Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-bacnet

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-bacnet - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

bacnet/icons/bacnet-icon.png

2

bacnet/bacnet-write.js

@@ -1,2 +0,2 @@

"use strict";function _createForOfIteratorHelper(e,r){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=_unsupportedIterableToArray(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var a=0,n=function(){};return{s:n,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(l)throw o}}}}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}module.exports=function(r){var o=require("./core/bacnet-core"),l=require("node-bacnet"),s=require("underscore");r.nodes.registerType("BACnet-Write",function(e){r.nodes.createNode(this,e),this.name=e.name,this.objectType=parseInt(e.objectType),this.valueTag=parseInt(e.valueTag),this.valueValue=e.valueValue,this.propertyId=parseInt(e.propertyId),this.priority=Math.min(Math.max(parseInt(e.priority)||15,1),16),this.multipleWrite=e.multipleWrite,this.instance=r.nodes.getNode(e.instance),this.objectInstance=this.instance.instanceAddress||0,this.device=r.nodes.getNode(e.device),this.deviceIPAddress=this.device.deviceAddress||"127.0.0.1",this.connector=r.nodes.getNode(e.server);var n=this;n.status({fill:"green",shape:"dot",text:"active"}),n.on("input",function(a){if(n.connector){var e=a.payload.options||{priority:n.priority};if(n.multipleWrite){if(o.internalDebugLog("Multiple Write"),!a.payload.values||!a.payload.values[0].values)return void n.error(new Error("msg.payload.values missing or invalid array for multiple write"),a);a.payload.values.forEach(function(e){e.objectId||(e.objectId={type:n.objectType,instance:parseInt(n.objectInstance)})});try{o.internalDebugLog("writePropertyMultiple msg.payload.values: "+JSON.stringify(a.payload.values))}catch(e){o.internalDebugLog("writePropertyMultiple error: "+e)}n.connector.client.writePropertyMultiple(a.payload.deviceIPAddress||n.deviceIPAddress,a.payload.values,e,function(e,r){var t;e?(t=o.translateErrorMessage(e),o.internalDebugLog(t),n.error(t,a)):(a.input=a.payload,a.payload=r,n.send(a))})}else{if(o.internalDebugLog("Write"),a.payload.values&&!a.payload.values[0])return void n.error(new Error("invalid msg.payload.values array for write"),a);var r={type:n.objectType,instance:parseInt(n.objectInstance)},t=[{type:n.valueTag,value:n.valueValue}];try{o.internalDebugLog("readProperty default objectId: "+JSON.stringify(r)),o.internalDebugLog("writeProperty default values: "+JSON.stringify(t)),o.internalDebugLog("writeProperty msg.payload.values: "+JSON.stringify(a.payload.values)),o.internalDebugLog("writeProperty node.propertyId: "+n.propertyId)}catch(e){o.internalDebugLog("writeProperty error: "+e)}n.connector.client.writeProperty(a.payload.deviceIPAddress||n.deviceIPAddress,a.payload.objectId||r,a.payload.propertyId||n.propertyId,a.payload.values||t,e,function(e,r){var t;e?(t=o.translateErrorMessage(e),o.internalDebugLog(t),n.error(t,a)):(a.input=a.payload,a.payload=r,n.send(a))})}}else n.error(new Error("Client Not Ready To Write"),a)})}),r.httpAdmin.get("/bacnet/ApplicationTags",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.ApplicationTag,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)}),r.httpAdmin.get("/bacnet/PropertyIds",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.PropertyIdentifier,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)}),r.httpAdmin.get("/bacnet/ObjectTypes",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.ObjectType,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)})};
"use strict";function _createForOfIteratorHelper(e,r){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=_unsupportedIterableToArray(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var a=0,n=function(){};return{s:n,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(l)throw o}}}}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}module.exports=function(r){var o=require("./core/bacnet-core"),l=require("node-bacnet"),s=require("underscore");r.nodes.registerType("BACnet-Write",function(e){r.nodes.createNode(this,e),this.name=e.name,this.objectType=parseInt(e.objectType),this.valueTag=parseInt(e.valueTag),this.valueValue=e.valueValue,this.propertyId=parseInt(e.propertyId),this.priority=parseInt(e.priority),this.multipleWrite=e.multipleWrite,this.instance=r.nodes.getNode(e.instance),this.objectInstance=this.instance.instanceAddress||0,this.device=r.nodes.getNode(e.device),this.deviceIPAddress=this.device.deviceAddress||"127.0.0.1",this.connector=r.nodes.getNode(e.server);var n=this;n.status({fill:"green",shape:"dot",text:"active"}),n.on("input",function(a){if(n.connector){n.priority=n.priority<1?16:n.priority,n.priority=16<n.priority?16:n.priority;var e=a.payload.options||{priority:n.priority};if(n.multipleWrite){if(o.internalDebugLog("Multiple Write"),!a.payload.values||!a.payload.values[0].values)return void n.error(new Error("msg.payload.values missing or invalid array for multiple write"),a);a.payload.values.forEach(function(e){e.objectId||(e.objectId={type:n.objectType,instance:parseInt(n.objectInstance)})});try{o.internalDebugLog("writePropertyMultiple msg.payload.values: "+JSON.stringify(a.payload.values))}catch(e){o.internalDebugLog("writePropertyMultiple error: "+e)}n.connector.client.writePropertyMultiple(a.payload.deviceIPAddress||n.deviceIPAddress,a.payload.values,e,function(e,r){var t;e?(t=o.translateErrorMessage(e),o.internalDebugLog(t),n.error(t,a)):(a.input=a.payload,a.payload=r,n.send(a))})}else{if(o.internalDebugLog("Write"),a.payload.values&&!a.payload.values[0])return void n.error(new Error("invalid msg.payload.values array for write"),a);var r={type:n.objectType,instance:parseInt(n.objectInstance)},t=[{type:n.valueTag,value:n.valueValue}];try{o.internalDebugLog("readProperty default objectId: "+JSON.stringify(r)),o.internalDebugLog("writeProperty default values: "+JSON.stringify(t)),o.internalDebugLog("writeProperty msg.payload.values: "+JSON.stringify(a.payload.values)),o.internalDebugLog("writeProperty node.propertyId: "+n.propertyId)}catch(e){o.internalDebugLog("writeProperty error: "+e)}n.connector.client.writeProperty(a.payload.deviceIPAddress||n.deviceIPAddress,a.payload.objectId||r,a.payload.propertyId||n.propertyId,a.payload.values||t,e,function(e,r){var t;e?(t=o.translateErrorMessage(e),o.internalDebugLog(t),n.error(t,a)):(a.input=a.payload,a.payload=r,n.send(a))})}}else n.error(new Error("Client Not Ready To Write"),a)})}),r.httpAdmin.get("/bacnet/ApplicationTags",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.ApplicationTag,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)}),r.httpAdmin.get("/bacnet/PropertyIds",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.PropertyIdentifier,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)}),r.httpAdmin.get("/bacnet/ObjectTypes",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.ObjectType,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)})};
//# sourceMappingURL=maps/bacnet-write.js.map
{
"name": "node-red-contrib-bacnet",
"version": "0.2.3",
"version": "0.2.4",
"private": false,

@@ -43,6 +43,6 @@ "description": "The BACnet toolbox package for Node-RED.",

"test": "standard --fix && mocha test --recursive --reporter dot --timeout 5000",
"test:coverage": "istanbul cover _mocha --report lcovonly -- --recursive --timeout 5000 -R spec && cat ./coverage/lcov.info | codacy-coverage --token $CODACY_COVERAGE_TOKEN && rm -rf ./coverage",
"coverage": "standard --fix && gulp build && npm test && istanbul cover _mocha -- --recursive --timeout 5000",
"test-with-coverage": "istanbul cover _mocha --report lcovonly -- --recursive --timeout 5000 -R spec && cat ./coverage/lcov.info | codacy-coverage --token $CODACY_COVERAGE_TOKEN && rm -rf ./coverage",
"coverage": "npm run build && npm test && istanbul cover _mocha -- --recursive --timeout 5000",
"build": "standard --fix && gulp",
"prepublishOnly": "npm run rewrite-changelog && npm test",
"prepublishOnly": "npm run build && npm run rewrite-changelog && npm test",
"ci-publish": "ci-publish",

@@ -49,0 +49,0 @@ "release": "standard-version -a",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc