incyclist-devices 1.5.38 → 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} +208 -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
|
@@ -13,14 +13,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const gd_eventlog_1 = require("gd-eventlog");
|
|
16
|
-
const utils_1 = require("
|
|
16
|
+
const utils_1 = require("../../../utils/utils");
|
|
17
17
|
const DaumAdapter_1 = __importDefault(require("../DaumAdapter"));
|
|
18
|
-
const
|
|
18
|
+
const daum_classic_1 = __importDefault(require("./modes/daum-classic"));
|
|
19
|
+
const comms_1 = __importDefault(require("./comms"));
|
|
20
|
+
const serial_interface_1 = __importDefault(require("../../serial-interface"));
|
|
19
21
|
const PROTOCOL_NAME = "Daum Classic";
|
|
22
|
+
const DEFAULT_GEAR = 10;
|
|
23
|
+
const getBikeProps = (props) => {
|
|
24
|
+
const { port, interface: ifaceName } = props;
|
|
25
|
+
let serial;
|
|
26
|
+
if (ifaceName && typeof ifaceName === 'string') {
|
|
27
|
+
serial = serial_interface_1.default.getInstance({ ifaceName });
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
serial = props.interface;
|
|
31
|
+
}
|
|
32
|
+
if (!serial || !serial.binding)
|
|
33
|
+
throw new Error(`unknonwn interface: ${ifaceName}`);
|
|
34
|
+
const path = `${port}`;
|
|
35
|
+
return { serial, path };
|
|
36
|
+
};
|
|
20
37
|
class DaumClassicAdapter extends DaumAdapter_1.default {
|
|
21
|
-
constructor(
|
|
22
|
-
super(
|
|
23
|
-
|
|
38
|
+
constructor(settings, props) {
|
|
39
|
+
super(settings, props);
|
|
40
|
+
const logger = new gd_eventlog_1.EventLogger('DaumClassic');
|
|
41
|
+
const commProps = Object.assign(Object.assign({}, getBikeProps(settings)), { logger });
|
|
42
|
+
this.bike = new comms_1.default(commProps);
|
|
43
|
+
this.logger = logger;
|
|
24
44
|
this.name = PROTOCOL_NAME;
|
|
25
45
|
this.ignoreHrm = false;
|
|
26
46
|
this.ignorePower = false;
|
|
@@ -28,8 +48,6 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
|
|
|
28
48
|
this.paused = undefined;
|
|
29
49
|
this.iv = undefined;
|
|
30
50
|
this.distanceInternal = undefined;
|
|
31
|
-
this.udid = Date.now();
|
|
32
|
-
this.logger.logEvent({ message: 'Device created', udid: this.udid, port: this.getPort() });
|
|
33
51
|
this.initData();
|
|
34
52
|
}
|
|
35
53
|
setID(id) {
|
|
@@ -47,13 +65,51 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
|
|
|
47
65
|
getPort() {
|
|
48
66
|
return this.bike.getPort();
|
|
49
67
|
}
|
|
68
|
+
getProtocolName() {
|
|
69
|
+
return PROTOCOL_NAME;
|
|
70
|
+
}
|
|
50
71
|
getSupportedCyclingModes() {
|
|
51
72
|
const supported = super.getSupportedCyclingModes();
|
|
52
|
-
supported.push(
|
|
73
|
+
supported.push(daum_classic_1.default);
|
|
53
74
|
return supported;
|
|
54
75
|
}
|
|
55
76
|
getDefaultCyclingMode() {
|
|
56
|
-
return new
|
|
77
|
+
return new daum_classic_1.default(this);
|
|
78
|
+
}
|
|
79
|
+
check() {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
var info = {};
|
|
82
|
+
if (this.isStopped())
|
|
83
|
+
return false;
|
|
84
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
this.logger.logEvent({ message: "checking device", port: this.getPort() });
|
|
86
|
+
const iv = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
this.logger.logEvent({ message: "checking device failed", port: this.getPort(), reason: 'timeout' });
|
|
88
|
+
resolve(false);
|
|
89
|
+
}), 5000);
|
|
90
|
+
try {
|
|
91
|
+
const connected = yield this.connect();
|
|
92
|
+
if (!connected) {
|
|
93
|
+
clearTimeout(iv);
|
|
94
|
+
resolve(false);
|
|
95
|
+
}
|
|
96
|
+
const address = (yield this.bike.getAddress()) || {};
|
|
97
|
+
info.bikeNo = address.bike;
|
|
98
|
+
const version = (yield this.bike.getVersion()) || {};
|
|
99
|
+
info.serialNo = version.serialNo;
|
|
100
|
+
info.cockpit = version.cockpit;
|
|
101
|
+
this.setName('Daum ' + info.cockpit);
|
|
102
|
+
this.setID(info.serialNo);
|
|
103
|
+
clearTimeout(iv);
|
|
104
|
+
this.logger.logEvent({ message: "checking device success", port: this.getPort(), info });
|
|
105
|
+
resolve(true);
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
this.logger.logEvent({ message: "checking device failed", port: this.getPort(), reason: err.message || err });
|
|
109
|
+
resolve(false);
|
|
110
|
+
}
|
|
111
|
+
}));
|
|
112
|
+
});
|
|
57
113
|
}
|
|
58
114
|
pause() {
|
|
59
115
|
const _super = Object.create(null, {
|
|
@@ -75,41 +131,15 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
|
|
|
75
131
|
return resumed;
|
|
76
132
|
});
|
|
77
133
|
}
|
|
78
|
-
check() {
|
|
79
|
-
var info = {};
|
|
80
|
-
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
this.logger.logEvent({ message: "check()", port: this.getPort() });
|
|
82
|
-
const iv = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
reject(new Error(`timeout`));
|
|
84
|
-
}), 5000);
|
|
85
|
-
try {
|
|
86
|
-
if (!this.bike.isConnected())
|
|
87
|
-
yield this.bike.saveConnect();
|
|
88
|
-
const address = (yield this.bike.getAddress()) || {};
|
|
89
|
-
info.bikeNo = address.bike;
|
|
90
|
-
const version = (yield this.bike.getVersion()) || {};
|
|
91
|
-
info.serialNo = version.serialNo;
|
|
92
|
-
info.cockpit = version.cockpit;
|
|
93
|
-
this.setName('Daum ' + info.cockpit);
|
|
94
|
-
this.setID(info.serialNo);
|
|
95
|
-
clearTimeout(iv);
|
|
96
|
-
resolve(info);
|
|
97
|
-
}
|
|
98
|
-
catch (err) {
|
|
99
|
-
clearTimeout(iv);
|
|
100
|
-
reject(err);
|
|
101
|
-
}
|
|
102
|
-
}));
|
|
103
|
-
}
|
|
104
134
|
startRide(props) {
|
|
105
135
|
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
-
this.logger.logEvent({ message: 'relaunch of device'
|
|
136
|
+
this.logger.logEvent({ message: 'relaunch of device' });
|
|
107
137
|
return yield this.launch(props, true);
|
|
108
138
|
});
|
|
109
139
|
}
|
|
110
140
|
start(props) {
|
|
111
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
this.logger.logEvent({ message: 'initial start of device'
|
|
142
|
+
this.logger.logEvent({ message: 'initial start of device' });
|
|
113
143
|
return yield this.launch(props, false);
|
|
114
144
|
});
|
|
115
145
|
}
|
|
@@ -118,38 +148,35 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
|
|
|
118
148
|
try {
|
|
119
149
|
if (isRelaunch) {
|
|
120
150
|
yield this.stop();
|
|
121
|
-
this.bike.connected = true;
|
|
122
151
|
}
|
|
123
152
|
yield this.performStart(props, isRelaunch);
|
|
124
153
|
if (!isRelaunch) {
|
|
125
154
|
try {
|
|
126
155
|
const version = yield this.bike.getVersion();
|
|
127
156
|
const { serialNo, cockpit } = version || {};
|
|
128
|
-
this.logEvent({ message: 'device info', deviceInfo: { serialNo, cockpit }
|
|
157
|
+
this.logEvent({ message: 'device info', deviceInfo: { serialNo, cockpit } });
|
|
129
158
|
}
|
|
130
159
|
catch (_a) { }
|
|
131
160
|
}
|
|
132
|
-
this.logger.logEvent({ message: 'start result: success'
|
|
161
|
+
this.logger.logEvent({ message: 'start result: success' });
|
|
133
162
|
return true;
|
|
134
163
|
}
|
|
135
164
|
catch (err) {
|
|
136
|
-
this.logger.logEvent({ message: 'start result: error', error: err.message
|
|
165
|
+
this.logger.logEvent({ message: 'start result: error', error: err.message });
|
|
137
166
|
throw new Error(`could not start device, reason:${err.message}`);
|
|
138
167
|
}
|
|
139
168
|
});
|
|
140
169
|
}
|
|
141
170
|
performStart(props = {}, isRelaunch = false) {
|
|
142
|
-
this.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (bikeSettings && bikeSettings.weight)
|
|
147
|
-
this.bikeSettings.weight = bikeSettings.weight;
|
|
171
|
+
this.stopUpdatePull();
|
|
172
|
+
this.setBikeProps(props);
|
|
173
|
+
const user = this.user;
|
|
174
|
+
const { gear = DEFAULT_GEAR } = props;
|
|
148
175
|
this.initData();
|
|
149
176
|
let startState = {};
|
|
150
177
|
return (0, utils_1.runWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
|
|
151
178
|
try {
|
|
152
|
-
this.logger.logEvent({ message: 'start attempt',
|
|
179
|
+
this.logger.logEvent({ message: 'start attempt', isRelaunch, isConnected: this.bike.isConnected() });
|
|
153
180
|
if (!isRelaunch && !this.bike.isConnected())
|
|
154
181
|
yield this.bike.saveConnect();
|
|
155
182
|
yield this.getBike().resetDevice();
|
|
@@ -171,7 +198,7 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
|
|
|
171
198
|
startState.startProg = true;
|
|
172
199
|
}
|
|
173
200
|
if (!startState.setGear) {
|
|
174
|
-
yield this.bike.setGear(this.cyclingData.gear ||
|
|
201
|
+
yield this.bike.setGear(this.cyclingData.gear || gear);
|
|
175
202
|
startState.setGear = true;
|
|
176
203
|
}
|
|
177
204
|
const startRequest = this.getCyclingMode().getBikeInitRequest();
|
|
@@ -187,7 +214,7 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
|
|
|
187
214
|
return data;
|
|
188
215
|
}
|
|
189
216
|
catch (err) {
|
|
190
|
-
this.logger.logEvent({ message: 'start attempt failed',
|
|
217
|
+
this.logger.logEvent({ message: 'start attempt failed', error: err.message });
|
|
191
218
|
if (startState.checkRunData) {
|
|
192
219
|
startState = {};
|
|
193
220
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { EventLogger } from 'gd-eventlog';
|
|
2
|
-
import { Queue } from '
|
|
3
|
-
import { User } from '
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { Queue } from '../../../utils/utils';
|
|
3
|
+
import { User } from '../../../types/user';
|
|
4
|
+
import { SerialInterface, SerialPortProvider } from '../..';
|
|
5
|
+
import { SerialCommProps } from '../../comm';
|
|
6
|
+
type SuccessCallbackFn = (data: any) => void;
|
|
7
|
+
type ErrorCallbackFn = (status: number, error: any) => void;
|
|
6
8
|
interface CommandInstructions {
|
|
7
9
|
logStr: string;
|
|
8
10
|
payload: Array<number>;
|
|
@@ -14,8 +16,6 @@ interface CommandInstructions {
|
|
|
14
16
|
export default class Daum8008 {
|
|
15
17
|
logger: EventLogger;
|
|
16
18
|
portName: string;
|
|
17
|
-
settings: any;
|
|
18
|
-
bikeData: any;
|
|
19
19
|
sp: any;
|
|
20
20
|
error: Error;
|
|
21
21
|
opening: boolean;
|
|
@@ -28,7 +28,10 @@ export default class Daum8008 {
|
|
|
28
28
|
cmdStart: number;
|
|
29
29
|
cmdCurrent: any;
|
|
30
30
|
isLoggingPaused: boolean;
|
|
31
|
-
|
|
31
|
+
spp: SerialPortProvider;
|
|
32
|
+
serial: SerialInterface;
|
|
33
|
+
_timeoutSend: number;
|
|
34
|
+
constructor(props: SerialCommProps);
|
|
32
35
|
static setSerialPort(spClass: any): void;
|
|
33
36
|
static getClassName(): string;
|
|
34
37
|
getType(): string;
|
|
@@ -37,15 +40,10 @@ export default class Daum8008 {
|
|
|
37
40
|
pauseLogging(): void;
|
|
38
41
|
resumLogging(): void;
|
|
39
42
|
logEvent(e: any): void;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
saveConnect(): Promise<unknown>;
|
|
45
|
-
close(): void;
|
|
46
|
-
saveClose(): Promise<unknown>;
|
|
47
|
-
onPortOpen(): void;
|
|
48
|
-
onPortClose(): void;
|
|
43
|
+
connect(): Promise<boolean>;
|
|
44
|
+
close(): Promise<void>;
|
|
45
|
+
flush(): Promise<void>;
|
|
46
|
+
onPortClose(): Promise<void>;
|
|
49
47
|
onPortError(err: any): void;
|
|
50
48
|
startWorker(): void;
|
|
51
49
|
stopWorker(): void;
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
const gd_eventlog_1 = require("gd-eventlog");
|
|
4
13
|
const utils_1 = require("./utils");
|
|
5
|
-
const utils_2 = require("
|
|
14
|
+
const utils_2 = require("../../../utils/utils");
|
|
15
|
+
const __1 = require("../..");
|
|
6
16
|
const ByteLength = require('@serialport/parser-byte-length');
|
|
7
17
|
const nop = () => { };
|
|
8
18
|
const TIMEOUT_START = 15000;
|
|
9
19
|
const TIMEOUT_CLOSE = 5000;
|
|
10
20
|
const TIMEOUT_SEND = 2000;
|
|
11
|
-
var __SerialPort = undefined;
|
|
12
21
|
class Daum8008 {
|
|
13
|
-
constructor(
|
|
14
|
-
this.
|
|
15
|
-
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
maxPower: 800
|
|
21
|
-
};
|
|
22
|
+
constructor(props) {
|
|
23
|
+
this._timeoutSend = TIMEOUT_SEND;
|
|
24
|
+
const { logger, serial, path } = props;
|
|
25
|
+
this.logger = logger || new gd_eventlog_1.EventLogger('DaumClassic');
|
|
26
|
+
this.portName = path;
|
|
27
|
+
this.serial = serial;
|
|
28
|
+
this.spp = (0, __1.useSerialPortProvider)();
|
|
22
29
|
this.sp = undefined;
|
|
23
30
|
this.error = undefined;
|
|
24
31
|
this.opening = false;
|
|
@@ -30,7 +37,7 @@ class Daum8008 {
|
|
|
30
37
|
this.isLoggingPaused = false;
|
|
31
38
|
}
|
|
32
39
|
static setSerialPort(spClass) {
|
|
33
|
-
|
|
40
|
+
__1.SerialPortProvider.getInstance().setLegacyClass('serial', spClass);
|
|
34
41
|
}
|
|
35
42
|
static getClassName() {
|
|
36
43
|
return "Daum8008";
|
|
@@ -54,161 +61,72 @@ class Daum8008 {
|
|
|
54
61
|
if (!this.isLoggingPaused)
|
|
55
62
|
this.logger.logEvent(e);
|
|
56
63
|
}
|
|
57
|
-
setUser(user, callback) {
|
|
58
|
-
this.logEvent({ message: "setUser()", user });
|
|
59
|
-
if (user)
|
|
60
|
-
this.settings.user = user;
|
|
61
|
-
var cb = callback || nop;
|
|
62
|
-
cb(200, user);
|
|
63
|
-
}
|
|
64
|
-
getUserWeight() {
|
|
65
|
-
if (this.settings && this.settings.user && this.settings.user.weight)
|
|
66
|
-
return (0, utils_1.getWeight)(this.settings.user.weight);
|
|
67
|
-
else
|
|
68
|
-
return (0, utils_1.getWeight)();
|
|
69
|
-
}
|
|
70
|
-
getBikeWeight() {
|
|
71
|
-
if (this.settings && this.settings.weight) {
|
|
72
|
-
let m = this.settings.weight;
|
|
73
|
-
if (m > 0 && m < 20)
|
|
74
|
-
return m;
|
|
75
|
-
}
|
|
76
|
-
return 10;
|
|
77
|
-
}
|
|
78
64
|
connect() {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
if (this.connected)
|
|
84
|
-
return;
|
|
85
|
-
try {
|
|
86
|
-
if (this.sp === undefined) {
|
|
87
|
-
const settings = this.settings.port || {};
|
|
88
|
-
settings.autoOpen = false;
|
|
89
|
-
this.sp = new __SerialPort(this.portName, settings);
|
|
90
|
-
this.sp.on('open', () => { this.onPortOpen(); });
|
|
91
|
-
this.sp.on('close', () => { this.onPortClose(); });
|
|
92
|
-
this.sp.on('error', (error) => { this.onPortError(error); });
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
if (this.isConnected() && this.sp) {
|
|
67
|
+
return true;
|
|
93
68
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
saveConnect() {
|
|
104
|
-
return new Promise((resolve, reject) => {
|
|
105
|
-
if (this.isConnected()) {
|
|
106
|
-
this.opening = false;
|
|
107
|
-
return resolve(true);
|
|
108
|
-
}
|
|
109
|
-
this.connect();
|
|
110
|
-
const timeoutStart = this.settings.timeoutStart || TIMEOUT_START;
|
|
111
|
-
const tTimeout = Date.now() + timeoutStart;
|
|
112
|
-
const iv = setInterval(() => {
|
|
113
|
-
if (this.isConnected()) {
|
|
114
|
-
clearInterval(iv);
|
|
115
|
-
this.opening = false;
|
|
116
|
-
resolve(true);
|
|
69
|
+
try {
|
|
70
|
+
const port = yield this.serial.openPort(this.portName);
|
|
71
|
+
if (port !== null) {
|
|
72
|
+
this.connected = true;
|
|
73
|
+
this.sp = port;
|
|
74
|
+
this.sp.on('close', this.onPortClose.bind(this));
|
|
75
|
+
this.sp.on('error', (error) => { this.onPortError(error); });
|
|
76
|
+
return true;
|
|
117
77
|
}
|
|
118
78
|
else {
|
|
119
|
-
|
|
120
|
-
clearInterval(iv);
|
|
121
|
-
this.cmdBusy = false;
|
|
122
|
-
reject(this.error);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
if (Date.now() > tTimeout) {
|
|
126
|
-
clearInterval(iv);
|
|
127
|
-
this.opening = false;
|
|
128
|
-
this.cmdBusy = false;
|
|
129
|
-
reject(new Error('timeout'));
|
|
130
|
-
}
|
|
79
|
+
return false;
|
|
131
80
|
}
|
|
132
|
-
}
|
|
81
|
+
}
|
|
82
|
+
catch (_a) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
133
85
|
});
|
|
134
86
|
}
|
|
135
87
|
close() {
|
|
136
|
-
this
|
|
137
|
-
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
if (!this.serial)
|
|
90
|
+
return;
|
|
91
|
+
this.stopWorker();
|
|
92
|
+
yield this.flush();
|
|
93
|
+
yield this.serial.closePort(this.portName);
|
|
94
|
+
this.connected = false;
|
|
95
|
+
if (this.sp)
|
|
96
|
+
this.sp.removeAllListeners();
|
|
97
|
+
this.sp = null;
|
|
98
|
+
this.error = undefined;
|
|
99
|
+
this.closing = false;
|
|
100
|
+
this.closed = true;
|
|
101
|
+
this.cmdBusy = false;
|
|
138
102
|
return;
|
|
139
|
-
}
|
|
140
|
-
var serialPort = this.sp;
|
|
141
|
-
this.closing = true;
|
|
142
|
-
this.stopWorker();
|
|
143
|
-
let connected = this.connected;
|
|
144
|
-
if (connected) {
|
|
145
|
-
if (serialPort) {
|
|
146
|
-
serialPort.unpipe();
|
|
147
|
-
serialPort.flush();
|
|
148
|
-
if (this.cmdBusy) {
|
|
149
|
-
serialPort.drain(() => {
|
|
150
|
-
serialPort.close();
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
serialPort.close();
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
if (serialPort) {
|
|
160
|
-
serialPort.close();
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
this.cmdBusy = false;
|
|
103
|
+
});
|
|
164
104
|
}
|
|
165
|
-
|
|
166
|
-
return
|
|
167
|
-
this.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
resolve(true);
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
if (Date.now() > tTimeout) {
|
|
105
|
+
flush() {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
if (!this.cmdBusy)
|
|
108
|
+
return;
|
|
109
|
+
return new Promise(done => {
|
|
110
|
+
const iv = setInterval(() => {
|
|
111
|
+
if (!this.cmdBusy) {
|
|
176
112
|
clearInterval(iv);
|
|
177
|
-
|
|
178
|
-
reject(new Error('timeout'));
|
|
113
|
+
done();
|
|
179
114
|
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
115
|
+
}, 100);
|
|
116
|
+
});
|
|
182
117
|
});
|
|
183
118
|
}
|
|
184
|
-
onPortOpen() {
|
|
185
|
-
this.logEvent({ message: "port opened", port: this.getPort() });
|
|
186
|
-
this.error = undefined;
|
|
187
|
-
this.connected = true;
|
|
188
|
-
this.opening = false;
|
|
189
|
-
this.closed = false;
|
|
190
|
-
if (this.cmdStart !== undefined) {
|
|
191
|
-
this.cmdStart = Date.now();
|
|
192
|
-
}
|
|
193
|
-
this.cmdBusy = false;
|
|
194
|
-
}
|
|
195
119
|
onPortClose() {
|
|
196
|
-
this
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
this.closed = true;
|
|
201
|
-
this.cmdBusy = false;
|
|
202
|
-
if (this.queue !== undefined)
|
|
203
|
-
this.queue.clear();
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
this.logEvent({ message: "port closed", port: this.getPort() });
|
|
122
|
+
yield this.close();
|
|
123
|
+
});
|
|
204
124
|
}
|
|
205
125
|
onPortError(err) {
|
|
206
126
|
if (this.closed && !this.opening)
|
|
207
127
|
return;
|
|
208
128
|
if ((this.closing || this.closed) && (err.message === 'Port is not open' || err.message === 'Writing to COM port (GetOverlappedResult): Operation aborted'))
|
|
209
129
|
return;
|
|
210
|
-
if (this.opening && (err.message === 'Port is already open' || err.message === 'Port is opening'))
|
|
211
|
-
return;
|
|
212
130
|
const state = { opening: this.opening, connected: this.connected, closing: this.closing, closed: this.closed, busy: this.cmdBusy };
|
|
213
131
|
this.logEvent({ message: "port error:", port: this.getPort(), error: err.message, stack: err.stack, state });
|
|
214
132
|
this.error = err;
|
|
@@ -227,8 +145,6 @@ class Daum8008 {
|
|
|
227
145
|
clearInterval(this.bikeCmdWorker);
|
|
228
146
|
this.bikeCmdWorker = undefined;
|
|
229
147
|
}
|
|
230
|
-
if (this.queue !== undefined)
|
|
231
|
-
this.queue.clear();
|
|
232
148
|
}
|
|
233
149
|
sendDaum8008CommandfromQueue() {
|
|
234
150
|
if (!this.connected || this.closing || !this.sp)
|
|
@@ -254,7 +170,7 @@ class Daum8008 {
|
|
|
254
170
|
if (this.connected && this.cmdBusy) {
|
|
255
171
|
if (this.cmdCurrent !== undefined && this.cmdCurrent.start !== undefined) {
|
|
256
172
|
const cmdInfo = this.cmdCurrent;
|
|
257
|
-
const timeout = (cmdInfo.options && cmdInfo.options.timeout) ? cmdInfo.options.timeout :
|
|
173
|
+
const timeout = (cmdInfo.options && cmdInfo.options.timeout) ? cmdInfo.options.timeout : this._timeoutSend;
|
|
258
174
|
let d = Date.now() - cmdInfo.start;
|
|
259
175
|
if (d > timeout) {
|
|
260
176
|
this.logEvent({ message: 'sendCommmand:timeout', port: this.getPort() });
|
|
@@ -384,9 +300,9 @@ class Daum8008 {
|
|
|
384
300
|
const age = user.age !== undefined ? user.age : utils_1.DEFAULT_AGE;
|
|
385
301
|
const gender = (0, utils_1.getGender)(user.sex);
|
|
386
302
|
const length = (0, utils_1.getLength)(user.length);
|
|
387
|
-
const maxPower =
|
|
388
|
-
const mUser = user.weight
|
|
389
|
-
const weight = (0, utils_1.getWeight)(mUser) +
|
|
303
|
+
const maxPower = 800;
|
|
304
|
+
const mUser = user.weight;
|
|
305
|
+
const weight = (0, utils_1.getWeight)(mUser) + 10;
|
|
390
306
|
var cmd = [0x24, bikeNo, 0];
|
|
391
307
|
cmd.push(age);
|
|
392
308
|
cmd.push(gender);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { MockBindingInterface, MockPortBinding, CreatePortOptions } from '@serialport/binding-mock';
|
|
3
|
+
import { BindingInterface } from '@serialport/bindings-interface';
|
|
4
|
+
export type MockProps = {
|
|
5
|
+
interface: string;
|
|
6
|
+
path: string;
|
|
7
|
+
};
|
|
8
|
+
export interface DaumClassicMockBindingInterface extends BindingInterface<DaumClassicMockBinding> {
|
|
9
|
+
reset(): void;
|
|
10
|
+
createPort(path: string, opt?: CreatePortOptions): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const DaumClassicMock: MockBindingInterface;
|
|
13
|
+
export declare class DaumClassicMockImpl {
|
|
14
|
+
static _instance: DaumClassicMockImpl;
|
|
15
|
+
static getInstance(): DaumClassicMockImpl;
|
|
16
|
+
static reset(): void;
|
|
17
|
+
simulators: Map<string, DaumClassicSimulator>;
|
|
18
|
+
ports: {
|
|
19
|
+
path: string;
|
|
20
|
+
binding: DaumClassicMockBinding;
|
|
21
|
+
}[];
|
|
22
|
+
constructor();
|
|
23
|
+
setSimulator(path: string, simulator: DaumClassicSimulator): void;
|
|
24
|
+
getSimulator(path: any): DaumClassicSimulator;
|
|
25
|
+
reset(): void;
|
|
26
|
+
createPort(path: string, options?: CreatePortOptions): void;
|
|
27
|
+
list(): Promise<import("@serialport/bindings-interface").PortInfo[]>;
|
|
28
|
+
open(options: any): Promise<DaumClassicMockBinding>;
|
|
29
|
+
}
|
|
30
|
+
export type DaumClassicUser = {
|
|
31
|
+
weight: number;
|
|
32
|
+
length?: number;
|
|
33
|
+
age?: number;
|
|
34
|
+
sex?: number;
|
|
35
|
+
personNo?: number;
|
|
36
|
+
pctFat?: number;
|
|
37
|
+
coachingLevel?: number;
|
|
38
|
+
coachingFrequency?: number;
|
|
39
|
+
powerLimit?: number;
|
|
40
|
+
hrLimit?: number;
|
|
41
|
+
timeLimit?: number;
|
|
42
|
+
distLimit?: number;
|
|
43
|
+
kcalLimit?: number;
|
|
44
|
+
};
|
|
45
|
+
interface BikeData {
|
|
46
|
+
cockpitVersion: number;
|
|
47
|
+
isPedalling: boolean;
|
|
48
|
+
bikeType: number;
|
|
49
|
+
person: DaumClassicUser;
|
|
50
|
+
}
|
|
51
|
+
export declare class DaumClassicSimulator {
|
|
52
|
+
selectedBike: number;
|
|
53
|
+
bikes: BikeData[];
|
|
54
|
+
cadence: number;
|
|
55
|
+
gear: number;
|
|
56
|
+
slope: number;
|
|
57
|
+
progNo: number;
|
|
58
|
+
heartrate: number;
|
|
59
|
+
distance: number;
|
|
60
|
+
isPowerMode: boolean;
|
|
61
|
+
targetPower: number;
|
|
62
|
+
currentPower: number;
|
|
63
|
+
_timeoutResponse: number;
|
|
64
|
+
_simulateNoReponseCnt: number;
|
|
65
|
+
_simulateIllegalResponseCnt: number;
|
|
66
|
+
constructor();
|
|
67
|
+
reset(): void;
|
|
68
|
+
simulateTimeout(ms: number): void;
|
|
69
|
+
simulateNoResponse(cnt?: number): void;
|
|
70
|
+
simulateIllegalResponse(cnt?: number): void;
|
|
71
|
+
isPedalling(): 0 | 1;
|
|
72
|
+
}
|
|
73
|
+
export declare class DaumClassicMockBinding extends MockPortBinding {
|
|
74
|
+
prevCommand: Buffer;
|
|
75
|
+
simulator: DaumClassicSimulator;
|
|
76
|
+
handlers: Map<number, (payload: Buffer) => void>;
|
|
77
|
+
constructor(parent: MockPortBinding);
|
|
78
|
+
getPath(): string;
|
|
79
|
+
initHandlers(): void;
|
|
80
|
+
write(buffer: Buffer): Promise<void>;
|
|
81
|
+
emitData(data: string | Buffer): void;
|
|
82
|
+
onCheckCockpit(payload: Buffer): void;
|
|
83
|
+
onGetAddress(_payload: Buffer): void;
|
|
84
|
+
onGetVersion(payload: Buffer): void;
|
|
85
|
+
onResetDevice(payload: Buffer): void;
|
|
86
|
+
onStartProg(payload: Buffer): void;
|
|
87
|
+
onStopProg(payload: Buffer): void;
|
|
88
|
+
onSetProg(payload: Buffer): void;
|
|
89
|
+
onSetBikeType(payload: Buffer): void;
|
|
90
|
+
onSetPerson(payload: Buffer): void;
|
|
91
|
+
onRunData(payload: Buffer): void;
|
|
92
|
+
onSetGear(payload: Buffer): void;
|
|
93
|
+
onSetPower(payload: Buffer): void;
|
|
94
|
+
onSetSlope(payload: Buffer): void;
|
|
95
|
+
}
|
|
96
|
+
export {};
|