incyclist-devices 2.0.36 → 2.0.37

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.
@@ -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 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "2.0.36",
3
+ "version": "2.0.37",
4
4
  "dependencies": {
5
5
  "@serialport/bindings-interface": "^1.2.2",
6
6
  "@serialport/parser-byte-length": "^9.0.1",