incyclist-devices 2.0.28 → 2.0.29
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/lib/antv2/adapter.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export default class AntAdapter<TDeviceData extends BaseDeviceData, TData> exten
|
|
|
33
33
|
protected dataMsgCount: number;
|
|
34
34
|
protected ivWaitForData: NodeJS.Timeout;
|
|
35
35
|
constructor(settings: AntDeviceSettings, props?: DeviceProperties);
|
|
36
|
+
logEvent(event: any): void;
|
|
36
37
|
createSensor(settings: AntDeviceSettings): ISensor;
|
|
37
38
|
isEqual(settings: AntDeviceSettings): boolean;
|
|
38
39
|
connect(): Promise<boolean>;
|
package/lib/antv2/adapter.js
CHANGED
|
@@ -63,6 +63,16 @@ class AntAdapter extends adpater_1.default {
|
|
|
63
63
|
this.channel = undefined;
|
|
64
64
|
this.ant = ant_interface_1.default.getInstance();
|
|
65
65
|
}
|
|
66
|
+
logEvent(event) {
|
|
67
|
+
if (!this.logger || this.paused)
|
|
68
|
+
return;
|
|
69
|
+
this.logger.logEvent(event);
|
|
70
|
+
const w = global.window;
|
|
71
|
+
if ((w === null || w === void 0 ? void 0 : w.DEVICE_DEBUG) || process.env.BLE_DEBUG || process.env.ANT_DEBUG) {
|
|
72
|
+
const logText = '~~~ ANT:' + this.logger.getName();
|
|
73
|
+
console.log(logText, event);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
66
76
|
createSensor(settings) {
|
|
67
77
|
throw new Error('Method not implemented.');
|
|
68
78
|
}
|
package/lib/antv2/fe/adapter.js
CHANGED
|
@@ -90,7 +90,7 @@ class AntFEAdapter extends adapter_1.ControllableAntAdapter {
|
|
|
90
90
|
const update = isReset ? this.getCyclingMode().getBikeInitRequest() : this.getCyclingMode().sendBikeUpdate(request);
|
|
91
91
|
if (!update)
|
|
92
92
|
return;
|
|
93
|
-
this.
|
|
93
|
+
this.logEvent({ message: 'send bike update requested', update, request });
|
|
94
94
|
try {
|
|
95
95
|
const fe = this.sensor;
|
|
96
96
|
if (update.slope !== undefined) {
|
|
@@ -107,7 +107,7 @@ class AntFEAdapter extends adapter_1.ControllableAntAdapter {
|
|
|
107
107
|
yield this.reconnect();
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
this.
|
|
110
|
+
this.logEvent({ message: 'sendBikeUpdate() error', error: err.message });
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
}
|
|
@@ -122,7 +122,7 @@ class AntFEAdapter extends adapter_1.ControllableAntAdapter {
|
|
|
122
122
|
}
|
|
123
123
|
try {
|
|
124
124
|
const logData = this.getLogData(deviceData, ['PairedDevices', 'RawData']);
|
|
125
|
-
this.
|
|
125
|
+
this.logEvent({ message: 'onDeviceData', data: logData, paused: this.paused });
|
|
126
126
|
if (!this.canSendUpdate())
|
|
127
127
|
return;
|
|
128
128
|
let incyclistData = this.mapToCycleModeData(deviceData);
|
|
@@ -131,7 +131,7 @@ class AntFEAdapter extends adapter_1.ControllableAntAdapter {
|
|
|
131
131
|
this.emitData(this.data);
|
|
132
132
|
}
|
|
133
133
|
catch (err) {
|
|
134
|
-
this.
|
|
134
|
+
this.logEvent({ message: 'error', fn: 'onDeviceData()', error: err.message || err, stack: err.stack });
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
canSendUpdate() {
|
|
@@ -274,7 +274,7 @@ class AntFEAdapter extends adapter_1.ControllableAntAdapter {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
catch (err) {
|
|
277
|
-
this.
|
|
277
|
+
this.logEvent({ message: 'sending FE message error', error: err.message });
|
|
278
278
|
this.started = false;
|
|
279
279
|
}
|
|
280
280
|
success = status.userSent && status.slopeSent;
|
|
@@ -318,18 +318,18 @@ class AntFEAdapter extends adapter_1.ControllableAntAdapter {
|
|
|
318
318
|
}
|
|
319
319
|
reconnect() {
|
|
320
320
|
return __awaiter(this, void 0, void 0, function* () {
|
|
321
|
-
this.
|
|
321
|
+
this.logEvent({ message: 'reconnect to device' });
|
|
322
322
|
this.isReconnecting = true;
|
|
323
323
|
try {
|
|
324
324
|
yield this.stop();
|
|
325
325
|
yield this.start(this.startProps);
|
|
326
326
|
this.started = true;
|
|
327
327
|
this.isReconnecting = false;
|
|
328
|
-
this.
|
|
328
|
+
this.logEvent({ message: 'reconnect success' });
|
|
329
329
|
return true;
|
|
330
330
|
}
|
|
331
331
|
catch (err) {
|
|
332
|
-
this.
|
|
332
|
+
this.logEvent({ message: 'reconnect failed' });
|
|
333
333
|
this.isReconnecting = false;
|
|
334
334
|
return false;
|
|
335
335
|
}
|
package/lib/antv2/hr/adapter.js
CHANGED
package/lib/base/adpater.js
CHANGED
|
@@ -67,7 +67,7 @@ class IncyclistDevice extends events_1.default {
|
|
|
67
67
|
this.logger.logEvent(event);
|
|
68
68
|
const w = global.window;
|
|
69
69
|
if ((w === null || w === void 0 ? void 0 : w.DEVICE_DEBUG) || process.env.BLE_DEBUG || process.env.ANT_DEBUG) {
|
|
70
|
-
const logText = '~~~ ' + this.
|
|
70
|
+
const logText = '~~~ ' + this.logger.getName();
|
|
71
71
|
console.log(logText, event);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -148,7 +148,7 @@ class DaumAdapterBase extends adapter_1.SerialIncyclistDevice {
|
|
|
148
148
|
this.iv = undefined;
|
|
149
149
|
}
|
|
150
150
|
startUpdatePull() {
|
|
151
|
-
this.
|
|
151
|
+
this.logEvent({ message: 'start update pull', iv: this.iv, ignoreBike: this.ignoreBike, ignoreHrm: this.ignoreHrm, ignorePower: this.ignorePower });
|
|
152
152
|
if (this.iv)
|
|
153
153
|
return;
|
|
154
154
|
if (this.ignoreBike && this.ignoreHrm && this.ignorePower)
|