Skip to content

Device select

Example#

preview

Code-example#

<measmatic-card highlight-header>
  <measmatic-device-select data-id=control1Id1 filter=ClAsS1 icon=device label=Switch></measmatic-device-select>
  <measmatic-device-select data-id=control1Id2 filter=ClAsS1 label=Switch></measmatic-device-select>
  <measmatic-device-select data-id=control1Id3 filter=ClAsS1 icon=device-alternative></measmatic-device-select>
  <measmatic-device-select data-id=control1Id4></measmatic-device-select>
  <measmatic-device-select data-id=control1Id5 label=disabled disabled></measmatic-device-select>
</measmatic-card>

Description#

This custom-element creates a control to select devices which were set in the Device Manager under Test site configuration.

The selectable values are read from window.deviceList.deviceList. Update the list by calling DeviceListUpdated(deviceList).

Usage#

Attributes#

Necessary#

<measmatic-device-select data-id='control1Id'>
Measmatic needs an data-id in this element to initialize the control properly.

Optional#

<measmatic-device-select data-id='control1Id' filter='Switch'>
By adding the attribute filter='Switch' you can filter the selectable devices.

<measmatic-device-select data-id='control1Id' label='Switch'>
To edit the text next to the selection you can add label='Switches'.

<measmatic-device-select data-id='control1Id' icon='world'>
You can choose an icon from the directory "Measmatic/data/TestIcons/".

<measmatic-device-select data-id='control1Id' disabled>
By adding the attribute disabled the selection is disabled. The attribute can be added or removed at any time.

Properties of interest

  • device gets name of the selected device
  • guid gets guid of the selected device
  • deviceObject gets/sets Object containing name and guid of selected device
  • disabled gets/sets if the selection is disabled

Export

  • exports device, guid and class
  • class is derived from the filter attribute and written in lowercase