UNPKG

@strato-automation/node-red-contrib-strato-automation

Version:
1 lines 6.75 kB
const a16_0x1fd020=a16_0x4562;(function(_0x31c142,_0x559692){const _0xe3c2c2=a16_0x4562,_0x3f5789=_0x31c142();while(!![]){try{const _0x4980eb=parseInt(_0xe3c2c2(0x13f))/0x1+-parseInt(_0xe3c2c2(0x130))/0x2+-parseInt(_0xe3c2c2(0x124))/0x3*(-parseInt(_0xe3c2c2(0x118))/0x4)+-parseInt(_0xe3c2c2(0x135))/0x5+-parseInt(_0xe3c2c2(0x11a))/0x6+-parseInt(_0xe3c2c2(0x13c))/0x7+parseInt(_0xe3c2c2(0x132))/0x8;if(_0x4980eb===_0x559692)break;else _0x3f5789['push'](_0x3f5789['shift']());}catch(_0x1617a7){_0x3f5789['push'](_0x3f5789['shift']());}}}(a16_0x5a4d,0x673af));function a16_0x4562(_0x4420b0,_0x1c25bd){_0x4420b0=_0x4420b0-0x111;const _0x5a4db4=a16_0x5a4d();let _0x45627e=_0x5a4db4[_0x4420b0];return _0x45627e;}const OCNAPIClient=require('../lib/ocnApiClient.js'),{parseBacnetTypeToInt}=require(a16_0x1fd020(0x125)),EventEmitter=require(a16_0x1fd020(0x11d));function a16_0x5a4d(){const _0x3143c3=['push','1677692ifaeor','deviceInstance','26388312VXTzPR','set','has','4141735UMkMkC','undefined','errorCallback','size','_mstpRetryCount','then','values','5631003ZLIARb','__doWork','log','107120FPyIRd','writeMultiplePropery','getTime','writeMstpObject','_mstpObjectToWriteMap','_mstpInterval','slice','callStatsEmitter','objectType','ocn_ip','nodeRed','https://','length','propertyId','options','/api/v1','exports','_ipMinSendTime','6392HOKPEC','_ipInterval','3230232pfOlAB','_ipTimeout','_ipRetryCount','events','_mstpTimeout','_maxIpObjectsToWrite','_maxMstpObjectsToWrite','\x20objects\x20written','value','emit','51aJBkhr','./bacnet.js','_mstpMinSendTime','error','status','isFinite','objectInstance','_ipObjectToWriteMap','call-stats','statusText','catch'];a16_0x5a4d=function(){return _0x3143c3;};return a16_0x5a4d();}class PresentValueUpdateService{[a16_0x1fd020(0x12b)]=new Map();[a16_0x1fd020(0x143)]=new Map();constructor(_0x1988cf,_0x2a15b8,_0x1886df,_0x2c0912,_0xd972cc,_0x5176e2,_0xa3bb54,_0x566edb,_0x351f95,_0x449545){const _0x154cec=a16_0x1fd020;this['errorCallback']=_0x1988cf,this[_0x154cec(0x11f)]=0x28,this[_0x154cec(0x120)]=0xf;const _0x5f5471=(_0x25364a,_0x11e221)=>{const _0x3b5638=_0x154cec;if(_0x25364a==null||_0x25364a==='')return _0x11e221;const _0x2c5329=Number(_0x25364a);if(!Number[_0x3b5638(0x129)](_0x2c5329)||_0x2c5329<=0x0)return _0x11e221;return Math['min'](0x2710,_0x2c5329);};this['_ipInterval']=_0x5f5471(_0x2a15b8,0x1f4),this[_0x154cec(0x117)]=_0x5f5471(_0x1886df,0x64),this[_0x154cec(0x11b)]=_0x5f5471(_0x2c0912,0x3e8),this[_0x154cec(0x11c)]=_0xd972cc||0x2,this[_0x154cec(0x144)]=_0x5f5471(_0x5176e2,0x64),this[_0x154cec(0x126)]=_0x5f5471(_0xa3bb54,0x1f4),this[_0x154cec(0x11e)]=_0x5f5471(_0x566edb,0xbb8),this[_0x154cec(0x139)]=_0x351f95||0x2,this[_0x154cec(0x146)]=new EventEmitter(),this[_0x154cec(0x149)]=_0x449545,setTimeout(()=>{const _0x21256d=_0x154cec;this[_0x21256d(0x13d)](this[_0x21256d(0x119)],this[_0x21256d(0x12b)],this[_0x21256d(0x11f)],this['_ipMinSendTime'],this['_ipTimeout'],this['_ipRetryCount']);},this['_ipInterval']),setTimeout(()=>{const _0x3bd86f=_0x154cec;this[_0x3bd86f(0x13d)](this[_0x3bd86f(0x144)],this[_0x3bd86f(0x143)],this['_maxMstpObjectsToWrite'],this[_0x3bd86f(0x126)],this['_mstpTimeout'],this[_0x3bd86f(0x139)]);},this[_0x154cec(0x144)]);}async[a16_0x1fd020(0x13d)](_0x4ca8d5,_0x2b237d,_0x5a1b8f,_0x44f878,_0x309bb1,_0x2fc7d3){const _0x8e11ac=a16_0x1fd020;try{const _0x3da66b=new Map();if(!_0x2b237d||_0x2b237d[_0x8e11ac(0x138)]==0x0)return;for(const [_0x3bf184,_0x2b6c7f]of _0x2b237d){if(!_0x3da66b[_0x8e11ac(0x134)](''+_0x2b6c7f[_0x8e11ac(0x131)]))_0x3da66b[_0x8e11ac(0x133)](''+_0x2b6c7f[_0x8e11ac(0x131)],[]);_0x3da66b['get'](''+_0x2b6c7f[_0x8e11ac(0x131)])['push'](_0x2b6c7f);}_0x2b237d['clear']();for(const [_0x837b41,_0x47d72a]of _0x3da66b){const _0x1981c1=[];for(let _0x27e647=0x0;_0x27e647<_0x47d72a?.[_0x8e11ac(0x112)];_0x27e647+=_0x5a1b8f){_0x1981c1[_0x8e11ac(0x12f)](_0x47d72a[_0x8e11ac(0x145)](_0x27e647,_0x27e647+_0x5a1b8f));}_0x3da66b[_0x8e11ac(0x133)](_0x837b41,_0x1981c1);}for(const [_0xb20bb1,_0x129b7e]of _0x3da66b){if(_0x129b7e[0x0]===undefined)continue;if(_0x129b7e[0x0][0x0]===undefined)continue;const _0x404c71=_0x129b7e[0x0][0x0][_0x8e11ac(0x131)];for(const _0x4a390f of _0x129b7e){const _0x5959e8={'values':_0x4a390f['map'](_0x38ff1e=>{const _0x48d9e0=_0x8e11ac;return{'objectType':parseBacnetTypeToInt(_0x38ff1e[_0x48d9e0(0x147)]),'objectInstance':Number(_0x38ff1e[_0x48d9e0(0x12a)]),'propertyId':Number(_0x38ff1e[_0x48d9e0(0x114)][_0x48d9e0(0x113)]),'priority':Number(_0x38ff1e[_0x48d9e0(0x114)]['priority']),'value':_0x38ff1e[_0x48d9e0(0x114)][_0x48d9e0(0x122)]};}),'retryCount':_0x2fc7d3,'timeoutMs':_0x309bb1},_0x202ccb=new Date()[_0x8e11ac(0x141)]();new OCNAPIClient(_0x8e11ac(0x111)+_0x4a390f[0x0][_0x8e11ac(0x148)]+_0x8e11ac(0x115),_0x4a390f[0x0]['ocn_token'],this[_0x8e11ac(0x149)])[_0x8e11ac(0x140)](_0x404c71,_0x5959e8)[_0x8e11ac(0x13a)](_0x3602ea=>{const _0x55e313=_0x8e11ac,_0x5509a3=new Date()[_0x55e313(0x141)]();!_0x3602ea['ok']?this[_0x55e313(0x137)]('Error\x20writing\x20to\x20device\x20'+_0x404c71+'\x20'+_0x3602ea[_0x55e313(0x12d)]+'\x20('+_0x3602ea[_0x55e313(0x128)]+')'):this['nodeRed'][_0x55e313(0x13e)]['info'](_0x5959e8[_0x55e313(0x13b)]?.[_0x55e313(0x112)]+_0x55e313(0x121)),this[_0x55e313(0x146)][_0x55e313(0x123)](_0x55e313(0x12c),{'deviceInstance':_0x404c71,'objectCount':_0x5959e8[_0x55e313(0x13b)]?.[_0x55e313(0x112)],'objects':_0x5959e8[_0x55e313(0x13b)],'time':_0x5509a3-_0x202ccb,'status':_0x3602ea[_0x55e313(0x128)]});})[_0x8e11ac(0x12e)](_0x4f0558=>{const _0x7886e1=_0x8e11ac;this[_0x7886e1(0x149)][_0x7886e1(0x13e)][_0x7886e1(0x127)](_0x4f0558),this[_0x7886e1(0x137)](_0x4f0558);}),await new Promise(_0x2091f2=>setTimeout(_0x2091f2,_0x44f878));}}}catch(_0x44162b){this[_0x8e11ac(0x149)][_0x8e11ac(0x13e)]['error'](_0x44162b);}finally{setTimeout(()=>{const _0xc3efbd=_0x8e11ac;this[_0xc3efbd(0x13d)](_0x4ca8d5,_0x2b237d,_0x5a1b8f,_0x44f878,_0x309bb1,_0x2fc7d3);},_0x4ca8d5);}}['writeIpObject'](_0x4e4bf4,_0x2e8425,_0x4d0534,_0x160cb2,_0x5b25f0,_0x533d18){const _0x2836f7=a16_0x1fd020,_0x4a2ac4=_0x4d0534+'-'+_0x160cb2+'-'+_0x5b25f0;this[_0x2836f7(0x12b)][_0x2836f7(0x133)](_0x4a2ac4,{'ocn_ip':_0x4e4bf4,'ocn_token':_0x2e8425,'deviceInstance':_0x4d0534,'objectType':_0x160cb2,'objectInstance':_0x5b25f0,'options':_0x533d18});}[a16_0x1fd020(0x142)](_0x1e012c,_0x106181,_0x37a730,_0x197ac8,_0x12289d,_0x2bfae6){const _0x28a9c3=a16_0x1fd020,_0x57ff9d=_0x37a730+'-'+_0x197ac8+'-'+_0x12289d;this[_0x28a9c3(0x143)][_0x28a9c3(0x133)](_0x57ff9d,{'ocn_ip':_0x1e012c,'ocn_token':_0x106181,'deviceInstance':_0x37a730,'objectType':_0x197ac8,'objectInstance':_0x12289d,'options':_0x2bfae6});}}typeof module!==a16_0x1fd020(0x136)&&typeof module[a16_0x1fd020(0x116)]!==a16_0x1fd020(0x136)&&(module['exports']=PresentValueUpdateService);