Commit c181b71ebd908949c4ca16ac773b2a52057b2f7c
1 parent
344f94b1
燃料电池数据对接
Showing
4 changed files
with
47 additions
and
29 deletions
src/main/java/com/bsth/entity/ExtendData.java
| 1 | 1 | package com.bsth.entity; |
| 2 | 2 | import com.bsth.socket.protocol.Message0280; |
| 3 | +import org.springframework.beans.BeanUtils; | |
| 4 | + | |
| 3 | 5 | public class ExtendData extends Data{ |
| 4 | 6 | |
| 5 | 7 | /** |
| ... | ... | @@ -129,50 +131,57 @@ public class ExtendData extends Data{ |
| 129 | 131 | |
| 130 | 132 | |
| 131 | 133 | public ExtendData(Message0280 message0280){ |
| 134 | + BeanUtils.copyProperties(message0280, this); | |
| 132 | 135 | |
| 133 | - this.infoType = message0280.getInfoType() != 0xFF ? message0280.getInfoType() : (byte) 0x80; | |
| 136 | + this.infoType &= (short) 0xFF; | |
| 134 | 137 | |
| 135 | 138 | // 自定义数据长度,默认34 |
| 136 | - this.customDataLen = message0280.getCustomDataLen() != 0xFF ? message0280.getCustomDataLen() : (short) 34; | |
| 139 | + this.customDataLen &= (short) 0xFF; | |
| 137 | 140 | |
| 138 | 141 | // 蓄电池电压 |
| 139 | - this.storageBatteryVoltage = message0280.getStorageBatteryVoltage(); | |
| 142 | + this.storageBatteryVoltage &= (short) 0xFF; | |
| 140 | 143 | |
| 141 | 144 | // 左前轮胎压力 |
| 142 | - this.lfTirePressure = message0280.getLfTirePressure(); | |
| 145 | + this.lfTirePressure &= (short) 0xFF; | |
| 143 | 146 | |
| 144 | 147 | // 左前轮胎温度 |
| 145 | - this.lfTireTemp = message0280.getLfTireTemp(); | |
| 148 | + this.lfTireTemp &= (short) 0xFF; | |
| 149 | + this.lfTireTemp -=40; | |
| 146 | 150 | |
| 147 | 151 | // 右前轮胎压力 |
| 148 | - this.rfTirePressure = message0280.getRfTirePressure(); | |
| 152 | + this.rfTirePressure &= (short) 0xFF; | |
| 149 | 153 | |
| 150 | 154 | // 右前轮胎温度 |
| 151 | - this.rfTireTemp = message0280.getRfTireTemp(); | |
| 155 | + this.rfTireTemp &= (short) 0xFF; | |
| 156 | + this.rfTireTemp -=40; | |
| 152 | 157 | |
| 153 | 158 | // 左后轮胎1压力 |
| 154 | - this.lrTirePressure1 = message0280.getLrTirePressure1(); | |
| 159 | + this.lrTirePressure1 &= (short) 0xFF; | |
| 155 | 160 | |
| 156 | 161 | // 左后轮胎1温度 |
| 157 | 162 | this.lrTireTemp1 = message0280.getLrTireTemp1(); |
| 163 | + this.lrTireTemp1 -=40; | |
| 158 | 164 | |
| 159 | 165 | // 左后轮胎2压力 |
| 160 | 166 | this.lrTirePressure2 = message0280.getLrTirePressure2(); |
| 161 | 167 | |
| 162 | 168 | // 左后轮胎2温度 |
| 163 | 169 | this.lrTireTemp2 = message0280.getLrTireTemp2(); |
| 170 | + this.lrTireTemp2 -=40; | |
| 164 | 171 | |
| 165 | 172 | // 右后轮胎1压力 |
| 166 | 173 | this.rrTirePressure1 = message0280.getRrTirePressure1(); |
| 167 | 174 | |
| 168 | 175 | // 右后轮胎1温度 |
| 169 | 176 | this.rrTireTemp1 = message0280.getRrTireTemp1(); |
| 177 | + this.rrTireTemp1 -=40; | |
| 170 | 178 | |
| 171 | 179 | // 右后轮胎2压力 |
| 172 | 180 | this.rrTirePressure2 = message0280.getRrTirePressure2(); |
| 173 | 181 | |
| 174 | 182 | // 右后轮胎2温度 |
| 175 | 183 | this.rrTireTemp2 = message0280.getRrTireTemp2(); |
| 184 | + this.rrTireTemp2 -=40; | |
| 176 | 185 | |
| 177 | 186 | |
| 178 | 187 | ... | ... |
src/main/java/com/bsth/entity/FuelCellData.java
| 1 | 1 | package com.bsth.entity; |
| 2 | 2 | import com.bsth.socket.protocol.Message0203; |
| 3 | +import org.springframework.beans.BeanUtils; | |
| 3 | 4 | |
| 4 | 5 | |
| 5 | 6 | public class FuelCellData extends Data{ |
| ... | ... | @@ -105,19 +106,22 @@ public class FuelCellData extends Data{ |
| 105 | 106 | private byte dcState; |
| 106 | 107 | |
| 107 | 108 | 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(); | |
| 109 | + BeanUtils.copyProperties(message0203, this); | |
| 110 | + this.infoType &= (short) 0xFF; | |
| 111 | + this.voltage &= (short) 0xFF; | |
| 112 | + this.current &= (short) 0xFF; | |
| 113 | + this.fuelConsumeRate &= (short) 0xFF; | |
| 114 | + this.tempProbeQuantity &= (short) 0xFF; | |
| 115 | + for (int i = 0; i < temps.length; i++) { | |
| 116 | + this.temps[i] -= 40; } | |
| 117 | + this.hydrogenMaxTemp &= (short) 0xFF; | |
| 118 | + this.hydrogenMaxTemp -=40; | |
| 119 | + this.maxTempSensorCode &= (short) 0xFF; | |
| 120 | + this.hydrogenMaxConcentration &= (short) 0xFF; | |
| 121 | + this.maxConcentrationSensorCode &= (short) 0xFF; | |
| 122 | + this.hydrogenMaxPressure &= (short) 0xFF; | |
| 123 | + this.maxPressureSensorCode &= (short) 0xFF; | |
| 124 | + this.dcState &= (short) 0xFF; | |
| 121 | 125 | } |
| 122 | 126 | |
| 123 | 127 | ... | ... |
src/main/java/com/bsth/entity/TerminalCollectData.java
| 1 | 1 | package com.bsth.entity; |
| 2 | 2 | import com.bsth.socket.protocol.Message0281; |
| 3 | +import org.springframework.beans.BeanUtils; | |
| 3 | 4 | |
| 4 | 5 | public class TerminalCollectData extends Data { |
| 5 | 6 | |
| ... | ... | @@ -62,30 +63,31 @@ public class TerminalCollectData extends Data { |
| 62 | 63 | private short totalCurrent; |
| 63 | 64 | |
| 64 | 65 | public TerminalCollectData(Message0281 message0281){ |
| 66 | + BeanUtils.copyProperties(message0281, this); | |
| 65 | 67 | |
| 66 | - this.acceleratorFlag = message0281.getDataList().get(0).getAcceleratorFlag() != 0xFF ? message0281.getDataList().get(0).getAcceleratorFlag() : (byte) 0x01; | |
| 68 | + this.acceleratorFlag &= (short) 0xFF; | |
| 67 | 69 | |
| 68 | 70 | // 加速踏板行程值 |
| 69 | - this.acceleratorState = message0281.getDataList().get(0).getAcceleratorState(); | |
| 71 | + this.acceleratorState &= (short) 0xFF; | |
| 70 | 72 | |
| 71 | 73 | // 制动踏板标识类型,默认应该为0x02 |
| 72 | - this.brakePedalFlag = message0281.getDataList().get(0).getBrakePedalFlag() != 0xFF ? message0281.getDataList().get(0).getBrakePedalFlag() : (byte) 0x02; | |
| 74 | + this.brakePedalFlag &= (short) 0xFF; | |
| 73 | 75 | |
| 74 | 76 | // 制动踏板状态 |
| 75 | - this.brakePedalState = message0281.getDataList().get(0).getBrakePedalState(); | |
| 77 | + this.brakePedalState &= (short) 0xFF; | |
| 76 | 78 | |
| 77 | 79 | |
| 78 | 80 | // 车速标识类型,默认应该为0x03 |
| 79 | - this.speedFlag = message0281.getDataList().get(0).getSpeedFlag() != 0xFF ? message0281.getDataList().get(0).getSpeedFlag() : (byte) 0x03; | |
| 81 | + this.speedFlag &= (short) 0xFF; | |
| 80 | 82 | |
| 81 | 83 | // 车速 |
| 82 | - this.speed = message0281.getDataList().get(0).getSpeed(); | |
| 84 | + this.speed &= (short) 0xFF; | |
| 83 | 85 | |
| 84 | 86 | // 总电流标识类型,默认应该为0x04 |
| 85 | - this.totalCurrentFlag = message0281.getDataList().get(0).getTotalCurrentFlag() != 0xFF ? message0281.getDataList().get(0).getTotalCurrentFlag() : (byte) 0x04; | |
| 87 | + this.totalCurrentFlag &= (short) 0xFF; | |
| 86 | 88 | |
| 87 | 89 | // 总电流 |
| 88 | - this.totalCurrent = message0281.getDataList().get(0).getTotalCurrent(); | |
| 90 | + this.totalCurrent &= (short) 0xFF; | |
| 89 | 91 | |
| 90 | 92 | |
| 91 | 93 | ... | ... |
src/main/java/com/bsth/entity/VehicleLocationData.java