incyclist-devices 2.1.32 → 2.1.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.
- package/lib/serial/daum/DaumAdapter.d.ts +1 -0
- package/lib/serial/daum/DaumAdapter.js +8 -1
- package/lib/serial/daum/classic/adapter.js +19 -4
- package/lib/serial/daum/premium/adapter.d.ts +1 -1
- package/lib/serial/daum/premium/adapter.js +24 -8
- package/package.json +1 -1
- package/lib/adapters.d.ts +0 -7
- package/lib/adapters.js +0 -49
- package/lib/antv2/adapter-factory.d.ts +0 -14
- package/lib/antv2/adapter-factory.js +0 -65
- package/lib/antv2/adapter.d.ts +0 -54
- package/lib/antv2/adapter.js +0 -291
- package/lib/antv2/ant-interface.d.ts +0 -35
- package/lib/antv2/ant-interface.js +0 -285
- package/lib/antv2/base/ant-interface.d.ts +0 -35
- package/lib/antv2/base/ant-interface.js +0 -285
- package/lib/antv2/binding.d.ts +0 -13
- package/lib/antv2/binding.js +0 -27
- package/lib/antv2/hr copy/adapter.d.ts +0 -11
- package/lib/antv2/hr copy/adapter.js +0 -30
- package/lib/antv2/hr copy/index.d.ts +0 -2
- package/lib/antv2/hr copy/index.js +0 -7
- package/lib/antv2/sensor-factory.d.ts +0 -5
- package/lib/antv2/sensor-factory.js +0 -20
- package/lib/interfaces.d.ts +0 -7
- package/lib/interfaces.js +0 -27
- package/lib/serial/SinglePathScanner.d.ts +0 -17
- package/lib/serial/SinglePathScanner.js +0 -87
- package/lib/serial/adapter-factory.d.ts +0 -14
- package/lib/serial/adapter-factory.js +0 -30
- package/lib/serial/adapter.d.ts +0 -17
- package/lib/serial/adapter.js +0 -67
- package/lib/serial/comm.d.ts +0 -7
- package/lib/serial/comm.js +0 -2
- package/lib/serial/comms.d.ts +0 -62
- package/lib/serial/comms.js +0 -280
- package/lib/serial/daum/classic/PROTOCOL_NAME.d.ts +0 -2
- package/lib/serial/daum/classic/PROTOCOL_NAME.js +0 -5
- package/lib/serial/daum/consts.d.ts +0 -0
- package/lib/serial/daum/consts.js +0 -0
- package/lib/serial/serial-interface.d.ts +0 -36
- package/lib/serial/serial-interface.js +0 -288
- package/lib/serial/serial-scanner.d.ts +0 -16
- package/lib/serial/serial-scanner.js +0 -87
- package/lib/serial/serialport.d.ts +0 -17
- package/lib/serial/serialport.js +0 -87
- package/lib/types/Command.d.ts +0 -8
- package/lib/types/Command.js +0 -2
- package/lib/types/command.d.ts +0 -0
- package/lib/types/command.js +0 -0
- package/lib/types/route.d.ts +0 -0
- package/lib/types/route.js +0 -0
- package/lib/types/types.d.ts +0 -8
- package/lib/types/types.js +0 -2
|
@@ -1,87 +0,0 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.SinglePathScanner = void 0;
|
|
16
|
-
const gd_eventlog_1 = require("gd-eventlog");
|
|
17
|
-
const types_1 = require("./types");
|
|
18
|
-
const adapter_factory_1 = __importDefault(require("./factories/adapter-factory"));
|
|
19
|
-
const utils_1 = require("../utils/utils");
|
|
20
|
-
class SinglePathScanner {
|
|
21
|
-
constructor(path, serial, props) {
|
|
22
|
-
this.path = path;
|
|
23
|
-
this.serial = serial;
|
|
24
|
-
this.result = undefined;
|
|
25
|
-
this.isScanning = false;
|
|
26
|
-
this.isFound = false;
|
|
27
|
-
this.props = props;
|
|
28
|
-
this.logger = props.logger || new gd_eventlog_1.EventLogger('SerialScanner');
|
|
29
|
-
}
|
|
30
|
-
logEvent(event) {
|
|
31
|
-
if (this.logger) {
|
|
32
|
-
this.logger.logEvent(event);
|
|
33
|
-
}
|
|
34
|
-
const w = global.window;
|
|
35
|
-
if ((w === null || w === void 0 ? void 0 : w.DEVICE_DEBUG) || process.env.BLE_DEBUG) {
|
|
36
|
-
console.log('~~~ SerialScanner', event);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
onStopRequest(resolve) {
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
this.logEvent({ message: 'stopping scan', path: this.path });
|
|
42
|
-
if (!this.isFound)
|
|
43
|
-
yield this.serial.closePort(this.path);
|
|
44
|
-
this.isScanning = false;
|
|
45
|
-
resolve(this.result);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
scan() {
|
|
49
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
if (this.isScanning)
|
|
51
|
-
return;
|
|
52
|
-
this.isScanning = true;
|
|
53
|
-
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
this.logEvent({ message: 'starting scan', path: this.path, interface: this.serial.getName() });
|
|
55
|
-
this.serial.scanEvents.on('timeout', () => this.onStopRequest(resolve));
|
|
56
|
-
this.serial.scanEvents.on('stop', () => this.onStopRequest(resolve));
|
|
57
|
-
let found = false;
|
|
58
|
-
while (!found && this.isScanning) {
|
|
59
|
-
try {
|
|
60
|
-
const { protocol } = this.props;
|
|
61
|
-
let host, port;
|
|
62
|
-
if (this.serial.getName() === types_1.SerialInterfaceType.TCPIP) {
|
|
63
|
-
[host, port] = this.path.split(':');
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
port = this.path;
|
|
67
|
-
}
|
|
68
|
-
const adapterSettings = { interface: this.serial.getName(), host, port, protocol };
|
|
69
|
-
const adapter = adapter_factory_1.default.getInstance().createInstance(adapterSettings);
|
|
70
|
-
found = yield adapter.check();
|
|
71
|
-
if (found) {
|
|
72
|
-
this.isFound = true;
|
|
73
|
-
const name = adapter.getName();
|
|
74
|
-
resolve(Object.assign(Object.assign({}, adapterSettings), { name }));
|
|
75
|
-
}
|
|
76
|
-
yield (0, utils_1.sleep)(100);
|
|
77
|
-
}
|
|
78
|
-
catch (err) {
|
|
79
|
-
this.logEvent({ message: 'error', fn: 'scan()', error: err.message || err, stack: err.stack });
|
|
80
|
-
yield (0, utils_1.sleep)(100);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}));
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
exports.SinglePathScanner = SinglePathScanner;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { BindingInterface } from '@serialport/bindings-interface';
|
|
2
|
-
import { InterfaceBinding, InterfaceImplementation } from './types';
|
|
3
|
-
export default class SerialPortProvider {
|
|
4
|
-
static _instance: SerialPortProvider;
|
|
5
|
-
interfaces: InterfaceBinding[];
|
|
6
|
-
implemenations: InterfaceImplementation[];
|
|
7
|
-
static getInstance(): SerialPortProvider;
|
|
8
|
-
constructor();
|
|
9
|
-
setBinding(ifaceName: string, binding: BindingInterface): void;
|
|
10
|
-
getBinding(ifaceName: string): BindingInterface;
|
|
11
|
-
getSerialPort(ifaceName: string, props: any): any;
|
|
12
|
-
list(ifaceName: string): Promise<any>;
|
|
13
|
-
setLegacyClass(ifaceName: string, Serialport: any): void;
|
|
14
|
-
getLegacyInfo(ifaceName: string): InterfaceImplementation;
|
|
15
|
-
getLegacyClass(ifaceName: string): any;
|
|
16
|
-
}
|
|
17
|
-
export declare const useSerialPortProvider: () => SerialPortProvider;
|
package/lib/serial/serialport.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
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/lib/types/Command.d.ts
DELETED
package/lib/types/Command.js
DELETED
package/lib/types/command.d.ts
DELETED
|
File without changes
|
package/lib/types/command.js
DELETED
|
File without changes
|
package/lib/types/route.d.ts
DELETED
|
File without changes
|
package/lib/types/route.js
DELETED
|
File without changes
|
package/lib/types/types.d.ts
DELETED
package/lib/types/types.js
DELETED