| | |
| | | ReMessage message = new ReMessage(); |
| | | message.setStrMsg(strMsg); |
| | | //设置起始符 |
| | | message.setStartStr(strMsg.substring(0, 9*2-1)); |
| | | message.setStartStr(strMsg.substring(0, 9*2)); |
| | | |
| | | //设置粮情分机地址 |
| | | String str = strMsg.substring(9*2-1, 10*2-1); |
| | | String str = strMsg.substring(9*2, 10*2); |
| | | int i = BytesUtil.hexToInt(str); |
| | | String serId = String.valueOf(i - BeiboGrainServerUtils.BM); |
| | | message.setSerId(serId); |
| | | str = String.valueOf(i - BeiboGrainServerUtils.BM); |
| | | message.setSerId(str); |
| | | |
| | | //粮情数据 |
| | | str = strMsg.substring(10*2, 1034*2); |
| | | message.setGrainStr(str); |
| | | |
| | | //温度数据 |
| | | str = strMsg.substring(1034*2, 1052*2); |
| | | message.setThStr(str); |
| | | |
| | | //扩充数据 |
| | | str = strMsg.substring(1052*2, 1062*2); |
| | | message.setExpand(str); |
| | | |
| | | //检验码 |
| | | str = strMsg.substring(1062*2); |
| | | message.setHexCrc16(str); |
| | | |
| | | return message; |
| | | } |