Device is physical device or Node.js process, internally using values that needs to be accessed and/or modified from other processes. It can be defined and configured using libraries appropriate for platform you are going to use.
Device can use fixed configuration or built-in discovery service to figure out where should it connect to, or how to reestablish broken connection.
When device connects server for the first time, server generates unique identifier (UUID). Device stores it in permanent memory and use to identify itself from now on. Basing on what was defined in code, device generates manifest and send it to server as stringified JSON object. Manifest contains device id, name, declared Gate Values etc.
Once connection is established, device can use Server Storage to save or retrieve static data (like configuration params, persistent states etc.)
Some implementation details may differ between libraries. See
Arduino and
Node.js sections for library-specific information.
Common device properties:
name - string that will be displayed in user interface as device name
group - string defining which group device initially belongs to
info - string reserved for user-defined information on this device (i.e. custom id to assist finding specific device within controller's model). Not used by any system component
factory - object containing factory methods to generate Gate Values for this device
ServerStorage - object containing methods to interact with Server Storage
start() - method starting device
stop() - method stopping device
isReady() - returns true if device is connected to server, false otherwise