UNPKG

incyclist-ant-plus

Version:

Incyclist library for ANT+ - originally forked from longhorn/ant-plus

44 lines (43 loc) 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SensorState = void 0; const SEND_TIMEOUT = 10000; class SensorState { constructor(deviceID) { this.ManId = undefined; this.SerialNumber = undefined; this.HwVersion = undefined; this.SwVersion = undefined; this.ModelNum = undefined; this.BatteryLevel = undefined; this.BatteryVoltage = undefined; this.BatteryStatus = 'Invalid'; this.DeviceID = deviceID; } } exports.SensorState = SensorState; class Sensor { constructor(deviceID = 0, channel) { this.deviceID = Number(deviceID); this.channel = channel; this.sendTimeout = SEND_TIMEOUT; this.onMessage = this.onMessage.bind(this); this.onEvent = this.onEvent.bind(this); } getChannel() { return this.channel; } setChannel(channel) { this.channel = channel; } getDeviceID() { return this.deviceID; } setSendTimeout(ms) { this.sendTimeout = ms; } getSendTimeout() { return this.sendTimeout; } } exports.default = Sensor;