2023-09-06 16:20:36 +08:00
|
|
|
package repository
|
|
|
|
|
|
|
|
import "joylink.club/rtsssimulation/repository/model/proto"
|
|
|
|
|
|
|
|
// 检测点
|
|
|
|
type CheckPoint struct {
|
|
|
|
Identity
|
|
|
|
|
2023-09-20 15:14:38 +08:00
|
|
|
km *proto.Kilometer
|
|
|
|
pointType proto.CheckPointType //检测点类型
|
|
|
|
devicePorts []DevicePort //检测点关联的设备及其端口
|
2024-07-31 17:08:53 +08:00
|
|
|
linkPosition LinkPosition
|
2023-09-06 16:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewCheckPoint(id string, km *proto.Kilometer, pointType proto.CheckPointType) *CheckPoint {
|
|
|
|
return &CheckPoint{
|
|
|
|
Identity: identity{id, proto.DeviceType_DeviceType_CheckPoint},
|
|
|
|
km: km,
|
|
|
|
pointType: pointType,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-31 17:08:53 +08:00
|
|
|
func (c *CheckPoint) LinkPosition() LinkPosition {
|
|
|
|
return c.linkPosition
|
|
|
|
}
|
|
|
|
|
2023-09-06 16:20:36 +08:00
|
|
|
func (c *CheckPoint) bindDevicePort(devicePort DevicePort) {
|
|
|
|
c.devicePorts = append(c.devicePorts, devicePort)
|
|
|
|
}
|
2023-09-20 15:14:38 +08:00
|
|
|
|
2024-07-31 17:08:53 +08:00
|
|
|
func (c *CheckPoint) bindLinkPosition(position LinkPosition) {
|
2023-09-20 15:14:38 +08:00
|
|
|
c.linkPosition = position
|
|
|
|
}
|