API Reference - HMI.notification
This API allows to create and interact with the HMI notification center.
Input Parameter | |||||
---|---|---|---|---|---|
Param name | Description | Type | Unit/Values | Example | Required |
title | Notification title. |
string |
|
Car maitenance reminder
|
true |
text | Notification text. |
string |
|
Your appointment with your favorite garage has been confirmed.
|
true |
timestamp | Timestamp to display for this notification. |
string |
|
1573041587
|
true |
userData
.cutsom |
Custom field for user data. |
string |
|
payload
|
true |
userData
.trackingParam |
TrackingParam field for user data. |
string |
|
af0426
|
true |
Output Data | ||||
---|---|---|---|---|
Data name | Description | Type | Unit/Values | Example |
notificationId | ID of the notification you just set-up. This ID is also returned in Susbscribe. |
int |
|
42
|
errorCode | Error code related to the notification. |
int |
- eOk = 0: 'dialog was opened'
- eFailure: 'unspecified error happened'
- eInvalidParameters: 'invalid parameters were passed'
- eDiscardedByPriority: 'higher priority panel is shown on the screen'
- eConditionsNotCorrect: 'discarded by check of specific conditions'
|
0
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
webportal.set(
/* api name */
"HMI.notification",
/* parameters */
{
"title": "Car maitenance reminder",
"text": "Your appointment with your favorite garage has been confirmed.",
"timestamp": "1573041587",
"userData.cutsom": "payload",
"userData.trackingParam": "af0426"
}
)
/* callback for `REPLY` messages */
.then((message) => {
if (message.status === 200) {
/* handle `REPLY` success */
}
else { /* handle `REPLY` error */ }
})
1
2
3
4
5
6
7
8
9
10
11
12
{
"id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
"type": "SET",
"api": "HMI.notification",
"params": {
"title": "Car maitenance reminder",
"text": "Your appointment with your favorite garage has been confirmed.",
"timestamp": "1573041587",
"userData.cutsom": "payload",
"userData.trackingParam": "af0426"
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
// --- format of the `REPLY` message ---
{
"id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
"type": "REPLY",
"api": "HMI.notification",
"status": 200,
"statusText": "OK",
"data": {
"notificationId": 42,
"errorCode": 0
}
}
false
This API allows to create and interact with the HMI notification center.
Input Parameter | |||||
---|---|---|---|---|---|
No input params |
Output Data | ||||
---|---|---|---|---|
Data name | Description | Type | Unit/Values | Example |
notificationId | ID of the notification being tiggered. This ID is also returned in Set. |
int |
|
42
|
event | Event related to the triggering of this notification. |
Enum of strings |
|
42
|
userData
.cutsom |
Custom field for user data. |
string |
|
payload
|
userData
.trackingParam |
TrackingParam field for user data. |
string |
|
af0426
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
webportal.subscribe(
/* api name */
"HMI.notification",
/* parameters */
null,
/* callback for `NOTIFY` messages */
async (notifyMessage) => {
if (notifyMessage.status === 200) {
/* handle `NOTIFY` response */
}
else { /* handle `NOTIFY` error */ }
}
)
/* callback for `REPLY` messages */
.then((message) => {
if (message.status === 200) {
/* handle `REPLY` success */
}
else { /* handle `REPLY` error */ }
})
1
2
3
4
5
6
{
"id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
"type": "SUBSCRIBE",
"api": "HMI.notification",
"params": null
}
1
2
3
4
5
6
7
8
9
10
11
// --- format of the `REPLY` message ---
// type: acknowledge the status of the subscription
// reception: only once after the subscription request
// contains outputed data: no
{
"id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
"type": "REPLY",
"status": 200,
"statusText": "OK"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// --- format of the `NOTIFY` message ---
// type: event message about the subscription
// reception: each time the conditions of the subscription are met
// contains outputed data: yes
{
"id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
"type": "NOTIFY",
"api": "HMI.notification",
"status": 200,
"statusText": "OK",
"data": {
"notificationId": 42,
"event": "closed",
"userData": {
"custom": "payload",
"trackingParam": "af0426"
}
}
}