UNPKG

@signageos/front-applet-extension-nexmosphere

Version:
36 lines (35 loc) 1.64 kB
import FrontAppletSerialPort from '@signageos/front-applet/es6/FrontApplet/Hardware/SerialPort'; import IButton from '@signageos/front-applet/es6/Sensors/IButton'; import IRfidAntenna from '@signageos/front-applet/es6/Sensors/IRfidAntenna'; /** * Provides factories for individual Nexmosphere sensors and other components * * All the factories expect an address as one of the arguments. * It's the address of the X-Talk interface the given element is connected to. * The address in Nexmosphere format is always a 3-digit number, for example 003 or 102. * However here we expect a number, so 003 becomes 3, 102 is still 102, etc. */ export default class Nexmosphere { private serialPort; /** * @param serialPort Instance of serial port created via sos.hardware.openSerialPort() */ constructor(serialPort: FrontAppletSerialPort); /** * Create button instance * * Index is the port number on the button controller in case it supports multiple buttons at once. * There are usually 4 ports, 1 for each button and they are numbered starting from 1, so 1, 2, 3 and 4. * However here they're indexed from 0, so all the numbers have to shifted down by 1, i.e. 0, 1, 2 and 3. * * @param {number} address Address of the X-Talk interface the button is connected to * @param {number} index Button index */ createButton(address: number, index: number): IButton; /** * Create RFID Antenna instance * * @param {number} address Address of the X-Talk interface the antenna is connected to */ createRfidAntenna(address: number): IRfidAntenna; }