| | |
| | | package com.ld.igds.protocol.modbus.data; |
| | | |
| | | import com.ld.igds.constant.Constant; |
| | | import com.ld.igds.models.DeviceModbus; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | |
| | | private int port; |
| | | |
| | | /** |
| | | * 开地址 |
| | | **/ |
| | | private String addrOpen = Constant.YN_N; |
| | | private DeviceModbus deviceModbus; |
| | | |
| | | /** |
| | | * 关地址 |
| | | **/ |
| | | private String addrClose = Constant.YN_N; |
| | | |
| | | /** |
| | | * 停地址 |
| | | **/ |
| | | private String addrStop = Constant.YN_N; |
| | | |
| | | /** |
| | | * 开到位地址 |
| | | **/ |
| | | private String addrOpenEnd = Constant.YN_N; |
| | | |
| | | /** |
| | | * 关到位地址 |
| | | **/ |
| | | private String addrCloseEnd = Constant.YN_N; |
| | | |
| | | /** |
| | | * 开故障地址 |
| | | **/ |
| | | private String addrOpenError = Constant.YN_N; |
| | | |
| | | /** |
| | | * 关故障地址 |
| | | **/ |
| | | private String addrCloseError = Constant.YN_N; |
| | | |
| | | private int addrExe = 65535; |
| | | |
| | | private int addrExe; |
| | | |
| | | public ModbusTcp() { |
| | | super(); |
| | | } |
| | | |
| | | public ModbusTcp(String modbusStr) { |
| | | //modbus规则:开地址-关地址-停地址-开到位-关到位-开故障-关故障,无地址用N代替 |
| | | String[] addr = modbusStr.split("-"); |
| | | this.addrOpen = addr[0]; |
| | | this.addrClose = addr[1]; |
| | | this.addrStop = addr[2]; |
| | | this.addrOpenEnd = addr[3]; |
| | | this.addrCloseEnd = addr[4]; |
| | | this.addrOpenError = addr[5]; |
| | | this.addrCloseError = addr[6]; |
| | | public ModbusTcp(DeviceModbus deviceModbus) { |
| | | this.deviceModbus = deviceModbus; |
| | | } |
| | | // |
| | | // public ModbusTcp(String modbusStr) { |
| | | // //modbus规则:开地址-关地址-停地址-开到位-关到位-开故障-关故障,无地址用N代替 |
| | | // String[] addr = modbusStr.split("-"); |
| | | // String temp = addr[0]; |
| | | // if (!Constant.YN_N.equals(temp)) this.addrOpen = temp; |
| | | // temp = addr[1]; |
| | | // if (!Constant.YN_N.equals(temp)) this.addrClose = temp; |
| | | // temp = addr[2]; |
| | | // if (!Constant.YN_N.equals(temp)) this.addrStop = temp; |
| | | // temp = addr[3]; |
| | | // if (!Constant.YN_N.equals(temp)) this.addrOpenEnd = temp; |
| | | // temp = addr[4]; |
| | | // if (!Constant.YN_N.equals(temp)) this.addrCloseEnd = temp; |
| | | // temp = addr[5]; |
| | | // if (!Constant.YN_N.equals(temp)) this.addrOpenError = temp; |
| | | // temp = addr[6]; |
| | | // if (!Constant.YN_N.equals(temp)) this.addrCloseError = temp; |
| | | // } |
| | | |
| | | public ModbusTcp(String companyId, String deviceCode, String serId, String ip, int port, DeviceModbus deviceModbus) { |
| | | this.companyId = companyId; |
| | | this.deviceCode = deviceCode; |
| | | this.serId = serId; |
| | | this.ip = ip; |
| | | this.port = port; |
| | | this.deviceModbus = deviceModbus; |
| | | } |
| | | } |