在Fox-Edge之上开发并调试ZS-SHT30-1T-1H-485 通讯协议解码器(1)

 * 比如,serial-channel提供的数据格式,是16进制格式的来表示通信报文,所以你要返回一个hex通信报文格式的String给外部
 */
@FoxEdgeOperate(name = "读取温湿度", polling = true, type = FoxEdgeOperate.encoder, timeout = 2000)
public static String packReadInputRegister(Map<String, Object> param) {
    return (String) operateReadRegister("", param);
}

/**
 * 解码函数
 *
 * @param hexString 该对象是由你使用的channnel从设备获得的报文,以hex格式文本输入给你。
 * 如果你用的是其他channel,其他channel有自己的约定,那么你需要采用对应的格式。
 * 目前各类channel支持的有常见的hexString,也有结构复杂一点的Map<String, Object>
 *
 * @param param  解码参数,它来自设备配置的参数和操作任务配置的参数的合并,到时候你知道该如何对设备返回报文进行解码
 * @return 解码后的数据 必须为Map<String, Object>格式,表示一批key-value的设备数据对象和它的数值
 */
@FoxEdgeOperate(name = "读取温湿度", polling = true, type = FoxEdgeOperate.decoder, timeout = 2000)
public static Map<String, Object> unpackReadInputRegister(String hexString, Map<String, Object> param) {
    return (Map<String, Object>) operateReadRegister(hexString, param);
}

}


#### [完整JAVA代码]( )



package cn.foxtech.device.protocol.zs.sht301t1h;

import cn.foxtech.device.protocol.core.annotation.FoxEdgeDeviceType;
import cn.foxtech.device.protocol.core.annotation.FoxEdgeOperate;
import cn.foxtech.device.protocol.core.exception.ProtocolException;
import cn.foxtech.device.protocol.core.utils.HexUtils;
import cn.foxtech.device.protocol.core.utils.MethodUtils;
import cn.foxtech.device.protocol.modbus.core.ModBusConstants;
import cn.foxtech.device.pro

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值