rts-sim-module/repository/station.go

48 lines
920 B
Go
Raw Normal View History

2023-10-13 15:26:25 +08:00
package repository
2023-12-06 16:43:29 +08:00
import (
"joylink.club/rtsssimulation/repository/model/proto"
)
2023-10-13 15:26:25 +08:00
type Station struct {
Identity
2023-12-06 16:43:29 +08:00
code string
empGroups []*ElectronicComponentGroup
spksComponents []IGroupedElectronicComponent
deviceEcc []*proto.DeviceEcc
2023-10-13 15:26:25 +08:00
}
func NewStation(id, code string) *Station {
return &Station{
Identity: identity{id, proto.DeviceType_DeviceType_Station},
code: code,
}
}
2023-10-17 15:05:13 +08:00
2023-10-31 14:42:42 +08:00
func (s *Station) GetCode() string {
return s.code
}
2023-12-06 16:43:29 +08:00
func (s *Station) EmpGroups() []*ElectronicComponentGroup {
return s.empGroups
2023-10-17 15:05:13 +08:00
}
2023-12-06 16:43:29 +08:00
func (s *Station) SpksComponents() []IGroupedElectronicComponent {
return s.spksComponents
2023-10-17 15:05:13 +08:00
}
2023-12-06 16:43:29 +08:00
func (s *Station) SpksButtons() []*Button {
var buttons []*Button
for _, c := range s.spksComponents {
b, ok := c.(*Button)
if ok {
buttons = append(buttons, b)
}
}
return buttons
}
func (s *Station) DeviceEcc() []*proto.DeviceEcc {
return s.deviceEcc
}