-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Implement obd ble tmp #21907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Implement obd ble tmp #21907
Conversation
| LIVE(0x41), FREEZE(0x42), IDENTIFICATION(0x49) | ||
| } | ||
|
|
||
| private val sideDataToRemoveFromAnswer = arrayOf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs better name
| val connection = Obd2Connection(createTransport(), this) | ||
| try { | ||
| while (isConnected(connection)) { | ||
| var connectedScannerIsStopped = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whole logics related to OBDResponse.STOPPED needs to be explained.
| } | ||
|
|
||
| private fun normalizeResponseString(fullCommand: String, response: String): String { | ||
| var response1 = response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use response1 like names
| boolean isOBDDevice = device instanceof BLEOBDDevice; | ||
| if (isOBDDevice && vehicleMetricsPlugin != null || !isOBDDevice && externalSensorsPlugin != null) { | ||
| devices.put(device.getDeviceId(), device); | ||
| if (isOBDDevice && vehicleMetricsPlugin != null) { | ||
| vehicleMetricsPlugin.onBLEDeviceFound((BLEOBDDevice) device); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be refactored!!!
| if (device instanceof BLEOBDDevice) { | ||
| ((BLEOBDDevice) device).setDeviceReadyListener(new BLEOBDDevice.DeviceReadyListener() { | ||
| @Override | ||
| public void onDeviceReadyStateChange(boolean isReady) { | ||
| VehicleMetricsPlugin vehicleMetricsPlugin = PluginsHelper.getPlugin(VehicleMetricsPlugin.class); | ||
| vehicleMetricsPlugin.connectToDevice((BLEOBDDevice) device); | ||
| } | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be refactored!!!
| } | ||
|
|
||
| @Nullable | ||
| protected List<BluetoothGattCharacteristic> cachedCharacteristics; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Insert fields at top of the class!
| cachedCharacteristics?.let { | ||
| } | ||
| } | ||
| log.debug("Відправлено команду: $command; result $res") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write logs in english only
No description provided.