node-red-contrib-mobius-flow-base 2.5.86-beta.74 → 2.5.86-beta.78
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/dist/nodes/mobius-clear-resource.html +3 -23
- package/dist/nodes/mobius-clear-resource.js +8 -21
- package/dist/nodes/mobius-connection.js +44 -91
- package/dist/nodes/mobius-discover-object-list.html +3 -36
- package/dist/nodes/mobius-discover-object-list.js +53 -71
- package/dist/nodes/mobius-flow-inject.html +2 -34
- package/dist/nodes/mobius-flow-inject.js +9 -23
- package/dist/nodes/mobius-get-multi-object.html +7 -40
- package/dist/nodes/mobius-get-multi-object.js +9 -17
- package/dist/nodes/mobius-get-multi-resource.html +7 -38
- package/dist/nodes/mobius-get-multi-resource.js +11 -19
- package/dist/nodes/mobius-get-object.html +5 -26
- package/dist/nodes/mobius-get-object.js +10 -21
- package/dist/nodes/mobius-get-resource.html +3 -25
- package/dist/nodes/mobius-get-resource.js +8 -21
- package/dist/nodes/mobius-object-cov.html +5 -26
- package/dist/nodes/mobius-object-cov.js +4 -10
- package/dist/nodes/mobius-resource-cov.html +4 -25
- package/dist/nodes/mobius-resource-cov.js +5 -13
- package/dist/nodes/mobius-set-multi-resource.html +4 -25
- package/dist/nodes/mobius-set-multi-resource.js +12 -18
- package/dist/nodes/mobius-set-resource.html +3 -24
- package/dist/nodes/mobius-set-resource.js +13 -31
- package/dist/nodes/node-red-ui-discover-devices.js +6 -136
- package/package.json +2 -2
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
30
|
module.exports = function (RED) {
|
|
31
|
-
function MobiusGetResourceNode(n) {
|
|
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,41 +51,36 @@ 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([
|
|
66
|
-
null,
|
|
67
|
-
null,
|
|
68
|
-
null,
|
|
69
|
-
{ topic: uri, payload: { error: true, response: err } },
|
|
70
|
-
]);
|
|
65
|
+
node.send([null, null, null, {topic: uri, payload: {error: true, response: err}}]);
|
|
71
66
|
}
|
|
72
67
|
} else {
|
|
73
68
|
node.status({
|
|
74
69
|
fill: 'green',
|
|
75
70
|
shape: 'dot',
|
|
76
|
-
text: JSON.stringify(response.value.pv)
|
|
71
|
+
text: JSON.stringify(response.value.pv)
|
|
77
72
|
});
|
|
78
73
|
if (node.detailedOutput === true) {
|
|
79
74
|
node.send([
|
|
80
75
|
{ topic: uri, payload: response.value.pv },
|
|
81
76
|
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
82
77
|
{ topic: uri, payload: response.value },
|
|
83
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
78
|
+
{ topic: uri, payload: { error: false, response: response } }
|
|
84
79
|
]);
|
|
85
80
|
} else {
|
|
86
81
|
node.send([
|
|
87
82
|
{ topic: uri, payload: response.value.pv },
|
|
88
|
-
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
83
|
+
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
89
84
|
]);
|
|
90
85
|
}
|
|
91
86
|
}
|
|
@@ -103,12 +98,4 @@ module.exports = function (RED) {
|
|
|
103
98
|
}
|
|
104
99
|
|
|
105
100
|
RED.nodes.registerType('mobius get resource', MobiusGetResourceNode);
|
|
106
|
-
|
|
107
|
-
RED.httpAdmin.get('/common/*', function (req, res) {
|
|
108
|
-
var options = {
|
|
109
|
-
root: __dirname + '/common/',
|
|
110
|
-
dotfiles: 'deny',
|
|
111
|
-
};
|
|
112
|
-
res.sendFile(req.params[0], options);
|
|
113
|
-
});
|
|
114
101
|
};
|
|
@@ -29,17 +29,10 @@ 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
|
-
|
|
35
|
-
<div id="instance-row">
|
|
36
|
-
<div class="form-row" id="input-row">
|
|
37
|
-
<label for="node-input-instance"><i class="fa fa-tasks"></i> URI</label>
|
|
38
|
-
<input type="text" id="node-input-instance" style="width:61%;" placeholder="HID/SID/PID/INS (optional name)">
|
|
39
|
-
</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)">
|
|
40
35
|
</div>
|
|
41
|
-
<div id="mobsearch"></div>
|
|
42
|
-
|
|
43
36
|
<div class="form-row">
|
|
44
37
|
<label for="node-input-include"><i class="fa fa-bars"></i> Include</label>
|
|
45
38
|
<select type="text" id="node-input-include" style="display: inline-block; width: auto; vertical-align: center;">
|
|
@@ -66,8 +59,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
66
59
|
</div>
|
|
67
60
|
</script>
|
|
68
61
|
|
|
69
|
-
<script src="common/mobsearch.js"></script>
|
|
70
|
-
|
|
71
62
|
<script type="text/javascript">
|
|
72
63
|
RED.nodes.registerType('mobius object cov', {
|
|
73
64
|
category: 'mobius',
|
|
@@ -76,7 +67,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
76
67
|
detailedOutput: {value:false},
|
|
77
68
|
format: {value: "name", required: true},
|
|
78
69
|
include: {value: "changed", required: true},
|
|
79
|
-
|
|
70
|
+
object: {value:"", validate:function(v) {
|
|
80
71
|
if(v === '') { return true; }
|
|
81
72
|
let parts = v.split('/');
|
|
82
73
|
for(let lp = 0; lp < parts.length; lp++) {
|
|
@@ -103,24 +94,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
103
94
|
if(this.name) {
|
|
104
95
|
return this.name;
|
|
105
96
|
} else {
|
|
106
|
-
return this.
|
|
97
|
+
return this.object ? `ObjCOV - ${this.object}` : "object cov";
|
|
107
98
|
}
|
|
108
99
|
},
|
|
109
100
|
labelStyle: function() {
|
|
110
101
|
return this.name ? "node_label_italic":"";
|
|
111
102
|
},
|
|
112
|
-
oneditprepare: function () {
|
|
113
|
-
|
|
114
|
-
var node = this;
|
|
115
|
-
let mobiusSrvc = $("#node-input-connection").val();
|
|
116
|
-
|
|
117
|
-
opts = {
|
|
118
|
-
htmlElementId: 'mobsearch',
|
|
119
|
-
uriFieldName: 'node-input-instance',
|
|
120
|
-
inputRowId: 'input-row',
|
|
121
|
-
};
|
|
122
|
-
initMobsearch.toIns(mobiusSrvc, opts);
|
|
123
|
-
},
|
|
124
103
|
oneditsave: function() {
|
|
125
104
|
if($("#node-input-detailedOutput").prop('checked')) {
|
|
126
105
|
this.outputs = 3;
|
|
@@ -32,7 +32,7 @@ module.exports = function (RED) {
|
|
|
32
32
|
function MobiusObjectCovNode(n) {
|
|
33
33
|
RED.nodes.createNode(this, n);
|
|
34
34
|
this.detailedOutput = n.detailedOutput;
|
|
35
|
-
this.
|
|
35
|
+
this.object = n.object;
|
|
36
36
|
this.format = n.format;
|
|
37
37
|
this.include = n.include;
|
|
38
38
|
this.serviceConn = RED.nodes.getNode(n.connection);
|
|
@@ -45,7 +45,7 @@ module.exports = function (RED) {
|
|
|
45
45
|
text: 'Disconnected',
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
node.serviceConn.subscribeToObjectCOV(node.
|
|
48
|
+
node.serviceConn.subscribeToObjectCOV(node.object, this.id, (response) => {
|
|
49
49
|
node.status({
|
|
50
50
|
fill: 'green',
|
|
51
51
|
shape: 'dot',
|
|
@@ -68,10 +68,12 @@ module.exports = function (RED) {
|
|
|
68
68
|
]);
|
|
69
69
|
} else {
|
|
70
70
|
node.send({ topic: response.uri, payload: allResources });
|
|
71
|
+
console.log(node.lastActiveTime);
|
|
71
72
|
}
|
|
72
73
|
});
|
|
73
74
|
|
|
74
75
|
node.serviceConn.register(node);
|
|
76
|
+
console.log(node.statusCheckLoop);
|
|
75
77
|
|
|
76
78
|
node.on('close', function (done) {
|
|
77
79
|
node.serviceConn.deregister(node, done);
|
|
@@ -82,12 +84,4 @@ module.exports = function (RED) {
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
RED.nodes.registerType('mobius object cov', MobiusObjectCovNode);
|
|
85
|
-
|
|
86
|
-
RED.httpAdmin.get('/common/*', function (req, res) {
|
|
87
|
-
var options = {
|
|
88
|
-
root: __dirname + '/common/',
|
|
89
|
-
dotfiles: 'deny',
|
|
90
|
-
};
|
|
91
|
-
res.sendFile(req.params[0], options);
|
|
92
|
-
});
|
|
93
87
|
};
|
|
@@ -29,17 +29,10 @@ 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
|
-
|
|
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>
|
|
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)">
|
|
40
35
|
</div>
|
|
41
|
-
<div id="mobsearch"></div>
|
|
42
|
-
|
|
43
36
|
<div class="form-row">
|
|
44
37
|
<label> </label>
|
|
45
38
|
<input type="checkbox" id="node-input-detailedOutput" style="display: inline-block; width: auto; vertical-align: top;">
|
|
@@ -52,16 +45,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
52
45
|
</div>
|
|
53
46
|
</script>
|
|
54
47
|
|
|
55
|
-
<script src="common/mobsearch.js"></script>
|
|
56
|
-
|
|
57
48
|
<script type="text/javascript">
|
|
58
49
|
RED.nodes.registerType('mobius resource cov', {
|
|
59
50
|
category: 'mobius',
|
|
60
51
|
defaults: {
|
|
61
52
|
name: {value:""},
|
|
62
53
|
detailedOutput: {value:false},
|
|
63
|
-
resource: {value:"", validate:function(v) {
|
|
64
|
-
if(v === '') { return true; }
|
|
54
|
+
resource: {value:"", required:true, validate:function(v) {
|
|
65
55
|
let parts = v.split('/');
|
|
66
56
|
for(let lp = 0; lp < parts.length; lp++) {
|
|
67
57
|
if(parts[lp] === null || parts[lp] === '') { return false;}
|
|
@@ -94,17 +84,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
94
84
|
labelStyle: function() {
|
|
95
85
|
return this.name ? "node_label_italic":"";
|
|
96
86
|
},
|
|
97
|
-
oneditprepare: function () {
|
|
98
|
-
var node = this;
|
|
99
|
-
let mobiusSrvc = $("#node-input-connection").val();
|
|
100
|
-
|
|
101
|
-
opts = {
|
|
102
|
-
htmlElementId: 'mobsearch',
|
|
103
|
-
uriFieldName: 'node-input-resource',
|
|
104
|
-
inputRowId: 'input-row',
|
|
105
|
-
};
|
|
106
|
-
initMobsearch.toRid(mobiusSrvc, opts);
|
|
107
|
-
},
|
|
108
87
|
oneditsave: function() {
|
|
109
88
|
if($("#node-input-detailedOutput").prop('checked')) {
|
|
110
89
|
this.outputs = 4;
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
30
|
module.exports = function (RED) {
|
|
31
|
-
function MobiusResourceCovNode(n) {
|
|
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
|
});
|
|
@@ -74,12 +74,4 @@ module.exports = function (RED) {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
RED.nodes.registerType('mobius resource cov', MobiusResourceCovNode);
|
|
77
|
-
|
|
78
|
-
RED.httpAdmin.get('/common/*', function (req, res) {
|
|
79
|
-
var options = {
|
|
80
|
-
root: __dirname + '/common/',
|
|
81
|
-
dotfiles: 'deny',
|
|
82
|
-
};
|
|
83
|
-
res.sendFile(req.params[0], options);
|
|
84
|
-
});
|
|
85
77
|
};
|
|
@@ -29,18 +29,10 @@ 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
|
-
|
|
35
|
-
<div id="instance-row">
|
|
36
|
-
<div class="form-row" id="input-row">
|
|
37
|
-
<label for="node-input-instance"><i class="fa fa-tasks"></i> URI</label>
|
|
38
|
-
<input type="text" id="node-input-instance" style="width:61%;" placeholder="HID/SID/PID/INS (optional name)">
|
|
39
|
-
<a id="node-lookup-instance" class="searchbutton" style="vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>
|
|
40
|
-
</div>
|
|
32
|
+
<div class="form-row">
|
|
33
|
+
<label for="node-input-mobject"><i class="fa fa-tasks"></i> URI</label>
|
|
34
|
+
<input type="text" id="node-input-mobject" placeholder="Object URI (hid/sid/pid/ins)">
|
|
41
35
|
</div>
|
|
42
|
-
<div id="mobsearch"></div>
|
|
43
|
-
|
|
44
36
|
<div class="form-row">
|
|
45
37
|
<label> </label>
|
|
46
38
|
<input type="checkbox" id="node-input-detailedOutput" style="display: inline-block; width: auto; vertical-align: top;">
|
|
@@ -53,15 +45,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
53
45
|
</div>
|
|
54
46
|
</script>
|
|
55
47
|
|
|
56
|
-
<script src="common/mobsearch.js"></script>
|
|
57
|
-
|
|
58
48
|
<script type="text/javascript">
|
|
59
49
|
RED.nodes.registerType('mobius set multi-resource',{
|
|
60
50
|
category: 'mobius',
|
|
61
51
|
defaults: {
|
|
62
52
|
name: {value:""},
|
|
63
53
|
detailedOutput: {value:false},
|
|
64
|
-
|
|
54
|
+
mobject: {value: "", validate:function(v) {
|
|
65
55
|
if(v === '') { return true; }
|
|
66
56
|
let parts = v.split('/');
|
|
67
57
|
for(let lp = 0; lp < parts.length; lp++) {
|
|
@@ -92,17 +82,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
92
82
|
labelStyle: function() {
|
|
93
83
|
return this.name ? "node_label_italic":"";
|
|
94
84
|
},
|
|
95
|
-
oneditprepare: function () {
|
|
96
|
-
var node = this;
|
|
97
|
-
let mobiusSrvc = $("#node-input-connection").val();
|
|
98
|
-
|
|
99
|
-
opts = {
|
|
100
|
-
htmlElementId: 'mobsearch',
|
|
101
|
-
uriFieldName: 'node-input-instance',
|
|
102
|
-
inputRowId: 'input-row',
|
|
103
|
-
};
|
|
104
|
-
initMobsearch.toIns(mobiusSrvc, opts);
|
|
105
|
-
},
|
|
106
85
|
oneditsave: function() {
|
|
107
86
|
if($("#node-input-detailedOutput").prop('checked')) {
|
|
108
87
|
this.outputs = 2;
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
30
|
module.exports = function (RED) {
|
|
31
|
-
function MobiusSetMultiResourceNode(n) {
|
|
31
|
+
function MobiusSetMultiResourceNode (n) {
|
|
32
32
|
RED.nodes.createNode(this, n);
|
|
33
33
|
this.detailedOutput = n.detailedOutput;
|
|
34
|
-
this.
|
|
34
|
+
this.mobject = n.mobject;
|
|
35
35
|
this.serviceConn = RED.nodes.getNode(n.connection);
|
|
36
36
|
var node = this;
|
|
37
37
|
|
|
@@ -39,11 +39,11 @@ 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) {
|
|
46
|
-
let uri = node.
|
|
46
|
+
let uri = node.mobject;
|
|
47
47
|
let value = null;
|
|
48
48
|
if (msg.hasOwnProperty('topic') && require('./validateURI')(msg.topic, 4)) {
|
|
49
49
|
uri = msg.topic;
|
|
@@ -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,25 +63,27 @@ 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, {
|
|
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
80
|
{ topic: uri, payload: response.value },
|
|
81
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
81
|
+
{ topic: uri, payload: { error: false, response: response } }
|
|
82
82
|
]);
|
|
83
83
|
} else {
|
|
84
|
-
node.send([
|
|
84
|
+
node.send([
|
|
85
|
+
{ topic: uri, payload: response.value }
|
|
86
|
+
]);
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
});
|
|
@@ -99,12 +101,4 @@ module.exports = function (RED) {
|
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
RED.nodes.registerType('mobius set multi-resource', MobiusSetMultiResourceNode);
|
|
102
|
-
|
|
103
|
-
RED.httpAdmin.get('/common/*', function (req, res) {
|
|
104
|
-
var options = {
|
|
105
|
-
root: __dirname + '/common/',
|
|
106
|
-
dotfiles: 'deny',
|
|
107
|
-
};
|
|
108
|
-
res.sendFile(req.params[0], options);
|
|
109
|
-
});
|
|
110
104
|
};
|
|
@@ -29,18 +29,10 @@ 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
|
-
|
|
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>
|
|
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)">
|
|
40
35
|
</div>
|
|
41
|
-
|
|
42
|
-
<div id="mobsearch"></div>
|
|
43
|
-
|
|
44
36
|
<div class="form-row">
|
|
45
37
|
<label for="node-input-priority"><i class="fa fa-exclamation-triangle"></i> Priority</label>
|
|
46
38
|
<input type="text" id="node-input-priority" placeholder="Priotity to write or clear">
|
|
@@ -57,8 +49,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
57
49
|
</div>
|
|
58
50
|
</script>
|
|
59
51
|
|
|
60
|
-
<script src="common/mobsearch.js"></script>
|
|
61
|
-
|
|
62
52
|
<script type="text/javascript">
|
|
63
53
|
RED.nodes.registerType('mobius set resource',{
|
|
64
54
|
category: 'mobius',
|
|
@@ -100,17 +90,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
100
90
|
labelStyle: function() {
|
|
101
91
|
return this.name ? "node_label_italic":"";
|
|
102
92
|
},
|
|
103
|
-
oneditprepare: function () {
|
|
104
|
-
var node = this;
|
|
105
|
-
let mobiusSrvc = $("#node-input-connection").val();
|
|
106
|
-
|
|
107
|
-
opts = {
|
|
108
|
-
htmlElementId: 'mobsearch',
|
|
109
|
-
uriFieldName: 'node-input-resource',
|
|
110
|
-
inputRowId: 'input-row',
|
|
111
|
-
};
|
|
112
|
-
initMobsearch.toRid(mobiusSrvc, opts);
|
|
113
|
-
},
|
|
114
93
|
oneditsave: function() {
|
|
115
94
|
if($("#node-input-detailedOutput").prop('checked')) {
|
|
116
95
|
this.outputs = 4;
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
30
|
module.exports = function (RED) {
|
|
31
|
-
function MobiusSetResourceNode(n) {
|
|
31
|
+
function MobiusSetResourceNode (n) {
|
|
32
32
|
RED.nodes.createNode(this, n);
|
|
33
33
|
this.detailedOutput = n.detailedOutput;
|
|
34
34
|
this.resource = n.resource;
|
|
@@ -40,7 +40,7 @@ module.exports = function (RED) {
|
|
|
40
40
|
node.status({
|
|
41
41
|
fill: 'red',
|
|
42
42
|
shape: 'ring',
|
|
43
|
-
text: 'Disconnected'
|
|
43
|
+
text: 'Disconnected'
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
node.on('input', function (msg) {
|
|
@@ -60,7 +60,7 @@ module.exports = function (RED) {
|
|
|
60
60
|
node.status({
|
|
61
61
|
fill: 'green',
|
|
62
62
|
shape: 'ring',
|
|
63
|
-
text: 'Busy'
|
|
63
|
+
text: 'Busy'
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
if (value === null) {
|
|
@@ -69,34 +69,29 @@ module.exports = function (RED) {
|
|
|
69
69
|
node.status({
|
|
70
70
|
fill: 'yellow',
|
|
71
71
|
shape: 'dot',
|
|
72
|
-
text: 'Error: ' + JSON.stringify(err.code)
|
|
72
|
+
text: 'Error: ' + JSON.stringify(err.code)
|
|
73
73
|
});
|
|
74
74
|
node.error('Mobius error clearing resource priority ' + JSON.stringify(err));
|
|
75
75
|
if (node.detailedOutput === true) {
|
|
76
|
-
node.send([
|
|
77
|
-
null,
|
|
78
|
-
null,
|
|
79
|
-
null,
|
|
80
|
-
{ topic: uri, payload: { error: true, response: err } },
|
|
81
|
-
]);
|
|
76
|
+
node.send([null, null, null, {topic: uri, payload: { error: true, response: err }}]);
|
|
82
77
|
}
|
|
83
78
|
} else {
|
|
84
79
|
node.status({
|
|
85
80
|
fill: 'green',
|
|
86
81
|
shape: 'dot',
|
|
87
|
-
text: JSON.stringify(response.value.pv)
|
|
82
|
+
text: JSON.stringify(response.value.pv)
|
|
88
83
|
});
|
|
89
84
|
if (node.detailedOutput === true) {
|
|
90
85
|
node.send([
|
|
91
86
|
{ topic: uri, payload: response.value.pv },
|
|
92
87
|
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
93
88
|
{ topic: uri, payload: response.value },
|
|
94
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
89
|
+
{ topic: uri, payload: { error: false, response: response } }
|
|
95
90
|
]);
|
|
96
91
|
} else {
|
|
97
92
|
node.send([
|
|
98
93
|
{ topic: uri, payload: response.value.pv },
|
|
99
|
-
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
94
|
+
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
100
95
|
]);
|
|
101
96
|
}
|
|
102
97
|
}
|
|
@@ -107,32 +102,27 @@ module.exports = function (RED) {
|
|
|
107
102
|
node.status({
|
|
108
103
|
fill: 'yellow',
|
|
109
104
|
shape: 'dot',
|
|
110
|
-
text: 'Error: ' + JSON.stringify(err.code)
|
|
105
|
+
text: 'Error: ' + JSON.stringify(err.code)
|
|
111
106
|
});
|
|
112
107
|
node.error('Mobius error writing resource ' + JSON.stringify(err));
|
|
113
|
-
node.send([
|
|
114
|
-
null,
|
|
115
|
-
null,
|
|
116
|
-
null,
|
|
117
|
-
{ topic: uri, payload: { error: true, response: err } },
|
|
118
|
-
]);
|
|
108
|
+
node.send([null, null, null, {topic: uri, payload: { error: true, response: err }}]);
|
|
119
109
|
} else {
|
|
120
110
|
node.status({
|
|
121
111
|
fill: 'green',
|
|
122
112
|
shape: 'dot',
|
|
123
|
-
text: JSON.stringify(response.value.pv)
|
|
113
|
+
text: JSON.stringify(response.value.pv)
|
|
124
114
|
});
|
|
125
115
|
if (node.detailedOutput === true) {
|
|
126
116
|
node.send([
|
|
127
117
|
{ topic: uri, payload: response.value.pv },
|
|
128
118
|
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
129
119
|
{ topic: uri, payload: response.value },
|
|
130
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
120
|
+
{ topic: uri, payload: { error: false, response: response } }
|
|
131
121
|
]);
|
|
132
122
|
} else {
|
|
133
123
|
node.send([
|
|
134
124
|
{ topic: uri, payload: response.value.pv },
|
|
135
|
-
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
125
|
+
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
136
126
|
]);
|
|
137
127
|
}
|
|
138
128
|
}
|
|
@@ -152,12 +142,4 @@ module.exports = function (RED) {
|
|
|
152
142
|
}
|
|
153
143
|
|
|
154
144
|
RED.nodes.registerType('mobius set resource', MobiusSetResourceNode);
|
|
155
|
-
|
|
156
|
-
RED.httpAdmin.get('/common/*', function (req, res) {
|
|
157
|
-
var options = {
|
|
158
|
-
root: __dirname + '/common/',
|
|
159
|
-
dotfiles: 'deny',
|
|
160
|
-
};
|
|
161
|
-
res.sendFile(req.params[0], options);
|
|
162
|
-
});
|
|
163
145
|
};
|