siteKiosk.devices

Example:

The following example explains a common use case and is intended to help you get started with the SiteKiosk API for devices.

Devices have to be registered first. The SiteKiosk Windows client offers two ways to do this, via the user interface or the project editor. Since the SiteKiosk Android client only offers the second option, it will be described below.
Adding emulated keyboard devices on Windows can be easier using the UI. If you do so, you can skip adding the clientSettings described below.

First, open or create a project and open the settings: Settings --> Advanced

In the advanced settings, add a new entry: devices

You can set up as many new devices as you need. We will start with one device:

[
{
"config": {
"deviceId": -1,
"omitTerminationChar": true,
"terminationChar": 10
},
"name": "scanner",
"type": "EmulatedKeyboard",
"logLevel": "DataGeneratedDetails"
}
]

On Android you can use "deviceId": -1 to use the first device found as the registered device. The name is freely selectable. The type must be one of the known device types, as documented (KnownDeviceTypes).

Once the device registration is complete, you can use the device in custom scripts by its name:

Note: Another device type may return a different data object, please refer the documentation.

const scanner = siteKiosk.devices.getByName("scanner");
if (!scanner) {
console.error("Scanner device not found!");
return;
}
scanner.onData((data) => {
console.log(data.text);
});

Nexmosphere device usage:

To be able to use Nexmosphere devices, you need to load the Nexmosphere plugin, too. Add a new entry to the advanced client settings (Settings --> Advanced): plugins:

[
{
"configuration": {
"logCommunication": true
},
"type": "Nexmosphere",
"name": "MyNexmospherePlugin"
}
]

The name can be chosen freely.

The plugin's name needs to be referenced in the device settings, e.g.:

[
{
"type": "Nexmosphere.XRange2",
"startMode": "automaticAndFailOnError",
"name": "myXRange2Device",
"logErrors": true,
"config": {
"pluginName": "MyNexmospherePlugin",
"address": 1
}
}
]

Methods

  • Returns a Device found by its name.

    Parameters

    • name: string

      The Device's name.

    Returns undefined | KnownDeviceTypes

Generated using TypeDoc