@ya-modbus/transport 0.13.0 → 0.14.0
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/CHANGELOG.md +6 -0
- package/README.md +16 -0
- package/dist/cjs/src/index.d.ts +1 -0
- package/dist/cjs/src/index.d.ts.map +1 -1
- package/dist/cjs/src/index.js +3 -1
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/last-request.d.ts +29 -0
- package/dist/cjs/src/last-request.d.ts.map +1 -0
- package/dist/cjs/src/last-request.js +44 -0
- package/dist/cjs/src/last-request.js.map +1 -0
- package/dist/cjs/src/manager.d.ts +2 -0
- package/dist/cjs/src/manager.d.ts.map +1 -1
- package/dist/cjs/src/manager.js +5 -1
- package/dist/cjs/src/manager.js.map +1 -1
- package/dist/cjs/src/retry.d.ts +7 -0
- package/dist/cjs/src/retry.d.ts.map +1 -1
- package/dist/cjs/src/retry.js +1 -0
- package/dist/cjs/src/retry.js.map +1 -1
- package/dist/cjs/src/rtu-transport.d.ts +7 -0
- package/dist/cjs/src/rtu-transport.d.ts.map +1 -1
- package/dist/cjs/src/rtu-transport.js.map +1 -1
- package/dist/cjs/src/slave-transport.d.ts +18 -1
- package/dist/cjs/src/slave-transport.d.ts.map +1 -1
- package/dist/cjs/src/slave-transport.js +59 -53
- package/dist/cjs/src/slave-transport.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/index.d.ts +1 -0
- package/dist/esm/src/index.d.ts.map +1 -1
- package/dist/esm/src/index.js +1 -0
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/last-request.d.ts +29 -0
- package/dist/esm/src/last-request.d.ts.map +1 -0
- package/dist/esm/src/last-request.js +40 -0
- package/dist/esm/src/last-request.js.map +1 -0
- package/dist/esm/src/manager.d.ts +2 -0
- package/dist/esm/src/manager.d.ts.map +1 -1
- package/dist/esm/src/manager.js +5 -1
- package/dist/esm/src/manager.js.map +1 -1
- package/dist/esm/src/retry.d.ts +7 -0
- package/dist/esm/src/retry.d.ts.map +1 -1
- package/dist/esm/src/retry.js +1 -1
- package/dist/esm/src/retry.js.map +1 -1
- package/dist/esm/src/rtu-transport.d.ts +7 -0
- package/dist/esm/src/rtu-transport.d.ts.map +1 -1
- package/dist/esm/src/rtu-transport.js.map +1 -1
- package/dist/esm/src/slave-transport.d.ts +18 -1
- package/dist/esm/src/slave-transport.d.ts.map +1 -1
- package/dist/esm/src/slave-transport.js +59 -53
- package/dist/esm/src/slave-transport.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/esm/src/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { isConnectionLostError, ModbusConnection, type OpenClient } from './conn
|
|
|
14
14
|
export { TransportManager, type TransportManagerOptions, type TransportStats } from './manager.js';
|
|
15
15
|
export { MutexTransport } from './mutex-transport.js';
|
|
16
16
|
export { SlaveTransport } from './slave-transport.js';
|
|
17
|
+
export { LastRequest } from './last-request.js';
|
|
17
18
|
export { getSerialNodeWarning } from './serial-node-warning.js';
|
|
18
19
|
export { listSerialPorts, matchSerialPorts, type SerialPortInfo, type SerialPortMatch, } from './serial-ports.js';
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACvE,OAAO,EAAE,kBAAkB,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE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AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAA"}
|
package/dist/esm/src/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { isConnectionLostError, ModbusConnection } from './connection.js';
|
|
|
14
14
|
export { TransportManager } from './manager.js';
|
|
15
15
|
export { MutexTransport } from './mutex-transport.js';
|
|
16
16
|
export { SlaveTransport } from './slave-transport.js';
|
|
17
|
+
export { LastRequest } from './last-request.js';
|
|
17
18
|
export { getSerialNodeWarning } from './serial-node-warning.js';
|
|
18
19
|
export { listSerialPorts, matchSerialPorts, } from './serial-ports.js';
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAwB,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAkB,MAAM,oBAAoB,CAAA;AACvE,OAAO,EAAE,kBAAkB,EAAkB,MAAM,oBAAoB,CAAA;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAoB,MAAM,YAAY,CAAA;AACrF,OAAO,EAAE,oBAAoB,EAAoB,MAAM,sBAAsB,CAAA;AAC7E,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAmB,MAAM,iBAAiB,CAAA;AAC1F,OAAO,EAAE,gBAAgB,EAAqD,MAAM,cAAc,CAAA;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EACL,eAAe,EACf,gBAAgB,GAGjB,MAAM,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAwB,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAkB,MAAM,oBAAoB,CAAA;AACvE,OAAO,EAAE,kBAAkB,EAAkB,MAAM,oBAAoB,CAAA;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAoB,MAAM,YAAY,CAAA;AACrF,OAAO,EAAE,oBAAoB,EAAoB,MAAM,sBAAsB,CAAA;AAC7E,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAmB,MAAM,iBAAiB,CAAA;AAC1F,OAAO,EAAE,gBAAgB,EAAqD,MAAM,cAAc,CAAA;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EACL,eAAe,EACf,gBAAgB,GAGjB,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pause between requests to different slaves on one connection
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The last request on a connection: the slave it went to and when it ended.
|
|
6
|
+
*
|
|
7
|
+
* The SlaveTransports on one connection share one LastRequest, so a transport knows when the
|
|
8
|
+
* previous request went to another slave. Some meters do not answer a request that comes too
|
|
9
|
+
* soon after another meter's reply.
|
|
10
|
+
*/
|
|
11
|
+
export declare class LastRequest {
|
|
12
|
+
private slaveId;
|
|
13
|
+
private endedAt;
|
|
14
|
+
/**
|
|
15
|
+
* Wait until `delay` ms have passed since the end of the last request, when it went to
|
|
16
|
+
* another slave. No wait before the first request, or before a request to the same slave.
|
|
17
|
+
*
|
|
18
|
+
* @param slaveId - Slave of the next request
|
|
19
|
+
* @param delay - Pause in milliseconds after a request to another slave
|
|
20
|
+
*/
|
|
21
|
+
waitBefore(slaveId: number, delay: number): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Note the end of a request, also of a failed one
|
|
24
|
+
*
|
|
25
|
+
* @param slaveId - Slave of the request
|
|
26
|
+
*/
|
|
27
|
+
ended(slaveId: number): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=last-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"last-request.d.ts","sourceRoot":"","sources":["../../../src/last-request.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;GAMG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,OAAO,CAAI;IAEnB;;;;;;OAMG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO/D;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAI7B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pause between requests to different slaves on one connection
|
|
3
|
+
*/
|
|
4
|
+
import { sleep } from './retry.js';
|
|
5
|
+
/**
|
|
6
|
+
* The last request on a connection: the slave it went to and when it ended.
|
|
7
|
+
*
|
|
8
|
+
* The SlaveTransports on one connection share one LastRequest, so a transport knows when the
|
|
9
|
+
* previous request went to another slave. Some meters do not answer a request that comes too
|
|
10
|
+
* soon after another meter's reply.
|
|
11
|
+
*/
|
|
12
|
+
export class LastRequest {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.endedAt = 0;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Wait until `delay` ms have passed since the end of the last request, when it went to
|
|
18
|
+
* another slave. No wait before the first request, or before a request to the same slave.
|
|
19
|
+
*
|
|
20
|
+
* @param slaveId - Slave of the next request
|
|
21
|
+
* @param delay - Pause in milliseconds after a request to another slave
|
|
22
|
+
*/
|
|
23
|
+
async waitBefore(slaveId, delay) {
|
|
24
|
+
if (this.slaveId === undefined || this.slaveId === slaveId)
|
|
25
|
+
return;
|
|
26
|
+
const wait = this.endedAt + delay - performance.now();
|
|
27
|
+
if (wait > 0)
|
|
28
|
+
await sleep(wait);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Note the end of a request, also of a failed one
|
|
32
|
+
*
|
|
33
|
+
* @param slaveId - Slave of the request
|
|
34
|
+
*/
|
|
35
|
+
ended(slaveId) {
|
|
36
|
+
this.slaveId = slaveId;
|
|
37
|
+
this.endedAt = performance.now();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=last-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"last-request.js","sourceRoot":"","sources":["../../../src/last-request.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC;;;;;;GAMG;AACH,MAAM,OAAO,WAAW;IAAxB;QAEU,YAAO,GAAG,CAAC,CAAA;IAyBrB,CAAC;IAvBC;;;;;;OAMG;IACH,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,KAAa;QAC7C,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,KAAK,OAAO;YAAE,OAAM;QAElE,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,GAAG,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;QACrD,IAAI,IAAI,GAAG,CAAC;YAAE,MAAM,KAAK,CAAC,IAAI,CAAC,CAAA;IACjC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAe;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;IAClC,CAAC;CACF"}
|
|
@@ -33,6 +33,8 @@ export interface TransportStats {
|
|
|
33
33
|
* - Returns Transport objects (SlaveTransport wrapped with request details in errors) that set the slave ID before each operation
|
|
34
34
|
* - Multiple devices on the same connection share a single client and mutex
|
|
35
35
|
* - All operations are serialized using async-mutex to prevent race conditions
|
|
36
|
+
* - On a serial port, a request waits `interDeviceDelay` ms (RTU config of its device) after
|
|
37
|
+
* a request to another slave
|
|
36
38
|
* - A lost connection (USB adapter unplugged, TCP connection closed) drops the client.
|
|
37
39
|
* The first request after a backoff opens a new client for all devices on the
|
|
38
40
|
* connection (see ModbusConnection)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAMxD,OAAO,KAAK,EAAwB,eAAe,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAMxD,OAAO,KAAK,EAAwB,eAAe,EAAE,MAAM,cAAc,CAAA;AAEzE,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAgB7E;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,gBAAgB;IAOf,OAAO,CAAC,QAAQ,CAAC,OAAO;IANpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqC;IAEjE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8C;IAEtE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;gBAEtB,OAAO,GAAE,uBAA4B;IAElE;;;;;;;;;OASG;IACG,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC;IA+B/D;;;;;;;;;;;OAWG;IACG,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAc3D;;;;;;OAMG;YACW,cAAc;IA4B5B;;;;;;OAMG;IACH,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,WAAW,GAAG,SAAS;IAIpE;;;;OAIG;IACH,QAAQ,IAAI,cAAc;IAS1B;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAc/B;;;;;OAKG;YACW,eAAe;IAQ7B;;;;;;;;OAQG;IACH,OAAO,CAAC,wBAAwB;IAShC;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IAIjB;;;;;;OAMG;YACW,eAAe;IAe7B;;;;;;OAMG;YACW,eAAe;IAU7B;;;;;OAKG;IACH,OAAO,CAAC,WAAW;CAGpB"}
|
package/dist/esm/src/manager.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Mutex } from 'async-mutex';
|
|
|
2
2
|
import ModbusRTU from 'modbus-serial';
|
|
3
3
|
import { connectTCP, DEFAULT_TIMEOUT_MS } from './client-config.js';
|
|
4
4
|
import { ModbusConnection } from './connection.js';
|
|
5
|
+
import { LastRequest } from './last-request.js';
|
|
5
6
|
import { normalizeModbusError } from './normalize-error.js';
|
|
6
7
|
import { formatSerialSettings, withRequestContext } from './request-context.js';
|
|
7
8
|
import { SlaveTransport } from './slave-transport.js';
|
|
@@ -15,6 +16,8 @@ import { SlaveTransport } from './slave-transport.js';
|
|
|
15
16
|
* - Returns Transport objects (SlaveTransport wrapped with request details in errors) that set the slave ID before each operation
|
|
16
17
|
* - Multiple devices on the same connection share a single client and mutex
|
|
17
18
|
* - All operations are serialized using async-mutex to prevent race conditions
|
|
19
|
+
* - On a serial port, a request waits `interDeviceDelay` ms (RTU config of its device) after
|
|
20
|
+
* a request to another slave
|
|
18
21
|
* - A lost connection (USB adapter unplugged, TCP connection closed) drops the client.
|
|
19
22
|
* The first request after a backoff opens a new client for all devices on the
|
|
20
23
|
* connection (see ModbusConnection)
|
|
@@ -69,7 +72,7 @@ export class TransportManager {
|
|
|
69
72
|
entry = await opening;
|
|
70
73
|
}
|
|
71
74
|
// Return a new SlaveTransport for this specific slave
|
|
72
|
-
const transport = new SlaveTransport(config.slaveId, entry.connection, entry.mutex, config.maxRetries ?? 3, config.logger);
|
|
75
|
+
const transport = new SlaveTransport(config.slaveId, entry.connection, entry.mutex, config.maxRetries ?? 3, config.logger, this.isRTUConfig(config) ? config.interDeviceDelay : undefined, entry.lastRequest);
|
|
73
76
|
const target = this.getTarget(config);
|
|
74
77
|
const where = this.isRTUConfig(config) ? `${target} ${formatSerialSettings(config)}` : target;
|
|
75
78
|
const described = withRequestContext(transport, `${where}, slave ${config.slaveId}`);
|
|
@@ -128,6 +131,7 @@ export class TransportManager {
|
|
|
128
131
|
const entry = {
|
|
129
132
|
connection,
|
|
130
133
|
mutex: new Mutex(),
|
|
134
|
+
lastRequest: new LastRequest(),
|
|
131
135
|
config,
|
|
132
136
|
isRTU,
|
|
133
137
|
transports: new Set(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,SAAS,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,EAAE,oBAAoB,EAAoB,MAAM,sBAAsB,CAAA;AAC7E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,SAAS,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAoB,MAAM,sBAAsB,CAAA;AAC7E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAsCrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,gBAAgB;IAO3B,YAA6B,UAAmC,EAAE;QAArC,YAAO,GAAP,OAAO,CAA8B;QANjD,gBAAW,GAAG,IAAI,GAAG,EAA2B,CAAA;QACjE,wFAAwF;QACvE,YAAO,GAAG,IAAI,GAAG,EAAoC,CAAA;QACtE,mEAAmE;QAClD,YAAO,GAAG,IAAI,GAAG,EAAiB,CAAA;IAEkB,CAAC;IAEtE;;;;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CAAA;IACnF,CAAC;CACF"}
|
package/dist/esm/src/retry.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ import { type ModbusError } from './normalize-error.js';
|
|
|
6
6
|
export declare const MAX_RETRIES = 3;
|
|
7
7
|
/** Delay between retry attempts in milliseconds */
|
|
8
8
|
export declare const RETRY_DELAY_MS = 100;
|
|
9
|
+
/**
|
|
10
|
+
* Sleep for a specified duration
|
|
11
|
+
*
|
|
12
|
+
* @param ms - Duration in milliseconds
|
|
13
|
+
* @returns Promise that resolves after the specified duration
|
|
14
|
+
*/
|
|
15
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
9
16
|
/**
|
|
10
17
|
* Logger function to track retry attempts
|
|
11
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAE7E,6DAA6D;AAC7D,eAAO,MAAM,WAAW,IAAI,CAAA;AAE5B,mDAAmD;AACnD,eAAO,MAAM,cAAc,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAE7E,6DAA6D;AAC7D,eAAO,MAAM,WAAW,IAAI,CAAA;AAE5B,mDAAmD;AACnD,eAAO,MAAM,cAAc,MAAM,CAAA;AAEjC;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;AAEvE;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,UAAU,GAAE,MAAoB,EAChC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,CAAC,CAAC,CAqBZ"}
|
package/dist/esm/src/retry.js
CHANGED
|
@@ -12,7 +12,7 @@ export const RETRY_DELAY_MS = 100;
|
|
|
12
12
|
* @param ms - Duration in milliseconds
|
|
13
13
|
* @returns Promise that resolves after the specified duration
|
|
14
14
|
*/
|
|
15
|
-
function sleep(ms) {
|
|
15
|
+
export function sleep(ms) {
|
|
16
16
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../../src/retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAoB,MAAM,sBAAsB,CAAA;AAE7E,6DAA6D;AAC7D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAA;AAE5B,mDAAmD;AACnD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;AAEjC;;;;;GAKG;AACH,
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../../src/retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAoB,MAAM,sBAAsB,CAAA;AAE7E,6DAA6D;AAC7D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAA;AAE5B,mDAAmD;AACnD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;AAEjC;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAC1D,CAAC;AAUD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,EAAoB,EACpB,aAAqB,WAAW,EAChC,MAAoB;IAEpB,IAAI,SAAS,GAAgB,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;IAErE,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;QACvD,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,EAAE,CAAA;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAS,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAA;YAEvC,kCAAkC;YAClC,IAAI,OAAO,GAAG,UAAU,EAAE,CAAC;gBACzB,8CAA8C;gBAC9C,IAAI,MAAM,EAAE,CAAC;oBACX,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;gBAC5B,CAAC;gBACD,MAAM,KAAK,CAAC,cAAc,CAAC,CAAA;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,SAAS,CAAA;AACjB,CAAC"}
|
|
@@ -22,6 +22,13 @@ export interface RTUConfig {
|
|
|
22
22
|
maxRetries?: number | undefined;
|
|
23
23
|
/** Optional callback to log retry attempts for debugging */
|
|
24
24
|
logger?: RetryLogger | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Pause in milliseconds before a request to this slave when the previous request on the port
|
|
27
|
+
* went to another slave, counted from the end of that request (default: 0, no pause). Some
|
|
28
|
+
* meters do not answer a request that comes too soon after another meter's reply. Only for
|
|
29
|
+
* devices that share a port through TransportManager.
|
|
30
|
+
*/
|
|
31
|
+
interDeviceDelay?: number | undefined;
|
|
25
32
|
}
|
|
26
33
|
/**
|
|
27
34
|
* Create an RTU transport
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rtu-transport.d.ts","sourceRoot":"","sources":["../../../src/rtu-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,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E,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,4DAA4D;IAC5D,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;IAChC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACtC;AAED;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAqB9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rtu-transport.js","sourceRoot":"","sources":["../../../src/rtu-transport.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"rtu-transport.js","sourceRoot":"","sources":["../../../src/rtu-transport.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAkC/E;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAiB;IACxD,MAAM,IAAI,GAAG,KAAK,IAAwB,EAAE;QAC1C,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAA;QAE9B,yBAAyB;QACzB,MAAM,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,EAAE;YAC3C,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC,CAAA;QAEF,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;QACvD,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,IAAI,gBAAgB,CAAC,MAAM,IAAI,EAAE,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACxE,OAAO,kBAAkB,CACvB,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,EACnE,GAAG,MAAM,CAAC,IAAI,IAAI,oBAAoB,CAAC,MAAM,CAAC,WAAW,MAAM,CAAC,OAAO,EAAE,CAC1E,CAAA;AACH,CAAC"}
|
|
@@ -2,6 +2,7 @@ import type { Transport } from '@ya-modbus/driver-types';
|
|
|
2
2
|
import type { Mutex } from 'async-mutex';
|
|
3
3
|
import type ModbusRTU from 'modbus-serial';
|
|
4
4
|
import { type ModbusConnection } from './connection.js';
|
|
5
|
+
import { LastRequest } from './last-request.js';
|
|
5
6
|
import { type RetryLogger } from './retry.js';
|
|
6
7
|
/**
|
|
7
8
|
* SlaveTransport wraps a shared ModbusRTU client with slave-specific addressing.
|
|
@@ -13,6 +14,10 @@ import { type RetryLogger } from './retry.js';
|
|
|
13
14
|
* Requests on a lost connection reject with a ConnectionLostError. When the shared
|
|
14
15
|
* ModbusConnection can reopen its client, all devices on the connection use the new client.
|
|
15
16
|
*
|
|
17
|
+
* With an `interDeviceDelay` and a LastRequest shared by the transports on the connection, a
|
|
18
|
+
* request waits after a request to another slave. Some meters do not answer a request that
|
|
19
|
+
* comes too soon after another meter's reply.
|
|
20
|
+
*
|
|
16
21
|
* @example
|
|
17
22
|
* ```typescript
|
|
18
23
|
* const client = new ModbusRTU()
|
|
@@ -34,6 +39,8 @@ export declare class SlaveTransport implements Transport {
|
|
|
34
39
|
private readonly mutex;
|
|
35
40
|
private readonly maxRetries;
|
|
36
41
|
private readonly logger?;
|
|
42
|
+
private readonly interDeviceDelay;
|
|
43
|
+
private readonly lastRequest;
|
|
37
44
|
private readonly connection;
|
|
38
45
|
/**
|
|
39
46
|
* @param slaveId - Modbus slave/unit ID for this device
|
|
@@ -41,8 +48,13 @@ export declare class SlaveTransport implements Transport {
|
|
|
41
48
|
* @param mutex - Shared mutex for serializing operations on the bus
|
|
42
49
|
* @param maxRetries - Maximum retry attempts for failed operations (default: 3)
|
|
43
50
|
* @param logger - Optional callback to log retry attempts
|
|
51
|
+
* @param interDeviceDelay - Pause in milliseconds before a request to this slave when the
|
|
52
|
+
* previous request on the connection went to another slave, counted from the end of that
|
|
53
|
+
* request (default: 0, no pause)
|
|
54
|
+
* @param lastRequest - Last request on the connection, the same for all transports that share
|
|
55
|
+
* the mutex. interDeviceDelay needs it.
|
|
44
56
|
*/
|
|
45
|
-
constructor(slaveId: number, client: ModbusConnection | ModbusRTU, mutex: Mutex, maxRetries?: number, logger?: RetryLogger | undefined);
|
|
57
|
+
constructor(slaveId: number, client: ModbusConnection | ModbusRTU, mutex: Mutex, maxRetries?: number, logger?: RetryLogger | undefined, interDeviceDelay?: number, lastRequest?: LastRequest);
|
|
46
58
|
readHoldingRegisters(address: number, count: number): Promise<Buffer>;
|
|
47
59
|
readInputRegisters(address: number, count: number): Promise<Buffer>;
|
|
48
60
|
readCoils(address: number, count: number): Promise<Buffer>;
|
|
@@ -63,5 +75,10 @@ export declare class SlaveTransport implements Transport {
|
|
|
63
75
|
* TransportManager.closeAll() at shutdown.
|
|
64
76
|
*/
|
|
65
77
|
close(): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Run a request to this slave while no other request uses the bus: wait for the pause after
|
|
80
|
+
* a request to another slave, then send it with retries
|
|
81
|
+
*/
|
|
82
|
+
private request;
|
|
66
83
|
}
|
|
67
84
|
//# sourceMappingURL=slave-transport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slave-transport.d.ts","sourceRoot":"","sources":["../../../src/slave-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,SAAS,MAAM,eAAe,CAAA;AAE1C,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAExD
|
|
1
|
+
{"version":3,"file":"slave-transport.d.ts","sourceRoot":"","sources":["../../../src/slave-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,SAAS,MAAM,eAAe,CAAA;AAE1C,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,cAAe,YAAW,SAAS;IAgB5C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAExB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW;IArB9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB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
|
* SlaveTransport wraps a shared ModbusRTU client with slave-specific addressing.
|
|
@@ -10,6 +11,10 @@ import { withRetry } from './retry.js';
|
|
|
10
11
|
* Requests on a lost connection reject with a ConnectionLostError. When the shared
|
|
11
12
|
* ModbusConnection can reopen its client, all devices on the connection use the new client.
|
|
12
13
|
*
|
|
14
|
+
* With an `interDeviceDelay` and a LastRequest shared by the transports on the connection, a
|
|
15
|
+
* request waits after a request to another slave. Some meters do not answer a request that
|
|
16
|
+
* comes too soon after another meter's reply.
|
|
17
|
+
*
|
|
13
18
|
* @example
|
|
14
19
|
* ```typescript
|
|
15
20
|
* const client = new ModbusRTU()
|
|
@@ -33,88 +38,71 @@ export class SlaveTransport {
|
|
|
33
38
|
* @param mutex - Shared mutex for serializing operations on the bus
|
|
34
39
|
* @param maxRetries - Maximum retry attempts for failed operations (default: 3)
|
|
35
40
|
* @param logger - Optional callback to log retry attempts
|
|
41
|
+
* @param interDeviceDelay - Pause in milliseconds before a request to this slave when the
|
|
42
|
+
* previous request on the connection went to another slave, counted from the end of that
|
|
43
|
+
* request (default: 0, no pause)
|
|
44
|
+
* @param lastRequest - Last request on the connection, the same for all transports that share
|
|
45
|
+
* the mutex. interDeviceDelay needs it.
|
|
36
46
|
*/
|
|
37
|
-
constructor(slaveId, client, mutex, maxRetries = 3, logger) {
|
|
47
|
+
constructor(slaveId, client, mutex, maxRetries = 3, logger, interDeviceDelay = 0, lastRequest = new LastRequest()) {
|
|
38
48
|
this.slaveId = slaveId;
|
|
39
49
|
this.mutex = mutex;
|
|
40
50
|
this.maxRetries = maxRetries;
|
|
41
51
|
this.logger = logger;
|
|
52
|
+
this.interDeviceDelay = interDeviceDelay;
|
|
53
|
+
this.lastRequest = lastRequest;
|
|
42
54
|
this.connection = toConnection(client);
|
|
43
55
|
}
|
|
44
56
|
async readHoldingRegisters(address, count) {
|
|
45
|
-
return this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const result = await client.readHoldingRegisters(address, count);
|
|
49
|
-
return result.buffer;
|
|
50
|
-
}), this.maxRetries, this.logger);
|
|
57
|
+
return this.request(async (client) => {
|
|
58
|
+
const result = await client.readHoldingRegisters(address, count);
|
|
59
|
+
return result.buffer;
|
|
51
60
|
});
|
|
52
61
|
}
|
|
53
62
|
async readInputRegisters(address, count) {
|
|
54
|
-
return this.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const result = await client.readInputRegisters(address, count);
|
|
58
|
-
return result.buffer;
|
|
59
|
-
}), this.maxRetries, this.logger);
|
|
63
|
+
return this.request(async (client) => {
|
|
64
|
+
const result = await client.readInputRegisters(address, count);
|
|
65
|
+
return result.buffer;
|
|
60
66
|
});
|
|
61
67
|
}
|
|
62
68
|
async readCoils(address, count) {
|
|
63
|
-
return this.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const result = await client.readCoils(address, count);
|
|
67
|
-
return result.buffer;
|
|
68
|
-
}), this.maxRetries, this.logger);
|
|
69
|
+
return this.request(async (client) => {
|
|
70
|
+
const result = await client.readCoils(address, count);
|
|
71
|
+
return result.buffer;
|
|
69
72
|
});
|
|
70
73
|
}
|
|
71
74
|
async readDiscreteInputs(address, count) {
|
|
72
|
-
return this.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const result = await client.readDiscreteInputs(address, count);
|
|
76
|
-
return result.buffer;
|
|
77
|
-
}), this.maxRetries, this.logger);
|
|
75
|
+
return this.request(async (client) => {
|
|
76
|
+
const result = await client.readDiscreteInputs(address, count);
|
|
77
|
+
return result.buffer;
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
async writeSingleRegister(address, value) {
|
|
81
|
-
return this.
|
|
82
|
-
|
|
83
|
-
client.setID(this.slaveId);
|
|
84
|
-
await client.writeRegister(address, value);
|
|
85
|
-
}), this.maxRetries, this.logger);
|
|
81
|
+
return this.request(async (client) => {
|
|
82
|
+
await client.writeRegister(address, value);
|
|
86
83
|
});
|
|
87
84
|
}
|
|
88
85
|
async writeMultipleRegisters(address, values) {
|
|
89
|
-
return this.
|
|
90
|
-
|
|
91
|
-
client.setID(this.slaveId);
|
|
92
|
-
await client.writeRegisters(address, values);
|
|
93
|
-
}), this.maxRetries, this.logger);
|
|
86
|
+
return this.request(async (client) => {
|
|
87
|
+
await client.writeRegisters(address, values);
|
|
94
88
|
});
|
|
95
89
|
}
|
|
96
90
|
async writeSingleCoil(address, value) {
|
|
97
|
-
return this.
|
|
98
|
-
|
|
99
|
-
client.setID(this.slaveId);
|
|
100
|
-
await client.writeCoil(address, value);
|
|
101
|
-
}), this.maxRetries, this.logger);
|
|
91
|
+
return this.request(async (client) => {
|
|
92
|
+
await client.writeCoil(address, value);
|
|
102
93
|
});
|
|
103
94
|
}
|
|
104
95
|
async writeMultipleCoils(address, values) {
|
|
105
|
-
return this.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
await client.writeCoils(address, bools);
|
|
117
|
-
}), this.maxRetries, this.logger);
|
|
96
|
+
return this.request(async (client) => {
|
|
97
|
+
// Convert Buffer to boolean array
|
|
98
|
+
const bools = [];
|
|
99
|
+
for (let i = 0; i < values.length * 8; i++) {
|
|
100
|
+
const byteIndex = Math.floor(i / 8);
|
|
101
|
+
const bitIndex = i % 8;
|
|
102
|
+
const byte = values[byteIndex];
|
|
103
|
+
bools.push((byte & (1 << bitIndex)) !== 0);
|
|
104
|
+
}
|
|
105
|
+
await client.writeCoils(address, bools);
|
|
118
106
|
});
|
|
119
107
|
}
|
|
120
108
|
/**
|
|
@@ -132,5 +120,23 @@ export class SlaveTransport {
|
|
|
132
120
|
// Don't use mutex for close operation
|
|
133
121
|
return this.connection.close();
|
|
134
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Run a request to this slave while no other request uses the bus: wait for the pause after
|
|
125
|
+
* a request to another slave, then send it with retries
|
|
126
|
+
*/
|
|
127
|
+
request(send) {
|
|
128
|
+
return this.mutex.runExclusive(async () => {
|
|
129
|
+
await this.lastRequest.waitBefore(this.slaveId, this.interDeviceDelay);
|
|
130
|
+
try {
|
|
131
|
+
return await withRetry(() => this.connection.run(async (client) => {
|
|
132
|
+
client.setID(this.slaveId);
|
|
133
|
+
return send(client);
|
|
134
|
+
}), this.maxRetries, this.logger);
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
this.lastRequest.ended(this.slaveId);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
135
141
|
}
|
|
136
142
|
//# sourceMappingURL=slave-transport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slave-transport.js","sourceRoot":"","sources":["../../../src/slave-transport.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAyB,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,SAAS,EAAoB,MAAM,YAAY,CAAA;AAExD
|
|
1
|
+
{"version":3,"file":"slave-transport.js","sourceRoot":"","sources":["../../../src/slave-transport.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAyB,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAoB,MAAM,YAAY,CAAA;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,cAAc;IAGzB;;;;;;;;;;;OAWG;IACH,YACmB,OAAe,EAChC,MAAoC,EACnB,KAAY,EACZ,aAAqB,CAAC,EACtB,MAAoB,EACpB,mBAA2B,CAAC,EAC5B,cAA2B,IAAI,WAAW,EAAE;QAN5C,YAAO,GAAP,OAAO,CAAQ;QAEf,UAAK,GAAL,KAAK,CAAO;QACZ,eAAU,GAAV,UAAU,CAAY;QACtB,WAAM,GAAN,MAAM,CAAc;QACpB,qBAAgB,GAAhB,gBAAgB,CAAY;QAC5B,gBAAW,GAAX,WA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