Webportal v2

embedded apps

API Reference - HMI.dialogWindow

Required Privacy: Data & Location
Plateforme Compatibility:
Operations:

This API allows to use the HMI dialog window element (popup) in order to send a message to the user.

webportal-v2-dialog-window

Input Parameter
Param name Description Type Unit/Values Example Required
title

Title of the message.

string

n/a

Warning true
secondaryTitle

Subtitle of the message.

string

n/a

Your tire pressure is down false
content

Content of the message.

string

n/a

You should fix your tires pressure in order to maintain your safety and your vehicle durability. true
contentIcon

Url of an icon displayed with the content of the message.

string

n/a

data:image/jpg,base64;... true
button1Label

Text displayed on button 1.

string

n/a

Call garage true
button2Label

Text displayed on button 2.

string

n/a

Close false
button3Label

Text displayed on button 3.

string

n/a

Nav to closest gas station false
button4Label

Text displayed on button 4.

string

n/a

Panic! false
Output Data
Data name Description Type Unit/Values Example
dialogId

ID of the dialog window you just set-up. This ID is also returned in Susbscribe.

int

n/a

42
Code Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
webportal.set(
    /* api name */
    "HMI.dialogWindow",
    /* parameters */
     { 
      "title": "Warning",
      "secondaryTitle": "Your tire pressure is down",
      "content": "You should fix your tires pressure in order to maintain your safety and your vehicle durability.",
      "contentIcon": "data:image/jpg,base64;...",
      "button1Label": "Call garage",
      "button2Label": "Close",
      "button3Label": "Nav to closest gas station",
      "button4Label": "Panic!"
        }
  )
  /* 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
13
14
15
{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0", 
  "type": "SET", 
  "api": "HMI.dialogWindow",
  "params":  { 
    "title": "Warning",
    "secondaryTitle": "Your tire pressure is down",
    "content": "You should fix your tires pressure in order to maintain your safety and your vehicle durability.",
    "contentIcon": "data:image/jpg,base64;...",
    "button1Label": "Call garage",
    "button2Label": "Close",
    "button3Label": "Nav to closest gas station",
    "button4Label": "Panic!"
  }
}
1
2
3
4
5
6
7
8
9
10
// --- format of the `REPLY` message ---

{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
  "type": "REPLY",
  "api": "HMI.dialogWindow",
  "status": 200,
  "statusText": "OK", 
  "data": { "dialogId": 42 } 
}

false

This API allows to use the HMI dialog window element (popup) in order to send a message to the user.

webportal-v2-dialog-window

Input Parameter
No input params
Output Data
Data name Description Type Unit/Values Example
dialogId

ID of the dialog beaign triggered. This ID is also returned in Set.

int

n/a

42
eventType

Type of interaction choosen by the user.

Enum of strings

- buttonPressed

- closed
buttonPressed
target

Retrieve which button was clicked by the user.This field is displayed if 'eventType': 'buttonPressed'.

Enum of strings

- button1

- button2

- button3

- button4
button2
Code Example
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.dialogWindow",
    /* 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.dialogWindow",
  "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
// --- 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.dialogWindow",
  "status": 200,
  "statusText": "OK", 
  "data":  { 
    "dialogId": 42,
    "eventType": "buttonPressed",
    "target": "button2"
  } 
}