5.2.1.4.4 Light Sensor Dashboard

The ADP example sets up a dashboard for the I/O1 Xplained Pro light sensor and LED that looks something like the screenshot below.

: The appearance of screenshots will vary with operating system version and configuration.

The light sensor dashboard is configured by the messages detailed in the tables below.

First, the dashboard itself must be set up.

Table 5-7. MSG_CONF_DASHBOARD
FieldValuesDescription
Token0xFF
Message ID0x2A
Data length38
ID0x0000Dashboard ID
Label“Light Sensor Example Dashboard\0” Dashboard label
Background color0xFFFFFF (transmitted as 0xFFFFFFFFFFFF as each 0xFF character must be transmitted as 0xFFFF, see Message Format)Background color of dashboard
Height300Height (in pixels) of dashboard

Next, Label elements are added to the dashboard.

Table 5-8. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_LABEL
FieldValuesDescription
Token0xFF
Message ID0x2B
Data length47Depending on element type
Dashboard ID0x0000ID of light sensor dashboard
Element ID0x0000Unique ID of label element
Z-Index0Order index, 0 places the element the farthest to the back
X-coordinate5X-coordinate of element location. 0 is topmost position on dashboard.
Y-coordinate5Y-coordinate of element location. 0 is topmost position on dashboard.
Width300Width of element (pixels)
Height35Height of element (pixels)
Element type0x00ELEMENT_TYPE_LABEL
Font size24
Attribute0x00Bold = OFF, Italic = OFF
Horizontal alignment1Center
Vertical alignment1Center
Background transparency0
Background color0xFFFFFF (transmitted as 0xFFFFFFFFFFFF as each 0xFF character must be transmitted as 0xFFFF, see Message Format)RGB color of background
Foreground transparency255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see Message Format)
Foreground color0x000000RGB color of background
Label text“Light Sensor Example\0”
Table 5-9. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_LABEL
FieldValuesDescription
Token0xFF
Message ID0x2B
Data length45Depending on element type
Dashboard ID0x0000ID of light sensor dashboard
Element ID0x0001Unique ID of label element
Z-Index0Order index, 0 places the element the farthest to the back
X-coordinate5X-coordinate of element location. 0 is topmost position on dashboard.
Y-coordinate60Y-coordinate of element location. 0 is topmost position on dashboard.
Width129Width of element (pixels)
Height25Height of element (pixels)
Element type0x00ELEMENT_TYPE_LABEL
Font size14
Attribute0x01Bold = ON, Italic = OFF
Horizontal alignment0Left
Vertical alignment1Center
Background transparency0
Background color0xFFFFFF (transmitted as 0xFFFFFFFFFFFF as each 0xFF character must be transmitted as 0xFFFF, see Message Format)RGB color of background
Foreground transparency255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see Message Format)
Foreground color0x000000RGB color of background
Label text“Light Sensor Value\0”
Table 5-10. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_LABEL
FieldValuesDescription
Token0xFF
Message ID0x2B
Data length38Depending on element type
Dashboard ID0x0000ID of light sensor dashboard
Element ID0x0002Unique ID of label element
Z-Index0Order index, 0 places the element the farthest to the back
X-coordinate5X-coordinate of element location. 0 is topmost position on dashboard.
Y-coordinate100Y-coordinate of element location. 0 is topmost position on dashboard.
Width82Width of element (pixels)
Height25Height of element (pixels)
Element type0x00ELEMENT_TYPE_LABEL
Font size14
Attribute0x01Bold = ON, Italic = OFF
Horizontal alignment0Left
Vertical alignment1Center
Background transparency0
Background color0xFFFFFF (transmitted as 0xFFFFFFFFFFFF as each 0xFF character must be transmitted as 0xFFFF, see Message Format)RGB color of background
Foreground transparency255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see Message Format)
Foreground color0x000000RGB color of background
Label text“Night Light\0”
Table 5-11. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_LABEL
FieldValuesDescription
Token0xFF
Message ID0x2B
Data length38Depending on element type
Dashboard ID0x0000ID of light sensor dashboard
Element ID0x0003Unique ID of label element
Z-Index0Order index, 0 places the element the farthest to the back
X-coordinate5X-coordinate of element location. 0 is topmost position on dashboard.
Y-coordinate230Y-coordinate of element location. 0 is topmost position on dashboard.
Width80Width of element (pixels)
Height25Height of element (pixels)
Element type0x00ELEMENT_TYPE_LABEL
Font size14
Attribute0x01Bold = ON, Italic = OFF
Horizontal alignment0Left
Vertical alignment1Center
Background transparency0
Background color0xFFFFFF (transmitted as 0xFFFFFFFFFFFF as each 0xFF character must be transmitted as 0xFFFF, see Message Format)RGB color of background
Foreground transparency255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see Message Format)
Foreground color0x000000RGB color of background
Label text“LED Control\0”

A stream needs to be set up to receive light sensor data.

Table 5-12. MSG_CONF_STREAM
FieldValuesDescription
Token0xFF
Message ID0x20
Data length 18
ID0x0001ID of the light sensor data stream
Type12Stream type float
Mode2Out from target
State0Stream state ON
Label“Light sensor\0”Label of the data stream

And a Progress bar to show the light sensor data is added.

Table 5-13. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_PROGRESS
FieldValuesDescription
Token0xFF
Message ID0x2B
Data length29Depending on element type
Dashboard ID0x0000ID of the light sensor dashboard
Element ID0x0004Unique ID of the progress bar element
Z-Index0Order index, 0 places the element the farthest to the back
X-coordinate140X-coordinate of element location. 0 is topmost position on dashboard.
Y-coordinate60Y-coordinate of element location. 0 is topmost position on dashboard.
Width145Width of element (pixels)
Height25Height of element (pixels)
Element type0x03ELEMENT_TYPE_PROGRESS
Minimum value0
Maximum value4
Initial value0
Color0x008000RGB color of progress bar

Eventually, the light sensor data stream is connected to the Progress bar element.

Table 5-14. MSG_CONF_ADD_STREAM_TO_ELEMENT
FieldValuesDescription
Message ID0x2C
Data length6
Dashboard ID0x0000ID of the light sensor dashboard
Element ID0x0004ID of the progress bar element
Stream ID0x0001ID of the light sensor data stream

Next, a Graph element is added to the dashboard.

Table 5-15. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_GRAPH
FieldValuesDescription
Token0xFF
Message ID0x2B
Data length53Depending on element type
Dashboard ID0x0000ID of the light sensor dashboard
Element ID0x0007Unique ID of graph element
Title color0xFFFFFF (transmitted as 0xFFFFFFFFFFFF as each 0xFF character must be transmitted as 0xFFFF, see Message Format)RGB color of title
Background color0x000000RGB color of graph frame
Graph background color0x000000RGB color of graph
Title text“Light level\0”
Plot count1
Xmin0
Xmax10
Ymin0
Ymax5
Mode0x00

Mouse interaction OFF

Fit graph to right edge of canvas OFF

And the light sensor data stream is connected to the Graph.

Table 5-16. MSG_CONF_ADD_STREAM_TO_ELEMENT
FieldValuesDescription
Message ID0x2C
Data length6
Dashboard ID0x0000ID of the light sensor dashboard
Element ID0x0007ID of the graph element
Stream ID0x0001ID of the light sensor data stream

A separate stream is set up to signal Night mode.

Table 5-17. MSG_CONF_STREAM
FieldValuesDescription
Token0xFF
Message ID0x20
Data length16
ID0x0029ID of the Night mode stream
Type2Stream type uint_8
Mode2Out from target
State0Stream state ON
Label“Night Mode\0”Label of the data stream

A Signal element is added to the dashboard for the Night mode signal.

Table 5-18. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_SIGNAL
FieldValuesDescription
Token0xFF
Message ID0x2B
Data length22Depending on element type
Dashboard ID0x0000ID of the light sensor dashboard
Element ID0x0005Unique ID of the signal element
Z-Index0Order index, 0 places the element the farthest to the back
X-coordinate140X-coordinate of element location. 0 is topmost position on dashboard.
Y-coordinate100Y-coordinate of element location. 0 is topmost position on dashboard.
Width25Width of element (pixels)
Height25Height of element (pixels)
Element type0x04ELEMENT_TYPE_SIGNAL
On transparency255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see Message Format)
On color0x008000RGB color for ON state
Off transparency255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see Message Format)
Off color0x000000RGB color for OFF state

And the Night mode stream is connected to the Signal element.

Table 5-19. MSG_CONF_ADD_STREAM_TO_ELEMENT
FieldValuesDescription
Message ID0x2C
Data length6
Dashboard ID0x0000ID of the light sensor dashboard
Element ID0x0005ID of the signal element
Stream ID0x0029ID of the night mode stream

Next, a incoming stream (in to target) is set up to transfer the Button status to the target.

Table 5-20. MSG_CONF_STREAM
FieldValuesDescription
Token0xFF
Message ID0x20
Data length16
ID0x0030ID of the button stream
Type2Stream type uint_8
Mode0In to target
State0Stream state ON
Label“LED Toggle\0”Label of the stream

A Button is added to the dashboard to toggle the target LED.

Table 5-21. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_BUTTON
FieldValuesDescription
Token0xFF
Message ID0x2B
Data length26Depending on element type
Dashboard ID0x0000ID of the light sensor dashboard
Element ID0x0006Unique ID of the signal element
Z-Index0Order index, 0 places the element the farthest to the back
X-coordinate110X-coordinate of element location. 0 is topmost position on dashboard.
Y-coordinate230Y-coordinate of element location. 0 is topmost position on dashboard.
Width75Width of element (pixels)
Height50Height of element (pixels)
Element type0x01ELEMENT_TYPE_BUTTON
Font size10
Button text“LED Toggle\0”
Toggle button
  • 0x00 = Normal button
  • 0x01 = Toggle button
Normal button

And the button stream is connected to the Button element.

Table 5-22. MSG_CONF_ADD_STREAM_TO_ELEMENT
FieldValuesDescription
Message ID0x2C
Data length6
Dashboard ID0x0000ID of the light sensor dashboard
Element ID0x0006ID of the button element
Stream ID0x0030ID of the button stream