node-red-contrib-mobius-flow-base 2.5.86-beta.115 → 2.5.86-beta.118
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 +12 -3
- package/dist/nodes/mobius-clear-resource.js +15 -16
- package/dist/nodes/mobius-connection.js +1 -1
- package/dist/nodes/mobius-get-object.html +10 -2
- package/dist/nodes/mobius-get-object.js +12 -16
- package/dist/nodes/mobius-get-resource.html +11 -2
- package/dist/nodes/mobius-get-resource.js +15 -16
- package/dist/nodes/mobius-object-cov.html +2 -2
- package/dist/nodes/mobius-resource-cov.html +11 -2
- package/dist/nodes/mobius-resource-cov.js +7 -9
- package/dist/nodes/mobius-set-resource.html +11 -2
- package/dist/nodes/mobius-set-resource.js +27 -29
- package/package.json +1 -1
|
@@ -42,10 +42,18 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
42
42
|
<input type="checkbox" id="node-input-detailedOutput" style="display: inline-block; width: auto; vertical-align: top;">
|
|
43
43
|
<label for="node-input-detailedOutput" style="width: 70%;"> Use detailed outputs</label>
|
|
44
44
|
</div>
|
|
45
|
-
<hr>
|
|
45
|
+
<hr>
|
|
46
46
|
<div class="form-row">
|
|
47
|
-
<label for="node-input-
|
|
48
|
-
<
|
|
47
|
+
<label for="node-input-statusType" style="width: 125px;"><p><font color=##55aa88><i class="fa fa-square"></i></font> Status Display</p></label>
|
|
48
|
+
<select type="text" id="node-input-statusType" style="display: inline-block; width: 65%; vertical-align: right;">
|
|
49
|
+
<option value="timeSinceLastActive">Show time since last active</option>
|
|
50
|
+
<option value="lastUri">Show last URI</option>
|
|
51
|
+
<option value="lastValue">Show last Value</option>
|
|
52
|
+
</select>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="form-row">
|
|
55
|
+
<label for="node-input-name" style="width: 125px;"><i class="fa fa-tag"></i> Name</label>
|
|
56
|
+
<input type="text" id="node-input-name" placeholder="Name" style="display: inline-block; width: 65%; vertical-align: right;">
|
|
49
57
|
</div>
|
|
50
58
|
</script>
|
|
51
59
|
|
|
@@ -54,6 +62,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
54
62
|
category: 'mobius',
|
|
55
63
|
defaults: {
|
|
56
64
|
name: {value:""},
|
|
65
|
+
statusType: {value:"timeSinceLastActive"},
|
|
57
66
|
detailedOutput: {value:false},
|
|
58
67
|
resource: {value:"", validate:function(v) {
|
|
59
68
|
if(v === '') { return true; }
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
30
|
module.exports = function (RED) {
|
|
31
|
-
function MobiusClearResourceNode
|
|
31
|
+
function MobiusClearResourceNode(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) {
|
|
@@ -57,37 +57,36 @@ module.exports = function (RED) {
|
|
|
57
57
|
node.status({
|
|
58
58
|
fill: 'green',
|
|
59
59
|
shape: 'ring',
|
|
60
|
-
text: 'Busy'
|
|
60
|
+
text: 'Busy',
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
node.serviceConn.clearResourcePriority(uri, pri, (err, response) => {
|
|
64
64
|
if (err) {
|
|
65
|
-
node.
|
|
66
|
-
fill: 'yellow',
|
|
67
|
-
shape: 'dot',
|
|
68
|
-
text: 'Error: ' + JSON.stringify(err.code)
|
|
69
|
-
});
|
|
65
|
+
node.serviceConn.update.errMessage('Error: ' + JSON.stringify(err.code));
|
|
70
66
|
node.error('Mobius error clearing resource priority ' + JSON.stringify(err));
|
|
71
67
|
if (node.detailedOutput === true) {
|
|
72
|
-
node.send([
|
|
68
|
+
node.send([
|
|
69
|
+
null,
|
|
70
|
+
null,
|
|
71
|
+
null,
|
|
72
|
+
{ topic: uri, payload: { error: true, response: err } },
|
|
73
|
+
]);
|
|
73
74
|
}
|
|
74
75
|
} else {
|
|
75
|
-
node.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
text: JSON.stringify(response.value.pv)
|
|
79
|
-
});
|
|
76
|
+
node.serviceConn.update.latestUri(node, response.uri);
|
|
77
|
+
node.serviceConn.update.lastActiveTime(node);
|
|
78
|
+
node.serviceConn.update.latestValue(node, response.value.pv);
|
|
80
79
|
if (node.detailedOutput === true) {
|
|
81
80
|
node.send([
|
|
82
81
|
{ topic: uri, payload: response.value.pv },
|
|
83
82
|
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
84
83
|
{ topic: uri, payload: response.value },
|
|
85
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
84
|
+
{ topic: uri, payload: { error: false, response: response } },
|
|
86
85
|
]);
|
|
87
86
|
} else {
|
|
88
87
|
node.send([
|
|
89
88
|
{ topic: uri, payload: response.value.pv },
|
|
90
|
-
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
89
|
+
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
91
90
|
]);
|
|
92
91
|
}
|
|
93
92
|
}
|
|
@@ -338,7 +338,7 @@ module.exports = function (RED) {
|
|
|
338
338
|
}
|
|
339
339
|
node.users[mobiusNode.id].lastActiveTime = 0;
|
|
340
340
|
node.users[mobiusNode.id].statusCheckLoop = setInterval(() => {
|
|
341
|
-
if (node.connected) {
|
|
341
|
+
if (node.connected && node.users[mobiusNode.id].statusType !== undefined) {
|
|
342
342
|
node.updateNodeStatus(mobiusNode);
|
|
343
343
|
}
|
|
344
344
|
}, 60000);
|
|
@@ -47,8 +47,15 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
47
47
|
</div>
|
|
48
48
|
<hr>
|
|
49
49
|
<div class="form-row">
|
|
50
|
-
<label for="node-input-
|
|
51
|
-
<
|
|
50
|
+
<label for="node-input-statusType" style="width: 125px;"><p><font color=##55aa88><i class="fa fa-square"></i></font> Status Display</p></label>
|
|
51
|
+
<select type="text" id="node-input-statusType" style="display: inline-block; width: 65%; vertical-align: right;">
|
|
52
|
+
<option value="timeSinceLastActive">Show time since last active</option>
|
|
53
|
+
<option value="lastUri">Show last URI</option>
|
|
54
|
+
</select>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="form-row">
|
|
57
|
+
<label for="node-input-name" style="width: 125px;"><i class="fa fa-tag"></i> Name</label>
|
|
58
|
+
<input type="text" id="node-input-name" placeholder="Name" style="display: inline-block; width: 65%; vertical-align: right;">
|
|
52
59
|
</div>
|
|
53
60
|
</script>
|
|
54
61
|
|
|
@@ -58,6 +65,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
58
65
|
color: "#8abff5",
|
|
59
66
|
defaults: {
|
|
60
67
|
name: {value: ""},
|
|
68
|
+
statusType: {value:"timeSinceLastActive"},
|
|
61
69
|
detailedOutput: {value:false},
|
|
62
70
|
format: {value: "name", required: true},
|
|
63
71
|
mobject: {value: "", validate:function(v) {
|
|
@@ -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,28 @@ 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
|
-
node.
|
|
62
|
-
fill: 'yellow',
|
|
63
|
-
shape: 'dot',
|
|
64
|
-
text: 'Error: ' + JSON.stringify(err.code)
|
|
65
|
-
});
|
|
61
|
+
node.serviceConn.update.errMessage('Error: ' + JSON.stringify(err.code));
|
|
66
62
|
node.error('Mobius error reading object ' + JSON.stringify(err));
|
|
67
63
|
if (node.detailedOutput === true) {
|
|
68
|
-
node.send([null, null, {topic: uri, payload: { error: true, response: err }}]);
|
|
64
|
+
node.send([null, null, { topic: uri, payload: { error: true, response: err } }]);
|
|
69
65
|
}
|
|
70
66
|
} else {
|
|
71
|
-
node.
|
|
72
|
-
|
|
73
|
-
shape: 'dot',
|
|
74
|
-
text: JSON.stringify(response.uri)
|
|
75
|
-
});
|
|
67
|
+
node.serviceConn.update.latestUri(node, response.uri);
|
|
68
|
+
node.serviceConn.update.lastActiveTime(node);
|
|
76
69
|
|
|
77
|
-
let allResources = _.keyBy(
|
|
70
|
+
let allResources = _.keyBy(
|
|
71
|
+
response.value.resources,
|
|
72
|
+
node.format === 'name' ? 'name' : 'rid'
|
|
73
|
+
);
|
|
78
74
|
if (node.detailedOutput === true) {
|
|
79
75
|
node.send([
|
|
80
76
|
{ topic: uri, payload: allResources },
|
|
81
77
|
{ topic: uri, payload: response.value },
|
|
82
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
78
|
+
{ topic: uri, payload: { error: false, response: response } },
|
|
83
79
|
]);
|
|
84
80
|
} else {
|
|
85
81
|
node.send({ topic: uri, payload: allResources });
|
|
@@ -40,8 +40,16 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
40
40
|
</div>
|
|
41
41
|
<hr>
|
|
42
42
|
<div class="form-row">
|
|
43
|
-
<label for="node-input-
|
|
44
|
-
<
|
|
43
|
+
<label for="node-input-statusType" style="width: 125px;"><p><font color=##55aa88><i class="fa fa-square"></i></font> Status Display</p></label>
|
|
44
|
+
<select type="text" id="node-input-statusType" style="display: inline-block; width: 65%; vertical-align: right;">
|
|
45
|
+
<option value="timeSinceLastActive">Show time since last active</option>
|
|
46
|
+
<option value="lastUri">Show last URI</option>
|
|
47
|
+
<option value="lastValue">Show last Value</option>
|
|
48
|
+
</select>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="form-row">
|
|
51
|
+
<label for="node-input-name" style="width: 125px;"><i class="fa fa-tag"></i> Name</label>
|
|
52
|
+
<input type="text" id="node-input-name" placeholder="Name" style="display: inline-block; width: 65%; vertical-align: right;">
|
|
45
53
|
</div>
|
|
46
54
|
</script>
|
|
47
55
|
|
|
@@ -51,6 +59,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
51
59
|
color:"#8abff5",
|
|
52
60
|
defaults: {
|
|
53
61
|
name: {value:""},
|
|
62
|
+
statusType: {value:"timeSinceLastActive"},
|
|
54
63
|
detailedOutput: {value:false},
|
|
55
64
|
resource: {value:"", validate:function(v) {
|
|
56
65
|
if(v === '') { return true; }
|
|
@@ -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,35 @@ 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
|
-
node.
|
|
59
|
-
fill: 'yellow',
|
|
60
|
-
shape: 'dot',
|
|
61
|
-
text: 'Error: ' + JSON.stringify(err.code)
|
|
62
|
-
});
|
|
58
|
+
node.serviceConn.update.errMessage('Error: ' + JSON.stringify(err.code));
|
|
63
59
|
node.error('Mobius error reading resource ' + JSON.stringify(err));
|
|
64
60
|
if (node.detailedOutput === true) {
|
|
65
|
-
node.send([
|
|
61
|
+
node.send([
|
|
62
|
+
null,
|
|
63
|
+
null,
|
|
64
|
+
null,
|
|
65
|
+
{ topic: uri, payload: { error: true, response: err } },
|
|
66
|
+
]);
|
|
66
67
|
}
|
|
67
68
|
} else {
|
|
68
|
-
node.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
text: JSON.stringify(response.value.pv)
|
|
72
|
-
});
|
|
69
|
+
node.serviceConn.update.latestUri(node, response.uri);
|
|
70
|
+
node.serviceConn.update.lastActiveTime(node);
|
|
71
|
+
node.serviceConn.update.latestValue(node, response.value.pv);
|
|
73
72
|
if (node.detailedOutput === true) {
|
|
74
73
|
node.send([
|
|
75
74
|
{ topic: uri, payload: response.value.pv },
|
|
76
75
|
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
77
76
|
{ topic: uri, payload: response.value },
|
|
78
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
77
|
+
{ topic: uri, payload: { error: false, response: response } },
|
|
79
78
|
]);
|
|
80
79
|
} else {
|
|
81
80
|
node.send([
|
|
82
81
|
{ topic: uri, payload: response.value.pv },
|
|
83
|
-
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
82
|
+
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
84
83
|
]);
|
|
85
84
|
}
|
|
86
85
|
}
|
|
@@ -55,14 +55,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
55
55
|
<hr>
|
|
56
56
|
<div class="form-row">
|
|
57
57
|
<label for="node-input-statusType" style="width: 125px;"><p><font color=##55aa88><i class="fa fa-square"></i></font> Status Display</p></label>
|
|
58
|
-
<select type="text" id="node-input-statusType" style="display: inline-block; width:
|
|
58
|
+
<select type="text" id="node-input-statusType" style="display: inline-block; width: 65%; vertical-align: right;">
|
|
59
59
|
<option value="timeSinceLastActive">Show time since last active</option>
|
|
60
60
|
<option value="lastUri">Show last URI</option>
|
|
61
61
|
</select>
|
|
62
62
|
</div>
|
|
63
63
|
<div class="form-row">
|
|
64
64
|
<label for="node-input-name" style="width: 125px;"><i class="fa fa-tag"></i> Name</label>
|
|
65
|
-
<input type="text" id="node-input-name" placeholder="Name" style="display: inline-block; width:
|
|
65
|
+
<input type="text" id="node-input-name" placeholder="Name" style="display: inline-block; width: 65%; vertical-align: right;">
|
|
66
66
|
</div>
|
|
67
67
|
</script>
|
|
68
68
|
|
|
@@ -40,8 +40,16 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
40
40
|
</div>
|
|
41
41
|
<hr>
|
|
42
42
|
<div class="form-row">
|
|
43
|
-
<label for="node-input-
|
|
44
|
-
<
|
|
43
|
+
<label for="node-input-statusType" style="width: 125px;"><p><font color=##55aa88><i class="fa fa-square"></i></font> Status Display</p></label>
|
|
44
|
+
<select type="text" id="node-input-statusType" style="display: inline-block; width: 65%; vertical-align: right;">
|
|
45
|
+
<option value="timeSinceLastActive">Show time since last active</option>
|
|
46
|
+
<option value="lastUri">Show last URI</option>
|
|
47
|
+
<option value="lastValue">Show last Value</option>
|
|
48
|
+
</select>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="form-row">
|
|
51
|
+
<label for="node-input-name" style="width: 125px;"><i class="fa fa-tag"></i> Name</label>
|
|
52
|
+
<input type="text" id="node-input-name" placeholder="Name" style="display: inline-block; width: 65%; vertical-align: right;">
|
|
45
53
|
</div>
|
|
46
54
|
</script>
|
|
47
55
|
|
|
@@ -50,6 +58,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
50
58
|
category: 'mobius',
|
|
51
59
|
defaults: {
|
|
52
60
|
name: {value:""},
|
|
61
|
+
statusType: {value:"timeSinceLastActive"},
|
|
53
62
|
detailedOutput: {value:false},
|
|
54
63
|
resource: {value:"", required:true, validate:function(v) {
|
|
55
64
|
let parts = v.split('/');
|
|
@@ -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,24 @@ 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
|
-
node.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
text: JSON.stringify(response.value.pv)
|
|
50
|
-
});
|
|
46
|
+
node.serviceConn.update.latestUri(node, response.uri);
|
|
47
|
+
node.serviceConn.update.lastActiveTime(node);
|
|
48
|
+
node.serviceConn.update.latestValue(node, response.value.pv);
|
|
51
49
|
if (node.detailedOutput === true) {
|
|
52
50
|
node.send([
|
|
53
51
|
{ topic: response.uri, payload: response.value.pv },
|
|
54
52
|
{ topic: response.uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
55
53
|
{ topic: response.uri, payload: response.value },
|
|
56
|
-
{ topic: response.uri, payload: { response: response } }
|
|
54
|
+
{ topic: response.uri, payload: { response: response } },
|
|
57
55
|
]);
|
|
58
56
|
} else {
|
|
59
57
|
node.send([
|
|
60
58
|
{ topic: response.uri, payload: response.value.pv },
|
|
61
|
-
{ topic: response.uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
59
|
+
{ topic: response.uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
62
60
|
]);
|
|
63
61
|
}
|
|
64
62
|
});
|
|
@@ -44,8 +44,16 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
44
44
|
</div>
|
|
45
45
|
<hr>
|
|
46
46
|
<div class="form-row">
|
|
47
|
-
<label for="node-input-
|
|
48
|
-
<
|
|
47
|
+
<label for="node-input-statusType" style="width: 125px;"><p><font color=##55aa88><i class="fa fa-square"></i></font> Status Display</p></label>
|
|
48
|
+
<select type="text" id="node-input-statusType" style="display: inline-block; width: 65%; vertical-align: right;">
|
|
49
|
+
<option value="timeSinceLastActive">Show time since last active</option>
|
|
50
|
+
<option value="lastUri">Show last URI</option>
|
|
51
|
+
<option value="lastValue">Show last Value</option>
|
|
52
|
+
</select>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="form-row">
|
|
55
|
+
<label for="node-input-name" style="width: 125px;"><i class="fa fa-tag"></i> Name</label>
|
|
56
|
+
<input type="text" id="node-input-name" placeholder="Name" style="display: inline-block; width: 65%; vertical-align: right;">
|
|
49
57
|
</div>
|
|
50
58
|
</script>
|
|
51
59
|
|
|
@@ -54,6 +62,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
54
62
|
category: 'mobius',
|
|
55
63
|
defaults: {
|
|
56
64
|
name: {value:""},
|
|
65
|
+
statusType: {value:"timeSinceLastActive"},
|
|
57
66
|
detailedOutput: {value:false},
|
|
58
67
|
resource: {value:"", validate:function(v) {
|
|
59
68
|
if(v === '') { return true; }
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
30
|
module.exports = function (RED) {
|
|
31
|
-
function MobiusSetResourceNode
|
|
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,38 +60,37 @@ 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) {
|
|
67
67
|
node.serviceConn.clearResourcePriority(uri, pri, (err, response) => {
|
|
68
68
|
if (err) {
|
|
69
|
-
node.
|
|
70
|
-
fill: 'yellow',
|
|
71
|
-
shape: 'dot',
|
|
72
|
-
text: 'Error: ' + JSON.stringify(err.code)
|
|
73
|
-
});
|
|
69
|
+
node.serviceConn.update.errMessage('Error: ' + JSON.stringify(err.code));
|
|
74
70
|
node.error('Mobius error clearing resource priority ' + JSON.stringify(err));
|
|
75
71
|
if (node.detailedOutput === true) {
|
|
76
|
-
node.send([
|
|
72
|
+
node.send([
|
|
73
|
+
null,
|
|
74
|
+
null,
|
|
75
|
+
null,
|
|
76
|
+
{ topic: uri, payload: { error: true, response: err } },
|
|
77
|
+
]);
|
|
77
78
|
}
|
|
78
79
|
} else {
|
|
79
|
-
node.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
text: JSON.stringify(response.value.pv)
|
|
83
|
-
});
|
|
80
|
+
node.serviceConn.update.latestUri(node, response.uri);
|
|
81
|
+
node.serviceConn.update.lastActiveTime(node);
|
|
82
|
+
node.serviceConn.update.latestValue(node, response.value.pv);
|
|
84
83
|
if (node.detailedOutput === true) {
|
|
85
84
|
node.send([
|
|
86
85
|
{ topic: uri, payload: response.value.pv },
|
|
87
86
|
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
88
87
|
{ topic: uri, payload: response.value },
|
|
89
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
88
|
+
{ topic: uri, payload: { error: false, response: response } },
|
|
90
89
|
]);
|
|
91
90
|
} else {
|
|
92
91
|
node.send([
|
|
93
92
|
{ topic: uri, payload: response.value.pv },
|
|
94
|
-
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
93
|
+
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
95
94
|
]);
|
|
96
95
|
}
|
|
97
96
|
}
|
|
@@ -99,30 +98,29 @@ module.exports = function (RED) {
|
|
|
99
98
|
} else {
|
|
100
99
|
node.serviceConn.writeResourceValue(uri, value, pri, (err, response) => {
|
|
101
100
|
if (err) {
|
|
102
|
-
node.
|
|
103
|
-
fill: 'yellow',
|
|
104
|
-
shape: 'dot',
|
|
105
|
-
text: 'Error: ' + JSON.stringify(err.code)
|
|
106
|
-
});
|
|
101
|
+
node.serviceConn.update.errMessage('Error: ' + JSON.stringify(err.code));
|
|
107
102
|
node.error('Mobius error writing resource ' + JSON.stringify(err));
|
|
108
|
-
node.send([
|
|
103
|
+
node.send([
|
|
104
|
+
null,
|
|
105
|
+
null,
|
|
106
|
+
null,
|
|
107
|
+
{ topic: uri, payload: { error: true, response: err } },
|
|
108
|
+
]);
|
|
109
109
|
} else {
|
|
110
|
-
node.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
text: JSON.stringify(response.value.pv)
|
|
114
|
-
});
|
|
110
|
+
node.serviceConn.update.latestUri(node, response.uri);
|
|
111
|
+
node.serviceConn.update.lastActiveTime(node);
|
|
112
|
+
node.serviceConn.update.latestValue(node, response.value.pv);
|
|
115
113
|
if (node.detailedOutput === true) {
|
|
116
114
|
node.send([
|
|
117
115
|
{ topic: uri, payload: response.value.pv },
|
|
118
116
|
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
119
117
|
{ topic: uri, payload: response.value },
|
|
120
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
118
|
+
{ topic: uri, payload: { error: false, response: response } },
|
|
121
119
|
]);
|
|
122
120
|
} else {
|
|
123
121
|
node.send([
|
|
124
122
|
{ topic: uri, payload: response.value.pv },
|
|
125
|
-
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
123
|
+
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
126
124
|
]);
|
|
127
125
|
}
|
|
128
126
|
}
|