包调整

This commit is contained in:
xzb 2023-08-22 11:00:14 +08:00
parent bdf431001b
commit a6d5623908
22 changed files with 323 additions and 256 deletions

View File

@ -2,14 +2,14 @@ package components
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/state"
"joylink.club/rtsssimulation/cstate"
)
// 按钮状态组件
var ButtonStateComponent = ecs.NewComponentType[state.ButtonState]()
var ButtonStateComponent = ecs.NewComponentType[cstate.ButtonState]()
// 按钮操作组件
var ButtonPressOperatingComponent = ecs.NewComponentType[state.ButtonPressOperating]()
var ButtonPressOperatingComponent = ecs.NewComponentType[cstate.ButtonPressOperating]()
// 按钮确认组件
var ButtonConfirmOperatingComponent = ecs.NewComponentType[state.ButtonConfirmOperating]()
var ButtonConfirmOperatingComponent = ecs.NewComponentType[cstate.ButtonConfirmOperating]()

View File

@ -2,39 +2,39 @@ package components
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/state"
"joylink.club/rtsssimulation/cstate"
)
// 系统时钟组件
var SystemTimerComponent = ecs.NewComponentType[state.SystemTimer]()
var SystemTimerComponent = ecs.NewComponentType[cstate.SystemTimer]()
// 身份组件
var DeviceIdentityComponent = ecs.NewComponentType[state.DeviceIdentity]()
var DeviceIdentityComponent = ecs.NewComponentType[cstate.DeviceIdentity]()
// 持有实体标签的组件
var EntityTagHandlerComponent = ecs.NewComponentType[state.EntityTagHandler]()
var EntityTagHandlerComponent = ecs.NewComponentType[cstate.EntityTagHandler]()
// 百分比设备组件
var PercentageDeviceComponent = ecs.NewComponentType[state.PercentageDeviceState]()
var PercentageDeviceOperatingComponent = ecs.NewComponentType[state.PercentageDeviceOperating]()
var PercentageDeviceComponent = ecs.NewComponentType[cstate.PercentageDeviceState]()
var PercentageDeviceOperatingComponent = ecs.NewComponentType[cstate.PercentageDeviceOperating]()
// 道岔继电器状态组件
var SwitchRelayStateComponent = ecs.NewComponentType[state.SwitchRelayState]()
var SwitchRelayStateComponent = ecs.NewComponentType[cstate.SwitchRelayState]()
// 物理区段状态组件
var PhysicalSectionStateComponent = ecs.NewComponentType[state.PhysicalSectionState]()
var PhysicalSectionStateComponent = ecs.NewComponentType[cstate.PhysicalSectionState]()
// 信号机状态组件
var SignalStateComponent = ecs.NewComponentType[state.SignalState]()
var SignalStateComponent = ecs.NewComponentType[cstate.SignalState]()
// 信号机显示操作组件
var SignalDisplayOperatingComponent = ecs.NewComponentType[state.SignalDisplayOperating]()
var SignalDisplayOperatingComponent = ecs.NewComponentType[cstate.SignalDisplayOperating]()
// 站台单侧屏蔽门状态组件
var PsdStateComponent = ecs.NewComponentType[state.PsdState]()
var PsdStateComponent = ecs.NewComponentType[cstate.PsdState]()
// 应答器状态组件
var BaliseStateComponent = ecs.NewComponentType[state.BaliseState]()
var BaliseStateComponent = ecs.NewComponentType[cstate.BaliseState]()
// 列车状态组件
var TrainStateComponent = ecs.NewComponentType[state.TrainState]()
var TrainStateComponent = ecs.NewComponentType[cstate.TrainState]()

View File

@ -4,7 +4,7 @@
// protoc v4.23.1
// source: status.proto
package state
package cstate
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@ -425,7 +425,7 @@ type SignalState struct {
unknownFields protoimpl.UnknownFields
// 信号机显示状态
Display SignalAspect `protobuf:"varint,1,opt,name=display,proto3,enum=state.SignalAspect" json:"display,omitempty"`
Display SignalAspect `protobuf:"varint,1,opt,name=display,proto3,enum=cstate.SignalAspect" json:"display,omitempty"`
}
func (x *SignalState) Reset() {
@ -478,7 +478,7 @@ type SignalDisplayOperating struct {
// 执行操作剩余时长单位ms
OperateTime int64 `protobuf:"varint,2,opt,name=operateTime,proto3" json:"operateTime,omitempty"`
// 信号机目标显示
TargetAspect SignalAspect `protobuf:"varint,3,opt,name=targetAspect,proto3,enum=state.SignalAspect" json:"targetAspect,omitempty"`
TargetAspect SignalAspect `protobuf:"varint,3,opt,name=targetAspect,proto3,enum=cstate.SignalAspect" json:"targetAspect,omitempty"`
}
func (x *SignalDisplayOperating) Reset() {
@ -926,7 +926,7 @@ type TrainState struct {
unknownFields protoimpl.UnknownFields
// 列车激活端
ActiveHead TrainActiveEnum `protobuf:"varint,1,opt,name=activeHead,proto3,enum=state.TrainActiveEnum" json:"activeHead,omitempty"`
ActiveHead TrainActiveEnum `protobuf:"varint,1,opt,name=activeHead,proto3,enum=cstate.TrainActiveEnum" json:"activeHead,omitempty"`
// 列车所占的轨道位置列表
OccupiedLinks []*OccupiedLinkPosition `protobuf:"bytes,7,rep,name=occupiedLinks,proto3" json:"occupiedLinks,omitempty"`
}
@ -1163,115 +1163,115 @@ func (x *ButtonConfirmOperating) GetCancel() bool {
var File_status_proto protoreflect.FileDescriptor
var file_status_proto_rawDesc = []byte{
0x0a, 0x0c, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05,
0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x20, 0x0a, 0x0e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49,
0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x5a, 0x0a, 0x10, 0x53, 0x77, 0x69, 0x74, 0x63,
0x68, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x64,
0x63, 0x4a, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x64, 0x63, 0x4a, 0x12, 0x10, 0x0a,
0x03, 0x66, 0x63, 0x4a, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x66, 0x63, 0x4a, 0x12,
0x10, 0x0a, 0x03, 0x64, 0x62, 0x4a, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x64, 0x62,
0x4a, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x62, 0x4a, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03,
0x66, 0x62, 0x4a, 0x22, 0x32, 0x0a, 0x14, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x53,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6f,
0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f,
0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x22, 0x3c, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x61,
0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e,
0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x07, 0x64, 0x69,
0x73, 0x70, 0x6c, 0x61, 0x79, 0x22, 0x97, 0x01, 0x0a, 0x16, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c,
0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67,
0x12, 0x22, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x65,
0x72, 0x61, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54,
0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61,
0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x73,
0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63,
0x74, 0x52, 0x0c, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x22,
0x74, 0x0a, 0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61,
0x6c, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
0x61, 0x6c, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x6c,
0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x6c,
0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72,
0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01,
0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6c,
0x65, 0x61, 0x73, 0x65, 0x64, 0x22, 0x2b, 0x0a, 0x15, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74,
0x61, 0x67, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12,
0x0a, 0x04, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, 0x61,
0x74, 0x65, 0x22, 0xc1, 0x01, 0x0a, 0x19, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67,
0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67,
0x12, 0x10, 0x0a, 0x03, 0x74, 0x6f, 0x48, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x74,
0x6f, 0x48, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x68, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6c, 0x68, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e,
0x63, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x69, 0x74, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e,
0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x69, 0x6e, 0x69, 0x74, 0x44, 0x69,
0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x75, 0x6d, 0x44, 0x69, 0x73,
0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x75, 0x6d,
0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x72, 0x65, 0x6d, 0x61,
0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20,
0x01, 0x28, 0x03, 0x52, 0x11, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69,
0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x3d, 0x0a, 0x0b, 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65,
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x42,
0x61, 0x6c, 0x69, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f,
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x4d, 0x0a, 0x0d, 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x43,
0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f,
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e,
0x74, 0x65, 0x6e, 0x74, 0x22, 0x6e, 0x0a, 0x14, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64,
0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06,
0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x69,
0x6e, 0x6b, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x66, 0x66,
0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74,
0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x4f, 0x66, 0x66,
0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x4f, 0x66,
0x66, 0x73, 0x65, 0x74, 0x22, 0x87, 0x01, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74,
0x61, 0x74, 0x65, 0x12, 0x36, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e,
0x54, 0x72, 0x61, 0x69, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52,
0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x64, 0x12, 0x41, 0x0a, 0x0d, 0x6f,
0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4f, 0x63, 0x63, 0x75, 0x70,
0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52,
0x0d, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x22, 0x2b,
0x0a, 0x0b, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a,
0x09, 0x70, 0x72, 0x65, 0x73, 0x73, 0x44, 0x6f, 0x77, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
0x52, 0x09, 0x70, 0x72, 0x65, 0x73, 0x73, 0x44, 0x6f, 0x77, 0x6e, 0x22, 0x84, 0x01, 0x0a, 0x14,
0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x50, 0x72, 0x65, 0x73, 0x73, 0x4f, 0x70, 0x65, 0x72, 0x61,
0x74, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20,
0x01, 0x28, 0x08, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x6f,
0x77, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x20,
0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65,
0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x65, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x18,
0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x6e, 0x65, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69,
0x72, 0x6d, 0x22, 0x4a, 0x0a, 0x16, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66,
0x69, 0x72, 0x6d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07,
0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x63,
0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c,
0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x2a, 0x68,
0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03,
0x41, 0x6e, 0x79, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x10, 0x01, 0x12,
0x0a, 0x0a, 0x06, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x53,
0x69, 0x67, 0x6e, 0x61, 0x6c, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x73, 0x64, 0x10, 0x04,
0x12, 0x0b, 0x0a, 0x07, 0x50, 0x73, 0x64, 0x43, 0x65, 0x6c, 0x6c, 0x10, 0x05, 0x12, 0x0d, 0x0a,
0x09, 0x41, 0x78, 0x6c, 0x65, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x06, 0x12, 0x0a, 0x0a, 0x06,
0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x10, 0x07, 0x2a, 0x81, 0x01, 0x0a, 0x0c, 0x53, 0x69, 0x67,
0x6e, 0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x6f, 0x10,
0x00, 0x12, 0x05, 0x0a, 0x01, 0x52, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x47, 0x10, 0x02, 0x12,
0x05, 0x0a, 0x01, 0x59, 0x10, 0x03, 0x12, 0x05, 0x0a, 0x01, 0x57, 0x10, 0x04, 0x12, 0x05, 0x0a,
0x01, 0x42, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x59, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02,
0x52, 0x57, 0x10, 0x07, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x47, 0x10, 0x08, 0x12, 0x06, 0x0a, 0x02,
0x47, 0x59, 0x10, 0x09, 0x12, 0x06, 0x0a, 0x02, 0x59, 0x59, 0x10, 0x0a, 0x12, 0x06, 0x0a, 0x02,
0x52, 0x46, 0x10, 0x0b, 0x12, 0x06, 0x0a, 0x02, 0x59, 0x46, 0x10, 0x0c, 0x12, 0x06, 0x0a, 0x02,
0x47, 0x46, 0x10, 0x0d, 0x12, 0x06, 0x0a, 0x02, 0x57, 0x46, 0x10, 0x0e, 0x2a, 0x35, 0x0a, 0x0f,
0x54, 0x72, 0x61, 0x69, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12,
0x0a, 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, 0x5f, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x48,
0x45, 0x41, 0x44, 0x5f, 0x41, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, 0x5f,
0x42, 0x10, 0x02, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x0a, 0x0c, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06,
0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x20, 0x0a, 0x0e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x5a, 0x0a, 0x10, 0x53, 0x77, 0x69, 0x74,
0x63, 0x68, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03,
0x64, 0x63, 0x4a, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x64, 0x63, 0x4a, 0x12, 0x10,
0x0a, 0x03, 0x66, 0x63, 0x4a, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x66, 0x63, 0x4a,
0x12, 0x10, 0x0a, 0x03, 0x64, 0x62, 0x4a, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x64,
0x62, 0x4a, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x62, 0x4a, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52,
0x03, 0x66, 0x62, 0x4a, 0x22, 0x32, 0x0a, 0x14, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c,
0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08,
0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08,
0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x22, 0x3d, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e,
0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x64, 0x69, 0x73, 0x70, 0x6c,
0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74,
0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x07,
0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x22, 0x98, 0x01, 0x0a, 0x16, 0x53, 0x69, 0x67, 0x6e,
0x61, 0x6c, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
0x6e, 0x67, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61,
0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f,
0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x70, 0x65,
0x72, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x0c, 0x74, 0x61, 0x72, 0x67,
0x65, 0x74, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14,
0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41, 0x73,
0x70, 0x65, 0x63, 0x74, 0x52, 0x0c, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x41, 0x73, 0x70, 0x65,
0x63, 0x74, 0x22, 0x74, 0x0a, 0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1c,
0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x08, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09,
0x61, 0x6c, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52,
0x09, 0x61, 0x6c, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6e,
0x74, 0x65, 0x72, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x18,
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6c, 0x6f, 0x63, 0x6b,
0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x22, 0x2b, 0x0a, 0x15, 0x50, 0x65, 0x72, 0x63,
0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74,
0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x04, 0x72, 0x61, 0x74, 0x65, 0x22, 0xc1, 0x01, 0x0a, 0x19, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e,
0x74, 0x61, 0x67, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74,
0x69, 0x6e, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x6f, 0x48, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
0x52, 0x03, 0x74, 0x6f, 0x48, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x68, 0x44, 0x69, 0x73, 0x74, 0x61,
0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6c, 0x68, 0x44, 0x69, 0x73,
0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x69, 0x74, 0x44, 0x69, 0x73,
0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x69, 0x6e, 0x69,
0x74, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x75, 0x6d,
0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b,
0x73, 0x75, 0x6d, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x72,
0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, 0x6e,
0x67, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x3e, 0x0a, 0x0b, 0x42, 0x61, 0x6c,
0x69, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74,
0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x73, 0x74, 0x61,
0x74, 0x65, 0x2e, 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x4d, 0x0a, 0x0d, 0x42, 0x61, 0x6c,
0x69, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79,
0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18,
0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52,
0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x6e, 0x0a, 0x14, 0x4f, 0x63, 0x63, 0x75,
0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x16, 0x0a, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72,
0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73,
0x74, 0x61, 0x72, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e,
0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65,
0x6e, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0x89, 0x01, 0x0a, 0x0a, 0x54, 0x72, 0x61,
0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76,
0x65, 0x48, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x63, 0x73,
0x74, 0x61, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65,
0x45, 0x6e, 0x75, 0x6d, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x64,
0x12, 0x42, 0x0a, 0x0d, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b,
0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65,
0x2e, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x6f, 0x73,
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c,
0x69, 0x6e, 0x6b, 0x73, 0x22, 0x2b, 0x0a, 0x0b, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74,
0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x73, 0x73, 0x44, 0x6f, 0x77, 0x6e,
0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x70, 0x72, 0x65, 0x73, 0x73, 0x44, 0x6f, 0x77,
0x6e, 0x22, 0x84, 0x01, 0x0a, 0x14, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x50, 0x72, 0x65, 0x73,
0x73, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74,
0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74,
0x12, 0x12, 0x0a, 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04,
0x64, 0x6f, 0x77, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54,
0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61,
0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x65, 0x65, 0x64, 0x43, 0x6f,
0x6e, 0x66, 0x69, 0x72, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x6e, 0x65, 0x65,
0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x22, 0x4a, 0x0a, 0x16, 0x42, 0x75, 0x74, 0x74,
0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x18, 0x01, 0x20,
0x01, 0x28, 0x08, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x12, 0x16, 0x0a, 0x06,
0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x61,
0x6e, 0x63, 0x65, 0x6c, 0x2a, 0x68, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x6e, 0x79, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4c,
0x69, 0x6e, 0x6b, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x10,
0x02, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x10, 0x03, 0x12, 0x07, 0x0a,
0x03, 0x50, 0x73, 0x64, 0x10, 0x04, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x73, 0x64, 0x43, 0x65, 0x6c,
0x6c, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x78, 0x6c, 0x65, 0x50, 0x6f, 0x69, 0x6e, 0x74,
0x10, 0x06, 0x12, 0x0a, 0x0a, 0x06, 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x10, 0x07, 0x2a, 0x81,
0x01, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x12,
0x06, 0x0a, 0x02, 0x4e, 0x6f, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x52, 0x10, 0x01, 0x12, 0x05,
0x0a, 0x01, 0x47, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x59, 0x10, 0x03, 0x12, 0x05, 0x0a, 0x01,
0x57, 0x10, 0x04, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x59,
0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x57, 0x10, 0x07, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x47,
0x10, 0x08, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x59, 0x10, 0x09, 0x12, 0x06, 0x0a, 0x02, 0x59, 0x59,
0x10, 0x0a, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x46, 0x10, 0x0b, 0x12, 0x06, 0x0a, 0x02, 0x59, 0x46,
0x10, 0x0c, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x46, 0x10, 0x0d, 0x12, 0x06, 0x0a, 0x02, 0x57, 0x46,
0x10, 0x0e, 0x2a, 0x35, 0x0a, 0x0f, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x76,
0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0a, 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, 0x5f, 0x4e, 0x10,
0x00, 0x12, 0x0a, 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, 0x5f, 0x41, 0x10, 0x01, 0x12, 0x0a, 0x0a,
0x06, 0x48, 0x45, 0x41, 0x44, 0x5f, 0x42, 0x10, 0x02, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x63,
0x73, 0x74, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1289,31 +1289,31 @@ func file_status_proto_rawDescGZIP() []byte {
var file_status_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_status_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_status_proto_goTypes = []interface{}{
(DeviceType)(0), // 0: state.DeviceType
(SignalAspect)(0), // 1: state.SignalAspect
(TrainActiveEnum)(0), // 2: state.TrainActiveEnum
(*DeviceIdentity)(nil), // 3: state.DeviceIdentity
(*SwitchRelayState)(nil), // 4: state.SwitchRelayState
(*PhysicalSectionState)(nil), // 5: state.PhysicalSectionState
(*SignalState)(nil), // 6: state.SignalState
(*SignalDisplayOperating)(nil), // 7: state.SignalDisplayOperating
(*PsdState)(nil), // 8: state.PsdState
(*PercentageDeviceState)(nil), // 9: state.PercentageDeviceState
(*PercentageDeviceOperating)(nil), // 10: state.PercentageDeviceOperating
(*BaliseState)(nil), // 11: state.BaliseState
(*BaliseContent)(nil), // 12: state.BaliseContent
(*OccupiedLinkPosition)(nil), // 13: state.OccupiedLinkPosition
(*TrainState)(nil), // 14: state.TrainState
(*ButtonState)(nil), // 15: state.ButtonState
(*ButtonPressOperating)(nil), // 16: state.ButtonPressOperating
(*ButtonConfirmOperating)(nil), // 17: state.ButtonConfirmOperating
(DeviceType)(0), // 0: cstate.DeviceType
(SignalAspect)(0), // 1: cstate.SignalAspect
(TrainActiveEnum)(0), // 2: cstate.TrainActiveEnum
(*DeviceIdentity)(nil), // 3: cstate.DeviceIdentity
(*SwitchRelayState)(nil), // 4: cstate.SwitchRelayState
(*PhysicalSectionState)(nil), // 5: cstate.PhysicalSectionState
(*SignalState)(nil), // 6: cstate.SignalState
(*SignalDisplayOperating)(nil), // 7: cstate.SignalDisplayOperating
(*PsdState)(nil), // 8: cstate.PsdState
(*PercentageDeviceState)(nil), // 9: cstate.PercentageDeviceState
(*PercentageDeviceOperating)(nil), // 10: cstate.PercentageDeviceOperating
(*BaliseState)(nil), // 11: cstate.BaliseState
(*BaliseContent)(nil), // 12: cstate.BaliseContent
(*OccupiedLinkPosition)(nil), // 13: cstate.OccupiedLinkPosition
(*TrainState)(nil), // 14: cstate.TrainState
(*ButtonState)(nil), // 15: cstate.ButtonState
(*ButtonPressOperating)(nil), // 16: cstate.ButtonPressOperating
(*ButtonConfirmOperating)(nil), // 17: cstate.ButtonConfirmOperating
}
var file_status_proto_depIdxs = []int32{
1, // 0: state.SignalState.display:type_name -> state.SignalAspect
1, // 1: state.SignalDisplayOperating.targetAspect:type_name -> state.SignalAspect
12, // 2: state.BaliseState.content:type_name -> state.BaliseContent
2, // 3: state.TrainState.activeHead:type_name -> state.TrainActiveEnum
13, // 4: state.TrainState.occupiedLinks:type_name -> state.OccupiedLinkPosition
1, // 0: cstate.SignalState.display:type_name -> cstate.SignalAspect
1, // 1: cstate.SignalDisplayOperating.targetAspect:type_name -> cstate.SignalAspect
12, // 2: cstate.BaliseState.content:type_name -> cstate.BaliseContent
2, // 3: cstate.TrainState.activeHead:type_name -> cstate.TrainActiveEnum
13, // 4: cstate.TrainState.occupiedLinks:type_name -> cstate.OccupiedLinkPosition
5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name

View File

@ -1,4 +1,4 @@
package state
package cstate
import (
"time"

View File

@ -6,18 +6,19 @@ import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/components"
"joylink.club/rtsssimulation/cstate"
"joylink.club/rtsssimulation/memory"
"joylink.club/rtsssimulation/memory/wdcreator"
"joylink.club/rtsssimulation/model"
"joylink.club/rtsssimulation/state"
"joylink.club/rtsssimulation/system"
)
func testModel() {
link1 := model.NewLinkModel("link1")
link2 := model.NewLinkModel("link2")
memory.AddModel(link1)
memory.AddModel(link2)
memory.ForEachModelsByType(state.DeviceType_Link, func(md memory.ModelData) {
memory.DeviceModelStorage.AddModel(link1)
memory.DeviceModelStorage.AddModel(link2)
memory.DeviceModelStorage.ForEachModelsByType(cstate.DeviceType_Link, func(md memory.ModelData) {
link := md.(*model.LinkModel)
fmt.Println("==>>", link.Id)
})
@ -26,7 +27,7 @@ func main() {
world := ecs.NewWorld(300)
worlTime := time.Now()
//外界与world交互的门面
face := memory.InitializeWorld(world, worlTime)
face := wdcreator.InitializeWorld(world, worlTime)
//
initDevicesStatus(world)
//
@ -86,31 +87,31 @@ func testSwitchTurn(world ecs.World, face *system.FaceSystem) {
}
func testSignalOpt(world ecs.World, face *system.FaceSystem) {
face.Call(func(w ecs.World) any {
return system.SetSignalDisplay(w, "siganl1", state.SignalAspect_B)
return system.SetSignalDisplay(w, "siganl1", cstate.SignalAspect_B)
})
}
// ////////////////////////////////////////////////////////////////////////
func initDevicesStatus(world ecs.World) {
//当组件未显式set值时world会初始化组件的零值
switch1Entry := memory.CreateSwitchEntity(world)
components.DeviceIdentityComponent.Set(switch1Entry, &state.DeviceIdentity{Id: "switch1"})
components.SwitchRelayStateComponent.Set(switch1Entry, &state.SwitchRelayState{DcJ: false, FcJ: false, DbJ: true, FbJ: false})
components.PercentageDeviceComponent.Set(switch1Entry, &state.PercentageDeviceState{Rate: system.SwitchNormalRate})
switch1Entry := wdcreator.CreateSwitchEntity(world)
components.DeviceIdentityComponent.Set(switch1Entry, &cstate.DeviceIdentity{Id: "switch1"})
components.SwitchRelayStateComponent.Set(switch1Entry, &cstate.SwitchRelayState{DcJ: false, FcJ: false, DbJ: true, FbJ: false})
components.PercentageDeviceComponent.Set(switch1Entry, &cstate.PercentageDeviceState{Rate: system.SwitchNormalRate})
//
signal1Entry := memory.CreateSignalEntity(world)
components.DeviceIdentityComponent.Set(signal1Entry, &state.DeviceIdentity{Id: "siganl1"})
components.SignalStateComponent.Set(signal1Entry, &state.SignalState{Display: state.SignalAspect_No})
signal1Entry := wdcreator.CreateSignalEntity(world)
components.DeviceIdentityComponent.Set(signal1Entry, &cstate.DeviceIdentity{Id: "siganl1"})
components.SignalStateComponent.Set(signal1Entry, &cstate.SignalState{Display: cstate.SignalAspect_No})
//psd1两个cell
psd1Entry := memory.CreatePsdEntity(world)
components.DeviceIdentityComponent.Set(psd1Entry, &state.DeviceIdentity{Id: "psd1"})
components.PsdStateComponent.Set(psd1Entry, &state.PsdState{AllClosed: true, AllOpened: false, InterlockReleased: false})
psd1Cell1Entry := memory.CreatePsdCellEntity(world, psd1Entry)
components.DeviceIdentityComponent.Set(psd1Cell1Entry, &state.DeviceIdentity{Id: "psd1Cell1"})
components.PercentageDeviceComponent.Set(psd1Cell1Entry, &state.PercentageDeviceState{Rate: system.PsdCellWholeCloseRate})
psd1Cell2Entry := memory.CreatePsdCellEntity(world, psd1Entry)
components.DeviceIdentityComponent.Set(psd1Cell2Entry, &state.DeviceIdentity{Id: "psd1Cell2"})
components.PercentageDeviceComponent.Set(psd1Cell2Entry, &state.PercentageDeviceState{Rate: system.PsdCellWholeCloseRate})
psd1Entry := wdcreator.CreatePsdEntity(world)
components.DeviceIdentityComponent.Set(psd1Entry, &cstate.DeviceIdentity{Id: "psd1"})
components.PsdStateComponent.Set(psd1Entry, &cstate.PsdState{AllClosed: true, AllOpened: false, InterlockReleased: false})
psd1Cell1Entry := wdcreator.CreatePsdCellEntity(world, psd1Entry)
components.DeviceIdentityComponent.Set(psd1Cell1Entry, &cstate.DeviceIdentity{Id: "psd1Cell1"})
components.PercentageDeviceComponent.Set(psd1Cell1Entry, &cstate.PercentageDeviceState{Rate: system.PsdCellWholeCloseRate})
psd1Cell2Entry := wdcreator.CreatePsdCellEntity(world, psd1Entry)
components.DeviceIdentityComponent.Set(psd1Cell2Entry, &cstate.DeviceIdentity{Id: "psd1Cell2"})
components.PercentageDeviceComponent.Set(psd1Cell2Entry, &cstate.PercentageDeviceState{Rate: system.PsdCellWholeCloseRate})
}
func initSystems(world ecs.World) {

View File

@ -3,47 +3,51 @@ package memory
import (
"fmt"
"joylink.club/rtsssimulation/model"
"joylink.club/rtsssimulation/state"
"joylink.club/rtsssimulation/cstate"
"joylink.club/rtsssimulation/umi"
)
// 仿真模型数据定义
type ModelData = model.IDeviceModel
type ModelData = umi.IDeviceModel
// 仿真模型数据仓库
// 所有仿真实例共用
var storage *modelStorage = &modelStorage{idModelMap: make(map[string]ModelData, 2048), typeModelMap: make(map[state.DeviceType][]ModelData, 128)}
var DeviceModelStorage *ModelStorage = newModelStorage()
// 模型存储、管理仓库
type modelStorage struct {
type ModelStorage struct {
//key-模型id,value-模型指针
idModelMap map[string]ModelData
//key-设备类型value-对应设备类型的所有模型数据的指针列表
typeModelMap map[state.DeviceType][]ModelData
typeModelMap map[cstate.DeviceType][]ModelData
}
func newModelStorage() *ModelStorage {
return &ModelStorage{idModelMap: make(map[string]ModelData, 2048), typeModelMap: make(map[cstate.DeviceType][]ModelData, 128)}
}
// 添加模型数据
// m 为具体模型数据的指针
func AddModel(m ModelData) error {
_, ok := storage.idModelMap[m.GetId()]
func (me *ModelStorage) AddModel(m ModelData) error {
_, ok := me.idModelMap[m.GetId()]
if ok {
return fmt.Errorf("模型[%s]已经存在", m.GetId())
} else {
storage.idModelMap[m.GetId()] = m
me.idModelMap[m.GetId()] = m
//
_, mdOk := storage.typeModelMap[m.GetType()]
_, mdOk := me.typeModelMap[m.GetType()]
if !mdOk {
storage.typeModelMap[m.GetType()] = make([]ModelData, 0, 512)
me.typeModelMap[m.GetType()] = make([]ModelData, 0, 512)
}
storage.typeModelMap[m.GetType()] = append(storage.typeModelMap[m.GetType()], m)
me.typeModelMap[m.GetType()] = append(me.typeModelMap[m.GetType()], m)
//
return nil
}
}
// 根据设备类型获取该类型的所有设备数据
func FindModelsByType(deviceType state.DeviceType) []ModelData {
models, ok := storage.typeModelMap[deviceType]
func (me *ModelStorage) FindModelsByType(deviceType cstate.DeviceType) []ModelData {
models, ok := me.typeModelMap[deviceType]
if ok {
return models
} else {
@ -53,8 +57,8 @@ func FindModelsByType(deviceType state.DeviceType) []ModelData {
// 根据设备id获取对应模型数据
// 如果不存在返回nil
func FindModelById(id string) ModelData {
md, ok := storage.idModelMap[id]
func (me *ModelStorage) FindModelById(id string) ModelData {
md, ok := me.idModelMap[id]
if ok {
return md
} else {
@ -63,23 +67,23 @@ func FindModelById(id string) ModelData {
}
// 遍历某个类型的所有设备
func ForEachModelsByType(deviceType state.DeviceType, callback func(md ModelData)) {
mds := FindModelsByType(deviceType)
func (me *ModelStorage) ForEachModelsByType(deviceType cstate.DeviceType, callback func(md ModelData)) {
mds := me.FindModelsByType(deviceType)
for _, modelData := range mds {
callback(modelData)
}
}
// 根据id检测设备模型数据是否存在
func HasModelById(id string) bool {
_, ok := storage.idModelMap[id]
func (me *ModelStorage) HasModelById(id string) bool {
_, ok := me.idModelMap[id]
return ok
}
// 获取当前模型数据总数量
func AmountOfModels() int {
return len(storage.idModelMap)
func (me *ModelStorage) AmountOfModels() int {
return len(me.idModelMap)
}
func AmountOfDeviceTypes() int {
return len(storage.typeModelMap)
func (me *ModelStorage) AmountOfDeviceTypes() int {
return len(me.typeModelMap)
}

View File

@ -3,7 +3,7 @@ package memory
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/components"
"joylink.club/rtsssimulation/state"
"joylink.club/rtsssimulation/cstate"
)
//收集实体组件状态生成设备状态
@ -24,6 +24,7 @@ type StateCompareMethod func(preState DeviceState, curState DeviceState) bool
// 设备状态仓库定义
type StatusStorage struct {
modelStorage *ModelStorage
//当前状态
//key-设备id,value-状态数据指针
idCurStateMap map[string]DeviceState
@ -31,44 +32,51 @@ type StatusStorage struct {
//key-设备id,value-状态数据指针
idPreStateMap map[string]DeviceState
//设备类型到设备实体转换为设备状态的方法的映射
entityToStateMethodMap map[state.DeviceType]*EntityToStateMethod
entityToStateMethodMap map[cstate.DeviceType]*EntityToStateMethod
//生成对应类型设备的状态的副本的方法的映射
stateCopyMethodMap map[state.DeviceType]*StateCopyMethod
stateCopyMethodMap map[cstate.DeviceType]*StateCopyMethod
//当前时刻设备状态与前一刻设备状态比较的方法映射
stateCompareMethodMap map[state.DeviceType]*StateCompareMethod
stateCompareMethodMap map[cstate.DeviceType]*StateCompareMethod
}
func NewStatusStorage() *StatusStorage {
modelsAmount := AmountOfModels()
typesAmount := AmountOfDeviceTypes()
dms := DeviceModelStorage
modelsAmount := dms.AmountOfModels()
typesAmount := dms.AmountOfDeviceTypes()
return &StatusStorage{
modelStorage: dms,
idCurStateMap: make(map[string]DeviceState, modelsAmount),
idPreStateMap: make(map[string]DeviceState, modelsAmount),
entityToStateMethodMap: make(map[state.DeviceType]*EntityToStateMethod, typesAmount),
stateCopyMethodMap: make(map[state.DeviceType]*StateCopyMethod, typesAmount),
stateCompareMethodMap: make(map[state.DeviceType]*StateCompareMethod, typesAmount),
entityToStateMethodMap: make(map[cstate.DeviceType]*EntityToStateMethod, typesAmount),
stateCopyMethodMap: make(map[cstate.DeviceType]*StateCopyMethod, typesAmount),
stateCompareMethodMap: make(map[cstate.DeviceType]*StateCompareMethod, typesAmount),
}
}
// 从实体运行时生成对应设备状态
func (me *StatusStorage) AddStateFromEntity(entry *ecs.Entry) {
id := components.DeviceIdentityComponent.Get(entry).Id
deviceModel := FindModelById(id)
deviceModel := me.modelStorage.FindModelById(id)
deviceState := (*me.entityToStateMethodMap[deviceModel.GetType()])(entry)
me.idCurStateMap[id] = deviceState
}
// 添加从设备实体生成状态的方法
func (me *StatusStorage) InitEntityToStateMethod(deviceType state.DeviceType, method *EntityToStateMethod) {
func (me *StatusStorage) InitEntityToStateMethod(deviceType cstate.DeviceType, method *EntityToStateMethod) {
me.entityToStateMethodMap[deviceType] = method
}
// 添加生成对应类型设备的状态的副本的方法
func (me *StatusStorage) InitStateCopyMethod(deviceType state.DeviceType, method *StateCopyMethod) {
func (me *StatusStorage) InitStateCopyMethod(deviceType cstate.DeviceType, method *StateCopyMethod) {
me.stateCopyMethodMap[deviceType] = method
}
// 添加当前时刻设备状态与前一刻设备状态比较的方法
func (me *StatusStorage) InitStateCompareMethod(deviceType state.DeviceType, method *StateCompareMethod) {
func (me *StatusStorage) InitStateCompareMethod(deviceType cstate.DeviceType, method *StateCompareMethod) {
me.stateCompareMethodMap[deviceType] = method
}
// 获取模型仓库
func (me *StatusStorage) ModelStorage() *ModelStorage {
return me.modelStorage
}

View File

@ -1,11 +1,11 @@
package memory
package wdcreator
import (
"time"
"joylink.club/ecs"
"joylink.club/rtsssimulation/components"
"joylink.club/rtsssimulation/state"
"joylink.club/rtsssimulation/cstate"
"joylink.club/rtsssimulation/system"
)
@ -13,7 +13,7 @@ import (
func InitializeWorld(w ecs.World, worldTime time.Time) *system.FaceSystem {
//初始化world时钟
timeEntry := w.Create(components.SystemTimerComponent)
components.SystemTimerComponent.Set(timeEntry, state.NewSystemTimer(&worldTime))
components.SystemTimerComponent.Set(timeEntry, cstate.NewSystemTimer(&worldTime))
w.AddSystem(system.NewTimerSystem())
//初始化world与外界交互的门面
faceSystem := system.NewFaceSystem(w)
@ -44,7 +44,7 @@ func CreatePhysicalSectionEntity(w ecs.World) *ecs.Entry {
// 创建站台单侧屏蔽门实体
func CreatePsdEntity(w ecs.World) *ecs.Entry {
e := w.Create(components.DeviceIdentityComponent, components.PsdStateComponent, components.EntityTagHandlerComponent)
components.EntityTagHandlerComponent.Set(e, &state.EntityTagHandler{Tag: ecs.NewComponentType[struct{}]()})
components.EntityTagHandlerComponent.Set(e, &cstate.EntityTagHandler{Tag: ecs.NewComponentType[struct{}]()})
return e
}

View File

@ -1,6 +1,6 @@
package model
import "joylink.club/rtsssimulation/state"
import "joylink.club/rtsssimulation/cstate"
//计轴检测点模型
type AxlePointModel struct {
@ -10,5 +10,5 @@ type AxlePointModel struct {
}
func NewAxlePointModel(id string) *AxlePointModel {
return &AxlePointModel{DeviceModel: DeviceModel{Id: id, Type: state.DeviceType_AxlePoint}}
return &AxlePointModel{DeviceModel: DeviceModel{Id: id, Type: cstate.DeviceType_AxlePoint}}
}

View File

@ -1,6 +1,6 @@
package model
import "joylink.club/rtsssimulation/state"
import "joylink.club/rtsssimulation/cstate"
// 应答器
type BaliseModel struct {
@ -10,5 +10,5 @@ type BaliseModel struct {
}
func NewBaliseModel(id string) *BaliseModel {
return &BaliseModel{DeviceModel: DeviceModel{Id: id, Type: state.DeviceType_Balise}}
return &BaliseModel{DeviceModel: DeviceModel{Id: id, Type: cstate.DeviceType_Balise}}
}

View File

@ -1,28 +1,25 @@
package model
import "joylink.club/rtsssimulation/state"
type IDeviceModel interface {
GetId() string
IsSame(other IDeviceModel) bool
GetType() state.DeviceType
}
import (
"joylink.club/rtsssimulation/cstate"
"joylink.club/rtsssimulation/umi"
)
// 设备模型基础信息
type DeviceModel struct {
// 设备id
Id string
// 设备类型
Type state.DeviceType
Type cstate.DeviceType
}
func (me *DeviceModel) GetId() string {
return me.Id
}
func (me *DeviceModel) IsSame(other IDeviceModel) bool {
func (me *DeviceModel) IsSame(other umi.IDeviceModel) bool {
return me.Id == other.GetId()
}
func (me *DeviceModel) GetType() state.DeviceType {
func (me *DeviceModel) GetType() cstate.DeviceType {
return me.Type
}

View File

@ -1,6 +1,6 @@
package model
import "joylink.club/rtsssimulation/state"
import "joylink.club/rtsssimulation/cstate"
//长轨道,道岔端点间的轨道
type LinkModel struct {
@ -12,7 +12,7 @@ type LinkModel struct {
}
func NewLinkModel(id string) *LinkModel {
return &LinkModel{DeviceModel: DeviceModel{Id: id, Type: state.DeviceType_Link}}
return &LinkModel{DeviceModel: DeviceModel{Id: id, Type: cstate.DeviceType_Link}}
}
//轨道端口引用

View File

@ -1,33 +1,41 @@
package model
import "joylink.club/rtsssimulation/state"
import (
"joylink.club/rtsssimulation/cstate"
"joylink.club/rtsssimulation/umi"
)
//站台一侧屏蔽门模型
// 站台一侧屏蔽门模型
type PsdModel struct {
DeviceModel
//屏蔽门所包含的单元
Cells []*PsdCellModel
//屏蔽门移动从0-100耗时单位ms
MoveTime int64
}
func NewPsdModel(id string) *PsdModel {
return &PsdModel{DeviceModel: DeviceModel{Id: id, Type: state.DeviceType_Psd}, Cells: make([]*PsdCellModel, 0)}
return &PsdModel{DeviceModel: DeviceModel{Id: id, Type: cstate.DeviceType_Psd}, Cells: make([]*PsdCellModel, 0)}
}
func (me *PsdModel) AddCell(cell *PsdCellModel) {
me.Cells = append(me.Cells, cell)
}
func (me *PsdModel) MovingTime() int64 {
return me.MoveTime
}
/////////////////////////////////////////////
//站台一侧屏蔽门单元模型
// 站台一侧屏蔽门单元模型
type PsdCellModel struct {
DeviceModel
//该屏蔽门单元所属的屏蔽门
psd IDeviceModel
psd umi.IDeviceModel
}
func NewPsdCellModel(id string, psdModel *PsdModel) *PsdCellModel {
return &PsdCellModel{
DeviceModel: DeviceModel{Id: id, Type: state.DeviceType_PsdCell},
DeviceModel: DeviceModel{Id: id, Type: cstate.DeviceType_PsdCell},
psd: psdModel,
}
}

View File

@ -1,6 +1,6 @@
package model
import "joylink.club/rtsssimulation/state"
import "joylink.club/rtsssimulation/cstate"
// 信号机
type SignalModel struct {
@ -8,11 +8,11 @@ type SignalModel struct {
//信号机所在轨道
LinkOffset *LinkOffsetRef
//信号机类型,出厂已确定,即几个色灯、排列顺序
Type state.SignalAspect
Type cstate.SignalAspect
//默认显示信号
DefaultDisplay state.SignalAspect
DefaultDisplay cstate.SignalAspect
}
func NewSignalModel(id string) *SignalModel {
return &SignalModel{DeviceModel: DeviceModel{Id: id, Type: state.DeviceType_Signal}}
return &SignalModel{DeviceModel: DeviceModel{Id: id, Type: cstate.DeviceType_Signal}}
}

View File

@ -1,6 +1,6 @@
package model
import "joylink.club/rtsssimulation/state"
import "joylink.club/rtsssimulation/cstate"
//道岔
type SwitchModel struct {
@ -15,6 +15,10 @@ type SwitchModel struct {
TurnTime int64
}
func (me *SwitchModel) TurningTime() int64 {
return me.TurnTime
}
//道岔端口引用
type SwitchPortRef struct {
Switch *SwitchModel
@ -23,5 +27,5 @@ type SwitchPortRef struct {
}
func NewSwitchModel(id string) *SwitchModel {
return &SwitchModel{DeviceModel: DeviceModel{Id: id, Type: state.DeviceType_Switch}}
return &SwitchModel{DeviceModel: DeviceModel{Id: id, Type: cstate.DeviceType_Switch}}
}

View File

@ -1,6 +1,8 @@
syntax = "proto3";
package state;
option go_package = "./state";
package cstate;
option go_package = "./cstate";
//仿ecs组件相关定义
//
message DeviceIdentity{

View File

@ -4,7 +4,7 @@ import (
"github.com/yohamta/donburi/filter"
"joylink.club/ecs"
"joylink.club/rtsssimulation/components"
"joylink.club/rtsssimulation/state"
"joylink.club/rtsssimulation/cstate"
)
// 应答器查询
@ -30,7 +30,7 @@ func (me *BaliseSystem) Update(w ecs.World) {
// 发送消息到应答器
// 当要清空应答器中报文时,则message=nil
func SendMessageToTransponder(world ecs.World, transponderId string, message *state.BaliseContent) bool {
func SendMessageToTransponder(world ecs.World, transponderId string, message *cstate.BaliseContent) bool {
var transponderEntry *ecs.Entry = nil
baliseQuery.Each(world, func(e *ecs.Entry) {
if transponderId == components.DeviceIdentityComponent.Get(e).Id {

View File

@ -6,7 +6,7 @@ import (
"github.com/yohamta/donburi/filter"
"joylink.club/ecs"
"joylink.club/rtsssimulation/components"
"joylink.club/rtsssimulation/state"
"joylink.club/rtsssimulation/cstate"
)
// 百分比设备系统
@ -70,7 +70,7 @@ func FirePercentageDeviceOperation(w ecs.World, deviceEntry *ecs.Entry, lhDistan
sumDistance = int64(float64(lhDistance) * (float64(curRate-toRate) / float64(100)))
}
//
*operation = state.PercentageDeviceOperating{
*operation = cstate.PercentageDeviceOperating{
ToH: toHigh,
LhDistance: lhDistance,
InitDistance: initDistance,

View File

@ -6,7 +6,9 @@ import (
"github.com/yohamta/donburi/filter"
"joylink.club/ecs"
"joylink.club/rtsssimulation/components"
"joylink.club/rtsssimulation/state"
"joylink.club/rtsssimulation/cstate"
"joylink.club/rtsssimulation/memory"
"joylink.club/rtsssimulation/umi"
)
var psdQuery = ecs.NewQuery(filter.Contains(components.DeviceIdentityComponent, components.PsdStateComponent, components.EntityTagHandlerComponent))
@ -19,11 +21,11 @@ const (
)
type PsdSystem struct {
cellsQuery map[state.EntityTag]*ecs.Query
cellsQuery map[cstate.EntityTag]*ecs.Query
}
func NewPsdSystem() *PsdSystem {
return &PsdSystem{cellsQuery: make(map[state.EntityTag]*ecs.Query)}
return &PsdSystem{cellsQuery: make(map[cstate.EntityTag]*ecs.Query)}
}
// world 执行
@ -129,5 +131,11 @@ func findPsdEntry(world ecs.World, psdId string) (*ecs.Entry, error) {
// 获取屏蔽门从完全开到完全关所需时间单位ms
func findPsdWholeMoveTime(psdId string) int64 {
psd := memory.DeviceModelStorage.FindModelById(psdId)
if nil != psd {
psdUmi := psd.(umi.IPsdModel)
return psdUmi.MovingTime()
}
//默认值
return 4000
}

View File

@ -6,7 +6,7 @@ import (
"github.com/yohamta/donburi/filter"
"joylink.club/ecs"
"joylink.club/rtsssimulation/components"
"joylink.club/rtsssimulation/state"
"joylink.club/rtsssimulation/cstate"
)
type SignalSystem struct {
@ -25,7 +25,7 @@ func NewSignalSystem() *SignalSystem {
// 设置某个信号机的显示
// 返回值true-设置成功false-设置失败
func SetSignalDisplay(w ecs.World, signalId string, display state.SignalAspect) error {
func SetSignalDisplay(w ecs.World, signalId string, display cstate.SignalAspect) error {
signalEntry, err := findSignalEntry(w, signalId)
if err != nil {
return err

View File

@ -6,6 +6,8 @@ import (
"github.com/yohamta/donburi/filter"
"joylink.club/ecs"
"joylink.club/rtsssimulation/components"
"joylink.club/rtsssimulation/memory"
"joylink.club/rtsssimulation/umi"
)
var switchQuery *ecs.Query = ecs.NewQuery(filter.Contains(components.DeviceIdentityComponent, components.SwitchRelayStateComponent, components.PercentageDeviceComponent))
@ -83,5 +85,11 @@ func (me *SwitchSystem) Update(w ecs.World) {
// 获取道岔转动耗时ms
func getSwitchTurnTime(switchId string) int64 {
dcModel := memory.DeviceModelStorage.FindModelById(switchId)
if nil != dcModel {
var dc umi.ISwitchModel = dcModel.(umi.ISwitchModel)
return dc.TurningTime()
}
//不存在返回默认值
return 5000
}

27
umi/model_umi.go Normal file
View File

@ -0,0 +1,27 @@
package umi
import "joylink.club/rtsssimulation/cstate"
// 用户设备模型与仿真底层设备交互定义
// 仿真底层设备模型定义
// 用户所有设备模型定义须实现该接口
type IDeviceModel interface {
GetId() string
IsSame(other IDeviceModel) bool
GetType() cstate.DeviceType
}
// 仿真底层道岔模型
// 用户所有道岔模型定义须实现该接口
type ISwitchModel interface {
//道岔转动从0-100耗时单位ms
TurningTime() int64
}
// 仿真底层屏蔽门模型
// 用户所有屏蔽门模型定义须实现该接口
type IPsdModel interface {
//屏蔽门移动从0-100耗时单位ms
MovingTime() int64
}