| | |
| | | package com.sandu.ximon.admin.manager.iot.frame.inner.report; |
| | | |
| | | import cn.hutool.core.util.HexUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.BaseResponseInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.util.CRC32Utils; |
| | |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | | * @date 2021/12/6 14:46 |
| | | * A5-81-42 |
| | | * 单灯上报ampq 故障码 |
| | | * C3充电桩故障上报帧 |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | |
| | | /** |
| | | * 故障码 |
| | | */ |
| | | private String errorCode; |
| | | private int errorCode; |
| | | |
| | | @Override |
| | | public A5C3ErrorCodeReportInnerFrame transformFrame(String hex) { |
| | |
| | | |
| | | setDestinationAddress(hex.substring(8, 16)); |
| | | |
| | | setErrorCode(hex.substring(16, hex.length() - 8)); |
| | | //故障码 |
| | | String errorCodeHex = hex.substring(16, hex.length() - 8); |
| | | errorCode = HexUtil.hexToInt(errorCodeHex); |
| | | |
| | | setCrc32(hex.substring(hex.length() - 8)); |
| | | // 校验CRC32 |
| | | String frame = getFunctionCode() + getPayloadLength() + getDestinationAddress() + getErrorCode(); |
| | | String frame = getFunctionCode() + getPayloadLength() + getDestinationAddress() + errorCodeHex; |
| | | this.setValidate(CRC32Utils.validateFrame(frame, getCrc32())); |
| | | return this; |
| | | } |