@zaber/motion 7.8.4 → 7.9.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.
Files changed (33) hide show
  1. package/LICENSE +136 -1
  2. package/dist/binding/wasm/zaber-motion-core.wasm +0 -0
  3. package/dist/lib/ascii/connection.d.ts +16 -0
  4. package/dist/lib/ascii/connection.d.ts.map +1 -1
  5. package/dist/lib/ascii/connection.js +45 -6
  6. package/dist/lib/ascii/connection.js.map +1 -1
  7. package/dist/lib/binary/connection.d.ts +10 -0
  8. package/dist/lib/binary/connection.d.ts.map +1 -1
  9. package/dist/lib/binary/connection.js +23 -1
  10. package/dist/lib/binary/connection.js.map +1 -1
  11. package/dist/lib/library.js +1 -1
  12. package/dist/lib/library.js.map +1 -1
  13. package/dist/lib/requests/alert_event_wrapper.d.ts +4 -0
  14. package/dist/lib/requests/alert_event_wrapper.d.ts.map +1 -1
  15. package/dist/lib/requests/alert_event_wrapper.js +3 -0
  16. package/dist/lib/requests/alert_event_wrapper.js.map +1 -1
  17. package/dist/lib/requests/binary_reply_only_event_wrapper.d.ts +4 -0
  18. package/dist/lib/requests/binary_reply_only_event_wrapper.d.ts.map +1 -1
  19. package/dist/lib/requests/binary_reply_only_event_wrapper.js +3 -0
  20. package/dist/lib/requests/binary_reply_only_event_wrapper.js.map +1 -1
  21. package/dist/lib/requests/disconnected_event.d.ts +4 -0
  22. package/dist/lib/requests/disconnected_event.d.ts.map +1 -1
  23. package/dist/lib/requests/disconnected_event.js +3 -0
  24. package/dist/lib/requests/disconnected_event.js.map +1 -1
  25. package/dist/lib/requests/unknown_binary_response_event_wrapper.d.ts +4 -0
  26. package/dist/lib/requests/unknown_binary_response_event_wrapper.d.ts.map +1 -1
  27. package/dist/lib/requests/unknown_binary_response_event_wrapper.js +3 -0
  28. package/dist/lib/requests/unknown_binary_response_event_wrapper.js.map +1 -1
  29. package/dist/lib/requests/unknown_response_event_wrapper.d.ts +4 -0
  30. package/dist/lib/requests/unknown_response_event_wrapper.d.ts.map +1 -1
  31. package/dist/lib/requests/unknown_response_event_wrapper.js +3 -0
  32. package/dist/lib/requests/unknown_response_event_wrapper.js.map +1 -1
  33. package/package.json +1 -1
package/LICENSE CHANGED
@@ -421,6 +421,31 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
421
421
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
422
422
  THE SOFTWARE.
423
423
 
424
+ ------------------
425
+ github.com/stretchr/testify v1.8.1
426
+ ------------------
427
+ MIT License
428
+
429
+ Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors.
430
+
431
+ Permission is hereby granted, free of charge, to any person obtaining a copy
432
+ of this software and associated documentation files (the "Software"), to deal
433
+ in the Software without restriction, including without limitation the rights
434
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
435
+ copies of the Software, and to permit persons to whom the Software is
436
+ furnished to do so, subject to the following conditions:
437
+
438
+ The above copyright notice and this permission notice shall be included in all
439
+ copies or substantial portions of the Software.
440
+
441
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
442
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
443
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
444
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
445
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
446
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
447
+ SOFTWARE.
448
+
424
449
  ------------------
425
450
  github.com/zabertech/go-ethereum v1.10.4-rpc-1 (fork github.com/ethereum/go-ethereum)
426
451
  ------------------
@@ -1457,7 +1482,69 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1457
1482
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1458
1483
 
1459
1484
  ------------------
1460
- golang.org/x/net v0.12.0
1485
+ golang.org/x/mod v0.12.0
1486
+ ------------------
1487
+ Copyright (c) 2009 The Go Authors. All rights reserved.
1488
+
1489
+ Redistribution and use in source and binary forms, with or without
1490
+ modification, are permitted provided that the following conditions are
1491
+ met:
1492
+
1493
+ * Redistributions of source code must retain the above copyright
1494
+ notice, this list of conditions and the following disclaimer.
1495
+ * Redistributions in binary form must reproduce the above
1496
+ copyright notice, this list of conditions and the following disclaimer
1497
+ in the documentation and/or other materials provided with the
1498
+ distribution.
1499
+ * Neither the name of Google Inc. nor the names of its
1500
+ contributors may be used to endorse or promote products derived from
1501
+ this software without specific prior written permission.
1502
+
1503
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1504
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1505
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1506
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1507
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1508
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1509
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1510
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1511
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1512
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1513
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1514
+
1515
+ ------------------
1516
+ golang.org/x/net v0.0.0-20190620200207-3b0461eec859
1517
+ ------------------
1518
+ Copyright (c) 2009 The Go Authors. All rights reserved.
1519
+
1520
+ Redistribution and use in source and binary forms, with or without
1521
+ modification, are permitted provided that the following conditions are
1522
+ met:
1523
+
1524
+ * Redistributions of source code must retain the above copyright
1525
+ notice, this list of conditions and the following disclaimer.
1526
+ * Redistributions in binary form must reproduce the above
1527
+ copyright notice, this list of conditions and the following disclaimer
1528
+ in the documentation and/or other materials provided with the
1529
+ distribution.
1530
+ * Neither the name of Google Inc. nor the names of its
1531
+ contributors may be used to endorse or promote products derived from
1532
+ this software without specific prior written permission.
1533
+
1534
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1535
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1536
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1537
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1538
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1539
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1540
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1541
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1542
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1543
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1544
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1545
+
1546
+ ------------------
1547
+ golang.org/x/sync v0.3.0
1461
1548
  ------------------
1462
1549
  Copyright (c) 2009 The Go Authors. All rights reserved.
1463
1550
 
@@ -1518,6 +1605,37 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1518
1605
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1519
1606
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1520
1607
 
1608
+ ------------------
1609
+ golang.org/x/text v0.3.0
1610
+ ------------------
1611
+ Copyright (c) 2009 The Go Authors. All rights reserved.
1612
+
1613
+ Redistribution and use in source and binary forms, with or without
1614
+ modification, are permitted provided that the following conditions are
1615
+ met:
1616
+
1617
+ * Redistributions of source code must retain the above copyright
1618
+ notice, this list of conditions and the following disclaimer.
1619
+ * Redistributions in binary form must reproduce the above
1620
+ copyright notice, this list of conditions and the following disclaimer
1621
+ in the documentation and/or other materials provided with the
1622
+ distribution.
1623
+ * Neither the name of Google Inc. nor the names of its
1624
+ contributors may be used to endorse or promote products derived from
1625
+ this software without specific prior written permission.
1626
+
1627
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1628
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1629
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1630
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1631
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1632
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1633
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1634
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1635
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1636
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1637
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1638
+
1521
1639
  ------------------
1522
1640
  gonum.org/v1/gonum v0.16.0
1523
1641
  ------------------
@@ -1560,3 +1678,20 @@ distributed under the License is distributed on an "AS IS" BASIS,
1560
1678
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1561
1679
  See the License for the specific language governing permissions and
1562
1680
  limitations under the License.
1681
+
1682
+ ------------------
1683
+ gotest.tools/v3 v3.0.2
1684
+ ------------------
1685
+ Copyright 2018 gotest.tools authors
1686
+
1687
+ Licensed under the Apache License, Version 2.0 (the "License");
1688
+ you may not use this file except in compliance with the License.
1689
+ You may obtain a copy of the License at
1690
+
1691
+ http://www.apache.org/licenses/LICENSE-2.0
1692
+
1693
+ Unless required by applicable law or agreed to in writing, software
1694
+ distributed under the License is distributed on an "AS IS" BASIS,
1695
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1696
+ See the License for the specific language governing permissions and
1697
+ limitations under the License.
@@ -53,6 +53,11 @@ export declare class Connection {
53
53
  */
54
54
  get checksumEnabled(): boolean;
55
55
  set checksumEnabled(value: boolean);
56
+ /**
57
+ * Returns whether the connection is open.
58
+ * Does not guarantee that subsequent requests will succeed.
59
+ */
60
+ get isOpen(): boolean;
56
61
  constructor(interfaceId: number);
57
62
  /**
58
63
  * Opens a serial port, if Zaber Launcher controls the port, the port will be opened through Zaber Launcher.
@@ -103,6 +108,12 @@ export declare class Connection {
103
108
  * @returns An object representing the connection.
104
109
  */
105
110
  static openNetworkShare(hostName: string, port?: number, connectionName?: string): Promise<Connection>;
111
+ /**
112
+ * Reopens the connection.
113
+ * To continue using events on the connection, you must resubscribe to event observables.
114
+ * Throws an exception if the connection is already open.
115
+ */
116
+ reopen(): Promise<void>;
106
117
  /**
107
118
  * Sends a generic ASCII command to this connection.
108
119
  * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
@@ -222,6 +233,11 @@ export declare class Connection {
222
233
  * @param isEnabled Checksum enabled.
223
234
  */
224
235
  private _changeChecksumEnabled;
236
+ /**
237
+ * Returns is open.
238
+ * @returns Is open.
239
+ */
240
+ private _retrieveIsOpen;
225
241
  /**
226
242
  * Releases native resources of the connection.
227
243
  * @param interfaceId The ID of the connection.
@@ -1 +1 @@
1
- {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/ascii/connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAiB,MAAM,MAAM,CAAC;AAKjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnD;;GAEG;AACH,qBAAa,UAAU;IACrB;;OAEG;IACI,eAAe,EAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IAE1D;;OAEG;IACI,KAAK,EAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAEtC;;OAEG;IACH,gBAAuB,iBAAiB,EAAE,MAAM,CAAU;IAE1D;;;OAGG;IACH,gBAAuB,cAAc,EAAE,MAAM,CAAS;IAEtD;;OAEG;IACH,gBAAuB,kBAAkB,EAAE,MAAM,CAAS;IAE1D;;;;OAIG;IACH,gBAAuB,oBAAoB,EAAE,MAAM,CAAS;IAE5D;;OAEG;IACH,IAAW,WAAW,IAAI,MAAM,CAE/B;IACD,OAAO,CAAC,YAAY,CAAS;IAE7B;;;;OAIG;IACH,IAAW,qBAAqB,IAAI,MAAM,CAEzC;IAED,IAAW,qBAAqB,CAAC,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AO,CAAC;KACpB;IACD,UAAiB,cAAc;QAC3B;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf;;;;WAIG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf;;WAEG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB;IACD,UAAiB,qBAAqB;QAClC;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KACpB;IACD,UAAiB,+BAA+B;QAC5C;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;WAGG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB;IACD,UAAiB,kCAAkC;QAC/C;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KACpB;IACD,UAAiB,sBAAsB;QACnC;;;WAGG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;KACzB;IACD,UAAiB,oBAAoB;QACjC;;WAEG;QACH,eAAe,CAAC,EAAE,OAAO,CAAC;KAC7B;IACD,UAAiB,cAAc;QAC3B;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KAC3B;IACD,UAAiB,cAAc;QAC3B;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KAC3B;CACF"}
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/ascii/connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAiB,MAAM,MAAM,CAA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BAAqB;QAClC;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KACpB;IACD,UAAiB,+BAA+B;QAC5C;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;WAGG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB;IACD,UAAiB,kCAAkC;QAC/C;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KACpB;IACD,UAAiB,sBAAsB;QACnC;;;WAGG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;KACzB;IACD,UAAiB,oBAAoB;QACjC;;WAEG;QACH,eAAe,CAAC,EAAE,OAAO,CAAC;KAC7B;IACD,UAAiB,cAAc;QAC3B;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KAC3B;IACD,UAAiB,cAAc;QAC3B;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KAC3B;CACF"}
@@ -64,11 +64,17 @@ class Connection {
64
64
  set checksumEnabled(value) {
65
65
  this._changeChecksumEnabled(value);
66
66
  }
67
+ /**
68
+ * Returns whether the connection is open.
69
+ * Does not guarantee that subsequent requests will succeed.
70
+ */
71
+ get isOpen() {
72
+ return this._retrieveIsOpen();
73
+ }
67
74
  constructor(interfaceId) {
68
- this._disconnected = new rxjs_1.ReplaySubject();
69
75
  this._interfaceId = interfaceId;
70
76
  (0, finalizer_1.registerForFinalization)(this, Connection._free.bind(null, interfaceId));
71
- this._subscribe();
77
+ this._subscribe(0);
72
78
  }
73
79
  /**
74
80
  * Opens a serial port, if Zaber Launcher controls the port, the port will be opened through Zaber Launcher.
@@ -185,6 +191,22 @@ class Connection {
185
191
  const response = await gateway.callAsync('interface/open', request, requests.OpenInterfaceResponse.fromBinary);
186
192
  return new Connection(response.interfaceId);
187
193
  }
194
+ /**
195
+ * Reopens the connection.
196
+ * To continue using events on the connection, you must resubscribe to event observables.
197
+ * Throws an exception if the connection is already open.
198
+ */
199
+ async reopen() {
200
+ const request = {
201
+ ...requests.InterfaceEmptyRequest.DEFAULT,
202
+ interfaceId: this.interfaceId,
203
+ toBinary() {
204
+ return requests.InterfaceEmptyRequest.toBinary(this);
205
+ },
206
+ };
207
+ const response = await gateway.callAsync('interface/reopen', request, requests.IntResponse.fromBinary);
208
+ this._subscribe(response.value);
209
+ }
188
210
  /**
189
211
  * Sends a generic ASCII command to this connection.
190
212
  * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
@@ -503,6 +525,21 @@ class Connection {
503
525
  };
504
526
  gateway.callSync('interface/set_checksum_enabled', request);
505
527
  }
528
+ /**
529
+ * Returns is open.
530
+ * @returns Is open.
531
+ */
532
+ _retrieveIsOpen() {
533
+ const request = {
534
+ ...requests.InterfaceEmptyRequest.DEFAULT,
535
+ interfaceId: this.interfaceId,
536
+ toBinary() {
537
+ return requests.InterfaceEmptyRequest.toBinary(this);
538
+ },
539
+ };
540
+ const response = gateway.callSync('interface/get_is_open', request, requests.BoolResponse.fromBinary);
541
+ return response.value;
542
+ }
506
543
  /**
507
544
  * Releases native resources of the connection.
508
545
  * @param interfaceId The ID of the connection.
@@ -523,10 +560,12 @@ class Connection {
523
560
  get disconnected() {
524
561
  return this._disconnected;
525
562
  }
526
- _subscribe() {
527
- this.unknownResponse = gateway_1.events.pipe((0, operators_1.takeUntil)(this._disconnected), (0, gateway_1.filterEvent)('interface/unknown_response'), (0, operators_1.filter)(event => event.interfaceId === this.interfaceId), (0, operators_1.map)(event => event.unknownResponse));
528
- this.alert = gateway_1.events.pipe((0, operators_1.takeUntil)(this._disconnected), (0, gateway_1.filterEvent)('interface/alert'), (0, operators_1.filter)(event => event.interfaceId === this.interfaceId), (0, operators_1.map)(event => event.alert));
529
- gateway_1.events.pipe((0, gateway_1.filterEvent)('interface/disconnected'), (0, operators_1.filter)(event => event.interfaceId === this.interfaceId), (0, operators_1.take)(1), (0, operators_1.map)(({ errorMessage, errorType }) => gateway.convertToException(errorType, errorMessage))).subscribe(this._disconnected);
563
+ _subscribe(sessionId) {
564
+ this._disconnected = new rxjs_1.ReplaySubject();
565
+ const filterLocalEvent = (event) => event.interfaceId === this.interfaceId && event.sessionId === sessionId;
566
+ this.unknownResponse = gateway_1.events.pipe((0, operators_1.takeUntil)(this._disconnected), (0, gateway_1.filterEvent)('interface/unknown_response'), (0, operators_1.filter)(filterLocalEvent), (0, operators_1.map)(event => event.unknownResponse));
567
+ this.alert = gateway_1.events.pipe((0, operators_1.takeUntil)(this._disconnected), (0, gateway_1.filterEvent)('interface/alert'), (0, operators_1.filter)(filterLocalEvent), (0, operators_1.map)(event => event.alert));
568
+ gateway_1.events.pipe((0, gateway_1.filterEvent)('interface/disconnected'), (0, operators_1.filter)(filterLocalEvent), (0, operators_1.take)(1), (0, operators_1.map)(({ errorMessage, errorType }) => gateway.convertToException(errorType, errorMessage))).subscribe(this._disconnected);
530
569
  }
531
570
  /**
532
571
  * Releases the native resources of the connection.
@@ -1 +1 @@
1
- {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/ascii/connection.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,+BAAiD;AACjD,8CAA8D;AAC9D,oDAAsC;AACtC,wCAAiD;AACjD,sDAAwC;AAExC,qCAAkC;AAClC,yCAAsC;AAItC,4CAAuD;AAEvD;;GAEG;AACH,MAAa,UAAU;IAkCrB;;OAEG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,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A+sBC;AApsBC;;GAEG;AACoB,4BAAiB,GAAW,MAAM,AAAjB,CAAkB;AAE1D;;;GAGG;AACoB,yBAAc,GAAW,KAAK,AAAhB,CAAiB;AAEtD;;GAEG;AACoB,6BAAkB,GAAW,KAAK,AAAhB,CAAiB;AAE1D;;;;GAIG;AACoB,+BAAoB,GAAW,KAAK,AAAhB,CAAiB","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Observable, ReplaySubject } from 'rxjs';\nimport { map, filter, takeUntil, take } from 'rxjs/operators';\nimport * as gateway from '../gateway';\nimport { events, filterEvent } from '../gateway';\nimport * as requests from '../requests';\nimport { Transport } from './transport';\nimport { Device } from './device';\nimport { Response } from './response';\nimport { UnknownResponseEvent } from './unknown_response_event';\nimport { AlertEvent } from './alert_event';\nimport { MotionLibException } from '../exceptions';\nimport { registerForFinalization } from '../finalizer';\n\n/**\n * Class representing access to particular connection (serial port, TCP connection).\n */\nexport class Connection {\n /**\n * Event invoked when a response from a device cannot be matched to any known request.\n */\n public unknownResponse!: Observable<UnknownResponseEvent>;\n\n /**\n * Event invoked when an alert is received from a device.\n */\n public alert!: Observable<AlertEvent>;\n\n /**\n * Default baud rate for serial connections.\n */\n public static readonly DEFAULT_BAUD_RATE: number = 115200;\n\n /**\n * Commands sent over this port are forwarded to the device chain.\n * The bandwidth may be limited as the commands are forwarded over a serial connection.\n */\n public static readonly TCP_PORT_CHAIN: number = 55550;\n\n /**\n * Local area network share port.\n */\n public static readonly NETWORK_SHARE_PORT: number = 11421;\n\n /**\n * Commands send over this port are processed only by the device\n * and not forwarded to the rest of the chain.\n * Using this port typically makes the communication faster.\n */\n public static readonly TCP_PORT_DEVICE_ONLY: number = 55551;\n\n /**\n * The interface ID identifies this Connection instance with the underlying library.\n */\n public get interfaceId(): number {\n return this._interfaceId;\n }\n private _interfaceId: number;\n\n /**\n * The default timeout, in milliseconds, for a device to respond to a request.\n * Setting the timeout to a too low value may cause request timeout exceptions.\n * The initial value is 1000 (one second).\n */\n public get defaultRequestTimeout(): number {\n return this._retrieveTimeout();\n }\n\n public set defaultRequestTimeout(value: number) {\n this._changeTimeout(value);\n }\n\n /**\n * Controls whether outgoing messages contain checksum.\n */\n public get checksumEnabled(): boolean {\n return this._retrieveChecksumEnabled();\n }\n\n public set checksumEnabled(value: boolean) {\n this._changeChecksumEnabled(value);\n }\n\n constructor(interfaceId: number) {\n this._interfaceId = interfaceId;\n registerForFinalization(this, Connection._free.bind(null, interfaceId));\n this._subscribe();\n }\n\n /**\n * Opens a serial port, if Zaber Launcher controls the port, the port will be opened through Zaber Launcher.\n * Zaber Launcher allows sharing of the port between multiple applications,\n * If port sharing is not desirable, use the `direct` parameter.\n * @param portName Name of the port to open.\n * @param [options.baudRate=Connection.DEFAULT_BAUD_RATE] Optional baud rate (defaults to 115200).\n * @param [options.direct=false] If true will connect to the serial port directly,\n * failing if the connection is already opened by a message router instance.\n * @returns An object representing the port.\n */\n public static async openSerialPort(\n portName: string,\n options: Connection.OpenSerialPortOptions = {}\n ): Promise<Connection> {\n const {\n baudRate = Connection.DEFAULT_BAUD_RATE,\n direct = false,\n } = options;\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.SERIAL_PORT,\n portName: portName,\n baudRate: baudRate,\n rejectRoutedConnection: direct,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a TCP connection.\n * @param hostName Hostname or IP address.\n * @param [port=Connection.TCP_PORT_CHAIN] Optional port number (defaults to 55550).\n * @returns An object representing the connection.\n */\n public static async openTcp(\n hostName: string,\n port: number = Connection.TCP_PORT_CHAIN\n ): Promise<Connection> {\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.TCP,\n hostName: hostName,\n port: port,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a connection using a custom transport.\n * @param transport The custom connection transport.\n * @returns An object representing the connection.\n */\n public static async openCustom(\n transport: Transport\n ): Promise<Connection> {\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.CUSTOM,\n transport: transport.transportId,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a secured connection to a cloud connected device chain.\n * Use this method to connect to devices on your account.\n * @param cloudId The cloud ID to connect to.\n * @param [options.token='unauthenticated'] The token to authenticate with. By default the connection will be unauthenticated.\n * @param options.connectionName The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n * @param options.realm The realm to connect to.\n * Can be left empty for the default account realm.\n * @param [options.api='https://api.zaber.io'] The URL of the API to receive connection info from.\n * @returns An object representing the connection.\n */\n public static async openIot(\n cloudId: string,\n options: Connection.OpenIotOptions = {}\n ): Promise<Connection> {\n const {\n token = 'unauthenticated',\n connectionName,\n realm,\n api = 'https://api.zaber.io',\n } = options;\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.IOT,\n cloudId: cloudId,\n token: token,\n connectionName: connectionName,\n realm: realm,\n api: api,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a connection to Zaber Launcher in your Local Area Network.\n * The connection is not secured.\n * @param hostName Hostname or IP address.\n * @param [port=Connection.NETWORK_SHARE_PORT] Port number.\n * @param connectionName The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n * @returns An object representing the connection.\n */\n public static async openNetworkShare(\n hostName: string,\n port: number = Connection.NETWORK_SHARE_PORT,\n connectionName?: string\n ): Promise<Connection> {\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.NETWORK_SHARE,\n hostName: hostName,\n port: port,\n connectionName: connectionName,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Sends a generic ASCII command to this connection.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * @param [options.axis=0] Optional axis number to send the command to.\n * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns A response to the command.\n */\n public async genericCommand(\n command: string,\n options: Connection.GenericCommandOptions = {}\n ): Promise<Response> {\n const {\n device = 0,\n axis = 0,\n checkErrors = true,\n timeout = 0,\n } = options;\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n checkErrors: checkErrors,\n timeout: timeout,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<Response>(\n 'interface/generic_command',\n request,\n Response.fromBinary);\n return response;\n }\n\n /**\n * Sends a generic ASCII command to this connection without expecting a response and without adding a message ID.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * Specifying -1 omits the number completely.\n * @param [options.axis=0] Optional axis number to send the command to.\n * Specifying -1 omits the number completely.\n */\n public async genericCommandNoResponse(\n command: string,\n options: Connection.GenericCommandNoResponseOptions = {}\n ): Promise<void> {\n const {\n device = 0,\n axis = 0,\n } = options;\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Sends a generic ASCII command to this connection and expect multiple responses,\n * either from one device or from many devices.\n * Responses are returned in order of arrival.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * @param [options.axis=0] Optional axis number to send the command to.\n * @param [options.checkErrors=true] Controls whether to throw an exception when a device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns All responses to the command.\n */\n public async genericCommandMultiResponse(\n command: string,\n options: Connection.GenericCommandMultiResponseOptions = {}\n ): Promise<Response[]> {\n const {\n device = 0,\n axis = 0,\n checkErrors = true,\n timeout = 0,\n } = options;\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n checkErrors: checkErrors,\n timeout: timeout,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.GenericCommandResponseCollection>(\n 'interface/generic_command_multi_response',\n request,\n requests.GenericCommandResponseCollection.fromBinary);\n return response.responses;\n }\n\n /**\n * Enables alerts for all devices on the connection.\n * This will change the \"comm.alert\" setting to 1 on all supported devices.\n */\n public async enableAlerts(): Promise<void> {\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: 'set comm.alert 1',\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Disables alerts for all devices on the connection.\n * This will change the \"comm.alert\" setting to 0 on all supported devices.\n */\n public async disableAlerts(): Promise<void> {\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: 'set comm.alert 0',\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Resets ASCII protocol message IDs. Only for testing purposes.\n */\n public resetIds(): void {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/reset_ids', request);\n }\n\n /**\n * Close the connection.\n */\n public async close(): Promise<void> {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/close', request);\n }\n\n /**\n * Gets a Device class instance which allows you to control a particular device on this connection.\n * Devices are numbered from 1.\n * @param deviceAddress Address of device intended to control. Address is configured for each device.\n * @returns Device instance.\n */\n public getDevice(\n deviceAddress: number\n ): Device {\n if (deviceAddress <= 0) {\n throw new TypeError('Invalid value; physical devices are numbered from 1.');\n }\n return new Device(this, deviceAddress);\n }\n\n /**\n * Renumbers devices present on this connection. After renumbering, devices need to be identified again.\n * @param [options.firstAddress=1] This is the address that the device closest to the computer is given.\n * Remaining devices are numbered consecutively.\n * @returns Total number of devices that responded to the renumber.\n */\n public async renumberDevices(\n options: Connection.RenumberDevicesOptions = {}\n ): Promise<number> {\n const {\n firstAddress = 1,\n } = options;\n if (firstAddress <= 0) {\n throw new TypeError('Invalid value; device addresses are numbered from 1.');\n }\n const request: requests.RenumberRequest & gateway.Message = {\n ...requests.RenumberRequest.DEFAULT,\n interfaceId: this.interfaceId,\n address: firstAddress,\n toBinary() {\n return requests.RenumberRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.IntResponse>(\n 'device/renumber_all',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Attempts to detect any devices present on this connection.\n * @param [options.identifyDevices=true] Determines whether device identification should be performed as well.\n * @returns Array of detected devices.\n */\n public async detectDevices(\n options: Connection.DetectDevicesOptions = {}\n ): Promise<Device[]> {\n const {\n identifyDevices = true,\n } = options;\n const request: requests.DeviceDetectRequest & gateway.Message = {\n ...requests.DeviceDetectRequest.DEFAULT,\n interfaceId: this.interfaceId,\n identifyDevices: identifyDevices,\n toBinary() {\n return requests.DeviceDetectRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceDetectResponse>(\n 'device/detect',\n request,\n requests.DeviceDetectResponse.fromBinary);\n return response.devices.map(deviceAddress => this.getDevice(deviceAddress));\n }\n\n /**\n * Forgets all the information associated with devices on the connection.\n * Useful when devices are removed from the chain indefinitely.\n * @param [exceptDevices=[]] Addresses of devices that should not be forgotten.\n */\n public forgetDevices(\n exceptDevices: number[] = []\n ): void {\n const request: requests.ForgetDevicesRequest & gateway.Message = {\n ...requests.ForgetDevicesRequest.DEFAULT,\n interfaceId: this.interfaceId,\n exceptDevices: exceptDevices,\n toBinary() {\n return requests.ForgetDevicesRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device/forget', request);\n }\n\n /**\n * Stops all of the devices on this connection.\n * @param [options.waitUntilIdle=true] Determines whether the function should return immediately\n * or wait until the devices are stopped.\n * @returns The addresses of the devices that were stopped by this command.\n */\n public async stopAll(\n options: Connection.StopAllOptions = {}\n ): Promise<number[]> {\n const {\n waitUntilIdle = true,\n } = options;\n const request: requests.DeviceOnAllRequest & gateway.Message = {\n ...requests.DeviceOnAllRequest.DEFAULT,\n interfaceId: this.interfaceId,\n waitUntilIdle: waitUntilIdle,\n toBinary() {\n return requests.DeviceOnAllRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceOnAllResponse>(\n 'device/stop_all',\n request,\n requests.DeviceOnAllResponse.fromBinary);\n return response.deviceAddresses;\n }\n\n /**\n * Homes all of the devices on this connection.\n * @param [options.waitUntilIdle=true] Determines whether the function should return immediately\n * or wait until the devices are homed.\n * @returns The addresses of the devices that were homed by this command.\n */\n public async homeAll(\n options: Connection.HomeAllOptions = {}\n ): Promise<number[]> {\n const {\n waitUntilIdle = true,\n } = options;\n const request: requests.DeviceOnAllRequest & gateway.Message = {\n ...requests.DeviceOnAllRequest.DEFAULT,\n interfaceId: this.interfaceId,\n waitUntilIdle: waitUntilIdle,\n toBinary() {\n return requests.DeviceOnAllRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceOnAllResponse>(\n 'device/home_all',\n request,\n requests.DeviceOnAllResponse.fromBinary);\n return response.deviceAddresses;\n }\n\n /**\n * Returns a string that represents the connection.\n * @returns A string that represents the connection.\n */\n public toString(): string {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.StringResponse>(\n 'interface/to_string',\n request,\n requests.StringResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Returns default request timeout.\n * @returns Default request timeout.\n */\n private _retrieveTimeout(): number {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.IntResponse>(\n 'interface/get_timeout',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Sets default request timeout.\n * @param timeout Default request timeout.\n */\n private _changeTimeout(\n timeout: number\n ): void {\n const request: requests.SetInterfaceTimeoutRequest & gateway.Message = {\n ...requests.SetInterfaceTimeoutRequest.DEFAULT,\n interfaceId: this.interfaceId,\n timeout: timeout,\n toBinary() {\n return requests.SetInterfaceTimeoutRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/set_timeout', request);\n }\n\n /**\n * Returns checksum enabled.\n * @returns Checksum enabled.\n */\n private _retrieveChecksumEnabled(): boolean {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.BoolResponse>(\n 'interface/get_checksum_enabled',\n request,\n requests.BoolResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Sets checksum enabled.\n * @param isEnabled Checksum enabled.\n */\n private _changeChecksumEnabled(\n isEnabled: boolean\n ): void {\n const request: requests.SetInterfaceChecksumEnabledRequest & gateway.Message = {\n ...requests.SetInterfaceChecksumEnabledRequest.DEFAULT,\n interfaceId: this.interfaceId,\n isEnabled: isEnabled,\n toBinary() {\n return requests.SetInterfaceChecksumEnabledRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/set_checksum_enabled', request);\n }\n\n /**\n * Releases native resources of the connection.\n * @param interfaceId The ID of the connection.\n */\n private static _free(\n interfaceId: number\n ): void {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/free', request);\n }\n\n private _disconnected = new ReplaySubject<MotionLibException>();\n\n /**\n * Event invoked when connection is interrupted or closed.\n */\n public get disconnected(): Observable<MotionLibException> {\n return this._disconnected;\n }\n\n private _subscribe(): void {\n this.unknownResponse = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.UnknownResponseEventWrapper>('interface/unknown_response'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.unknownResponse)\n );\n\n this.alert = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.AlertEventWrapper>('interface/alert'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.alert)\n );\n\n events.pipe(\n filterEvent<requests.DisconnectedEvent>('interface/disconnected'),\n filter(event => event.interfaceId === this.interfaceId),\n take(1),\n map(({ errorMessage, errorType }) => gateway.convertToException(errorType, errorMessage))\n ).subscribe(this._disconnected);\n }\n\n /**\n * Releases the native resources of the connection.\n * Should only be called if your environment does not support FinalizationRegistry.\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry\n */\n public free(): void {\n Connection._free(this.interfaceId);\n }\n}\n\nnamespace Connection {\n export interface OpenSerialPortOptions {\n /**\n * Optional baud rate (defaults to 115200).\n */\n baudRate?: number;\n /**\n * If true will connect to the serial port directly,\n * failing if the connection is already opened by a message router instance.\n */\n direct?: boolean;\n }\n export interface OpenIotOptions {\n /**\n * The token to authenticate with. By default the connection will be unauthenticated.\n */\n token?: string;\n /**\n * The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n */\n connectionName?: string;\n /**\n * The realm to connect to.\n * Can be left empty for the default account realm.\n */\n realm?: string;\n /**\n * The URL of the API to receive connection info from.\n */\n api?: string;\n }\n export interface GenericCommandOptions {\n /**\n * Optional device address to send the command to.\n */\n device?: number;\n /**\n * Optional axis number to send the command to.\n */\n axis?: number;\n /**\n * Controls whether to throw an exception when the device rejects the command.\n */\n checkErrors?: boolean;\n /**\n * The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n */\n timeout?: number;\n }\n export interface GenericCommandNoResponseOptions {\n /**\n * Optional device address to send the command to.\n * Specifying -1 omits the number completely.\n */\n device?: number;\n /**\n * Optional axis number to send the command to.\n * Specifying -1 omits the number completely.\n */\n axis?: number;\n }\n export interface GenericCommandMultiResponseOptions {\n /**\n * Optional device address to send the command to.\n */\n device?: number;\n /**\n * Optional axis number to send the command to.\n */\n axis?: number;\n /**\n * Controls whether to throw an exception when a device rejects the command.\n */\n checkErrors?: boolean;\n /**\n * The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n */\n timeout?: number;\n }\n export interface RenumberDevicesOptions {\n /**\n * This is the address that the device closest to the computer is given.\n * Remaining devices are numbered consecutively.\n */\n firstAddress?: number;\n }\n export interface DetectDevicesOptions {\n /**\n * Determines whether device identification should be performed as well.\n */\n identifyDevices?: boolean;\n }\n export interface StopAllOptions {\n /**\n * Determines whether the function should return immediately\n * or wait until the devices are stopped.\n */\n waitUntilIdle?: boolean;\n }\n export interface HomeAllOptions {\n /**\n * Determines whether the function should return immediately\n * or wait until the devices are homed.\n */\n waitUntilIdle?: boolean;\n }\n}\n"]}
1
+ {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/ascii/connection.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,+BAAiD;AACjD,8CAA8D;AAC9D,oDAAsC;AACtC,wCAAiD;AACjD,sDAAwC;AAExC,qCAAkC;AAClC,yCAAsC;AAItC,4CAAuD;AAEvD;;GAEG;AACH,MAAa,UAAU;IAkCrB;;OAEG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,C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= //\n\nimport { Observable, ReplaySubject } from 'rxjs';\nimport { map, filter, takeUntil, take } from 'rxjs/operators';\nimport * as gateway from '../gateway';\nimport { events, filterEvent } from '../gateway';\nimport * as requests from '../requests';\nimport { Transport } from './transport';\nimport { Device } from './device';\nimport { Response } from './response';\nimport { UnknownResponseEvent } from './unknown_response_event';\nimport { AlertEvent } from './alert_event';\nimport { MotionLibException } from '../exceptions';\nimport { registerForFinalization } from '../finalizer';\n\n/**\n * Class representing access to particular connection (serial port, TCP connection).\n */\nexport class Connection {\n /**\n * Event invoked when a response from a device cannot be matched to any known request.\n */\n public unknownResponse!: Observable<UnknownResponseEvent>;\n\n /**\n * Event invoked when an alert is received from a device.\n */\n public alert!: Observable<AlertEvent>;\n\n /**\n * Default baud rate for serial connections.\n */\n public static readonly DEFAULT_BAUD_RATE: number = 115200;\n\n /**\n * Commands sent over this port are forwarded to the device chain.\n * The bandwidth may be limited as the commands are forwarded over a serial connection.\n */\n public static readonly TCP_PORT_CHAIN: number = 55550;\n\n /**\n * Local area network share port.\n */\n public static readonly NETWORK_SHARE_PORT: number = 11421;\n\n /**\n * Commands send over this port are processed only by the device\n * and not forwarded to the rest of the chain.\n * Using this port typically makes the communication faster.\n */\n public static readonly TCP_PORT_DEVICE_ONLY: number = 55551;\n\n /**\n * The interface ID identifies this Connection instance with the underlying library.\n */\n public get interfaceId(): number {\n return this._interfaceId;\n }\n private _interfaceId: number;\n\n /**\n * The default timeout, in milliseconds, for a device to respond to a request.\n * Setting the timeout to a too low value may cause request timeout exceptions.\n * The initial value is 1000 (one second).\n */\n public get defaultRequestTimeout(): number {\n return this._retrieveTimeout();\n }\n\n public set defaultRequestTimeout(value: number) {\n this._changeTimeout(value);\n }\n\n /**\n * Controls whether outgoing messages contain checksum.\n */\n public get checksumEnabled(): boolean {\n return this._retrieveChecksumEnabled();\n }\n\n public set checksumEnabled(value: boolean) {\n this._changeChecksumEnabled(value);\n }\n\n /**\n * Returns whether the connection is open.\n * Does not guarantee that subsequent requests will succeed.\n */\n public get isOpen(): boolean {\n return this._retrieveIsOpen();\n }\n\n constructor(interfaceId: number) {\n this._interfaceId = interfaceId;\n registerForFinalization(this, Connection._free.bind(null, interfaceId));\n this._subscribe(0);\n }\n\n /**\n * Opens a serial port, if Zaber Launcher controls the port, the port will be opened through Zaber Launcher.\n * Zaber Launcher allows sharing of the port between multiple applications,\n * If port sharing is not desirable, use the `direct` parameter.\n * @param portName Name of the port to open.\n * @param [options.baudRate=Connection.DEFAULT_BAUD_RATE] Optional baud rate (defaults to 115200).\n * @param [options.direct=false] If true will connect to the serial port directly,\n * failing if the connection is already opened by a message router instance.\n * @returns An object representing the port.\n */\n public static async openSerialPort(\n portName: string,\n options: Connection.OpenSerialPortOptions = {}\n ): Promise<Connection> {\n const {\n baudRate = Connection.DEFAULT_BAUD_RATE,\n direct = false,\n } = options;\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.SERIAL_PORT,\n portName: portName,\n baudRate: baudRate,\n rejectRoutedConnection: direct,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a TCP connection.\n * @param hostName Hostname or IP address.\n * @param [port=Connection.TCP_PORT_CHAIN] Optional port number (defaults to 55550).\n * @returns An object representing the connection.\n */\n public static async openTcp(\n hostName: string,\n port: number = Connection.TCP_PORT_CHAIN\n ): Promise<Connection> {\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.TCP,\n hostName: hostName,\n port: port,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a connection using a custom transport.\n * @param transport The custom connection transport.\n * @returns An object representing the connection.\n */\n public static async openCustom(\n transport: Transport\n ): Promise<Connection> {\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.CUSTOM,\n transport: transport.transportId,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a secured connection to a cloud connected device chain.\n * Use this method to connect to devices on your account.\n * @param cloudId The cloud ID to connect to.\n * @param [options.token='unauthenticated'] The token to authenticate with. By default the connection will be unauthenticated.\n * @param options.connectionName The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n * @param options.realm The realm to connect to.\n * Can be left empty for the default account realm.\n * @param [options.api='https://api.zaber.io'] The URL of the API to receive connection info from.\n * @returns An object representing the connection.\n */\n public static async openIot(\n cloudId: string,\n options: Connection.OpenIotOptions = {}\n ): Promise<Connection> {\n const {\n token = 'unauthenticated',\n connectionName,\n realm,\n api = 'https://api.zaber.io',\n } = options;\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.IOT,\n cloudId: cloudId,\n token: token,\n connectionName: connectionName,\n realm: realm,\n api: api,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a connection to Zaber Launcher in your Local Area Network.\n * The connection is not secured.\n * @param hostName Hostname or IP address.\n * @param [port=Connection.NETWORK_SHARE_PORT] Port number.\n * @param connectionName The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n * @returns An object representing the connection.\n */\n public static async openNetworkShare(\n hostName: string,\n port: number = Connection.NETWORK_SHARE_PORT,\n connectionName?: string\n ): Promise<Connection> {\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.NETWORK_SHARE,\n hostName: hostName,\n port: port,\n connectionName: connectionName,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Reopens the connection.\n * To continue using events on the connection, you must resubscribe to event observables.\n * Throws an exception if the connection is already open.\n */\n public async reopen(): Promise<void> {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.IntResponse>(\n 'interface/reopen',\n request,\n requests.IntResponse.fromBinary);\n this._subscribe(response.value);\n }\n\n /**\n * Sends a generic ASCII command to this connection.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * @param [options.axis=0] Optional axis number to send the command to.\n * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns A response to the command.\n */\n public async genericCommand(\n command: string,\n options: Connection.GenericCommandOptions = {}\n ): Promise<Response> {\n const {\n device = 0,\n axis = 0,\n checkErrors = true,\n timeout = 0,\n } = options;\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n checkErrors: checkErrors,\n timeout: timeout,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<Response>(\n 'interface/generic_command',\n request,\n Response.fromBinary);\n return response;\n }\n\n /**\n * Sends a generic ASCII command to this connection without expecting a response and without adding a message ID.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * Specifying -1 omits the number completely.\n * @param [options.axis=0] Optional axis number to send the command to.\n * Specifying -1 omits the number completely.\n */\n public async genericCommandNoResponse(\n command: string,\n options: Connection.GenericCommandNoResponseOptions = {}\n ): Promise<void> {\n const {\n device = 0,\n axis = 0,\n } = options;\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Sends a generic ASCII command to this connection and expect multiple responses,\n * either from one device or from many devices.\n * Responses are returned in order of arrival.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * @param [options.axis=0] Optional axis number to send the command to.\n * @param [options.checkErrors=true] Controls whether to throw an exception when a device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns All responses to the command.\n */\n public async genericCommandMultiResponse(\n command: string,\n options: Connection.GenericCommandMultiResponseOptions = {}\n ): Promise<Response[]> {\n const {\n device = 0,\n axis = 0,\n checkErrors = true,\n timeout = 0,\n } = options;\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n checkErrors: checkErrors,\n timeout: timeout,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.GenericCommandResponseCollection>(\n 'interface/generic_command_multi_response',\n request,\n requests.GenericCommandResponseCollection.fromBinary);\n return response.responses;\n }\n\n /**\n * Enables alerts for all devices on the connection.\n * This will change the \"comm.alert\" setting to 1 on all supported devices.\n */\n public async enableAlerts(): Promise<void> {\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: 'set comm.alert 1',\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Disables alerts for all devices on the connection.\n * This will change the \"comm.alert\" setting to 0 on all supported devices.\n */\n public async disableAlerts(): Promise<void> {\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: 'set comm.alert 0',\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Resets ASCII protocol message IDs. Only for testing purposes.\n */\n public resetIds(): void {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/reset_ids', request);\n }\n\n /**\n * Close the connection.\n */\n public async close(): Promise<void> {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/close', request);\n }\n\n /**\n * Gets a Device class instance which allows you to control a particular device on this connection.\n * Devices are numbered from 1.\n * @param deviceAddress Address of device intended to control. Address is configured for each device.\n * @returns Device instance.\n */\n public getDevice(\n deviceAddress: number\n ): Device {\n if (deviceAddress <= 0) {\n throw new TypeError('Invalid value; physical devices are numbered from 1.');\n }\n return new Device(this, deviceAddress);\n }\n\n /**\n * Renumbers devices present on this connection. After renumbering, devices need to be identified again.\n * @param [options.firstAddress=1] This is the address that the device closest to the computer is given.\n * Remaining devices are numbered consecutively.\n * @returns Total number of devices that responded to the renumber.\n */\n public async renumberDevices(\n options: Connection.RenumberDevicesOptions = {}\n ): Promise<number> {\n const {\n firstAddress = 1,\n } = options;\n if (firstAddress <= 0) {\n throw new TypeError('Invalid value; device addresses are numbered from 1.');\n }\n const request: requests.RenumberRequest & gateway.Message = {\n ...requests.RenumberRequest.DEFAULT,\n interfaceId: this.interfaceId,\n address: firstAddress,\n toBinary() {\n return requests.RenumberRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.IntResponse>(\n 'device/renumber_all',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Attempts to detect any devices present on this connection.\n * @param [options.identifyDevices=true] Determines whether device identification should be performed as well.\n * @returns Array of detected devices.\n */\n public async detectDevices(\n options: Connection.DetectDevicesOptions = {}\n ): Promise<Device[]> {\n const {\n identifyDevices = true,\n } = options;\n const request: requests.DeviceDetectRequest & gateway.Message = {\n ...requests.DeviceDetectRequest.DEFAULT,\n interfaceId: this.interfaceId,\n identifyDevices: identifyDevices,\n toBinary() {\n return requests.DeviceDetectRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceDetectResponse>(\n 'device/detect',\n request,\n requests.DeviceDetectResponse.fromBinary);\n return response.devices.map(deviceAddress => this.getDevice(deviceAddress));\n }\n\n /**\n * Forgets all the information associated with devices on the connection.\n * Useful when devices are removed from the chain indefinitely.\n * @param [exceptDevices=[]] Addresses of devices that should not be forgotten.\n */\n public forgetDevices(\n exceptDevices: number[] = []\n ): void {\n const request: requests.ForgetDevicesRequest & gateway.Message = {\n ...requests.ForgetDevicesRequest.DEFAULT,\n interfaceId: this.interfaceId,\n exceptDevices: exceptDevices,\n toBinary() {\n return requests.ForgetDevicesRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device/forget', request);\n }\n\n /**\n * Stops all of the devices on this connection.\n * @param [options.waitUntilIdle=true] Determines whether the function should return immediately\n * or wait until the devices are stopped.\n * @returns The addresses of the devices that were stopped by this command.\n */\n public async stopAll(\n options: Connection.StopAllOptions = {}\n ): Promise<number[]> {\n const {\n waitUntilIdle = true,\n } = options;\n const request: requests.DeviceOnAllRequest & gateway.Message = {\n ...requests.DeviceOnAllRequest.DEFAULT,\n interfaceId: this.interfaceId,\n waitUntilIdle: waitUntilIdle,\n toBinary() {\n return requests.DeviceOnAllRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceOnAllResponse>(\n 'device/stop_all',\n request,\n requests.DeviceOnAllResponse.fromBinary);\n return response.deviceAddresses;\n }\n\n /**\n * Homes all of the devices on this connection.\n * @param [options.waitUntilIdle=true] Determines whether the function should return immediately\n * or wait until the devices are homed.\n * @returns The addresses of the devices that were homed by this command.\n */\n public async homeAll(\n options: Connection.HomeAllOptions = {}\n ): Promise<number[]> {\n const {\n waitUntilIdle = true,\n } = options;\n const request: requests.DeviceOnAllRequest & gateway.Message = {\n ...requests.DeviceOnAllRequest.DEFAULT,\n interfaceId: this.interfaceId,\n waitUntilIdle: waitUntilIdle,\n toBinary() {\n return requests.DeviceOnAllRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceOnAllResponse>(\n 'device/home_all',\n request,\n requests.DeviceOnAllResponse.fromBinary);\n return response.deviceAddresses;\n }\n\n /**\n * Returns a string that represents the connection.\n * @returns A string that represents the connection.\n */\n public toString(): string {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.StringResponse>(\n 'interface/to_string',\n request,\n requests.StringResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Returns default request timeout.\n * @returns Default request timeout.\n */\n private _retrieveTimeout(): number {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.IntResponse>(\n 'interface/get_timeout',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Sets default request timeout.\n * @param timeout Default request timeout.\n */\n private _changeTimeout(\n timeout: number\n ): void {\n const request: requests.SetInterfaceTimeoutRequest & gateway.Message = {\n ...requests.SetInterfaceTimeoutRequest.DEFAULT,\n interfaceId: this.interfaceId,\n timeout: timeout,\n toBinary() {\n return requests.SetInterfaceTimeoutRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/set_timeout', request);\n }\n\n /**\n * Returns checksum enabled.\n * @returns Checksum enabled.\n */\n private _retrieveChecksumEnabled(): boolean {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.BoolResponse>(\n 'interface/get_checksum_enabled',\n request,\n requests.BoolResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Sets checksum enabled.\n * @param isEnabled Checksum enabled.\n */\n private _changeChecksumEnabled(\n isEnabled: boolean\n ): void {\n const request: requests.SetInterfaceChecksumEnabledRequest & gateway.Message = {\n ...requests.SetInterfaceChecksumEnabledRequest.DEFAULT,\n interfaceId: this.interfaceId,\n isEnabled: isEnabled,\n toBinary() {\n return requests.SetInterfaceChecksumEnabledRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/set_checksum_enabled', request);\n }\n\n /**\n * Returns is open.\n * @returns Is open.\n */\n private _retrieveIsOpen(): boolean {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.BoolResponse>(\n 'interface/get_is_open',\n request,\n requests.BoolResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Releases native resources of the connection.\n * @param interfaceId The ID of the connection.\n */\n private static _free(\n interfaceId: number\n ): void {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/free', request);\n }\n\n private _disconnected!: ReplaySubject<MotionLibException>;\n\n /**\n * Event invoked when connection is interrupted or closed.\n */\n public get disconnected(): Observable<MotionLibException> {\n return this._disconnected;\n }\n\n private _subscribe(sessionId: number): void {\n this._disconnected = new ReplaySubject<MotionLibException>();\n\n const filterLocalEvent = <TEvent extends { interfaceId: number; sessionId: number }>(event: TEvent): boolean =>\n event.interfaceId === this.interfaceId && event.sessionId === sessionId;\n\n this.unknownResponse = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.UnknownResponseEventWrapper>('interface/unknown_response'),\n filter(filterLocalEvent),\n map(event => event.unknownResponse)\n );\n\n this.alert = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.AlertEventWrapper>('interface/alert'),\n filter(filterLocalEvent),\n map(event => event.alert)\n );\n\n events.pipe(\n filterEvent<requests.DisconnectedEvent>('interface/disconnected'),\n filter(filterLocalEvent),\n take(1),\n map(({ errorMessage, errorType }) => gateway.convertToException(errorType, errorMessage))\n ).subscribe(this._disconnected);\n }\n\n /**\n * Releases the native resources of the connection.\n * Should only be called if your environment does not support FinalizationRegistry.\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry\n */\n public free(): void {\n Connection._free(this.interfaceId);\n }\n}\n\nnamespace Connection {\n export interface OpenSerialPortOptions {\n /**\n * Optional baud rate (defaults to 115200).\n */\n baudRate?: number;\n /**\n * If true will connect to the serial port directly,\n * failing if the connection is already opened by a message router instance.\n */\n direct?: boolean;\n }\n export interface OpenIotOptions {\n /**\n * The token to authenticate with. By default the connection will be unauthenticated.\n */\n token?: string;\n /**\n * The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n */\n connectionName?: string;\n /**\n * The realm to connect to.\n * Can be left empty for the default account realm.\n */\n realm?: string;\n /**\n * The URL of the API to receive connection info from.\n */\n api?: string;\n }\n export interface GenericCommandOptions {\n /**\n * Optional device address to send the command to.\n */\n device?: number;\n /**\n * Optional axis number to send the command to.\n */\n axis?: number;\n /**\n * Controls whether to throw an exception when the device rejects the command.\n */\n checkErrors?: boolean;\n /**\n * The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n */\n timeout?: number;\n }\n export interface GenericCommandNoResponseOptions {\n /**\n * Optional device address to send the command to.\n * Specifying -1 omits the number completely.\n */\n device?: number;\n /**\n * Optional axis number to send the command to.\n * Specifying -1 omits the number completely.\n */\n axis?: number;\n }\n export interface GenericCommandMultiResponseOptions {\n /**\n * Optional device address to send the command to.\n */\n device?: number;\n /**\n * Optional axis number to send the command to.\n */\n axis?: number;\n /**\n * Controls whether to throw an exception when a device rejects the command.\n */\n checkErrors?: boolean;\n /**\n * The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n */\n timeout?: number;\n }\n export interface RenumberDevicesOptions {\n /**\n * This is the address that the device closest to the computer is given.\n * Remaining devices are numbered consecutively.\n */\n firstAddress?: number;\n }\n export interface DetectDevicesOptions {\n /**\n * Determines whether device identification should be performed as well.\n */\n identifyDevices?: boolean;\n }\n export interface StopAllOptions {\n /**\n * Determines whether the function should return immediately\n * or wait until the devices are stopped.\n */\n waitUntilIdle?: boolean;\n }\n export interface HomeAllOptions {\n /**\n * Determines whether the function should return immediately\n * or wait until the devices are homed.\n */\n waitUntilIdle?: boolean;\n }\n}\n"]}
@@ -26,6 +26,11 @@ export declare class Connection {
26
26
  */
27
27
  get interfaceId(): number;
28
28
  private _interfaceId;
29
+ /**
30
+ * Returns whether the connection is open.
31
+ * Does not guarantee that the subsequent requests will succeed.
32
+ */
33
+ get isOpen(): boolean;
29
34
  constructor(interfaceId: number);
30
35
  /**
31
36
  * Opens a serial port.
@@ -100,6 +105,11 @@ export declare class Connection {
100
105
  * @returns Device instance.
101
106
  */
102
107
  getDevice(deviceAddress: number): Device;
108
+ /**
109
+ * Returns is open.
110
+ * @returns Is open.
111
+ */
112
+ private _retrieveIsOpen;
103
113
  /**
104
114
  * Returns a string that represents the connection.
105
115
  * @returns A string that represents the connection.
@@ -1 +1 @@
1
- {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/binary/connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAiB,MAAM,MAAM,CAAC;AAKjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnD;;GAEG;AACH,qBAAa,UAAU;IACrB;;OAEG;IACI,eAAe,EAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IAE1D;;OAEG;IACI,SAAS,EAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAE9C;;OAEG;IACH,gBAAuB,iBAAiB,EAAE,MAAM,CAAQ;IAExD;;OAEG;IACH,I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C;IAoBpB;;;;;OAKG;IACI,SAAS,CACd,aAAa,EAAE,MAAM,GACpB,MAAM;IAOT;;;OAGG;IACH,OAAO,CAAC,eAAe;IAgBvB;;;OAGG;IACI,QAAQ,IAAI,MAAM;IAgBzB;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,KAAK;IAcpB,OAAO,CAAC,aAAa,CAAqC;IAE1D;;OAEG;IACH,IAAW,YAAY,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAExD;IAED,OAAO,CAAC,UAAU;IAyBlB;;;;OAIG;IACI,IAAI,IAAI,IAAI;CAGpB;AAED,kBAAU,UAAU,CAAC;IACnB,UAAiB,qBAAqB;QAClC;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KAC3B;IACD,UAAiB,cAAc;QAC3B;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KAC3B;IACD,UAAiB,qBAAqB;QAClC;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB;;WAEG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;KACzB;IACD,UAAiB,kCAAkC;QAC/C;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB;;WAEG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;KACzB;IACD,UAAiB,oBAAoB;QACjC;;WAEG;QACH,eAAe,CAAC,EAAE,OAAO,CAAC;KAC7B;CACF"}
@@ -44,8 +44,14 @@ class Connection {
44
44
  get interfaceId() {
45
45
  return this._interfaceId;
46
46
  }
47
+ /**
48
+ * Returns whether the connection is open.
49
+ * Does not guarantee that the subsequent requests will succeed.
50
+ */
51
+ get isOpen() {
52
+ return this._retrieveIsOpen();
53
+ }
47
54
  constructor(interfaceId) {
48
- this._disconnected = new rxjs_1.ReplaySubject();
49
55
  this._interfaceId = interfaceId;
50
56
  (0, finalizer_1.registerForFinalization)(this, Connection._free.bind(null, interfaceId));
51
57
  this._subscribe();
@@ -230,6 +236,21 @@ class Connection {
230
236
  }
231
237
  return new device_1.Device(this, deviceAddress);
232
238
  }
239
+ /**
240
+ * Returns is open.
241
+ * @returns Is open.
242
+ */
243
+ _retrieveIsOpen() {
244
+ const request = {
245
+ ...requests.InterfaceEmptyRequest.DEFAULT,
246
+ interfaceId: this.interfaceId,
247
+ toBinary() {
248
+ return requests.InterfaceEmptyRequest.toBinary(this);
249
+ },
250
+ };
251
+ const response = gateway.callSync('interface/get_is_open', request, requests.BoolResponse.fromBinary);
252
+ return response.value;
253
+ }
233
254
  /**
234
255
  * Returns a string that represents the connection.
235
256
  * @returns A string that represents the connection.
@@ -266,6 +287,7 @@ class Connection {
266
287
  return this._disconnected;
267
288
  }
268
289
  _subscribe() {
290
+ this._disconnected = new rxjs_1.ReplaySubject();
269
291
  this.unknownResponse = gateway_1.events.pipe((0, operators_1.takeUntil)(this._disconnected), (0, gateway_1.filterEvent)('binary/interface/unknown_response'), (0, operators_1.filter)(event => event.interfaceId === this.interfaceId), (0, operators_1.map)(event => event.unknownResponse));
270
292
  this.replyOnly = gateway_1.events.pipe((0, operators_1.takeUntil)(this._disconnected), (0, gateway_1.filterEvent)('binary/interface/reply_only'), (0, operators_1.filter)(event => event.interfaceId === this.interfaceId), (0, operators_1.map)(event => event.reply));
271
293
  gateway_1.events.pipe((0, gateway_1.filterEvent)('interface/disconnected'), (0, operators_1.filter)(event => event.interfaceId === this.interfaceId), (0, operators_1.take)(1), (0, operators_1.map)(({ errorMessage, errorType }) => gateway.convertToException(errorType, errorMessage))).subscribe(this._disconnected);
@@ -1 +1 @@
1
- {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/binary/connection.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,+BAAiD;AACjD,8CAA8D;AAC9D,oDAAsC;AACtC,wCAAiD;AACjD,sDAAwC;AACxC,qCAAkC;AAIlC,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AAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,CAAC,EACvD,IAAA,eAAG,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CACpC,CAAC;QAEF,IAAI,CAAC,SAAS,GAAG,gBAAM,CAAC,IAAI,CAC1B,IAAA,qBAAS,EAAC,IAAI,CAAC,aAAa,CAAC,EAC7B,IAAA,qBAAW,EAAuC,6BAA6B,CAAC,EAChF,IAAA,kBAAM,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,CAAC,EACvD,IAAA,eAAG,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAC1B,CAAC;QAEF,gBAAM,CAAC,IAAI,CACT,IAAA,qBAAW,EAA6B,wBAAwB,CAAC,EACjE,IAAA,kBAAM,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,CAAC,EACvD,IAAA,gBAAI,EAAC,CAAC,CAAC,EACP,IAAA,eAAG,EAAC,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAC1F,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,IAAI;QACT,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACrC,CAAC;;AAvWH,gCAwWC;AA7VC;;GAEG;AACoB,4BAAiB,GAAW,IAAI,AAAf,CAAgB","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Observable, ReplaySubject } from 'rxjs';\nimport { map, filter, takeUntil, take } from 'rxjs/operators';\nimport * as gateway from '../gateway';\nimport { events, filterEvent } from '../gateway';\nimport * as requests from '../requests';\nimport { Device } from './device';\nimport { UnknownResponseEvent } from './unknown_response_event';\nimport { ReplyOnlyEvent } from './reply_only_event';\nimport { CommandCode } from './command_code';\nimport { Message } from './message';\nimport { MotionLibException } from '../exceptions';\nimport { registerForFinalization } from '../finalizer';\n\n/**\n * Class representing access to particular connection (serial port, TCP connection) using the legacy Binary protocol.\n */\nexport class Connection {\n /**\n * Event invoked when a response from a device cannot be matched to any known request.\n */\n public unknownResponse!: Observable<UnknownResponseEvent>;\n\n /**\n * Event invoked when a reply-only command such as a move tracking message is received from a device.\n */\n public replyOnly!: Observable<ReplyOnlyEvent>;\n\n /**\n * Default baud rate for serial connections.\n */\n public static readonly DEFAULT_BAUD_RATE: number = 9600;\n\n /**\n * The interface ID identifies thisConnection instance with the underlying library.\n */\n public get interfaceId(): number {\n return this._interfaceId;\n }\n private _interfaceId: number;\n\n constructor(interfaceId: number) {\n this._interfaceId = interfaceId;\n registerForFinalization(this, Connection._free.bind(null, interfaceId));\n this._subscribe();\n }\n\n /**\n * Opens a serial port.\n * @param portName Name of the port to open.\n * @param [options.baudRate=Connection.DEFAULT_BAUD_RATE] Optional baud rate (defaults to 9600).\n * @param [options.useMessageIds=false] Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n * @returns An object representing the port.\n */\n public static async openSerialPort(\n portName: string,\n options: Connection.OpenSerialPortOptions = {}\n ): Promise<Connection> {\n const {\n baudRate = Connection.DEFAULT_BAUD_RATE,\n useMessageIds = false,\n } = options;\n const request: requests.OpenBinaryInterfaceRequest & gateway.Message = {\n ...requests.OpenBinaryInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.SERIAL_PORT,\n portName: portName,\n baudRate: baudRate,\n useMessageIds: useMessageIds,\n toBinary() {\n return requests.OpenBinaryInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'binary/interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a TCP connection.\n * @param hostName Hostname or IP address.\n * @param port Port number.\n * @param [options.useMessageIds=false] Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n * @returns An object representing the connection.\n */\n public static async openTcp(\n hostName: string,\n port: number,\n options: Connection.OpenTcpOptions = {}\n ): Promise<Connection> {\n const {\n useMessageIds = false,\n } = options;\n const request: requests.OpenBinaryInterfaceRequest & gateway.Message = {\n ...requests.OpenBinaryInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.TCP,\n hostName: hostName,\n port: port,\n useMessageIds: useMessageIds,\n toBinary() {\n return requests.OpenBinaryInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'binary/interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Close the connection.\n */\n public async close(): Promise<void> {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/close', request);\n }\n\n /**\n * Sends a generic Binary command to this connection.\n * For more information please refer to the\n * [Binary Protocol Manual](https://www.zaber.com/protocol-manual?protocol=Binary#topic_quick_command_reference).\n * @param device Device address to send the command to. Use zero for broadcast.\n * @param command Command to send.\n * @param [data=0] Optional data argument to the command. Defaults to zero.\n * @param [options.timeout=0.0] Number of seconds to wait for a response from the device. 0 or negative defaults to 0.5s.\n * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.\n * @returns A response to the command.\n */\n public async genericCommand(\n device: number,\n command: CommandCode,\n data: number = 0,\n options: Connection.GenericCommandOptions = {}\n ): Promise<Message> {\n const {\n timeout = 0.0,\n checkErrors = true,\n } = options;\n const request: requests.GenericBinaryRequest & gateway.Message = {\n ...requests.GenericBinaryRequest.DEFAULT,\n interfaceId: this.interfaceId,\n device: device,\n command: command,\n data: data,\n timeout: timeout,\n checkErrors: checkErrors,\n toBinary() {\n return requests.GenericBinaryRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<Message>(\n 'binary/interface/generic_command',\n request,\n Message.fromBinary);\n return response;\n }\n\n /**\n * Sends a generic Binary command to this connection without expecting a response.\n * For more information please refer to the\n * [Binary Protocol Manual](https://www.zaber.com/protocol-manual?protocol=Binary#topic_quick_command_reference).\n * @param device Device address to send the command to. Use zero for broadcast.\n * @param command Command to send.\n * @param [data=0] Optional data argument to the command. Defaults to zero.\n */\n public async genericCommandNoResponse(\n device: number,\n command: CommandCode,\n data: number = 0\n ): Promise<void> {\n const request: requests.GenericBinaryRequest & gateway.Message = {\n ...requests.GenericBinaryRequest.DEFAULT,\n interfaceId: this.interfaceId,\n device: device,\n command: command,\n data: data,\n toBinary() {\n return requests.GenericBinaryRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('binary/interface/generic_command_no_response', request);\n }\n\n /**\n * Sends a generic Binary command to this connection and expects responses from one or more devices.\n * Responses are returned in order of arrival.\n * For more information please refer to the\n * [Binary Protocol Manual](https://www.zaber.com/protocol-manual?protocol=Binary#topic_quick_command_reference).\n * @param command Command to send.\n * @param [data=0] Optional data argument to the command. Defaults to zero.\n * @param [options.timeout=0.0] Number of seconds to wait for all responses from the device chain. 0 or negative defaults to 0.5s.\n * @param [options.checkErrors=true] Controls whether to throw an exception when any device rejects the command.\n * @returns All responses to the command.\n */\n public async genericCommandMultiResponse(\n command: CommandCode,\n data: number = 0,\n options: Connection.GenericCommandMultiResponseOptions = {}\n ): Promise<Message[]> {\n const {\n timeout = 0.0,\n checkErrors = true,\n } = options;\n const request: requests.GenericBinaryRequest & gateway.Message = {\n ...requests.GenericBinaryRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n data: data,\n timeout: timeout,\n checkErrors: checkErrors,\n toBinary() {\n return requests.GenericBinaryRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.BinaryMessageCollection>(\n 'binary/interface/generic_command_multi_response',\n request,\n requests.BinaryMessageCollection.fromBinary);\n return response.messages;\n }\n\n /**\n * Renumbers devices present on this connection. After renumbering, you must identify devices again.\n * @returns Total number of devices that responded to the renumber.\n */\n public async renumberDevices(): Promise<number> {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.IntResponse>(\n 'binary/device/renumber',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Attempts to detect any devices present on this connection.\n * @param [options.identifyDevices=true] Determines whether device identification should be performed as well.\n * @returns Array of detected devices.\n */\n public async detectDevices(\n options: Connection.DetectDevicesOptions = {}\n ): Promise<Device[]> {\n const {\n identifyDevices = true,\n } = options;\n const request: requests.BinaryDeviceDetectRequest & gateway.Message = {\n ...requests.BinaryDeviceDetectRequest.DEFAULT,\n interfaceId: this.interfaceId,\n identifyDevices: identifyDevices,\n toBinary() {\n return requests.BinaryDeviceDetectRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.BinaryDeviceDetectResponse>(\n 'binary/device/detect',\n request,\n requests.BinaryDeviceDetectResponse.fromBinary);\n return response.devices.map(deviceAddress => this.getDevice(deviceAddress));\n }\n\n /**\n * Gets a Device class instance which allows you to control a particular device on this connection.\n * Devices are numbered from 1.\n * @param deviceAddress Address of device intended to control. Address is configured for each device.\n * @returns Device instance.\n */\n public getDevice(\n deviceAddress: number\n ): Device {\n if (deviceAddress <= 0) {\n throw new TypeError('Invalid value; physical devices are numbered from 1.');\n }\n return new Device(this, deviceAddress);\n }\n\n /**\n * Returns a string that represents the connection.\n * @returns A string that represents the connection.\n */\n public toString(): string {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.StringResponse>(\n 'interface/to_string',\n request,\n requests.StringResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Releases native resources of the connection.\n * @param interfaceId The ID of the connection.\n */\n private static _free(\n interfaceId: number\n ): void {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/free', request);\n }\n\n private _disconnected = new ReplaySubject<MotionLibException>();\n\n /**\n * Event invoked when connection is interrupted or closed.\n */\n public get disconnected(): Observable<MotionLibException> {\n return this._disconnected;\n }\n\n private _subscribe(): void {\n this.unknownResponse = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.UnknownBinaryResponseEventWrapper>('binary/interface/unknown_response'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.unknownResponse)\n );\n\n this.replyOnly = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.BinaryReplyOnlyEventWrapper>('binary/interface/reply_only'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.reply)\n );\n\n events.pipe(\n filterEvent<requests.DisconnectedEvent>('interface/disconnected'),\n filter(event => event.interfaceId === this.interfaceId),\n take(1),\n map(({ errorMessage, errorType }) => gateway.convertToException(errorType, errorMessage))\n ).subscribe(this._disconnected);\n }\n\n /**\n * Releases the native resources of the connection.\n * Should only be called if your environment does not support FinalizationRegistry.\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry\n */\n public free(): void {\n Connection._free(this.interfaceId);\n }\n}\n\nnamespace Connection {\n export interface OpenSerialPortOptions {\n /**\n * Optional baud rate (defaults to 9600).\n */\n baudRate?: number;\n /**\n * Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n */\n useMessageIds?: boolean;\n }\n export interface OpenTcpOptions {\n /**\n * Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n */\n useMessageIds?: boolean;\n }\n export interface GenericCommandOptions {\n /**\n * Number of seconds to wait for a response from the device. 0 or negative defaults to 0.5s.\n */\n timeout?: number;\n /**\n * Controls whether to throw an exception when the device rejects the command.\n */\n checkErrors?: boolean;\n }\n export interface GenericCommandMultiResponseOptions {\n /**\n * Number of seconds to wait for all responses from the device chain. 0 or negative defaults to 0.5s.\n */\n timeout?: number;\n /**\n * Controls whether to throw an exception when any device rejects the command.\n */\n checkErrors?: boolean;\n }\n export interface DetectDevicesOptions {\n /**\n * Determines whether device identification should be performed as well.\n */\n identifyDevices?: boolean;\n }\n}\n"]}
1
+ {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/binary/connection.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,+BAAiD;AACjD,8CAA8D;AAC9D,oDAAsC;AACtC,wCAAiD;AACjD,sDAAwC;AACxC,qCAAkC;AAIlC,uCAAoC;AAEpC,4CAAuD;AAEvD;;GAEG;AACH,MAAa,UAAU;IAgBrB;;OAEG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAGD;;;OAGG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;IAED,YAAY,WAAmB;QAC7B,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAA,mCAAuB,EAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,cAAc,CAChC,QAAgB,EAChB,UAA4C,EAAE;QAE9C,M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WAAW,KAAK,IAAI,CAAC,WAAW,CAAC,EACvD,IAAA,eAAG,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CACpC,CAAC;QAEF,IAAI,CAAC,SAAS,GAAG,gBAAM,CAAC,IAAI,CAC1B,IAAA,qBAAS,EAAC,IAAI,CAAC,aAAa,CAAC,EAC7B,IAAA,qBAAW,EAAuC,6BAA6B,CAAC,EAChF,IAAA,kBAAM,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,CAAC,EACvD,IAAA,eAAG,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAC1B,CAAC;QAEF,gBAAM,CAAC,IAAI,CACT,IAAA,qBAAW,EAA6B,wBAAwB,CAAC,EACjE,IAAA,kBAAM,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,CAAC,EACvD,IAAA,gBAAI,EAAC,CAAC,CAAC,EACP,IAAA,eAAG,EAAC,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAC1F,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,IAAI;QACT,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACrC,CAAC;;AArYH,gCAsYC;AA3XC;;GAEG;AACoB,4BAAiB,GAAW,IAAI,CAAC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Observable, ReplaySubject } from 'rxjs';\nimport { map, filter, takeUntil, take } from 'rxjs/operators';\nimport * as gateway from '../gateway';\nimport { events, filterEvent } from '../gateway';\nimport * as requests from '../requests';\nimport { Device } from './device';\nimport { UnknownResponseEvent } from './unknown_response_event';\nimport { ReplyOnlyEvent } from './reply_only_event';\nimport { CommandCode } from './command_code';\nimport { Message } from './message';\nimport { MotionLibException } from '../exceptions';\nimport { registerForFinalization } from '../finalizer';\n\n/**\n * Class representing access to particular connection (serial port, TCP connection) using the legacy Binary protocol.\n */\nexport class Connection {\n /**\n * Event invoked when a response from a device cannot be matched to any known request.\n */\n public unknownResponse!: Observable<UnknownResponseEvent>;\n\n /**\n * Event invoked when a reply-only command such as a move tracking message is received from a device.\n */\n public replyOnly!: Observable<ReplyOnlyEvent>;\n\n /**\n * Default baud rate for serial connections.\n */\n public static readonly DEFAULT_BAUD_RATE: number = 9600;\n\n /**\n * The interface ID identifies thisConnection instance with the underlying library.\n */\n public get interfaceId(): number {\n return this._interfaceId;\n }\n private _interfaceId: number;\n\n /**\n * Returns whether the connection is open.\n * Does not guarantee that the subsequent requests will succeed.\n */\n public get isOpen(): boolean {\n return this._retrieveIsOpen();\n }\n\n constructor(interfaceId: number) {\n this._interfaceId = interfaceId;\n registerForFinalization(this, Connection._free.bind(null, interfaceId));\n this._subscribe();\n }\n\n /**\n * Opens a serial port.\n * @param portName Name of the port to open.\n * @param [options.baudRate=Connection.DEFAULT_BAUD_RATE] Optional baud rate (defaults to 9600).\n * @param [options.useMessageIds=false] Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n * @returns An object representing the port.\n */\n public static async openSerialPort(\n portName: string,\n options: Connection.OpenSerialPortOptions = {}\n ): Promise<Connection> {\n const {\n baudRate = Connection.DEFAULT_BAUD_RATE,\n useMessageIds = false,\n } = options;\n const request: requests.OpenBinaryInterfaceRequest & gateway.Message = {\n ...requests.OpenBinaryInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.SERIAL_PORT,\n portName: portName,\n baudRate: baudRate,\n useMessageIds: useMessageIds,\n toBinary() {\n return requests.OpenBinaryInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'binary/interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a TCP connection.\n * @param hostName Hostname or IP address.\n * @param port Port number.\n * @param [options.useMessageIds=false] Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n * @returns An object representing the connection.\n */\n public static async openTcp(\n hostName: string,\n port: number,\n options: Connection.OpenTcpOptions = {}\n ): Promise<Connection> {\n const {\n useMessageIds = false,\n } = options;\n const request: requests.OpenBinaryInterfaceRequest & gateway.Message = {\n ...requests.OpenBinaryInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.TCP,\n hostName: hostName,\n port: port,\n useMessageIds: useMessageIds,\n toBinary() {\n return requests.OpenBinaryInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'binary/interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Close the connection.\n */\n public async close(): Promise<void> {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/close', request);\n }\n\n /**\n * Sends a generic Binary command to this connection.\n * For more information please refer to the\n * [Binary Protocol Manual](https://www.zaber.com/protocol-manual?protocol=Binary#topic_quick_command_reference).\n * @param device Device address to send the command to. Use zero for broadcast.\n * @param command Command to send.\n * @param [data=0] Optional data argument to the command. Defaults to zero.\n * @param [options.timeout=0.0] Number of seconds to wait for a response from the device. 0 or negative defaults to 0.5s.\n * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.\n * @returns A response to the command.\n */\n public async genericCommand(\n device: number,\n command: CommandCode,\n data: number = 0,\n options: Connection.GenericCommandOptions = {}\n ): Promise<Message> {\n const {\n timeout = 0.0,\n checkErrors = true,\n } = options;\n const request: requests.GenericBinaryRequest & gateway.Message = {\n ...requests.GenericBinaryRequest.DEFAULT,\n interfaceId: this.interfaceId,\n device: device,\n command: command,\n data: data,\n timeout: timeout,\n checkErrors: checkErrors,\n toBinary() {\n return requests.GenericBinaryRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<Message>(\n 'binary/interface/generic_command',\n request,\n Message.fromBinary);\n return response;\n }\n\n /**\n * Sends a generic Binary command to this connection without expecting a response.\n * For more information please refer to the\n * [Binary Protocol Manual](https://www.zaber.com/protocol-manual?protocol=Binary#topic_quick_command_reference).\n * @param device Device address to send the command to. Use zero for broadcast.\n * @param command Command to send.\n * @param [data=0] Optional data argument to the command. Defaults to zero.\n */\n public async genericCommandNoResponse(\n device: number,\n command: CommandCode,\n data: number = 0\n ): Promise<void> {\n const request: requests.GenericBinaryRequest & gateway.Message = {\n ...requests.GenericBinaryRequest.DEFAULT,\n interfaceId: this.interfaceId,\n device: device,\n command: command,\n data: data,\n toBinary() {\n return requests.GenericBinaryRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('binary/interface/generic_command_no_response', request);\n }\n\n /**\n * Sends a generic Binary command to this connection and expects responses from one or more devices.\n * Responses are returned in order of arrival.\n * For more information please refer to the\n * [Binary Protocol Manual](https://www.zaber.com/protocol-manual?protocol=Binary#topic_quick_command_reference).\n * @param command Command to send.\n * @param [data=0] Optional data argument to the command. Defaults to zero.\n * @param [options.timeout=0.0] Number of seconds to wait for all responses from the device chain. 0 or negative defaults to 0.5s.\n * @param [options.checkErrors=true] Controls whether to throw an exception when any device rejects the command.\n * @returns All responses to the command.\n */\n public async genericCommandMultiResponse(\n command: CommandCode,\n data: number = 0,\n options: Connection.GenericCommandMultiResponseOptions = {}\n ): Promise<Message[]> {\n const {\n timeout = 0.0,\n checkErrors = true,\n } = options;\n const request: requests.GenericBinaryRequest & gateway.Message = {\n ...requests.GenericBinaryRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n data: data,\n timeout: timeout,\n checkErrors: checkErrors,\n toBinary() {\n return requests.GenericBinaryRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.BinaryMessageCollection>(\n 'binary/interface/generic_command_multi_response',\n request,\n requests.BinaryMessageCollection.fromBinary);\n return response.messages;\n }\n\n /**\n * Renumbers devices present on this connection. After renumbering, you must identify devices again.\n * @returns Total number of devices that responded to the renumber.\n */\n public async renumberDevices(): Promise<number> {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.IntResponse>(\n 'binary/device/renumber',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Attempts to detect any devices present on this connection.\n * @param [options.identifyDevices=true] Determines whether device identification should be performed as well.\n * @returns Array of detected devices.\n */\n public async detectDevices(\n options: Connection.DetectDevicesOptions = {}\n ): Promise<Device[]> {\n const {\n identifyDevices = true,\n } = options;\n const request: requests.BinaryDeviceDetectRequest & gateway.Message = {\n ...requests.BinaryDeviceDetectRequest.DEFAULT,\n interfaceId: this.interfaceId,\n identifyDevices: identifyDevices,\n toBinary() {\n return requests.BinaryDeviceDetectRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.BinaryDeviceDetectResponse>(\n 'binary/device/detect',\n request,\n requests.BinaryDeviceDetectResponse.fromBinary);\n return response.devices.map(deviceAddress => this.getDevice(deviceAddress));\n }\n\n /**\n * Gets a Device class instance which allows you to control a particular device on this connection.\n * Devices are numbered from 1.\n * @param deviceAddress Address of device intended to control. Address is configured for each device.\n * @returns Device instance.\n */\n public getDevice(\n deviceAddress: number\n ): Device {\n if (deviceAddress <= 0) {\n throw new TypeError('Invalid value; physical devices are numbered from 1.');\n }\n return new Device(this, deviceAddress);\n }\n\n /**\n * Returns is open.\n * @returns Is open.\n */\n private _retrieveIsOpen(): boolean {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.BoolResponse>(\n 'interface/get_is_open',\n request,\n requests.BoolResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Returns a string that represents the connection.\n * @returns A string that represents the connection.\n */\n public toString(): string {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.StringResponse>(\n 'interface/to_string',\n request,\n requests.StringResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Releases native resources of the connection.\n * @param interfaceId The ID of the connection.\n */\n private static _free(\n interfaceId: number\n ): void {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/free', request);\n }\n\n private _disconnected!: ReplaySubject<MotionLibException>;\n\n /**\n * Event invoked when connection is interrupted or closed.\n */\n public get disconnected(): Observable<MotionLibException> {\n return this._disconnected;\n }\n\n private _subscribe(): void {\n this._disconnected = new ReplaySubject<MotionLibException>();\n\n this.unknownResponse = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.UnknownBinaryResponseEventWrapper>('binary/interface/unknown_response'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.unknownResponse)\n );\n\n this.replyOnly = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.BinaryReplyOnlyEventWrapper>('binary/interface/reply_only'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.reply)\n );\n\n events.pipe(\n filterEvent<requests.DisconnectedEvent>('interface/disconnected'),\n filter(event => event.interfaceId === this.interfaceId),\n take(1),\n map(({ errorMessage, errorType }) => gateway.convertToException(errorType, errorMessage))\n ).subscribe(this._disconnected);\n }\n\n /**\n * Releases the native resources of the connection.\n * Should only be called if your environment does not support FinalizationRegistry.\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry\n */\n public free(): void {\n Connection._free(this.interfaceId);\n }\n}\n\nnamespace Connection {\n export interface OpenSerialPortOptions {\n /**\n * Optional baud rate (defaults to 9600).\n */\n baudRate?: number;\n /**\n * Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n */\n useMessageIds?: boolean;\n }\n export interface OpenTcpOptions {\n /**\n * Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n */\n useMessageIds?: boolean;\n }\n export interface GenericCommandOptions {\n /**\n * Number of seconds to wait for a response from the device. 0 or negative defaults to 0.5s.\n */\n timeout?: number;\n /**\n * Controls whether to throw an exception when the device rejects the command.\n */\n checkErrors?: boolean;\n }\n export interface GenericCommandMultiResponseOptions {\n /**\n * Number of seconds to wait for all responses from the device chain. 0 or negative defaults to 0.5s.\n */\n timeout?: number;\n /**\n * Controls whether to throw an exception when any device rejects the command.\n */\n checkErrors?: boolean;\n }\n export interface DetectDevicesOptions {\n /**\n * Determines whether device identification should be performed as well.\n */\n identifyDevices?: boolean;\n }\n}\n"]}
@@ -157,7 +157,7 @@ class Library {
157
157
  const request = {
158
158
  ...requests.CheckVersionRequest.DEFAULT,
159
159
  host: 'js',
160
- version: '7.8.4',
160
+ version: '7.9.0',
161
161
  toBinary() {
162
162
  return requests.CheckVersionRequest.toBinary(this);
163
163
  },
@@ -1 +1 @@
1
- {"version":3,"file":"library.js","sourceRoot":"","sources":["../../src/library.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,mDAAqC;AACrC,qDAAuC;AAIvC,MAAa,OAAO;IAClB;;;;OAIG;IACI,MAAM,CAAC,YAAY,CACx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GAAG,QAAQ,CAAC,UAAU,CAAC,OAAO;YAC9B,KAAK,EAAE,MAAM;YACb,QAAQ;gBACN,OAAO,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC5C,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,YAAY;QACxB,MAAM,OAAO,GAAmD;YAC9D,GAAG,QAAQ,CAAC,mBAAmB,CAAC,OAAO;YACvC,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,OAAO;YAChB,QAAQ;gBACN,OAAO,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;CACF;AAxKD,0BAwKC;AAED,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from './gateway';\nimport * as requests from './requests';\nimport { LogOutputMode } from './log_output_mode';\nimport { DeviceDbSourceType } from './device_db_source_type';\n\nexport class Library {\n /**\n * Sets library logging output.\n * @param mode Logging output mode.\n * @param filePath Path of the file to open.\n */\n public static setLogOutput(\n mode: LogOutputMode,\n filePath?: string\n ): void {\n const request: requests.SetLogOutputRequest & gateway.Message = {\n ...requests.SetLogOutputRequest.DEFAULT,\n mode: mode,\n filePath: filePath,\n toBinary() {\n return requests.SetLogOutputRequest.toBinary(this);\n },\n };\n\n gateway.callSync('logging/set_output', request);\n }\n\n /**\n * Sets source of Device DB data. Allows selection of a web service or a local file.\n * @param sourceType Source type.\n * @param urlOrFilePath URL of the web service or path to the local file.\n * Leave empty for the default URL of Zaber web service.\n */\n public static setDeviceDbSource(\n sourceType: DeviceDbSourceType,\n urlOrFilePath?: string\n ): void {\n const request: requests.SetDeviceDbSourceRequest & gateway.Message = {\n ...requests.SetDeviceDbSourceRequest.DEFAULT,\n sourceType: sourceType,\n urlOrFilePath: urlOrFilePath,\n toBinary() {\n return requests.SetDeviceDbSourceRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/set_source', request);\n }\n\n /**\n * Enables Device DB store.\n * The store uses filesystem to save information obtained from the Device DB.\n * The stored data are later used instead of the Device DB.\n * @param storeLocation Specifies relative or absolute path of the folder used by the store.\n * If left empty defaults to a folder in user home directory.\n * Must be accessible by the process.\n */\n public static enableDeviceDbStore(\n storeLocation?: string\n ): void {\n const request: requests.ToggleDeviceDbStoreRequest & gateway.Message = {\n ...requests.ToggleDeviceDbStoreRequest.DEFAULT,\n toggleOn: true,\n storeLocation: storeLocation,\n toBinary() {\n return requests.ToggleDeviceDbStoreRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/toggle_store', request);\n }\n\n /**\n * Disables Device DB store.\n */\n public static disableDeviceDbStore(): void {\n const request: requests.ToggleDeviceDbStoreRequest & gateway.Message = {\n ...requests.ToggleDeviceDbStoreRequest.DEFAULT,\n toBinary() {\n return requests.ToggleDeviceDbStoreRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/toggle_store', request);\n }\n\n /**\n * Checks if the Device DB store is currently enabled.\n * @returns True if the Device DB store is enabled.\n */\n public static isDeviceDbStoreEnabled(): boolean {\n const request: requests.EmptyRequest & gateway.Message = {\n ...requests.EmptyRequest.DEFAULT,\n toBinary() {\n return requests.EmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.BoolResponse>(\n 'device_db/check_store',\n request,\n requests.BoolResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Clears the Device DB store on the local filesystem.\n * Note: If the device DB was enabled with a custom store location, store files will be removed in that location.\n */\n public static async clearDeviceDbStore(): Promise<void> {\n const request: requests.EmptyRequest & gateway.Message = {\n ...requests.EmptyRequest.DEFAULT,\n toBinary() {\n return requests.EmptyRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('device_db/clear_store', request);\n }\n\n /**\n * Disables certain customer checks (like FF flag).\n * @param mode Whether to turn internal mode on or off.\n */\n public static setInternalMode(\n mode: boolean\n ): void {\n const request: requests.SetInternalModeRequest & gateway.Message = {\n ...requests.SetInternalModeRequest.DEFAULT,\n mode: mode,\n toBinary() {\n return requests.SetInternalModeRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/set_internal_mode', request);\n }\n\n /**\n * Sets the period between polling for IDLE during movements.\n * Caution: Setting the period too low may cause performance issues.\n * @param period Period in milliseconds.\n * Negative value restores the default period.\n */\n public static setIdlePollingPeriod(\n period: number\n ): void {\n const request: requests.IntRequest & gateway.Message = {\n ...requests.IntRequest.DEFAULT,\n value: period,\n toBinary() {\n return requests.IntRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/set_idle_polling_period', request);\n }\n\n /**\n * Throws an error if the version of the loaded shared library does not match the caller's version.\n */\n public static checkVersion(): void {\n const request: requests.CheckVersionRequest & gateway.Message = {\n ...requests.CheckVersionRequest.DEFAULT,\n host: 'js',\n version: '7.8.4',\n toBinary() {\n return requests.CheckVersionRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/check_version', request);\n }\n}\n\ngateway.addInitCallback(Library.checkVersion);\n"]}
1
+ {"version":3,"file":"library.js","sourceRoot":"","sources":["../../src/library.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,mDAAqC;AACrC,qDAAuC;AAIvC,MAAa,OAAO;IAClB;;;;OAIG;IACI,MAAM,CAAC,YAAY,CACxB,IAAmB,EACnB,QAAiB;QAEjB,MAAM,OAAO,GAAmD;YAC9D,GAAG,QAAQ,CAAC,mBAAmB,CAAC,OAAO;YACvC,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,QAAQ;YAClB,QAAQ;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F,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,YAAY;QACxB,MAAM,OAAO,GAAmD;YAC9D,GAAG,QAAQ,CAAC,mBAAmB,CAAC,OAAO;YACvC,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,OAAO;YAChB,QAAQ;gBACN,OAAO,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;CACF;AAxKD,0BAwKC;AAED,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from './gateway';\nimport * as requests from './requests';\nimport { LogOutputMode } from './log_output_mode';\nimport { DeviceDbSourceType } from './device_db_source_type';\n\nexport class Library {\n /**\n * Sets library logging output.\n * @param mode Logging output mode.\n * @param filePath Path of the file to open.\n */\n public static setLogOutput(\n mode: LogOutputMode,\n filePath?: string\n ): void {\n const request: requests.SetLogOutputRequest & gateway.Message = {\n ...requests.SetLogOutputRequest.DEFAULT,\n mode: mode,\n filePath: filePath,\n toBinary() {\n return requests.SetLogOutputRequest.toBinary(this);\n },\n };\n\n gateway.callSync('logging/set_output', request);\n }\n\n /**\n * Sets source of Device DB data. Allows selection of a web service or a local file.\n * @param sourceType Source type.\n * @param urlOrFilePath URL of the web service or path to the local file.\n * Leave empty for the default URL of Zaber web service.\n */\n public static setDeviceDbSource(\n sourceType: DeviceDbSourceType,\n urlOrFilePath?: string\n ): void {\n const request: requests.SetDeviceDbSourceRequest & gateway.Message = {\n ...requests.SetDeviceDbSourceRequest.DEFAULT,\n sourceType: sourceType,\n urlOrFilePath: urlOrFilePath,\n toBinary() {\n return requests.SetDeviceDbSourceRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/set_source', request);\n }\n\n /**\n * Enables Device DB store.\n * The store uses filesystem to save information obtained from the Device DB.\n * The stored data are later used instead of the Device DB.\n * @param storeLocation Specifies relative or absolute path of the folder used by the store.\n * If left empty defaults to a folder in user home directory.\n * Must be accessible by the process.\n */\n public static enableDeviceDbStore(\n storeLocation?: string\n ): void {\n const request: requests.ToggleDeviceDbStoreRequest & gateway.Message = {\n ...requests.ToggleDeviceDbStoreRequest.DEFAULT,\n toggleOn: true,\n storeLocation: storeLocation,\n toBinary() {\n return requests.ToggleDeviceDbStoreRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/toggle_store', request);\n }\n\n /**\n * Disables Device DB store.\n */\n public static disableDeviceDbStore(): void {\n const request: requests.ToggleDeviceDbStoreRequest & gateway.Message = {\n ...requests.ToggleDeviceDbStoreRequest.DEFAULT,\n toBinary() {\n return requests.ToggleDeviceDbStoreRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/toggle_store', request);\n }\n\n /**\n * Checks if the Device DB store is currently enabled.\n * @returns True if the Device DB store is enabled.\n */\n public static isDeviceDbStoreEnabled(): boolean {\n const request: requests.EmptyRequest & gateway.Message = {\n ...requests.EmptyRequest.DEFAULT,\n toBinary() {\n return requests.EmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.BoolResponse>(\n 'device_db/check_store',\n request,\n requests.BoolResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Clears the Device DB store on the local filesystem.\n * Note: If the device DB was enabled with a custom store location, store files will be removed in that location.\n */\n public static async clearDeviceDbStore(): Promise<void> {\n const request: requests.EmptyRequest & gateway.Message = {\n ...requests.EmptyRequest.DEFAULT,\n toBinary() {\n return requests.EmptyRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('device_db/clear_store', request);\n }\n\n /**\n * Disables certain customer checks (like FF flag).\n * @param mode Whether to turn internal mode on or off.\n */\n public static setInternalMode(\n mode: boolean\n ): void {\n const request: requests.SetInternalModeRequest & gateway.Message = {\n ...requests.SetInternalModeRequest.DEFAULT,\n mode: mode,\n toBinary() {\n return requests.SetInternalModeRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/set_internal_mode', request);\n }\n\n /**\n * Sets the period between polling for IDLE during movements.\n * Caution: Setting the period too low may cause performance issues.\n * @param period Period in milliseconds.\n * Negative value restores the default period.\n */\n public static setIdlePollingPeriod(\n period: number\n ): void {\n const request: requests.IntRequest & gateway.Message = {\n ...requests.IntRequest.DEFAULT,\n value: period,\n toBinary() {\n return requests.IntRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/set_idle_polling_period', request);\n }\n\n /**\n * Throws an error if the version of the loaded shared library does not match the caller's version.\n */\n public static checkVersion(): void {\n const request: requests.CheckVersionRequest & gateway.Message = {\n ...requests.CheckVersionRequest.DEFAULT,\n host: 'js',\n version: '7.9.0',\n toBinary() {\n return requests.CheckVersionRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/check_version', request);\n }\n}\n\ngateway.addInitCallback(Library.checkVersion);\n"]}
@@ -2,6 +2,10 @@ import { BSON } from 'bson';
2
2
  import { AlertEvent } from '../ascii/alert_event';
3
3
  export interface AlertEventWrapper {
4
4
  interfaceId: number;
5
+ /**
6
+ * The id of the connection session.
7
+ */
8
+ sessionId: number;
5
9
  alert: AlertEvent;
6
10
  }
7
11
  export declare const AlertEventWrapper: {
@@ -1 +1 @@
1
- {"version":3,"file":"alert_event_wrapper.d.ts","sourceRoot":"","sources":["../../../src/requests/alert_event_wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IAEpB,KAAK,EAAE,UAAU,CAAC;CAEnB;AAED,eAAO,MAAM,iBAAiB;yBACP,UAAU,KAAG,iBAAiB;sBACjC,iBAAiB,KAAG,UAAU;;sBAK9B,iBAAiB,KAAG,iBAAiB;qBAQtC,KAAK,QAAQ,KAAG,iBAAiB;CAInD,CAAC"}
1
+ {"version":3,"file":"alert_event_wrapper.d.ts","sourceRoot":"","sources":["../../../src/requests/alert_event_wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,KAAK,EAAE,UAAU,CAAC;CAEnB;AAED,eAAO,MAAM,iBAAiB;yBACP,UAAU,KAAG,iBAAiB;sBACjC,iBAAiB,KAAG,UAAU;;sBAM9B,iBAAiB,KAAG,iBAAiB;qBAStC,KAAK,QAAQ,KAAG,iBAAiB;CAKnD,CAAC"}
@@ -10,6 +10,7 @@ exports.AlertEventWrapper = {
10
10
  toBinary: (value) => bson_1.BSON.serialize(exports.AlertEventWrapper.sanitize(value)),
11
11
  DEFAULT: Object.freeze({
12
12
  interfaceId: 0,
13
+ sessionId: 0,
13
14
  alert: alert_event_1.AlertEvent.DEFAULT,
14
15
  }),
15
16
  sanitize: (value) => {
@@ -21,11 +22,13 @@ exports.AlertEventWrapper = {
21
22
  }
22
23
  return {
23
24
  interfaceId: sanitizer_1.sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),
25
+ sessionId: sanitizer_1.sanitizer.sanitizeInt(value.sessionId, 'sessionId'),
24
26
  alert: alert_event_1.AlertEvent.sanitize(value.alert),
25
27
  };
26
28
  },
27
29
  convert: (value) => ({
28
30
  interfaceId: value.interfaceId,
31
+ sessionId: value.sessionId,
29
32
  alert: value.alert,
30
33
  })
31
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"alert_event_wrapper.js","sourceRoot":"","sources":["../../../src/requests/alert_event_wrapper.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACpD,+BAA4B;AAC5B,oDAAiD;AACjD,sDAAkD;AASrC,QAAA,iBAAiB,GAAG;IAC/B,UAAU,EAAE,CAAC,MAAkB,EAAqB,EAAE,CAAC,yBAAiB,CAAC,OAAO,CAAC,WAAI,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACjI,QAAQ,EAAE,CAAC,KAAwB,EAAc,EAAE,CAAC,WAAI,CAAC,SAAS,CAAC,yBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrG,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;QACrB,WAAW,EAAE,CAAC;QACd,KAAK,EAAE,wBAAU,CAAC,OAAO;KAC1B,CAAgC;IACjC,QAAQ,EAAE,CAAC,KAAwB,EAAqB,EAAE;QACxD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,8DAA8D,CAAC,CAAA;QAAC,CAAC;QAC1G,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,6CAA6C,OAAO,KAAK,GAAG,CAAC,CAAA;QAAC,CAAC;QACpH,OAAO;YACL,WAAW,EAAE,qBAAS,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC;YACpE,KAAK,EAAE,wBAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;SACxC,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC,KAAoB,EAAqB,EAAE,CAAC,CAAC;QACrD,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;CACH,CAAC","sourcesContent":["/* This file is generated. Do not modify by hand. */\nimport { BSON } from 'bson';\nimport { sanitizer } from '../gateway/sanitizer';\nimport { AlertEvent } from '../ascii/alert_event';\n\nexport interface AlertEventWrapper {\n interfaceId: number;\n\n alert: AlertEvent;\n\n}\n\nexport const AlertEventWrapper = {\n fromBinary: (buffer: Uint8Array): AlertEventWrapper => AlertEventWrapper.convert(BSON.deserialize(buffer, { useBigInt64: true })),\n toBinary: (value: AlertEventWrapper): Uint8Array => BSON.serialize(AlertEventWrapper.sanitize(value)),\n DEFAULT: Object.freeze({\n interfaceId: 0,\n alert: AlertEvent.DEFAULT,\n }) as Readonly<AlertEventWrapper>,\n sanitize: (value: AlertEventWrapper): AlertEventWrapper => {\n if (value == null) { throw new TypeError('Expected AlertEventWrapper object but got null or undefined.') }\n if (typeof value !== 'object') { throw new TypeError(`Expected AlertEventWrapper object but got ${typeof value}.`) }\n return {\n interfaceId: sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),\n alert: AlertEvent.sanitize(value.alert),\n };\n },\n convert: (value: BSON.Document): AlertEventWrapper => ({\n interfaceId: value.interfaceId,\n alert: value.alert,\n })\n};\n"]}
1
+ {"version":3,"file":"alert_event_wrapper.js","sourceRoot":"","sources":["../../../src/requests/alert_event_wrapper.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACpD,+BAA4B;AAC5B,oDAAiD;AACjD,sDAAkD;AAcrC,QAAA,iBAAiB,GAAG;IAC/B,UAAU,EAAE,CAAC,MAAkB,EAAqB,EAAE,CAAC,yBAAiB,CAAC,OAAO,CAAC,WAAI,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACjI,QAAQ,EAAE,CAAC,KAAwB,EAAc,EAAE,CAAC,WAAI,CAAC,SAAS,CAAC,yBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrG,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;QACrB,WAAW,EAAE,CAAC;QACd,SAAS,EAAE,CAAC;QACZ,KAAK,EAAE,wBAAU,CAAC,OAAO;KAC1B,CAAgC;IACjC,QAAQ,EAAE,CAAC,KAAwB,EAAqB,EAAE;QACxD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,8DAA8D,CAAC,CAAA;QAAC,CAAC;QAC1G,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,6CAA6C,OAAO,KAAK,GAAG,CAAC,CAAA;QAAC,CAAC;QACpH,OAAO;YACL,WAAW,EAAE,qBAAS,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC;YACpE,SAAS,EAAE,qBAAS,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC;YAC9D,KAAK,EAAE,wBAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;SACxC,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC,KAAoB,EAAqB,EAAE,CAAC,CAAC;QACrD,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;CACH,CAAC","sourcesContent":["/* This file is generated. Do not modify by hand. */\nimport { BSON } from 'bson';\nimport { sanitizer } from '../gateway/sanitizer';\nimport { AlertEvent } from '../ascii/alert_event';\n\nexport interface AlertEventWrapper {\n interfaceId: number;\n\n /**\n * The id of the connection session.\n */\n sessionId: number;\n\n alert: AlertEvent;\n\n}\n\nexport const AlertEventWrapper = {\n fromBinary: (buffer: Uint8Array): AlertEventWrapper => AlertEventWrapper.convert(BSON.deserialize(buffer, { useBigInt64: true })),\n toBinary: (value: AlertEventWrapper): Uint8Array => BSON.serialize(AlertEventWrapper.sanitize(value)),\n DEFAULT: Object.freeze({\n interfaceId: 0,\n sessionId: 0,\n alert: AlertEvent.DEFAULT,\n }) as Readonly<AlertEventWrapper>,\n sanitize: (value: AlertEventWrapper): AlertEventWrapper => {\n if (value == null) { throw new TypeError('Expected AlertEventWrapper object but got null or undefined.') }\n if (typeof value !== 'object') { throw new TypeError(`Expected AlertEventWrapper object but got ${typeof value}.`) }\n return {\n interfaceId: sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),\n sessionId: sanitizer.sanitizeInt(value.sessionId, 'sessionId'),\n alert: AlertEvent.sanitize(value.alert),\n };\n },\n convert: (value: BSON.Document): AlertEventWrapper => ({\n interfaceId: value.interfaceId,\n sessionId: value.sessionId,\n alert: value.alert,\n })\n};\n"]}
@@ -2,6 +2,10 @@ import { BSON } from 'bson';
2
2
  import { ReplyOnlyEvent } from '../binary/reply_only_event';
3
3
  export interface BinaryReplyOnlyEventWrapper {
4
4
  interfaceId: number;
5
+ /**
6
+ * The id of the connection session.
7
+ */
8
+ sessionId: number;
5
9
  reply: ReplyOnlyEvent;
6
10
  }
7
11
  export declare const BinaryReplyOnlyEventWrapper: {
@@ -1 +1 @@
1
- {"version":3,"file":"binary_reply_only_event_wrapper.d.ts","sourceRoot":"","sources":["../../../src/requests/binary_reply_only_event_wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,MAAM,CAAC;IAEpB,KAAK,EAAE,cAAc,CAAC;CAEvB;AAED,eAAO,MAAM,2BAA2B;yBACjB,UAAU,KAAG,2BAA2B;sBAC3C,2BAA2B,KAAG,UAAU;;sBAKxC,2BAA2B,KAAG,2BAA2B;qBAQ1D,KAAK,QAAQ,KAAG,2BAA2B;CAI7D,CAAC"}
1
+ {"version":3,"file":"binary_reply_only_event_wrapper.d.ts","sourceRoot":"","sources":["../../../src/requests/binary_reply_only_event_wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,KAAK,EAAE,cAAc,CAAC;CAEvB;AAED,eAAO,MAAM,2BAA2B;yBACjB,UAAU,KAAG,2BAA2B;sBAC3C,2BAA2B,KAAG,UAAU;;sBAMxC,2BAA2B,KAAG,2BAA2B;qBAS1D,KAAK,QAAQ,KAAG,2BAA2B;CAK7D,CAAC"}
@@ -10,6 +10,7 @@ exports.BinaryReplyOnlyEventWrapper = {
10
10
  toBinary: (value) => bson_1.BSON.serialize(exports.BinaryReplyOnlyEventWrapper.sanitize(value)),
11
11
  DEFAULT: Object.freeze({
12
12
  interfaceId: 0,
13
+ sessionId: 0,
13
14
  reply: reply_only_event_1.ReplyOnlyEvent.DEFAULT,
14
15
  }),
15
16
  sanitize: (value) => {
@@ -21,11 +22,13 @@ exports.BinaryReplyOnlyEventWrapper = {
21
22
  }
22
23
  return {
23
24
  interfaceId: sanitizer_1.sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),
25
+ sessionId: sanitizer_1.sanitizer.sanitizeInt(value.sessionId, 'sessionId'),
24
26
  reply: reply_only_event_1.ReplyOnlyEvent.sanitize(value.reply),
25
27
  };
26
28
  },
27
29
  convert: (value) => ({
28
30
  interfaceId: value.interfaceId,
31
+ sessionId: value.sessionId,
29
32
  reply: value.reply,
30
33
  })
31
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"binary_reply_only_event_wrapper.js","sourceRoot":"","sources":["../../../src/requests/binary_reply_only_event_wrapper.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACpD,+BAA4B;AAC5B,oDAAiD;AACjD,iEAA4D;AAS/C,QAAA,2BAA2B,GAAG;IACzC,UAAU,EAAE,CAAC,MAAkB,EAA+B,EAAE,CAAC,mCAA2B,CAAC,OAAO,CAAC,WAAI,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACrJ,QAAQ,EAAE,CAAC,KAAkC,EAAc,EAAE,CAAC,WAAI,CAAC,SAAS,CAAC,mCAA2B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzH,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;QACrB,WAAW,EAAE,CAAC;QACd,KAAK,EAAE,iCAAc,CAAC,OAAO;KAC9B,CAA0C;IAC3C,QAAQ,EAAE,CAAC,KAAkC,EAA+B,EAAE;QAC5E,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,wEAAwE,CAAC,CAAA;QAAC,CAAC;QACpH,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,uDAAuD,OAAO,KAAK,GAAG,CAAC,CAAA;QAAC,CAAC;QAC9H,OAAO;YACL,WAAW,EAAE,qBAAS,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC;YACpE,KAAK,EAAE,iCAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;SAC5C,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC,KAAoB,EAA+B,EAAE,CAAC,CAAC;QAC/D,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;CACH,CAAC","sourcesContent":["/* This file is generated. Do not modify by hand. */\nimport { BSON } from 'bson';\nimport { sanitizer } from '../gateway/sanitizer';\nimport { ReplyOnlyEvent } from '../binary/reply_only_event';\n\nexport interface BinaryReplyOnlyEventWrapper {\n interfaceId: number;\n\n reply: ReplyOnlyEvent;\n\n}\n\nexport const BinaryReplyOnlyEventWrapper = {\n fromBinary: (buffer: Uint8Array): BinaryReplyOnlyEventWrapper => BinaryReplyOnlyEventWrapper.convert(BSON.deserialize(buffer, { useBigInt64: true })),\n toBinary: (value: BinaryReplyOnlyEventWrapper): Uint8Array => BSON.serialize(BinaryReplyOnlyEventWrapper.sanitize(value)),\n DEFAULT: Object.freeze({\n interfaceId: 0,\n reply: ReplyOnlyEvent.DEFAULT,\n }) as Readonly<BinaryReplyOnlyEventWrapper>,\n sanitize: (value: BinaryReplyOnlyEventWrapper): BinaryReplyOnlyEventWrapper => {\n if (value == null) { throw new TypeError('Expected BinaryReplyOnlyEventWrapper object but got null or undefined.') }\n if (typeof value !== 'object') { throw new TypeError(`Expected BinaryReplyOnlyEventWrapper object but got ${typeof value}.`) }\n return {\n interfaceId: sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),\n reply: ReplyOnlyEvent.sanitize(value.reply),\n };\n },\n convert: (value: BSON.Document): BinaryReplyOnlyEventWrapper => ({\n interfaceId: value.interfaceId,\n reply: value.reply,\n })\n};\n"]}
1
+ {"version":3,"file":"binary_reply_only_event_wrapper.js","sourceRoot":"","sources":["../../../src/requests/binary_reply_only_event_wrapper.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACpD,+BAA4B;AAC5B,oDAAiD;AACjD,iEAA4D;AAc/C,QAAA,2BAA2B,GAAG;IACzC,UAAU,EAAE,CAAC,MAAkB,EAA+B,EAAE,CAAC,mCAA2B,CAAC,OAAO,CAAC,WAAI,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACrJ,QAAQ,EAAE,CAAC,KAAkC,EAAc,EAAE,CAAC,WAAI,CAAC,SAAS,CAAC,mCAA2B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzH,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;QACrB,WAAW,EAAE,CAAC;QACd,SAAS,EAAE,CAAC;QACZ,KAAK,EAAE,iCAAc,CAAC,OAAO;KAC9B,CAA0C;IAC3C,QAAQ,EAAE,CAAC,KAAkC,EAA+B,EAAE;QAC5E,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,wEAAwE,CAAC,CAAA;QAAC,CAAC;QACpH,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,uDAAuD,OAAO,KAAK,GAAG,CAAC,CAAA;QAAC,CAAC;QAC9H,OAAO;YACL,WAAW,EAAE,qBAAS,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC;YACpE,SAAS,EAAE,qBAAS,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC;YAC9D,KAAK,EAAE,iCAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;SAC5C,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC,KAAoB,EAA+B,EAAE,CAAC,CAAC;QAC/D,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;CACH,CAAC","sourcesContent":["/* This file is generated. Do not modify by hand. */\nimport { BSON } from 'bson';\nimport { sanitizer } from '../gateway/sanitizer';\nimport { ReplyOnlyEvent } from '../binary/reply_only_event';\n\nexport interface BinaryReplyOnlyEventWrapper {\n interfaceId: number;\n\n /**\n * The id of the connection session.\n */\n sessionId: number;\n\n reply: ReplyOnlyEvent;\n\n}\n\nexport const BinaryReplyOnlyEventWrapper = {\n fromBinary: (buffer: Uint8Array): BinaryReplyOnlyEventWrapper => BinaryReplyOnlyEventWrapper.convert(BSON.deserialize(buffer, { useBigInt64: true })),\n toBinary: (value: BinaryReplyOnlyEventWrapper): Uint8Array => BSON.serialize(BinaryReplyOnlyEventWrapper.sanitize(value)),\n DEFAULT: Object.freeze({\n interfaceId: 0,\n sessionId: 0,\n reply: ReplyOnlyEvent.DEFAULT,\n }) as Readonly<BinaryReplyOnlyEventWrapper>,\n sanitize: (value: BinaryReplyOnlyEventWrapper): BinaryReplyOnlyEventWrapper => {\n if (value == null) { throw new TypeError('Expected BinaryReplyOnlyEventWrapper object but got null or undefined.') }\n if (typeof value !== 'object') { throw new TypeError(`Expected BinaryReplyOnlyEventWrapper object but got ${typeof value}.`) }\n return {\n interfaceId: sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),\n sessionId: sanitizer.sanitizeInt(value.sessionId, 'sessionId'),\n reply: ReplyOnlyEvent.sanitize(value.reply),\n };\n },\n convert: (value: BSON.Document): BinaryReplyOnlyEventWrapper => ({\n interfaceId: value.interfaceId,\n sessionId: value.sessionId,\n reply: value.reply,\n })\n};\n"]}
@@ -8,6 +8,10 @@ export interface DisconnectedEvent {
8
8
  * The id of the interface that was disconnected.
9
9
  */
10
10
  interfaceId: number;
11
+ /**
12
+ * The id of the connection session.
13
+ */
14
+ sessionId: number;
11
15
  /**
12
16
  * The type of error that caused the disconnection.
13
17
  */
@@ -1 +1 @@
1
- {"version":3,"file":"disconnected_event.d.ts","sourceRoot":"","sources":["../../../src/requests/disconnected_event.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CAEtB;AAED,eAAO,MAAM,iBAAiB;yBACP,UAAU,KAAG,iBAAiB;sBACjC,iBAAiB,KAAG,UAAU;;sBAM9B,iBAAiB,KAAG,iBAAiB;qBAStC,KAAK,QAAQ,KAAG,iBAAiB;CAKnD,CAAC"}
1
+ {"version":3,"file":"disconnected_event.d.ts","sourceRoot":"","sources":["../../../src/requests/disconnected_event.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CAEtB;AAED,eAAO,MAAM,iBAAiB;yBACP,UAAU,KAAG,iBAAiB;sBACjC,iBAAiB,KAAG,UAAU;;sBAO9B,iBAAiB,KAAG,iBAAiB;qBAUtC,KAAK,QAAQ,KAAG,iBAAiB;CAMnD,CAAC"}
@@ -10,6 +10,7 @@ exports.DisconnectedEvent = {
10
10
  toBinary: (value) => bson_1.BSON.serialize(exports.DisconnectedEvent.sanitize(value)),
11
11
  DEFAULT: Object.freeze({
12
12
  interfaceId: 0,
13
+ sessionId: 0,
13
14
  errorType: 0,
14
15
  errorMessage: '',
15
16
  }),
@@ -22,12 +23,14 @@ exports.DisconnectedEvent = {
22
23
  }
23
24
  return {
24
25
  interfaceId: sanitizer_1.sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),
26
+ sessionId: sanitizer_1.sanitizer.sanitizeInt(value.sessionId, 'sessionId'),
25
27
  errorType: sanitizer_1.sanitizer.sanitizeEnum(value.errorType, 'Errors', errors_1.Errors, 'errorType'),
26
28
  errorMessage: sanitizer_1.sanitizer.sanitizeString(value.errorMessage, 'errorMessage'),
27
29
  };
28
30
  },
29
31
  convert: (value) => ({
30
32
  interfaceId: value.interfaceId,
33
+ sessionId: value.sessionId,
31
34
  errorType: value.errorType,
32
35
  errorMessage: value.errorMessage,
33
36
  })
@@ -1 +1 @@
1
- {"version":3,"file":"disconnected_event.js","sourceRoot":"","sources":["../../../src/requests/disconnected_event.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACpD,+BAA4B;AAC5B,oDAAiD;AACjD,+CAA4C;AAuB/B,QAAA,iBAAiB,GAAG;IAC/B,UAAU,EAAE,CAAC,MAAkB,EAAqB,EAAE,CAAC,yBAAiB,CAAC,OAAO,CAAC,WAAI,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACjI,QAAQ,EAAE,CAAC,KAAwB,EAAc,EAAE,CAAC,WAAI,CAAC,SAAS,CAAC,yBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrG,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;QACrB,WAAW,EAAE,CAAC;QACd,SAAS,EAAE,CAAW;QACtB,YAAY,EAAE,EAAE;KACjB,CAAgC;IACjC,QAAQ,EAAE,CAAC,KAAwB,EAAqB,EAAE;QACxD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,8DAA8D,CAAC,CAAA;QAAC,CAAC;QAC1G,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,6CAA6C,OAAO,KAAK,GAAG,CAAC,CAAA;QAAC,CAAC;QACpH,OAAO;YACL,WAAW,EAAE,qBAAS,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC;YACpE,SAAS,EAAE,qBAAS,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,EAAE,eAAM,EAAE,WAAW,CAAC;YACjF,YAAY,EAAE,qBAAS,CAAC,cAAc,CAAC,KAAK,CAAC,YAAY,EAAE,cAAc,CAAC;SAC3E,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC,KAAoB,EAAqB,EAAE,CAAC,CAAC;QACrD,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,YAAY,EAAE,KAAK,CAAC,YAAY;KACjC,CAAC;CACH,CAAC","sourcesContent":["/* This file is generated. Do not modify by hand. */\nimport { BSON } from 'bson';\nimport { sanitizer } from '../gateway/sanitizer';\nimport { Errors } from '../requests/errors';\n\n/**\n * Event that is sent when a connection is lost.\n */\nexport interface DisconnectedEvent {\n /**\n * The id of the interface that was disconnected.\n */\n interfaceId: number;\n\n /**\n * The type of error that caused the disconnection.\n */\n errorType: Errors;\n\n /**\n * The message describing the error.\n */\n errorMessage: string;\n\n}\n\nexport const DisconnectedEvent = {\n fromBinary: (buffer: Uint8Array): DisconnectedEvent => DisconnectedEvent.convert(BSON.deserialize(buffer, { useBigInt64: true })),\n toBinary: (value: DisconnectedEvent): Uint8Array => BSON.serialize(DisconnectedEvent.sanitize(value)),\n DEFAULT: Object.freeze({\n interfaceId: 0,\n errorType: 0 as Errors,\n errorMessage: '',\n }) as Readonly<DisconnectedEvent>,\n sanitize: (value: DisconnectedEvent): DisconnectedEvent => {\n if (value == null) { throw new TypeError('Expected DisconnectedEvent object but got null or undefined.') }\n if (typeof value !== 'object') { throw new TypeError(`Expected DisconnectedEvent object but got ${typeof value}.`) }\n return {\n interfaceId: sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),\n errorType: sanitizer.sanitizeEnum(value.errorType, 'Errors', Errors, 'errorType'),\n errorMessage: sanitizer.sanitizeString(value.errorMessage, 'errorMessage'),\n };\n },\n convert: (value: BSON.Document): DisconnectedEvent => ({\n interfaceId: value.interfaceId,\n errorType: value.errorType,\n errorMessage: value.errorMessage,\n })\n};\n"]}
1
+ {"version":3,"file":"disconnected_event.js","sourceRoot":"","sources":["../../../src/requests/disconnected_event.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACpD,+BAA4B;AAC5B,oDAAiD;AACjD,+CAA4C;AA4B/B,QAAA,iBAAiB,GAAG;IAC/B,UAAU,EAAE,CAAC,MAAkB,EAAqB,EAAE,CAAC,yBAAiB,CAAC,OAAO,CAAC,WAAI,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACjI,QAAQ,EAAE,CAAC,KAAwB,EAAc,EAAE,CAAC,WAAI,CAAC,SAAS,CAAC,yBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrG,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;QACrB,WAAW,EAAE,CAAC;QACd,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,CAAW;QACtB,YAAY,EAAE,EAAE;KACjB,CAAgC;IACjC,QAAQ,EAAE,CAAC,KAAwB,EAAqB,EAAE;QACxD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,8DAA8D,CAAC,CAAA;QAAC,CAAC;QAC1G,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,6CAA6C,OAAO,KAAK,GAAG,CAAC,CAAA;QAAC,CAAC;QACpH,OAAO;YACL,WAAW,EAAE,qBAAS,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC;YACpE,SAAS,EAAE,qBAAS,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC;YAC9D,SAAS,EAAE,qBAAS,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,EAAE,eAAM,EAAE,WAAW,CAAC;YACjF,YAAY,EAAE,qBAAS,CAAC,cAAc,CAAC,KAAK,CAAC,YAAY,EAAE,cAAc,CAAC;SAC3E,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC,KAAoB,EAAqB,EAAE,CAAC,CAAC;QACrD,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,YAAY,EAAE,KAAK,CAAC,YAAY;KACjC,CAAC;CACH,CAAC","sourcesContent":["/* This file is generated. Do not modify by hand. */\nimport { BSON } from 'bson';\nimport { sanitizer } from '../gateway/sanitizer';\nimport { Errors } from '../requests/errors';\n\n/**\n * Event that is sent when a connection is lost.\n */\nexport interface DisconnectedEvent {\n /**\n * The id of the interface that was disconnected.\n */\n interfaceId: number;\n\n /**\n * The id of the connection session.\n */\n sessionId: number;\n\n /**\n * The type of error that caused the disconnection.\n */\n errorType: Errors;\n\n /**\n * The message describing the error.\n */\n errorMessage: string;\n\n}\n\nexport const DisconnectedEvent = {\n fromBinary: (buffer: Uint8Array): DisconnectedEvent => DisconnectedEvent.convert(BSON.deserialize(buffer, { useBigInt64: true })),\n toBinary: (value: DisconnectedEvent): Uint8Array => BSON.serialize(DisconnectedEvent.sanitize(value)),\n DEFAULT: Object.freeze({\n interfaceId: 0,\n sessionId: 0,\n errorType: 0 as Errors,\n errorMessage: '',\n }) as Readonly<DisconnectedEvent>,\n sanitize: (value: DisconnectedEvent): DisconnectedEvent => {\n if (value == null) { throw new TypeError('Expected DisconnectedEvent object but got null or undefined.') }\n if (typeof value !== 'object') { throw new TypeError(`Expected DisconnectedEvent object but got ${typeof value}.`) }\n return {\n interfaceId: sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),\n sessionId: sanitizer.sanitizeInt(value.sessionId, 'sessionId'),\n errorType: sanitizer.sanitizeEnum(value.errorType, 'Errors', Errors, 'errorType'),\n errorMessage: sanitizer.sanitizeString(value.errorMessage, 'errorMessage'),\n };\n },\n convert: (value: BSON.Document): DisconnectedEvent => ({\n interfaceId: value.interfaceId,\n sessionId: value.sessionId,\n errorType: value.errorType,\n errorMessage: value.errorMessage,\n })\n};\n"]}
@@ -2,6 +2,10 @@ import { BSON } from 'bson';
2
2
  import { UnknownResponseEvent } from '../binary/unknown_response_event';
3
3
  export interface UnknownBinaryResponseEventWrapper {
4
4
  interfaceId: number;
5
+ /**
6
+ * The id of the connection session.
7
+ */
8
+ sessionId: number;
5
9
  unknownResponse: UnknownResponseEvent;
6
10
  }
7
11
  export declare const UnknownBinaryResponseEventWrapper: {
@@ -1 +1 @@
1
- {"version":3,"file":"unknown_binary_response_event_wrapper.d.ts","sourceRoot":"","sources":["../../../src/requests/unknown_binary_response_event_wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,MAAM,WAAW,iCAAiC;IAChD,WAAW,EAAE,MAAM,CAAC;IAEpB,eAAe,EAAE,oBAAoB,CAAC;CAEvC;AAED,eAAO,MAAM,iCAAiC;yBACvB,UAAU,KAAG,iCAAiC;sBACjD,iCAAiC,KAAG,UAAU;;sBAK9C,iCAAiC,KAAG,iCAAiC;qBAQtE,KAAK,QAAQ,KAAG,iCAAiC;CAInE,CAAC"}
1
+ {"version":3,"file":"unknown_binary_response_event_wrapper.d.ts","sourceRoot":"","sources":["../../../src/requests/unknown_binary_response_event_wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,MAAM,WAAW,iCAAiC;IAChD,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,eAAe,EAAE,oBAAoB,CAAC;CAEvC;AAED,eAAO,MAAM,iCAAiC;yBACvB,UAAU,KAAG,iCAAiC;sBACjD,iCAAiC,KAAG,UAAU;;sBAM9C,iCAAiC,KAAG,iCAAiC;qBAStE,KAAK,QAAQ,KAAG,iCAAiC;CAKnE,CAAC"}
@@ -10,6 +10,7 @@ exports.UnknownBinaryResponseEventWrapper = {
10
10
  toBinary: (value) => bson_1.BSON.serialize(exports.UnknownBinaryResponseEventWrapper.sanitize(value)),
11
11
  DEFAULT: Object.freeze({
12
12
  interfaceId: 0,
13
+ sessionId: 0,
13
14
  unknownResponse: unknown_response_event_1.UnknownResponseEvent.DEFAULT,
14
15
  }),
15
16
  sanitize: (value) => {
@@ -21,11 +22,13 @@ exports.UnknownBinaryResponseEventWrapper = {
21
22
  }
22
23
  return {
23
24
  interfaceId: sanitizer_1.sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),
25
+ sessionId: sanitizer_1.sanitizer.sanitizeInt(value.sessionId, 'sessionId'),
24
26
  unknownResponse: unknown_response_event_1.UnknownResponseEvent.sanitize(value.unknownResponse),
25
27
  };
26
28
  },
27
29
  convert: (value) => ({
28
30
  interfaceId: value.interfaceId,
31
+ sessionId: value.sessionId,
29
32
  unknownResponse: value.unknownResponse,
30
33
  })
31
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"unknown_binary_response_event_wrapper.js","sourceRoot":"","sources":["../../../src/requests/unknown_binary_response_event_wrapper.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACpD,+BAA4B;AAC5B,oDAAiD;AACjD,6EAAwE;AAS3D,QAAA,iCAAiC,GAAG;IAC/C,UAAU,EAAE,CAAC,MAAkB,EAAqC,EAAE,CAAC,yCAAiC,CAAC,OAAO,CAAC,WAAI,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACjK,QAAQ,EAAE,CAAC,KAAwC,EAAc,EAAE,CAAC,WAAI,CAAC,SAAS,CAAC,yCAAiC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrI,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;QACrB,WAAW,EAAE,CAAC;QACd,eAAe,EAAE,6CAAoB,CAAC,OAAO;KAC9C,CAAgD;IACjD,QAAQ,EAAE,CAAC,KAAwC,EAAqC,EAAE;QACxF,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,8EAA8E,CAAC,CAAA;QAAC,CAAC;QAC1H,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,6DAA6D,OAAO,KAAK,GAAG,CAAC,CAAA;QAAC,CAAC;QACpI,OAAO;YACL,WAAW,EAAE,qBAAS,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC;YACpE,eAAe,EAAE,6CAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC;SACtE,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC,KAAoB,EAAqC,EAAE,CAAC,CAAC;QACrE,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,eAAe,EAAE,KAAK,CAAC,eAAe;KACvC,CAAC;CACH,CAAC","sourcesContent":["/* This file is generated. Do not modify by hand. */\nimport { BSON } from 'bson';\nimport { sanitizer } from '../gateway/sanitizer';\nimport { UnknownResponseEvent } from '../binary/unknown_response_event';\n\nexport interface UnknownBinaryResponseEventWrapper {\n interfaceId: number;\n\n unknownResponse: UnknownResponseEvent;\n\n}\n\nexport const UnknownBinaryResponseEventWrapper = {\n fromBinary: (buffer: Uint8Array): UnknownBinaryResponseEventWrapper => UnknownBinaryResponseEventWrapper.convert(BSON.deserialize(buffer, { useBigInt64: true })),\n toBinary: (value: UnknownBinaryResponseEventWrapper): Uint8Array => BSON.serialize(UnknownBinaryResponseEventWrapper.sanitize(value)),\n DEFAULT: Object.freeze({\n interfaceId: 0,\n unknownResponse: UnknownResponseEvent.DEFAULT,\n }) as Readonly<UnknownBinaryResponseEventWrapper>,\n sanitize: (value: UnknownBinaryResponseEventWrapper): UnknownBinaryResponseEventWrapper => {\n if (value == null) { throw new TypeError('Expected UnknownBinaryResponseEventWrapper object but got null or undefined.') }\n if (typeof value !== 'object') { throw new TypeError(`Expected UnknownBinaryResponseEventWrapper object but got ${typeof value}.`) }\n return {\n interfaceId: sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),\n unknownResponse: UnknownResponseEvent.sanitize(value.unknownResponse),\n };\n },\n convert: (value: BSON.Document): UnknownBinaryResponseEventWrapper => ({\n interfaceId: value.interfaceId,\n unknownResponse: value.unknownResponse,\n })\n};\n"]}
1
+ {"version":3,"file":"unknown_binary_response_event_wrapper.js","sourceRoot":"","sources":["../../../src/requests/unknown_binary_response_event_wr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AC,eAAe;KACvC,CAAC;CACH,CAAC","sourcesContent":["/* This file is generated. Do not modify by hand. */\nimport { BSON } from 'bson';\nimport { sanitizer } from '../gateway/sanitizer';\nimport { UnknownResponseEvent } from '../binary/unknown_response_event';\n\nexport interface UnknownBinaryResponseEventWrapper {\n interfaceId: number;\n\n /**\n * The id of the connection session.\n */\n sessionId: number;\n\n unknownResponse: UnknownResponseEvent;\n\n}\n\nexport const UnknownBinaryResponseEventWrapper = {\n fromBinary: (buffer: Uint8Array): UnknownBinaryResponseEventWrapper => UnknownBinaryResponseEventWrapper.convert(BSON.deserialize(buffer, { useBigInt64: true })),\n toBinary: (value: UnknownBinaryResponseEventWrapper): Uint8Array => BSON.serialize(UnknownBinaryResponseEventWrapper.sanitize(value)),\n DEFAULT: Object.freeze({\n interfaceId: 0,\n sessionId: 0,\n unknownResponse: UnknownResponseEvent.DEFAULT,\n }) as Readonly<UnknownBinaryResponseEventWrapper>,\n sanitize: (value: UnknownBinaryResponseEventWrapper): UnknownBinaryResponseEventWrapper => {\n if (value == null) { throw new TypeError('Expected UnknownBinaryResponseEventWrapper object but got null or undefined.') }\n if (typeof value !== 'object') { throw new TypeError(`Expected UnknownBinaryResponseEventWrapper object but got ${typeof value}.`) }\n return {\n interfaceId: sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),\n sessionId: sanitizer.sanitizeInt(value.sessionId, 'sessionId'),\n unknownResponse: UnknownResponseEvent.sanitize(value.unknownResponse),\n };\n },\n convert: (value: BSON.Document): UnknownBinaryResponseEventWrapper => ({\n interfaceId: value.interfaceId,\n sessionId: value.sessionId,\n unknownResponse: value.unknownResponse,\n })\n};\n"]}
@@ -2,6 +2,10 @@ import { BSON } from 'bson';
2
2
  import { UnknownResponseEvent } from '../ascii/unknown_response_event';
3
3
  export interface UnknownResponseEventWrapper {
4
4
  interfaceId: number;
5
+ /**
6
+ * The id of the connection session.
7
+ */
8
+ sessionId: number;
5
9
  unknownResponse: UnknownResponseEvent;
6
10
  }
7
11
  export declare const UnknownResponseEventWrapper: {
@@ -1 +1 @@
1
- {"version":3,"file":"unknown_response_event_wrapper.d.ts","sourceRoot":"","sources":["../../../src/requests/unknown_response_event_wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,MAAM,CAAC;IAEpB,eAAe,EAAE,oBAAoB,CAAC;CAEvC;AAED,eAAO,MAAM,2BAA2B;yBACjB,UAAU,KAAG,2BAA2B;sBAC3C,2BAA2B,KAAG,UAAU;;sBAKxC,2BAA2B,KAAG,2BAA2B;qBAQ1D,KAAK,QAAQ,KAAG,2BAA2B;CAI7D,CAAC"}
1
+ {"version":3,"file":"unknown_response_event_wrapper.d.ts","sourceRoot":"","sources":["../../../src/requests/unknown_response_event_wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,eAAe,EAAE,oBAAoB,CAAC;CAEvC;AAED,eAAO,MAAM,2BAA2B;yBACjB,UAAU,KAAG,2BAA2B;sBAC3C,2BAA2B,KAAG,UAAU;;sBAMxC,2BAA2B,KAAG,2BAA2B;qBAS1D,KAAK,QAAQ,KAAG,2BAA2B;CAK7D,CAAC"}
@@ -10,6 +10,7 @@ exports.UnknownResponseEventWrapper = {
10
10
  toBinary: (value) => bson_1.BSON.serialize(exports.UnknownResponseEventWrapper.sanitize(value)),
11
11
  DEFAULT: Object.freeze({
12
12
  interfaceId: 0,
13
+ sessionId: 0,
13
14
  unknownResponse: unknown_response_event_1.UnknownResponseEvent.DEFAULT,
14
15
  }),
15
16
  sanitize: (value) => {
@@ -21,11 +22,13 @@ exports.UnknownResponseEventWrapper = {
21
22
  }
22
23
  return {
23
24
  interfaceId: sanitizer_1.sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),
25
+ sessionId: sanitizer_1.sanitizer.sanitizeInt(value.sessionId, 'sessionId'),
24
26
  unknownResponse: unknown_response_event_1.UnknownResponseEvent.sanitize(value.unknownResponse),
25
27
  };
26
28
  },
27
29
  convert: (value) => ({
28
30
  interfaceId: value.interfaceId,
31
+ sessionId: value.sessionId,
29
32
  unknownResponse: value.unknownResponse,
30
33
  })
31
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"unknown_response_event_wrapper.js","sourceRoot":"","sources":["../../../src/requests/unknown_response_event_wrapper.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACpD,+BAA4B;AAC5B,oDAAiD;AACjD,4EAAuE;AAS1D,QAAA,2BAA2B,GAAG;IACzC,UAAU,EAAE,CAAC,MAAkB,EAA+B,EAAE,CAAC,mCAA2B,CAAC,OAAO,CAAC,WAAI,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACrJ,QAAQ,EAAE,CAAC,KAAkC,EAAc,EAAE,CAAC,WAAI,CAAC,SAAS,CAAC,mCAA2B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzH,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;QACrB,WAAW,EAAE,CAAC;QACd,eAAe,EAAE,6CAAoB,CAAC,OAAO;KAC9C,CAA0C;IAC3C,QAAQ,EAAE,CAAC,KAAkC,EAA+B,EAAE;QAC5E,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,wEAAwE,CAAC,CAAA;QAAC,CAAC;QACpH,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,uDAAuD,OAAO,KAAK,GAAG,CAAC,CAAA;QAAC,CAAC;QAC9H,OAAO;YACL,WAAW,EAAE,qBAAS,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC;YACpE,eAAe,EAAE,6CAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC;SACtE,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC,KAAoB,EAA+B,EAAE,CAAC,CAAC;QAC/D,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,eAAe,EAAE,KAAK,CAAC,eAAe;KACvC,CAAC;CACH,CAAC","sourcesContent":["/* This file is generated. Do not modify by hand. */\nimport { BSON } from 'bson';\nimport { sanitizer } from '../gateway/sanitizer';\nimport { UnknownResponseEvent } from '../ascii/unknown_response_event';\n\nexport interface UnknownResponseEventWrapper {\n interfaceId: number;\n\n unknownResponse: UnknownResponseEvent;\n\n}\n\nexport const UnknownResponseEventWrapper = {\n fromBinary: (buffer: Uint8Array): UnknownResponseEventWrapper => UnknownResponseEventWrapper.convert(BSON.deserialize(buffer, { useBigInt64: true })),\n toBinary: (value: UnknownResponseEventWrapper): Uint8Array => BSON.serialize(UnknownResponseEventWrapper.sanitize(value)),\n DEFAULT: Object.freeze({\n interfaceId: 0,\n unknownResponse: UnknownResponseEvent.DEFAULT,\n }) as Readonly<UnknownResponseEventWrapper>,\n sanitize: (value: UnknownResponseEventWrapper): UnknownResponseEventWrapper => {\n if (value == null) { throw new TypeError('Expected UnknownResponseEventWrapper object but got null or undefined.') }\n if (typeof value !== 'object') { throw new TypeError(`Expected UnknownResponseEventWrapper object but got ${typeof value}.`) }\n return {\n interfaceId: sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),\n unknownResponse: UnknownResponseEvent.sanitize(value.unknownResponse),\n };\n },\n convert: (value: BSON.Document): UnknownResponseEventWrapper => ({\n interfaceId: value.interfaceId,\n unknownResponse: value.unknownResponse,\n })\n};\n"]}
1
+ {"version":3,"file":"unknown_response_event_wrapper.js","sourceRoot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SAAS;QAC1B,eAAe,EAAE,KAAK,CAAC,eAAe;KACvC,CAAC;CACH,CAAC","sourcesContent":["/* This file is generated. Do not modify by hand. */\nimport { BSON } from 'bson';\nimport { sanitizer } from '../gateway/sanitizer';\nimport { UnknownResponseEvent } from '../ascii/unknown_response_event';\n\nexport interface UnknownResponseEventWrapper {\n interfaceId: number;\n\n /**\n * The id of the connection session.\n */\n sessionId: number;\n\n unknownResponse: UnknownResponseEvent;\n\n}\n\nexport const UnknownResponseEventWrapper = {\n fromBinary: (buffer: Uint8Array): UnknownResponseEventWrapper => UnknownResponseEventWrapper.convert(BSON.deserialize(buffer, { useBigInt64: true })),\n toBinary: (value: UnknownResponseEventWrapper): Uint8Array => BSON.serialize(UnknownResponseEventWrapper.sanitize(value)),\n DEFAULT: Object.freeze({\n interfaceId: 0,\n sessionId: 0,\n unknownResponse: UnknownResponseEvent.DEFAULT,\n }) as Readonly<UnknownResponseEventWrapper>,\n sanitize: (value: UnknownResponseEventWrapper): UnknownResponseEventWrapper => {\n if (value == null) { throw new TypeError('Expected UnknownResponseEventWrapper object but got null or undefined.') }\n if (typeof value !== 'object') { throw new TypeError(`Expected UnknownResponseEventWrapper object but got ${typeof value}.`) }\n return {\n interfaceId: sanitizer.sanitizeInt(value.interfaceId, 'interfaceId'),\n sessionId: sanitizer.sanitizeInt(value.sessionId, 'sessionId'),\n unknownResponse: UnknownResponseEvent.sanitize(value.unknownResponse),\n };\n },\n convert: (value: BSON.Document): UnknownResponseEventWrapper => ({\n interfaceId: value.interfaceId,\n sessionId: value.sessionId,\n unknownResponse: value.unknownResponse,\n })\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaber/motion",
3
- "version": "7.8.4",
3
+ "version": "7.9.0",
4
4
  "description": "Zaber Motion Library is a multi-platform library used to operate Zaber devices.",
5
5
  "keywords": [],
6
6
  "main": "dist/lib/index.js",