incyclist-devices 3.0.1 → 3.0.2
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/cjs/direct-connect/base/interface.js +0 -1
- package/lib/cjs/direct-connect/base/peripheral.js +0 -1
- package/lib/cjs/serial/base/serialport.js +36 -2
- package/lib/esm/direct-connect/base/interface.js +0 -1
- package/lib/esm/direct-connect/base/peripheral.js +0 -1
- package/lib/esm/serial/base/serialport.js +2 -1
- package/lib/types/serial/base/comms.d.ts +3 -3
- package/lib/types/serial/base/serial-interface.d.ts +1 -2
- package/lib/types/serial/types.d.ts +10 -1
- package/package.json +3 -3
|
@@ -352,7 +352,6 @@ class DirectConnectPeripheral {
|
|
|
352
352
|
const { address, port } = this.announcement;
|
|
353
353
|
try {
|
|
354
354
|
const net = this.getBinding().net;
|
|
355
|
-
console.log('# net Binding ', this.getBinding().net);
|
|
356
355
|
this.socket = net.createSocket();
|
|
357
356
|
return new Promise((resolve, reject) => {
|
|
358
357
|
this.socket.once('timeout', () => {
|
|
@@ -1,7 +1,41 @@
|
|
|
1
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.useSerialPortProvider = void 0;
|
|
4
|
-
const
|
|
37
|
+
const _Stream = __importStar(require("@serialport/stream"));
|
|
38
|
+
const { SerialPortStream } = _Stream;
|
|
5
39
|
const DEFAULT_BAUD_RATE = 9600;
|
|
6
40
|
class SerialPortProvider {
|
|
7
41
|
static _instance;
|
|
@@ -36,7 +70,7 @@ class SerialPortProvider {
|
|
|
36
70
|
props.autoOpen = false;
|
|
37
71
|
if (!props.baudRate)
|
|
38
72
|
props.baudRate = DEFAULT_BAUD_RATE;
|
|
39
|
-
return new
|
|
73
|
+
return new SerialPortStream(props);
|
|
40
74
|
}
|
|
41
75
|
const legacy = this.getLegacyInfo(ifaceName);
|
|
42
76
|
if (legacy && legacy.Serialport) {
|
|
@@ -346,7 +346,6 @@ export class DirectConnectPeripheral {
|
|
|
346
346
|
const { address, port } = this.announcement;
|
|
347
347
|
try {
|
|
348
348
|
const net = this.getBinding().net;
|
|
349
|
-
console.log('# net Binding ', this.getBinding().net);
|
|
350
349
|
this.socket = net.createSocket();
|
|
351
350
|
return new Promise((resolve, reject) => {
|
|
352
351
|
this.socket.once('timeout', () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventLogger } from "gd-eventlog";
|
|
2
2
|
import SerialInterface from "./serial-interface.js";
|
|
3
|
-
import { SerialCommProps } from "../types.js";
|
|
4
|
-
import { SerialPortStream } from "@serialport/stream";
|
|
3
|
+
import { SerialCommProps, SerialPortStream } from "../types.js";
|
|
5
4
|
import { Queue } from "../../utils/utils.js";
|
|
5
|
+
import { Duplex } from "node:stream";
|
|
6
6
|
export type ConnectionState = 'Connecting' | 'Connected' | 'Disconnected' | 'Disconnecting';
|
|
7
7
|
export type Request = {
|
|
8
8
|
logString?: string;
|
|
@@ -19,7 +19,7 @@ export default class SerialPortComms<T extends CommsState, C extends Request, R
|
|
|
19
19
|
protected props: SerialCommProps;
|
|
20
20
|
protected sp: SerialPortStream;
|
|
21
21
|
protected connectState: ConnectionState;
|
|
22
|
-
protected connectPromise: Promise<
|
|
22
|
+
protected connectPromise: Promise<Duplex>;
|
|
23
23
|
protected disconnectPromise: Promise<boolean>;
|
|
24
24
|
protected writePromise: Promise<void>;
|
|
25
25
|
protected sendCmdPromise: Promise<R>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import EventEmitter from "node:events";
|
|
2
2
|
import { BindingInterface } from "@serialport/bindings-interface";
|
|
3
|
-
import { SerialPortStream } from
|
|
4
|
-
import { SerialDeviceSettings, SerialScannerProps, PortMapping, SerialInterfaceProps } from "../types.js";
|
|
3
|
+
import { SerialDeviceSettings, SerialScannerProps, PortMapping, SerialInterfaceProps, SerialPortStream } from "../types.js";
|
|
5
4
|
import { DeviceSettings, IncyclistInterface } from "../../types/index.js";
|
|
6
5
|
import { EventLogger } from "gd-eventlog";
|
|
7
6
|
export default class SerialInterface extends EventEmitter implements IncyclistInterface {
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { EventLogger } from "gd-eventlog";
|
|
2
2
|
import { BindingInterface } from "@serialport/bindings-interface";
|
|
3
|
-
import { SerialPortStream } from "@serialport/stream";
|
|
4
3
|
import { DeviceSettings, IncyclistScanProps, InterfaceProps } from "../types/index.js";
|
|
5
4
|
import SerialInterface from "./base/serial-interface.js";
|
|
5
|
+
import { Duplex } from "node:stream";
|
|
6
|
+
export interface SerialPortStream extends Duplex {
|
|
7
|
+
open(callback?: (err: Error | null) => void): void;
|
|
8
|
+
close(callback?: (err: Error | null) => void): void;
|
|
9
|
+
flush(callback?: (err: Error | null) => void): void;
|
|
10
|
+
drain(callback?: (err: Error | null) => void): void;
|
|
11
|
+
set?(options: any, callback?: (err: Error | null) => void): void;
|
|
12
|
+
update?(options: any, callback?: (err: Error | null) => void): void;
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
}
|
|
6
15
|
export type SerialCommProps = {
|
|
7
16
|
serial: SerialInterface;
|
|
8
17
|
path: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "incyclist-devices",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"lint": "eslint . --ext .ts",
|
|
6
6
|
"build": "npm run build:esm && npm run build:cjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@serialport/binding-mock": "^10.2.2",
|
|
32
32
|
"@serialport/bindings-cpp": "^13.0.1",
|
|
33
33
|
"@stoprocent/noble": "^2.3.10",
|
|
34
|
-
"@types/node": "^25.0
|
|
34
|
+
"@types/node": "^25.1.0",
|
|
35
35
|
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
|
36
36
|
"@typescript-eslint/parser": "^8.54.0",
|
|
37
37
|
"@vitest/coverage-v8": "^4.0.18",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"eslint": "^9.39.2",
|
|
40
40
|
"protoc": "^33.4.0",
|
|
41
41
|
"ts-node": "^10.9.2",
|
|
42
|
-
"typescript": "^5.9.
|
|
42
|
+
"typescript": "^5.9.3",
|
|
43
43
|
"vitest": "^4.0.18"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|