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-11-06 17:32:34 +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
|
2023-11-06 17:32:34 +08:00
|
|
|
}
|
2023-11-09 14:26:08 +08:00
|
|
|
|
|
|
|
func (s *Station) DeviceEcc() []*proto.DeviceEcc {
|
|
|
|
return s.deviceEcc
|
|
|
|
}
|