node-red-contrib-mobius-flow-base 2.5.91 → 3.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/bug_report.md +16 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +16 -0
- package/.github/ISSUE_TEMPLATE/general.md +7 -0
- package/.github/workflows/build_publish.yml +80 -0
- package/README.md +4 -10
- package/dist/engine-api-calls.d.ts +19 -0
- package/dist/engine-api-calls.js +235 -0
- package/dist/engine-api-client.d.ts +8 -0
- package/dist/engine-api-client.js +106 -0
- package/dist/engine-websocket.d.ts +60 -0
- package/dist/engine-websocket.js +264 -0
- package/dist/node-red-ui-funcs.js +180 -0
- package/dist/nodes/common/mobsearch.js +602 -0
- package/dist/nodes/mobius-change-admin-password.d.ts +26 -0
- package/dist/nodes/mobius-change-admin-password.html +98 -0
- package/dist/nodes/mobius-change-admin-password.js +87 -0
- package/dist/nodes/mobius-clear-resource.html +37 -12
- package/dist/nodes/mobius-clear-resource.js +17 -13
- package/dist/nodes/mobius-connection-interface.d.ts +45 -0
- package/dist/nodes/mobius-connection-interface.js +2 -0
- package/dist/nodes/mobius-connection.html +30 -8
- package/dist/nodes/mobius-connection.js +216 -85
- package/dist/nodes/mobius-discover-object-list.html +185 -126
- package/dist/nodes/mobius-discover-object-list.js +24 -5
- package/dist/nodes/mobius-discover.js +7 -7
- package/dist/nodes/mobius-filter-by-rid-value.html +62 -42
- package/dist/nodes/mobius-filter-by-rid-value.js +38 -31
- package/dist/nodes/mobius-flow-inject.html +32 -2
- package/dist/nodes/mobius-get-multi-object.html +39 -5
- package/dist/nodes/mobius-get-multi-resource.html +37 -4
- package/dist/nodes/mobius-get-multi-resource.js +13 -12
- package/dist/nodes/mobius-get-object.html +39 -11
- package/dist/nodes/mobius-get-object.js +12 -9
- package/dist/nodes/mobius-get-resource.html +41 -12
- package/dist/nodes/mobius-get-resource.js +17 -12
- package/dist/nodes/mobius-object-cov.html +40 -11
- package/dist/nodes/mobius-object-cov.js +9 -6
- package/dist/nodes/mobius-resource-cov.html +37 -11
- package/dist/nodes/mobius-resource-cov.js +5 -5
- package/dist/nodes/mobius-set-multi-resource.html +39 -12
- package/dist/nodes/mobius-set-multi-resource.js +9 -11
- package/dist/nodes/mobius-set-resource.html +38 -11
- package/package.json +15 -8
- package/dist/nodes/node-red-ui-discover-devices.js +0 -103
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
const _ = require('lodash');
|
|
31
31
|
|
|
32
32
|
module.exports = function (RED) {
|
|
33
|
-
function MobiusGetObjectNode
|
|
33
|
+
function MobiusGetObjectNode(n) {
|
|
34
34
|
RED.nodes.createNode(this, n);
|
|
35
35
|
this.detailedOutput = n.detailedOutput;
|
|
36
36
|
this.format = n.format;
|
|
@@ -42,7 +42,7 @@ module.exports = function (RED) {
|
|
|
42
42
|
node.status({
|
|
43
43
|
fill: 'red',
|
|
44
44
|
shape: 'ring',
|
|
45
|
-
text: 'Disconnected'
|
|
45
|
+
text: 'Disconnected',
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
node.on('input', function (msg) {
|
|
@@ -54,32 +54,35 @@ module.exports = function (RED) {
|
|
|
54
54
|
node.status({
|
|
55
55
|
fill: 'green',
|
|
56
56
|
shape: 'ring',
|
|
57
|
-
text: 'Busy'
|
|
57
|
+
text: 'Busy',
|
|
58
58
|
});
|
|
59
59
|
node.serviceConn.readObject(uri, (err, response) => {
|
|
60
60
|
if (err) {
|
|
61
61
|
node.status({
|
|
62
62
|
fill: 'yellow',
|
|
63
63
|
shape: 'dot',
|
|
64
|
-
text: 'Error: ' + JSON.stringify(err.code)
|
|
64
|
+
text: 'Error: ' + JSON.stringify(err.code),
|
|
65
65
|
});
|
|
66
66
|
node.error('Mobius error reading object ' + JSON.stringify(err));
|
|
67
67
|
if (node.detailedOutput === true) {
|
|
68
|
-
node.send([null, null, {topic: uri, payload: { error: true, response: err }}]);
|
|
68
|
+
node.send([null, null, { topic: uri, payload: { error: true, response: err } }]);
|
|
69
69
|
}
|
|
70
70
|
} else {
|
|
71
71
|
node.status({
|
|
72
72
|
fill: 'green',
|
|
73
73
|
shape: 'dot',
|
|
74
|
-
text: JSON.stringify(response.uri)
|
|
74
|
+
text: JSON.stringify(response.uri),
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
let allResources = _.keyBy(
|
|
77
|
+
let allResources = _.keyBy(
|
|
78
|
+
response.data.resources,
|
|
79
|
+
node.format === 'name' ? 'name' : 'rid'
|
|
80
|
+
);
|
|
78
81
|
if (node.detailedOutput === true) {
|
|
79
82
|
node.send([
|
|
80
83
|
{ topic: uri, payload: allResources },
|
|
81
|
-
{ topic: uri, payload: response.
|
|
82
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
84
|
+
{ topic: uri, payload: response.data },
|
|
85
|
+
{ topic: uri, payload: { error: false, response: response } },
|
|
83
86
|
]);
|
|
84
87
|
} else {
|
|
85
88
|
node.send({ topic: uri, payload: allResources });
|
|
@@ -29,22 +29,35 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
29
29
|
<label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
|
|
30
30
|
<input type="text" id="node-input-connection">
|
|
31
31
|
</div>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
|
|
33
|
+
<hr>
|
|
34
|
+
|
|
35
|
+
<div id="instance-row">
|
|
36
|
+
<div class="form-row" id="input-row">
|
|
37
|
+
<label for="node-input-resource"><i class="fa fa-tasks"></i> URI</label>
|
|
38
|
+
<input type="text" id="node-input-resource" style="width:61%;" placeholder="HID/SID/PID/INS/RID">
|
|
39
|
+
</div>
|
|
35
40
|
</div>
|
|
41
|
+
|
|
42
|
+
<div id="mobsearch"></div>
|
|
43
|
+
|
|
44
|
+
|
|
36
45
|
<div class="form-row">
|
|
37
46
|
<label> </label>
|
|
38
47
|
<input type="checkbox" id="node-input-detailedOutput" style="display: inline-block; width: auto; vertical-align: top;">
|
|
39
48
|
<label for="node-input-detailedOutput" style="width: 70%;"> Use detailed outputs</label>
|
|
49
|
+
<input type="hidden" id="node-input-outputs"/>
|
|
40
50
|
</div>
|
|
41
51
|
<hr>
|
|
42
52
|
<div class="form-row">
|
|
43
53
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
44
54
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
45
55
|
</div>
|
|
56
|
+
|
|
46
57
|
</script>
|
|
47
58
|
|
|
59
|
+
<script src="common/mobsearch.js"></script>
|
|
60
|
+
|
|
48
61
|
<script type="text/javascript">
|
|
49
62
|
RED.nodes.registerType('mobius get resource',{
|
|
50
63
|
category: 'mobius',
|
|
@@ -62,10 +75,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
62
75
|
if(parts.length < 5 && parts[parts.length - 1] === '#') { return true; }
|
|
63
76
|
return false;
|
|
64
77
|
}},
|
|
65
|
-
connection: {type:"mobius connection", required:true}
|
|
78
|
+
connection: {type:"mobius connection", required: true},
|
|
79
|
+
outputs: {value:2},
|
|
66
80
|
},
|
|
67
81
|
inputs:1,
|
|
68
|
-
outputs:2,
|
|
82
|
+
outputs: 2,
|
|
69
83
|
outputLabels: function (index) {
|
|
70
84
|
if(index === 0) return ("Resource's PV");
|
|
71
85
|
if(index === 1) return ("Resource's PV and name");
|
|
@@ -85,13 +99,28 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
85
99
|
labelStyle: function() {
|
|
86
100
|
return this.name ? "node_label_italic":"";
|
|
87
101
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
oneditprepare: function () {
|
|
103
|
+
$("#node-input-outputs").val(this.detailedOutput ? 4 : 2);
|
|
104
|
+
$("#node-input-detailedOutput").change(function() {
|
|
105
|
+
$("#node-input-outputs").val(this.checked ? 4 : 2);
|
|
106
|
+
});
|
|
107
|
+
var node = this;
|
|
108
|
+
let mobiusSrvc = $("#node-input-connection").val();
|
|
109
|
+
opts = {
|
|
110
|
+
htmlElementId: 'mobsearch',
|
|
111
|
+
uriFieldName: 'node-input-resource',
|
|
112
|
+
inputRowId: 'input-row',
|
|
113
|
+
};
|
|
114
|
+
initMobsearch.toRid(mobiusSrvc, opts);
|
|
115
|
+
|
|
116
|
+
},
|
|
117
|
+
// oneditsave: function() {
|
|
118
|
+
// if($("#node-input-detailedOutput").prop('checked')) {
|
|
119
|
+
// this.outputs = 4;
|
|
120
|
+
// } else {
|
|
121
|
+
// this.outputs = 2;
|
|
122
|
+
// }
|
|
123
|
+
// }
|
|
95
124
|
});
|
|
96
125
|
</script>
|
|
97
126
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
30
|
module.exports = function (RED) {
|
|
31
|
-
function MobiusGetResourceNode
|
|
31
|
+
function MobiusGetResourceNode(n) {
|
|
32
32
|
RED.nodes.createNode(this, n);
|
|
33
33
|
this.detailedOutput = n.detailedOutput;
|
|
34
34
|
this.resource = n.resource;
|
|
@@ -39,7 +39,7 @@ module.exports = function (RED) {
|
|
|
39
39
|
node.status({
|
|
40
40
|
fill: 'red',
|
|
41
41
|
shape: 'ring',
|
|
42
|
-
text: 'Disconnected'
|
|
42
|
+
text: 'Disconnected',
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
node.on('input', function (msg) {
|
|
@@ -51,36 +51,41 @@ module.exports = function (RED) {
|
|
|
51
51
|
node.status({
|
|
52
52
|
fill: 'green',
|
|
53
53
|
shape: 'ring',
|
|
54
|
-
text: 'Busy'
|
|
54
|
+
text: 'Busy',
|
|
55
55
|
});
|
|
56
56
|
node.serviceConn.readResource(uri, (err, response) => {
|
|
57
57
|
if (err) {
|
|
58
58
|
node.status({
|
|
59
59
|
fill: 'yellow',
|
|
60
60
|
shape: 'dot',
|
|
61
|
-
text: 'Error: ' + JSON.stringify(err.code)
|
|
61
|
+
text: 'Error: ' + JSON.stringify(err.code),
|
|
62
62
|
});
|
|
63
63
|
node.error('Mobius error reading resource ' + JSON.stringify(err));
|
|
64
64
|
if (node.detailedOutput === true) {
|
|
65
|
-
node.send([
|
|
65
|
+
node.send([
|
|
66
|
+
null,
|
|
67
|
+
null,
|
|
68
|
+
null,
|
|
69
|
+
{ topic: uri, payload: { error: true, response: err } },
|
|
70
|
+
]);
|
|
66
71
|
}
|
|
67
72
|
} else {
|
|
68
73
|
node.status({
|
|
69
74
|
fill: 'green',
|
|
70
75
|
shape: 'dot',
|
|
71
|
-
text: JSON.stringify(response.
|
|
76
|
+
text: JSON.stringify(response.data.pv),
|
|
72
77
|
});
|
|
73
78
|
if (node.detailedOutput === true) {
|
|
74
79
|
node.send([
|
|
75
|
-
{ topic: uri, payload: response.
|
|
76
|
-
{ topic: uri, payload: { pv: response.
|
|
77
|
-
{ topic: uri, payload: response.
|
|
78
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
80
|
+
{ topic: uri, payload: response.data.pv },
|
|
81
|
+
{ topic: uri, payload: { pv: response.data.pv, name: response.data.name } },
|
|
82
|
+
{ topic: uri, payload: response.data },
|
|
83
|
+
{ topic: uri, payload: { error: false, response: response } },
|
|
79
84
|
]);
|
|
80
85
|
} else {
|
|
81
86
|
node.send([
|
|
82
|
-
{ topic: uri, payload: response.
|
|
83
|
-
{ topic: uri, payload: { pv: response.
|
|
87
|
+
{ topic: uri, payload: response.data.pv },
|
|
88
|
+
{ topic: uri, payload: { pv: response.data.pv, name: response.data.name } },
|
|
84
89
|
]);
|
|
85
90
|
}
|
|
86
91
|
}
|
|
@@ -29,10 +29,18 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
29
29
|
<label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
|
|
30
30
|
<input type="text" id="node-input-connection">
|
|
31
31
|
</div>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
|
|
33
|
+
<hr>
|
|
34
|
+
|
|
35
|
+
<div id="instance-row">
|
|
36
|
+
<div class="form-row" id="input-row">
|
|
37
|
+
<label for="node-input-object"><i class="fa fa-tasks"></i> URI</label>
|
|
38
|
+
<input type="text" id="node-input-object" style="width:61%;" placeholder="Object URI (hid/sid/pid/ins)">
|
|
39
|
+
</div>
|
|
35
40
|
</div>
|
|
41
|
+
|
|
42
|
+
<div id="mobsearch"></div>
|
|
43
|
+
|
|
36
44
|
<div class="form-row">
|
|
37
45
|
<label for="node-input-include"><i class="fa fa-bars"></i> Include</label>
|
|
38
46
|
<select type="text" id="node-input-include" style="display: inline-block; width: auto; vertical-align: center;">
|
|
@@ -40,6 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
40
48
|
<option value="changed">Changed Resources</option>
|
|
41
49
|
</select>
|
|
42
50
|
</div>
|
|
51
|
+
|
|
43
52
|
<div class="form-row">
|
|
44
53
|
<label for="node-input-format"><i class="fa fa-bars"></i> Format</label>
|
|
45
54
|
<select type="text" id="node-input-format" style="display: inline-block; width: auto; vertical-align: center;">
|
|
@@ -47,10 +56,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
47
56
|
<option value="rid">By RID</option>
|
|
48
57
|
</select>
|
|
49
58
|
</div>
|
|
59
|
+
|
|
50
60
|
<div class="form-row">
|
|
51
61
|
<label> </label>
|
|
52
62
|
<input type="checkbox" id="node-input-detailedOutput" style="display: inline-block; width: auto; vertical-align: top;">
|
|
53
63
|
<label for="node-input-detailedOutput" style="width: 70%;"> Use detailed outputs</label>
|
|
64
|
+
<input type="hidden" id="node-input-outputs"/>
|
|
54
65
|
</div>
|
|
55
66
|
<hr>
|
|
56
67
|
<div class="form-row">
|
|
@@ -59,6 +70,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
59
70
|
</div>
|
|
60
71
|
</script>
|
|
61
72
|
|
|
73
|
+
<script src="common/mobsearch.js"></script>
|
|
74
|
+
|
|
62
75
|
<script type="text/javascript">
|
|
63
76
|
RED.nodes.registerType('mobius object cov', {
|
|
64
77
|
category: 'mobius',
|
|
@@ -77,7 +90,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
77
90
|
if(parts.length < 4 && parts[parts.length - 1] === '#') { return true; }
|
|
78
91
|
return false;
|
|
79
92
|
}},
|
|
80
|
-
connection: {type:"mobius connection", required:true}
|
|
93
|
+
connection: {type:"mobius connection", required:true},
|
|
94
|
+
outputs: {value:1},
|
|
81
95
|
},
|
|
82
96
|
color:"#8abff5",
|
|
83
97
|
inputs:0,
|
|
@@ -100,13 +114,28 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
100
114
|
labelStyle: function() {
|
|
101
115
|
return this.name ? "node_label_italic":"";
|
|
102
116
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
117
|
+
oneditprepare: function () {
|
|
118
|
+
$("#node-input-outputs").val(this.detailedOutput ? 3 : 1);
|
|
119
|
+
$("#node-input-detailedOutput").change(function() {
|
|
120
|
+
$("#node-input-outputs").val(this.checked ? 3 : 1);
|
|
121
|
+
});
|
|
122
|
+
var node = this;
|
|
123
|
+
let mobiusSrvc = $("#node-input-connection").val();
|
|
124
|
+
|
|
125
|
+
opts = {
|
|
126
|
+
htmlElementId: 'mobsearch',
|
|
127
|
+
uriFieldName: 'node-input-object',
|
|
128
|
+
inputRowId: 'input-row',
|
|
129
|
+
};
|
|
130
|
+
initMobsearch.toIns(mobiusSrvc, opts);
|
|
131
|
+
},
|
|
132
|
+
// oneditsave: function() {
|
|
133
|
+
// if($("#node-input-detailedOutput").prop('checked')) {
|
|
134
|
+
// this.outputs = 3;
|
|
135
|
+
// } else {
|
|
136
|
+
// this.outputs = 1;
|
|
137
|
+
// }
|
|
138
|
+
// }
|
|
110
139
|
});
|
|
111
140
|
</script>
|
|
112
141
|
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
var _ = require('lodash');
|
|
30
30
|
|
|
31
31
|
module.exports = function (RED) {
|
|
32
|
-
function MobiusObjectCovNode
|
|
32
|
+
function MobiusObjectCovNode(n) {
|
|
33
33
|
RED.nodes.createNode(this, n);
|
|
34
34
|
this.detailedOutput = n.detailedOutput;
|
|
35
35
|
this.object = n.object;
|
|
@@ -42,26 +42,29 @@ module.exports = function (RED) {
|
|
|
42
42
|
node.status({
|
|
43
43
|
fill: 'red',
|
|
44
44
|
shape: 'ring',
|
|
45
|
-
text: 'Disconnected'
|
|
45
|
+
text: 'Disconnected',
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
node.serviceConn.subscribeToObjectCOV(node.object, this.id, (response) => {
|
|
49
49
|
node.status({
|
|
50
50
|
fill: 'green',
|
|
51
51
|
shape: 'dot',
|
|
52
|
-
text: JSON.stringify(response.uri)
|
|
52
|
+
text: JSON.stringify(response.uri),
|
|
53
53
|
});
|
|
54
|
-
let allResources = _.keyBy(
|
|
54
|
+
let allResources = _.keyBy(
|
|
55
|
+
response.value.resources,
|
|
56
|
+
node.format === 'name' ? 'name' : 'rid'
|
|
57
|
+
);
|
|
55
58
|
if (node.include === 'changed') {
|
|
56
59
|
allResources = _.pickBy(allResources, (res) => {
|
|
57
|
-
return response.changed.includes(res.rid);
|
|
60
|
+
return response.additonalInformation.changed.includes(res.rid);
|
|
58
61
|
});
|
|
59
62
|
}
|
|
60
63
|
if (node.detailedOutput === true) {
|
|
61
64
|
node.send([
|
|
62
65
|
{ topic: response.uri, payload: allResources },
|
|
63
66
|
{ topic: response.uri, payload: response.value },
|
|
64
|
-
{ topic: response.uri, payload: { response: response } }
|
|
67
|
+
{ topic: response.uri, payload: { response: response } },
|
|
65
68
|
]);
|
|
66
69
|
} else {
|
|
67
70
|
node.send({ topic: response.uri, payload: allResources });
|
|
@@ -29,14 +29,22 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
29
29
|
<label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
|
|
30
30
|
<input type="text" id="node-input-connection">
|
|
31
31
|
</div>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
|
|
33
|
+
<hr>
|
|
34
|
+
|
|
35
|
+
<div id="instance-row">
|
|
36
|
+
<div class="form-row" id="input-row">
|
|
37
|
+
<label for="node-input-resource"><i class="fa fa-tasks"></i> URI</label>
|
|
38
|
+
<input type="text" id="node-input-resource" placeholder="Resource URI (hid/sid/pid/ins/rid)">
|
|
39
|
+
</div>
|
|
35
40
|
</div>
|
|
41
|
+
<div id="mobsearch"></div>
|
|
42
|
+
|
|
36
43
|
<div class="form-row">
|
|
37
44
|
<label> </label>
|
|
38
45
|
<input type="checkbox" id="node-input-detailedOutput" style="display: inline-block; width: auto; vertical-align: top;">
|
|
39
46
|
<label for="node-input-detailedOutput" style="width: 70%;"> Use detailed outputs</label>
|
|
47
|
+
<input type="hidden" id="node-input-outputs"/>
|
|
40
48
|
</div>
|
|
41
49
|
<hr>
|
|
42
50
|
<div class="form-row">
|
|
@@ -45,6 +53,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
45
53
|
</div>
|
|
46
54
|
</script>
|
|
47
55
|
|
|
56
|
+
<script src="common/mobsearch.js"></script>
|
|
57
|
+
|
|
48
58
|
<script type="text/javascript">
|
|
49
59
|
RED.nodes.registerType('mobius resource cov', {
|
|
50
60
|
category: 'mobius',
|
|
@@ -60,7 +70,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
60
70
|
if(parts.length < 5 && parts[parts.length - 1] === '#') { return true; }
|
|
61
71
|
return false;
|
|
62
72
|
}},
|
|
63
|
-
connection: {type:"mobius connection", required:true}
|
|
73
|
+
connection: {type:"mobius connection", required:true},
|
|
74
|
+
outputs: {value:2},
|
|
64
75
|
},
|
|
65
76
|
color:"#8abff5",
|
|
66
77
|
inputs:0,
|
|
@@ -84,13 +95,28 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
84
95
|
labelStyle: function() {
|
|
85
96
|
return this.name ? "node_label_italic":"";
|
|
86
97
|
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
oneditprepare: function () {
|
|
99
|
+
$("#node-input-outputs").val(this.detailedOutput ? 4 : 2);
|
|
100
|
+
$("#node-input-detailedOutput").change(function() {
|
|
101
|
+
$("#node-input-outputs").val(this.checked ? 4 : 2);
|
|
102
|
+
});
|
|
103
|
+
var node = this;
|
|
104
|
+
let mobiusSrvc = $("#node-input-connection").val();
|
|
105
|
+
|
|
106
|
+
opts = {
|
|
107
|
+
htmlElementId: 'mobsearch',
|
|
108
|
+
uriFieldName: 'node-input-resource',
|
|
109
|
+
inputRowId: 'input-row',
|
|
110
|
+
};
|
|
111
|
+
initMobsearch.toRid(mobiusSrvc, opts);
|
|
112
|
+
},
|
|
113
|
+
// oneditsave: function() {
|
|
114
|
+
// if($("#node-input-detailedOutput").prop('checked')) {
|
|
115
|
+
// this.outputs = 4;
|
|
116
|
+
// } else {
|
|
117
|
+
// this.outputs = 2;
|
|
118
|
+
// }
|
|
119
|
+
// }
|
|
94
120
|
});
|
|
95
121
|
</script>
|
|
96
122
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
30
|
module.exports = function (RED) {
|
|
31
|
-
function MobiusResourceCovNode
|
|
31
|
+
function MobiusResourceCovNode(n) {
|
|
32
32
|
RED.nodes.createNode(this, n);
|
|
33
33
|
this.detailedOutput = n.detailedOutput;
|
|
34
34
|
this.resource = n.resource;
|
|
@@ -39,26 +39,26 @@ module.exports = function (RED) {
|
|
|
39
39
|
node.status({
|
|
40
40
|
fill: 'red',
|
|
41
41
|
shape: 'ring',
|
|
42
|
-
text: 'Disconnected'
|
|
42
|
+
text: 'Disconnected',
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
node.serviceConn.subscribeToCOV(node.resource, this.id, (response) => {
|
|
46
46
|
node.status({
|
|
47
47
|
fill: 'green',
|
|
48
48
|
shape: 'dot',
|
|
49
|
-
text: JSON.stringify(response.value.pv)
|
|
49
|
+
text: JSON.stringify(response.value.pv),
|
|
50
50
|
});
|
|
51
51
|
if (node.detailedOutput === true) {
|
|
52
52
|
node.send([
|
|
53
53
|
{ topic: response.uri, payload: response.value.pv },
|
|
54
54
|
{ topic: response.uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
55
55
|
{ topic: response.uri, payload: response.value },
|
|
56
|
-
{ topic: response.uri, payload: { response: response } }
|
|
56
|
+
{ topic: response.uri, payload: { response: response } },
|
|
57
57
|
]);
|
|
58
58
|
} else {
|
|
59
59
|
node.send([
|
|
60
60
|
{ topic: response.uri, payload: response.value.pv },
|
|
61
|
-
{ topic: response.uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
61
|
+
{ topic: response.uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
62
62
|
]);
|
|
63
63
|
}
|
|
64
64
|
});
|
|
@@ -29,14 +29,23 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
29
29
|
<label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
|
|
30
30
|
<input type="text" id="node-input-connection">
|
|
31
31
|
</div>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
|
|
33
|
+
<hr>
|
|
34
|
+
|
|
35
|
+
<div id="instance-row">
|
|
36
|
+
<div class="form-row" id="input-row">
|
|
37
|
+
<label for="node-input-mobject"><i class="fa fa-tasks"></i> URI</label>
|
|
38
|
+
<input type="text" style="width:61%;" id="node-input-mobject" placeholder="Object URI (hid/sid/pid/ins)">
|
|
39
|
+
|
|
40
|
+
</div>
|
|
35
41
|
</div>
|
|
42
|
+
<div id="mobsearch"></div>
|
|
43
|
+
|
|
36
44
|
<div class="form-row">
|
|
37
45
|
<label> </label>
|
|
38
46
|
<input type="checkbox" id="node-input-detailedOutput" style="display: inline-block; width: auto; vertical-align: top;">
|
|
39
47
|
<label for="node-input-detailedOutput" style="width: 70%;"> Use detailed outputs</label>
|
|
48
|
+
<input type="hidden" id="node-input-outputs"/>
|
|
40
49
|
</div>
|
|
41
50
|
<hr>
|
|
42
51
|
<div class="form-row">
|
|
@@ -45,6 +54,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
45
54
|
</div>
|
|
46
55
|
</script>
|
|
47
56
|
|
|
57
|
+
<script src="common/mobsearch.js"></script>
|
|
58
|
+
|
|
48
59
|
<script type="text/javascript">
|
|
49
60
|
RED.nodes.registerType('mobius set multi-resource',{
|
|
50
61
|
category: 'mobius',
|
|
@@ -60,11 +71,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
60
71
|
if(parts.length === 4) { return true; }
|
|
61
72
|
return false;
|
|
62
73
|
}},
|
|
63
|
-
connection: {type:"mobius connection", required:true}
|
|
74
|
+
connection: {type:"mobius connection", required:true},
|
|
75
|
+
outputs: {value:2},
|
|
64
76
|
},
|
|
65
77
|
color:"#8abff5",
|
|
66
78
|
inputs:1,
|
|
67
|
-
outputs:
|
|
79
|
+
outputs:2,
|
|
68
80
|
outputLabels: function (index) {
|
|
69
81
|
if(index === 0) return ("MOBiUS object");
|
|
70
82
|
if(index === 1) return ("Full MOBiUS response");
|
|
@@ -82,13 +94,28 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
82
94
|
labelStyle: function() {
|
|
83
95
|
return this.name ? "node_label_italic":"";
|
|
84
96
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
oneditprepare: function () {
|
|
98
|
+
$("#node-input-outputs").val(this.detailedOutput ? 4 : 2);
|
|
99
|
+
$("#node-input-detailedOutput").change(function() {
|
|
100
|
+
$("#node-input-outputs").val(this.checked ? 4 : 2);
|
|
101
|
+
});
|
|
102
|
+
var node = this;
|
|
103
|
+
let mobiusSrvc = $("#node-input-connection").val();
|
|
104
|
+
|
|
105
|
+
opts = {
|
|
106
|
+
htmlElementId: 'mobsearch',
|
|
107
|
+
uriFieldName: 'node-input-mobject',
|
|
108
|
+
inputRowId: 'input-row',
|
|
109
|
+
};
|
|
110
|
+
initMobsearch.toIns(mobiusSrvc, opts);
|
|
111
|
+
},
|
|
112
|
+
// oneditsave: function() {
|
|
113
|
+
// if($("#node-input-detailedOutput").prop('checked')) {
|
|
114
|
+
// this.outputs = 2;
|
|
115
|
+
// } else {
|
|
116
|
+
// this.outputs = 1;
|
|
117
|
+
// }
|
|
118
|
+
// }
|
|
92
119
|
});
|
|
93
120
|
</script>
|
|
94
121
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
30
|
module.exports = function (RED) {
|
|
31
|
-
function MobiusSetMultiResourceNode
|
|
31
|
+
function MobiusSetMultiResourceNode(n) {
|
|
32
32
|
RED.nodes.createNode(this, n);
|
|
33
33
|
this.detailedOutput = n.detailedOutput;
|
|
34
34
|
this.mobject = n.mobject;
|
|
@@ -39,7 +39,7 @@ module.exports = function (RED) {
|
|
|
39
39
|
node.status({
|
|
40
40
|
fill: 'red',
|
|
41
41
|
shape: 'ring',
|
|
42
|
-
text: 'Disconnected'
|
|
42
|
+
text: 'Disconnected',
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
node.on('input', function (msg) {
|
|
@@ -55,7 +55,7 @@ module.exports = function (RED) {
|
|
|
55
55
|
node.status({
|
|
56
56
|
fill: 'green',
|
|
57
57
|
shape: 'ring',
|
|
58
|
-
text: 'Busy'
|
|
58
|
+
text: 'Busy',
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
node.serviceConn.multiWriteResourceValue(uri, value, (err, response) => {
|
|
@@ -63,27 +63,25 @@ module.exports = function (RED) {
|
|
|
63
63
|
node.status({
|
|
64
64
|
fill: 'yellow',
|
|
65
65
|
shape: 'dot',
|
|
66
|
-
text: 'Error: ' + JSON.stringify(err.code)
|
|
66
|
+
text: 'Error: ' + JSON.stringify(err.code),
|
|
67
67
|
});
|
|
68
68
|
node.error('Mobius error writing multiple resources ' + JSON.stringify(err));
|
|
69
69
|
if (node.detailedOutput === true) {
|
|
70
|
-
node.send([null, {topic: uri, payload: { error: true, response: err }}]);
|
|
70
|
+
node.send([null, { topic: uri, payload: { error: true, response: err } }]);
|
|
71
71
|
}
|
|
72
72
|
} else {
|
|
73
73
|
node.status({
|
|
74
74
|
fill: 'green',
|
|
75
75
|
shape: 'dot',
|
|
76
|
-
text: 'OK'
|
|
76
|
+
text: 'OK',
|
|
77
77
|
});
|
|
78
78
|
if (node.detailedOutput === true) {
|
|
79
79
|
node.send([
|
|
80
|
-
{ topic: uri, payload: response.
|
|
81
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
80
|
+
{ topic: uri, payload: response.data },
|
|
81
|
+
{ topic: uri, payload: { error: false, response: response } },
|
|
82
82
|
]);
|
|
83
83
|
} else {
|
|
84
|
-
node.send([
|
|
85
|
-
{ topic: uri, payload: response.value }
|
|
86
|
-
]);
|
|
84
|
+
node.send([{ topic: uri, payload: response.data }]);
|
|
87
85
|
}
|
|
88
86
|
}
|
|
89
87
|
});
|