Commit 0b156a66c3678bf0e9bfbebf0c84fd310ace7ca1
1 parent
27f727e0
1.燃料电池数据对接
Showing
8 changed files
with
556 additions
and
6 deletions
src/main/java/com/bsth/entity/DeviceAbnormal.java
| @@ -38,9 +38,7 @@ public class DeviceAbnormal { | @@ -38,9 +38,7 @@ public class DeviceAbnormal { | ||
| 38 | return offline; | 38 | return offline; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | - public void setOffline(int offline) { | ||
| 42 | - this.offline = offline; | ||
| 43 | - } | 41 | + public void setOffline(int offline) { this.offline = offline; } |
| 44 | 42 | ||
| 45 | public int getDrift() { | 43 | public int getDrift() { |
| 46 | return drift; | 44 | return drift; |
src/main/java/com/bsth/entity/ExtendData.java
0 → 100644
| 1 | +package com.bsth.entity; | ||
| 2 | +import com.bsth.socket.protocol.Message0280; | ||
| 3 | +public class ExtendData extends Data{ | ||
| 4 | + | ||
| 5 | + /** | ||
| 6 | + * 信息类型 | ||
| 7 | + * 默认应该为0x80 | ||
| 8 | + */ | ||
| 9 | + private byte infoType; | ||
| 10 | + | ||
| 11 | + /** | ||
| 12 | + * 自定义数据长度 1-65531 | ||
| 13 | + * 默认34 | ||
| 14 | + */ | ||
| 15 | + private short customDataLen; | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 蓄电池电压 0-32 | ||
| 19 | + * 分辨率0.5v/bit | ||
| 20 | + * 0xfe 异常 | ||
| 21 | + * 0xff 无效 | ||
| 22 | + */ | ||
| 23 | + private byte storageBatteryVoltage; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 左前轮胎压力 0-250 | ||
| 27 | + * 分辨率 4kPa | ||
| 28 | + * 0xfe 异常 | ||
| 29 | + * 0xff 无效 | ||
| 30 | + */ | ||
| 31 | + private byte lfTirePressure; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 左前轮胎温度 0-250 | ||
| 35 | + * 分辨率 1℃ | ||
| 36 | + * 0xfe 异常 | ||
| 37 | + * 0xff 无效 | ||
| 38 | + */ | ||
| 39 | + private byte lfTireTemp; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 右前轮胎压力 0-250 | ||
| 43 | + * 分辨率 4kPa | ||
| 44 | + * 0xfe 异常 | ||
| 45 | + * 0xff 无效 | ||
| 46 | + */ | ||
| 47 | + private byte rfTirePressure; | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * 右前轮胎温度 0-250 | ||
| 51 | + * 分辨率 1℃ | ||
| 52 | + * 0xfe 异常 | ||
| 53 | + * 0xff 无效 | ||
| 54 | + */ | ||
| 55 | + private byte rfTireTemp; | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 左后轮胎1压力 0-250 | ||
| 59 | + * 分辨率 4kPa | ||
| 60 | + * 0xfe 异常 | ||
| 61 | + * 0xff 无效 | ||
| 62 | + */ | ||
| 63 | + private byte lrTirePressure1; | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * 左后轮胎1温度 0-250 | ||
| 67 | + * 分辨率 1℃ | ||
| 68 | + * 0xfe 异常 | ||
| 69 | + * 0xff 无效 | ||
| 70 | + */ | ||
| 71 | + private byte lrTireTemp1; | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * 左后轮胎2压力 0-250 | ||
| 75 | + * 分辨率 4kPa | ||
| 76 | + * 0xfe 异常 | ||
| 77 | + * 0xff 无效 | ||
| 78 | + */ | ||
| 79 | + private byte lrTirePressure2; | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 左后轮胎2温度 0-250 | ||
| 83 | + * 分辨率 1℃ | ||
| 84 | + * 0xfe 异常 | ||
| 85 | + * 0xff 无效 | ||
| 86 | + */ | ||
| 87 | + private byte lrTireTemp2; | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 右后轮胎1压力 0-250 | ||
| 91 | + * 分辨率 4kPa | ||
| 92 | + * 0xfe 异常 | ||
| 93 | + * 0xff 无效 | ||
| 94 | + */ | ||
| 95 | + private byte rrTirePressure1; | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * 右后轮胎1温度 0-250 | ||
| 99 | + * 分辨率 1℃ | ||
| 100 | + * 0xfe 异常 | ||
| 101 | + * 0xff 无效 | ||
| 102 | + */ | ||
| 103 | + private byte rrTireTemp1; | ||
| 104 | + | ||
| 105 | + /** | ||
| 106 | + * 右后轮胎2压力 0-250 | ||
| 107 | + * 分辨率 4kPa | ||
| 108 | + * 0xfe 异常 | ||
| 109 | + * 0xff 无效 | ||
| 110 | + */ | ||
| 111 | + private byte rrTirePressure2; | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * 右后轮胎2温度 0-250 | ||
| 115 | + * 分辨率 1℃ | ||
| 116 | + * 0xfe 异常 | ||
| 117 | + * 0xff 无效 | ||
| 118 | + */ | ||
| 119 | + private byte rrTireTemp2; | ||
| 120 | + | ||
| 121 | + /** | ||
| 122 | + * 无法定义 | ||
| 123 | + * 用了其中2,3位作为手刹状态 | ||
| 124 | + * 0无信号 1有信号 2异常 3无效 | ||
| 125 | + */ | ||
| 126 | + | ||
| 127 | + | ||
| 128 | + private byte unknown; | ||
| 129 | + | ||
| 130 | + | ||
| 131 | + public ExtendData(Message0280 message0280){ | ||
| 132 | + | ||
| 133 | + this.infoType = message0280.getInfoType() != 0xFF ? message0280.getInfoType() : (byte) 0x80; | ||
| 134 | + | ||
| 135 | + // 自定义数据长度,默认34 | ||
| 136 | + this.customDataLen = message0280.getCustomDataLen() != 0xFF ? message0280.getCustomDataLen() : (short) 34; | ||
| 137 | + | ||
| 138 | + // 蓄电池电压 | ||
| 139 | + this.storageBatteryVoltage = message0280.getStorageBatteryVoltage(); | ||
| 140 | + | ||
| 141 | + // 左前轮胎压力 | ||
| 142 | + this.lfTirePressure = message0280.getLfTirePressure(); | ||
| 143 | + | ||
| 144 | + // 左前轮胎温度 | ||
| 145 | + this.lfTireTemp = message0280.getLfTireTemp(); | ||
| 146 | + | ||
| 147 | + // 右前轮胎压力 | ||
| 148 | + this.rfTirePressure = message0280.getRfTirePressure(); | ||
| 149 | + | ||
| 150 | + // 右前轮胎温度 | ||
| 151 | + this.rfTireTemp = message0280.getRfTireTemp(); | ||
| 152 | + | ||
| 153 | + // 左后轮胎1压力 | ||
| 154 | + this.lrTirePressure1 = message0280.getLrTirePressure1(); | ||
| 155 | + | ||
| 156 | + // 左后轮胎1温度 | ||
| 157 | + this.lrTireTemp1 = message0280.getLrTireTemp1(); | ||
| 158 | + | ||
| 159 | + // 左后轮胎2压力 | ||
| 160 | + this.lrTirePressure2 = message0280.getLrTirePressure2(); | ||
| 161 | + | ||
| 162 | + // 左后轮胎2温度 | ||
| 163 | + this.lrTireTemp2 = message0280.getLrTireTemp2(); | ||
| 164 | + | ||
| 165 | + // 右后轮胎1压力 | ||
| 166 | + this.rrTirePressure1 = message0280.getRrTirePressure1(); | ||
| 167 | + | ||
| 168 | + // 右后轮胎1温度 | ||
| 169 | + this.rrTireTemp1 = message0280.getRrTireTemp1(); | ||
| 170 | + | ||
| 171 | + // 右后轮胎2压力 | ||
| 172 | + this.rrTirePressure2 = message0280.getRrTirePressure2(); | ||
| 173 | + | ||
| 174 | + // 右后轮胎2温度 | ||
| 175 | + this.rrTireTemp2 = message0280.getRrTireTemp2(); | ||
| 176 | + | ||
| 177 | + | ||
| 178 | + | ||
| 179 | + | ||
| 180 | + | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + | ||
| 184 | + | ||
| 185 | + @Override | ||
| 186 | + public String toString() { | ||
| 187 | + StringBuilder sb = new StringBuilder(); | ||
| 188 | + sb.append(" 信息类型: ").append(String.format("%02x", infoType)) | ||
| 189 | + .append(" 自定义数据长度: ").append(customDataLen) | ||
| 190 | + .append(" 蓄电池电压: ").append(storageBatteryVoltage) | ||
| 191 | + .append(" 左前轮压力: ").append(lfTirePressure) | ||
| 192 | + .append(" 左前轮温度: ").append(lfTireTemp) | ||
| 193 | + .append(" 右前轮压力: ").append(rfTirePressure) | ||
| 194 | + .append(" 右前轮温度: ").append(rfTireTemp) | ||
| 195 | + .append(" 左后轮1压力: ").append(lrTirePressure1) | ||
| 196 | + .append(" 左后轮1温度: ").append(lrTireTemp1) | ||
| 197 | + .append(" 左后轮2压力: ").append(lrTirePressure2) | ||
| 198 | + .append(" 左后轮2温度: ").append(lrTireTemp2) | ||
| 199 | + .append(" 右后轮1压力: ").append(rrTirePressure1) | ||
| 200 | + .append(" 右后轮1温度: ").append(rrTireTemp1) | ||
| 201 | + .append(" 右后轮2压力: ").append(rrTirePressure2) | ||
| 202 | + .append(" 右后轮2温度: ").append(rrTireTemp2) | ||
| 203 | + .append(" 手刹状态: ").append(unknown); | ||
| 204 | + | ||
| 205 | + return sb.toString(); | ||
| 206 | + } | ||
| 207 | + @Override | ||
| 208 | + public String getType() { | ||
| 209 | + | ||
| 210 | + return "Extend_data"; | ||
| 211 | + } | ||
| 212 | +} |
src/main/java/com/bsth/entity/FuelCellData.java
0 → 100644
| 1 | +package com.bsth.entity; | ||
| 2 | +import com.bsth.socket.protocol.Message0203; | ||
| 3 | + | ||
| 4 | + | ||
| 5 | +public class FuelCellData extends Data{ | ||
| 6 | + | ||
| 7 | + /** | ||
| 8 | + * 信息类型 | ||
| 9 | + * 默认应该为0x03 | ||
| 10 | + */ | ||
| 11 | + private byte infoType; | ||
| 12 | + | ||
| 13 | + /** | ||
| 14 | + * 电池电压 0-20000 | ||
| 15 | + * 分辨率0.1v | ||
| 16 | + * 0xff 0xfe 异常 | ||
| 17 | + * 0xff 0xff 无效 | ||
| 18 | + */ | ||
| 19 | + private short voltage; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 电池电流 0-20000 | ||
| 23 | + * 分辨率0.1v | ||
| 24 | + * 0xff 0xfe 异常 | ||
| 25 | + * 0xff 0xff 无效 | ||
| 26 | + */ | ||
| 27 | + private short current; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 燃料消耗率 0-60000 | ||
| 31 | + * 分辨率0.01kg/100km | ||
| 32 | + * 0xff 0xfe 异常 | ||
| 33 | + * 0xff 0xff 无效 | ||
| 34 | + */ | ||
| 35 | + private short fuelConsumeRate; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 电池温度探针数量 0-65531 | ||
| 39 | + * n | ||
| 40 | + * 0xff 0xfe 异常 | ||
| 41 | + * 0xff 0xff 无效 | ||
| 42 | + */ | ||
| 43 | + private short tempProbeQuantity; | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 累计里程 0-240 | ||
| 47 | + * 分辨率1℃ 偏移量-40 n*1 | ||
| 48 | + * 0xff 0xff 0xff 0xfe 异常 | ||
| 49 | + * 0xff 0xff 0xff 0xff 无效 | ||
| 50 | + */ | ||
| 51 | + private byte[] temps; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 氢系统中最高温度值 0-2400 | ||
| 55 | + * 分辨率0.1℃ 偏移量-400 | ||
| 56 | + * 0xff 0xfe 异常 | ||
| 57 | + * 0xff 0xff 无效 | ||
| 58 | + */ | ||
| 59 | + private short hydrogenMaxTemp; | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 氢系统最高温度探针代号 1-252 | ||
| 63 | + * 0xfe 异常 | ||
| 64 | + * 0xff 无效 | ||
| 65 | + */ | ||
| 66 | + private byte maxTempSensorCode; | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * 氢气最大浓度 0-60000 | ||
| 70 | + * 分辨率1mg/kg | ||
| 71 | + * 0xFF 0xFE 异常 | ||
| 72 | + * 0xFF 0xFF 无效 | ||
| 73 | + */ | ||
| 74 | + private short hydrogenMaxConcentration; | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * 氢气最大浓度传感器代号 1-252 | ||
| 78 | + * 0xfe 异常 | ||
| 79 | + * 0xff 无效 | ||
| 80 | + */ | ||
| 81 | + private byte maxConcentrationSensorCode; | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * 氢气最高压力 0-1000 | ||
| 85 | + * 分辨率0.1MPa | ||
| 86 | + * 0xFF 0xFE 异常 | ||
| 87 | + * 0xFF 0xFF 无效 | ||
| 88 | + */ | ||
| 89 | + private short hydrogenMaxPressure; | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * 氢气最大浓度传感器代号 1-252 | ||
| 93 | + * 0xfe 异常 | ||
| 94 | + * 0xff 无效 | ||
| 95 | + */ | ||
| 96 | + private byte maxPressureSensorCode; | ||
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * dc-dc状态 | ||
| 100 | + * 0x01 工作 | ||
| 101 | + * 0x02 断开 | ||
| 102 | + * 0xFE 异常 | ||
| 103 | + * 0xFF 无效 | ||
| 104 | + */ | ||
| 105 | + private byte dcState; | ||
| 106 | + | ||
| 107 | + public FuelCellData(Message0203 message0203){ | ||
| 108 | + this.infoType = message0203.getInfoType(); | ||
| 109 | + this.voltage = message0203.getVoltage(); | ||
| 110 | + this.current = message0203.getCurrent(); | ||
| 111 | + this.fuelConsumeRate = message0203.getFuelConsumeRate(); | ||
| 112 | + this.tempProbeQuantity = message0203.getTempProbeQuantity(); | ||
| 113 | + this.temps = message0203.getTemps(); | ||
| 114 | + this.hydrogenMaxTemp = message0203.getHydrogenMaxTemp(); | ||
| 115 | + this.maxTempSensorCode = message0203.getMaxTempSensorCode(); | ||
| 116 | + this.hydrogenMaxConcentration = message0203.getHydrogenMaxConcentration(); | ||
| 117 | + this.maxConcentrationSensorCode = message0203.getMaxConcentrationSensorCode(); | ||
| 118 | + this.hydrogenMaxPressure = message0203.getHydrogenMaxPressure(); | ||
| 119 | + this.maxPressureSensorCode = message0203.getMaxPressureSensorCode(); | ||
| 120 | + this.dcState = message0203.getDcState(); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + | ||
| 124 | + | ||
| 125 | + @Override | ||
| 126 | + public String toString() { | ||
| 127 | + StringBuilder sb = new StringBuilder(); | ||
| 128 | + sb.append(" 信息类型: ").append(String.format("%02x", infoType)) | ||
| 129 | + .append(" 电池电压: ").append(voltage) | ||
| 130 | + .append(" 电池电流: ").append(current) | ||
| 131 | + .append(" 燃料消耗率: ").append(fuelConsumeRate) | ||
| 132 | + .append(" 电池温度探针数量: ").append(tempProbeQuantity) | ||
| 133 | + .append(" 氢系统最高温度值: ").append(hydrogenMaxTemp) | ||
| 134 | + .append(" 氢系统最高温度探针代号: ").append(maxTempSensorCode) | ||
| 135 | + .append(" 氢气最大浓度: ").append(hydrogenMaxConcentration) | ||
| 136 | + .append(" 氢气最大浓度传感器代号: ").append(maxConcentrationSensorCode) | ||
| 137 | + .append(" 氢气最高压力: ").append(hydrogenMaxPressure) | ||
| 138 | + .append(" 氢气最高压力传感器代号: ").append(maxPressureSensorCode) | ||
| 139 | + .append(" dc-dc状态: ").append(dcState); | ||
| 140 | + | ||
| 141 | + return sb.toString(); | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + | ||
| 146 | + | ||
| 147 | + @Override | ||
| 148 | + public String getType() { | ||
| 149 | + return "FuelCell_data"; | ||
| 150 | + } | ||
| 151 | +} |
src/main/java/com/bsth/entity/TerminalCollectData.java
0 → 100644
| 1 | +package com.bsth.entity; | ||
| 2 | +import com.bsth.socket.protocol.Message0281; | ||
| 3 | + | ||
| 4 | +public class TerminalCollectData extends Data { | ||
| 5 | + | ||
| 6 | + private final static int BYTE_LEN = 10; | ||
| 7 | + | ||
| 8 | + /** | ||
| 9 | + * 加速踏板标识类型 | ||
| 10 | + * 默认应该为0x01 | ||
| 11 | + */ | ||
| 12 | + private byte acceleratorFlag; | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 加速踏板行程值 0-100% | ||
| 16 | + * 分辨率1% | ||
| 17 | + * 0xFE 异常 | ||
| 18 | + * 0xFF 无效 | ||
| 19 | + */ | ||
| 20 | + private byte acceleratorState; | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 制动踏板标识类型 | ||
| 24 | + * 默认应该为0x02 | ||
| 25 | + */ | ||
| 26 | + private byte brakePedalFlag; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 制动踏板状态 0-100% | ||
| 30 | + * 分辨率1% 在无具体行程值情况下,用“101”表示制动有效状态 | ||
| 31 | + * 0xFE 异常 | ||
| 32 | + * 0xFF 无效 | ||
| 33 | + */ | ||
| 34 | + private byte brakePedalState; | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 车速标识类型 | ||
| 38 | + * 默认应该为0x03 | ||
| 39 | + */ | ||
| 40 | + private byte speedFlag; | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 车速 0-2200 | ||
| 44 | + * 分辨率0.1km/h | ||
| 45 | + * 0xff 0xfe 异常 | ||
| 46 | + * 0xff 0xff 无效 | ||
| 47 | + */ | ||
| 48 | + private short speed; | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 总电流标识类型 | ||
| 52 | + * 默认应该为0x04 | ||
| 53 | + */ | ||
| 54 | + private byte totalCurrentFlag; | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * 总电流 0-20000 | ||
| 58 | + * 分辨率0.1a | ||
| 59 | + * 0xff 0xfe 异常 | ||
| 60 | + * 0xff 0xff 无效 | ||
| 61 | + */ | ||
| 62 | + private short totalCurrent; | ||
| 63 | + | ||
| 64 | + public TerminalCollectData(Message0281 message0281){ | ||
| 65 | + | ||
| 66 | + this.acceleratorFlag = message0281.getDataList().get(0).getAcceleratorFlag() != 0xFF ? message0281.getDataList().get(0).getAcceleratorFlag() : (byte) 0x01; | ||
| 67 | + | ||
| 68 | + // 加速踏板行程值 | ||
| 69 | + this.acceleratorState = message0281.getDataList().get(0).getAcceleratorState(); | ||
| 70 | + | ||
| 71 | + // 制动踏板标识类型,默认应该为0x02 | ||
| 72 | + this.brakePedalFlag = message0281.getDataList().get(0).getBrakePedalFlag() != 0xFF ? message0281.getDataList().get(0).getBrakePedalFlag() : (byte) 0x02; | ||
| 73 | + | ||
| 74 | + // 制动踏板状态 | ||
| 75 | + this.brakePedalState = message0281.getDataList().get(0).getBrakePedalState(); | ||
| 76 | + | ||
| 77 | + | ||
| 78 | + // 车速标识类型,默认应该为0x03 | ||
| 79 | + this.speedFlag = message0281.getDataList().get(0).getSpeedFlag() != 0xFF ? message0281.getDataList().get(0).getSpeedFlag() : (byte) 0x03; | ||
| 80 | + | ||
| 81 | + // 车速 | ||
| 82 | + this.speed = message0281.getDataList().get(0).getSpeed(); | ||
| 83 | + | ||
| 84 | + // 总电流标识类型,默认应该为0x04 | ||
| 85 | + this.totalCurrentFlag = message0281.getDataList().get(0).getTotalCurrentFlag() != 0xFF ? message0281.getDataList().get(0).getTotalCurrentFlag() : (byte) 0x04; | ||
| 86 | + | ||
| 87 | + // 总电流 | ||
| 88 | + this.totalCurrent = message0281.getDataList().get(0).getTotalCurrent(); | ||
| 89 | + | ||
| 90 | + | ||
| 91 | + | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @Override | ||
| 95 | + public String toString() { | ||
| 96 | + StringBuilder sb = new StringBuilder(); | ||
| 97 | + sb.append(" 加速踏板标识类型: ").append(acceleratorFlag) | ||
| 98 | + .append(" 加速踏板行程值: ").append(acceleratorState) | ||
| 99 | + .append(" 制动踏板标识类型: ").append(brakePedalFlag) | ||
| 100 | + .append(" 制动踏板状态: ").append(brakePedalState) | ||
| 101 | + .append(" 车速标识类型: ").append(speedFlag) | ||
| 102 | + .append(" 车速: ").append(speed) | ||
| 103 | + .append(" 总电流标识类型: ").append(totalCurrentFlag) | ||
| 104 | + .append(" 总电流: ").append(totalCurrent) | ||
| 105 | + .append("\n"); | ||
| 106 | + | ||
| 107 | + return sb.toString(); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + @Override | ||
| 111 | + public String getType() { | ||
| 112 | + | ||
| 113 | + return "TerminalCollect_data"; | ||
| 114 | + } | ||
| 115 | +} |
src/main/java/com/bsth/entity/VehicleData.java
| @@ -142,7 +142,7 @@ public class VehicleData extends Data { | @@ -142,7 +142,7 @@ public class VehicleData extends Data { | ||
| 142 | public VehicleData(Message0201 message0201) { | 142 | public VehicleData(Message0201 message0201) { |
| 143 | BeanUtils.copyProperties(message0201, this); | 143 | BeanUtils.copyProperties(message0201, this); |
| 144 | this.drivingForce = (gear & 32) == 32 ? true : false; | 144 | this.drivingForce = (gear & 32) == 32 ? true : false; |
| 145 | - this.drivingForce = (gear & 16) == 16 ? true : false; | 145 | + this.brakingForce = (gear & 16) == 16 ? true : false; |
| 146 | this.gear1 = (byte) (gear & 15); | 146 | this.gear1 = (byte) (gear & 15); |
| 147 | } | 147 | } |
| 148 | 148 |
src/main/java/com/bsth/entity/VehicleLocationData.java
0 → 100644
| 1 | +package com.bsth.entity; | ||
| 2 | +import com.bsth.socket.protocol.Message0205; | ||
| 3 | + | ||
| 4 | +public class VehicleLocationData extends Data { | ||
| 5 | + | ||
| 6 | + /** | ||
| 7 | + * 信息类型 | ||
| 8 | + * 默认应该为0x05 | ||
| 9 | + */ | ||
| 10 | + private byte infoType; | ||
| 11 | + | ||
| 12 | + /** | ||
| 13 | + * 定位状态 | ||
| 14 | + * 位0 0有效 1无效 | ||
| 15 | + * 位1 0北纬 1南纬 | ||
| 16 | + * 位2 0东经 1西经 | ||
| 17 | + * 位3-7 保留 | ||
| 18 | + */ | ||
| 19 | + private byte locationState; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 经度 | ||
| 23 | + * 分辨率0.000001 | ||
| 24 | + */ | ||
| 25 | + private int lon; | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 纬度 | ||
| 29 | + * 分辨率0.000001 | ||
| 30 | + */ | ||
| 31 | + private int lat; | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + public VehicleLocationData(Message0205 message0205){ | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public String toString() { | ||
| 41 | + StringBuilder sb = new StringBuilder(); | ||
| 42 | + sb.append(" 信息类型: ").append(String.format("%02x", infoType)) | ||
| 43 | + .append(" 定位状态: ").append(locationState) | ||
| 44 | + .append(" 经度: ").append(lon) | ||
| 45 | + .append(" 纬度: ").append(lat); | ||
| 46 | + | ||
| 47 | + return sb.toString(); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + public String getType() { | ||
| 54 | + | ||
| 55 | + return "VehicleLocation_data"; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | +} |
src/main/java/com/bsth/util/ProtocolConverter.java
| @@ -4,6 +4,10 @@ import com.bsth.entity.AlarmData; | @@ -4,6 +4,10 @@ import com.bsth.entity.AlarmData; | ||
| 4 | import com.bsth.entity.Data; | 4 | import com.bsth.entity.Data; |
| 5 | import com.bsth.entity.PeakData; | 5 | import com.bsth.entity.PeakData; |
| 6 | import com.bsth.entity.VehicleData; | 6 | import com.bsth.entity.VehicleData; |
| 7 | +import com.bsth.entity.ExtendData; | ||
| 8 | +import com.bsth.entity.FuelCellData; | ||
| 9 | +import com.bsth.entity.VehicleLocationData; | ||
| 10 | +import com.bsth.entity.TerminalCollectData; | ||
| 7 | import com.bsth.socket.protocol.*; | 11 | import com.bsth.socket.protocol.*; |
| 8 | 12 | ||
| 9 | import java.util.HashMap; | 13 | import java.util.HashMap; |
| @@ -48,6 +52,18 @@ public class ProtocolConverter { | @@ -48,6 +52,18 @@ public class ProtocolConverter { | ||
| 48 | if (messageBody02 instanceof Message0207) { | 52 | if (messageBody02 instanceof Message0207) { |
| 49 | return new AlarmData((Message0207) messageBody02); | 53 | return new AlarmData((Message0207) messageBody02); |
| 50 | } | 54 | } |
| 55 | + if (messageBody02 instanceof Message0203){ | ||
| 56 | + return new FuelCellData((Message0203)messageBody02); | ||
| 57 | + } | ||
| 58 | + if (messageBody02 instanceof Message0205){ | ||
| 59 | + return new VehicleLocationData((Message0205)messageBody02); | ||
| 60 | + } | ||
| 61 | + if (messageBody02 instanceof Message0280){ | ||
| 62 | + return new ExtendData((Message0280)messageBody02); | ||
| 63 | + } | ||
| 64 | + if (messageBody02 instanceof Message0281){ | ||
| 65 | + return new TerminalCollectData((Message0281)messageBody02); | ||
| 66 | + } | ||
| 51 | 67 | ||
| 52 | return null; | 68 | return null; |
| 53 | } | 69 | } |
src/main/resources/application-dev.properties
| @@ -4,7 +4,7 @@ spring.jpa.show-sql= true | @@ -4,7 +4,7 @@ spring.jpa.show-sql= true | ||
| 4 | spring.datasource.control.driver-class-name= com.mysql.cj.jdbc.Driver | 4 | spring.datasource.control.driver-class-name= com.mysql.cj.jdbc.Driver |
| 5 | spring.datasource.control.jdbc-url= jdbc:mysql://10.10.150.103/control?useUnicode=true&characterEncoding=utf-8 | 5 | spring.datasource.control.jdbc-url= jdbc:mysql://10.10.150.103/control?useUnicode=true&characterEncoding=utf-8 |
| 6 | spring.datasource.control.username= root | 6 | spring.datasource.control.username= root |
| 7 | -spring.datasource.control.password= Aa123456 | 7 | +spring.datasource.control.password= fsodlgjiuigAQF2$9fs9 |
| 8 | #DATASOURCE | 8 | #DATASOURCE |
| 9 | spring.datasource.control.max-active=100 | 9 | spring.datasource.control.max-active=100 |
| 10 | spring.datasource.control.max-idle=8 | 10 | spring.datasource.control.max-idle=8 |
| @@ -20,7 +20,7 @@ spring.datasource.control.validation-query=select 1 | @@ -20,7 +20,7 @@ spring.datasource.control.validation-query=select 1 | ||
| 20 | spring.datasource.ms.hikari.driver-class-name= com.mysql.cj.jdbc.Driver | 20 | spring.datasource.ms.hikari.driver-class-name= com.mysql.cj.jdbc.Driver |
| 21 | spring.datasource.ms.jdbc-url= jdbc:mysql://10.10.150.103/ms?useUnicode=true&characterEncoding=utf-8 | 21 | spring.datasource.ms.jdbc-url= jdbc:mysql://10.10.150.103/ms?useUnicode=true&characterEncoding=utf-8 |
| 22 | spring.datasource.ms.username= root | 22 | spring.datasource.ms.username= root |
| 23 | -spring.datasource.ms.password= Aa123456 | 23 | +spring.datasource.ms.password= fsodlgjiuigAQF2$9fs9 |
| 24 | #DATASOURCE | 24 | #DATASOURCE |
| 25 | spring.datasource.ms.max-active=100 | 25 | spring.datasource.ms.max-active=100 |
| 26 | spring.datasource.ms.max-idle=8 | 26 | spring.datasource.ms.max-idle=8 |