UNPKG

@sports-alliance/sports-lib

Version:

A Library to for importing / exporting and processing GPX, TCX, FIT and JSON files from services such as Strava, Movescount, Garmin, Polar etc

33 lines (32 loc) 1.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Device = void 0; const helpers_1 = require("../../events/utilities/helpers"); class Device { constructor(type) { this.type = type || 'Unknown'; } toJSON() { return { type: this.type, index: (0, helpers_1.isNumber)(this.index) ? this.index : null, batteryStatus: this.batteryStatus || null, batteryLevel: (0, helpers_1.isNumber)(this.batteryLevel) ? this.batteryLevel : null, name: this.name || null, batteryVoltage: (0, helpers_1.isNumber)(this.batteryVoltage) ? this.batteryVoltage : null, manufacturer: this.manufacturer || null, serialNumber: this.serialNumber || null, product: (0, helpers_1.isNumber)(this.product) ? this.product : null, swInfo: this.swInfo || null, hwInfo: this.hwInfo || null, antDeviceNumber: (0, helpers_1.isNumber)(this.antDeviceNumber) ? this.antDeviceNumber : null, antTransmissionType: (0, helpers_1.isNumber)(this.antTransmissionType) ? this.antTransmissionType : null, antNetwork: this.antNetwork || null, sourceType: this.sourceType || null, antId: this.antId || null, cumOperatingTime: (0, helpers_1.isNumber)(this.cumOperatingTime) ? this.cumOperatingTime : null, timestamp: this.timestamp ? this.timestamp.toISOString() : null }; } } exports.Device = Device;