| | |
| | | private Integer sec; |
| | | // 设备温度 2 1字节整数1字节小数 |
| | | private Double deviceTemperature; |
| | | // 亮度百分比 1 |
| | | // 灯1亮度百分比 1 |
| | | private Integer lightPercent; |
| | | // 电网电压 2 1字节整数1字节小数 |
| | | private Double voltage; |
| | |
| | | private Double recentlyUsingPower; |
| | | // 累计用电电量 4 |
| | | private Double totalUsingPower; |
| | | // 灯2亮度百分比 1 |
| | | private Integer light2Percent; |
| | | // 保留 11 |
| | | private String retain; |
| | | // 原帧 |
| | |
| | | this.totalLightSec = HexUtil.hexToLong(hex.substring(50, 58)); |
| | | this.recentlyUsingPower = NumberUtil.round(HexUtil.hexToInt(hex.substring(58, 66)) * (double) 0.001, 3).doubleValue(); |
| | | this.totalUsingPower = NumberUtil.round(HexUtil.hexToInt(hex.substring(66, 74)) * (double) 0.001, 3).doubleValue(); |
| | | this.retain = hex.substring(74, 96); |
| | | this.light2Percent = HexUtil.hexToInt(hex.substring(74, 76)); |
| | | this.retain = hex.substring(76, 96); |
| | | return this; |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(HexUtil.hexToLong("F64D020F")); |
| | | System.out.println(5 * (float) 0.001); |
| | | } |
| | | } |