Package org.opencabstandard.provider
Class VehicleInformationContract
java.lang.Object
org.opencabstandard.provider.VehicleInformationContract
Defines the contract for the OpenCab Vehicle Information provider. An OpenCab Vehicle Information provider app should
define an Android
ContentProvider
class
that follows this contract or should subclass the AbstractVehicleInformationProvider class and
implement the abstract methods.
sequenceDiagram
participant A as OpenCab Consumer
participant B as OpenCab Provider
Note over A,B: consumer app launches, no driver logged in
A->>+B: provider.call(METHOD_GET_VEHICLE_INFORMATION, version: 1)
B->>A: {VEHICLE_INFORMATION: null}
Note over A,B: driver logs in or connects to a vehicle mount
B->>A: ACTION_VEHICLE_INFORMATION_CHANGED
A->>+B: provider.call(METHOD_GET_VEHICLE_INFORMATION, version: 1)
B->>A: {VEHICLE_INFORMATION: {VIN: "JH4NA1150RT000268", inGear: false}}
Note over A,B: driver switches to D status or puts vehicle in gear
B->>A: ACTION_VEHICLE_INFORMATION_CHANGED
A->>+B: provider.call(METHOD_GET_VEHICLE_INFORMATION, version: 1)
B->>A: {VEHICLE_INFORMATION: {VIN: "JH4NA1150RT000268", inGear: true}}
Note over A,B: driver logs out or detaches tablet
B->>A: ACTION_VEHICLE_INFORMATION_CHANGED
A->>+B: provider.call(METHOD_GET_VEHICLE_INFORMATION, version: 1)
B->>A: {VEHICLE_INFORMATION: null}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Object containing the vehicle information. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
This Action is broadcast when the vehicle information changes, perhaps because the driver chooses to associate with another vehicle, or if the device removed from a vehicle in a slip-seat scenario.static final String
This authority is declared in the manifest for the app that acts as the vehicle information provider.static final String
If an error has occurred in one of the provider method calls, use this key to retrieve the error from the Bundle object returned from the provider call method.static final String
Use this key to retrieve the VIN from theBundle
object that is returned from theVehicleInformationContract
.METHOD_GET_VEHICLE_INFORMATION method call.static final String
For the methodsVehicleInformationContract
.METHOD_GET_VEHICLE_INFORMATION andVehicleInformationContract
.METHOD_GET_VEHICLE_INFORMATION, the returnedBundle
object will contain this key which maps to String indicating contract version supported.static final String
Provider method for retrieving the vehicle information.static final String
This is the name of the receiver class.static final String
This is the current version of theVehicleInformationContract
for the OpenCab Standard. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
VERSION
This is the current version of theVehicleInformationContract
for the OpenCab Standard. The version will be passed as an argument to all method calls to the provider. The provider may reject or handle appropriately if the VERSION does not match the expected value. An OpenCab vehicle information provider allows access to details about the vehicle, if any, associated with the mobile device running the app or associated with the driver who is logged into the mobile app.- See Also:
-
AUTHORITY
This authority is declared in the manifest for the app that acts as the vehicle information provider. It is then used by the consumer app to identify any providers installed on the device.- See Also:
-
VEHICLE_INFORMATION_CHANGED_RECEIVER
This is the name of the receiver class. Application will be looking for classes with this name when it tries to broadcast an event.- See Also:
-
ACTION_VEHICLE_INFORMATION_CHANGED
This Action is broadcast when the vehicle information changes, perhaps because the driver chooses to associate with another vehicle, or if the device removed from a vehicle in a slip-seat scenario.- See Also:
-
METHOD_GET_VEHICLE_INFORMATION
Provider method for retrieving the vehicle information.Example:
ContentResolver
resolver = getApplicationContext().getContentResolver();Bundle
result = resolver.call(Uri.parse("content://" +VehicleInformationContract
.AUTHORITY),VehicleInformationContract
.METHOD_GET_VEHICLE_INFORMATION,VehicleInformationContract
.VERSION, null);VehicleInformationContract
.VehicleInformation info = result.getParcelableArrayList(VehicleInformationContract
.KEY_VEHICLE_INFORMATION);- See Also:
-
KEY_VEHICLE_INFORMATION
Use this key to retrieve the VIN from theBundle
object that is returned from theVehicleInformationContract
.METHOD_GET_VEHICLE_INFORMATION method call. If the value is null, an error occurred and you can then retrieve the error from theBundle
using the keyVehicleInformationContract
.KEY_ERROR.Example:
ContentResolver
resolver = getApplicationContext().getContentResolver();Bundle
result = resolver.call(Uri.parse("content://" +VehicleInformationContract
.AUTHORITY),VehicleInformationContract
.METHOD_GET_VEHICLE_INFORMATION,VehicleInformationContract
.VERSION, null);VehicleInformationContract
.VehicleInformation info = result.getParcelableArrayList(VehicleInformationContract
.KEY_VEHICLE_INFORMATION);- See Also:
-
KEY_ERROR
If an error has occurred in one of the provider method calls, use this key to retrieve the error from the Bundle object returned from the provider call method.Example:
Bundle
result = provider.call(Uri.parse("content://" +VehicleInformationContract
.AUTHORITY), "ANY METHOD",VehicleInformationContract
.VERSION, null); String error = result.getString(VehicleInformationContract
.KEY_ERROR);- See Also:
-
KEY_VERSION
For the methodsVehicleInformationContract
.METHOD_GET_VEHICLE_INFORMATION andVehicleInformationContract
.METHOD_GET_VEHICLE_INFORMATION, the returnedBundle
object will contain this key which maps to String indicating contract version supported.Example:
ContentResolver
resolver = getApplicationContext().getContentResolver();Bundle
result = resolver.call(Uri.parse("content://" +HOSContract
.AUTHORITY),VehicleInformationContract
.METHOD_GET_LOGIN_CREDENTIALS,IdentityContract
.VERSION, null); String version = result.getBoolean(IdentityContract
.METHOD_GET_VEHICLE_INFORMATION);- See Also:
-
-
Constructor Details
-
VehicleInformationContract
public VehicleInformationContract()
-