API Reference - pims.vehicle.event-O2X
Info: Stellantis Mobile SDK for ex Groupe PSA brands (Citroën, DS, Peugeot, Opel and Vauxhall) is not publicly available yet.
This api allows to be notified when an event has occured in relation with O2X.
Input Parameter | |||||
---|---|---|---|---|---|
Param name | Description | Type | Unit/Values | Example | Required |
actionType | Action name, in this case |
String |
|
O2X
|
true |
Output Data | ||||
---|---|---|---|---|
Data name | Description | Type | Unit/Values | Example |
event | This api allows to be notified (unsubscribe) when the connection with vehicle is lost or unable to charge. |
String |
- disconnected
- cantCharge
|
disconnected
|
Error | |
---|---|
Error Code | Error Label |
2001 | Facade not initialized |
Code Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* Subscribe, see unsubscribe below */
pims.subscribe("pims.vehicle.event",
mapOf( /* parameters */
Pair("actionType", "O2X")
)
) { 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.event" /* no params */ )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* Subscribe, see unsubscribe below */
pims.subscribe(api: "pims.vehicle.event",
parameters: [
"actionType": "O2X"
]
) { (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.event" /* 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
// representation of the `result` dictionary object message as JSON
{
"transactionId": "953cfefb-bc72",
"status": "RESULT",
"result": {
"event": "disconnected"
}
}
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"
}
}