incyclist-devices 1.5.32 → 1.5.33

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.
@@ -118,6 +118,7 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
118
118
  try {
119
119
  if (isRelaunch) {
120
120
  yield this.stop();
121
+ this.bike.connected = true;
121
122
  }
122
123
  yield this.performStart(props, isRelaunch);
123
124
  if (!isRelaunch) {
@@ -128,9 +129,7 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
128
129
  }
129
130
  catch (_a) { }
130
131
  }
131
- this.stopped = false;
132
- this.paused = false;
133
- this.startUpdatePull();
132
+ this.logger.logEvent({ message: 'start result: success', udid: this.udid });
134
133
  return true;
135
134
  }
136
135
  catch (err) {
@@ -0,0 +1,20 @@
1
+ /// <reference types="node" />
2
+ import { BindingPortInterface, OpenOptions, PortStatus, SetOptions, UpdateOptions } from "@serialport/bindings-interface";
3
+ export declare class TCPPortBinding implements BindingPortInterface {
4
+ openOptions: Required<OpenOptions>;
5
+ isOpen: boolean;
6
+ close(): Promise<void>;
7
+ read(buffer: Buffer, offset: number, length: number): Promise<{
8
+ buffer: Buffer;
9
+ bytesRead: number;
10
+ }>;
11
+ write(buffer: Buffer): Promise<void>;
12
+ update(options: UpdateOptions): Promise<void>;
13
+ set(options: SetOptions): Promise<void>;
14
+ get(): Promise<PortStatus>;
15
+ getBaudRate(): Promise<{
16
+ baudRate: number;
17
+ }>;
18
+ flush(): Promise<void>;
19
+ drain(): Promise<void>;
20
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TCPPortBinding = void 0;
4
+ class TCPPortBinding {
5
+ close() {
6
+ throw new Error("Method not implemented.");
7
+ }
8
+ read(buffer, offset, length) {
9
+ throw new Error("Method not implemented.");
10
+ }
11
+ write(buffer) {
12
+ throw new Error("Method not implemented.");
13
+ }
14
+ update(options) {
15
+ throw new Error("Method not implemented.");
16
+ }
17
+ set(options) {
18
+ throw new Error("Method not implemented.");
19
+ }
20
+ get() {
21
+ throw new Error("Method not implemented.");
22
+ }
23
+ getBaudRate() {
24
+ throw new Error("Method not implemented.");
25
+ }
26
+ flush() {
27
+ throw new Error("Method not implemented.");
28
+ }
29
+ drain() {
30
+ throw new Error("Method not implemented.");
31
+ }
32
+ }
33
+ exports.TCPPortBinding = TCPPortBinding;
@@ -0,0 +1,2 @@
1
+ import SerialPortProvider, { useSerialPortProvider } from './serialport';
2
+ export { SerialPortProvider, useSerialPortProvider };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.useSerialPortProvider = exports.SerialPortProvider = void 0;
27
+ const serialport_1 = __importStar(require("./serialport"));
28
+ exports.SerialPortProvider = serialport_1.default;
29
+ Object.defineProperty(exports, "useSerialPortProvider", { enumerable: true, get: function () { return serialport_1.useSerialPortProvider; } });
@@ -0,0 +1,29 @@
1
+ import { BindingInterface } from '@serialport/bindings-interface';
2
+ export type InterfaceBinding = {
3
+ name: string;
4
+ binding: BindingInterface;
5
+ };
6
+ export type InterfaceImplementation = {
7
+ name: string;
8
+ Serialport: any;
9
+ implementation?: any;
10
+ };
11
+ export type SerialPortProps = {
12
+ interface: string;
13
+ port?: string;
14
+ };
15
+ export default class SerialPortProvider {
16
+ static _instance: SerialPortProvider;
17
+ interfaces: InterfaceBinding[];
18
+ implemenations: InterfaceImplementation[];
19
+ static getInstance(): SerialPortProvider;
20
+ constructor();
21
+ setBinding(ifaceName: string, binding: BindingInterface): void;
22
+ getBinding(ifaceName: string): BindingInterface;
23
+ getSerialPort(ifaceName: string, props: any): any;
24
+ list(ifaceName: string): Promise<any>;
25
+ setLegacyClass(ifaceName: string, Serialport: any): void;
26
+ getLegacyInfo(ifaceName: string): InterfaceImplementation;
27
+ getLegacyClass(ifaceName: string): any;
28
+ }
29
+ export declare const useSerialPortProvider: () => SerialPortProvider;
@@ -0,0 +1,87 @@
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
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.useSerialPortProvider = void 0;
13
+ const { SerialPortStream } = require('@serialport/stream');
14
+ const DEFAULT_BAUD_RATE = 9600;
15
+ class SerialPortProvider {
16
+ static getInstance() {
17
+ if (!SerialPortProvider._instance)
18
+ SerialPortProvider._instance = new SerialPortProvider();
19
+ return SerialPortProvider._instance;
20
+ }
21
+ constructor() {
22
+ this.interfaces = [];
23
+ this.implemenations = [];
24
+ }
25
+ setBinding(ifaceName, binding) {
26
+ const existing = this.interfaces.find(ib => ib.name === ifaceName);
27
+ if (existing)
28
+ existing.binding = binding;
29
+ else
30
+ this.interfaces.push({ name: ifaceName, binding });
31
+ }
32
+ getBinding(ifaceName) {
33
+ const existing = this.interfaces.find(ib => ib.name === ifaceName);
34
+ if (existing)
35
+ return existing.binding;
36
+ }
37
+ getSerialPort(ifaceName, props) {
38
+ const binding = this.getBinding(ifaceName);
39
+ if (binding) {
40
+ props.binding = binding;
41
+ if (props.autoOpen === undefined)
42
+ props.autoOpen = false;
43
+ if (!props.baudRate)
44
+ props.baudRate = DEFAULT_BAUD_RATE;
45
+ return new SerialPortStream(props);
46
+ }
47
+ const legacy = this.getLegacyInfo(ifaceName);
48
+ if (legacy && legacy.Serialport) {
49
+ const portName = props.path;
50
+ if (props.autoOpen === undefined)
51
+ props.autoOpen = false;
52
+ const settings = Object.assign({}, props);
53
+ delete settings.path;
54
+ return new legacy.Serialport(portName, settings);
55
+ }
56
+ }
57
+ list(ifaceName) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const Binding = this.getBinding(ifaceName);
60
+ if (Binding)
61
+ return yield Binding.list();
62
+ const legacy = this.getLegacyInfo(ifaceName);
63
+ if (legacy && legacy.Serialport && legacy.Serialport.list) {
64
+ return yield legacy.Serialport.list();
65
+ }
66
+ return [];
67
+ });
68
+ }
69
+ setLegacyClass(ifaceName, Serialport) {
70
+ const existing = this.getLegacyInfo(ifaceName);
71
+ if (existing)
72
+ existing.Serialport = Serialport;
73
+ else
74
+ this.implemenations.push({ name: ifaceName, Serialport });
75
+ }
76
+ getLegacyInfo(ifaceName) {
77
+ return this.implemenations.find(ib => ib.name === ifaceName);
78
+ }
79
+ getLegacyClass(ifaceName) {
80
+ const existing = this.implemenations.find(ib => ib.name === ifaceName);
81
+ if (existing)
82
+ return existing.Serialport;
83
+ }
84
+ }
85
+ exports.default = SerialPortProvider;
86
+ const useSerialPortProvider = () => SerialPortProvider.getInstance();
87
+ exports.useSerialPortProvider = useSerialPortProvider;
@@ -0,0 +1,29 @@
1
+ import { BindingInterface } from '@serialport/bindings-interface';
2
+ export type InterfaceBinding = {
3
+ name: string;
4
+ binding: BindingInterface;
5
+ };
6
+ export type InterfaceImplementation = {
7
+ name: string;
8
+ Serialport: any;
9
+ implementation?: any;
10
+ };
11
+ export type SerialPortProps = {
12
+ interface: string;
13
+ port?: string;
14
+ };
15
+ export default class SerialPortProvider {
16
+ static _instance: SerialPortProvider;
17
+ interfaces: InterfaceBinding[];
18
+ implemenations: InterfaceImplementation[];
19
+ static getInstance(): SerialPortProvider;
20
+ constructor();
21
+ setBinding(ifaceName: string, binding: BindingInterface): void;
22
+ getBinding(ifaceName: string): BindingInterface;
23
+ getSerialPort(ifaceName: string, props: any): any;
24
+ list(ifaceName: string): Promise<any>;
25
+ setLegacyClass(ifaceName: string, Serialport: any): void;
26
+ getLegacyInfo(ifaceName: string): InterfaceImplementation;
27
+ getLegacyClass(ifaceName: string): any;
28
+ }
29
+ export declare const useSerialPortProvider: () => SerialPortProvider;
@@ -0,0 +1,87 @@
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
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.useSerialPortProvider = void 0;
13
+ const { SerialPortStream } = require('@serialport/stream');
14
+ const DEFAULT_BAUD_RATE = 9600;
15
+ class SerialPortProvider {
16
+ static getInstance() {
17
+ if (!SerialPortProvider._instance)
18
+ SerialPortProvider._instance = new SerialPortProvider();
19
+ return SerialPortProvider._instance;
20
+ }
21
+ constructor() {
22
+ this.interfaces = [];
23
+ this.implemenations = [];
24
+ }
25
+ setBinding(ifaceName, binding) {
26
+ const existing = this.interfaces.find(ib => ib.name === ifaceName);
27
+ if (existing)
28
+ existing.binding = binding;
29
+ else
30
+ this.interfaces.push({ name: ifaceName, binding });
31
+ }
32
+ getBinding(ifaceName) {
33
+ const existing = this.interfaces.find(ib => ib.name === ifaceName);
34
+ if (existing)
35
+ return existing.binding;
36
+ }
37
+ getSerialPort(ifaceName, props) {
38
+ const binding = this.getBinding(ifaceName);
39
+ if (binding) {
40
+ props.binding = binding;
41
+ if (props.autoOpen === undefined)
42
+ props.autoOpen = false;
43
+ if (!props.baudRate)
44
+ props.baudRate = DEFAULT_BAUD_RATE;
45
+ return new SerialPortStream(props);
46
+ }
47
+ const legacy = this.getLegacyInfo(ifaceName);
48
+ if (legacy && legacy.Serialport) {
49
+ const portName = props.path;
50
+ if (props.autoOpen === undefined)
51
+ props.autoOpen = false;
52
+ const settings = Object.assign({}, props);
53
+ delete settings.path;
54
+ return new legacy.Serialport(portName, settings);
55
+ }
56
+ }
57
+ list(ifaceName) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const Binding = this.getBinding(ifaceName);
60
+ if (Binding)
61
+ return yield Binding.list();
62
+ const legacy = this.getLegacyInfo(ifaceName);
63
+ if (legacy && legacy.Serialport && legacy.Serialport.list) {
64
+ return yield legacy.Serialport.list();
65
+ }
66
+ return [];
67
+ });
68
+ }
69
+ setLegacyClass(ifaceName, Serialport) {
70
+ const existing = this.getLegacyInfo(ifaceName);
71
+ if (existing)
72
+ existing.Serialport = Serialport;
73
+ else
74
+ this.implemenations.push({ name: ifaceName, Serialport });
75
+ }
76
+ getLegacyInfo(ifaceName) {
77
+ return this.implemenations.find(ib => ib.name === ifaceName);
78
+ }
79
+ getLegacyClass(ifaceName) {
80
+ const existing = this.implemenations.find(ib => ib.name === ifaceName);
81
+ if (existing)
82
+ return existing.Serialport;
83
+ }
84
+ }
85
+ exports.default = SerialPortProvider;
86
+ const useSerialPortProvider = () => SerialPortProvider.getInstance();
87
+ exports.useSerialPortProvider = useSerialPortProvider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "1.5.32",
3
+ "version": "1.5.33",
4
4
  "dependencies": {
5
5
  "@serialport/parser-byte-length": "^9.0.1",
6
6
  "@serialport/parser-delimiter": "^9.0.1",