rticonnextdds-connector 1.0.0 → 1.3.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 (36) hide show
  1. package/LICENSE.pdf +0 -0
  2. package/README.md +9 -8
  3. package/README.rst +14 -12
  4. package/examples/nodejs/ShapeExample.xml +3 -4
  5. package/examples/nodejs/simple/writer.js +2 -2
  6. package/examples/nodejs/web_socket/README.md +7 -5
  7. package/examples/nodejs/web_socket/indexChart.html +121 -0
  8. package/examples/nodejs/web_socket/indexMaps.html +1 -1
  9. package/examples/nodejs/web_socket/reader_websocket.js +12 -2
  10. package/package.json +18 -9
  11. package/rticonnextdds-connector/lib/linux-arm/libnddsc.so +0 -0
  12. package/rticonnextdds-connector/lib/linux-arm/libnddscore.so +0 -0
  13. package/rticonnextdds-connector/lib/linux-arm/librtiddsconnector.so +0 -0
  14. package/rticonnextdds-connector/lib/linux-arm64/libnddsc.so +0 -0
  15. package/rticonnextdds-connector/lib/linux-arm64/libnddscore.so +0 -0
  16. package/rticonnextdds-connector/lib/linux-arm64/librtiddsconnector.so +0 -0
  17. package/rticonnextdds-connector/lib/linux-x64/libnddsc.so +0 -0
  18. package/rticonnextdds-connector/lib/{x64Win64VS2013/rtiddsconnector.dll → linux-x64/libnddscore.so} +0 -0
  19. package/rticonnextdds-connector/lib/linux-x64/librtiddsconnector.so +0 -0
  20. package/rticonnextdds-connector/lib/osx-x64/libnddsc.dylib +0 -0
  21. package/rticonnextdds-connector/lib/osx-x64/libnddscore.dylib +0 -0
  22. package/rticonnextdds-connector/lib/osx-x64/librtiddsconnector.dylib +0 -0
  23. package/rticonnextdds-connector/lib/win-x64/nddsc.dll +0 -0
  24. package/rticonnextdds-connector/lib/win-x64/nddscore.dll +0 -0
  25. package/rticonnextdds-connector/lib/win-x64/rtiddsconnector.dll +0 -0
  26. package/rticonnextdds-connector/lib/win-x64/vcruntime140.dll +0 -0
  27. package/rticonnextdds-connector.js +323 -257
  28. package/rticonnextdds-connector/LICENSE.pdf +0 -0
  29. package/rticonnextdds-connector/README.md +0 -43
  30. package/rticonnextdds-connector/lib/armv6vfphLinux3.xgcc4.7.2/librtiddsconnector.so +0 -0
  31. package/rticonnextdds-connector/lib/i86Linux3.xgcc4.6.3/librtiddsconnector.so +0 -0
  32. package/rticonnextdds-connector/lib/i86Win32VS2010/msvcr100.dll +0 -0
  33. package/rticonnextdds-connector/lib/i86Win32VS2010/rtiddsconnector.dll +0 -0
  34. package/rticonnextdds-connector/lib/x64Darwin16clang8.0/librtiddsconnector.dylib +0 -0
  35. package/rticonnextdds-connector/lib/x64Linux2.6gcc4.4.5/librtiddsconnector.so +0 -0
  36. package/rticonnextdds-connector/lib/x64Win64VS2013/msvcr120.dll +0 -0
@@ -7,86 +7,99 @@
7
7
  ******************************************************************************/
8
8
 
9
9
  const os = require('os')
10
- const ref = require('ref')
11
- const ffi = require('ffi')
10
+ const ref = require('ref-napi')
11
+ const ffi = require('ffi-napi')
12
12
  const path = require('path')
13
- const StructType = require('ref-struct')
13
+ const StructType = require('ref-struct-di')(ref)
14
14
  const EventEmitter = require('events').EventEmitter
15
15
 
16
16
  /**
17
17
  * The Node.js representation of the RTI_Connector_Options structure within
18
18
  * the core.
19
19
  *
20
- * We define it here using the module ref-struct (require above). This allows
20
+ * We define it here using the module ref-struct (require above). This allows
21
21
  * us to pass it by value into the Core when creating a :class:`Connector` object.
22
22
  *
23
23
  * @private
24
24
  */
25
- var _ConnectorOptions = StructType({
25
+ const _ConnectorOptions = StructType({
26
26
  enable_on_data_event: ref.types.int,
27
27
  one_based_sequence_indexing: ref.types.int
28
28
  })
29
29
 
30
+ // We ignore the loading of the libraries in code coverage since it is
31
+ // not easily testable
32
+ /* istanbul ignore next */
30
33
  class _ConnectorBinding {
31
34
  constructor () {
32
- let libArch = ''
35
+ let libDir = ''
33
36
  let libName = ''
34
37
  let additionalLib = null
38
+ let isWindows = false
35
39
 
36
- // Obtain the name of the library that contains the Connector binding
37
- if (os.arch() === 'x64') {
40
+ // Obtain the name of the library that contains the Connector native libraries
41
+ if (os.arch() === 'arm64') {
42
+ if (os.platform() === 'linux') {
43
+ libDir = 'linux-arm64'
44
+ libName = 'librtiddsconnector.so'
45
+ } else {
46
+ throw new Error('This platform (' + os.platform() + ' ' + os.arch() + ') is not supported')
47
+ }
48
+ } else if (os.arch() === 'arm') {
49
+ if (os.platform() === 'linux') {
50
+ libDir = 'linux-arm'
51
+ libName = 'librtiddsconnector.so'
52
+ } else {
53
+ throw new Error('This platform (' + os.platform() + ' ' + os.arch() + ') is not supported')
54
+ }
55
+ } else {
56
+ // Note that we are intentionally not checking if os.arch() is x64.
57
+ // This allows somebody with access to 32-bit libraries to replace them
58
+ // in the corresponding x64 directory and we will try to load them.
59
+ // This behaviour is not officially supported.
38
60
  switch (os.platform()) {
39
61
  case 'darwin':
40
- libArch = 'x64Darwin16clang8.0'
62
+ libDir = 'osx-x64'
41
63
  libName = 'librtiddsconnector.dylib'
42
64
  break
43
65
  case 'linux':
44
- libArch = 'x64Linux2.6gcc4.4.5'
66
+ libDir = 'linux-x64'
45
67
  libName = 'librtiddsconnector.so'
46
68
  break
47
69
  // Windows returns win32 even on 64-bit platforms
48
70
  case 'win32':
49
- libArch = 'x64Win64VS2013'
71
+ libDir = 'win-x64'
50
72
  libName = 'rtiddsconnector.dll'
51
- additionalLib = 'msvcr120.dll'
52
- break
53
- default:
54
- throw new Error(os.platform() + ' not yet supported')
55
- }
56
- } else if (os.arch() === 'ia32') {
57
- switch (os.platform()) {
58
- case 'linux':
59
- libArch = 'i86Linux3.xgcc4.6.3'
60
- libName = 'librtiddsconnector.so'
61
- break
62
- case 'win32':
63
- libArch = 'i86Win32VS2010'
64
- libName = 'rtiddsconnector.dll'
65
- additionalLib = 'msvcr100.dll'
66
- break
67
- default:
68
- throw new Error(os.platform() + ' not yet supported')
69
- }
70
- } else if (os.arch() === 'arm') {
71
- switch (os.platform()) {
72
- case 'linux':
73
- libArch = 'armv6vfphLinux3.xgcc4.7.2'
74
- libName = 'librtiddsconnector.so'
73
+ additionalLib = 'vcruntime140.dll'
74
+ isWindows = true
75
75
  break
76
76
  default:
77
77
  throw new Error(os.platform() + ' not yet supported')
78
78
  }
79
79
  }
80
80
 
81
+ // Connector is not supported on a (non ARM) 32-bit platform
82
+ // We continue, incase the user has manually replaced the libraries within
83
+ // the directory which we are going to load.
84
+ if (os.arch() === 'ia32') {
85
+ console.log('Warning: 32-bit ' + os.platform() + ' is not supported')
86
+ }
87
+
81
88
  if (additionalLib !== null) {
82
89
  try {
83
- ffi.Library(path.join(__dirname, '/rticonnextdds-connector/lib/', libArch, '/', additionalLib))
90
+ ffi.Library(path.join(__dirname, '/rticonnextdds-connector/lib/', libDir, '/', additionalLib))
84
91
  } catch (_) {
85
92
  // ignore this error and try to run without explicitly loading the VC++ runtime
86
93
  }
87
94
  }
88
95
 
89
- this.library = path.join(__dirname, '/rticonnextdds-connector/lib/', libArch, '/', libName)
96
+ // On Windows we need to explicitly load the dependent libraries
97
+ if (isWindows) {
98
+ ffi.Library(path.join(__dirname, '/rticonnextdds-connector/lib/', libDir, '/', 'nddscore.dll'))
99
+ ffi.Library(path.join(__dirname, '/rticonnextdds-connector/lib/', libDir, '/', 'nddsc.dll'))
100
+ }
101
+
102
+ this.library = path.join(__dirname, '/rticonnextdds-connector/lib/', libDir, '/', libName)
90
103
  // Obtain FFI'd methods for all of the APIs which we require from the binding,
91
104
  // specifying the argument types and return types. If any of the types are
92
105
  // not builtin Node types then we have to use the ref module to represent them.
@@ -125,16 +138,16 @@ class _ConnectorBinding {
125
138
  RTI_Connector_get_last_error_message: ['char *', []],
126
139
  RTI_Connector_get_native_instance: ['int', ['pointer', 'string', ref.refType('pointer')]],
127
140
  RTI_Connector_free_string: ['void', ['char *']],
128
- RTI_Connector_set_max_objects_per_thread: ['int', ['int']],
129
- RTIDDSConnector_getJSONInstance:['char *', ['pointer', 'string']],
141
+ RTIDDSConnector_getJSONInstance: ['char *', ['pointer', 'string']],
130
142
  // This API is only used in the unit tests
131
- RTI_Connector_create_test_scenario: ['int', ['pointer', 'int', 'pointer']]
143
+ RTI_Connector_create_test_scenario: ['int', ['pointer', 'int', 'pointer']],
144
+ RTI_Connector_get_build_versions: ['int', [ref.refType('char *'), ref.refType('char *')]]
132
145
  })
133
146
  }
134
147
  }
135
148
 
136
149
  // Create an instance of the connectorBinding class, allowing us to call the FFI'd methods
137
- var connectorBinding = new _ConnectorBinding()
150
+ const connectorBinding = new _ConnectorBinding()
138
151
 
139
152
  /**
140
153
  * Copies a natively allocated string into a Node.js string and frees the
@@ -212,7 +225,7 @@ class TimeoutError extends Error {
212
225
  */
213
226
  class DDSError extends Error {
214
227
  /**
215
- * This error is thrown when an error is encountered from within one of the
228
+ * This error is thrown when an error is encountered from within one of the
216
229
  * APIs within the *RTI Connext DDS* Core.
217
230
  * @private
218
231
  */
@@ -226,7 +239,7 @@ class DDSError extends Error {
226
239
  }
227
240
 
228
241
  /**
229
- * Checks the value returned by the functions in the core for success and
242
+ * Checks the value returned by the functions in the core for success and
230
243
  * throws the appropriate error on failure.
231
244
  *
232
245
  * We do not handle DDS_RETCODE_NO_DATA here, since in some operations (those
@@ -308,13 +321,17 @@ function _getAnyValue (getter, connector, inputName, index, fieldName) {
308
321
  return !!boolVal.deref()
309
322
  } else if (selection === _AnyValueKind.connector_string) {
310
323
  const nodeStr = _moveCString(stringVal.deref())
311
- // Try to convert the returned string to a JSON object. We can now return
312
- // one of two things:
324
+ // If this is NOT a numeric string, try to convert the returned string to a
325
+ // JSON object. We can now return one of two things:
313
326
  // - An actual string (if the JSON.parse call fails)
314
327
  // - A JSON object (if the JSON.parse call succeeds)
315
- try {
316
- return JSON.parse(nodeStr)
317
- } catch (err) {
328
+ if (isNaN(nodeStr)) {
329
+ try {
330
+ return JSON.parse(nodeStr)
331
+ } catch (err) {
332
+ return nodeStr
333
+ }
334
+ } else {
318
335
  return nodeStr
319
336
  }
320
337
  } else {
@@ -326,7 +343,7 @@ function _getAnyValue (getter, connector, inputName, index, fieldName) {
326
343
  /**
327
344
  * Provides access to the meta-data contained in samples read by an input.
328
345
  *
329
- * Note: The Infos class is deprecated and should not be used directly.
346
+ * Note: The Infos class is deprecated and should not be used directly.
330
347
  * Instead, use :meth:`SampleIterator.info`.
331
348
  *
332
349
  * @private
@@ -353,7 +370,7 @@ class Infos {
353
370
  /**
354
371
  * Checks if the sample at the given index contains valid data.
355
372
  *
356
- * @param {number} index - The index of the sample in the :class:`Input`'s
373
+ * @param {number} index - The index of the sample in the :class:`Input`'s
357
374
  * queue to check for valid data
358
375
  * @returns{boolean} True if the sample contains valid data
359
376
  * @private
@@ -389,14 +406,14 @@ class SampleIterator {
389
406
  /**
390
407
  * A SampleIterator provides access to the data receieved by an :class:`Input`.
391
408
  *
392
- * The :attr:`Input.samples` attribute implements a :class:`SampleIterator`,
393
- * meaning it can be iterated over. An individual sample can be accessed
409
+ * The :attr:`Input.samples` attribute implements a :class:`SampleIterator`,
410
+ * meaning it can be iterated over. An individual sample can be accessed
394
411
  * using :meth:`Input.samples.get`.
395
412
  *
396
413
  * See :class:`ValidSampleIterator`.
397
414
  *
398
415
  * This class provides both an iterator and iterable, and is used internally
399
- * by the :class:`Samples` class. The following options to iterate over the
416
+ * by the :class:`Samples` class. The following options to iterate over the
400
417
  * samples exist::
401
418
  *
402
419
  * // option 1 - The iterable can be used in for...of loops
@@ -406,11 +423,11 @@ class SampleIterator {
406
423
  * // option 3 - Returns a generator which must be incremented by the application
407
424
  * const iterator = input.samples.iterator()
408
425
  *
409
- * @property {boolean} validData - Whether or not the current sample
426
+ * @property {boolean} validData - Whether or not the current sample
410
427
  * contains valid data.
411
- * @property {SampleInfo} infos - The meta-data associated with the
428
+ * @property {SampleInfo} infos - The meta-data associated with the
412
429
  * current sample.
413
- * @property {pointer} native - A native handle that allows accessing
430
+ * @property {pointer} native - A native handle that allows accessing
414
431
  * additional *Connext DDS* APIs in C.
415
432
  */
416
433
  constructor (input, index) {
@@ -425,10 +442,10 @@ class SampleIterator {
425
442
  /**
426
443
  * Whether or not this sample contains valid data.
427
444
  *
428
- * If ``false``, the methods to obtain values of the samples
429
- * (e.g., :meth:`SampleIterator.getNumber`,
430
- * :meth:`SampleIterator.getBoolean`, :meth:`SampleIterator.getJson`,
431
- * :meth:`SampleIterator.getString`) should not be called. To avoid
445
+ * If ``false``, the methods to obtain values of the samples
446
+ * (e.g., :meth:`SampleIterator.getNumber`,
447
+ * :meth:`SampleIterator.getBoolean`, :meth:`SampleIterator.getJson`,
448
+ * :meth:`SampleIterator.getString`) should not be called. To avoid
432
449
  * this restraint, use a :class:`ValidSampleIterator`.
433
450
  * @type {boolean}
434
451
  */
@@ -447,15 +464,18 @@ class SampleIterator {
447
464
  *
448
465
  * * ``'source_timestamp'`` returns an integer representing nanoseconds
449
466
  * * ``'reception_timestamp'`` returns an integer representing nanoseconds
450
- * * ``'sample_identity'`` or ``'identity'`` returns a JSON object
467
+ * * ``'sample_identity'`` or ``'identity'`` returns a JSON object
451
468
  * (see :meth:`Output.write`)
452
- * * ``'related_sample_identity'`` returns a JSON object
469
+ * * ``'related_sample_identity'`` returns a JSON object
453
470
  * (see :meth:`Output.write`)
454
- * * ``'valid_data'`` returns a boolean (equivalent to
471
+ * * ``'valid_data'`` returns a boolean (equivalent to
455
472
  * :attr:`SampleIterator.validData`)
473
+ * * ``'view_state'``, returns a string (either "NEW" or "NOT_NEW")
474
+ * * ``'instance_state'``, returns a string (one of "ALIVE", "NOT_ALIVE_DISPOSED" or "NOT_ALIVE_NO_WRITERS")
475
+ * * ``'sample_state'``, returns a string (either "READ" or "NOT_READ")
456
476
  *
457
- * These fields are documented in `The SampleInfo Structure
458
- * <https://community.rti.com/static/documentation/connext-dds/current/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_UsersManual/index.htm#UsersManual/The_SampleInfo_Structure.htm>`__
477
+ * These fields are documented in `The SampleInfo Structure
478
+ * <https://community.rti.com/static/documentation/connext-dds/current/doc/manuals/connext_dds_professional/users_manual/index.htm#users_manual/The_SampleInfo_Structure.htm>`__
459
479
  * section in the *RTI Connext DDS Core Libraries User's Manual*.
460
480
  *
461
481
  * See :class:`SampleInfo`.
@@ -469,7 +489,7 @@ class SampleIterator {
469
489
  *
470
490
  * See :ref:`Accessing the data samples`.
471
491
  *
472
- * @param {string} [memberName] - The name of the complex member or field
492
+ * @param {string} [memberName] - The name of the complex member or field
473
493
  * to obtain.
474
494
  * @returns {JSON} The obtained JSON object.
475
495
  */
@@ -480,6 +500,11 @@ class SampleIterator {
480
500
  /**
481
501
  * Gets the value of a numeric field in this sample.
482
502
  *
503
+ * .. note::
504
+ * This operation should not be used with values with an aboslute value
505
+ * larger than `Number.MAX_SAFE_INTEGER`. See :ref:`Accessing 64-bit integers`
506
+ * for more information.
507
+ *
483
508
  * @param {string} fieldName - The name of the field.
484
509
  * @returns {number} The numeric value of the field.
485
510
  */
@@ -566,7 +591,7 @@ class SampleIterator {
566
591
  /**
567
592
  * Iterates and provides access to data samples with valid data.
568
593
  *
569
- * This iterator provides the same methods as :class:`SampleIterator`.
594
+ * This iterator provides the same methods as :class:`SampleIterator`.
570
595
  * It can be obtained using :attr:`Input.samples.validDataIter`.
571
596
  * @extends SampleIterator
572
597
  *
@@ -606,12 +631,12 @@ class ValidSampleIterator extends SampleIterator {
606
631
  */
607
632
  class Samples {
608
633
  /**
609
- * This class provides access to data samples read by an
610
- * :class:`Input` (using either the :meth:`Input.read`
634
+ * This class provides access to data samples read by an
635
+ * :class:`Input` (using either the :meth:`Input.read`
611
636
  * or :meth:`Input.take` methods).
612
637
  *
613
- * This class implements a ``[Symbol.iterator]()`` method, making it an
614
- * iterable. This allows it to be used in ``for... of`` loops, to iterate
638
+ * This class implements a ``[Symbol.iterator]()`` method, making it an
639
+ * iterable. This allows it to be used in ``for... of`` loops, to iterate
615
640
  * through available samples::
616
641
  *
617
642
  * for (const sample of input.samples) {
@@ -626,12 +651,12 @@ class Samples {
626
651
  *
627
652
  * The samples returned by these methods may only contain meta-data
628
653
  * (see :attr:`SampleIterator.info`). The :attr:`Samples.validDataIter`
629
- * iterable only iterates over samples that contain valid data
654
+ * iterable only iterates over samples that contain valid data
630
655
  * (a :class:`ValidSampleIterator`).
631
656
  *
632
- * :class:`Samples` and :class:`ValidSampleIterator` both also provide
633
- * generators to the samples, allowing applications to define their own
634
- * iterables (see :meth:`Samples.iterator()` and
657
+ * :class:`Samples` and :class:`ValidSampleIterator` both also provide
658
+ * generators to the samples, allowing applications to define their own
659
+ * iterables (see :meth:`Samples.iterator()` and
635
660
  * :meth:`ValidSampleIterator.iterator()`).
636
661
  *
637
662
  * ``Samples`` is the type of the property :meth:`Input.samples`.
@@ -639,9 +664,9 @@ class Samples {
639
664
  * For more information and examples, see :ref:`Accessing the data samples`.
640
665
  *
641
666
  * Attributes:
642
- * * length (number) - The number of samples available since the last time
667
+ * * length (number) - The number of samples available since the last time
643
668
  * :meth:`Input.read` or :meth:`Input.take` was called.
644
- * * validDataIter (:class:`ValidSampleIterator`) - The class used to
669
+ * * validDataIter (:class:`ValidSampleIterator`) - The class used to
645
670
  * iterate through the available samples that have valid data.
646
671
  */
647
672
  constructor (input) {
@@ -651,18 +676,18 @@ class Samples {
651
676
  /**
652
677
  * Returns an iterator to the data samples, starting at the index specified.
653
678
  *
654
- * The iterator provides access to all the data samples retrieved by the
679
+ * The iterator provides access to all the data samples retrieved by the
655
680
  * most recent call to :meth:`Input.read` or :meth:`Input.take`.
656
681
  *
657
- * This iterator may return samples with invalid data (samples that only
682
+ * This iterator may return samples with invalid data (samples that only
658
683
  * contain meta-data).
659
- * Use :attr:`Samples.validDataIter` to avoid having to check
684
+ * Use :attr:`Samples.validDataIter` to avoid having to check
660
685
  * :attr:`SampleIterator.validData`.
661
686
  *
662
- * @param {number} [index] The index of the sample from which the iteration
687
+ * @param {number} [index] The index of the sample from which the iteration
663
688
  * should begin. By default, the iterator begins with the first sample.
664
689
  *
665
- * @returns :class:`SampleIterator` - An iterator to the samples (which
690
+ * @returns :class:`SampleIterator` - An iterator to the samples (which
666
691
  * implements both iterable and iterator logic).
667
692
  */
668
693
  get (index) {
@@ -677,7 +702,7 @@ class Samples {
677
702
  *
678
703
  * This iterable may return samples with invalid data (samples that only contain
679
704
  * meta-data).
680
- * Use :attr:`Samples.validDataIter` to avoid having to check
705
+ * Use :attr:`Samples.validDataIter` to avoid having to check
681
706
  * :attr:`SampleIterator.validData`.
682
707
  *
683
708
  * Allows for the following syntax::
@@ -722,13 +747,13 @@ class Samples {
722
747
  * Returns an iterator to the data samples that contain valid data.
723
748
  *
724
749
  * The iterator provides access to all the data samples retrieved by the most
725
- * recent call to :meth:`Input.read` or :meth:`Input.take`, and skips samples
750
+ * recent call to :meth:`Input.read` or :meth:`Input.take`, and skips samples
726
751
  * with invalid data (meta-data only).
727
752
  *
728
753
  * By using this iterator, it is not necessary to check if each sample contains
729
754
  * valid data.
730
755
  *
731
- * @returns {ValidSampleIterator} An iterator to the samples containing valid
756
+ * @returns {ValidSampleIterator} An iterator to the samples containing valid
732
757
  * data (which implements both iterable and iterator logic).
733
758
  */
734
759
  get validDataIter () {
@@ -892,8 +917,8 @@ class Samples {
892
917
  * Gets a JSON object with the values of all the fields of this sample.
893
918
  *
894
919
  * @param {number} index The index of the sample.
895
- * @param {string} [memberName] The name of the complex member. The type
896
- * of the member with name memberName must be an array, sequence, struct,
920
+ * @param {string} [memberName] The name of the complex member. The type
921
+ * of the member with name memberName must be an array, sequence, struct,
897
922
  * value or union.
898
923
  * @returns {JSON} The obtained JSON object.
899
924
  *
@@ -936,10 +961,10 @@ class Samples {
936
961
  }
937
962
 
938
963
  /**
939
- * Obtains a native handle to the sample, which can be used to access
964
+ * Obtains a native handle to the sample, which can be used to access
940
965
  * additional *Connext DDS* APIs in C.
941
966
  *
942
- * @param {number} index The index of the sample for which to obtain
967
+ * @param {number} index The index of the sample for which to obtain
943
968
  * the native pointer.
944
969
  * @returns {pointer} A native pointer to the sample.
945
970
  */
@@ -959,9 +984,9 @@ class Samples {
959
984
  /**
960
985
  * This method is deprecated, use :meth:`Samples.getJson`.
961
986
  *
962
- * @param {number} index - The index of the sample for which to obtain
987
+ * @param {number} index - The index of the sample for which to obtain
963
988
  * the JSON object.
964
- * @param {string} [memberName] - The name of the complex member for
989
+ * @param {string} [memberName] - The name of the complex member for
965
990
  * which to obtain the JSON object.
966
991
  * @returns {JSON} A JSON object representing the current sample.
967
992
  * @private
@@ -990,15 +1015,15 @@ class SampleInfo {
990
1015
  *
991
1016
  * * ``'source_timestamp'`` returns an integer representing nanoseconds
992
1017
  * * ``'reception_timestamp'`` returns an integer representing nanoseconds
993
- * * ``'sample_identity'`` or ``'identity'`` returns a JSON object
1018
+ * * ``'sample_identity'`` or ``'identity'`` returns a JSON object
994
1019
  * (see :meth:`Output.write`)
995
- * * ``'related_sample_identity'`` returns a JSON object
1020
+ * * ``'related_sample_identity'`` returns a JSON object
996
1021
  * (see :meth:`Output.write`)
997
- * * ``'valid_data'`` returns a boolean (equivalent to
1022
+ * * ``'valid_data'`` returns a boolean (equivalent to
998
1023
  * :attr:`SampleIterator.validData`)
999
1024
  *
1000
- * These fields are documented in `The SampleInfo Structure
1001
- * <https://community.rti.com/static/documentation/connext-dds/current/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_UsersManual/index.htm#UsersManual/The_SampleInfo_Structure.htm>`__
1025
+ * These fields are documented in `The SampleInfo Structure
1026
+ * <https://community.rti.com/static/documentation/connext-dds/current/doc/manuals/connext_dds_professional/users_manual/index.htm#users_manual/The_SampleInfo_Structure.htm>`__
1002
1027
  * section in the *RTI Connext DDS Core Libraries User's Manual*.
1003
1028
  *
1004
1029
  * @param {string} fieldName - The name of the ``SampleInfo`` field to obtain
@@ -1030,11 +1055,11 @@ class Input {
1030
1055
  *
1031
1056
  * Attributes:
1032
1057
  * * connector (:class:`Connector`) - The Connector creates this Input.
1033
- * * name (string) - The name of the Input (the name used in
1058
+ * * name (string) - The name of the Input (the name used in
1034
1059
  * :meth:`Connector.getInput`).
1035
- * * native (pointer) - A native handle that allows accessing additional
1060
+ * * native (pointer) - A native handle that allows accessing additional
1036
1061
  * *Connext DDS* APIs in C.
1037
- * * matchedPublications (JSON) - A JSON object containing information
1062
+ * * matchedPublications (JSON) - A JSON object containing information
1038
1063
  * about all the publications currently matched with this Input.
1039
1064
  */
1040
1065
  constructor (connector, name) {
@@ -1062,8 +1087,8 @@ class Input {
1062
1087
  /**
1063
1088
  * Accesses the samples received by this Input.
1064
1089
  *
1065
- * This operation performs the same operation as :meth:`Input.take` but
1066
- * the samples remain accessible (in the internal queue) after the
1090
+ * This operation performs the same operation as :meth:`Input.take` but
1091
+ * the samples remain accessible (in the internal queue) after the
1067
1092
  * operation has been called.
1068
1093
  */
1069
1094
  read () {
@@ -1075,7 +1100,7 @@ class Input {
1075
1100
  /**
1076
1101
  * Accesses the samples receieved by this Input.
1077
1102
  *
1078
- * After calling this method, the samples are accessible using
1103
+ * After calling this method, the samples are accessible using
1079
1104
  * :meth:`Input.samples`.
1080
1105
  */
1081
1106
  take () {
@@ -1102,18 +1127,18 @@ class Input {
1102
1127
  * .. note::
1103
1128
  * This operation is asynchronous.
1104
1129
  *
1105
- * This method waits for the specified timeout (or if no timeout is
1130
+ * This method waits for the specified timeout (or if no timeout is
1106
1131
  * specified, it waits forever), for a match (or unmatch) to occur.
1107
- * @param {number} [timeout] The maximum time to wait, in milliseconds.
1132
+ * @param {number} [timeout] The maximum time to wait, in milliseconds.
1108
1133
  * By default, infinite.
1109
- * @throws {TimeoutError} :class:`TimeoutError` will be thrown if the
1134
+ * @throws {TimeoutError} :class:`TimeoutError` will be thrown if the
1110
1135
  * timeout expires before any publications are matched.
1111
- * @returns {Promise} Promise object resolving with the change in the
1112
- * current number of matched outputs. If this is a positive number,
1113
- * the input has matched with new publishers. If it is negative, the
1114
- * input has unmatched from an output. It is possible for multiple
1115
- * matches and/or unmatches to be returned (e.g., 0 could be returned,
1116
- * indicating that the input matched the same number of outputs as it
1136
+ * @returns {Promise} Promise object resolving with the change in the
1137
+ * current number of matched outputs. If this is a positive number,
1138
+ * the input has matched with new publishers. If it is negative, the
1139
+ * input has unmatched from an output. It is possible for multiple
1140
+ * matches and/or unmatches to be returned (e.g., 0 could be returned,
1141
+ * indicating that the input matched the same number of outputs as it
1117
1142
  * unmatched).
1118
1143
  */
1119
1144
  waitForPublications (timeout) {
@@ -1152,15 +1177,15 @@ class Input {
1152
1177
  /**
1153
1178
  * Returns information about matched publications.
1154
1179
  *
1155
- * This property returns a JSON array, with each element of the
1180
+ * This property returns a JSON array, with each element of the
1156
1181
  * array containing information about a matched publication.
1157
1182
  *
1158
- * Currently the only information contained in this JSON object is
1159
- * the publication name of the matched publication. If the matched
1160
- * publication doesn't have a name, the name for that specific
1183
+ * Currently the only information contained in this JSON object is
1184
+ * the publication name of the matched publication. If the matched
1185
+ * publication doesn't have a name, the name for that specific
1161
1186
  * publication will be null.
1162
1187
  *
1163
- * Note that :class:`Connector` Outputs are automatically assigned
1188
+ * Note that :class:`Connector` Outputs are automatically assigned
1164
1189
  * a name from the ``data_writer name`` element in the XML configuration.
1165
1190
  *
1166
1191
  * @type {JSON}
@@ -1180,11 +1205,11 @@ class Input {
1180
1205
  * .. note::
1181
1206
  * This operation is asynchronous.
1182
1207
  *
1183
- * @param {number} [timeout] The maximum time to wait, in milliseconds.
1208
+ * @param {number} [timeout] The maximum time to wait, in milliseconds.
1184
1209
  * By default, infinite.
1185
- * @throws {TimeoutError} :class:`TimeoutError` will be thrown if the
1210
+ * @throws {TimeoutError} :class:`TimeoutError` will be thrown if the
1186
1211
  * timeout expires before data is received.
1187
- * @returns {Promise} A ``Promise`` which will be resolved once data is
1212
+ * @returns {Promise} A ``Promise`` which will be resolved once data is
1188
1213
  * available, or rejected if the timeout expires.
1189
1214
  */
1190
1215
  wait (timeout) {
@@ -1223,17 +1248,17 @@ class Instance {
1223
1248
  /**
1224
1249
  * A data sample.
1225
1250
  *
1226
- * :class:`Instance` is the type obtained through ``Output.instance``
1251
+ * :class:`Instance` is the type obtained through ``Output.instance``
1227
1252
  * and is the object that is published by :meth:`Output.write`.
1228
1253
  *
1229
- * An Instance has an associated DDS Type, specified in the XML
1230
- * configuration, and it allows setting the values for the fields of
1254
+ * An Instance has an associated DDS Type, specified in the XML
1255
+ * configuration, and it allows setting the values for the fields of
1231
1256
  * the DDS Type.
1232
1257
  *
1233
1258
  * Attributes:
1234
- * * ``output`` (:class:`Output`) - The :class:`Output` that owns
1259
+ * * ``output`` (:class:`Output`) - The :class:`Output` that owns
1235
1260
  * this Instance.
1236
- * * ``native`` (pointer) - Native handle to this Instance that allows
1261
+ * * ``native`` (pointer) - Native handle to this Instance that allows
1237
1262
  * for additional *Connext DDS Pro* C APIs to be called.
1238
1263
  */
1239
1264
  constructor (output) {
@@ -1243,9 +1268,9 @@ class Instance {
1243
1268
  /**
1244
1269
  * Resets a member to its default value.
1245
1270
  *
1246
- * The effect is the same as that of :meth:`Output.clearMembers`, except
1271
+ * The effect is the same as that of :meth:`Output.clearMembers`, except
1247
1272
  * that only one member is cleared.
1248
- * @param {string} fieldName The name of the field. It can be a complex
1273
+ * @param {string} fieldName The name of the field. It can be a complex
1249
1274
  * member or a primitive member.
1250
1275
  */
1251
1276
  clearMember (fieldName) {
@@ -1263,8 +1288,13 @@ class Instance {
1263
1288
  /**
1264
1289
  * Sets a numeric field.
1265
1290
  *
1291
+ * .. note::
1292
+ * This operation should not be used with values with an aboslute value
1293
+ * larger than `Number.MAX_SAFE_INTEGER`. See :ref:`Accessing 64-bit integers`
1294
+ * for more information.
1295
+ *
1266
1296
  * @param {string} fieldName - The name of the field.
1267
- * @param {number} value - A numeric value, or null, to unset an
1297
+ * @param {number} value - A numeric value, or null, to unset an
1268
1298
  * optional member.
1269
1299
  */
1270
1300
  setNumber (fieldName, value) {
@@ -1289,7 +1319,7 @@ class Instance {
1289
1319
  * Sets a boolean field.
1290
1320
  *
1291
1321
  * @param {string} fieldName - The name of the field.
1292
- * @param {boolean} value - A boolean value, or null, to unset an
1322
+ * @param {boolean} value - A boolean value, or null, to unset an
1293
1323
  * optional member.
1294
1324
  */
1295
1325
  setBoolean (fieldName, value) {
@@ -1315,7 +1345,7 @@ class Instance {
1315
1345
  * Sets a string field.
1316
1346
  *
1317
1347
  * @param {string} fieldName - The name of the field.
1318
- * @param {number} value - A string value, or null, to unset an
1348
+ * @param {string|null} value - A string value, or null, to unset an
1319
1349
  * optional member.
1320
1350
  */
1321
1351
  setString (fieldName, value) {
@@ -1340,20 +1370,20 @@ class Instance {
1340
1370
  /**
1341
1371
  * Sets the member values specified in a JSON object.
1342
1372
  *
1343
- * The keys in the JSON object are the member names of the DDS Type
1344
- * associated with the Output, and the values are the values to set
1373
+ * The keys in the JSON object are the member names of the DDS Type
1374
+ * associated with the Output, and the values are the values to set
1345
1375
  * for those members.
1346
1376
  *
1347
- * This method sets the values of those members that are explicitly
1348
- * specified in the JSON object. Any member that is not specified in
1377
+ * This method sets the values of those members that are explicitly
1378
+ * specified in the JSON object. Any member that is not specified in
1349
1379
  * the JSON object will retain its previous value.
1350
1380
  *
1351
- * To clear members that are not in the JSON object, call
1352
- * :meth:`Output.clearMembers` before this method. You can also
1353
- * explicitly set any value in the JSON object to *null* to reset that
1381
+ * To clear members that are not in the JSON object, call
1382
+ * :meth:`Output.clearMembers` before this method. You can also
1383
+ * explicitly set any value in the JSON object to *null* to reset that
1354
1384
  * field to its default value.
1355
1385
  *
1356
- * @param {JSON} jsonObj - The JSON object containing the keys
1386
+ * @param {JSON} jsonObj - The JSON object containing the keys
1357
1387
  * (field names) and values (values for the fields).
1358
1388
  */
1359
1389
  setFromJson (jsonObj) {
@@ -1366,16 +1396,16 @@ class Instance {
1366
1396
  /**
1367
1397
  * Sets the value of fieldName.
1368
1398
  *
1369
- * The type of the argument ``value`` must correspond with the type of the
1399
+ * The type of the argument ``value`` must correspond with the type of the
1370
1400
  * field with name ``fieldName`` (as defined in the configuration XML file).
1371
1401
  *
1372
- * This method is an alternative to
1373
- * :meth:`Instance.setNumber`, :meth:`Instance.setString` and
1374
- * :meth:`Instance.setBoolean`. The main difference is that it is
1402
+ * This method is an alternative to
1403
+ * :meth:`Instance.setNumber`, :meth:`Instance.setString` and
1404
+ * :meth:`Instance.setBoolean`. The main difference is that it is
1375
1405
  * type-independent (in that the same method can be used for all fields).
1376
1406
  *
1377
1407
  * @param {string} fieldName The name of the field.
1378
- * @param {number|boolean|string|null} value The value to set. Note that
1408
+ * @param {number|boolean|string|null} value The value to set. Note that
1379
1409
  * ``null`` is used to unset an optional member.
1380
1410
  */
1381
1411
  set (fieldName, value) {
@@ -1404,17 +1434,22 @@ class Instance {
1404
1434
  /**
1405
1435
  * Retrives the value of this instance as a JSON object.
1406
1436
  *
1437
+ * .. note::
1438
+ * This operation should not be used with values with an aboslute value
1439
+ * larger than `Number.MAX_SAFE_INTEGER`. See :ref:`Accessing 64-bit integers`
1440
+ * for more information.
1441
+ *
1407
1442
  * @returns {JSON} The value of this instance as a JSON object.
1408
1443
  */
1409
1444
  getJson () {
1410
1445
  const nativeStr = connectorBinding.api.RTIDDSConnector_getJSONInstance(
1411
- this.output.connector.native,
1412
- this.output.name)
1446
+ this.output.connector.native,
1447
+ this.output.name)
1413
1448
  // Now move the native string
1414
1449
  if (nativeStr === null) {
1415
- throw new Error('Failed to create JSON object of instance')
1450
+ throw new Error('Failed to create JSON object of instance')
1416
1451
  } else {
1417
- return JSON.parse(_moveCString(nativeStr))
1452
+ return JSON.parse(_moveCString(nativeStr))
1418
1453
  }
1419
1454
  }
1420
1455
 
@@ -1451,18 +1486,19 @@ class Instance {
1451
1486
  class Output {
1452
1487
  /**
1453
1488
  * This class is used to publish data for a DDS Topic.
1489
+ *
1454
1490
  * To get an Output object, use :meth:`Connector.getOutput`.
1455
1491
  *
1456
1492
  * Attributes:
1457
- * * ``instance`` (:class:`Instance`) - The data that is written when
1493
+ * * ``instance`` (:class:`Instance`) - The data that is written when
1458
1494
  * :meth:`Output.write` is called.
1459
- * * ``connector`` (:class:`Connector`) - The :class:`Connector` object
1495
+ * * ``connector`` (:class:`Connector`) - The :class:`Connector` object
1460
1496
  * that created this object.
1461
- * * ``name`` (str) - The name of this Output (the name used in
1497
+ * * ``name`` (str) - The name of this Output (the name used in
1462
1498
  * :meth:`Connector.getOutput`).
1463
- * * ``native`` (pointer) - The native handle that allows accessing
1499
+ * * ``native`` (pointer) - The native handle that allows accessing
1464
1500
  * additional *Connext DDS* APIs in C.
1465
- * * ``matchedSubscriptions`` (JSON) - Information about matched
1501
+ * * ``matchedSubscriptions`` (JSON) - Information about matched
1466
1502
  * subscriptions (see below).
1467
1503
  *
1468
1504
  */
@@ -1482,40 +1518,40 @@ class Output {
1482
1518
  /**
1483
1519
  * Publishes the values of the current Instance.
1484
1520
  *
1485
- * Note that after writing it, the Instance's values remain unchanged.
1486
- * If, for the next write, you need to start from scratch, you must
1521
+ * Note that after writing it, the Instance's values remain unchanged.
1522
+ * If, for the next write, you need to start from scratch, you must
1487
1523
  * first call :meth:`Output.clearMembers`.
1488
1524
  *
1489
- * This method accepts an optional JSON object as a parameter, which may
1525
+ * This method accepts an optional JSON object as a parameter, which may
1490
1526
  * specify the parameters to use in the `write` call.
1491
- * The supported parameters are a subset of those documented in the
1492
- * `Writing Data section <https://community.rti.com/static/documentation/connext-dds/current/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_UsersManual/index.htm#UsersManual/Writing_Data.htm?Highlight=DDS_WriteParams_t>`__
1527
+ * The supported parameters are a subset of those documented in the
1528
+ * `Writing Data section <https://community.rti.com/static/documentation/connext-dds/current/doc/manuals/connext_dds_professional/users_manual/index.htm#users_manual/Writing_Data.htm?Highlight=DDS_WriteParams_t>`__
1493
1529
  * of the *RTI Connext DDS Core Libraries User's Manual*. These are:
1494
1530
  *
1495
1531
  * * ``action`` – One of ``write`` (default), ``dispose`` or ``unregister``
1496
- * * ``source_timestamp`` – An integer representing the total number of
1532
+ * * ``source_timestamp`` – An integer representing the total number of
1497
1533
  * nanoseconds
1498
- * * ``identity`` – A JSON object containing the fields ``writer_guid`` and
1534
+ * * ``identity`` – A JSON object containing the fields ``writer_guid`` and
1499
1535
  * ``sequence_number``
1500
- * * ``related_sample_identity`` – Used for request-reply communications.
1536
+ * * ``related_sample_identity`` – Used for request-reply communications.
1501
1537
  * It has the same format as identity
1502
1538
  *
1503
1539
  * @example output.write()
1504
- * @example output.write({
1505
- * action: 'dispose',
1506
- * identity: { writer_guid: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], sequence_number: 1 }
1540
+ * @example output.write({
1541
+ * action: 'dispose',
1542
+ * identity: { writer_guid: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], sequence_number: 1 }
1507
1543
  * })
1508
1544
  *
1509
1545
  * @param {JSON} [params] [Optional] The optional parameters described above
1510
- * @throws {TimeoutError} The write method can block under multiple
1511
- * circumstances (see 'Blocking During a write()' in the `Writing Data section
1512
- * <https://community.rti.com/static/documentation/connext-dds/current/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_UsersManual/index.htm#UsersManual/Writing_Data.htm>`__
1546
+ * @throws {TimeoutError} The write method can block under multiple
1547
+ * circumstances (see 'Blocking During a write()' in the `Writing Data section
1548
+ * <https://community.rti.com/static/documentation/connext-dds/current/doc/manuals/connext_dds_professional/users_manual/index.htm#users_manual/Writing_Data.htm>`__
1513
1549
  * of the *RTI Connext DDS Core Libraries User's Manual*.)
1514
- * If the blocking time exceeds the ``max_blocking_time``, this method
1550
+ * If the blocking time exceeds the ``max_blocking_time``, this method
1515
1551
  * throws :class:`TimeoutError`.
1516
1552
  */
1517
1553
  write (params) {
1518
- var cStr
1554
+ let cStr
1519
1555
  if (params === undefined) {
1520
1556
  cStr = null
1521
1557
  } else {
@@ -1530,10 +1566,10 @@ class Output {
1530
1566
  /**
1531
1567
  * Resets the values of the members of this :class:`Instance`.
1532
1568
  *
1533
- * If the member is defined with a *default* attribute in the configuration
1534
- * file, it gets that value. Otherwise, numbers are set to 0 and strings are
1569
+ * If the member is defined with a *default* attribute in the configuration
1570
+ * file, it gets that value. Otherwise, numbers are set to 0 and strings are
1535
1571
  * set to empty. Sequences are cleared and optional members are set to 'null'.
1536
- * For example, if this Output's type is *ShapeType*, then ``clearMembers()``
1572
+ * For example, if this Output's type is *ShapeType*, then ``clearMembers()``
1537
1573
  * sets::
1538
1574
  * color = 'RED'
1539
1575
  * shapesize = 30
@@ -1547,7 +1583,7 @@ class Output {
1547
1583
  }
1548
1584
 
1549
1585
  /**
1550
- * Waits until all matching reliable subscriptions have acknowledged all the
1586
+ * Waits until all matching reliable subscriptions have acknowledged all the
1551
1587
  * samples that have currently been written.
1552
1588
  *
1553
1589
  * This method only waits if this Output is configured with a reliable QoS.
@@ -1555,13 +1591,13 @@ class Output {
1555
1591
  * .. note::
1556
1592
  * This operation is asynchronous
1557
1593
  *
1558
- * @param {timeout} [timeout] The maximum time to wait, in milliseconds.
1594
+ * @param {timeout} [timeout] The maximum time to wait, in milliseconds.
1559
1595
  * By default, infinite.
1560
1596
  * @throws {TimeoutError} :class:`TimeoutError` will be thrown if the timeout
1561
- * expires before all matching reliable subscriptions acknowledge all the
1597
+ * expires before all matching reliable subscriptions acknowledge all the
1562
1598
  * samples.
1563
- * @returns {Promise} Promise object which will be rejected if not all matching
1564
- * reliable subscriptions acknowledge all of the samples within the specified
1599
+ * @returns {Promise} Promise object which will be rejected if not all matching
1600
+ * reliable subscriptions acknowledge all of the samples within the specified
1565
1601
  * timeout.
1566
1602
  */
1567
1603
  wait (timeout) {
@@ -1576,10 +1612,14 @@ class Output {
1576
1612
  timeout,
1577
1613
  (err, res) => {
1578
1614
  if (err) {
1579
- reject(err)
1615
+ return reject(err)
1616
+ } else if (res === _ReturnCodes.ok) {
1617
+ return resolve()
1618
+ } else if (res === _ReturnCodes.timeout) {
1619
+ return reject(new TimeoutError('Timeout error'))
1620
+ } else {
1621
+ return reject(new DDSError('res: ' + res))
1580
1622
  }
1581
- _checkRetcode(res)
1582
- resolve()
1583
1623
  }
1584
1624
  )
1585
1625
  })
@@ -1588,21 +1628,21 @@ class Output {
1588
1628
  /**
1589
1629
  * Waits for this Output to match or unmatch a compatible DDS Publication.
1590
1630
  *
1591
- * This method waits for the specified timeout (or if no timeout is
1631
+ * This method waits for the specified timeout (or if no timeout is
1592
1632
  * specified, it waits forever), for a match (or unmatch) to occur.
1593
1633
  *
1594
1634
  * .. note::
1595
1635
  * This operation is asynchronous
1596
1636
  *
1597
- * @param {number} [timeout] - The maximum time to wait, in milliseconds.
1637
+ * @param {number} [timeout] - The maximum time to wait, in milliseconds.
1598
1638
  * By default, infinite.
1599
- * @throws {TimeoutError} :class:`TimeoutError` will be thrown if the
1639
+ * @throws {TimeoutError} :class:`TimeoutError` will be thrown if the
1600
1640
  * timeout expires before a subscription is matched.
1601
- * @returns {Promise} Promise object resolving with the change in the
1602
- * current number of matched inputs. If this is a positive number, the
1603
- * output has matched with new subscribers. If it is negative, the output
1604
- * has unmatched from a subscription. It is possible for multiple matches
1605
- * and/or unmatches to be returned (e.g., 0 could be returned, indicating
1641
+ * @returns {Promise} Promise object resolving with the change in the
1642
+ * current number of matched inputs. If this is a positive number, the
1643
+ * output has matched with new subscribers. If it is negative, the output
1644
+ * has unmatched from a subscription. It is possible for multiple matches
1645
+ * and/or unmatches to be returned (e.g., 0 could be returned, indicating
1606
1646
  * that the output matched the same number of inputs as it unmatched).
1607
1647
  */
1608
1648
  waitForSubscriptions (timeout) {
@@ -1630,7 +1670,7 @@ class Output {
1630
1670
  } else if (res === _ReturnCodes.timeout) {
1631
1671
  return reject(new TimeoutError('Timeout error'))
1632
1672
  } else {
1633
- return reject(new DDSError('DDS error'))
1673
+ return reject(new DDSError('res: ' + res))
1634
1674
  }
1635
1675
  }
1636
1676
  )
@@ -1641,14 +1681,14 @@ class Output {
1641
1681
  /**
1642
1682
  * Provides information about matched subscriptions.
1643
1683
  *
1644
- * This property returns a JSON array, with each element of the array
1684
+ * This property returns a JSON array, with each element of the array
1645
1685
  * containing information about a matched subscription.
1646
1686
  *
1647
- * Currently the only information contained in this JSON object is the
1687
+ * Currently the only information contained in this JSON object is the
1648
1688
  * subscription name of the matched subscription. If the matched subscription
1649
1689
  * doesn't have a name, the name for that specific subscription will be null.
1650
1690
  *
1651
- * Note that :class:`Connector` Inputs are automatically assigned a name from
1691
+ * Note that :class:`Connector` Inputs are automatically assigned a name from
1652
1692
  * the ``data_reader name`` element in the XML configuration.
1653
1693
  *
1654
1694
  * @type {JSON}
@@ -1662,6 +1702,7 @@ class Output {
1662
1702
  return JSON.parse(_moveCString(cStr.deref()))
1663
1703
  }
1664
1704
 
1705
+ /* istanbul ignore next */
1665
1706
  // Deprecated, use clearMembers
1666
1707
  clear_members () { // eslint-disable-line camelcase
1667
1708
  return this.clearMembers()
@@ -1672,9 +1713,9 @@ class Output {
1672
1713
  * Loads a configuration and creates its Inputs and Outputs.
1673
1714
  *
1674
1715
  * .. note::
1675
- * The :class:`Connector` class inherits from
1716
+ * The :class:`Connector` class inherits from
1676
1717
  * `EventEmitter <https://nodejs.org/api/events.html#events_class_eventemitter>`__.
1677
- * This allows us to support event-based notification for data, using the
1718
+ * This allows us to support event-based notification for data, using the
1678
1719
  * following syntax:
1679
1720
  *
1680
1721
  * .. code-block:: javascript
@@ -1683,28 +1724,32 @@ class Output {
1683
1724
  *
1684
1725
  * Please refer to :ref:`Reading data (Input)` for more information.
1685
1726
  *
1686
- * A :class:`Connector` instance loads a configuration file from an XML
1727
+ * A :class:`Connector` instance loads a configuration file from an XML
1687
1728
  * document. For example::
1688
1729
  * const connector = new rti.Connector('MyParticipantLibrary::MyParticipant', 'MyExample.xml')
1689
1730
  *
1690
- * After creating it, the :class:`Connector` object's Inputs can be used to
1691
- * read data, and the Outputs to write data. The methods
1692
- * :meth:`Connector.getOutput` and :meth:`Connector.getInput` return an
1731
+ * After creating it, the :class:`Connector` object's Inputs can be used to
1732
+ * read data, and the Outputs to write data. The methods
1733
+ * :meth:`Connector.getOutput` and :meth:`Connector.getInput` return an
1693
1734
  * :class:`Input` and :class:`Output`, respectively.
1694
1735
  *
1695
- * An application can create multiple :class:`Connector` instances for the
1736
+ * An application can create multiple :class:`Connector` instances for the
1696
1737
  * same or different configurations.
1697
1738
  */
1698
1739
  class Connector extends EventEmitter {
1699
1740
  /**
1700
- * @arg {string} configName The configuration to load. The configName format
1701
- * is `LibraryName::ParticipantName`, where LibraryName is the name
1702
- * attribute of a ``<domain_participant_library>`` tag, and
1703
- * ParticipantName is the name attribute of a ``<domain_participant>`` tag
1741
+ * @arg {string} configName The configuration to load. The configName format
1742
+ * is `LibraryName::ParticipantName`, where LibraryName is the name
1743
+ * attribute of a ``<domain_participant_library>`` tag, and
1744
+ * ParticipantName is the name attribute of a ``<domain_participant>`` tag
1704
1745
  * within that library.
1705
- * @arg {string} url A URL locating the XML document. It can be a file path
1706
- * (e.g., ``/tmp/my_dds_config.xml``) or a string containing the full XML
1707
- * document with the following format: ``str://"<dds>...</dds>"``.
1746
+ * @arg {string} url A URL locating the XML document. It can be a file path
1747
+ * (e.g., ``/tmp/my_dds_config.xml``), a string containing the full XML
1748
+ * document with the following format: ``str://"<dds>...</dds>"``, or a
1749
+ * combination of multiple files or strings, as explained in the
1750
+ * `URL Groups <https://community.rti.com/static/documentation/connext-dds/current/doc/manuals/connext_dds_professional/users_manual/index.htm#users_manual/URL_Groups.htm>`__
1751
+ * section of the *Connext DDS Core Libraries User's Manual*.
1752
+ *
1708
1753
  */
1709
1754
  constructor (configName, url) {
1710
1755
  super()
@@ -1725,18 +1770,18 @@ class Connector extends EventEmitter {
1725
1770
  }
1726
1771
 
1727
1772
  /**
1728
- * This method is used internally by the public APIs
1729
- * :meth:`Connector.close` and
1773
+ * This method is used internally by the public APIs
1774
+ * :meth:`Connector.close` and
1730
1775
  * :meth:`Connector.waitForCallbackFinalization`. It should not be used
1731
1776
  * directly by applications.
1732
1777
  *
1733
- * @param {function} resolve The resolve() callback to call once waitSetBusy
1778
+ * @param {function} resolve The resolve() callback to call once waitSetBusy
1734
1779
  * is false.
1735
- * @param {function} reject The reject() callback to call if we timeout,
1780
+ * @param {function} reject The reject() callback to call if we timeout,
1736
1781
  * or if another error occurs.
1737
- * @param {number} iterations Maximum number of iterations to perform
1782
+ * @param {number} iterations Maximum number of iterations to perform
1738
1783
  * before timing out.
1739
- * @param {boolean} cleanup Whether or not the :class:`Connector` object
1784
+ * @param {boolean} cleanup Whether or not the :class:`Connector` object
1740
1785
  * should be deleted once the waitset is no longer busy.
1741
1786
  * @private
1742
1787
  */
@@ -1766,27 +1811,27 @@ class Connector extends EventEmitter {
1766
1811
  * by the :class:`Connector` are no longer in use.
1767
1812
  *
1768
1813
  * .. note::
1769
- * This returned promise will be rejected if there are any listeners
1770
- * registered for the ``on_data_available`` event. Ensure that they have
1771
- * all been removed before calling this method using
1814
+ * This returned promise will be rejected if there are any listeners
1815
+ * registered for the ``on_data_available`` event. Ensure that they have
1816
+ * all been removed before calling this method using
1772
1817
  * ``connector.removeAllListeners(on_data_available)``.
1773
1818
  *
1774
- * It is currently only necessary to call this method if you remove all of
1819
+ * It is currently only necessary to call this method if you remove all of
1775
1820
  * the listeners for the ``on_data_available`` event and at some point in the
1776
- * future wish to use the same :class:`Connector` object to get notifications
1777
- * of new data (via the :meth:`Connector.wait` method, or by re-adding a
1821
+ * future wish to use the same :class:`Connector` object to get notifications
1822
+ * of new data (via the :meth:`Connector.wait` method, or by re-adding a
1778
1823
  * listener for the ``on_data_available`` event).
1779
1824
  *
1780
- * This operation does **not** free any resources. It is still necessary to
1781
- * call :meth:`Connector.close` when the :class:`Connector` is no longer
1825
+ * This operation does **not** free any resources. It is still necessary to
1826
+ * call :meth:`Connector.close` when the :class:`Connector` is no longer
1782
1827
  * required.
1783
1828
  *
1784
- * @argument {number} [timeout] Optional parameter to indicate the timeout
1785
- * of the operation, in seconds. By default, 10s. If this operation does
1786
- * not complete within the specified timeout, the returned Promise will
1829
+ * @argument {number} [timeout] Optional parameter to indicate the timeout
1830
+ * of the operation, in seconds. By default, 10s. If this operation does
1831
+ * not complete within the specified timeout, the returned Promise will
1787
1832
  * be rejected.
1788
- * @returns {Promise} A Promise that will be resolved once the resources
1789
- * being used internally by the :class:`Connector` object are no longer
1833
+ * @returns {Promise} A Promise that will be resolved once the resources
1834
+ * being used internally by the :class:`Connector` object are no longer
1790
1835
  * in use.
1791
1836
  */
1792
1837
  waitForCallbackFinalization (timeout) {
@@ -1802,12 +1847,12 @@ class Connector extends EventEmitter {
1802
1847
  /**
1803
1848
  * Frees all the resources created by this :class:`Connector` instance.
1804
1849
  *
1805
- * @argument {number} [timeout] Optional parameter to indicate the timeout
1806
- * of the operation, in seconds. By default, 10s. If this operation does
1807
- * not complete within the specified timeout, the returned Promise will
1850
+ * @argument {number} [timeout] Optional parameter to indicate the timeout
1851
+ * of the operation, in seconds. By default, 10s. If this operation does
1852
+ * not complete within the specified timeout, the returned Promise will
1808
1853
  * be rejected.
1809
- * @returns {Promise} Which resolves once the :class:`Connector` object has
1810
- * been freed. It is only necessary to wait for this promise to resolve
1854
+ * @returns {Promise} Which resolves once the :class:`Connector` object has
1855
+ * been freed. It is only necessary to wait for this promise to resolve
1811
1856
  * if you have attached a listener for the ``on_data_available`` event.
1812
1857
  */
1813
1858
  close (timeout) {
@@ -1834,7 +1879,7 @@ class Connector extends EventEmitter {
1834
1879
  /**
1835
1880
  * Returns the :class:`Input` named inputName.
1836
1881
  *
1837
- * ``inputName`` identifies a ``<data_reader>`` tag in the configuration
1882
+ * ``inputName`` identifies a ``<data_reader>`` tag in the configuration
1838
1883
  * loaded by the :class:`Connector`. For example::
1839
1884
  *
1840
1885
  * const connector = new rti.Connector('MyParticipantLibrary::MyParticipant', 'MyExample.xml')
@@ -1855,7 +1900,7 @@ class Connector extends EventEmitter {
1855
1900
  * ...
1856
1901
  * <domain_participant_library>
1857
1902
  *
1858
- * @param {string} inputName The name of the ``data_reader`` to load, with the
1903
+ * @param {string} inputName The name of the ``data_reader`` to load, with the
1859
1904
  * format `SubscriberName::DataReaderName`.
1860
1905
  * @returns {Input} The Input, if it exists.
1861
1906
  */
@@ -1866,7 +1911,7 @@ class Connector extends EventEmitter {
1866
1911
  /**
1867
1912
  * Returns the :class:`Output` named outputName.
1868
1913
  *
1869
- * ``outputName`` identifies a ``<data_writer>`` tag in the configuration
1914
+ * ``outputName`` identifies a ``<data_writer>`` tag in the configuration
1870
1915
  * loaded by the :class:`Connector`. For example::
1871
1916
  *
1872
1917
  * const connector = new rti.Connector('MyParticipantLibrary::MyParticipant', 'MyExample.xml')
@@ -1887,7 +1932,7 @@ class Connector extends EventEmitter {
1887
1932
  * ...
1888
1933
  * <domain_participant_library>
1889
1934
  *
1890
- * @param {string} outputName The name of the ``data_writer`` to load, with
1935
+ * @param {string} outputName The name of the ``data_writer`` to load, with
1891
1936
  * the format ``PublisherName::DataWriterName``.
1892
1937
  * @returns {Output} The Output, if it exists.
1893
1938
  */
@@ -1901,11 +1946,11 @@ class Connector extends EventEmitter {
1901
1946
  * .. note::
1902
1947
  * This operation is asynchronous.
1903
1948
  *
1904
- * @param {number} timeout The maximum time to wait, in milliseconds.
1949
+ * @param {number} timeout The maximum time to wait, in milliseconds.
1905
1950
  * By default, infinite.
1906
- * @throws {TimeoutError} :class:`TimeoutError` will be thrown if the
1951
+ * @throws {TimeoutError} :class:`TimeoutError` will be thrown if the
1907
1952
  * timeout expires before data is received.
1908
- * @returns {Promise} A ``Promise`` which will be resolved once data
1953
+ * @returns {Promise} A ``Promise`` which will be resolved once data
1909
1954
  * is available, or rejected once the timeout expires.
1910
1955
  */
1911
1956
  wait (timeout) {
@@ -1940,17 +1985,17 @@ class Connector extends EventEmitter {
1940
1985
  }
1941
1986
 
1942
1987
  /**
1943
- * Emits the ``on_data_available`` event when any Inputs within this
1988
+ * Emits the ``on_data_available`` event when any Inputs within this
1944
1989
  * :class:`Connector` object receive data.
1945
1990
  *
1946
1991
  * .. note::
1947
1992
  * This operation is asynchronous
1948
1993
  *
1949
- * This API is used internally to emit the ``on_data_available`` event when
1950
- * data is received on any of the Inputs contained within this
1994
+ * This API is used internally to emit the ``on_data_available`` event when
1995
+ * data is received on any of the Inputs contained within this
1951
1996
  * :class:`Connector` object.
1952
1997
  *
1953
- * The :class:`Connector` class extends EventEmitter, meaning that callbacks
1998
+ * The :class:`Connector` class extends EventEmitter, meaning that callbacks
1954
1999
  * can be registered for specific events using the following syntax:
1955
2000
  *
1956
2001
  * .. code-block:: javascript
@@ -1962,9 +2007,9 @@ class Connector extends EventEmitter {
1962
2007
  * // ...
1963
2008
  * connector.off('on_data_available', myCallback)
1964
2009
  *
1965
- * Once the ``on_data_available`` event has fired, either :meth:`Input.read`
1966
- * or :meth:`Input.take` should be called on the :class:`Input` that has
1967
- * new data. This will prevent ``on_data_available`` from being fired more
2010
+ * Once the ``on_data_available`` event has fired, either :meth:`Input.read`
2011
+ * or :meth:`Input.take` should be called on the :class:`Input` that has
2012
+ * new data. This will prevent ``on_data_available`` from being fired more
1968
2013
  * than once for the same data.
1969
2014
  *
1970
2015
  * @private
@@ -2029,26 +2074,47 @@ class Connector extends EventEmitter {
2029
2074
  }
2030
2075
 
2031
2076
  /**
2032
- * Allows you to increase the number of :class:`Connector` instances that
2033
- * can be created.
2077
+ * This method is deprecated since the max_objects_per_thread now grows
2078
+ * dynamically.
2034
2079
  *
2035
- * The default value is 1024 (which allows for approximately 8 instances
2036
- * of :class:`Connector` to be created in a single application). If you need
2037
- * to create more than 8 instances of :class:`Connector`, you can increase
2038
- * the value from the default.
2080
+ * Note this method is deprecated in the Ironside release. This static method
2081
+ * only exists to not break user's applications which are already using it.
2082
+ *
2083
+ * @private
2084
+ */
2085
+ static setMaxObjectsPerThread (value) {
2086
+ }
2087
+
2088
+ /**
2089
+ * Returns the version of Connector.
2090
+ *
2091
+ * This static method provides the build IDs of the native libraries being used
2092
+ * by Connector, as well as the version of the Connector API.
2039
2093
  *
2040
2094
  * .. note::
2041
- * This is a static method. It can only be called before creating a
2095
+ * This is a static method. It can be called before creating a
2042
2096
  * :class:`Connector` instance.
2043
2097
  *
2044
- * See `SYSTEM_RESOURCE_LIMITS QoS Policy
2045
- * <https://community.rti.com/static/documentation/connext-dds/6.0.0/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_UsersManual/index.htm#UsersManual/SYSTEM_RESOURCE_LIMITS_QoS.htm>`__
2046
- * in the *RTI Connext DDS Core Libraries User's Manual* for more information.
2047
- *
2048
- * @param {number} value The value for ``max_objects_per_thread``
2049
- */
2050
- static setMaxObjectsPerThread (value) {
2051
- _checkRetcode(connectorBinding.api.RTI_Connector_set_max_objects_per_thread(value))
2098
+ * @returns {string} A string containing information about the version of Connector.
2099
+ */
2100
+ static getVersion () {
2101
+ // Obtain version of Connector from package.json
2102
+ const versionString = require('./package.json').version
2103
+ // Parse numbers out of string
2104
+ const versionNumbers = versionString.split('.')
2105
+ // Now get the build IDs of the native libraries
2106
+ const nativeConnectorVersion = ref.alloc('char *')
2107
+ const nativeCoreCVersion = ref.alloc('char *')
2108
+ _checkRetcode(connectorBinding.api.RTI_Connector_get_build_versions(
2109
+ nativeCoreCVersion,
2110
+ nativeConnectorVersion))
2111
+
2112
+ // Now create the string containing all of the above information
2113
+ let versionStr = 'RTI Connector for JavaScript, version ' +
2114
+ versionNumbers[0] + '.' + versionNumbers[1] + '.' + versionNumbers[2] + '\n'
2115
+ versionStr += ref.readCString(nativeCoreCVersion.deref()) + '\n'
2116
+ versionStr += ref.readCString(nativeConnectorVersion.deref())
2117
+ return versionStr
2052
2118
  }
2053
2119
  }
2054
2120