incyclist-devices 2.0.36 → 2.0.38
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.js
CHANGED
|
@@ -203,8 +203,11 @@ class AntAdapter extends adpater_1.default {
|
|
|
203
203
|
}
|
|
204
204
|
start(props = {}) {
|
|
205
205
|
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
-
if (this.started && !this.stopped)
|
|
206
|
+
if (this.started && !this.stopped) {
|
|
207
|
+
if (this.paused)
|
|
208
|
+
this.resume();
|
|
207
209
|
return true;
|
|
210
|
+
}
|
|
208
211
|
this.stopped = false;
|
|
209
212
|
const connected = yield this.connect();
|
|
210
213
|
if (!connected)
|
|
@@ -212,6 +215,7 @@ class AntAdapter extends adpater_1.default {
|
|
|
212
215
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
213
216
|
this.resetData();
|
|
214
217
|
this.stopped = false;
|
|
218
|
+
this.resume();
|
|
215
219
|
const { startupTimeout = 20000 } = props;
|
|
216
220
|
let to = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
217
221
|
try {
|
package/lib/ble/base/adapter.js
CHANGED
|
@@ -168,10 +168,9 @@ class BleAdapter extends adpater_1.default {
|
|
|
168
168
|
const wasStopped = this.stopped;
|
|
169
169
|
if (wasPaused)
|
|
170
170
|
this.resume();
|
|
171
|
-
if (wasStopped)
|
|
172
|
-
this.stopped = false;
|
|
173
|
-
if (this.started && !wasPaused && !wasStopped)
|
|
171
|
+
if (this.started && !wasStopped)
|
|
174
172
|
return true;
|
|
173
|
+
this.stopped = false;
|
|
175
174
|
const connected = yield this.connect();
|
|
176
175
|
if (!connected)
|
|
177
176
|
throw new Error(`could not start device, reason:could not connect`);
|
|
@@ -169,7 +169,7 @@ class Daum8i extends comms_1.default {
|
|
|
169
169
|
do {
|
|
170
170
|
response = yield this.waitForResponse();
|
|
171
171
|
if (response.type === 'Response') {
|
|
172
|
-
this.logEvent(Object.assign(Object.assign({ message: `sendCommand:received:` }, logPayload), { response: request.isBinary ? Buffer.from(response.data).toString('hex') : response.data }));
|
|
172
|
+
this.logEvent(Object.assign(Object.assign({ message: `sendCommand:received:` }, logPayload), { response: request.isBinary ? Buffer.from(response.data).toString('hex') : (0, utils_1.responseLog)(response.data) }));
|
|
173
173
|
yield this.sendACK(logPayload);
|
|
174
174
|
this.sendCmdPromise = null;
|
|
175
175
|
return resolve(response);
|
|
@@ -6,6 +6,7 @@ export declare const DEBUG_LOGGER: {
|
|
|
6
6
|
log: (e: any, ...args: any[]) => void;
|
|
7
7
|
logEvent: (event: any) => void;
|
|
8
8
|
};
|
|
9
|
+
export declare function responseLog(str: string): string;
|
|
9
10
|
export declare const validateHost: (host: string) => string;
|
|
10
11
|
export declare const validatePath: (path: string) => string;
|
|
11
12
|
export declare function bin2esc(arr: Uint8Array): Uint8Array;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parsePersonData = exports.getPersonData = exports.parseTrainingData = exports.routeToEpp = exports.FileTimeSupport = exports.getBikeType = exports.BikeType = exports.ReservedCommands = exports.getAsciiArrayFromStr = exports.ascii = exports.hexstr = exports.getMessageData = exports.buildMessage = exports.checkSum = exports.esc2bin = exports.bin2esc = exports.validatePath = exports.validateHost = exports.DEBUG_LOGGER = void 0;
|
|
6
|
+
exports.parsePersonData = exports.getPersonData = exports.parseTrainingData = exports.routeToEpp = exports.FileTimeSupport = exports.getBikeType = exports.BikeType = exports.ReservedCommands = exports.getAsciiArrayFromStr = exports.ascii = exports.hexstr = exports.getMessageData = exports.buildMessage = exports.checkSum = exports.esc2bin = exports.bin2esc = exports.validatePath = exports.validateHost = exports.responseLog = exports.DEBUG_LOGGER = void 0;
|
|
7
7
|
const user_1 = require("../../../types/user");
|
|
8
8
|
const win32filetime_1 = __importDefault(require("win32filetime"));
|
|
9
9
|
const sum = (arr) => arr.reduce((a, b) => a + b, 0);
|
|
@@ -11,6 +11,15 @@ exports.DEBUG_LOGGER = {
|
|
|
11
11
|
log: (e, ...args) => console.log(e, ...args),
|
|
12
12
|
logEvent: (event) => console.log(JSON.stringify(event))
|
|
13
13
|
};
|
|
14
|
+
const GS = 0x1D;
|
|
15
|
+
const GS_CHAR = String.fromCharCode(GS);
|
|
16
|
+
function responseLog(str) {
|
|
17
|
+
if (str.includes(GS_CHAR)) {
|
|
18
|
+
return str.split(GS_CHAR).join('/');
|
|
19
|
+
}
|
|
20
|
+
return str;
|
|
21
|
+
}
|
|
22
|
+
exports.responseLog = responseLog;
|
|
14
23
|
const validateHost = (host) => {
|
|
15
24
|
const ipParts = host.split('.');
|
|
16
25
|
if (ipParts.length > 1)
|
|
@@ -269,7 +278,6 @@ function routeToEpp(route, date) {
|
|
|
269
278
|
}
|
|
270
279
|
exports.routeToEpp = routeToEpp;
|
|
271
280
|
function parseTrainingData(payload) {
|
|
272
|
-
const GS = 0x1D;
|
|
273
281
|
const gearVal = (v) => v > 0 ? v - 1 : undefined;
|
|
274
282
|
const vals = payload.split(String.fromCharCode(GS));
|
|
275
283
|
const data = {
|