incyclist-devices 1.5.38 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.MD +238 -0
- package/lib/adapters.d.ts +7 -0
- package/lib/adapters.js +49 -0
- package/lib/antv2/adapter-factory.d.ts +21 -10
- package/lib/antv2/adapter-factory.js +51 -33
- package/lib/antv2/adapter.d.ts +65 -0
- package/lib/antv2/adapter.js +310 -0
- package/lib/antv2/ant-interface.d.ts +17 -11
- package/lib/antv2/ant-interface.js +41 -31
- package/lib/antv2/{ant-binding.d.ts → binding.d.ts} +1 -1
- package/lib/antv2/{ant-binding.js → binding.js} +1 -1
- package/lib/antv2/fe/adapter.d.ts +28 -0
- package/lib/antv2/{fe.js → fe/adapter.js} +106 -90
- package/lib/antv2/fe/index.d.ts +2 -0
- package/lib/antv2/fe/index.js +7 -0
- package/lib/antv2/hr/adapter.d.ts +15 -0
- package/lib/antv2/hr/adapter.js +76 -0
- package/lib/antv2/hr/index.d.ts +2 -0
- package/lib/antv2/hr/index.js +7 -0
- package/lib/antv2/index.d.ts +7 -0
- package/lib/antv2/index.js +20 -0
- package/lib/antv2/modes/ant-fe-adv-st-mode.d.ts +9 -0
- package/lib/{ant/antfe → antv2/modes}/ant-fe-adv-st-mode.js +1 -1
- package/lib/antv2/modes/ant-fe-erg-mode.d.ts +6 -0
- package/lib/{ant/antfe → antv2/modes}/ant-fe-erg-mode.js +1 -1
- package/lib/antv2/modes/ant-fe-st-mode.d.ts +5 -0
- package/lib/{ant/antfe → antv2/modes}/ant-fe-st-mode.js +1 -1
- package/lib/antv2/pwr/adapter.d.ts +24 -0
- package/lib/antv2/pwr/adapter.js +141 -0
- package/lib/antv2/pwr/index.d.ts +2 -0
- package/lib/antv2/pwr/index.js +7 -0
- package/lib/antv2/sensor-factory.d.ts +2 -2
- package/lib/antv2/types.d.ts +22 -0
- package/lib/antv2/types.js +5 -0
- package/lib/antv2/utils.d.ts +4 -0
- package/lib/antv2/utils.js +192 -0
- package/lib/base/adpater.d.ts +68 -0
- package/lib/base/adpater.js +183 -0
- package/lib/ble/adapter-factory.d.ts +33 -0
- package/lib/ble/adapter-factory.js +105 -0
- package/lib/ble/base/adapter.d.ts +53 -0
- package/lib/ble/base/adapter.js +290 -0
- package/lib/ble/base/comms-utils.d.ts +7 -0
- package/lib/ble/base/comms-utils.js +91 -0
- package/lib/ble/{ble-device.d.ts → base/comms.d.ts} +31 -16
- package/lib/ble/{ble-device.js → base/comms.js} +193 -55
- package/lib/ble/bindings/index.d.ts +2 -0
- package/lib/ble/bindings/index.js +8 -0
- package/lib/ble/bindings/linux.d.ts +15 -0
- package/lib/ble/bindings/linux.js +39 -0
- package/lib/ble/bindings/mock.d.ts +9 -0
- package/lib/ble/bindings/mock.js +108 -0
- package/lib/ble/bindings/types.d.ts +57 -0
- package/lib/ble/bindings/types.js +96 -0
- package/lib/ble/ble-interface.d.ts +38 -59
- package/lib/ble/ble-interface.js +254 -462
- package/lib/ble/ble-peripheral.d.ts +7 -5
- package/lib/ble/ble-peripheral.js +52 -21
- package/lib/ble/consts.d.ts +3 -0
- package/lib/ble/consts.js +4 -1
- package/lib/ble/cp/adapter.d.ts +22 -0
- package/lib/ble/cp/adapter.js +111 -0
- package/lib/ble/cp/comm.d.ts +31 -0
- package/lib/ble/cp/comm.js +125 -0
- package/lib/ble/cp/index.d.ts +4 -0
- package/lib/ble/cp/index.js +10 -0
- package/lib/ble/cp/types.d.ts +13 -0
- package/lib/ble/cp/types.js +2 -0
- package/lib/ble/elite/adapter.d.ts +19 -0
- package/lib/ble/elite/adapter.js +120 -0
- package/lib/ble/elite/comms.d.ts +32 -0
- package/lib/ble/elite/comms.js +126 -0
- package/lib/ble/elite/index.d.ts +3 -0
- package/lib/ble/elite/index.js +10 -0
- package/lib/ble/fm/adapter.d.ts +22 -0
- package/lib/ble/fm/adapter.js +249 -0
- package/lib/ble/fm/comms.d.ts +50 -0
- package/lib/ble/{fm.js → fm/comms.js} +34 -277
- package/lib/ble/fm/consts.d.ts +6 -0
- package/lib/ble/fm/consts.js +9 -0
- package/lib/ble/fm/index.d.ts +5 -0
- package/lib/ble/fm/index.js +13 -0
- package/lib/ble/fm/types.d.ts +30 -0
- package/lib/ble/fm/types.js +2 -0
- package/lib/ble/hr/adapter.d.ts +14 -0
- package/lib/ble/hr/adapter.js +45 -0
- package/lib/ble/hr/comm.d.ts +19 -0
- package/lib/ble/hr/comm.js +56 -0
- package/lib/ble/hr/index.d.ts +4 -0
- package/lib/ble/hr/index.js +10 -0
- package/lib/ble/hr/mock.d.ts +7 -0
- package/lib/ble/hr/mock.js +47 -0
- package/lib/ble/hr/types.d.ts +5 -0
- package/lib/ble/hr/types.js +2 -0
- package/lib/ble/index.d.ts +9 -0
- package/lib/ble/index.js +26 -0
- package/lib/ble/peripheral-cache.d.ts +43 -0
- package/lib/ble/peripheral-cache.js +107 -0
- package/lib/ble/tacx/adapter.d.ts +10 -0
- package/lib/ble/tacx/adapter.js +99 -0
- package/lib/ble/{tacx.d.ts → tacx/comms.d.ts} +11 -43
- package/lib/ble/{tacx.js → tacx/comms.js} +23 -155
- package/lib/ble/tacx/index.d.ts +4 -0
- package/lib/ble/tacx/index.js +10 -0
- package/lib/ble/tacx/types.d.ts +25 -0
- package/lib/ble/tacx/types.js +2 -0
- package/lib/ble/types.d.ts +128 -0
- package/lib/ble/types.js +2 -0
- package/lib/ble/utils.d.ts +17 -0
- package/lib/ble/utils.js +54 -0
- package/lib/ble/wahoo/adapter.d.ts +9 -0
- package/lib/ble/wahoo/adapter.js +95 -0
- package/lib/ble/{wahoo-kickr.d.ts → wahoo/comms.d.ts} +11 -44
- package/lib/ble/{wahoo-kickr.js → wahoo/comms.js} +29 -129
- package/lib/ble/wahoo/index.d.ts +4 -0
- package/lib/ble/wahoo/index.js +10 -0
- package/lib/ble/wahoo/types.d.ts +19 -0
- package/lib/ble/wahoo/types.js +2 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.js +34 -0
- package/lib/interfaces.d.ts +7 -0
- package/lib/interfaces.js +27 -0
- package/lib/{ble → modes}/ble-erg-mode.d.ts +4 -4
- package/lib/{ble → modes}/ble-erg-mode.js +2 -2
- package/lib/{ble → modes}/ble-st-mode.d.ts +3 -3
- package/lib/{ble → modes}/ble-st-mode.js +1 -1
- package/lib/{cycling-mode.d.ts → modes/cycling-mode.d.ts} +8 -8
- package/lib/modes/power-base.d.ts +3 -3
- package/lib/modes/power-base.js +8 -4
- package/lib/modes/power-meter.d.ts +3 -3
- package/lib/modes/simulator.d.ts +2 -2
- package/lib/modes/simulator.js +1 -1
- package/lib/serial/adapter-factory.d.ts +12 -0
- package/lib/serial/adapter-factory.js +30 -0
- package/lib/serial/adapter.d.ts +21 -0
- package/lib/serial/adapter.js +61 -0
- package/lib/serial/bindings/tcp.d.ts +45 -0
- package/lib/serial/bindings/tcp.js +284 -0
- package/lib/serial/comm.d.ts +7 -0
- package/lib/serial/comm.js +2 -0
- package/lib/{daum → serial/daum}/DaumAdapter.d.ts +14 -23
- package/lib/{daum → serial/daum}/DaumAdapter.js +57 -97
- package/lib/{daum → serial/daum}/DaumPowerMeterCyclingMode.d.ts +2 -2
- package/lib/{daum → serial/daum}/DaumPowerMeterCyclingMode.js +1 -1
- package/lib/{daum → serial/daum}/ERGCyclingMode.d.ts +3 -3
- package/lib/{daum → serial/daum}/ERGCyclingMode.js +3 -3
- package/lib/{daum → serial/daum}/SmartTrainerCyclingMode.d.ts +3 -3
- package/lib/{daum → serial/daum}/SmartTrainerCyclingMode.js +4 -3
- package/lib/serial/daum/classic/adapter.d.ts +29 -0
- package/lib/{daum/classic/DaumClassicAdapter.js → serial/daum/classic/adapter.js} +77 -50
- package/lib/{daum/classic/bike.d.ts → serial/daum/classic/comms.d.ts} +14 -16
- package/lib/{daum/classic/bike.js → serial/daum/classic/comms.js} +68 -152
- package/lib/serial/daum/classic/mock.d.ts +96 -0
- package/lib/serial/daum/classic/mock.js +365 -0
- package/lib/{daum/classic/DaumClassicCyclingMode.d.ts → serial/daum/classic/modes/daum-classic.d.ts} +3 -3
- package/lib/{daum/classic/DaumClassicCyclingMode.js → serial/daum/classic/modes/daum-classic.js} +2 -2
- package/lib/{daum → serial/daum}/classic/utils.d.ts +1 -1
- package/lib/serial/daum/premium/adapter.d.ts +25 -0
- package/lib/{daum/premium/DaumPremiumAdapter.js → serial/daum/premium/adapter.js} +107 -47
- package/lib/{daum/premium/bike.d.ts → serial/daum/premium/comms.d.ts} +26 -54
- package/lib/{daum/premium/bike.js → serial/daum/premium/comms.js} +215 -420
- package/lib/serial/daum/premium/mock.d.ts +75 -0
- package/lib/serial/daum/premium/mock.js +289 -0
- package/lib/{daum/premium/DaumClassicCyclingMode.d.ts → serial/daum/premium/modes/daum-classic.d.ts} +3 -3
- package/lib/{daum/premium/DaumClassicCyclingMode.js → serial/daum/premium/modes/daum-classic.js} +2 -2
- package/lib/serial/daum/premium/types.d.ts +12 -0
- package/lib/serial/daum/premium/types.js +2 -0
- package/lib/{daum → serial/daum}/premium/utils.d.ts +8 -11
- package/lib/{daum → serial/daum}/premium/utils.js +22 -63
- package/lib/serial/index.d.ts +9 -0
- package/lib/serial/index.js +49 -0
- package/lib/{kettler → serial/kettler}/comms.d.ts +8 -6
- package/lib/{kettler → serial/kettler}/comms.js +71 -32
- package/lib/{kettler → serial/kettler}/ergo-racer/adapter.d.ts +14 -28
- package/lib/{kettler → serial/kettler}/ergo-racer/adapter.js +102 -169
- package/lib/serial/kettler/ergo-racer/mock.d.ts +66 -0
- package/lib/serial/kettler/ergo-racer/mock.js +216 -0
- package/lib/{kettler/ergo-racer/ERGCyclingMode.d.ts → serial/kettler/ergo-racer/modes/erg.d.ts} +4 -4
- package/lib/{kettler/ergo-racer/ERGCyclingMode.js → serial/kettler/ergo-racer/modes/erg.js} +2 -2
- package/lib/serial/serial-interface.d.ts +60 -0
- package/lib/serial/serial-interface.js +309 -0
- package/lib/simulator/Simulator.d.ts +12 -25
- package/lib/simulator/Simulator.js +26 -87
- package/lib/types/adapter.d.ts +39 -0
- package/lib/types/adapter.js +2 -0
- package/lib/types/capabilities.d.ts +8 -0
- package/lib/types/capabilities.js +12 -0
- package/lib/types/data.d.ts +12 -0
- package/lib/types/data.js +2 -0
- package/lib/types/device.d.ts +32 -0
- package/lib/types/device.js +11 -0
- package/lib/types/interface.d.ts +18 -0
- package/lib/types/interface.js +2 -0
- package/lib/types/route.d.ts +2 -2
- package/lib/types/user.d.ts +1 -1
- package/lib/{utils.d.ts → utils/utils.d.ts} +1 -0
- package/lib/{utils.js → utils/utils.js} +5 -1
- package/package.json +16 -14
- package/lib/DeviceSupport.d.ts +0 -36
- package/lib/DeviceSupport.js +0 -82
- package/lib/ant/AntAdapter.d.ts +0 -50
- package/lib/ant/AntAdapter.js +0 -109
- package/lib/ant/AntScanner.d.ts +0 -60
- package/lib/ant/AntScanner.js +0 -651
- package/lib/ant/antfe/AntFEAdapter.d.ts +0 -83
- package/lib/ant/antfe/AntFEAdapter.js +0 -652
- package/lib/ant/antfe/ant-fe-adv-st-mode.d.ts +0 -9
- package/lib/ant/antfe/ant-fe-erg-mode.d.ts +0 -6
- package/lib/ant/antfe/ant-fe-st-mode.d.ts +0 -5
- package/lib/ant/anthrm/AntHrmAdapter.d.ts +0 -16
- package/lib/ant/anthrm/AntHrmAdapter.js +0 -130
- package/lib/ant/antpwr/pwr-adapter.d.ts +0 -49
- package/lib/ant/antpwr/pwr-adapter.js +0 -251
- package/lib/ant/utils.d.ts +0 -1
- package/lib/ant/utils.js +0 -23
- package/lib/antv2/AntAdapter.d.ts +0 -48
- package/lib/antv2/AntAdapter.js +0 -104
- package/lib/antv2/ant-device.d.ts +0 -59
- package/lib/antv2/ant-device.js +0 -161
- package/lib/antv2/fe.d.ts +0 -32
- package/lib/antv2/hr.d.ts +0 -18
- package/lib/antv2/hr.js +0 -102
- package/lib/antv2/incyclist-protocol.d.ts +0 -37
- package/lib/antv2/incyclist-protocol.js +0 -126
- package/lib/antv2/pwr.d.ts +0 -28
- package/lib/antv2/pwr.js +0 -171
- package/lib/ble/ble.d.ts +0 -129
- package/lib/ble/ble.js +0 -86
- package/lib/ble/elite.d.ts +0 -90
- package/lib/ble/elite.js +0 -322
- package/lib/ble/fm.d.ts +0 -125
- package/lib/ble/hrm.d.ts +0 -48
- package/lib/ble/hrm.js +0 -134
- package/lib/ble/incyclist-protocol.d.ts +0 -31
- package/lib/ble/incyclist-protocol.js +0 -153
- package/lib/ble/pwr.d.ts +0 -89
- package/lib/ble/pwr.js +0 -322
- package/lib/daum/classic/DaumClassicAdapter.d.ts +0 -28
- package/lib/daum/classic/DaumClassicProtocol.d.ts +0 -27
- package/lib/daum/classic/DaumClassicProtocol.js +0 -185
- package/lib/daum/premium/DaumPremiumAdapter.d.ts +0 -16
- package/lib/daum/premium/DaumPremiumProtocol.d.ts +0 -32
- package/lib/daum/premium/DaumPremiumProtocol.js +0 -207
- package/lib/daum/premium/tcpserial.d.ts +0 -33
- package/lib/daum/premium/tcpserial.js +0 -123
- package/lib/device.d.ts +0 -94
- package/lib/device.js +0 -76
- package/lib/kettler/ergo-racer/protocol.d.ts +0 -41
- package/lib/kettler/ergo-racer/protocol.js +0 -203
- package/lib/protocol.d.ts +0 -74
- package/lib/protocol.js +0 -41
- package/lib/registry.d.ts +0 -8
- package/lib/registry.js +0 -33
- package/lib/serialport/bindings/tcp.d.ts +0 -20
- package/lib/serialport/bindings/tcp.js +0 -33
- package/lib/serialport/index.d.ts +0 -2
- package/lib/serialport/index.js +0 -29
- package/lib/serialport/serialport.d.ts +0 -29
- package/lib/serialport/serialport.js +0 -87
- /package/lib/{cycling-mode.js → modes/cycling-mode.js} +0 -0
- /package/lib/{daum → serial/daum}/classic/utils.js +0 -0
- /package/lib/{daum → serial/daum}/constants.d.ts +0 -0
- /package/lib/{daum → serial/daum}/constants.js +0 -0
- /package/lib/{serialport.d.ts → serial/serialport.d.ts} +0 -0
- /package/lib/{serialport.js → serial/serialport.js} +0 -0
- /package/lib/{calculations.d.ts → utils/calculations.d.ts} +0 -0
- /package/lib/{calculations.js → utils/calculations.js} +0 -0
package/lib/ble/pwr.js
DELETED
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
-
};
|
|
33
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
exports.PwrAdapter = void 0;
|
|
35
|
-
const ble_device_1 = require("./ble-device");
|
|
36
|
-
const ble_interface_1 = __importDefault(require("./ble-interface"));
|
|
37
|
-
const ble_1 = require("./ble");
|
|
38
|
-
const device_1 = __importStar(require("../device"));
|
|
39
|
-
const gd_eventlog_1 = require("gd-eventlog");
|
|
40
|
-
const consts_1 = require("./consts");
|
|
41
|
-
const power_meter_1 = __importDefault(require("../modes/power-meter"));
|
|
42
|
-
class BleCyclingPowerDevice extends ble_device_1.BleDevice {
|
|
43
|
-
constructor(props) {
|
|
44
|
-
super(props);
|
|
45
|
-
this.instantaneousPower = undefined;
|
|
46
|
-
this.balance = undefined;
|
|
47
|
-
this.accTorque = undefined;
|
|
48
|
-
this.rpm = undefined;
|
|
49
|
-
this.timeOffset = 0;
|
|
50
|
-
this.time = undefined;
|
|
51
|
-
this.currentCrankData = undefined;
|
|
52
|
-
this.prevCrankData = undefined;
|
|
53
|
-
}
|
|
54
|
-
isMatching(characteristics) {
|
|
55
|
-
if (!characteristics)
|
|
56
|
-
return false;
|
|
57
|
-
const hasCPMeasurement = characteristics.find(c => c === consts_1.CSP_MEASUREMENT) !== undefined;
|
|
58
|
-
const hasCPFeature = characteristics.find(c => c === consts_1.CSP_FEATURE) !== undefined;
|
|
59
|
-
return hasCPMeasurement && hasCPFeature;
|
|
60
|
-
}
|
|
61
|
-
init() {
|
|
62
|
-
const _super = Object.create(null, {
|
|
63
|
-
init: { get: () => super.init }
|
|
64
|
-
});
|
|
65
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
try {
|
|
67
|
-
yield _super.init.call(this);
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
return Promise.resolve(false);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
getProfile() {
|
|
75
|
-
return 'Power Meter';
|
|
76
|
-
}
|
|
77
|
-
getServiceUUids() {
|
|
78
|
-
return BleCyclingPowerDevice.services;
|
|
79
|
-
}
|
|
80
|
-
parseCrankData(crankData) {
|
|
81
|
-
if (!this.prevCrankData)
|
|
82
|
-
this.prevCrankData = { revolutions: 0, time: 0, cntUpdateMissing: -1 };
|
|
83
|
-
const c = this.currentCrankData = crankData;
|
|
84
|
-
const p = this.prevCrankData;
|
|
85
|
-
let rpm = this.rpm;
|
|
86
|
-
let hasUpdate = c.time !== p.time;
|
|
87
|
-
if (hasUpdate) {
|
|
88
|
-
let time = c.time - p.time;
|
|
89
|
-
let revs = c.revolutions - p.revolutions;
|
|
90
|
-
if (c.time < p.time) {
|
|
91
|
-
time += 0x10000;
|
|
92
|
-
this.timeOffset += 0x10000;
|
|
93
|
-
}
|
|
94
|
-
if (c.revolutions < p.revolutions)
|
|
95
|
-
revs += 0x10000;
|
|
96
|
-
rpm = 1024 * 60 * revs / time;
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
if (p.cntUpdateMissing < 0 || p.cntUpdateMissing > 2) {
|
|
100
|
-
rpm = 0;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
const cntUpdateMissing = p.cntUpdateMissing;
|
|
104
|
-
this.prevCrankData = this.currentCrankData;
|
|
105
|
-
if (hasUpdate)
|
|
106
|
-
this.prevCrankData.cntUpdateMissing = 0;
|
|
107
|
-
else
|
|
108
|
-
this.prevCrankData.cntUpdateMissing = cntUpdateMissing + 1;
|
|
109
|
-
return { rpm, time: this.timeOffset + c.time };
|
|
110
|
-
}
|
|
111
|
-
parsePower(_data) {
|
|
112
|
-
const data = Buffer.from(_data);
|
|
113
|
-
try {
|
|
114
|
-
let offset = 4;
|
|
115
|
-
const flags = data.readUInt16LE(0);
|
|
116
|
-
this.instantaneousPower = data.readUInt16LE(2);
|
|
117
|
-
if (flags & 0x1)
|
|
118
|
-
this.balance = data.readUInt8(offset++);
|
|
119
|
-
if (flags & 0x4) {
|
|
120
|
-
this.accTorque = data.readUInt16LE(offset);
|
|
121
|
-
offset += 2;
|
|
122
|
-
}
|
|
123
|
-
if (flags & 0x10) {
|
|
124
|
-
offset += 6;
|
|
125
|
-
}
|
|
126
|
-
if (flags & 0x20) {
|
|
127
|
-
const crankData = {
|
|
128
|
-
revolutions: data.readUInt16LE(offset),
|
|
129
|
-
time: data.readUInt16LE(offset + 2)
|
|
130
|
-
};
|
|
131
|
-
const { rpm, time } = this.parseCrankData(crankData);
|
|
132
|
-
this.rpm = rpm;
|
|
133
|
-
this.time = time;
|
|
134
|
-
offset += 4;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
catch (err) {
|
|
138
|
-
}
|
|
139
|
-
const { instantaneousPower, balance, accTorque, rpm, time } = this;
|
|
140
|
-
return { instantaneousPower, balance, accTorque, rpm, time, raw: `2a63:${data.toString('hex')}` };
|
|
141
|
-
}
|
|
142
|
-
onData(characteristic, data) {
|
|
143
|
-
const hasData = super.onData(characteristic, data);
|
|
144
|
-
if (!hasData)
|
|
145
|
-
return false;
|
|
146
|
-
if ((0, ble_1.matches)(characteristic, consts_1.CSP_MEASUREMENT)) {
|
|
147
|
-
const res = this.parsePower(data);
|
|
148
|
-
this.emit('data', res);
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
reset() {
|
|
154
|
-
this.instantaneousPower = undefined;
|
|
155
|
-
this.balance = undefined;
|
|
156
|
-
this.accTorque = undefined;
|
|
157
|
-
this.rpm = undefined;
|
|
158
|
-
this.timeOffset = 0;
|
|
159
|
-
this.time = undefined;
|
|
160
|
-
this.currentCrankData = undefined;
|
|
161
|
-
this.prevCrankData = undefined;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
exports.default = BleCyclingPowerDevice;
|
|
165
|
-
BleCyclingPowerDevice.services = [consts_1.CSP];
|
|
166
|
-
BleCyclingPowerDevice.characteristics = [consts_1.CSP_MEASUREMENT, consts_1.CSP_FEATURE, '2a5d', '2a3c'];
|
|
167
|
-
BleCyclingPowerDevice.detectionPriority = 1;
|
|
168
|
-
ble_interface_1.default.register('BleCyclingPowerDevice', 'cp', BleCyclingPowerDevice, BleCyclingPowerDevice.services);
|
|
169
|
-
class PwrAdapter extends device_1.default {
|
|
170
|
-
constructor(device, protocol) {
|
|
171
|
-
super(protocol);
|
|
172
|
-
this.ignore = false;
|
|
173
|
-
this.paused = false;
|
|
174
|
-
this.distanceInternal = 0;
|
|
175
|
-
this.device = device;
|
|
176
|
-
this.ble = protocol.ble;
|
|
177
|
-
this.mode = this.getDefaultCyclingMode();
|
|
178
|
-
this.logger = new gd_eventlog_1.EventLogger('Ble-CP');
|
|
179
|
-
}
|
|
180
|
-
isBike() { return true; }
|
|
181
|
-
isHrm() { return false; }
|
|
182
|
-
isPower() { return true; }
|
|
183
|
-
isSame(device) {
|
|
184
|
-
if (!(device instanceof PwrAdapter))
|
|
185
|
-
return false;
|
|
186
|
-
const adapter = device;
|
|
187
|
-
return (adapter.getName() === this.getName() && adapter.getProfile() === this.getProfile());
|
|
188
|
-
}
|
|
189
|
-
getProfile() {
|
|
190
|
-
return 'Power Meter';
|
|
191
|
-
}
|
|
192
|
-
getName() {
|
|
193
|
-
return `${this.device.name}`;
|
|
194
|
-
}
|
|
195
|
-
getDisplayName() {
|
|
196
|
-
const { name, instantaneousPower: power } = this.device;
|
|
197
|
-
const powerStr = power ? ` (${power})` : '';
|
|
198
|
-
return `${name}${powerStr}`;
|
|
199
|
-
}
|
|
200
|
-
getCyclingMode() {
|
|
201
|
-
if (!this.mode)
|
|
202
|
-
this.mode = this.getDefaultCyclingMode();
|
|
203
|
-
return this.mode;
|
|
204
|
-
}
|
|
205
|
-
getDefaultCyclingMode() {
|
|
206
|
-
return new power_meter_1.default(this);
|
|
207
|
-
}
|
|
208
|
-
getSupportedCyclingModes() {
|
|
209
|
-
return [power_meter_1.default];
|
|
210
|
-
}
|
|
211
|
-
getPort() {
|
|
212
|
-
return 'ble';
|
|
213
|
-
}
|
|
214
|
-
getWeight() {
|
|
215
|
-
let userWeight = device_1.DEFAULT_USER_WEIGHT;
|
|
216
|
-
let bikeWeight = device_1.DEFAULT_BIKE_WEIGHT;
|
|
217
|
-
if (this.userSettings && this.userSettings.weight) {
|
|
218
|
-
userWeight = Number(this.userSettings.weight);
|
|
219
|
-
}
|
|
220
|
-
if (this.bikeSettings && this.bikeSettings.weight) {
|
|
221
|
-
bikeWeight = Number(this.bikeSettings.weight);
|
|
222
|
-
}
|
|
223
|
-
return bikeWeight + userWeight;
|
|
224
|
-
}
|
|
225
|
-
setIgnoreBike(ignore) {
|
|
226
|
-
this.ignore = ignore;
|
|
227
|
-
}
|
|
228
|
-
setIgnorePower(ignore) {
|
|
229
|
-
this.ignore = ignore;
|
|
230
|
-
}
|
|
231
|
-
onDeviceData(deviceData) {
|
|
232
|
-
if (this.prevDataTS && Date.now() - this.prevDataTS < 1000)
|
|
233
|
-
return;
|
|
234
|
-
this.prevDataTS = Date.now();
|
|
235
|
-
this.logger.logEvent({ message: 'onDeviceData', data: deviceData });
|
|
236
|
-
let incyclistData = this.mapData(deviceData);
|
|
237
|
-
incyclistData = this.getCyclingMode().updateData(incyclistData);
|
|
238
|
-
const data = this.transformData(incyclistData);
|
|
239
|
-
if (this.onDataFn && !this.ignore && !this.paused)
|
|
240
|
-
this.onDataFn(data);
|
|
241
|
-
}
|
|
242
|
-
mapData(deviceData) {
|
|
243
|
-
const data = {
|
|
244
|
-
isPedalling: false,
|
|
245
|
-
power: 0,
|
|
246
|
-
pedalRpm: undefined,
|
|
247
|
-
speed: 0,
|
|
248
|
-
heartrate: 0,
|
|
249
|
-
distanceInternal: 0,
|
|
250
|
-
slope: undefined,
|
|
251
|
-
time: undefined
|
|
252
|
-
};
|
|
253
|
-
data.power = (deviceData.instantaneousPower !== undefined ? deviceData.instantaneousPower : data.power);
|
|
254
|
-
data.pedalRpm = (deviceData.rpm !== undefined ? deviceData.rpm : data.pedalRpm);
|
|
255
|
-
data.time = (deviceData.time !== undefined ? deviceData.time : data.time);
|
|
256
|
-
data.isPedalling = data.pedalRpm > 0 || (data.pedalRpm === undefined && data.power > 0);
|
|
257
|
-
return data;
|
|
258
|
-
}
|
|
259
|
-
transformData(bikeData) {
|
|
260
|
-
if (this.ignore) {
|
|
261
|
-
return {};
|
|
262
|
-
}
|
|
263
|
-
if (bikeData === undefined)
|
|
264
|
-
return;
|
|
265
|
-
let distance = 0;
|
|
266
|
-
if (this.distanceInternal !== undefined && bikeData.distanceInternal !== undefined) {
|
|
267
|
-
distance = Math.round(bikeData.distanceInternal - this.distanceInternal);
|
|
268
|
-
}
|
|
269
|
-
if (bikeData.distanceInternal !== undefined)
|
|
270
|
-
this.distanceInternal = bikeData.distanceInternal;
|
|
271
|
-
let data = {
|
|
272
|
-
speed: bikeData.speed,
|
|
273
|
-
slope: bikeData.slope,
|
|
274
|
-
power: bikeData.power !== undefined ? Math.round(bikeData.power) : undefined,
|
|
275
|
-
cadence: bikeData.pedalRpm !== undefined ? Math.round(bikeData.pedalRpm) : undefined,
|
|
276
|
-
distance,
|
|
277
|
-
timestamp: Date.now()
|
|
278
|
-
};
|
|
279
|
-
return data;
|
|
280
|
-
}
|
|
281
|
-
start(props) {
|
|
282
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
283
|
-
if (props && props.user)
|
|
284
|
-
this.userSettings = props.user;
|
|
285
|
-
if (props && props.bikeSettings)
|
|
286
|
-
this.bikeSettings = props.bikeSettings;
|
|
287
|
-
this.logger.logEvent({ message: 'csp: start requested', profile: this.getProfile(), props });
|
|
288
|
-
try {
|
|
289
|
-
const bleDevice = yield this.ble.connectDevice(this.device);
|
|
290
|
-
if (bleDevice) {
|
|
291
|
-
this.device = bleDevice;
|
|
292
|
-
bleDevice.on('data', (data) => {
|
|
293
|
-
this.onDeviceData(data);
|
|
294
|
-
});
|
|
295
|
-
return true;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
catch (err) {
|
|
299
|
-
this.logger.logEvent({ message: 'start result: error', error: err.message, profile: this.getProfile() });
|
|
300
|
-
throw new Error(`could not start device, reason:${err.message}`);
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
stop() {
|
|
305
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
306
|
-
this.logger.logEvent({ message: 'stop requested', profile: this.getProfile() });
|
|
307
|
-
this.distanceInternal = 0;
|
|
308
|
-
this.device.reset();
|
|
309
|
-
return this.device.disconnect();
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
sendUpdate(request) {
|
|
313
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
314
|
-
if (this.paused)
|
|
315
|
-
return;
|
|
316
|
-
this.getCyclingMode().sendBikeUpdate(request);
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
pause() { this.paused = true; return Promise.resolve(true); }
|
|
320
|
-
resume() { this.paused = false; return Promise.resolve(true); }
|
|
321
|
-
}
|
|
322
|
-
exports.PwrAdapter = PwrAdapter;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import CyclingMode from '../../cycling-mode';
|
|
2
|
-
import DaumAdapter from '../DaumAdapter';
|
|
3
|
-
export default class DaumClassicAdapter extends DaumAdapter {
|
|
4
|
-
static NAME: string;
|
|
5
|
-
name: string;
|
|
6
|
-
id: string;
|
|
7
|
-
udid: number;
|
|
8
|
-
constructor(protocol: any, bike: any);
|
|
9
|
-
setID(id: any): void;
|
|
10
|
-
getID(): string;
|
|
11
|
-
getName(): string;
|
|
12
|
-
setName(name: any): void;
|
|
13
|
-
getPort(): any;
|
|
14
|
-
getSupportedCyclingModes(): Array<any>;
|
|
15
|
-
getDefaultCyclingMode(): CyclingMode;
|
|
16
|
-
pause(): Promise<boolean>;
|
|
17
|
-
resume(): Promise<boolean>;
|
|
18
|
-
check(): Promise<unknown>;
|
|
19
|
-
startRide(props: any): Promise<boolean>;
|
|
20
|
-
start(props: any): Promise<boolean>;
|
|
21
|
-
launch(props: any, isRelaunch?: boolean): Promise<boolean>;
|
|
22
|
-
performStart(props?: {
|
|
23
|
-
user?: any;
|
|
24
|
-
bikeSettings?: any;
|
|
25
|
-
gear?: any;
|
|
26
|
-
}, isRelaunch?: boolean): Promise<unknown>;
|
|
27
|
-
getCurrentBikeData(): any;
|
|
28
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import DeviceProtocolBase, { ScanProps, DeviceProtocol, DeviceSettings } from '../../protocol';
|
|
2
|
-
import Adapter from './DaumClassicAdapter';
|
|
3
|
-
import { EventLogger } from 'gd-eventlog';
|
|
4
|
-
export interface DaumClassicProtocolState {
|
|
5
|
-
activeScans: Array<any>;
|
|
6
|
-
scanning: boolean;
|
|
7
|
-
stopScanning?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface DaumClassicScanProps extends ScanProps {
|
|
10
|
-
port: string;
|
|
11
|
-
}
|
|
12
|
-
export default class DaumClassicProtocol extends DeviceProtocolBase implements DeviceProtocol {
|
|
13
|
-
logger: EventLogger;
|
|
14
|
-
state: DaumClassicProtocolState;
|
|
15
|
-
constructor();
|
|
16
|
-
add(settings: DeviceSettings): Adapter;
|
|
17
|
-
getName(): string;
|
|
18
|
-
getInterfaces(): Array<string>;
|
|
19
|
-
isBike(): boolean;
|
|
20
|
-
isHrm(): boolean;
|
|
21
|
-
isPower(): boolean;
|
|
22
|
-
scan(props: DaumClassicScanProps): void;
|
|
23
|
-
addDevice(opts: any, portName: any): any;
|
|
24
|
-
stopScan(): Promise<boolean>;
|
|
25
|
-
isScanning(): boolean;
|
|
26
|
-
scanCommand(device: any, opts: any): any;
|
|
27
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
-
};
|
|
33
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
const protocol_1 = __importStar(require("../../protocol"));
|
|
35
|
-
const registry_1 = __importDefault(require("../../registry"));
|
|
36
|
-
const bike_1 = __importDefault(require("./bike"));
|
|
37
|
-
const DaumClassicAdapter_1 = __importDefault(require("./DaumClassicAdapter"));
|
|
38
|
-
const gd_eventlog_1 = require("gd-eventlog");
|
|
39
|
-
const DaumClassicAdapter_2 = __importDefault(require("./DaumClassicAdapter"));
|
|
40
|
-
const PROTOCOL_NAME = "Daum Classic";
|
|
41
|
-
const DefaultState = {
|
|
42
|
-
activeScans: [],
|
|
43
|
-
scanning: false,
|
|
44
|
-
stopScanning: false
|
|
45
|
-
};
|
|
46
|
-
class DaumClassicProtocol extends protocol_1.default {
|
|
47
|
-
constructor() {
|
|
48
|
-
super();
|
|
49
|
-
this.state = DefaultState;
|
|
50
|
-
this.logger = new gd_eventlog_1.EventLogger('DaumClassic');
|
|
51
|
-
this.devices = [];
|
|
52
|
-
}
|
|
53
|
-
add(settings) {
|
|
54
|
-
this.logger.logEvent({ message: 'adding device', settings });
|
|
55
|
-
const { port } = settings;
|
|
56
|
-
bike_1.default.setSerialPort(protocol_1.default.getSerialPort());
|
|
57
|
-
const bike = new bike_1.default({ port });
|
|
58
|
-
let device = new DaumClassicAdapter_2.default(this, bike);
|
|
59
|
-
this.devices.push(device);
|
|
60
|
-
return device;
|
|
61
|
-
}
|
|
62
|
-
getName() {
|
|
63
|
-
return PROTOCOL_NAME;
|
|
64
|
-
}
|
|
65
|
-
getInterfaces() {
|
|
66
|
-
return [protocol_1.INTERFACE.SERIAL];
|
|
67
|
-
}
|
|
68
|
-
isBike() {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
isHrm() {
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
isPower() {
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
scan(props) {
|
|
78
|
-
this.logger.logEvent({ message: 'start scan', id: props.id, port: props.port });
|
|
79
|
-
bike_1.default.setSerialPort(protocol_1.default.getSerialPort());
|
|
80
|
-
this.state.scanning = true;
|
|
81
|
-
let device = this.addDevice(props, props.port);
|
|
82
|
-
if (device) {
|
|
83
|
-
const iv = setInterval(() => { this.scanCommand(device, props); }, 1000);
|
|
84
|
-
this.state.activeScans.push({ iv, device, props });
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
addDevice(opts, portName) {
|
|
88
|
-
let device;
|
|
89
|
-
if (this.devices.length === 0) {
|
|
90
|
-
const bike = new bike_1.default(opts);
|
|
91
|
-
device = new DaumClassicAdapter_1.default(this, bike);
|
|
92
|
-
this.devices.push(device);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
const devices = this.devices;
|
|
96
|
-
const idx = devices.findIndex(d => d.getBike().getPort() === portName);
|
|
97
|
-
if (idx === -1) {
|
|
98
|
-
const bike = new bike_1.default(opts);
|
|
99
|
-
device = new DaumClassicAdapter_1.default(this, bike);
|
|
100
|
-
this.devices.push(device);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
device = this.devices[idx];
|
|
104
|
-
if (device.isSelected() || device.isDetected())
|
|
105
|
-
device = undefined;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return device;
|
|
109
|
-
}
|
|
110
|
-
stopScan() {
|
|
111
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
if (this.state.stopScanning)
|
|
113
|
-
return;
|
|
114
|
-
this.state.stopScanning = true;
|
|
115
|
-
this.logger.logEvent({ message: 'stop scan', activeScans: this.state.activeScans });
|
|
116
|
-
const stopRequired = [];
|
|
117
|
-
if (this.state.activeScans.length > 0) {
|
|
118
|
-
this.state.activeScans.forEach(scan => {
|
|
119
|
-
stopRequired.push(scan.scanning);
|
|
120
|
-
clearInterval(scan.iv);
|
|
121
|
-
scan.iv = undefined;
|
|
122
|
-
scan.scanning = false;
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
for (let i = 0; i < this.state.activeScans.length; i++) {
|
|
126
|
-
const as = this.state.activeScans[i];
|
|
127
|
-
const toStop = stopRequired[i];
|
|
128
|
-
const d = as.device;
|
|
129
|
-
if (!d.isSelected() && !d.isDetected()) {
|
|
130
|
-
try {
|
|
131
|
-
yield d.close();
|
|
132
|
-
}
|
|
133
|
-
catch (err) {
|
|
134
|
-
this.logger.logEvent({ message: 'stop scan error', error: err.message });
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
if (toStop) {
|
|
138
|
-
const { id, onScanFinished } = as.props;
|
|
139
|
-
if (onScanFinished)
|
|
140
|
-
onScanFinished(id);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
this.state.activeScans = [];
|
|
144
|
-
this.state.scanning = false;
|
|
145
|
-
this.state.stopScanning = false;
|
|
146
|
-
this.logger.logEvent({ message: 'stop scan completed' });
|
|
147
|
-
return true;
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
isScanning() {
|
|
151
|
-
return this.state.scanning;
|
|
152
|
-
}
|
|
153
|
-
scanCommand(device, opts) {
|
|
154
|
-
const scan = this.state.activeScans.find(actScan => actScan.device.getBike().getPort() === device.getBike().getPort());
|
|
155
|
-
if (this.state.stopScanning || (scan && scan.scanning) || device.isDetected())
|
|
156
|
-
return;
|
|
157
|
-
scan.scanning = true;
|
|
158
|
-
return device.check()
|
|
159
|
-
.then(() => __awaiter(this, void 0, void 0, function* () {
|
|
160
|
-
if (this.state.stopScanning)
|
|
161
|
-
return;
|
|
162
|
-
const { onDeviceFound, onScanFinished, id } = opts;
|
|
163
|
-
device.setDetected();
|
|
164
|
-
if (onDeviceFound)
|
|
165
|
-
onDeviceFound(device, device.getProtocol());
|
|
166
|
-
if (onScanFinished) {
|
|
167
|
-
onScanFinished(id);
|
|
168
|
-
}
|
|
169
|
-
try {
|
|
170
|
-
yield device.getBike().saveClose();
|
|
171
|
-
}
|
|
172
|
-
catch (err) {
|
|
173
|
-
this.logger.logEvent({ message: 'scanCommand warning: Could not close port', error: err.message });
|
|
174
|
-
}
|
|
175
|
-
clearInterval(scan.iv);
|
|
176
|
-
scan.iv = undefined;
|
|
177
|
-
scan.scanning = false;
|
|
178
|
-
}))
|
|
179
|
-
.catch(() => {
|
|
180
|
-
scan.scanning = false;
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
exports.default = DaumClassicProtocol;
|
|
185
|
-
registry_1.default.register(new DaumClassicProtocol());
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import DaumAdapter from '../DaumAdapter';
|
|
2
|
-
export default class DaumPremiumDevice extends DaumAdapter {
|
|
3
|
-
static NAME: string;
|
|
4
|
-
constructor(protocol: any, bike: any);
|
|
5
|
-
getName(): string;
|
|
6
|
-
getPort(): any;
|
|
7
|
-
getInterface(): any;
|
|
8
|
-
getSupportedCyclingModes(): Array<any>;
|
|
9
|
-
check(): Promise<unknown>;
|
|
10
|
-
pause(): Promise<boolean>;
|
|
11
|
-
resume(): Promise<boolean>;
|
|
12
|
-
startRide(props: any): Promise<boolean>;
|
|
13
|
-
start(props: any): Promise<boolean>;
|
|
14
|
-
launch(props: any, isRelaunch?: boolean): Promise<boolean>;
|
|
15
|
-
getCurrentBikeData(): Promise<any>;
|
|
16
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import DeviceProtocolBase, { DeviceProtocol, DeviceSettings } from '../../protocol';
|
|
2
|
-
import { EventLogger } from 'gd-eventlog';
|
|
3
|
-
export interface DaumPremiumProtocolState {
|
|
4
|
-
activeScans: Array<any>;
|
|
5
|
-
scanning: boolean;
|
|
6
|
-
stopScanning?: boolean;
|
|
7
|
-
}
|
|
8
|
-
interface DaumPremiumSettings extends DeviceSettings {
|
|
9
|
-
interface: string;
|
|
10
|
-
}
|
|
11
|
-
interface DaumPremiumTCPSettings extends DaumPremiumSettings {
|
|
12
|
-
host: string;
|
|
13
|
-
}
|
|
14
|
-
export default class DaumPremiumProtocol extends DeviceProtocolBase implements DeviceProtocol {
|
|
15
|
-
state: DaumPremiumProtocolState;
|
|
16
|
-
logger: EventLogger;
|
|
17
|
-
constructor();
|
|
18
|
-
add(settings: DaumPremiumSettings | DaumPremiumTCPSettings): any;
|
|
19
|
-
getName(): string;
|
|
20
|
-
getInterfaces(): string[];
|
|
21
|
-
isBike(): boolean;
|
|
22
|
-
isHrm(): boolean;
|
|
23
|
-
isPower(): boolean;
|
|
24
|
-
scan(props: any): void;
|
|
25
|
-
addDevice(DeviceClass: any, opts: any, portName: any): any;
|
|
26
|
-
scanTcpip(opts: any): void;
|
|
27
|
-
scanSerial(opts: any): void;
|
|
28
|
-
isScanning(): boolean;
|
|
29
|
-
stopScan(): Promise<boolean>;
|
|
30
|
-
scanCommand(device: any, opts: any): void;
|
|
31
|
-
}
|
|
32
|
-
export {};
|