rts-sim-module/model/device_model.go

38 lines
641 B
Go
Raw Normal View History

2023-08-14 16:23:34 +08:00
package model
2023-08-21 15:12:57 +08:00
import "joylink.club/rtsssimulation/state"
2023-08-18 17:59:16 +08:00
type IDeviceModel interface {
GetId() string
IsSame(other IDeviceModel) bool
2023-08-21 15:12:57 +08:00
GetType() state.DeviceType
2023-08-18 17:59:16 +08:00
}
// 设备模型基础信息
2023-08-14 18:06:26 +08:00
type DeviceModel struct {
2023-08-21 15:12:57 +08:00
// 设备id
2023-08-14 16:23:34 +08:00
Id string
2023-08-21 15:12:57 +08:00
// 设备类型
Type state.DeviceType
2023-08-14 16:23:34 +08:00
}
2023-08-18 17:59:16 +08:00
func (me *DeviceModel) GetId() string {
return me.Id
}
func (me *DeviceModel) IsSame(other IDeviceModel) bool {
return me.Id == other.GetId()
}
2023-08-21 15:12:57 +08:00
func (me *DeviceModel) GetType() state.DeviceType {
return me.Type
}
2023-08-18 17:59:16 +08:00
// 端口定义,如轨道、区段、道岔的端口
2023-08-14 16:23:34 +08:00
type PortEnum = int8
2023-08-18 17:59:16 +08:00
// 具体端口枚举
2023-08-14 16:23:34 +08:00
const (
A PortEnum = iota
B
C
)