rts-sim-module/repository/model.go
2023-09-22 10:53:51 +08:00

42 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package repository
import "joylink.club/rtsssimulation/repository/model/proto"
// 身份信息
type Identity interface {
Id() string
Type() proto.DeviceType
}
// 身份信息
type identity struct {
id string
deviceType proto.DeviceType
}
func (m identity) Id() string {
return m.id
}
func (m identity) Type() proto.DeviceType {
return m.deviceType
}
/////////////////////////////////////////////////////////////
// IRelayCRole 获取继电器在具体电路中的角色(组合类型、功能名称)
// 如信号机3XH-1电路中点灯继电器组合类型-"3XH-1" 功能名称-"DDJ"
// 对应设备电路中有继电器的设备模型须实现该接口
type IRelayCRole interface {
//FindCircuitRoleById 根据继电器id获取在具体电路中的电路角色
//relayId-继电器id
//relayGroup-继电器组合类型
//relayName-继电器在电路中的名称
//find-true找到false未找到
FindCircuitRoleById(relayId string) (relayGroup string, relayName string, find bool)
//FindRelayModelByCRole 根据继电器具体电路角色来获取继电器设备模型
//relayGroup-继电器组合类型
//relayName-继电器在电路中的名称
FindRelayModelByCRole(relayGroup string, relayName string) Identity
}