API Reference - pims.vehicle.informations-O2X
This API allows to subscribe to O2X vehicle informations.
Input Parameter | |||||
---|---|---|---|---|---|
Param name | Description | Type | Unit/Values | Example | Required |
actionType | Action name, in this case |
String |
|
O2X
|
true |
vin | Vehicle Identification Number. Required only if |
String |
|
VR1AB12C3D4567890
|
false |
reception | Type of subscription. |
String |
- status: 'notified when the state of the vehicle changes.'
- information: 'notified when the device receives data from the dongle.'
|
status
|
true |
firstTime | Indicates if is an auto start or no. If |
Boolean |
|
true
|
true |
Output Data | ||||
---|---|---|---|---|
Data name | Description | Type | Unit/Values | Example |
vin | Vehicle Identification Number |
String |
|
VR1AB12C3D4567890
|
receivedAt | Receive time. |
String |
|
YYYY-MM-DDTHH:MM:SSZ
|
status | Vehicle status. |
String |
- unknown
- driving
- parked
- charging
|
charging
|
currentAlert | CurrentAlert informations. |
Object |
/ |
|
currentAlert
.parkingBrake |
Is parking brake alert active. |
Boolean |
false
|
|
currentAlert
.clusterIssue |
Is cluster issue alert active. |
Boolean |
false
|
|
currentAlert
.stop |
Is stop alert active. |
Boolean |
true
|
|
currentAlert
.batteryCharge |
Is battery charge alert active. |
Boolean |
true
|
|
currentAlert
.brakeSystemProblem |
Is brake system problem alert. |
Boolean |
true
|
|
currentAlert
.service |
Is service alert active. |
Boolean |
false
|
|
currentAlert
.batteryTemperature |
Is batter temperature alert active. |
Boolean |
true
|
|
currentAlert
.turtleMode |
Is turtle mode alert active. |
Boolean |
false
|
|
previousAlert | PreviousAlert informations. |
Object |
/ |
|
previousAlert
.parkingBrake |
Is parking brake alert was active. |
Boolean |
|
false
|
previousAlert
.clusterIssue |
Is cluster issue alert was active. |
Boolean |
|
false
|
previousAlert
.stop |
Is stop alert was active. |
Boolean |
|
true
|
previousAlert
.batteryCharge |
Is battery charge alert was active. |
Boolean |
|
true
|
previousAlert
.brakeSystemProblem |
Is brake system problem alert was active. |
Boolean |
|
true
|
previousAlert
.service |
Is service alert was active. |
Boolean |
|
false
|
previousAlert
.batteryTemperature |
Is batter temperature alert was active. |
Boolean |
|
true
|
previousAlert
.turtleMode |
Is turtle mode alert was active. |
Boolean |
|
false
|
data | Data informations. |
Object |
/ |
|
data
.batterySoc |
BatterySoc informations. |
Object |
/ |
|
data
.batterySoc .value |
Battery soc value. |
String |
|
|
data
.batterySoc .unit |
Battery soc unit. |
String |
|
|
data
.systemState |
System state value. |
String |
- init
- standby
- driving
- charging
- noticed
- powerdown
- sleep
- unknown
|
sleep
|
data
.batteryState |
battery state value |
String |
- ready
- maintenaceautoid
- bootloader
- maintenancelogflash
- maintenanceexit
- maintenanceinit
- shutdownwait
- bootwait
- bootexit
- bootinit
- errorwait
- errorexit
- errorinit
- chargewait
- chargeheatingaftercharging
- chargeopenpwrrelays
- chargechargingwithheating
- chargecharging
- chargeclosepwrrelays
- chargeheatingforcharging
- chargecheckchargerstatus
- chargeactivebaltest
- chargeexit
- chargeinit
- downgradedsafetyline
- downgradedopenpwrrelays
- downgradedheating
- downgradedrunning
- downgradedclosepwrrelays
- downgradedexit
- downgradedinit
- runwaiting
- runsafetyline
- runopenpwrrelays
- runheating
- runrunning
- runclosepwrrelays
- runexit
- runinit
- docerror
- unknown
|
ready
|
data
.remainingAutonomy |
remainingAutonomy informations. |
Object |
/ |
|
data
.remainingAutonomy .value |
Remaining autonomy value. |
String |
|
|
data
.remainingAutonomy .unit |
Remaining autonomy unit. |
String |
|
|
data
.rnd |
the position of the gearbox |
String |
- unknown
- reverse
- neutral
- drive
|
neutral
|
data
.chargeDelay |
chargeDelay informations. |
Object |
/ |
|
data
.chargeDelay .value |
Charge delay value. |
String |
|
|
data
.chargeDelay .unit |
Charge delay unit. |
String |
|
|
data
.parkBrakeStatus |
Park brake status. |
String |
- activated
- notActivated
- unknown
|
notActivated
|
data
.totalOdometer |
Total odometer information. |
object |
/ |
|
data
.totalOdometer .value |
Total odometer value. |
String |
|
|
data
.totalOdometer .unit |
Total odometer unit. |
String |
|
|
Error | |
---|---|
Error Code | Error Label |
2001 | Facade not initialized |
2101 | Missing [PARAMETER] parameter |
2102 | Invalid [PARAMETER] parameter |
2201 | Timeout |
2203 | Invalid return [Parsing error] ou [No data] ou [invalid Data] |
2339 | Service already started |
2340 | [Permition] need to be granted |
2341 | [Location or Bluetooth] need to be activated on the phone |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* Subscribe, see unsubscribe below */
pims.subscribe("pims.vehicle.informations",
mapOf( /* parameters */
Pair("actionType", "O2X"),
Pair("vin", "VR1AB12C3D4567890"),
Pair("reception", "status"),
Pair("firstTime", "true")
)
) { 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.informations" /* no params */ )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* Subscribe, see unsubscribe below */
pims.subscribe(api: "pims.vehicle.informations",
parameters: [
"actionType": "O2X",
"vin": "VR1AB12C3D4567890",
"reception": "status",
"firstTime": "true"
]
) { (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.informations" /* 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
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// representation of the `result` dictionary object message as JSON
{
"transactionId": "953cfefb-bc72",
"status": "RESULT",
"result": {
"receivedAt": "YYYY-MM-DDTHH:MM:SSZ",
"status": "charging",
"currentAlert": {
"parkingBrake": true,
"clusterIssue": true,
"stop": true,
"batteryCharge": true,
"brakeSystemProblem": true,
"service": true,
"batteryTemperature": true,
"turtleMode": true
},
"previousAlert": {
"parkingBrake": true,
"clusterIssue": true,
"stop": true,
"batteryCharge": true,
"brakeSystemProblem": true,
"service": true,
"batteryTemperature": true,
"turtleMode": true
},
"data": {
"batterySoc": {
"unit": "unit_name",
"value": 42
},
"systemState": "charging",
"batteryState": "bootloader",
"remainingAutonomy": {
"unit": "unit_name",
"value": 42
},
"rnd": "drive",
"chargeDelay": {
"unit": "unit_name",
"value": 42
},
"parkBrakeStatus": "activated",
"totalOdometer": {
"unit": "unit_name",
"value": 42
}
},
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// representation of the `failed` dictionary objects messages as JSON
/* -------- STATUS FAILED: 2001 -------- */
{
"transactionId": "953cfefb-bc72",
"status": "FAILED",
"error": {
"code": 2001,
"label": "Facade not initialized"
}
}
/* -------- STATUS FAILED: 2101 -------- */
{
"transactionId": "953cfefb-bc72",
"status": "FAILED",
"error": {
"code": 2101,
"label": "Missing [PARAMETER] parameter"
}
}
/* -------- STATUS FAILED: 2102 -------- */
{
"transactionId": "953cfefb-bc72",
"status": "FAILED",
"error": {
"code": 2102,
"label": "Invalid [PARAMETER] parameter"
}
}
/* -------- STATUS FAILED: 2201 -------- */
{
"transactionId": "953cfefb-bc72",
"status": "FAILED",
"error": {
"code": 2201,
"label": "Timeout"
}
}
/* -------- STATUS FAILED: 2203 -------- */
{
"transactionId": "953cfefb-bc72",
"status": "FAILED",
"error": {
"code": 2203,
"label": "Invalid return [Parsing error] ou [No data] ou [invalid Data]"
}
}
/* -------- STATUS FAILED: 2339 -------- */
{
"transactionId": "953cfefb-bc72",
"status": "FAILED",
"error": {
"code": 2339,
"label": "Service already started"
}
}
/* -------- STATUS FAILED: 2340 -------- */
{
"transactionId": "953cfefb-bc72",
"status": "FAILED",
"error": {
"code": 2340,
"label": "[Permition] need to be granted"
}
}
/* -------- STATUS FAILED: 2341 -------- */
{
"transactionId": "953cfefb-bc72",
"status": "FAILED",
"error": {
"code": 2341,
"label": "[Location or Bluetooth] need to be activated on the phone"
}
}