39 lines
719 B
Go
39 lines
719 B
Go
package face
|
|
|
|
import "strings"
|
|
|
|
//设备模型基类
|
|
type DeviceModel struct {
|
|
//图形id,即由前端作图时生成,且全局唯一
|
|
GraphicId string
|
|
//索引编号,同类设备唯一,不同类设备不唯一
|
|
Index string
|
|
}
|
|
|
|
//判断是否同一个设备
|
|
func (dm *DeviceModel) IsSame(other *DeviceModel) bool {
|
|
return strings.EqualFold(dm.GraphicId, other.GraphicId)
|
|
}
|
|
|
|
//模型图形id
|
|
func (dm *DeviceModel) GetGraphicId() string {
|
|
return dm.GraphicId
|
|
}
|
|
|
|
//模型索引
|
|
func (dm *DeviceModel) GetIndex() string {
|
|
return dm.Index
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
//设备端口枚举定义
|
|
type PortEnum int8
|
|
|
|
//设备端口枚举值
|
|
const (
|
|
A PortEnum = iota
|
|
B
|
|
C
|
|
)
|