|  |  |  | 
|---|
|  |  |  | @Serial | 
|---|
|  |  |  | private static final long serialVersionUID = 20160805192500101L; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private String commandId ;//命令ID,可能为null | 
|---|
|  |  |  | private String rtuAddr ;//终端地址 | 
|---|
|  |  |  | private String protocol ;//数据所对应的协议名称 | 
|---|
|  |  |  | private String code ;//数据所对应的功能码: | 
|---|
|  |  |  | private Object subData ;//对应各个功能码的具体数据 | 
|---|
|  |  |  | private String hex ;//上报数据的十六进制 | 
|---|
|  |  |  | public String rtuResultSendWebUrl ;//rtu返回命令结果 发向目的地web URL | 
|---|
|  |  |  | public String commandId ;//命令ID,可能为null | 
|---|
|  |  |  | public String rtuAddr ;//终端地址 | 
|---|
|  |  |  | public String protocol ;//数据所对应的协议名称 | 
|---|
|  |  |  | public Short  protocolVer;//数据所对应的协议版本号(1~255) | 
|---|
|  |  |  | public String code ;//数据所对应的功能码: | 
|---|
|  |  |  | public Object subData ;//对应各个协议数据 | 
|---|
|  |  |  | public String hex ;//上报数据的十六进制 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String toString() { | 
|---|
|  |  |  | StringBuilder sb = new StringBuilder() ; | 
|---|
|  |  |  | sb.append("上行报文(十六进制): ").append((hex == null?"":hex)).append("\n") ; // | 
|---|
|  |  |  | sb.append("Rtu地址 : ").append((rtuAddr==null?"":rtuAddr)).append("\n") ; | 
|---|
|  |  |  | if(rtuResultSendWebUrl != null){ | 
|---|
|  |  |  | sb.append("命令结果发往 : ").append(rtuResultSendWebUrl).append("\n") ; //rtu返回命令结果 发向目的地web URL | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(commandId != null){ | 
|---|
|  |  |  | sb.append("命令ID : ").append(commandId).append("\n") ; //命令ID | 
|---|
|  |  |  | } | 
|---|
|  |  |  | sb.append("协议 : ").append((protocol == null?"":protocol)).append("\n") ; // | 
|---|
|  |  |  | sb.append("协议版本号 : ").append((protocolVer == null?"":protocolVer)).append("\n") ; // | 
|---|
|  |  |  | sb.append((code == null ? "" : ("功能码:" + code + "\n"))) ; | 
|---|
|  |  |  | if(this.subData  != null){ | 
|---|
|  |  |  | sb.append("上行数据:\n").append(this.subData) ; | 
|---|
|  |  |  | 
|---|
|  |  |  | d.code = "01" ; | 
|---|
|  |  |  | d.rtuAddr = "123234" ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DataV1_0_1 subD = new DataV1_0_1() ; | 
|---|
|  |  |  | DataV1 subD = new DataV1() ; | 
|---|
|  |  |  | subD.rtuAddr = "2342345" ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | d.subData = subD ; | 
|---|
|  |  |  | 
|---|
|  |  |  | public void setRtuAddr(String rtuAddr) { | 
|---|
|  |  |  | this.rtuAddr = rtuAddr; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getCode() { | 
|---|
|  |  |  | return code; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | public String getProtocol() { | 
|---|
|  |  |  | return protocol; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setProtocol(String protocol) { | 
|---|
|  |  |  | this.protocol = protocol; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Short getProtocolVer() { | 
|---|
|  |  |  | return protocolVer; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setProtocolVer(Short protocolVer) { | 
|---|
|  |  |  | this.protocolVer = protocolVer; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Object getSubData() { | 
|---|
|  |  |  | return subData; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | this.hex = hex; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getRtuResultSendWebUrl() { | 
|---|
|  |  |  | return rtuResultSendWebUrl; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 得到rtu返回命令结果 发向目的地web URL | 
|---|
|  |  |  | * 如果是主动上报数据,则此web URL为空 | 
|---|
|  |  |  | * @return  rtuResultSendWebUrl | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void setRtuResultSendWebUrl(String rtuResultSendWebUrl) { | 
|---|
|  |  |  | this.rtuResultSendWebUrl = rtuResultSendWebUrl; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setCommandId(String commandId) { | 
|---|
|  |  |  | this.commandId = commandId; | 
|---|
|  |  |  | } | 
|---|