| | |
| | | |
| | | import com.flightfeather.obd.common.utils.FileUtil |
| | | import com.flightfeather.obd.repository.* |
| | | import com.flightfeather.obd.socket.bean.EngineDataStream |
| | | import com.flightfeather.obd.socket.bean.ObdInfo |
| | | import com.flightfeather.obd.socket.bean.ObdPackageData |
| | | import com.flightfeather.obd.socket.bean.SupplementDataStream |
| | | import com.flightfeather.obd.socket.decoder.VehicleDataDecoder |
| | | import com.flightfeather.obd.socket.decoder.impl.DataPackageDecoderImpl |
| | | import com.flightfeather.obd.socket.eunm.ObdCommandUnit |
| | |
| | | when (packageData.commandUnit) { |
| | | ObdCommandUnit.CarRegister.value -> instance.carLoginRepository.saveCarLogin(packageData) |
| | | ObdCommandUnit.RealTimeData.value, |
| | | ObdCommandUnit.ReplacementData.value -> instance.dataStreamRepository.saveDataStream(packageData) |
| | | ObdCommandUnit.ReplacementData.value -> { |
| | | var done = false |
| | | for (i in 0 until packageData.dataUnit.size) { |
| | | when (packageData.dataUnit[i]) { |
| | | is ObdInfo -> instance.obdInfoRepository.saveObdInfo(packageData) |
| | | is EngineDataStream, |
| | | is SupplementDataStream -> { |
| | | instance.dataStreamRepository.saveDataStream(packageData) |
| | | done = true |
| | | } |
| | | } |
| | | if (done) break |
| | | } |
| | | } |
| | | ObdCommandUnit.CarLogOut.value-> instance.carLogoutRepository.saveCarLogout(packageData) |
| | | } |
| | | } |