Constant Data

Constant Data

Each script has a global variable called
DEVICE
that is available from anywhere in the code. They contain constant data about the current device. When using an emulator, this variable contains applicable messages about a lack of support.
DEVICE
is described by the following type:
interface IDevice { hostname: string; model: string; part_number: string; serial_number: string; uuid: string; firmware_version: string; type: DeviceType; sensor: ISensor; gpio: IGPIO; }
Using the following types:
enum DeviceType { REAL = "REAL", EMULATED = "EMULATED", } enum GpioPortState { DISABLE = "DISABLE", TRIGGER = "TRIGGER", JOB_SWITCH = "JOB_SWITCH", ILLUMINATION_STROBE = "ILLUMINATION_STROBE", INPUT = "INPUT", OUTPUT_PUSH_PULL = "OUTPUT_PUSH_PULL", OUTPUT_HIGH_SIDE = "OUTPUT_HIGH_SIDE", OUTPUT_STATIC_HIGH = "OUTPUT_STATIC_HIGH", OUTPUT_STATIC_LOW = "OUTPUT_STATIC_LOW", OUTPUT = "OUTPUT", } interface IGPIOPort { number: number; state: IGpioPortState; } interface IGPIO { count: number; ports: IGPIOPort[]; } interface ISensor { sensor_type: string; width: number; height: number; }