Chapter 8: C2C Serial Device Support (v0.3.7 update) - zymbia-carpm/garagepro_sdk GitHub Wiki
This update (SDK version 34, 0.3.7) adds support for the C2C OBD serial device over the wired UART (serial) transport. The change is additive and requires no API changes — you connect exactly the way you already do for a serial port, and every diagnostic function works unchanged.
Connect to the C2C serial device
Provide the serial device path and baud rate; the SDK opens, manages and closes the port for you.
GProDeviceConnection connection = GProDeviceConnection.forUart("/dev/ttyS1", 115200);
The first argument is the serial device node (e.g. /dev/ttyS1); the second is the baud rate. The
C2C device uses 115200.
Run diagnostics as usual
Pass the connection to the scan process and call the same functions you already use:
GProScanProcess gProScanProcess = new GProScanProcess(context, connection, scanListener);
gProScanProcess.initVinCheck(...); // read the vehicle VIN
gProScanProcess.initScan(makeName, registrationNumber, jobCardId); // full fault scan
gProScanProcess.initClearCodes(...); // clear fault codes
Live data works the same way:
GProLiveScanProcess gProLiveScanProcess = new GProLiveScanProcess(context, connection, liveListener);
gProLiveScanProcess.initLiveScan(...);
NOTE — VIN check, full scan, clear codes and live data are all supported over the C2C device. Every result and failure is delivered through the same 'GProScanListener' / 'GProLiveScanListener' callbacks you already use — there are no new interfaces to implement.
Stop a scan on demand
You can stop an in-progress scan or live scan immediately and release the connection:
gProScanProcess.forceStop();
Optionally pass a 'GProConnectionClosedListener' to be told, exactly once, after the connection has been closed:
gProScanProcess.forceStop(new GProConnectionClosedListener() {
@Override
public void onConnectionClosed(String message) {
Log.d(TAG, "Connection closed: " + message);
// safe to reconnect / start a new scan from here
}
});
The same 'forceStop(...)' methods are available on 'GProLiveScanProcess'. The callback is delivered on the main thread.
Upgrade
implementation ('com.github.zymbia-carpm:garagepro_sdk:v0.3.7') {
transitive = true
}
Fully backward compatible — no code changes are required for existing integrations.