incyclist-devices 1.5.37 → 2.0.0-beta.1
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 +0 -0
- package/lib/adapters.d.ts +6 -0
- package/lib/adapters.js +30 -0
- package/lib/antv2/adapter-factory.d.ts +20 -10
- package/lib/antv2/adapter-factory.js +49 -33
- package/lib/antv2/adapter.d.ts +64 -0
- package/lib/antv2/adapter.js +299 -0
- package/lib/antv2/ant-interface.d.ts +11 -9
- package/lib/antv2/ant-interface.js +15 -11
- package/lib/antv2/fe/adapter.d.ts +25 -0
- package/lib/antv2/{fe.js → fe/adapter.js} +48 -72
- package/lib/antv2/fe/index.d.ts +2 -0
- package/lib/antv2/fe/index.js +7 -0
- package/lib/antv2/hr/adapter.d.ts +14 -0
- package/lib/antv2/hr/adapter.js +73 -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 +22 -0
- package/lib/antv2/{pwr.js → pwr/adapter.js} +38 -76
- package/lib/antv2/pwr/index.d.ts +2 -0
- package/lib/antv2/pwr/index.js +7 -0
- package/lib/antv2/types.d.ts +19 -0
- package/lib/antv2/types.js +2 -0
- package/lib/antv2/utils.d.ts +1 -0
- package/lib/antv2/utils.js +181 -0
- package/lib/base/adpater.d.ts +56 -0
- package/lib/base/adpater.js +144 -0
- package/lib/ble/adapter-factory.d.ts +31 -0
- package/lib/ble/adapter-factory.js +96 -0
- package/lib/ble/adapter.d.ts +41 -0
- package/lib/ble/adapter.js +188 -0
- package/lib/ble/{ble-device.d.ts → ble-comms.d.ts} +9 -4
- package/lib/ble/{ble-device.js → ble-comms.js} +23 -11
- package/lib/ble/ble-interface.d.ts +15 -24
- package/lib/ble/ble-interface.js +32 -137
- package/lib/ble/ble-peripheral.d.ts +3 -3
- package/lib/ble/ble-peripheral.js +14 -14
- package/lib/ble/ble.d.ts +9 -81
- package/lib/ble/ble.js +1 -39
- package/lib/ble/consts.d.ts +2 -0
- package/lib/ble/consts.js +3 -1
- package/lib/ble/cp/adapter.d.ts +23 -0
- package/lib/ble/cp/adapter.js +124 -0
- package/lib/ble/cp/comm.d.ts +28 -0
- package/lib/ble/cp/comm.js +140 -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 +20 -0
- package/lib/ble/elite/adapter.js +127 -0
- package/lib/ble/elite/comms.d.ts +28 -0
- package/lib/ble/elite/comms.js +139 -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 +21 -0
- package/lib/ble/fm/adapter.js +190 -0
- package/lib/ble/fm/comms.d.ts +50 -0
- package/lib/ble/{fm.js → fm/comms.js} +3 -224
- 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 +25 -0
- package/lib/ble/fm/types.js +2 -0
- package/lib/ble/hr/adapter.d.ts +17 -0
- package/lib/ble/hr/adapter.js +62 -0
- package/lib/ble/hr/comm.d.ts +15 -0
- package/lib/ble/hr/comm.js +52 -0
- package/lib/ble/hr/index.d.ts +4 -0
- package/lib/ble/hr/index.js +10 -0
- package/lib/ble/hr/types.d.ts +5 -0
- package/lib/ble/hr/types.js +2 -0
- package/lib/ble/index.d.ts +8 -0
- package/lib/ble/index.js +26 -0
- package/lib/ble/tacx/adapter.d.ts +10 -0
- package/lib/ble/tacx/adapter.js +93 -0
- package/lib/ble/{tacx.d.ts → tacx/comms.d.ts} +6 -38
- package/lib/ble/{tacx.js → tacx/comms.js} +13 -112
- 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 +101 -0
- package/lib/ble/types.js +19 -0
- package/lib/ble/utils.d.ts +7 -0
- package/lib/ble/utils.js +95 -0
- package/lib/ble/wahoo/adapter.d.ts +9 -0
- package/lib/ble/wahoo/adapter.js +93 -0
- package/lib/ble/{wahoo-kickr.d.ts → wahoo/comms.d.ts} +5 -39
- package/lib/ble/{wahoo-kickr.js → wahoo/comms.js} +14 -112
- 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/device.d.ts +0 -94
- package/lib/device.js +0 -76
- package/lib/index.d.ts +12 -0
- package/lib/index.js +38 -0
- package/lib/interfaces.d.ts +6 -0
- package/lib/interfaces.js +23 -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 +4 -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 +16 -0
- package/lib/serial/adapter.js +42 -0
- package/lib/serial/bindings/tcp.d.ts +44 -0
- package/lib/serial/bindings/tcp.js +270 -0
- package/lib/serial/comm.d.ts +7 -0
- package/lib/serial/comm.js +2 -0
- package/lib/{daum → serial/daum}/DaumAdapter.d.ts +13 -22
- package/lib/{daum → serial/daum}/DaumAdapter.js +44 -90
- 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 +24 -0
- package/lib/{daum/premium/DaumPremiumAdapter.js → serial/daum/premium/adapter.js} +99 -46
- 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} +214 -420
- package/lib/serial/daum/premium/mock.d.ts +75 -0
- package/lib/serial/daum/premium/mock.js +290 -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 +13 -24
- package/lib/{kettler → serial/kettler}/ergo-racer/adapter.js +87 -130
- 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 +58 -0
- package/lib/serial/serial-interface.js +283 -0
- package/lib/simulator/Simulator.d.ts +10 -25
- package/lib/simulator/Simulator.js +19 -83
- package/lib/types/adapter.d.ts +32 -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 +29 -0
- package/lib/types/device.js +11 -0
- package/lib/types/interface.d.ts +14 -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 +15 -11
- 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/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/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/antv2/{ant-binding.d.ts → binding.d.ts} +0 -0
- /package/lib/antv2/{ant-binding.js → binding.js} +0 -0
- /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
|
@@ -1,153 +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 gd_eventlog_1 = require("gd-eventlog");
|
|
35
|
-
const protocol_1 = __importStar(require("../protocol"));
|
|
36
|
-
const registry_1 = __importDefault(require("../registry"));
|
|
37
|
-
const ble_1 = require("./ble");
|
|
38
|
-
const ble_interface_1 = __importDefault(require("./ble-interface"));
|
|
39
|
-
const fm_1 = __importStar(require("./fm"));
|
|
40
|
-
const hrm_1 = __importStar(require("./hrm"));
|
|
41
|
-
const pwr_1 = __importStar(require("./pwr"));
|
|
42
|
-
const wahoo_kickr_1 = __importStar(require("./wahoo-kickr"));
|
|
43
|
-
const tacx_1 = __importStar(require("./tacx"));
|
|
44
|
-
const elite_1 = __importStar(require("./elite"));
|
|
45
|
-
class BleProtocol extends protocol_1.default {
|
|
46
|
-
constructor(binding) {
|
|
47
|
-
super();
|
|
48
|
-
const b = binding || BleProtocol._defaultBinding;
|
|
49
|
-
this.logger = new gd_eventlog_1.EventLogger('BLE');
|
|
50
|
-
this.ble = ble_interface_1.default.getInstance({ binding: b, logger: this.logger });
|
|
51
|
-
BleProtocol._instances.push(this);
|
|
52
|
-
}
|
|
53
|
-
static setDefaultBinding(binding) {
|
|
54
|
-
BleProtocol._defaultBinding = binding;
|
|
55
|
-
BleProtocol._instances.forEach((p) => {
|
|
56
|
-
if (p.ble && !p.ble.getBinding()) {
|
|
57
|
-
p.ble.setBinding(binding);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
setBinding(binding) {
|
|
62
|
-
if (this.ble)
|
|
63
|
-
this.ble.setBinding(binding);
|
|
64
|
-
}
|
|
65
|
-
createDevice(bleDevice) {
|
|
66
|
-
const fromDevice = bleDevice instanceof ble_1.BleDeviceClass;
|
|
67
|
-
const profile = bleDevice instanceof ble_1.BleDeviceClass ? bleDevice.getProfile() : bleDevice.profile;
|
|
68
|
-
const props = () => {
|
|
69
|
-
const { id, name, address } = bleDevice;
|
|
70
|
-
return { id, name, address };
|
|
71
|
-
};
|
|
72
|
-
switch (profile.toLowerCase()) {
|
|
73
|
-
case 'hr':
|
|
74
|
-
case 'heartrate monitor':
|
|
75
|
-
return new hrm_1.HrmAdapter(fromDevice ? bleDevice : new hrm_1.default(props()), this);
|
|
76
|
-
case 'fm':
|
|
77
|
-
case 'smart trainer':
|
|
78
|
-
case 'wahoo smart trainer':
|
|
79
|
-
case 'fitness machine':
|
|
80
|
-
case 'elite smart trainer':
|
|
81
|
-
case tacx_1.default.PROFILE.toLowerCase():
|
|
82
|
-
let device;
|
|
83
|
-
if (fromDevice)
|
|
84
|
-
device = bleDevice;
|
|
85
|
-
else {
|
|
86
|
-
device = this.ble.findDeviceInCache(Object.assign(Object.assign({}, props()), { profile }));
|
|
87
|
-
}
|
|
88
|
-
if (profile.toLowerCase() === 'wahoo smart trainer') {
|
|
89
|
-
device = device || new wahoo_kickr_1.default(props());
|
|
90
|
-
return new wahoo_kickr_1.WahooAdvancedFmAdapter(device, this);
|
|
91
|
-
}
|
|
92
|
-
if (profile.toLowerCase() === 'elite smart trainer') {
|
|
93
|
-
device = device || new elite_1.default(props());
|
|
94
|
-
return new elite_1.EliteAdapter(device, this);
|
|
95
|
-
}
|
|
96
|
-
else if (profile === tacx_1.default.PROFILE) {
|
|
97
|
-
device = device || new tacx_1.default(props());
|
|
98
|
-
return new tacx_1.TacxBleFEAdapter(device, this);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
device = device || new fm_1.default(props());
|
|
102
|
-
return new fm_1.FmAdapter(device, this);
|
|
103
|
-
}
|
|
104
|
-
case 'cp':
|
|
105
|
-
case 'power meter':
|
|
106
|
-
return new pwr_1.PwrAdapter(fromDevice ? bleDevice : new pwr_1.default(props()), this);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
getName() { return 'BLE'; }
|
|
110
|
-
getInterfaces() { return [protocol_1.INTERFACE.BLE]; }
|
|
111
|
-
isBike() { return true; }
|
|
112
|
-
isHrm() { return true; }
|
|
113
|
-
isPower() { return true; }
|
|
114
|
-
add(settings) {
|
|
115
|
-
this.logger.logEvent({ message: 'adding device', settings });
|
|
116
|
-
const device = this.createDevice(settings);
|
|
117
|
-
return device;
|
|
118
|
-
}
|
|
119
|
-
scan(props) {
|
|
120
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
-
try {
|
|
122
|
-
this.ble.on('device', (bleDevice) => {
|
|
123
|
-
if (props && props.onDeviceFound) {
|
|
124
|
-
const device = this.createDevice(bleDevice);
|
|
125
|
-
props.onDeviceFound(device, this);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
this.logger.logEvent({ message: 'scan started' });
|
|
129
|
-
const supportedDeviceTypes = this.ble.getAllSupportedDeviceTypes();
|
|
130
|
-
yield this.ble.scan({ deviceTypes: supportedDeviceTypes, timeout: 20000 });
|
|
131
|
-
if (props && props.onScanFinished) {
|
|
132
|
-
props.onScanFinished(props.id);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
catch (err) {
|
|
136
|
-
this.logger.logEvent({ message: 'error', error: err.message });
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
stopScan() {
|
|
141
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
-
yield this.ble.stopScan();
|
|
143
|
-
return;
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
isScanning() {
|
|
147
|
-
return this.ble.isScanning();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
exports.default = BleProtocol;
|
|
151
|
-
BleProtocol._defaultBinding = undefined;
|
|
152
|
-
BleProtocol._instances = [];
|
|
153
|
-
registry_1.default.register(new BleProtocol());
|
package/lib/ble/pwr.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { BleDevice } from './ble-device';
|
|
3
|
-
import BleInterface from './ble-interface';
|
|
4
|
-
import BleProtocol from './incyclist-protocol';
|
|
5
|
-
import { BleDeviceClass } from './ble';
|
|
6
|
-
import DeviceAdapter, { DeviceData } from '../device';
|
|
7
|
-
import { DeviceProtocol } from '../protocol';
|
|
8
|
-
import { EventLogger } from 'gd-eventlog';
|
|
9
|
-
import CyclingMode from '../cycling-mode';
|
|
10
|
-
import { IncyclistBikeData } from '../cycling-mode';
|
|
11
|
-
declare type PowerData = {
|
|
12
|
-
instantaneousPower?: number;
|
|
13
|
-
balance?: number;
|
|
14
|
-
accTorque?: number;
|
|
15
|
-
time: number;
|
|
16
|
-
rpm: number;
|
|
17
|
-
raw?: string;
|
|
18
|
-
};
|
|
19
|
-
declare type CrankData = {
|
|
20
|
-
revolutions?: number;
|
|
21
|
-
time?: number;
|
|
22
|
-
cntUpdateMissing?: number;
|
|
23
|
-
};
|
|
24
|
-
export default class BleCyclingPowerDevice extends BleDevice {
|
|
25
|
-
static services: string[];
|
|
26
|
-
static characteristics: string[];
|
|
27
|
-
static detectionPriority: number;
|
|
28
|
-
instantaneousPower: number;
|
|
29
|
-
balance: number;
|
|
30
|
-
accTorque: number;
|
|
31
|
-
rpm: number;
|
|
32
|
-
timeOffset: number;
|
|
33
|
-
time: number;
|
|
34
|
-
currentCrankData: CrankData;
|
|
35
|
-
prevCrankData: CrankData;
|
|
36
|
-
constructor(props?: any);
|
|
37
|
-
isMatching(characteristics: string[]): boolean;
|
|
38
|
-
init(): Promise<boolean>;
|
|
39
|
-
getProfile(): string;
|
|
40
|
-
getServiceUUids(): string[];
|
|
41
|
-
parseCrankData(crankData: any): {
|
|
42
|
-
rpm: number;
|
|
43
|
-
time: any;
|
|
44
|
-
};
|
|
45
|
-
parsePower(_data: Uint8Array): PowerData;
|
|
46
|
-
onData(characteristic: string, data: Buffer): boolean;
|
|
47
|
-
reset(): void;
|
|
48
|
-
}
|
|
49
|
-
export declare class PwrAdapter extends DeviceAdapter {
|
|
50
|
-
device: BleCyclingPowerDevice;
|
|
51
|
-
ignore: boolean;
|
|
52
|
-
ble: BleInterface;
|
|
53
|
-
protocol: DeviceProtocol;
|
|
54
|
-
paused: boolean;
|
|
55
|
-
logger: EventLogger;
|
|
56
|
-
mode: CyclingMode;
|
|
57
|
-
distanceInternal: number;
|
|
58
|
-
prevDataTS: number;
|
|
59
|
-
userSettings: {
|
|
60
|
-
weight?: number;
|
|
61
|
-
};
|
|
62
|
-
bikeSettings: {
|
|
63
|
-
weight?: number;
|
|
64
|
-
};
|
|
65
|
-
constructor(device: BleDeviceClass, protocol: BleProtocol);
|
|
66
|
-
isBike(): boolean;
|
|
67
|
-
isHrm(): boolean;
|
|
68
|
-
isPower(): boolean;
|
|
69
|
-
isSame(device: DeviceAdapter): boolean;
|
|
70
|
-
getProfile(): string;
|
|
71
|
-
getName(): string;
|
|
72
|
-
getDisplayName(): string;
|
|
73
|
-
getCyclingMode(): CyclingMode;
|
|
74
|
-
getDefaultCyclingMode(): CyclingMode;
|
|
75
|
-
getSupportedCyclingModes(): any[];
|
|
76
|
-
getPort(): string;
|
|
77
|
-
getWeight(): number;
|
|
78
|
-
setIgnoreBike(ignore: any): void;
|
|
79
|
-
setIgnorePower(ignore: any): void;
|
|
80
|
-
onDeviceData(deviceData: PowerData): void;
|
|
81
|
-
mapData(deviceData: PowerData): IncyclistBikeData;
|
|
82
|
-
transformData(bikeData: IncyclistBikeData): DeviceData;
|
|
83
|
-
start(props?: any): Promise<any>;
|
|
84
|
-
stop(): Promise<boolean>;
|
|
85
|
-
sendUpdate(request: any): Promise<void>;
|
|
86
|
-
pause(): Promise<boolean>;
|
|
87
|
-
resume(): Promise<boolean>;
|
|
88
|
-
}
|
|
89
|
-
export {};
|
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
|
-
}
|