node-red-contrib-mobius-flow-base 2.5.86-beta.1 → 2.5.86-beta.101

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 (39) hide show
  1. package/dist/nodes/icons/mobius-inject.png +0 -0
  2. package/dist/nodes/icons/mobius.png +0 -0
  3. package/dist/nodes/mobius-clear-resource.html +178 -0
  4. package/dist/nodes/mobius-clear-resource.js +109 -0
  5. package/dist/nodes/mobius-connection.html +68 -0
  6. package/dist/nodes/mobius-connection.js +675 -0
  7. package/dist/nodes/mobius-discover-object-list.html +272 -0
  8. package/dist/nodes/mobius-discover-object-list.js +263 -0
  9. package/dist/nodes/mobius-discover.html +139 -0
  10. package/dist/nodes/mobius-discover.js +100 -0
  11. package/dist/nodes/mobius-filter-by-rid-value.html +206 -0
  12. package/dist/nodes/mobius-filter-by-rid-value.js +123 -0
  13. package/dist/nodes/mobius-flow-inject.html +162 -0
  14. package/dist/nodes/mobius-flow-inject.js +124 -0
  15. package/dist/nodes/mobius-get-multi-object.html +176 -0
  16. package/dist/nodes/mobius-get-multi-object.js +127 -0
  17. package/dist/nodes/mobius-get-multi-resource.html +195 -0
  18. package/dist/nodes/mobius-get-multi-resource.js +140 -0
  19. package/dist/nodes/mobius-get-object.html +168 -0
  20. package/dist/nodes/mobius-get-object.js +102 -0
  21. package/dist/nodes/mobius-get-resource.html +169 -0
  22. package/dist/nodes/mobius-get-resource.js +101 -0
  23. package/dist/nodes/mobius-object-cov.html +171 -0
  24. package/dist/nodes/mobius-object-cov.js +83 -0
  25. package/dist/nodes/mobius-resource-cov.html +155 -0
  26. package/dist/nodes/mobius-resource-cov.js +77 -0
  27. package/dist/nodes/mobius-send-bcmd.html +93 -0
  28. package/dist/nodes/mobius-send-bcmd.js +61 -0
  29. package/dist/nodes/mobius-send-dcmd.html +130 -0
  30. package/dist/nodes/mobius-send-dcmd.js +80 -0
  31. package/dist/nodes/mobius-set-multi-resource.html +150 -0
  32. package/dist/nodes/mobius-set-multi-resource.js +104 -0
  33. package/dist/nodes/mobius-set-resource.html +180 -0
  34. package/dist/nodes/mobius-set-resource.js +145 -0
  35. package/dist/nodes/mobius-sub-bcmd.html +94 -0
  36. package/dist/nodes/mobius-sub-bcmd.js +64 -0
  37. package/dist/nodes/node-red-ui-discover-devices.js +103 -0
  38. package/dist/nodes/validateURI.js +51 -0
  39. package/package.json +1 -1
@@ -0,0 +1,171 @@
1
+ <!--
2
+ Copyright (C) 2016, IAConnects Technology Limited
3
+ All Rights Reserved
4
+
5
+ ALL INFORMATION CONTAINED HEREIN IS, AND REMAINS
6
+ THE PROPERTY OF IACONNECTS TECHNOLOGY LIMITED AND ITS SUPPLIERS,
7
+ IF ANY. THE INTELLECTUAL AND TECHNICAL CONCEPTS CONTAINED
8
+ HEREIN ARE PROPRIETARY TO IACONNECTS TECHNOLOGY LIMITED
9
+ AND ITS SUPPLIERS AND ARE PROTECTED BY TRADE SECRET OR COPYRIGHT LAW.
10
+ DISSEMINATION OF THIS INFORMATION OR REPRODUCTION OF THIS MATERIAL
11
+ IS STRICTLY FORBIDDEN UNLESS PRIOR WRITTEN PERMISSION IS OBTAINED
12
+ FROM IACONNECTS TECHNOLOGY LIMITED.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
18
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24
+ POSSIBILITY OF SUCH DAMAGE.
25
+ -->
26
+
27
+ <script type="text/x-red" data-template-name="mobius object cov">
28
+ <div class="form-row">
29
+ <label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
30
+ <input type="text" id="node-input-connection">
31
+ </div>
32
+ <div class="form-row">
33
+ <label for="node-input-object"><i class="fa fa-tasks"></i> URI</label>
34
+ <input type="text" id="node-input-object" placeholder="Object URI (hid/sid/pid/ins)">
35
+ </div>
36
+ <div class="form-row">
37
+ <label for="node-input-include"><i class="fa fa-bars"></i> Include</label>
38
+ <select type="text" id="node-input-include" style="display: inline-block; width: auto; vertical-align: center;">
39
+ <option value="all">All Resources</option>
40
+ <option value="changed">Changed Resources</option>
41
+ </select>
42
+ </div>
43
+ <div class="form-row">
44
+ <label for="node-input-format"><i class="fa fa-bars"></i> Format</label>
45
+ <select type="text" id="node-input-format" style="display: inline-block; width: auto; vertical-align: center;">
46
+ <option value="name">By Name</option>
47
+ <option value="rid">By RID</option>
48
+ </select>
49
+ </div>
50
+ <div class="form-row">
51
+ <label>&nbsp;</label>
52
+ <input type="checkbox" id="node-input-detailedOutput" style="display: inline-block; width: auto; vertical-align: top;">
53
+ <label for="node-input-detailedOutput" style="width: 70%;"> Use detailed outputs</label>
54
+ </div>
55
+ <hr>
56
+ <div class="form-row">
57
+ <label for="node-input-statusType" style="width: 160px;"><i class="fa fa-bars"></i> Status Display</label>
58
+ <select type="text" id="node-input-statusType" style="display: inline-block; width: 300px; vertical-align: center;">
59
+ <option value="timeSinceLastActive">Show time since last active</option>
60
+ <option value="lastUri">Show last URI</option>
61
+ </select>
62
+ </div>
63
+ <div class="form-row">
64
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
65
+ <input type="text" id="node-input-name" placeholder="Name">
66
+ </div>
67
+ </script>
68
+
69
+ <script type="text/javascript">
70
+ RED.nodes.registerType('mobius object cov', {
71
+ category: 'mobius',
72
+ defaults: {
73
+ name: {value:""},
74
+ statusType: {value:"timeSinceLastActive"},
75
+ detailedOutput: {value:false},
76
+ format: {value: "name", required: true},
77
+ include: {value: "changed", required: true},
78
+ object: {value:"", validate:function(v) {
79
+ if(v === '') { return true; }
80
+ let parts = v.split('/');
81
+ for(let lp = 0; lp < parts.length; lp++) {
82
+ if(parts[lp] === null || parts[lp] === '') { return false;}
83
+ }
84
+ if(parts.length === 4) { return true; }
85
+ if(parts.length < 4 && parts[parts.length - 1] === '#') { return true; }
86
+ return false;
87
+ }},
88
+ connection: {type:"mobius connection", required:true}
89
+ },
90
+ color:"#8abff5",
91
+ inputs:0,
92
+ outputs:1,
93
+ outputLabels: function (index) {
94
+ if(index === 0) return ("Resource list");
95
+ if(index === 1) return ("MOBiUS object");
96
+ if(index === 2) return ("Full MOBiUS response");
97
+ },
98
+ icon: "mobius.png",
99
+ align: "left",
100
+ paletteLabel: 'object cov',
101
+ label: function() {
102
+ if(this.name) {
103
+ return this.name;
104
+ } else {
105
+ return this.object ? `ObjCOV - ${this.object}` : "object cov";
106
+ }
107
+ },
108
+ labelStyle: function() {
109
+ return this.name ? "node_label_italic":"";
110
+ },
111
+ oneditsave: function() {
112
+ if($("#node-input-detailedOutput").prop('checked')) {
113
+ this.outputs = 3;
114
+ } else {
115
+ this.outputs = 1;
116
+ }
117
+ }
118
+ });
119
+ </script>
120
+
121
+ <script type="text/x-red" data-help-name="mobius object cov">
122
+ <p>Subscribe to MOBiUS object change of value messages.</p>
123
+
124
+ <h3>Configuration Page</h3>
125
+ <dl class="message-properties">
126
+ <dt>MOBiUS <span class="property-type">node</span></dt>
127
+ <dd>Shared MOBiUS connection for communication with the MOBiUS Hub.</dd>
128
+ <dt>URI <span class="property-type">string</span></dt>
129
+ <dd>The MOBiUS URI of the subscription. This may contain MQTT type wildcards.</dd>
130
+ <dt>Include <span class="property-type">option</span></dt>
131
+ <dd>Select whether to include all resources or only changed resources in the resource list sent in output 1.</dd>
132
+ <dt>Format <span class="property-type">option</span></dt>
133
+ <dd>Select the keys used for the resource list sent in output 1.</dd>
134
+ <dt>Use detailed outputs <span class="property-type">boolean</span></dt>
135
+ <dd>If checked the full object is sent on output 2 and the full MOBiUS response is sent on output 3.</dd>
136
+ </dl>
137
+
138
+ <h3>Outputs</h3>
139
+ <ol class="node-ports">
140
+ <li>List of all or changed resources, keyed by name or RID
141
+ <dl class="message-properties">
142
+ <dt>topic <span class="property-type">string</span></dt>
143
+ <dd>The full URI of the object.</dd>
144
+ <dt>payload <span class="property-type">object</span></dt>
145
+ <dd>The resource list.</dd>
146
+ </dl>
147
+ </li>
148
+ <li>The MOBiUS object (optional)
149
+ <dl class="message-properties">
150
+ <dt>topic <span class="property-type">string</span></dt>
151
+ <dd>The full URI of the object.</dd>
152
+ <dt>payload <span class="property-type">object</span></dt>
153
+ <dd>The object.</dd>
154
+ </dl>
155
+ </li>
156
+ <li>Full MOBiUS response (optional)
157
+ <dl class="message-properties">
158
+ <dt>topic <span class="property-type">string</span></dt>
159
+ <dd>The full URI of the object.</dd>
160
+ <dt>response <span class="property-type">object</span></dt>
161
+ <dd>The full MOBiUS response message.</dd>
162
+ </dl>
163
+ </li>
164
+ </ol>
165
+
166
+ <h3>Details</h3>
167
+ <p>Outputs 2 and 3 are only sent if <b>Use detailed outputs</b> is checked on the configuration page.</p>
168
+
169
+ <br>
170
+ <p align="center" style="color:#000080">iaconnects © 2017</p>
171
+ </script>
@@ -0,0 +1,83 @@
1
+ /**
2
+ Copyright (C) 2016, IAConnects Technology Limited
3
+ All Rights Reserved
4
+
5
+ ALL INFORMATION CONTAINED HEREIN IS, AND REMAINS
6
+ THE PROPERTY OF IACONNECTS TECHNOLOGY LIMITED AND ITS SUPPLIERS,
7
+ IF ANY. THE INTELLECTUAL AND TECHNICAL CONCEPTS CONTAINED
8
+ HEREIN ARE PROPRIETARY TO IACONNECTS TECHNOLOGY LIMITED
9
+ AND ITS SUPPLIERS AND ARE PROTECTED BY TRADE SECRET OR COPYRIGHT LAW.
10
+ DISSEMINATION OF THIS INFORMATION OR REPRODUCTION OF THIS MATERIAL
11
+ IS STRICTLY FORBIDDEN UNLESS PRIOR WRITTEN PERMISSION IS OBTAINED
12
+ FROM IACONNECTS TECHNOLOGY LIMITED.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
18
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24
+ POSSIBILITY OF SUCH DAMAGE.
25
+ **/
26
+
27
+ /* jshint elision: true */
28
+ 'use strict';
29
+ var _ = require('lodash');
30
+
31
+ module.exports = function (RED) {
32
+ function MobiusObjectCovNode(n) {
33
+ RED.nodes.createNode(this, n);
34
+ this.detailedOutput = n.detailedOutput;
35
+ this.object = n.object;
36
+ this.format = n.format;
37
+ this.include = n.include;
38
+ this.serviceConn = RED.nodes.getNode(n.connection);
39
+ this.latestUri = '';
40
+ this.statusType = n.statusType;
41
+ var node = this;
42
+
43
+ if (node.serviceConn) {
44
+ node.status({
45
+ fill: 'red',
46
+ shape: 'ring',
47
+ text: 'Disconnected',
48
+ });
49
+ node.serviceConn.subscribeToObjectCOV(node.object, this.id, (response) => {
50
+ node.serviceConn.updateLatestUri(node, response.uri);
51
+ node.serviceConn.updateLastActiveTime(node);
52
+ let allResources = _.keyBy(
53
+ response.value.resources,
54
+ node.format === 'name' ? 'name' : 'rid'
55
+ );
56
+ if (node.include === 'changed') {
57
+ allResources = _.pickBy(allResources, (res) => {
58
+ return response.changed.includes(res.rid);
59
+ });
60
+ }
61
+ if (node.detailedOutput === true) {
62
+ node.send([
63
+ { topic: response.uri, payload: allResources },
64
+ { topic: response.uri, payload: response.value },
65
+ { topic: response.uri, payload: { response: response } },
66
+ ]);
67
+ } else {
68
+ node.send({ topic: response.uri, payload: allResources });
69
+ }
70
+ });
71
+
72
+ node.serviceConn.register(node);
73
+
74
+ node.on('close', function (done) {
75
+ node.serviceConn.deregister(node, done);
76
+ });
77
+ } else {
78
+ node.error(RED._('Mobius service not defined'));
79
+ }
80
+ }
81
+
82
+ RED.nodes.registerType('mobius object cov', MobiusObjectCovNode);
83
+ };
@@ -0,0 +1,155 @@
1
+ <!--
2
+ Copyright (C) 2016, IAConnects Technology Limited
3
+ All Rights Reserved
4
+
5
+ ALL INFORMATION CONTAINED HEREIN IS, AND REMAINS
6
+ THE PROPERTY OF IACONNECTS TECHNOLOGY LIMITED AND ITS SUPPLIERS,
7
+ IF ANY. THE INTELLECTUAL AND TECHNICAL CONCEPTS CONTAINED
8
+ HEREIN ARE PROPRIETARY TO IACONNECTS TECHNOLOGY LIMITED
9
+ AND ITS SUPPLIERS AND ARE PROTECTED BY TRADE SECRET OR COPYRIGHT LAW.
10
+ DISSEMINATION OF THIS INFORMATION OR REPRODUCTION OF THIS MATERIAL
11
+ IS STRICTLY FORBIDDEN UNLESS PRIOR WRITTEN PERMISSION IS OBTAINED
12
+ FROM IACONNECTS TECHNOLOGY LIMITED.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
18
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24
+ POSSIBILITY OF SUCH DAMAGE.
25
+ -->
26
+
27
+ <script type="text/x-red" data-template-name="mobius resource cov">
28
+ <div class="form-row">
29
+ <label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
30
+ <input type="text" id="node-input-connection">
31
+ </div>
32
+ <div class="form-row">
33
+ <label for="node-input-resource"><i class="fa fa-tasks"></i> URI</label>
34
+ <input type="text" id="node-input-resource" placeholder="Resource URI (hid/sid/pid/ins/rid)">
35
+ </div>
36
+ <div class="form-row">
37
+ <label>&nbsp;</label>
38
+ <input type="checkbox" id="node-input-detailedOutput" style="display: inline-block; width: auto; vertical-align: top;">
39
+ <label for="node-input-detailedOutput" style="width: 70%;"> Use detailed outputs</label>
40
+ </div>
41
+ <hr>
42
+ <div class="form-row">
43
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
44
+ <input type="text" id="node-input-name" placeholder="Name">
45
+ </div>
46
+ </script>
47
+
48
+ <script type="text/javascript">
49
+ RED.nodes.registerType('mobius resource cov', {
50
+ category: 'mobius',
51
+ defaults: {
52
+ name: {value:""},
53
+ detailedOutput: {value:false},
54
+ resource: {value:"", required:true, validate:function(v) {
55
+ let parts = v.split('/');
56
+ for(let lp = 0; lp < parts.length; lp++) {
57
+ if(parts[lp] === null || parts[lp] === '') { return false;}
58
+ }
59
+ if(parts.length === 5) { return true; }
60
+ if(parts.length < 5 && parts[parts.length - 1] === '#') { return true; }
61
+ return false;
62
+ }},
63
+ connection: {type:"mobius connection", required:true}
64
+ },
65
+ color:"#8abff5",
66
+ inputs:0,
67
+ outputs:2,
68
+ outputLabels: function (index) {
69
+ if(index === 0) return ("Resource's PV");
70
+ if(index === 1) return ("Resource's PV and name");
71
+ if(index === 2) return ("MOBiUS resource");
72
+ if(index === 3) return ("Full MOBiUS response");
73
+ },
74
+ icon: "mobius.png",
75
+ align: "left",
76
+ paletteLabel: 'resource cov',
77
+ label: function() {
78
+ if(this.name) {
79
+ return this.name;
80
+ } else {
81
+ return this.resource ? `ResCOV - ${this.resource}` : "resource cov";
82
+ }
83
+ },
84
+ labelStyle: function() {
85
+ return this.name ? "node_label_italic":"";
86
+ },
87
+ oneditsave: function() {
88
+ if($("#node-input-detailedOutput").prop('checked')) {
89
+ this.outputs = 4;
90
+ } else {
91
+ this.outputs = 2;
92
+ }
93
+ }
94
+ });
95
+ </script>
96
+
97
+ <script type="text/x-red" data-help-name="mobius resource cov">
98
+ <p>Subscribe to MOBiUS resource change of value messages.</p>
99
+
100
+ <h3>Configuration Page</h3>
101
+ <dl class="message-properties">
102
+ <dt>MOBiUS <span class="property-type">node</span></dt>
103
+ <dd>Shared MOBiUS connection for communication with the MOBiUS Hub.</dd>
104
+ <dt>URI <span class="property-type">string</span></dt>
105
+ <dd>The MOBiUS URI of the subscription. This may contain MQTT type wildcards.</dd>
106
+ <dt>Use detailed outputs <span class="property-type">boolean</span></dt>
107
+ <dd>If checked the full resource is sent on output 3 and the full MOBiUS response is sent on output 4.</dd>
108
+ </dl>
109
+
110
+ <h3>Outputs</h3>
111
+ <ol class="node-ports">
112
+ <li>Output 1 (Present value)
113
+ <dl class="message-properties">
114
+ <dt>topic <span class="property-type">string</span></dt>
115
+ <dd>The full URI of the resource.</dd>
116
+ <dt>payload <span class="property-type">object</span></dt>
117
+ <dd>The resource's pv.</dd>
118
+ </dl>
119
+ </li>
120
+ <li>Output 2 (Present value and name of resource)
121
+ <dl class="message-properties">
122
+ <dt>topic <span class="property-type">string</span></dt>
123
+ <dd>The full URI of the resource.</dd>
124
+ <dt>payload.pv <span class="property-type">object</span></dt>
125
+ <dd>The resource's pv.</dd>
126
+ <dt>payload.name <span class="property-type">object</span></dt>
127
+ <dd>The resource's name.</dd>
128
+ </dl>
129
+ </li>
130
+ <li>Output 3 (The MOBiUS resource - optional)
131
+ <dl class="message-properties">
132
+ <dt>topic <span class="property-type">string</span></dt>
133
+ <dd>The full URI of the resource.</dd>
134
+ <dt>payload <span class="property-type">object</span></dt>
135
+ <dd>The resource.</dd>
136
+ </dl>
137
+ </li>
138
+ <li>Output 4 (Full MOBiUS response - optional)
139
+ <dl class="message-properties">
140
+ <dt>topic <span class="property-type">string</span></dt>
141
+ <dd>The full URI of the resource.</dd>
142
+ <dt>error <span class="property-type">boolean</span></dt>
143
+ <dd>True if an error occured, else false.</dd>
144
+ <dt>response <span class="property-type">object</span></dt>
145
+ <dd>The full MOBiUS response message.</dd>
146
+ </dl>
147
+ </li>
148
+ </ol>
149
+
150
+ <h3>Details</h3>
151
+ <p>Outputs 3 and 4 are only sent if <b>Use detailed outputs</b> is checked on the configuration page.</p>
152
+
153
+ <br>
154
+ <p align="center" style="color:#000080">iaconnects © 2017</p>
155
+ </script>
@@ -0,0 +1,77 @@
1
+ /**
2
+ Copyright (C) 2016, IAConnects Technology Limited
3
+ All Rights Reserved
4
+
5
+ ALL INFORMATION CONTAINED HEREIN IS, AND REMAINS
6
+ THE PROPERTY OF IACONNECTS TECHNOLOGY LIMITED AND ITS SUPPLIERS,
7
+ IF ANY. THE INTELLECTUAL AND TECHNICAL CONCEPTS CONTAINED
8
+ HEREIN ARE PROPRIETARY TO IACONNECTS TECHNOLOGY LIMITED
9
+ AND ITS SUPPLIERS AND ARE PROTECTED BY TRADE SECRET OR COPYRIGHT LAW.
10
+ DISSEMINATION OF THIS INFORMATION OR REPRODUCTION OF THIS MATERIAL
11
+ IS STRICTLY FORBIDDEN UNLESS PRIOR WRITTEN PERMISSION IS OBTAINED
12
+ FROM IACONNECTS TECHNOLOGY LIMITED.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
18
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24
+ POSSIBILITY OF SUCH DAMAGE.
25
+ **/
26
+
27
+ /* jshint elision: true */
28
+ 'use strict';
29
+
30
+ module.exports = function (RED) {
31
+ function MobiusResourceCovNode (n) {
32
+ RED.nodes.createNode(this, n);
33
+ this.detailedOutput = n.detailedOutput;
34
+ this.resource = n.resource;
35
+ this.serviceConn = RED.nodes.getNode(n.connection);
36
+ var node = this;
37
+
38
+ if (node.serviceConn) {
39
+ node.status({
40
+ fill: 'red',
41
+ shape: 'ring',
42
+ text: 'Disconnected'
43
+ });
44
+
45
+ node.serviceConn.subscribeToCOV(node.resource, this.id, (response) => {
46
+ node.status({
47
+ fill: 'green',
48
+ shape: 'dot',
49
+ text: JSON.stringify(response.value.pv)
50
+ });
51
+ if (node.detailedOutput === true) {
52
+ node.send([
53
+ { topic: response.uri, payload: response.value.pv },
54
+ { topic: response.uri, payload: { pv: response.value.pv, name: response.value.name } },
55
+ { topic: response.uri, payload: response.value },
56
+ { topic: response.uri, payload: { response: response } }
57
+ ]);
58
+ } else {
59
+ node.send([
60
+ { topic: response.uri, payload: response.value.pv },
61
+ { topic: response.uri, payload: { pv: response.value.pv, name: response.value.name } }
62
+ ]);
63
+ }
64
+ });
65
+
66
+ node.serviceConn.register(node);
67
+
68
+ node.on('close', function (done) {
69
+ node.serviceConn.deregister(node, done);
70
+ });
71
+ } else {
72
+ this.error(RED._('Mobius service not defined'));
73
+ }
74
+ }
75
+
76
+ RED.nodes.registerType('mobius resource cov', MobiusResourceCovNode);
77
+ };
@@ -0,0 +1,93 @@
1
+ <!--
2
+ Copyright (C) 2016, IAConnects Technology Limited
3
+ All Rights Reserved
4
+
5
+ ALL INFORMATION CONTAINED HEREIN IS, AND REMAINS
6
+ THE PROPERTY OF IACONNECTS TECHNOLOGY LIMITED AND ITS SUPPLIERS,
7
+ IF ANY. THE INTELLECTUAL AND TECHNICAL CONCEPTS CONTAINED
8
+ HEREIN ARE PROPRIETARY TO IACONNECTS TECHNOLOGY LIMITED
9
+ AND ITS SUPPLIERS AND ARE PROTECTED BY TRADE SECRET OR COPYRIGHT LAW.
10
+ DISSEMINATION OF THIS INFORMATION OR REPRODUCTION OF THIS MATERIAL
11
+ IS STRICTLY FORBIDDEN UNLESS PRIOR WRITTEN PERMISSION IS OBTAINED
12
+ FROM IACONNECTS TECHNOLOGY LIMITED.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
18
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24
+ POSSIBILITY OF SUCH DAMAGE.
25
+ -->
26
+
27
+ <script type="text/x-red" data-template-name="mobius send bcmd">
28
+ <div class="form-row">
29
+ <label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
30
+ <input type="text" id="node-input-connection">
31
+ </div>
32
+ <div class="form-row">
33
+ <label for="node-input-cid"><i class="fa fa-tasks"></i> Command ID</label>
34
+ <input type="text" id="node-input-cid" placeholder="Mobius command ID">
35
+ </div>
36
+ <hr>
37
+ <div class="form-row">
38
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
39
+ <input type="text" id="node-input-name" placeholder="Name">
40
+ </div>
41
+ </script>
42
+
43
+ <script type="text/javascript">
44
+ RED.nodes.registerType('mobius send bcmd',{
45
+ category: 'mobius',
46
+ defaults: {
47
+ name: {value:""},
48
+ cid: {value:"", required:true},
49
+ connection: {type:"mobius connection", required:true}
50
+ },
51
+ color:"#8abff5",
52
+ inputs:1,
53
+ outputs:0,
54
+ icon: "mobius.png",
55
+ align: "right",
56
+ paletteLabel: 'send bcmd',
57
+ label: function() {
58
+ if(this.name) {
59
+ return this.name;
60
+ } else {
61
+ return 'send bcmd';
62
+ }
63
+ },
64
+ labelStyle: function() {
65
+ return this.name ? "node_label_italic":"";
66
+ }
67
+ });
68
+ </script>
69
+
70
+ <script type="text/x-red" data-help-name="mobius send bcmd">
71
+ <p>Send a MOBiUS broadcast command.</p>
72
+
73
+ <h3>Configuration Page</h3>
74
+ <dl class="message-properties">
75
+ <dt>MOBiUS <span class="property-type">node</span></dt>
76
+ <dd>Shared MOBiUS connection for communication with the MOBiUS Hub.</dd>
77
+ <dt>Command ID <span class="property-type">string</span></dt>
78
+ <dd>The MOBiUS broadcast command ID.</dd>
79
+ </dl>
80
+
81
+ <h3>Inputs</h3>
82
+ <ol class="node-ports">
83
+ <li>Input message to trigger sending the broadcast command
84
+ <dl class="message-properties">
85
+ <dt>payload <span class="property-type">string</span></dt>
86
+ <dd>The broadcast command data. The content will depend on the command being sent.</dd>
87
+ </dl>
88
+ </li>
89
+ </ol>
90
+
91
+ <br>
92
+ <p align="center" style="color:#000080">iaconnects © 2018</p>
93
+ </script>
@@ -0,0 +1,61 @@
1
+ /**
2
+ Copyright (C) 2016, IAConnects Technology Limited
3
+ All Rights Reserved
4
+
5
+ ALL INFORMATION CONTAINED HEREIN IS, AND REMAINS
6
+ THE PROPERTY OF IACONNECTS TECHNOLOGY LIMITED AND ITS SUPPLIERS,
7
+ IF ANY. THE INTELLECTUAL AND TECHNICAL CONCEPTS CONTAINED
8
+ HEREIN ARE PROPRIETARY TO IACONNECTS TECHNOLOGY LIMITED
9
+ AND ITS SUPPLIERS AND ARE PROTECTED BY TRADE SECRET OR COPYRIGHT LAW.
10
+ DISSEMINATION OF THIS INFORMATION OR REPRODUCTION OF THIS MATERIAL
11
+ IS STRICTLY FORBIDDEN UNLESS PRIOR WRITTEN PERMISSION IS OBTAINED
12
+ FROM IACONNECTS TECHNOLOGY LIMITED.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
18
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24
+ POSSIBILITY OF SUCH DAMAGE.
25
+ **/
26
+
27
+ /* jshint elision: true */
28
+ 'use strict';
29
+
30
+ module.exports = function (RED) {
31
+ function MobiusSendBCMDNode (n) {
32
+ RED.nodes.createNode(this, n);
33
+ this.cid = n.cid;
34
+ this.serviceConn = RED.nodes.getNode(n.connection);
35
+ var node = this;
36
+
37
+ if (node.serviceConn) {
38
+ node.status({
39
+ fill: 'red',
40
+ shape: 'ring',
41
+ text: 'Disconnected'
42
+ });
43
+
44
+ node.on('input', function (msg) {
45
+ if (msg.hasOwnProperty('payload')) {
46
+ node.serviceConn.sendBroadcastCommand(node.cid, msg.payload);
47
+ }
48
+ });
49
+
50
+ node.serviceConn.register(node);
51
+
52
+ node.on('close', function (done) {
53
+ node.serviceConn.deregister(node, done);
54
+ });
55
+ } else {
56
+ node.error(RED._('Mobius service not defined'));
57
+ }
58
+ }
59
+
60
+ RED.nodes.registerType('mobius send bcmd', MobiusSendBCMDNode);
61
+ };