You can use the GetVehicleData
and SubscribeVehicleData
RPC requests to get vehicle data. Each vehicle manufacturer decides which data it will expose and to whom they will expose it. Please check the response from Core to find out which data you will have permission to access. Additionally, be aware that the user may have the ability to disable vehicle data access through the settings menu of their head unit. It may be possible to access vehicle data when the hmiLevel
is NONE
(i.e. the user has not opened your SDL app) but you will have to request this permission from the vehicle manufacturer.
You will only have access to vehicle data that is allowed to your appName
and appId
combination. Permissions will be granted by each OEM separately. See Understanding Permissions for more details.
Vehicle Data | Parameter Name | Description |
---|---|---|
Acceleration Pedal Position | accPedalPosition | Accelerator pedal position (percentage depressed) |
Airbag Status | airbagStatus | Status of each of the airbags in the vehicle: yes, no, no event, not supported, fault |
Belt Status | beltStatus | The status of each of the seat belts: no, yes, not supported, fault, or no event |
Body Information | bodyInformation | Door ajar status for each door. The Ignition status. The ignition stable status. The park brake active status. |
Cloud App Vehicle Id | cloudAppVehicleID | The id for the vehicle when connecting to cloud applications |
Cluster Mode Status | clusterModeStatus | Whether or not the power mode is active. The power mode qualification status: power mode undefined, power mode evaluation in progress, not defined, power mode ok. The car mode status: normal, factory, transport, or crash. The power mode status: key out, key recently out, key approved, post accessory, accessory, post ignition, ignition on, running, crank |
Device Status | deviceStatus | Contains information about the smartphone device. Is voice recognition on or off, has a bluetooth connection been established, is a call active, is the phone in roaming mode, is a text message available, the battery level, the status of the mono and stereo output channels, the signal level, the primary audio source, whether or not an emergency call is currently taking place |
Driver Braking | driverBraking | The status of the brake pedal: yes, no, no event, fault, not supported |
E-Call Infomation | eCallInfo | Information about the status of an emergency call |
Electronic Parking Brake Status | electronicParkingBrakeStatus | The status of the electronic parking brake. Available states: closed, transition, open, drive active, fault |
Emergency event | emergencyEvent | The type of emergency: frontal, side, rear, rollover, no event, not supported, fault. Fuel cutoff status: normal operation, fuel is cut off, fault. The roll over status: yes, no, no event, not supported, fault. The maximum change in velocity. Whether or not multiple emergency events have occurred |
Engine Oil Life | engineOilLife | The estimated percentage (0% - 100%) of remaining oil life of the engine |
Engine Torque | engineTorque | Torque value for engine (in Nm) on non-diesel variants |
External Temperature | externalTemperature | The external temperature in degrees celsius |
Fuel Level | fuelLevel | The fuel level in the tank (percentage) |
Fuel Level State | fuelLevel_State | The fuel level state: Unknown, Normal, Low, Fault, Alert, or Not Supported |
Fuel Range | fuelRange | The estimate range in KM the vehicle can travel based on fuel level and consumption |
GPS | gps | Longitude and latitude, current time in UTC, degree of precision, altitude, heading, speed, satellite data vs dead reckoning, and supported dimensions of the GPS |
Head Lamp Status | headLampStatus | Status of the head lamps: whether or not the low and high beams are on or off. The ambient light sensor status: night, twilight 1, twilight 2, twilight 3, twilight 4, day, unknown, invalid |
Instant Fuel Consumption | instantFuelConsumption | The instantaneous fuel consumption in microlitres |
My Key | myKey | Information about whether or not the emergency 911 override has been activated |
Odometer | odometer | Odometer reading in km |
PRNDL | prndl | The selected gear the car is in: park, reverse, neutral, drive, sport, low gear, first, second, third, fourth, fifth, sixth, seventh or eighth gear, unknown, or fault |
Speed | speed | Speed in KPH |
Steering Wheel Angle | steeringWheelAngle | Current angle of the steering wheel (in degrees) |
Tire Pressure | tirePressure | Tire status of each wheel in the vehicle: normal, low, fault, alert, or not supported. Warning light status for the tire pressure: off, on, flash, or not used |
Turn Signal | turnSignal | The status of the turn signal. Available states: off, left, right, both |
RPM | rpm | The number of revolutions per minute of the engine |
VIN | vin | The Vehicle Identification Number |
Wiper Status | wiperStatus | The status of the wipers: off, automatic off, off moving, manual interaction off, manual interaction on, manual low, manual high, manual flick, wash, automatic low, automatic high, courtesy wipe, automatic adjust, stalled, no data exists |
To get vehicle data a single time, use the GetVehicleData
RPC.
GetVehicleData vdRequest = new GetVehicleData(); vdRequest.setPrndl(true); vdRequest.setOnRPCResponseListener(new OnRPCResponseListener() { @Override public void onResponse(int correlationId, RPCResponse response) { if(response.getSuccess()){ PRNDL prndl = ((GetVehicleDataResponse) response).getPrndl(); Log.i("SdlService", "PRNDL status: " + prndl.toString()); }else{ Log.i("SdlService", "GetVehicleData was rejected."); } } @Override public void onError(int correlationId, Result resultCode, String info){ Log.e(TAG, "onError: "+ resultCode+ " | Info: "+ info ); } }); sdlManager.sendRPC(vdRequest);
Subscribing to vehicle data allows you to get notifications whenever new data is available. You should not rely upon getting this data in a consistent manner. New vehicle data is available roughly every second, but this is totally dependent on which head unit you are connected to.
First, you should add a notification listener for the OnVehicleData
notification:
sdlManager.addOnRPCNotificationListener(FunctionID.ON_VEHICLE_DATA, new OnRPCNotificationListener() { @Override public void onNotified(RPCNotification notification) { OnVehicleData onVehicleDataNotification = (OnVehicleData) notification; if (onVehicleDataNotification.getPrndl() != null) { Log.i("SdlService", "PRNDL status was updated to: " + onVehicleDataNotification.getPrndl()); } } });
Second, send the SubscribeVehicleData
request:
SubscribeVehicleData subscribeRequest = new SubscribeVehicleData(); subscribeRequest.setPrndl(true); subscribeRequest.setOnRPCResponseListener(new OnRPCResponseListener() { @Override public void onResponse(int correlationId, RPCResponse response) { if(response.getSuccess()){ Log.i("SdlService", "Successfully subscribed to vehicle data."); }else{ Log.i("SdlService", "Request to subscribe to vehicle data was rejected."); } } @Override public void onError(int correlationId, Result resultCode, String info){ Log.e(TAG, "onError: "+ resultCode+ " | Info: "+ info ); } }); sdlManager.sendRPC(subscribeRequest);
Third, the onNotified
method will be called when there is an update to the subscribed vehicle data.
We suggest that you only subscribe to vehicle data as needed. To stop listening to specific vehicle data use the UnsubscribeVehicleData
RPC.
UnsubscribeVehicleData unsubscribeRequest = new UnsubscribeVehicleData(); unsubscribeRequest.setPrndl(true); // unsubscribe to PRNDL data unsubscribeRequest.setOnRPCResponseListener(new OnRPCResponseListener() { @Override public void onResponse(int correlationId, RPCResponse response) { if(response.getSuccess()){ Log.i("SdlService", "Successfully unsubscribed to vehicle data."); }else{ Log.i("SdlService", "Request to unsubscribe to vehicle data was rejected."); } } @Override public void onError(int correlationId, Result resultCode, String info){ Log.e(TAG, "onError: "+ resultCode+ " | Info: "+ info ); } }); sdlManager.sendRPC(unsubscribeRequest);