| | |
| | | @Data |
| | | public static class HeartBeatDataPackage implements IResponseInnerFrame<HeartBeatDataPackage> { |
| | | //设备型号 |
| | | private int equipmentModel; |
| | | private String equipmentModel; |
| | | //X轴 |
| | | private double theXAxis; |
| | | //Y轴 |
| | |
| | | //Z轴 |
| | | private double theZAxis; |
| | | //预留 |
| | | private int reservedA; |
| | | private int reservedB; |
| | | private int reservedC; |
| | | private int reservedD; |
| | | private String reservedA; |
| | | private String reservedB; |
| | | private String reservedC; |
| | | private String reservedD; |
| | | |
| | | @Override |
| | | public HeartBeatDataPackage transformFrame(String hex) { |
| | | if (StrUtil.isBlank(hex)) { |
| | | return null; |
| | | } |
| | | this.equipmentModel = (parseVal(hex, 0, 4)); |
| | | this.equipmentModel = "V" + (parseVal(hex, 0, 2)) + "." + String.format("%02d", parseVal(hex, 2, 4)); |
| | | this.theXAxis = NumberUtil.round(temperatureTransition(hex.substring(4, 8)) * 0.1, 1).doubleValue(); |
| | | this.theYAxis = NumberUtil.round(temperatureTransition(hex.substring(8, 12)) * 0.1, 1).doubleValue(); |
| | | this.theZAxis = NumberUtil.round(temperatureTransition(hex.substring(12, 16)) * 0.1, 1).doubleValue(); |
| | | this.reservedA = (parseVal(hex, 16, 20)); |
| | | this.reservedB = (parseVal(hex, 20, 24)); |
| | | this.reservedC = (parseVal(hex, 24, 28)); |
| | | this.reservedD = (parseVal(hex, 28, 32)); |
| | | this.reservedA = hex.substring(16, 20); |
| | | this.reservedB = hex.substring(20, 24); |
| | | this.reservedC = hex.substring(24, 28); |
| | | this.reservedD = hex.substring(28, 32); |
| | | //72-80保留,暂未使用 |
| | | |
| | | return this; |