2023-09-14 15:06:51 +08:00
|
|
|
package repository
|
|
|
|
|
2024-10-17 16:54:50 +08:00
|
|
|
import (
|
|
|
|
"joylink.club/rtsssimulation/repository/model/proto"
|
|
|
|
)
|
2023-09-14 15:06:51 +08:00
|
|
|
|
|
|
|
type Transponder struct {
|
|
|
|
Identity
|
|
|
|
|
|
|
|
km *proto.Kilometer
|
|
|
|
//section *PhysicalSection
|
|
|
|
//turnoutPort TurnoutPort
|
2024-07-31 17:08:53 +08:00
|
|
|
linkPosition LinkPosition //此位置是应答器初始位置,当前位置需从应答器实体中获取
|
2024-01-22 11:06:16 +08:00
|
|
|
fixedTelegram []byte //应答器固定报文
|
|
|
|
fixedUserTelegram []byte //应答器固定用户报文
|
|
|
|
baliseType proto.Transponder_Type //应答器类型
|
2024-07-29 13:53:46 +08:00
|
|
|
leuIndex uint32 //应答器所属LEU的索引
|
|
|
|
indexInLeu uint32 //应答器在LEU内的索引
|
2023-09-14 15:06:51 +08:00
|
|
|
}
|
|
|
|
|
2024-07-29 13:53:46 +08:00
|
|
|
func NewTransponder(id string, km *proto.Kilometer, fixedTelegram []byte, fixedUserTelegram []byte,
|
|
|
|
baliseType proto.Transponder_Type, leuIndex uint32, indexInLeu uint32) *Transponder {
|
2023-09-14 15:06:51 +08:00
|
|
|
return &Transponder{
|
2024-01-22 11:06:16 +08:00
|
|
|
Identity: identity{id, proto.DeviceType_DeviceType_Transponder},
|
|
|
|
km: km,
|
|
|
|
fixedTelegram: fixedTelegram,
|
|
|
|
fixedUserTelegram: fixedUserTelegram,
|
|
|
|
baliseType: baliseType,
|
2024-07-29 13:53:46 +08:00
|
|
|
leuIndex: leuIndex,
|
|
|
|
indexInLeu: indexInLeu,
|
2023-09-14 15:06:51 +08:00
|
|
|
}
|
|
|
|
}
|
2024-07-29 13:53:46 +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
|
|
|
|
}
|
2024-01-22 11:06:16 +08:00
|
|
|
func (t *Transponder) FixedUserTelegram() []byte {
|
|
|
|
return t.fixedUserTelegram
|
|
|
|
}
|
2024-07-31 17:08:53 +08:00
|
|
|
func (t *Transponder) bindLinkPosition(position LinkPosition) {
|
2023-09-20 15:14:38 +08:00
|
|
|
t.linkPosition = position
|
|
|
|
}
|
2024-07-31 17:08:53 +08:00
|
|
|
func (t *Transponder) LinkPosition() LinkPosition {
|
2023-11-22 16:35:54 +08:00
|
|
|
return t.linkPosition
|
|
|
|
}
|
2024-01-10 14:06:00 +08:00
|
|
|
|
|
|
|
func (t *Transponder) Km() *proto.Kilometer {
|
|
|
|
return t.km
|
|
|
|
}
|
2024-01-24 17:45:15 +08:00
|
|
|
|
|
|
|
func (t *Transponder) BaliseType() proto.Transponder_Type {
|
|
|
|
return t.baliseType
|
|
|
|
}
|
2024-07-29 13:53:46 +08:00
|
|
|
|
|
|
|
func (t *Transponder) LeuIndex() uint32 {
|
|
|
|
return t.leuIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *Transponder) IndexInLeu() uint32 {
|
|
|
|
return t.indexInLeu
|
|
|
|
}
|