| | |
| | | Brand string `gorm:"type:varchar(191);comment:PLC品牌" json:"brand"` |
| | | Method constvar.PlcMethod `gorm:"type:varchar(191);comment:接口方式" json:"method"` |
| | | //PortName string `gorm:"type:varchar(191);comment:端口名称" json:"portName"` |
| | | //Frequency int `gorm:"type:int(11);comment:数据更新频率 0-实时更新 1-1次/秒" json:"frequency"` |
| | | //Frequency int `gorm:"comment:数据更新频率 0-实时更新 1-1次/秒" json:"frequency"` |
| | | Address string `gorm:"type:varchar(191);comment:PLC地址" json:"address"` //plc ip地址, method = modbusTCP用 |
| | | Port int `gorm:"type:int(11);comment:端口" json:"port"` //plc 端口号, method = modbusTCP用 |
| | | BaudRate int `gorm:"type:int(11);comment:波特率" json:"baudRate"` //串口波特率, method = serial时 用 |
| | | SerialName string `gorm:"type:int(11);comment:串口名称" json:"serialName"` //串口名称,method = serial时 用 |
| | | IsOpen bool `gorm:"type:tinyint(1);comment:是否开启" json:"isOpen"` |
| | | Port int `gorm:"comment:端口" json:"port"` //plc 端口号, method = modbusTCP用 |
| | | BaudRate int `gorm:"comment:波特率" json:"baudRate"` //串口波特率, method = serial时 用 |
| | | SerialName string `gorm:"comment:串口名称" json:"serialName"` //串口名称,method = serial时 用 |
| | | IsOpen bool `gorm:"comment:是否开启" json:"isOpen"` |
| | | Detail string `gorm:"type:varchar(2048);comment:数据详情" json:"-"` |
| | | |
| | | Details []*DevicePlcAddress `gorm:"-" json:"details"` |
| | | |
| | | MaxTryTimes int `gorm:"-" json:"-"` //最大写入重试次数 |
| | | CurrentTryTimes int `gorm:"-" json:"-"` //当前写入重试次数 |
| | | CurrentErr error `gorm:"-" json:"-"` //当前报错 |
| | | } |
| | | |
| | | DevicePlcAddress struct { |
| | | Channel int32 `json:"channel"` // 数据起始地址 |
| | | StartAddress int `json:"startAddress"` // 数据起始地址 |
| | | Length int `json:"length"` // 数据长度 |
| | | Type constvar.PlcStartAddressValueType `json:"type"` // 数据类型 |