rts-sim-module/repository/transponder.go

63 lines
1.8 KiB
Go

package repository
import "joylink.club/rtsssimulation/repository/model/proto"
type Transponder struct {
Identity
km *proto.Kilometer
//section *PhysicalSection
//turnoutPort TurnoutPort
linkPosition LinkPosition //此位置是应答器初始位置,当前位置需从应答器实体中获取
fixedTelegram []byte //应答器固定报文
fixedUserTelegram []byte //应答器固定用户报文
baliseType proto.Transponder_Type //应答器类型
leuIndex uint32 //应答器所属LEU的索引
indexInLeu uint32 //应答器在LEU内的索引
}
func NewTransponder(id string, km *proto.Kilometer, fixedTelegram []byte, fixedUserTelegram []byte,
baliseType proto.Transponder_Type, leuIndex uint32, indexInLeu uint32) *Transponder {
return &Transponder{
Identity: identity{id, proto.DeviceType_DeviceType_Transponder},
km: km,
fixedTelegram: fixedTelegram,
fixedUserTelegram: fixedUserTelegram,
baliseType: baliseType,
leuIndex: leuIndex,
indexInLeu: indexInLeu,
}
}
func (t *Transponder) TransponderType() proto.Transponder_Type {
return t.baliseType
}
func (t *Transponder) FixedTelegram() []byte {
return t.fixedTelegram
}
func (t *Transponder) FixedUserTelegram() []byte {
return t.fixedUserTelegram
}
func (t *Transponder) bindLinkPosition(position LinkPosition) {
t.linkPosition = position
}
func (t *Transponder) LinkPosition() LinkPosition {
return t.linkPosition
}
func (t *Transponder) Km() *proto.Kilometer {
return t.km
}
func (t *Transponder) BaliseType() proto.Transponder_Type {
return t.baliseType
}
func (t *Transponder) LeuIndex() uint32 {
return t.leuIndex
}
func (t *Transponder) IndexInLeu() uint32 {
return t.indexInLeu
}