API Reference - pims.vehicle.connection
This API will forward connection events when the Trip
service will be enabled.
Enabling the Trips
is done using SUBSCRIBE pims.vehicle.trips . Thatâs why you should subscribe to pims.vehicle.connection before.
Input Parameter | |||||
---|---|---|---|---|---|
No params |
Output Data | |||||
---|---|---|---|---|---|
Data name | Description | Type | Unit/Values | Example | |
vin | Vehicleâs VIN. It can be null if no VIN connected. |
String |
|
VR1AB12C3D45678909
|
|
protocol | Field present if |
Enum of Strings |
- CEA
- Altran
|
CEA
|
|
model | Field present if |
Enum of Strings |
- SMEG
- NAC
- RCC
- RCE
- AIO_NAC
- AIO_RCC
- IVI
|
NAC
|
|
version |
|
String |
|
1.0.2
|
|
privacy | Field present if |
Enum of Strings |
- Full
- Geolocation
- None
- Unknown
|
Full
|
Error | |
---|---|
No errors |
1
2
3
4
5
6
7
pims.get("pims.vehicle.connection"
/* no params */
) { message -> when (message["status"] as? String) {
"SUCCEEDED" -> { } // handle succeeded status
"FAILED" -> { } // handle failed status
} }
1
2
3
4
5
6
7
pims.get(api: "pims.vehicle.connection"
/* no params */
) { (message) in
if message["status"] == "SUCEEDED" { } // handle succeeded status
else if message["status"] == "FAILED" { } // handle failed status
}
1
2
3
4
5
6
7
8
9
10
11
12
// representation of the `succeeded` dictionary object message as JSON
{
"transactionId": "953cfefb-bc72",
"status": "SUCCEEDED",
"result": {
"vin": "VR1AB12C3D45678909",
"protocol": "CEA",
"model": "NAC",
"version": "1.0.2",
"privacy": "Full"
}
}
false
This API will forward connection events when the Trip
service will be enabled.
Enabling the Trips
is done using SUBSCRIBE pims.vehicle.trips . Thatâs why you should subscribe to pims.vehicle.connection before.
Notification will be sent depending on nature of Head Unit:
CEA
: Once CEA session is openedAltran
: Once authentication is done
The unsubscribe api removes registration on connection change status. Any parameter required for this api.
Input Parameter | |||||
---|---|---|---|---|---|
No params |
Output Data | ||||
---|---|---|---|---|
Data name | Description | Type | Unit/Values | Example |
vin | Vehicle Identification Number |
String |
|
VR1AB12C3D4567890
|
status | Connection status. |
Enum of Strings |
- Connected
- Disconnected
|
Connected
|
protocol | Field present if |
Enum of Strings |
- CEA
- Altran
|
CEA
|
model | Field present if |
Enum of Strings |
- SMEG
- NAC
- RCC
- RCE
- AIO_NAC
- AIO_RCC
- IVI
|
NAC
|
version | Protocol version (SemVer format). Field present if |
String |
|
1.0.2
|
privacy | Field present if |
Enum of Strings |
- Full
- Geolocation
- None
- Unknown
|
Full
|
Error | |
---|---|
Error Code | Error Label |
2001 | Facade not initialized |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* Subscribe, see unsubscribe below */
pims.subscribe("pims.vehicle.connection"
/* no params */
) { message -> when (message["status"] as? String) {
"SUCCEEDED" -> { } // handle succeeded status
"FAILED" -> { } // handle failed status
"RESULT" -> {
if(message["error"] != null) { } // handle error event code
else { } // handle result event code
}
} }
/* Unsubscribe */
pims.unsubscribe( "pims.vehicle.connection" /* no params */ )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* Subscribe, see unsubscribe below */
pims.subscribe(api: "pims.vehicle.connection"
/* no params */
) { (message) in
if message["status"] == "SUCEEDED" { } // handle succeeded status
else if message["status"] == "FAILED" { } // handle failed status
else if status == "RESULT" {
if !message["error"].isEmpty { } // handle error event code
else { } // handle result event code
}
}
/* Unsubscribe */
pims.unsubscribe( api: "pims.vehicle.connection" /* no params */ )
1
2
3
4
5
6
// representation of the `succeeded` dictionary object message as JSON
{
"transactionId": "953cfefb-bc72",
"status": "SUCCEEDED",
"result": null
}
1
2
3
4
5
6
7
8
9
10
11
12
13
// representation of the `result` dictionary object message as JSON
{
"transactionId": "953cfefb-bc72",
"status": "RESULT",
"result": {
"": "",
"status": "Connected",
"protocol": "CEA",
"model": "NAC",
"version": "1.0.2",
"privacy": "Full"
}
}
1
2
3
4
5
6
7
8
9
10
11
// representation of the `failed` dictionary objects messages as JSON
/* -------- STATUS FAILED: 2001 -------- */
{
"transactionId": "953cfefb-bc72",
"status": "FAILED",
"error": {
"code": 2001,
"label": "Facade not initialized"
}
}