调整仿真订阅topic
This commit is contained in:
parent
58dd1b5391
commit
bd6e252250
@ -5,7 +5,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
"joylink.club/bj-rtsts-server/config"
|
|
||||||
"joylink.club/bj-rtsts-server/message_server/ms_api"
|
"joylink.club/bj-rtsts-server/message_server/ms_api"
|
||||||
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
|
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
|
||||||
"joylink.club/bj-rtsts-server/ts/protos/state"
|
"joylink.club/bj-rtsts-server/ts/protos/state"
|
||||||
@ -26,7 +25,7 @@ func NewIBPMs(vs *memory.VerifySimulation, mapId int32) *IbpMs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ms *IbpMs) GetChannel() string {
|
func (ms *IbpMs) GetChannel() string {
|
||||||
return SimulationDeviceStatesTopicPrefix + "/ibp/%s"
|
return SimulationIbpTopic
|
||||||
// return "simulation-ibp-%s_%d_%s-status"
|
// return "simulation-ibp-%s_%d_%s-status"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,5 +163,5 @@ func (ms *IbpMs) collectIBPKeyState(stationUid string, ibpKeys []*graphicData.Ib
|
|||||||
|
|
||||||
// 处理订阅通道名称
|
// 处理订阅通道名称
|
||||||
func (ms *IbpMs) handlerIBPChannelName(stationId string) string {
|
func (ms *IbpMs) handlerIBPChannelName(stationId string) string {
|
||||||
return fmt.Sprintf(ms.GetChannel(), config.SystemName, ms.vs.SimulationId, ms.mapId, stationId)
|
return fmt.Sprintf(SimulationIbpTopic, ms.vs.SimulationId, ms.mapId, stationId)
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
"joylink.club/rtsssimulation/entity"
|
"joylink.club/rtsssimulation/entity"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
"joylink.club/bj-rtsts-server/config"
|
|
||||||
"joylink.club/bj-rtsts-server/message_server/ms_api"
|
"joylink.club/bj-rtsts-server/message_server/ms_api"
|
||||||
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
|
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
|
||||||
"joylink.club/bj-rtsts-server/ts/protos/state"
|
"joylink.club/bj-rtsts-server/ts/protos/state"
|
||||||
@ -27,7 +26,7 @@ func NewPSLMs(vs *memory.VerifySimulation, mapId int32) *PslMs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *PslMs) GetChannel() string {
|
func (p *PslMs) GetChannel() string {
|
||||||
return SimulationDeviceStatesTopicPrefix + "/psl/%s"
|
return SimulationPslTopic
|
||||||
// return "simulation-psl-%s_%d_%s-status"
|
// return "simulation-psl-%s_%d_%s-status"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ func (p *PslMs) OnError(err error) {}
|
|||||||
|
|
||||||
// 处理订阅通道名称
|
// 处理订阅通道名称
|
||||||
func (p *PslMs) handlerPSLChannelName(gateBoxId string) string {
|
func (p *PslMs) handlerPSLChannelName(gateBoxId string) string {
|
||||||
return fmt.Sprintf(p.GetChannel(), config.SystemName, p.vs.SimulationId, p.mapId, gateBoxId)
|
return fmt.Sprintf(SimulationPslTopic, p.vs.SimulationId, p.mapId, gateBoxId)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PslMs) collectGateBoxPSLState(box *graphicData.GatedBox) (*state.PushedDevicesStatus, error) {
|
func (p *PslMs) collectGateBoxPSLState(box *graphicData.GatedBox) (*state.PushedDevicesStatus, error) {
|
||||||
|
@ -24,7 +24,7 @@ func NewRccMs(vs *memory.VerifySimulation, mapId int32) *RccMs {
|
|||||||
return &RccMs{
|
return &RccMs{
|
||||||
vs: vs,
|
vs: vs,
|
||||||
mapId: mapId,
|
mapId: mapId,
|
||||||
channel: fmt.Sprintf(SimulationDeviceStatesTopicPrefix, vs.SimulationId, mapId),
|
channel: fmt.Sprintf(SimulationRccTopic, vs.SimulationId, mapId),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ func NewSfpMs(vs *memory.VerifySimulation, mapId int32) *SfpMs {
|
|||||||
return &SfpMs{
|
return &SfpMs{
|
||||||
vs: vs,
|
vs: vs,
|
||||||
mapId: mapId,
|
mapId: mapId,
|
||||||
channel: fmt.Sprintf(SimulationDeviceStatesTopicPrefix, vs.SimulationId, mapId),
|
channel: fmt.Sprintf(SimulationSfpTopic, vs.SimulationId, mapId),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,9 +12,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SimulationTopicPrefix = "/" + config.SystemName + "/simulation/"
|
SimulationTopicPrefix = "/" + config.SystemName + "/simulation/%s/"
|
||||||
SimulationStateTopicPrefix = SimulationTopicPrefix + "%s/state/%d"
|
// 仿真状态消息topic
|
||||||
SimulationDeviceStatesTopicPrefix = SimulationTopicPrefix + "%s/devicestates/%d"
|
SimulationStateTopic = SimulationTopicPrefix + "state"
|
||||||
|
// 信号布置图设备状态消息topic
|
||||||
|
SimulationSfpTopic = SimulationTopicPrefix + "sfp/%d"
|
||||||
|
// 继电器组合柜布置图设备状态消息topic
|
||||||
|
SimulationRccTopic = SimulationTopicPrefix + "rcc/%d"
|
||||||
|
// PSL设备状态消息topic
|
||||||
|
SimulationPslTopic = SimulationTopicPrefix + "psl/%d/%s"
|
||||||
|
// IBP设备状态消息topic
|
||||||
|
SimulationIbpTopic = SimulationTopicPrefix + "ibp/%d/%s"
|
||||||
)
|
)
|
||||||
|
|
||||||
var smsMap sync.Map
|
var smsMap sync.Map
|
||||||
|
@ -19,7 +19,7 @@ type SimulationStateMs struct {
|
|||||||
func NewSimulationStateMs(vs *memory.VerifySimulation) *SimulationStateMs {
|
func NewSimulationStateMs(vs *memory.VerifySimulation) *SimulationStateMs {
|
||||||
ms := &SimulationStateMs{
|
ms := &SimulationStateMs{
|
||||||
vs: vs,
|
vs: vs,
|
||||||
channel: fmt.Sprintf("simulation-%s-status", vs.SimulationId),
|
channel: fmt.Sprintf(SimulationStateTopic, vs.SimulationId),
|
||||||
}
|
}
|
||||||
ecs.WorldStateChangeEvent.Subscribe(ms.vs.World, func(_ ecs.World, e ecs.WorldStateChange) {
|
ecs.WorldStateChangeEvent.Subscribe(ms.vs.World, func(_ ecs.World, e ecs.WorldStateChange) {
|
||||||
switch e.NewState {
|
switch e.NewState {
|
||||||
|
Loading…
Reference in New Issue
Block a user