@bitpoolos/edge-bacnet 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/bacnet_client.js +650 -233
  2. package/bacnet_device.js +65 -16
  3. package/bacnet_gateway.html +242 -99
  4. package/bacnet_gateway.js +211 -27
  5. package/bacnet_object.js +1 -1
  6. package/bacnet_read.html +211 -133
  7. package/bacnet_read.js +24 -24
  8. package/bacnet_server.js +321 -0
  9. package/bacnet_write.html +24 -15
  10. package/bacnet_write.js +0 -2
  11. package/common.js +95 -9
  12. package/edge-bacnet-datastore.cfg +0 -0
  13. package/package.json +6 -4
  14. package/resources/confirmationservice.min.js +1 -0
  15. package/resources/confirmdialog.min.js +1 -0
  16. package/resources/fonts/primeicons.woff2 +0 -0
  17. package/resources/node-bacnet/CHANGELOG.md +481 -0
  18. package/resources/{bacstack → node-bacnet}/LICENSE.md +3 -1
  19. package/resources/node-bacnet/README.md +91 -0
  20. package/resources/node-bacnet/docs/Client.html +4422 -0
  21. package/resources/node-bacnet/docs/bacnet-icon-quad.png +0 -0
  22. package/resources/node-bacnet/docs/bacnet-icon-quad128.png +0 -0
  23. package/resources/node-bacnet/docs/bacnet-icon-quad64.png +0 -0
  24. package/resources/node-bacnet/docs/bacnet-icon-small.xcf +0 -0
  25. package/resources/node-bacnet/docs/bacnet-icon.xcf +0 -0
  26. package/resources/node-bacnet/docs/bacnet.html +7032 -0
  27. package/resources/node-bacnet/docs/client.js.html +1759 -0
  28. package/resources/node-bacnet/docs/enum.js.html +2530 -0
  29. package/resources/node-bacnet/docs/global.html +2068 -0
  30. package/resources/node-bacnet/docs/images/mocha-logo.svg +65 -0
  31. package/resources/node-bacnet/docs/index.html +283 -0
  32. package/resources/node-bacnet/docs/scripts/collapse.js +11 -0
  33. package/resources/node-bacnet/docs/scripts/jquery-3.1.1.min.js +4 -0
  34. package/resources/node-bacnet/docs/scripts/linenumber.js +26 -0
  35. package/resources/node-bacnet/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  36. package/resources/node-bacnet/docs/scripts/prettify/lang-css.js +2 -0
  37. package/resources/node-bacnet/docs/scripts/prettify/prettify.js +28 -0
  38. package/resources/node-bacnet/docs/scripts/search.js +47 -0
  39. package/resources/node-bacnet/docs/services_i-am.js.html +157 -0
  40. package/resources/node-bacnet/docs/services_time-sync.js.html +118 -0
  41. package/resources/node-bacnet/docs/services_who-is.js.html +138 -0
  42. package/resources/node-bacnet/docs/styles/jsdoc.css +683 -0
  43. package/resources/node-bacnet/docs/styles/prettify.css +82 -0
  44. package/resources/node-bacnet/examples/discover-devices.js +66 -0
  45. package/resources/node-bacnet/examples/read-device.js +510 -0
  46. package/resources/node-bacnet/examples/subscribe-cov.js +75 -0
  47. package/resources/{bacstack → node-bacnet}/index.js +3 -0
  48. package/resources/{bacstack → node-bacnet}/lib/apdu.js +56 -39
  49. package/resources/{bacstack → node-bacnet}/lib/asn1.js +550 -532
  50. package/resources/node-bacnet/lib/bvlc.js +90 -0
  51. package/resources/node-bacnet/lib/client.js +1695 -0
  52. package/resources/node-bacnet/lib/enum.js +2463 -0
  53. package/resources/node-bacnet/lib/npdu.js +123 -0
  54. package/resources/{bacstack → node-bacnet}/lib/services/add-list-element.js +12 -6
  55. package/resources/{bacstack → node-bacnet}/lib/services/alarm-acknowledge.js +3 -3
  56. package/resources/{bacstack → node-bacnet}/lib/services/alarm-summary.js +5 -4
  57. package/resources/{bacstack → node-bacnet}/lib/services/atomic-read-file.js +49 -26
  58. package/resources/{bacstack → node-bacnet}/lib/services/atomic-write-file.js +40 -23
  59. package/resources/{bacstack → node-bacnet}/lib/services/cov-notify.js +33 -17
  60. package/resources/{bacstack → node-bacnet}/lib/services/create-object.js +23 -13
  61. package/resources/{bacstack → node-bacnet}/lib/services/delete-object.js +7 -2
  62. package/resources/{bacstack → node-bacnet}/lib/services/device-communication-control.js +8 -3
  63. package/resources/{bacstack → node-bacnet}/lib/services/error.js +7 -0
  64. package/resources/{bacstack → node-bacnet}/lib/services/event-information.js +10 -9
  65. package/resources/{bacstack → node-bacnet}/lib/services/event-notify-data.js +38 -16
  66. package/resources/{bacstack → node-bacnet}/lib/services/get-enrollment-summary.js +24 -11
  67. package/resources/{bacstack → node-bacnet}/lib/services/get-event-information.js +28 -13
  68. package/resources/node-bacnet/lib/services/i-am.js +90 -0
  69. package/resources/{bacstack/lib/services/i-have-broadcast.js → node-bacnet/lib/services/i-have.js} +3 -2
  70. package/resources/{bacstack → node-bacnet}/lib/services/index.js +7 -4
  71. package/resources/{bacstack → node-bacnet}/lib/services/life-safety-operation.js +3 -2
  72. package/resources/{bacstack → node-bacnet}/lib/services/private-transfer.js +3 -2
  73. package/resources/{bacstack → node-bacnet}/lib/services/read-property-multiple.js +11 -6
  74. package/resources/{bacstack → node-bacnet}/lib/services/read-property.js +42 -24
  75. package/resources/{bacstack → node-bacnet}/lib/services/read-range.js +37 -27
  76. package/resources/node-bacnet/lib/services/register-foreign-device.js +18 -0
  77. package/resources/{bacstack → node-bacnet}/lib/services/reinitialize-device.js +9 -4
  78. package/resources/{bacstack → node-bacnet}/lib/services/subscribe-cov.js +9 -4
  79. package/resources/{bacstack → node-bacnet}/lib/services/subscribe-property.js +18 -8
  80. package/resources/{bacstack → node-bacnet}/lib/services/time-sync.js +28 -5
  81. package/resources/{bacstack → node-bacnet}/lib/services/who-has.js +3 -3
  82. package/resources/{bacstack → node-bacnet}/lib/services/who-is.js +42 -9
  83. package/resources/{bacstack → node-bacnet}/lib/services/write-property-multiple.js +33 -16
  84. package/resources/{bacstack → node-bacnet}/lib/services/write-property.js +23 -13
  85. package/resources/node-bacnet/lib/transport.js +82 -0
  86. package/resources/node-bacnet/package.json +92 -0
  87. package/resources/primeicons.css +90 -2
  88. package/resources/bacstack/.codeclimate.yml +0 -15
  89. package/resources/bacstack/.dockerignore +0 -5
  90. package/resources/bacstack/.editorconfig +0 -13
  91. package/resources/bacstack/.eslintrc.yml +0 -13
  92. package/resources/bacstack/.github/ISSUE_TEMPLATE.md +0 -26
  93. package/resources/bacstack/.github/PULL_REQUEST_TEMPLATE.md +0 -14
  94. package/resources/bacstack/.github/workflows/ci.yml +0 -39
  95. package/resources/bacstack/.jscsrc +0 -8
  96. package/resources/bacstack/.jshintrc +0 -50
  97. package/resources/bacstack/.travis.yml +0 -27
  98. package/resources/bacstack/CHANGELOG.md +0 -232
  99. package/resources/bacstack/CODE_OF_CONDUCT.md +0 -74
  100. package/resources/bacstack/CONTRIBUTING.md +0 -77
  101. package/resources/bacstack/Dockerfile +0 -15
  102. package/resources/bacstack/FAQ.md +0 -64
  103. package/resources/bacstack/README.md +0 -157
  104. package/resources/bacstack/docker-compose.yml +0 -9
  105. package/resources/bacstack/lib/adpu.js +0 -190
  106. package/resources/bacstack/lib/bvlc.js +0 -43
  107. package/resources/bacstack/lib/client.js +0 -1028
  108. package/resources/bacstack/lib/enum.js +0 -1314
  109. package/resources/bacstack/lib/npdu.js +0 -119
  110. package/resources/bacstack/lib/services/i-am-broadcast.js +0 -51
  111. package/resources/bacstack/lib/services.js +0 -1963
  112. package/resources/bacstack/lib/transport.js +0 -52
  113. package/resources/bacstack/package-lock.json +0 -7974
  114. package/resources/bacstack/package.json +0 -84
  115. package/resources/bacstack/test/compliance/who-is.spec.js +0 -37
  116. package/resources/bacstack/test/integration/acknowledge-alarm.spec.js +0 -14
  117. package/resources/bacstack/test/integration/add-list-element.spec.js +0 -16
  118. package/resources/bacstack/test/integration/confirmed-event-notification.spec.js +0 -30
  119. package/resources/bacstack/test/integration/confirmed-private-transfer.spec.js +0 -15
  120. package/resources/bacstack/test/integration/create-object.spec.js +0 -16
  121. package/resources/bacstack/test/integration/delete-object.spec.js +0 -14
  122. package/resources/bacstack/test/integration/device-communication-control.spec.js +0 -14
  123. package/resources/bacstack/test/integration/get-alarm-summary.spec.js +0 -14
  124. package/resources/bacstack/test/integration/get-enrollment-summary.spec.js +0 -15
  125. package/resources/bacstack/test/integration/get-event-information.spec.js +0 -14
  126. package/resources/bacstack/test/integration/read-file.spec.js +0 -14
  127. package/resources/bacstack/test/integration/read-property-multiple.spec.js +0 -110
  128. package/resources/bacstack/test/integration/read-property.spec.js +0 -14
  129. package/resources/bacstack/test/integration/read-range.spec.js +0 -14
  130. package/resources/bacstack/test/integration/reinitialize-sevice.spec.js +0 -14
  131. package/resources/bacstack/test/integration/remove-list-element.spec.js +0 -16
  132. package/resources/bacstack/test/integration/subscribe-cov.spec.js +0 -14
  133. package/resources/bacstack/test/integration/subscribe-property.spec.js +0 -14
  134. package/resources/bacstack/test/integration/time-sync-utc.spec.js +0 -10
  135. package/resources/bacstack/test/integration/time-sync.spec.js +0 -10
  136. package/resources/bacstack/test/integration/unconfirmed-event-notification.spec.js +0 -28
  137. package/resources/bacstack/test/integration/unconfirmed-private-transfer.spec.js +0 -11
  138. package/resources/bacstack/test/integration/utils.js +0 -30
  139. package/resources/bacstack/test/integration/who-is.spec.js +0 -17
  140. package/resources/bacstack/test/integration/write-file.spec.js +0 -14
  141. package/resources/bacstack/test/integration/write-property-multiple.spec.js +0 -19
  142. package/resources/bacstack/test/integration/write-property.spec.js +0 -14
  143. package/resources/bacstack/test/unit/apdu.spec.js +0 -162
  144. package/resources/bacstack/test/unit/asn1.spec.js +0 -39
  145. package/resources/bacstack/test/unit/bacnet-apdu.spec.js +0 -161
  146. package/resources/bacstack/test/unit/bacnet-asn1.spec.js +0 -32
  147. package/resources/bacstack/test/unit/bacnet-bvlc.spec.js +0 -57
  148. package/resources/bacstack/test/unit/bacnet-npdu.spec.js +0 -118
  149. package/resources/bacstack/test/unit/bacnet-services.spec.js +0 -2052
  150. package/resources/bacstack/test/unit/bvlc.spec.js +0 -58
  151. package/resources/bacstack/test/unit/npdu.spec.js +0 -119
  152. package/resources/bacstack/test/unit/service-add-list-element.spec.js +0 -24
  153. package/resources/bacstack/test/unit/service-alarm-acknowledge.spec.js +0 -71
  154. package/resources/bacstack/test/unit/service-alarm-summary.spec.js +0 -22
  155. package/resources/bacstack/test/unit/service-atomic-read-file.spec.js +0 -54
  156. package/resources/bacstack/test/unit/service-atomic-write-file.spec.js +0 -56
  157. package/resources/bacstack/test/unit/service-cov-notify.spec.js +0 -98
  158. package/resources/bacstack/test/unit/service-create-object.spec.js +0 -90
  159. package/resources/bacstack/test/unit/service-delete-object.spec.js +0 -17
  160. package/resources/bacstack/test/unit/service-device-communication-control.spec.js +0 -29
  161. package/resources/bacstack/test/unit/service-error.spec.js +0 -17
  162. package/resources/bacstack/test/unit/service-event-information.spec.js +0 -48
  163. package/resources/bacstack/test/unit/service-event-notify-data.spec.js +0 -310
  164. package/resources/bacstack/test/unit/service-get-enrollment-summary.spec.js +0 -45
  165. package/resources/bacstack/test/unit/service-get-event-information.spec.js +0 -62
  166. package/resources/bacstack/test/unit/service-i-am.spec.js +0 -19
  167. package/resources/bacstack/test/unit/service-i-have-broadcast.spec.js +0 -18
  168. package/resources/bacstack/test/unit/service-life-safety-operation.spec.js +0 -19
  169. package/resources/bacstack/test/unit/service-private-transfer.spec.js +0 -18
  170. package/resources/bacstack/test/unit/service-read-property-multiple.spec.js +0 -131
  171. package/resources/bacstack/test/unit/service-read-property.spec.js +0 -541
  172. package/resources/bacstack/test/unit/service-read-range.spec.js +0 -97
  173. package/resources/bacstack/test/unit/service-reinitialize-device.spec.js +0 -27
  174. package/resources/bacstack/test/unit/service-subscribe-cov.spec.js +0 -32
  175. package/resources/bacstack/test/unit/service-subscribe-property.spec.js +0 -50
  176. package/resources/bacstack/test/unit/service-time-sync.spec.js +0 -18
  177. package/resources/bacstack/test/unit/service-who-has.spec.js +0 -33
  178. package/resources/bacstack/test/unit/service-who-is.spec.js +0 -17
  179. package/resources/bacstack/test/unit/service-write-property-multiple.spec.js +0 -143
  180. package/resources/bacstack/test/unit/service-write-property.spec.js +0 -198
  181. package/resources/bacstack/test/unit/utils.js +0 -6
package/bacnet_device.js CHANGED
@@ -1,23 +1,61 @@
1
1
  class BacnetDevice {
2
- constructor(config) {
2
+ constructor(fromImport, config) {
3
3
  let that = this;
4
- that.address = config.address;
5
- that.deviceId = config.deviceId;
6
- that.maxApdu = config.maxApdu;
7
- that.segmentation = config.segmentation;
8
- that.vendorId = config.vendorId;
9
- that.lastSeen = null;
10
- that.deviceName = null;
11
- that.pointsList = [];
12
- that.pointListUpdateTs = null;
4
+
5
+ if(fromImport == true) {
6
+ that.address = config.address;
7
+ that.isMstp = config.isMstp;
8
+ that.deviceId = config.deviceId;
9
+ that.maxApdu = config.maxApdu;
10
+ that.segmentation = config.segmentation;
11
+ that.vendorId = config.vendorId;
12
+ that.lastSeen = config.lastSeen;
13
+ that.deviceName = config.deviceName;
14
+ that.pointsList = config.pointsList;
15
+ that.pointListUpdateTs = config.pointListUpdateTs;
16
+ that.manualDiscoveryMode = config.manualDiscoveryMode;
17
+
18
+ } else if(fromImport == false) {
19
+
20
+ if(config.header.source) {
21
+ that.address = {address: config.header.sender.address, net: config.header.source.net, adr: config.header.source.adr};
22
+ that.isMstp = true;
23
+ } else {
24
+ that.address = config.header.sender.address;
25
+ that.isMstp = false;
26
+ }
27
+ that.deviceId = config.payload.deviceId;
28
+ that.maxApdu = config.payload.maxApdu;
29
+ that.segmentation = config.payload.segmentation;
30
+ that.vendorId = config.payload.vendorId;
31
+ that.lastSeen = null;
32
+ that.deviceName = null;
33
+ that.pointsList = [];
34
+ that.pointListUpdateTs = null;
35
+ that.manualDiscoveryMode = false;
36
+ }
13
37
  }
14
38
 
15
39
  updateDeviceConfig(config) {
16
- if(config.address !== "" && config.address !== null && config.address !== "undefined") this.address = config.address;
17
- if(Number.isInteger(config.deviceId)) this.deviceId = config.deviceId;
18
- if(Number.isInteger(config.maxApdu)) this.maxApdu = config.maxApdu;
19
- if(Number.isInteger(config.segmentation)) this.segmentation = config.segmentation;
20
- if(Number.isInteger(config.vendorId)) this.vendorId = config.vendorId;
40
+ if(config.header.sender.address !== "" && config.header.sender.address !== null && config.header.sender.address !== "undefined") {
41
+ if(config.header.source) {
42
+ this.address = {address: config.header.sender.address, net: config.header.source.net, adr: config.header.source.adr};
43
+ } else {
44
+ this.address = config.header.sender.address;
45
+ }
46
+ }
47
+ if(Number.isInteger(config.deviceId)) this.deviceId = config.payload.deviceId;
48
+ if(Number.isInteger(config.maxApdu)) this.maxApdu = config.payload.maxApdu;
49
+ if(Number.isInteger(config.segmentation)) this.segmentation = config.payload.segmentation;
50
+ if(Number.isInteger(config.vendorId)) this.vendorId = config.payload.vendorId;
51
+ }
52
+
53
+ setManualDiscoveryMode(bool) {
54
+ this.manualDiscoveryMode = bool;
55
+ }
56
+
57
+ getManualDiscoveryMode() {
58
+ return this.manualDiscoveryMode;
21
59
  }
22
60
 
23
61
  setPointListUpdateTS(ts) {
@@ -33,7 +71,14 @@ class BacnetDevice {
33
71
  }
34
72
 
35
73
  setPointsList(newPoints) {
36
- this.pointsList = newPoints;
74
+ for(let index = 0; index < newPoints.length; index ++){
75
+ let newPoint = newPoints[index];
76
+ let foundIndex = this.pointsList.findIndex(ele => ele.value.type == newPoint.value.type && ele.value.instance == newPoint.value.instance);
77
+ if(foundIndex == -1 ) {
78
+ //not found
79
+ this.pointsList.push(newPoint);
80
+ }
81
+ }
37
82
  }
38
83
 
39
84
  getDevicePoints() {
@@ -96,6 +141,10 @@ class BacnetDevice {
96
141
  this.deviceName = deviceName;
97
142
  }
98
143
 
144
+ getIsMstpDevice(){
145
+ return this.isMstp;
146
+ }
147
+
99
148
  }
100
149
 
101
150
  module.exports = { BacnetDevice };
@@ -1,8 +1,6 @@
1
1
  <!--
2
2
  MIT License Copyright 2021, 2022 - Bitpool Pty Ltd
3
3
  -->
4
-
5
-
6
4
  <!-- PrimeVue -->
7
5
  <link href="resources/@bitpoolos/edge-bacnet/primevue-saga-blue-theme.css" rel="stylesheet" />
8
6
  <link href="resources/@bitpoolos/edge-bacnet/primevue.min.css" rel="stylesheet" />
@@ -19,7 +17,12 @@
19
17
  async = false;
20
18
  }
21
19
  var scripts = [];
22
- var _scripts = ['resources/@bitpoolos/edge-bacnet/vue.global.prod.js', 'resources/@bitpoolos/edge-bacnet/core.min.js'];
20
+ var _scripts = [
21
+ 'resources/@bitpoolos/edge-bacnet/vue.global.prod.js',
22
+ 'resources/@bitpoolos/edge-bacnet/core.min.js',
23
+ 'resources/@bitpoolos/edge-bacnet/confirmdialog.min.js',
24
+ 'resources/@bitpoolos/edge-bacnet/confirmationservice.min.js'
25
+ ];
23
26
 
24
27
  if (async) {
25
28
  LoadScriptsAsync(_scripts, scripts)
@@ -74,7 +77,10 @@
74
77
  class NodeService {
75
78
  getNetworkData() {
76
79
  return fetch('/bitpool-bacnet-data/getNetworkTree').then(res => res.json());
77
- }
80
+ };
81
+ rebuildDataModel() {
82
+ return fetch('/bitpool-bacnet-data/rebuildDataModel').then(res => res.json());
83
+ };
78
84
  };
79
85
  RED.nodes.registerType('Bacnet-Gateway', {
80
86
  category: 'Bitpool BACnet',
@@ -92,16 +98,25 @@
92
98
  discover_polling_schedule: {value: ""},
93
99
  discover_polling_schedule_value: {value: "1", required: true},
94
100
  discover_polling_schedule_options: {value: "Minutes", required: true},
95
- device_id_range_enabled: {value: true},
101
+ device_id_range_enabled: {value: false},
96
102
  device_id_range_start: {value: 0},
97
103
  device_id_range_end: {value: 4194303},
104
+ deviceId: {value: 817001, required: true},
105
+ manual_instance_range_enabled: {value: false},
106
+ manual_instance_range_start: {value: 0},
107
+ manual_instance_range_end: {value: 10000},
108
+ logErrorToConsole: {value: false},
109
+ serverEnabled: {value: false},
110
+ bacnetServerRebuildSchedule: {value: ""},
111
+ bacnetServerRebuildSchedule_value: {value: "1", required: true},
112
+ bacnetServerRebuildSchedule_options: {value: "Hours", required: true}
98
113
  },
99
114
  networkInterfaces: [],
100
115
  inputs: 1,
101
116
  outputs: 1,
102
117
  icon: "bitpool.svg",
103
118
  label: function () {
104
- return "gateway";
119
+ return this.name || "gateway";
105
120
  },
106
121
  paletteLabel: function () {
107
122
  return "gateway";
@@ -109,6 +124,33 @@
109
124
  oneditprepare: function () {
110
125
  let node = this;
111
126
 
127
+ let tabs = RED.tabs.create(
128
+ {
129
+ id: "node-input-read-tabs",
130
+ onchange: function (tab) {
131
+ $("#node-input-tabs-content").children().hide()
132
+ $("#" + tab.id).show()
133
+ }
134
+ });
135
+
136
+ tabs.addTab(
137
+ {
138
+ id: "read-properties-tab",
139
+ label: "Gateway"
140
+ });
141
+
142
+ tabs.addTab(
143
+ {
144
+ id: "read-discover-tab",
145
+ label: "Discovery"
146
+ });
147
+
148
+ tabs.addTab(
149
+ {
150
+ id: "read-server-tab",
151
+ label: "Server"
152
+ });
153
+
112
154
  if (node.networkInterfaces && node.networkInterfaces.length > 0) {
113
155
  let nicSelector = document.getElementById("node-input-local_device_address");
114
156
  node.networkInterfaces.forEach(function (option) {
@@ -119,7 +161,6 @@
119
161
 
120
162
  function queryAdapters() {
121
163
  let nicSelector = document.getElementById("node-input-local_device_address");
122
-
123
164
  $.ajax({
124
165
  url: '/bitpool-bacnet-data/getNetworkInterfaces',
125
166
  success: function (data) {
@@ -142,8 +183,21 @@
142
183
  timeout: 10000
143
184
  });
144
185
  }
186
+
145
187
  queryAdapters();
146
188
 
189
+ // function setBroadCastAddress() {
190
+ // let nicSelector = document.getElementById("node-input-local_device_address");
191
+ // nicSelector.onchange = function(e) {
192
+ // if(typeof e.target.value == "string" && e.target.value !== ""){
193
+ // let broadcastAddrPrefill = e.target.value.split(".").slice(0, 3).join(".") + ".255";
194
+ // document.getElementById("node-input-broadCastAddr").value = broadcastAddrPrefill;
195
+ // }
196
+ // };
197
+ // }
198
+
199
+ // setBroadCastAddress();
200
+
147
201
  function setDeviceIdRangeState(state) {
148
202
  let deviceIdRangeStart = $("#node-input-device_id_range_start");
149
203
  let deviceIdRangeEnd = $("#node-input-device_id_range_end");
@@ -162,14 +216,37 @@
162
216
  setDeviceIdRangeState(this.checked);
163
217
  });
164
218
 
219
+ function setManualInstanceRangeState(state) {
220
+ let deviceIdRangeStart = $("#node-input-manual_instance_range_start");
221
+ let deviceIdRangeEnd = $("#node-input-manual_instance_range_end");
222
+ if(state == true) {
223
+ deviceIdRangeStart.removeAttr("readonly");
224
+ deviceIdRangeEnd.removeAttr("readonly");
225
+ } else if(state == false) {
226
+ deviceIdRangeStart.attr("readonly", true);
227
+ deviceIdRangeEnd.attr("readonly", true);
228
+ }
229
+ }
230
+
231
+ setManualInstanceRangeState(node.manual_instance_range_enabled);
232
+
233
+ $("#node-input-manual_instance_range_enabled").change(function(e) {
234
+ setManualInstanceRangeState(this.checked);
235
+ });
236
+
165
237
  },
166
- oneditsave: function () {
238
+ oneditsave: function (test) {
167
239
  let node = this;
168
240
 
169
241
  document.getElementById("node-input-discover_polling_schedule").value = getTimePeriodInSeconds(
170
242
  document.getElementById("node-input-discover_polling_schedule_value").value,
171
243
  document.getElementById("node-input-discover_polling_schedule_options").value
172
244
  );
245
+
246
+ document.getElementById("node-input-bacnetServerRebuildSchedule").value = getTimePeriodInSeconds(
247
+ document.getElementById("node-input-bacnetServerRebuildSchedule_value").value,
248
+ document.getElementById("node-input-bacnetServerRebuildSchedule_options").value
249
+ );
173
250
  }
174
251
  });
175
252
 
@@ -223,116 +300,182 @@
223
300
  margin-left: 50px;
224
301
  }
225
302
 
226
- /* .form-row deviceIdRange {
227
- display: flex;
228
- flex-direction: row;
229
- flex-wrap: nowrap;
230
- align-content: center;
231
- justify-content: flex-start;
232
- align-items: center;
233
- } */
303
+ .red-ui-editor label {
304
+ font-size: 12px;
305
+ }
234
306
 
235
307
  </style>
236
-
237
- <div class="form-row">
238
- <label for="node-input-name"><i class="icon-tag"></i><span data-i18n="bitpool-bacnet.label.name"></span> Name</label>
239
- <input type="text" id="node-input-name" placeholder="Name">
240
- </div>
241
-
308
+
242
309
  <div class='form-row node-input-read-tabs-row'>
243
310
  <ul style='min-width:600px;margin-bottom:20px' id='node-input-read-tabs'></ul>
244
311
  </div>
245
312
 
246
- <div class="form-row" id="networkInterfaceDiv">
247
- <label for="node-input-local_device_address"><i class="icon-tag"></i><span data-i18n="bitpool-bacnet.label.local_device_address"></span> Network Interface</label>
248
- <select id="node-input-local_device_address" style="width: 70%;" >
249
- </select>
250
- </div>
251
-
252
- <div class="form-row">
253
- <label for="node-input-broadCastAddr"><i class="icon-tag"></i><span data-i18n="bitpool-bacnet.label.broadCastAddr"></span> Broadcast Address </label>
254
- <input type="text" id="node-input-broadCastAddr" placeholder="255.255.255.255">
255
- </div>
256
-
257
- <div class="form-row">
258
- <label for="node-input-local_device_port"><i class="icon-tag"></i><span data-i18n="bitpool-bacnet.label.local_device_port"></span> Local Device Port</label>
259
- <input type="text" id="node-input-local_device_port" placeholder="47808">
260
- </div>
261
-
262
- <div class="form-row deviceIdRange">
263
- <label for="node-input-device_id_range"><i class="icon-tag"></i><span data-i18n="bitpool-bacnet.label.device_id_range"></span> Device ID Range </label>
264
- <input type="checkbox" id="node-input-device_id_range_enabled" style="width: auto;"/>
265
- <a style="padding-left: 60px;">Start: </a><input type="number" id="node-input-device_id_range_start" style="width: 125px;" min="0" max="4194303"/>
266
- <a style="padding-left: 35px;">End: </a><input type="number" id="node-input-device_id_range_end" style="width: 125px;" min="1" max="4194303"/>
267
-
268
- </div>
269
-
270
- <div class="form-row">
271
- <label for="node-input-apduTimeout"><i class="icon-tag"></i> <span data-i18n="bitpool-bacnet.label.apduTimeout"></span>Apdu Timeout</label>
272
- <input type="text" id="node-input-apduTimeout" placeholder="10000">
273
- </div>
274
-
275
- <div class="form-row">
276
- <label for="node-input-apduSize"><i class="icon-tag"></i> <span data-i18n="bitpool-bacnet.label.apduSize"></span>Max Apdu Size</label>
277
- <select id="node-input-apduSize">
278
- <option value="0">0</option>
279
- <option value="1">1</option>
280
- <option value="2">2</option>
281
- <option value="3">3</option>
282
- <option value="4">4</option>
283
- <option value="5">5</option>
284
- </select>
285
- </div>
286
-
287
- <div class="form-row">
288
- <label for="node-input-maxSegments"><i class="icon-tag"></i> <span data-i18n="bitpool-bacnet.label.maxSegments"></span>Max Segments</label>
289
- <select id="node-input-maxSegments">
290
- <option value="0">0</option>
291
- <option value="0x10">0x10</option>
292
- <option value="0x20">0x20</option>
293
- <option value="0x30">0x30</option>
294
- <option value="0x40">0x40</option>
295
- <option value="0x50">0x50</option>
296
- <option value="0x60">0x60</option>
297
- <option value="0x70">0x70</option>
298
- </select>
299
- </div>
300
-
301
- <div class="form-row" style="align-items: center; display: flex;">
302
- <label for="node-input-discover_polling_schedule_value"><i class="icon-tag"></i> <span data-i18n="bitpool-bacnet.label.bacnet_polling_schedule"></span>Global Discover Frequency</label>
303
- <p style="margin-right: 5px; margin-bottom: 0px; padding-left: 7px;">Every</p>
304
- <input type="text" id="node-input-discover_polling_schedule" style="display: none;">
305
- <input type="text" id="node-input-discover_polling_schedule_value" placeholder="5" style="width: 70px; margin-right: 5px;">
306
- <select name="timePeriod" id="node-input-discover_polling_schedule_options" style="width: 120px; margin-right: 5px;">
307
- <option value="Seconds">Seconds</option>
308
- <option value="Minutes">Minutes</option>
309
- <option value="Hours">Hours</option>
310
- <option value="Days">Days</option>
311
- </select>
312
- </div>
313
-
314
- <div class="form-row">
315
- <label for="node-input-toLog">
316
- Log found device:
317
- </label>
318
- <input type="checkbox" id="node-input-toLogIam" style="width: auto;"/>
319
- </div>
313
+ <div id='node-input-tabs-content'>
314
+ <div id='read-properties-tab' style='display:none'>
315
+ <div class="form-row">
316
+ <label for="node-input-name"><i class="icon-tag"></i><span data-i18n="bitpool-bacnet.label.name"></span> Name</label>
317
+ <input type="text" id="node-input-name" placeholder="Name">
318
+ </div>
319
+
320
+ <div class='form-row node-input-read-tabs-row'>
321
+ <ul style='min-width:600px;margin-bottom:20px' id='node-input-read-tabs'></ul>
322
+ </div>
323
+
324
+ <div class="form-row" id="networkInterfaceDiv">
325
+ <label for="node-input-local_device_address"><i class="icon-tag"></i><span data-i18n="bitpool-bacnet.label.local_device_address"></span> Network Interface</label>
326
+ <select id="node-input-local_device_address" style="width: 70%;" >
327
+ </select>
328
+ </div>
329
+
330
+ <div class="form-row">
331
+ <label for="node-input-broadCastAddr"><i class="icon-tag"></i><span data-i18n="bitpool-bacnet.label.broadCastAddr"></span> Broadcast Address </label>
332
+ <input type="text" id="node-input-broadCastAddr" placeholder="255.255.255.255">
333
+ </div>
334
+
335
+ <div class="form-row">
336
+ <label for="node-input-local_device_port"><i class="icon-tag"></i><span data-i18n="bitpool-bacnet.label.local_device_port"></span> Local Device Port</label>
337
+ <input type="text" id="node-input-local_device_port" placeholder="47808">
338
+ </div>
339
+
340
+ <div class="form-row">
341
+ <label for="node-input-deviceId"><i class="icon-tag"></i><span data-i18n="bitpool-bacnet.label.deviceId"></span> Device ID </label>
342
+ <input type="text" id="node-input-deviceId" placeholder="817001">
343
+ </div>
344
+
345
+ <div class="form-row deviceIdRange">
346
+ <label for="node-input-device_id_range"><i class="icon-tag"></i><span data-i18n="bitpool-bacnet.label.device_id_range"></span> Device ID Range </label>
347
+ <input type="checkbox" id="node-input-device_id_range_enabled" style="width: auto;"/>
348
+ <a style="padding-left: 60px;">Start: </a><input type="number" id="node-input-device_id_range_start" style="width: 125px;" min="0" max="4194303"/>
349
+ <a style="padding-left: 35px;">End: </a><input type="number" id="node-input-device_id_range_end" style="width: 125px;" min="1" max="4194303"/>
350
+ </div>
351
+ </div>
352
+
353
+ <div id='read-discover-tab' style='display:none'>
354
+
355
+ <div class="form-row">
356
+ <label for="node-input-apduTimeout"><i class="icon-tag"></i> <span data-i18n="bitpool-bacnet.label.apduTimeout"></span>Apdu Timeout</label>
357
+ <input type="text" id="node-input-apduTimeout" placeholder="10000">
358
+ </div>
359
+
360
+ <div class="form-row">
361
+ <label for="node-input-apduSize"><i class="icon-tag"></i> <span data-i18n="bitpool-bacnet.label.apduSize"></span>Max Apdu Size</label>
362
+ <select id="node-input-apduSize">
363
+ <option value="0">0</option>
364
+ <option value="1">1</option>
365
+ <option value="2">2</option>
366
+ <option value="3">3</option>
367
+ <option value="4">4</option>
368
+ <option value="5">5</option>
369
+ </select>
370
+ </div>
371
+
372
+ <div class="form-row">
373
+ <label for="node-input-maxSegments"><i class="icon-tag"></i> <span data-i18n="bitpool-bacnet.label.maxSegments"></span>Max Segments</label>
374
+ <select id="node-input-maxSegments">
375
+ <option value="0">0</option>
376
+ <option value="0x10">0x10</option>
377
+ <option value="0x20">0x20</option>
378
+ <option value="0x30">0x30</option>
379
+ <option value="0x40">0x40</option>
380
+ <option value="0x50">0x50</option>
381
+ <option value="0x60">0x60</option>
382
+ <option value="0x70">0x70</option>
383
+ </select>
384
+ </div>
385
+
386
+ <div class="form-row" style="align-items: center; display: flex;">
387
+ <label for="node-input-discover_polling_schedule_value"><i class="icon-tag"></i> <span data-i18n="bitpool-bacnet.label.bacnet_polling_schedule"></span>Discover Frequency</label>
388
+ <p style="margin-right: 5px; margin-bottom: 0px; padding-left: 7px;">Every</p>
389
+ <input type="text" id="node-input-discover_polling_schedule" style="display: none;">
390
+ <input type="text" id="node-input-discover_polling_schedule_value" placeholder="5" style="width: 70px; margin-right: 5px;">
391
+ <select name="timePeriod" id="node-input-discover_polling_schedule_options" style="width: 120px; margin-right: 5px;">
392
+ <option value="Seconds">Seconds</option>
393
+ <option value="Minutes">Minutes</option>
394
+ <option value="Hours">Hours</option>
395
+ <option value="Days">Days</option>
396
+ </select>
397
+ </div>
398
+
399
+ <div class="form-row deviceIdRange">
400
+ <label for="node-input-device_id_range"><i class="icon-tag"></i><span data-i18n="bitpool-bacnet.label.device_id_range"></span>Point Discovery Range </label>
401
+ <input type="checkbox" id="node-input-manual_instance_range_enabled" style="width: auto;"/>
402
+ <a style="padding-left: 60px;">Start: </a><input type="number" id="node-input-manual_instance_range_start" style="width: 125px;" min="0" max="100000"/>
403
+ <a style="padding-left: 35px;">End: </a><input type="number" id="node-input-manual_instance_range_end" style="width: 125px;" min="1" max="100000"/>
404
+ </div>
405
+
406
+ <div class="form-row">
407
+ <label for="node-input-toLog">
408
+ Log found device:
409
+ </label>
410
+ <input type="checkbox" id="node-input-toLogIam" style="width: auto;"/>
411
+ </div>
412
+
413
+ <div class="form-row">
414
+ <label for="node-input-logErrorToConsole">
415
+ Log BACnet errors to console:
416
+ </label>
417
+ <input type="checkbox" id="node-input-logErrorToConsole" style="width: auto;"/>
418
+ </div>
419
+
420
+ </div>
421
+ <div id='read-server-tab' style='display:none'>
422
+ <div class="form-row">
423
+ <label for="node-input-serverEnabled">
424
+ Enabled:
425
+ </label>
426
+ <input type="checkbox" id="node-input-serverEnabled" style="width: auto;"/>
427
+ </div>
428
+
429
+ <div class="form-row" style="align-items: center; display: flex;">
430
+ <label for="node-input-bacnetServerRebuildSchedule_value"><i class="icon-tag"></i> <span data-i18n="bitpool-bacnet.label.bacnetServerRebuildSchedule"></span>Clear Server Points:</label>
431
+ <p style="margin-right: 5px; margin-bottom: 0px; padding-left: 7px;">Every</p>
432
+ <input type="text" id="node-input-bacnetServerRebuildSchedule" style="display: none;">
433
+ <input type="text" id="node-input-bacnetServerRebuildSchedule_value" placeholder="5" style="width: 70px; margin-right: 5px;">
434
+ <select name="timePeriod" id="node-input-bacnetServerRebuildSchedule_options" style="width: 120px; margin-right: 5px;">
435
+ <option value="Seconds">Seconds</option>
436
+ <option value="Minutes">Minutes</option>
437
+ <option value="Hours">Hours</option>
438
+ <option value="Days">Days</option>
439
+ </select>
440
+ </div>
441
+ </div>
320
442
 
321
443
  </script>
322
444
  <script type="text/html" data-help-name="Bacnet-Gateway">
323
445
  <p> This node is the brain of the Bitpool BACnet node collection. It acts are the gateway for all BACnet communications and functionality for the collection. </p>
324
446
 
325
- <h3><strong>Properties</strong></h3>
326
- <ol class="node-ports">
447
+ <h3><strong>Gateway Tab</strong></h3>
448
+ <ul class="node-ports">
327
449
  <li>Network Interface - the desired interface for the bacstack client to bind to. This interface must not have any other BACnet clients bound to it.</li>
328
450
  <li>Broadcast Address - the desired subnet for global msgs to be broadcast and recieved on. This should be as strict as possible. Use 255.255.255.255 if unsure.</li>
329
451
  <li>Local Device Port - the port to be used for BACnet comms. Default is 47808</li>
452
+
453
+ </ul>
454
+
455
+ <h3><strong>Discovery Tab</strong></h3>
456
+ <ul class="node-ports">
330
457
  <li>APDU Timeout - BACnet msg timeout option</li>
331
458
  <li>Max APDU Size - BACnet max apdu size</li>
332
459
  <li>Max Segments - BACnet max segments</li>
333
460
  <li>Global Discover Frequency - the frequency at which the gateway issues global WhoIs BACnet commands. This should be limited to the least amount possible, as over-loading a network can be a serious issue with BACnet commmunications.</li>
461
+ <li>Manual Point Discovery Instance Range - if a BACnet device doesnt have a Object list (BACnet objectType:propertyId - 8:76), the this bacnet client will enter into manual discovery mode, where it iterates through types and instnace ranges. This range can be used to limit this manual scanning </li>
334
462
  <li>Log Device Found - toggles logging of found devices to the node-red debug tab.</li>
335
- </ol>
463
+ <li>Log BACnet Errors to Console - toggles logging of BACnet related errors to the node-red console</li>
464
+ </ul>
465
+
466
+ <h3><strong>Server Tab</strong></h3>
467
+ <p>This section provides the ability to simulate a BACnet device and BACnet points using node-red. </p>
468
+ <p>Injecting a msg.topic and msg.payload into the gateway node will create a virtual point that can be discovered by other devices via BACnet/IP</p>
469
+ <p>This node only supports 2 BACnet object types, Analog Value - to show numeric data, and a Character String - to show string data.</p>
470
+ <ul class="node-ports">
471
+ <li>Enabled - toggles whether or not the local BACnet server is started or not. </li>
472
+ <li>Clear Server Points - a schedule for the locally generated BACnet points to get cleared from the node object store</li>
473
+ </ul>
474
+
475
+ <h3><strong>Examples</strong></h3>
476
+ <p>For example flows, please use the examples section for this node. These examples can be found at: Node-red hamburger menu on top right -> Import -> Examples -> @bitpoolos/edge-bacnet</p>
477
+ <p>To find screen shot examples of settings and flows, please go to our wiki <a href="https://wiki.bitpool.com/en/edge/apps/bitpool-edge/nr-bacnet">here</a></p>
478
+
336
479
 
337
480
  <h3>Resources:</h3>
338
481
  <h4><strong>Online Docs:</strong></h4>