2023-09-14 15:06:51 +08:00
|
|
|
package repository
|
|
|
|
|
|
|
|
import "joylink.club/rtsssimulation/repository/model/proto"
|
|
|
|
|
|
|
|
type Transponder struct {
|
|
|
|
Identity
|
|
|
|
|
|
|
|
km *proto.Kilometer
|
|
|
|
//section *PhysicalSection
|
|
|
|
//turnoutPort TurnoutPort
|
2023-11-22 13:52:38 +08:00
|
|
|
linkPosition *LinkPosition
|
2023-11-23 13:17:09 +08:00
|
|
|
fixedTelegram []byte //无源应答器固定报文
|
|
|
|
baliseType proto.Transponder_Type //应答器类型
|
2023-09-14 15:06:51 +08:00
|
|
|
}
|
|
|
|
|
2023-11-23 13:17:09 +08:00
|
|
|
func NewTransponder(id string, km *proto.Kilometer, fixedTelegram []byte, baliseType proto.Transponder_Type) *Transponder {
|
2023-09-14 15:06:51 +08:00
|
|
|
return &Transponder{
|
2023-11-22 13:52:38 +08:00
|
|
|
Identity: identity{id, proto.DeviceType_DeviceType_Transponder},
|
|
|
|
km: km,
|
|
|
|
fixedTelegram: fixedTelegram,
|
2023-11-23 13:17:09 +08:00
|
|
|
baliseType: baliseType,
|
2023-09-14 15:06:51 +08:00
|
|
|
}
|
|
|
|
}
|
2023-11-23 13:17:09 +08:00
|
|
|
func (t *Transponder) TransponderType() proto.Transponder_Type {
|
|
|
|
return t.baliseType
|
|
|
|
}
|
|
|
|
func (t *Transponder) FixedTelegram() []byte {
|
|
|
|
return t.fixedTelegram
|
|
|
|
}
|
2023-09-20 15:14:38 +08:00
|
|
|
func (t *Transponder) bindLinkPosition(position *LinkPosition) {
|
|
|
|
t.linkPosition = position
|
|
|
|
}
|
|
|
|
|
2023-11-22 16:35:54 +08:00
|
|
|
// func (r *Transponder) bindSection(section *PhysicalSection) {
|
|
|
|
// r.section = section
|
|
|
|
// }
|
2023-09-14 15:06:51 +08:00
|
|
|
//
|
2023-11-22 16:35:54 +08:00
|
|
|
// func (r *Transponder) bindTurnoutPort(turnoutPort TurnoutPort) {
|
|
|
|
// r.turnoutPort = turnoutPort
|
|
|
|
// }
|
|
|
|
func (t *Transponder) LinkPosition() *LinkPosition {
|
|
|
|
return t.linkPosition
|
|
|
|
}
|