| | |
| | | package com.fzzy.protocol.youxian0.analysis; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.api.data.GatewayDeviceType; |
| | | import com.fzzy.api.utils.BytesUtil; |
| | | import com.fzzy.api.utils.NumberUtil; |
| | |
| | | |
| | | @Resource |
| | | private GatewayRemoteManager gatewayRemoteManager; |
| | | |
| | | |
| | | private static Map<String, GrainRoot> contextGrainRoot = new HashMap<>(); |
| | | |
| | |
| | | |
| | | //粮情返回 |
| | | if (ServiceUtils.FUNCTION_66.equalsIgnoreCase(funId)) { |
| | | |
| | | log.info("---------开始解析粮情信息---------"); |
| | | this.analysisGrainStep1(device, msgId, strMsg); |
| | | } |
| | | |
| | | //温湿度返回 |
| | | if (ServiceUtils.FUNCTION_68.equalsIgnoreCase(funId)) { |
| | | log.info("---------开始解析仓温湿度信息---------"); |
| | | this.analysisGrainTh(device, strMsg); |
| | | } |
| | | |
| | |
| | | String kyeNumHex = strMsg.substring(2, 4); |
| | | String kyeNumBin = BytesUtil.toBinary8String(BytesUtil.hexToInt(kyeNumHex)); |
| | | |
| | | String key = kyeNumBin.substring(0, 3); |
| | | String key = "00000" + kyeNumBin.substring(0, 3); |
| | | int keyValue = BytesUtil.hexToInt(BytesUtil.bin2Hex(key)); |
| | | key = kyeNumBin.substring(4); |
| | | key = "0000" + kyeNumBin.substring(4); |
| | | int numValue = BytesUtil.hexToInt(BytesUtil.bin2Hex(key)); |
| | | |
| | | //02 A4 BB BA BA B4 |
| | |
| | | point = this.getGrainTemp(keyValue, tempHex); |
| | | log.debug("--------解析后的温度点----{}---{}", tempHex, point); |
| | | grainRoot.getPoints().add(point); |
| | | start = 2 * 2; |
| | | } |
| | | |
| | | |
| | |
| | | log.error("------------粮情推送失败,系统不存在当前协议执行类----{}", reqData.getDevice().getDeviceName()); |
| | | return; |
| | | } |
| | | |
| | | reportService.reportGrainData(reqData); |
| | | } |
| | | |