2023-09-22 15:13:24 +08:00
|
|
|
package repository
|
|
|
|
|
|
|
|
import "joylink.club/rtsssimulation/repository/model/proto"
|
|
|
|
|
|
|
|
type Relay struct {
|
|
|
|
Identity
|
|
|
|
code string
|
|
|
|
model string
|
|
|
|
}
|
|
|
|
|
|
|
|
func newRelay(id string, code string, model string) *Relay {
|
|
|
|
return &Relay{
|
|
|
|
Identity: identity{
|
|
|
|
id: id,
|
|
|
|
deviceType: proto.DeviceType_DeviceType_Relay,
|
|
|
|
},
|
|
|
|
code: code,
|
|
|
|
model: model,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-26 10:25:00 +08:00
|
|
|
func (r *Relay) Code() string {
|
|
|
|
return r.code
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Relay) Model() string {
|
|
|
|
return r.model
|
|
|
|
}
|
|
|
|
|
2023-09-22 15:13:24 +08:00
|
|
|
type RelayGroup struct {
|
|
|
|
code string
|
|
|
|
relays []*Relay
|
|
|
|
}
|
2023-09-26 10:25:00 +08:00
|
|
|
|
|
|
|
func (r *RelayGroup) Code() string {
|
|
|
|
return r.code
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *RelayGroup) Relays() []*Relay {
|
|
|
|
return r.relays
|
|
|
|
}
|