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
package/LICENSE.pdf CHANGED
Binary file
package/README.md CHANGED
@@ -26,11 +26,12 @@ The `examples/nodejs` directory provides several examples:
26
26
  ## Dependencies
27
27
 
28
28
  RTI Connector for JavaScript has the following dependencies, which are also listed in `package.json`:
29
- * [ref](https://www.npmjs.com/package/ref): turns Buffer instances into "pointers"
30
- * [ffi](https://www.npmjs.com/package/ffi): used for loading and calling dynamic libraries using pure JavaScript
29
+ * [ref-napi](https://www.npmjs.com/package/ref-napi): turns Buffer instances into "pointers"
30
+ * [ref-struct-napi](https://www.npmjs.com/package/ref-struct-napi): create ABI-compilant "Struct" instances on top of Buffers
31
+ * [ffi-napi](https://www.npmjs.com/package/ffi-napi): used for loading and calling dynamic libraries using pure JavaScript
31
32
  * [events](https://www.npmjs.com/package/events): used for the 'EventEmitter' (legacy implementation of RTI Connector)
32
33
 
33
- Additionally to run the `web_socket` example, [socket.io](https://github.com/Automattic/socket.io) and [OpenLayers](hhttps://openlayers.org] are required.
34
+ Additionally to run the `web_socket` example, [socket.io](https://github.com/Automattic/socket.io) and [OpenLayers](https://openlayers.org) are required.
34
35
 
35
36
  Additional dependencies are required to run the unit tests and some of the examples. Please see the README files in the appropriate directory.
36
37
 
@@ -47,9 +48,9 @@ The dependency [ref](https://www.npmjs.com/package/ref) is shipped as source cod
47
48
 
48
49
  ## License
49
50
 
50
- RTI Connector for JavaScript and RTI Connector for Python are part of the Connext
51
- DDS Professional Package. If you have a valid license for the RTI Connext DDS
52
- Professional Package, such license shall govern your use of RTI Connector for
53
- Python and RTI Connector for JavaScript. All other use of this software shall
51
+ RTI Connector for JavaScript is part of the Connext
52
+ Professional Package. If you have a valid license for the RTI Connext
53
+ Professional Package, such license shall govern your use of
54
+ RTI Connector for JavaScript. All other use of this software shall
54
55
  be governed solely by the terms of RTI’s Software License for Non-Commercial
55
- Use #4040, included at the top level of the `Connector for Python repository
56
+ Use #4040.
package/README.rst CHANGED
@@ -2,7 +2,7 @@ RTI Connector for JavaScript
2
2
  ============================
3
3
 
4
4
  RTI® Connext® DDS is a connectivity software framework for integrating
5
- data sources of all types. At its core is the worlds leading ultra-high
5
+ data sources of all types. At its core is the world's leading ultra-high
6
6
  performance, distributed networking databus.
7
7
 
8
8
  *RTI Connector* provides a quick and easy way to write applications that
@@ -34,15 +34,18 @@ Dependencies
34
34
 
35
35
  RTI Connector for JavaScript has the following dependencies, which are
36
36
  also listed in ``package.json``: \*
37
- `ref <https://www.npmjs.com/package/ref>`__: turns Buffer instances into
38
- pointers \* `ffi <https://www.npmjs.com/package/ffi>`__: used for
39
- loading and calling dynamic libraries using pure JavaScript \*
37
+ `ref-napi <https://www.npmjs.com/package/ref-napi>`__: turns Buffer
38
+ instances into "pointers" \*
39
+ `ref-struct-napi <https://www.npmjs.com/package/ref-struct-napi>`__:
40
+ create ABI-compilant "Struct" instances on top of Buffers \*
41
+ `ffi-napi <https://www.npmjs.com/package/ffi-napi>`__: used for loading
42
+ and calling dynamic libraries using pure JavaScript \*
40
43
  `events <https://www.npmjs.com/package/events>`__: used for the
41
- EventEmitter (legacy implementation of RTI Connector)
44
+ 'EventEmitter' (legacy implementation of RTI Connector)
42
45
 
43
46
  Additionally to run the ``web_socket`` example,
44
47
  `socket.io <https://github.com/Automattic/socket.io>`__ and
45
- [OpenLayers](hhttps://openlayers.org] are required.
48
+ `OpenLayers <https://openlayers.org>`__ are required.
46
49
 
47
50
  Additional dependencies are required to run the unit tests and some of
48
51
  the examples. Please see the README files in the appropriate directory.
@@ -67,10 +70,9 @@ source code and requires a C++11 compiler.
67
70
  License
68
71
  -------
69
72
 
70
- RTI Connector for JavaScript and RTI Connector for Python are part of
71
- the Connext DDS Professional Package. If you have a valid license for
72
- the RTI Connext DDS Professional Package, such license shall govern your
73
- use of RTI Connector for Python and RTI Connector for JavaScript. All
73
+ RTI Connector for JavaScript is part of
74
+ the Connext Professional Package. If you have a valid license for
75
+ the RTI Connext Professional Package, such license shall govern your
76
+ use of RTI Connector for JavaScript. All
74
77
  other use of this software shall be governed solely by the terms of
75
- RTI’s Software License for Non-Commercial Use #4040, included at the top
76
- level of the \`Connector for Python repository
78
+ RTI’s Software License for Non-Commercial Use #4040.
@@ -8,19 +8,18 @@ This code contains trade secrets of Real-Time Innovations, Inc.
8
8
  -->
9
9
 
10
10
  <dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11
- xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.0.0/rti_dds_profiles.xsd"
12
- version="6.0.0">
11
+ xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/current/rti_dds_profiles.xsd">
13
12
 
14
13
  <!-- Qos Library -->
15
14
  <qos_library name="QosLibrary">
16
15
  <qos_profile name="DefaultProfile"
17
16
  base_name="BuiltinQosLibExp::Generic.StrictReliable"
18
17
  is_default_qos="true">
19
- <participant_qos>
18
+ <domain_participant_qos>
20
19
  <participant_name>
21
20
  <name>Connector Shape Example</name>
22
21
  </participant_name>
23
- </participant_qos>
22
+ </domain_participant_qos>
24
23
  </qos_profile>
25
24
  </qos_library>
26
25
 
@@ -6,7 +6,7 @@
6
6
  * This code contains trade secrets of Real-Time Innovations, Inc. *
7
7
  ******************************************************************************/
8
8
 
9
- const sleep = require('sleep')
9
+ const msleep = require('util').promisify(setTimeout)
10
10
  const path = require('path')
11
11
  const rti = require('rticonnextdds-connector')
12
12
  const configFile = path.join(__dirname, '/../ShapeExample.xml')
@@ -26,7 +26,7 @@ const run = async () => {
26
26
  output.instance.setString('color', 'BLUE')
27
27
  output.write()
28
28
 
29
- sleep.msleep(500)
29
+ await msleep(500)
30
30
  }
31
31
 
32
32
  console.log('Exiting...')
@@ -3,15 +3,18 @@
3
3
  ## Example description
4
4
  In this example, we create a simple application which visualises the data DDS data it receives.
5
5
  `reader_websocket.js` listens at [http://127.0.0.1:7400](http://127.0.0.1:7400) for requests
6
- on how it should visualise the data. There are two options:
6
+ on how it should visualise the data. There are the following visualisation are available:
7
7
  * simple: Prints the information about the current shape
8
8
  * maps: Prints the received shapes data on a map
9
+ * charts: Displays the x-position of thereceived shapes data on a chart
9
10
 
10
11
  ## Dependencies
11
12
  This example requires additional packages:
12
13
  * [socket.io](https://www.npmjs.com/package/socket.io)
14
+ * Note: Node.js v13.6.x is incomaptible with socket.io.
13
15
  * [ol](https://www.npmjs.com/package/ol)
14
- They can be installed using `npm install socket.io ol`
16
+
17
+ These additional dependencies can be installed using `npm install socket.io@^3.0.4 ol@^6.4.3`
15
18
 
16
19
  ## Running the example
17
20
  * Run any *DDS* application that publishes the *Square*, *Circle* or *Triangle* topic. For example run
@@ -19,8 +22,7 @@ They can be installed using `npm install socket.io ol`
19
22
  [RTI Shapes Demo](https://www.rti.com/free-trial/shapes-demo) and create a *Square*
20
23
  publisher.
21
24
  * Run the web server `node ./reader_websocket.js`
22
- * In a browser, navigate to [http:/localhost:7400](http://127.0.0.1:7400)
25
+ * In a browser, navigate to [http:/127.0.0.1:7400](http://127.0.0.1:7400)
23
26
  * Select how you would like to visualize the data (simple or maps).
24
- * Navigating to [http://localhost:7400/simple](http://localhost:7400/simple) will show the simple visualization and
25
- [http://localhost:7400/maps](http://localhost:7400/maps) will show the maps visualization.
27
+ * Navigating to [http://127.0.0.1:7400/simple](http://127.0.0.1:7400/simple) will show the simple visualisation, [http://127.0.0.1:7400/maps](http://127.0.0.1:7400/maps) will show the maps visualisation and [http://127.0.0.1:7400/chart](http://127.0.0.1:7400/chart) will show the chart visualisation.
26
28
  * Note: The simple visualization may not work in the Safari browser.
@@ -0,0 +1,121 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <!--
4
+ (c) 2020 Copyright, Real-Time Innovations. All rights reserved.
5
+ No duplications, whole or partial, manual or electronic, may be made
6
+ without express written permission. Any such copies, or revisions thereof,
7
+ must display this notice unaltered.
8
+ This code contains trade secrets of Real-Time Innovations, Inc.
9
+ -->
10
+ <head>
11
+ <meta charset="utf-8" />
12
+ <title>RTI Connector for Javascript Example - Chart</title>
13
+ <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
14
+ <script src="/socket.io/socket.io.js"></script>
15
+ <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
16
+ <script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v6.0.1/build/ol.js"></script>
17
+ </head>
18
+ <body>
19
+ <!-- Load the D3 library -->
20
+ <script src="http://d3js.org/d3.v3.min.js"></script>
21
+ <script>
22
+ // The number of datapoints to be displayed
23
+ var n = 40;
24
+ // The dataset to be displayed by the line
25
+ var dataset = d3.range(n).map(() => d3.random.normal(0, .2));
26
+
27
+ var margin = { top: 20, right: 20, bottom: 20, left: 40 },
28
+ width = 960 - margin.left - margin.right,
29
+ height = 500 - margin.top - margin.bottom;
30
+
31
+ // Configure the X scale to use the range of use our dataset
32
+ var x = d3.scale.linear()
33
+ .domain([0, n - 1])
34
+ .range([0, width]);
35
+
36
+ // Configure the Y scale
37
+ var y = d3.scale.linear()
38
+ .domain([0, 250])
39
+ .range([height, 0]);
40
+
41
+ var line = d3.svg.line()
42
+ .x(function(d, i) { return x(i); })
43
+ .y(function(d, i) { return y(d); });
44
+
45
+ var svg = d3.select("body").append("svg")
46
+ .attr("width", width + margin.left + margin.right)
47
+ .attr("height", height + margin.top + margin.bottom)
48
+ .append("g")
49
+ .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
50
+
51
+ svg.append("defs").append("clipPath")
52
+ .attr("id", "clip")
53
+ .append("rect")
54
+ .attr("width", width)
55
+ .attr("height", height);
56
+
57
+ svg.append("g")
58
+ .attr("class", "x axis")
59
+ .attr("transform", "translate(0," + y(0) + ")")
60
+ .call(d3.svg.axis().scale(x).orient("bottom"));
61
+
62
+ svg.append("g")
63
+ .attr("class", "y axis")
64
+ .call(d3.svg.axis().scale(y).orient("left"));
65
+
66
+ var path = svg.append("g")
67
+ .attr("clip-path", "url(#clip)")
68
+ .append("path")
69
+ .datum(dataset)
70
+ .attr("class", "line")
71
+ .attr("d", line);
72
+
73
+ function tick(number) {
74
+ // Push a new data point onto the back
75
+ dataset.push(number);
76
+ // Redraw the line, and slide it to the left
77
+ path
78
+ .attr("d", line)
79
+ .attr("transform", null)
80
+ .attr("fill", "none")
81
+ .attr("stroke", "steelblue")
82
+ .attr("stroke-width", 1.5)
83
+ .transition()
84
+ .attr("transform", "translate(" + x(-1) + ",0)")
85
+ .each("end", null);
86
+ // Pop the old data point off the front
87
+ dataset.shift();
88
+ }
89
+ </script>
90
+
91
+ <h1>Chart D3 Example</h1>
92
+ <h2>Current Data</h2>
93
+ <p id="topic"></p>
94
+ <p id="x-position"></p>
95
+ <script src="/socket.io/socket.io.js"></script>
96
+
97
+ <script>
98
+ var socket = io.connect('http://127.0.0.1:7400');
99
+ var xPos = document.getElementById('x-position');
100
+ var topic = document.getElementById('topic');
101
+ socket.on('square', function (data) {
102
+ console.log('Got udpate from the server for square');
103
+ xPos.innerHTML = data.x
104
+ topic.innerHTML = "Square"
105
+ tick(data.x);
106
+ });
107
+ socket.on('triangle', function (data) {
108
+ console.log('Got udpate from the server for triangle');
109
+ xPos.innerHTML = data.x
110
+ topic.innerHTML = "Triangle"
111
+ tick(data.x);
112
+ });
113
+ socket.on('circle', function (data) {
114
+ console.log('Got udpate from the server for circle');
115
+ xPos.innerHTML = data.x
116
+ topic.innerHTML = "Circle"
117
+ tick(data.x);
118
+ });
119
+ </script>
120
+ </body>
121
+ </html>
@@ -13,7 +13,7 @@
13
13
  <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
14
14
  <script src="/socket.io/socket.io.js"></script>
15
15
  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
16
- <script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v6.0.1/build/ol.js"></script>
16
+ <script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/main/dist/en/v6.0.1/build/ol.js"></script>
17
17
  <style>
18
18
  .map {
19
19
  width: 100%;
@@ -35,9 +35,19 @@ const server = http.createServer(function (req, res) {
35
35
  res.end(data, 'utf-8')
36
36
  }
37
37
  })
38
+ } else if (req.url === '/chart') {
39
+ fs.readFile(path.join(__dirname, 'indexChart.html'), (error, data) => {
40
+ if (error) {
41
+ console.log('Error: ' + error)
42
+ throw new Error(error)
43
+ } else {
44
+ res.writeHead(200, { 'Content-Type': 'text/html' })
45
+ res.end(data, 'utf-8')
46
+ }
47
+ })
38
48
  } else {
39
49
  res.writeHead(200, { 'Content-Type': 'text/html' })
40
- res.write("Select your visualisation: <a href='simple'>simple</a> or <a href='maps'>maps</a>")
50
+ res.write("Select your visualisation: <a href='simple'>simple</a>, <a href='chart'>chart</a> or <a href='maps'>maps</a>")
41
51
  res.end()
42
52
  }
43
53
  }).listen(7400, '127.0.0.1')
@@ -46,7 +56,7 @@ console.log('Server running at http://127.0.0.1:7400/')
46
56
  // Create the DDS entities required for this example - a reader of Triangle, Circle
47
57
  // and Square (all under the same participant).
48
58
  const connector = new rti.Connector('MyParticipantLibrary::MySubParticipant', fullpath)
49
- const io = socketsio.listen(server)
59
+ const io = socketsio(server)
50
60
  // Create an array of each input which we want to receive data on, and its associated
51
61
  // topic name. We will emit the topic name from the io object.
52
62
  const inputs = [
package/package.json CHANGED
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "name": "rticonnextdds-connector",
3
- "version": "1.0.0",
3
+ "version": "1.3.0",
4
4
  "description": "RTI Connector for JavaScript",
5
5
  "main": "rticonnextdds-connector.js",
6
- "scripts": {
7
- "test": "echo \"test\""
8
- },
9
6
  "files": [
10
7
  "rticonnextdds-connector.js",
11
8
  "rticonnextdds-connector/lib",
@@ -16,10 +13,15 @@
16
13
  "url": "https://github.com/rticommunity/rticonnextdds-connector-js.git"
17
14
  },
18
15
  "dependencies": {
19
- "events": "*",
20
- "ffi": "*",
21
- "ref": "*",
22
- "sleep": "*"
16
+ "events": "^3.2.0",
17
+ "ffi-napi": "^3.1.0",
18
+ "ref-napi": "^3.0.1",
19
+ "ref-struct-di": "^1.1.1"
20
+ },
21
+ "scripts": {
22
+ "test": "mocha ./test/nodejs/",
23
+ "test-junit": "mocha ./test/nodejs/ --reporter mocha-junit-reporter",
24
+ "test-json": "mocha ./test/nodejs/ --reporter json --reporter-option output=test-results.json"
23
25
  },
24
26
  "keywords": [
25
27
  "rti",
@@ -35,5 +37,12 @@
35
37
  "bugs": {
36
38
  "url": "https://github.com/rticommunity/rticonnextdds-connector-js/issues"
37
39
  },
38
- "homepage": "https://github.com/rticommunity/rticonnextdds-connector-js"
40
+ "homepage": "https://github.com/rticommunity/rticonnextdds-connector-js",
41
+ "devDependencies": {
42
+ "chai": "^4.3.4",
43
+ "chai-as-promised": "^7.1.1",
44
+ "mocha": "^10.2.0",
45
+ "mocha-junit-reporter": "^2.2.0",
46
+ "sinon": "^10.0.0"
47
+ }
39
48
  }