1 
2 /*
3 * Copyright (C) 2015-2020 Alibaba Group Holding Limited
4 * This file autogenerated for jsapi
5 */
6 
7 #include <stdio.h>
8 #include <string.h>
9 #include "amp_config.h"
10 #include "addons/libjs.h"
11 
12 #ifdef JSE_HIGHLEVEL_JSAPI
13 
14 libjs_entry_t LIBJS_ENTRIES[] = {
15 #ifdef JSE_HW_ADDON_ADC
16      {"adc", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}var HW_ADC=function(){function a(b){if(_classCallCheck(this,a),!b||!b.id)throw new Error('options is invalid');this.options={id:b.id},this.success=b.success||function(){},this.fail=b.fail||function(){},this._open()}return _createClass(a,[{key:'_open',value:function a(){return this.adcInstance=__native.ADC.open(this.options.id),this.adcInstance?void this.success():void this.fail()}},{key:'readValue',value:function a(){if(!this.adcInstance)throw new Error('adc not init');return __native.ADC.read(this.adcInstance)}},{key:'close',value:function a(){if(!this.adcInstance)throw new Error('adc not init');__native.ADC.close(this.adcInstance)}}]),a}();function open(a){return new HW_ADC(a)}module.exports={open:open};"},
17 #endif
18 
19 #ifdef JSE_ADVANCED_ADDON_OTA
20      {"appota", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events'),UTILS_APPOTA=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));if(!a)throw new Error('options invalid');return c._init(a),c}return _inherits(b,a),_createClass(b,[{key:'_init',value:function b(a){__native.APPOTA.otaInit(a,function(a){this.emit('new',a)}.bind(this))}},{key:'download',value:function c(a,b){__native.APPOTA.otaDownload(a,b)}},{key:'verify',value:function c(a,b){__native.APPOTA.otaVerify(a,b)}},{key:'report',value:function c(a){var b=__native.APPOTA.otaReport(a);0>b&&this.emit('error')}},{key:'upgrade',value:function c(a,b){__native.APPOTA.otaUpgrade(a,b)}}]),b}(EventEmitter);function open(a){return new UTILS_APPOTA(a)}module.exports={open:open};"},
21 #endif
22 
23 #ifdef JSE_CORE_ADDON_AT
24      {"at", "'use strict';module.exports=__native.AT;"},
25 #endif
26 
27 #ifdef JSE_ADVANCED_ADDON_AUDIOPLAYER
28      {"audioplayer", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events');module.exports=new(function(a){function b(){_classCallCheck(this,b);var a=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a._onState(),a}return _inherits(b,a),_createClass(b,[{key:'play',value:function c(a,b){if(!a||!b)throw new Error('invalid params');return __native.audioplayer.play(a,b)}},{key:'pause',value:function a(){return __native.audioplayer.pause()}},{key:'resume',value:function a(){return __native.audioplayer.resume()}},{key:'stop',value:function a(){return __native.audioplayer.stop()}},{key:'seekto',value:function b(a){if(0>a)throw new Error('invalid params');return __native.audioplayer.seekto(a)}},{key:'getPosition',value:function a(){return __native.audioplayer.getPosition()}},{key:'getDuration',value:function a(){return __native.audioplayer.getDuration()}},{key:'getState',value:function a(){return __native.audioplayer.getState()}},{key:'_onState',value:function a(){__native.audioplayer.onState(function(a){this.emit('stateChange',a)}.bind(this))}},{key:'listPlay',value:function c(a,b){if(!a||!b)throw new Error('invalid params');return __native.audioplayer.listPlay(a,b)}},{key:'listPlayStop',value:function a(){return __native.audioplayer.listPlayStop()}},{key:'setVolume',value:function b(a){if(0>a)throw new Error('invalid params');return __native.audioplayer.setVolume(a)}},{key:'getVolume',value:function a(){return __native.audioplayer.getVolume()}}]),b}(EventEmitter));"},
29 #endif
30 
31 #ifdef JSE_CORE_ADDON_BATTERY
32      {"battery", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events');module.exports=new(function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this))}return _inherits(b,a),_createClass(b,[{key:'getConnectState',value:function a(){return __native.Battery.getConnectState()}},{key:'getVoltage',value:function a(){return __native.Battery.getVoltage()}},{key:'getLevel',value:function a(){return __native.Battery.getLevel()}},{key:'getTemperature',value:function a(){return __native.Battery.getTemperature()}}]),b}(EventEmitter));"},
33 #endif
34 
35 #ifdef JSE_ADVANCED_ADDON_BLECFGNET
36      {"blecfgnet", "'use strict';function start(){__native.BLECFGNET.start()}function recoveryWifi(){__native.BLECFGNET.recoveryWifi()}function recoveryDevInfo(){__native.BLECFGNET.recoveryDevInfo()}module.exports={start:start,recoveryWifi:recoveryWifi,recoveryDevInfo:recoveryDevInfo};"},
37 #endif
38 
39 #ifdef JSE_WIRELESS_ADDON_BT_HOST
40      {"bt_host", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events'),bt_host=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));if(!a)throw new Error('options is invalid');if(!0==c.inited)throw new Error('bt_host already inited');return c.options={deviceName:a.deviceName,conn_num_max:a.conn_num_max},c.success=a.success||function(){},c.failed=a.failed||function(){},c._init(),c}return _inherits(b,a),_createClass(b,[{key:'_init',value:function b(){console.log('bt_host native init');var a=__native.BT_HOST.init(this.options);0==a?(this.inited=!0,console.log('bt host inited'),this.success()):(console.log('bt host init failed'),this.failed())}},{key:'start_adv',value:function c(a){if(console.log('bt host start adv'),!1==this.inited)throw new Error('bt host not initialed');!0==this.adv_flag&&stop_adv();var b=__native.BT_HOST.start_adv(a,function(a,b){console.log('connect callback'+a+b),b?this.emit('connect',a):this.emit('disconnect',a)}.bind(this));0==b?(this.adv_flag=!0,a.success&&a.success()):a.failed&&a.failed()}},{key:'stop_adv',value:function c(a){if(!1==this.inited)throw new Error('bt host not initialed');if(!1!=this.adv_flag){var b=__native.BT_HOST.stop_adv();0==b?(a.success&&a.success(),this.adv_flag=!1):a.failed&&a.failed()}}},{key:'start_scan',value:function c(a){if(console.log('bt host start scan'),!1==this.inited)throw new Error('bt host not initialed');!0==this.scan_flag&&stop_scan();var b=__native.BT_HOST.start_scan(a,function(a,b,c,d){console.log('scan result callback addr:'+a+' data:'+d)}.bind(this));0==b?(this.scan_flag=!0,a.success&&a.success()):a.failed&&a.failed()}},{key:'stop_scan',value:function c(a){if(!1==this.inited)throw new Error('bt host not initialed');if(!1!=this.scan_flag){var b=__native.BT_HOST.stop_scan();0==b?(this.scan_flag=!1,a.success&&a.success()):a.failed&&a.failed()}}},{key:'add_service',value:function c(a){if(!1==this.inited)throw new Error('bt host not initialed');console.log('srvc_cfg: '+a.service);var b=__native.BT_HOST.add_service(a.service,function(a){console.log('len: '+a.len+', data: '+a),this.emit('onCharWrite',a)}.bind(this));console.log('add_service result: '+b),0==b?a.success&&a.success():a.failed&&a.failed()}},{key:'update_char',value:function c(a){if(!1==this.inited)throw new Error('bt host not initialed');var b=__native.BT_HOST.update_chars(a.arg);0==b?a.success&&a.success():a.failed&&a.failed()}}]),b}(EventEmitter);function open(a){return new bt_host(a)}module.exports={open:open};"},
41 #endif
42 
43 #ifdef JSE_HW_ADDON_CAN
44      {"can", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events'),HW_CAN=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));if(!a||!a.id)throw new Error('options is invalid');return c.options={id:a.id},c.success=a.success||function(){},c.fail=a.fail||function(){},c._open(),c._onData(),c}return _inherits(b,a),_createClass(b,[{key:'_open',value:function a(){return this.canInstance=__native.CAN.open(this.options.id),this.canInstance?void this.success():void this.fail()}},{key:'receive',value:function a(){if(!this.canInstance)throw new Error('can not init');return __native.CAN.receive(this.canInstance)}},{key:'_onData',value:function a(){if(!this.canInstance)throw new Error('can not init');__native.CAN.receive(this.canInstance,function(a,b,c){this.emit('data',a,b,c)}.bind(this))}},{key:'send',value:function c(a,b){if(!this.canInstance||!b)throw new Error('can not init or params is invalid');__native.CAN.send(this.canInstance,a,b)}},{key:'close',value:function a(){if(!this.canInstance)throw new Error('can not init');__native.CAN.close(this.canInstance)}}]),b}(EventEmitter);function open(a){return new HW_CAN(a)}module.exports={open:open};"},
45 #endif
46 
47 #ifdef JSE_CORE_ADDON_CHARGER
48      {"charger", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events');module.exports=new(function(a){function b(){_classCallCheck(this,b);var a=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a._onConnect(),a}return _inherits(b,a),_createClass(b,[{key:'_onConnect',value:function a(){__native.Charger.onConnect(function(a){this.emit('connect',a)}.bind(this))}},{key:'getState',value:function a(){return __native.Charger.getState()}},{key:'getConnectState',value:function a(){return __native.Charger.getConnectState()}},{key:'getCurrent',value:function a(){return __native.Charger.getCurrent()}},{key:'switch',value:function b(a){return __native.Charger.switch(a)}}]),b}(EventEmitter));"},
49 #endif
50 
51 #ifdef JSE_CORE_ADDON_CHECKSUM
52      {"checksum", "'use strict';function md5(a){if(!a)throw new Error('params is invalid');return __native.CHECKSUM.md5(a)}function crc16(a){if(!a)throw new Error('params is invalid');return __native.CHECKSUM.crc16(a)}function crc32(a){if(!a)throw new Error('params is invalid');return __native.CHECKSUM.crc32(a)}module.exports={md5:md5,crc16:crc16,crc32:crc32};"},
53 #endif
54 
55 #ifdef JSE_HW_ADDON_DAC
56      {"dac", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}var HW_DAC=function(){function a(b){if(_classCallCheck(this,a),!b||!b.id)throw new Error('options is invalid');this.options={id:b.id},this.success=b.success||function(){},this.fail=b.fail||function(){},this._open()}return _createClass(a,[{key:'_open',value:function a(){return this.dacInstance=__native.DAC.open(this.options.id),this.dacInstance?void this.success():void this.fail()}},{key:'readValue',value:function a(){if(!this.dacInstance)throw new Error('dac not init');return __native.DAC.getVol(this.dacInstance)}},{key:'writeValue',value:function b(a){if(!this.dacInstance||!a)throw new Error('dac not init or params is invalid');__native.DAC.setVol(this.dacInstance,a)}},{key:'close',value:function a(){if(!this.dacInstance)throw new Error('dac not init');__native.DAC.close(this.dacInstance)}}]),a}();function open(a){return new HW_DAC(a)}module.exports={open:open};"},
57 #endif
58 
59     {"device", "'use strict';var kv=require('kv');function setDeviceInfo(a,b){if(!a||!b)throw new Error('params is invalid');kv.setStorageSync('_amp_internal_productkey',a),kv.setStorageSync('_amp_internal_productsecret',b)}function setToken(a){if(!a)throw new Error('invalid params');kv.setStorageSync('_amp_device_token',a)}function getToken(){return kv.getStorageSync('_amp_device_token')}module.exports={setDeviceInfo:setDeviceInfo,setToken:setToken,getToken:getToken};"},
60 
61     {"events", "'use strict';var spliceOne;function EventEmitter(){EventEmitter.init.call(this)}EventEmitter.EventEmitter=EventEmitter,EventEmitter.usingDomains=!1,EventEmitter.prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var defaultMaxListeners=10;Object.defineProperty(EventEmitter,'defaultMaxListeners',{enumerable:!0,get:function a(){return defaultMaxListeners},set:function b(a){if('number'!=typeof a||0>a||Number.isNaN(a))throw new Error('defaultMaxListeners:a non-negative number');defaultMaxListeners=a}}),EventEmitter.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function(a){if('number'!=typeof a||0>a||Number.isNaN(a))throw new Error('a non-negative number');this._maxListeners=a;var b=this;return b};function _getMaxListeners(a){return void 0===a._maxListeners?EventEmitter.defaultMaxListeners:a._maxListeners}EventEmitter.prototype.getMaxListeners=function(){return _getMaxListeners(this)};function longestSeqContainedIn(c,a){for(var b=c.length;3<=b;--b)for(var d=0;d<c.length-b;++d)for(var e,f=0;f<a.length-b;++f){e=!0;for(var g=0;g<b;++g)if(c[d+g]!==a[f+g]){e=!1;break}if(e)return[b,d,f]}return[0,0,0]}function enhanceStackTrace(a,b){var c=a.stack.split('\\n').slice(1),d=b.stack.split('\\n').slice(1),e=longestSeqContainedIn(d,c);0<e.len&&d.splice(e.off+1,e.len-1,'    [... lines matching original stack trace ...]'),a.stack=a.stack+'\\nEmitted \\'error\\' event at:\\n'+d.join('\\n')}EventEmitter.prototype.emit=function(a){var b='error'===a,c=this._events;if(c!==void 0)b=b&&c.error===void 0;else if(!b)return!1;for(var d=[],e=1,f=arguments.length;e<f;e++)d.push(arguments[e]);if(b){var g;if(0<d.length&&(g=d[0]),g instanceof Error)throw g;throw new Error('unhandled error')}var h=c[a];if(h===void 0)return!1;if('function'==typeof h)Function.prototype.apply.call(h,this,d);else for(var f=h.length,j=arrayClone(h,f),e=0;e<f;++e)Function.prototype.apply.call(j[e],this,d);return!0};function _addListener(a,b,c,d){var e,f;if('function'!=typeof c)throw new Error('addListener invalid arg type: Function');return e=a._events,void 0===e?(e=a._events=Object.create(null),a._eventsCount=0):(void 0!==e.newListener&&(a.emit('newListener',b,c.listener?c.listener:c),e=a._events),f=e[b]),void 0===f?(f=e[b]=c,++a._eventsCount):'function'==typeof f?f=e[b]=d?[c,f]:[f,c]:d?f.unshift(c):f.push(c),a}EventEmitter.prototype.addListener=function(a,b){return _addListener(this,a,b,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function(a,b){return _addListener(this,a,b,!0)};function onceWrapper(){this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,Function.prototype.apply.call(this.listener,this.target,arguments))}function _onceWrap(a,b,c){var d={fired:!1,wrapFn:void 0,target:a,type:b,listener:c},e=onceWrapper.bind(d);return e.listener=c,d.wrapFn=e,e}EventEmitter.prototype.once=function(a,b){if('function'!=typeof b)throw new Error('listener invalid arg type');this.on(a,_onceWrap(this,a,b));var c=this;return c},EventEmitter.prototype.prependOnceListener=function(a,b){if('function'!=typeof b)throw new Error('prependOnceListener invalid arg type');this.prependListener(a,_onceWrap(this,a,b));var c=this;return c},EventEmitter.prototype.removeListener=function(a,b){var c,d,e,f,g,h=this;if('function'!=typeof b)throw new Error('removeListener invalid arg type');if(d=this._events,void 0===d)return h;if(c=d[a],void 0===c)return h;if(c===b||c.listener===b)0==--this._eventsCount?this._events=Object.create(null):(delete d[a],d.removeListener&&this.emit('removeListener',a,c.listener||b));else if('function'!=typeof c){for(e=-1,f=c.length-1;0<=f;f--)if(c[f]===b||c[f].listener===b){g=c[f].listener,e=f;break}if(0>e)return h;0===e?c.shift():(void 0===spliceOne&&(spliceOne=require('internal/util').spliceOne),spliceOne(c,e)),1===c.length&&(d[a]=c[0]),void 0!==d.removeListener&&this.emit('removeListener',a,g||b)}return h},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.removeAllListeners=function(a){var b,c,d,e=this;if(c=this._events,void 0===c)return e;if(void 0===c.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==c[a]&&(0==--this._eventsCount?this._events=Object.create(null):delete c[a]),e;if(0===arguments.length){var f,g=Object.keys(c);for(d=0;d<g.length;++d)f=g[d],'removeListener'===f||this.removeAllListeners(f);return this.removeAllListeners('removeListener'),this._events=Object.create(null),this._eventsCount=0,e}if(b=c[a],'function'==typeof b)this.removeListener(a,b);else if(void 0!==b)for(d=b.length-1;0<=d;d--)this.removeListener(a,b[d]);return e};function _listeners(a,b,c){var d=a._events;if(d===void 0)return[];var e=d[b];return void 0===e?[]:'function'==typeof e?c?[e.listener||e]:[e]:c?unwrapListeners(e):arrayClone(e,e.length)}EventEmitter.prototype.listeners=function(a){return _listeners(this,a,!0)},EventEmitter.prototype.rawListeners=function(a){return _listeners(this,a,!1)},EventEmitter.listenerCount=function(a,b){return'function'==typeof a.listenerCount?a.listenerCount(b):listenerCount.call(a,b)},EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(a){var b=this._events;if(b!==void 0){var c=b[a];if('function'==typeof c)return 1;if(void 0!==c)return c.length}return 0}EventEmitter.prototype.eventNames=function(){return 0<this._eventsCount?Function.prototype.apply.call(this._events):[]};function arrayClone(a,b){for(var c=Array(b),d=0;d<b;++d)c[d]=a[d];return c}function unwrapListeners(a){for(var b=Array(a.length),c=0;c<b.length;++c)b[c]=a[c].listener||a[c];return b}module.exports=EventEmitter;"},
62 
63 #ifdef JSE_CORE_ADDON_FS
64      {"fs", "'use strict';function writeSync(a,b,c){if(!a||!b)throw new Error('params is invalid');c=c||{flag:'w'},__native.FS.write(a,b,c)}function readSync(a){if(!a)throw new Error('invalid params');var b=__native.FS.read(a);if(!b)throw'file open error';return b}function unlinkSync(a){if(!a)throw new Error('invalid params');__native.FS.delete(a)}function totalSize(){return __native.FS.totalsize()}function usedSize(){return __native.FS.usedsize()}function freeSize(){return __native.FS.freesize()}module.exports={writeSync:writeSync,readSync:readSync,unlinkSync:unlinkSync,totalSize:totalSize,usedSize:usedSize,freeSize:freeSize};"},
65 #endif
66 
67 #ifdef JSE_HW_ADDON_GPIO
68      {"gpio", "\"use strict\";var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,\"value\"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError(\"Cannot call a class as a function\")}var HW_GPIO=function(){function a(b){if(_classCallCheck(this,a),!b||!b.id)throw new Error(\"options is invalid\");this.options={id:b.id},this.success=b.success||function(){},this.fail=b.fail||function(){},this._open()}return _createClass(a,[{key:\"_open\",value:function a(){return this.gpioInstance=__native.GPIO.open(this.options.id),this.gpioInstance?void this.success():void this.fail()}},{key:\"writeValue\",value:function b(a){if(!this.gpioInstance)throw new Error(\"gpio not init\");__native.GPIO.write(this.gpioInstance,a)}},{key:\"toggle\",value:function a(){if(!this.gpioInstance)throw new Error(\"gpio not init\");__native.GPIO.toggle(this.gpioInstance)}},{key:\"onIRQ\",value:function b(a){if(!this.gpioInstance||!a||!a.cb)throw new Error(\"gpio not init or params is invalid\");__native.GPIO.on(this.gpioInstance,a.cb)}},{key:\"readValue\",value:function a(){if(!this.gpioInstance)throw new Error(\"gpio not init\");return __native.GPIO.read(this.gpioInstance)}},{key:\"close\",value:function a(){if(!this.gpioInstance)throw new Error(\"gpio not init\");__native.GPIO.close(this.gpioInstance)}}]),a}();function open(a){return new HW_GPIO(a)}module.exports={open:open};"},
69 #endif
70 
71 #ifdef JSE_NET_ADDON_HTTP
72      {"http", "'use strict';module.exports=__native.HTTP;"},
73 #endif
74 
75 #ifdef JSE_HW_ADDON_I2C
76      {"i2c", "\"use strict\";var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,\"value\"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError(\"Cannot call a class as a function\")}var HW_I2C=function(){function a(b){if(_classCallCheck(this,a),!b||!b.id)throw new Error(\"options is invalid\");this.options={id:b.id},this.success=b.success||function(){},this.fail=b.fail||function(){},this._open()}return _createClass(a,[{key:\"_open\",value:function a(){return this.i2cInstance=__native.I2C.open(this.options.id),this.i2cInstance?void this.success():void this.fail()}},{key:\"write\",value:function b(a){if(!this.i2cInstance||!a)throw new Error(\"i2c not init or params is invalid\");__native.I2C.write(this.i2cInstance,a)}},{key:\"read\",value:function b(a){if(!this.i2cInstance||!a)throw new Error(\"i2c not init or params is invalid\");return __native.I2C.read(this.i2cInstance,a)}},{key:\"writeMem\",value:function c(a,b){if(!this.i2cInstance)throw new Error(\"i2c not init or params is invalid\");__native.I2C.writeReg(this.i2cInstance,a,b)}},{key:\"readMem\",value:function c(a,b){if(!this.i2cInstance)throw new Error(\"i2c not init or params is invalid\");return __native.I2C.readReg(this.i2cInstance,a,b)}},{key:\"close\",value:function a(){if(!this.i2cInstance)throw new Error(\"i2c not init\");__native.I2C.close(this.i2cInstance)}}]),a}();function open(a){return new HW_I2C(a)}module.exports={open:open};"},
77 #endif
78 
79 #if defined(JSE_ADVANCED_ADDON_AIOT_DEVICE) || defined(JSE_ADVANCED_ADDON_AIOT_GATEWAY)
80      {"iot", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events'),IotDeviceClient=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));if(!a||!a.productKey||!a.deviceName||!a.deviceSecret)throw new Error('device info error');return c.options={productKey:a.productKey,deviceName:a.deviceName,deviceSecret:a.deviceSecret,region:a.region||'cn-shanghai',keepaliveSec:a.keepaliveSec||60},c._connect(),c}return _inherits(b,a),_createClass(b,[{key:'_connect',value:function a(){__native.AIOT_DEVICE.device(this.options,function(a){if(a.handle)switch(this.IoTDeviceInstance=a.handle,a.code){case 0:this.emit('connect');break;case 1:this.emit('reconnect');break;case 2:this.emit('disconnect');break;case 3:this.emit('message',a);break;default:}}.bind(this))}},{key:'getDeviceHandle',value:function a(){return this.IoTDeviceInstance}},{key:'subscribe',value:function d(a,b){var c=__native.AIOT_DEVICE.subscribe(this.IoTDeviceInstance,a,b||function(){});if(0>c)throw new Error('subscribe topic error',a.topic);return c}},{key:'unsubscribe',value:function d(a,b){var c=__native.AIOT_DEVICE.unsubscribe(this.IoTDeviceInstance,a,b||function(){});if(0>c)throw new Error('unsubscribe topic error',a);return c}},{key:'publish',value:function d(a,b){var c=__native.AIOT_DEVICE.publish(this.IoTDeviceInstance,a,b||function(){});if(0>c)throw new Error('publish topic info error',a.topic);return c}},{key:'postProps',value:function d(a,b){var c=__native.AIOT_DEVICE.postProps(this.IoTDeviceInstance,a,b||function(){});if(0>c)throw new Error('post props error');return c}},{key:'onProps',value:function c(a){var b=__native.AIOT_DEVICE.onProps(this.IoTDeviceInstance,a);if(0>b)throw new Error('on props error');return b}},{key:'postEvent',value:function d(a,b){var c=__native.AIOT_DEVICE.postEvent(this.IoTDeviceInstance,a,b||function(){});if(0>c)throw new Error('post event error');return c}},{key:'onService',value:function c(a){var b=__native.AIOT_DEVICE.onService(this.IoTDeviceInstance,a);if(0>b)throw new Error('on service error');return b}},{key:'end',value:function c(a){var b=__native.AIOT_DEVICE.close(this.IoTDeviceInstance,a||function(){});if(0>b)throw new Error('end iot client error');return b}}]),b}(EventEmitter),IotGatewayClient=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));if(!a||!a.productKey||!a.deviceName||!a.deviceSecret)throw new Error('device info error');return c.options={productKey:a.productKey,deviceName:a.deviceName,deviceSecret:a.deviceSecret,keepaliveSec:a.keepaliveSec||60,region:a.region||'cn-shanghai'},c._on(),c._connect(),c}return _inherits(b,a),_createClass(b,[{key:'_connect',value:function a(){__native.AIOT_GATEWAY.gateway(this.options,function(a){a.handle&&0==a.code&&(this.IoTGatewayInstance=a.handle,this.emit('connect'))}.bind(this))}},{key:'_on',value:function a(){__native.AIOT_GATEWAY.onMqttMessage(function(a){switch(a.code){case 1:this.emit('reconnect');break;case 2:this.emit('disconnect');break;case 3:this.emit('message',a);break;default:}}.bind(this))}},{key:'addTopo',value:function d(a,b){var c=__native.AIOT_GATEWAY.addTopo(this.IoTGatewayInstance,a,b||function(){});if(0>c)throw new Error('add topo error');return c}},{key:'getTopo',value:function c(a){var b=__native.AIOT_GATEWAY.getTopo(this.IoTGatewayInstance,a||function(){});if(0>b)throw new Error('get topo error');return b}},{key:'removeTopo',value:function d(a,b){var c=__native.AIOT_GATEWAY.removeTopo(this.IoTGatewayInstance,a,b||function(){});if(0>c)throw new Error('remove topo error');return c}},{key:'login',value:function d(a,b){var c=__native.AIOT_GATEWAY.login(this.IoTGatewayInstance,a,b||function(){});if(0>c)throw new Error('aiot subdev login error');return c}},{key:'logout',value:function d(a,b){var c=__native.AIOT_GATEWAY.logout(this.IoTGatewayInstance,a,b||function(){});if(0>c)throw new Error('aiot subdev logout error');return c}},{key:'registerSubDevice',value:function d(a,b){var c=__native.AIOT_GATEWAY.registerSubDevice(this.IoTGatewayInstance,a,b||function(){});if(0>c)throw new Error('aiot register subdev error');return c}},{key:'subscribe',value:function d(a,b){var c=__native.AIOT_GATEWAY.subscribe(this.IoTGatewayInstance,a,b||function(){});if(0>c)throw new Error('subscribe topic error',options.topic);return c}},{key:'unsubscribe',value:function d(a,b){var c=__native.AIOT_GATEWAY.unsubscribe(this.IoTGatewayInstance,a,b||function(){});if(0>c)throw new Error('unsubscribe topic error',a);return c}},{key:'publish',value:function d(a,b){var c=__native.AIOT_GATEWAY.publish(this.IoTGatewayInstance,a,b||function(){});if(0>c)throw new Error('publish topic info error',a.topic);return c}}]),b}(EventEmitter);function dynreg(a,b){var c=__native.AIOT_DEVICE.register(a,b);if(0>c)throw new Error('dynmic register error');return c}function device(a){return new IotDeviceClient(a)}function gateway(a){return new IotGatewayClient(a)}module.exports={device:device,gateway:gateway,dynreg:dynreg};"},
81 #endif
82 
83 #ifdef JSE_ADVANCED_ADDON_KEYPAD
84      {"keypad", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events');module.exports=new(function(a){function b(){_classCallCheck(this,b);var a=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a._on(),a}return _inherits(b,a),_createClass(b,[{key:'open',value:function a(){return __native.Keypad.open()}},{key:'close',value:function a(){return this.removeAllListeners('keypadEvent'),__native.Keypad.close()}},{key:'_on',value:function a(){__native.Keypad.on(function(a,b){this.emit('keypadEvent',a,b)}.bind(this))}}]),b}(EventEmitter));"},
85 #endif
86 
87 #ifdef JSE_CORE_ADDON_KV
88      {"kv", "'use strict';module.exports=__native.KV;"},
89 #endif
90 
91 #ifdef JSE_ADVANCED_ADDON_LOCATION
92      {"location", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}var ADVANCED_LOCATION=function(){function a(){_classCallCheck(this,a)}return _createClass(a,[{key:'getAccessApInfo',value:function b(){var a;return a=__native.LOCATION.accessedWifi(),a}},{key:'getScannedApInfo',value:function b(){var a;return a=__native.LOCATION.scannedWifi(),a}},{key:'getAccessedLbsInfo',value:function b(){var a;return a=__native.LOCATION.accessedLbs(),a}},{key:'getNearLbsInfo',value:function b(){var a;return a=__native.LOCATION.nearbts(),a}}]),a}();function open(){return new ADVANCED_LOCATION}module.exports={open:open};"},
93 #endif
94 
95 #ifdef JSE_NET_ADDON_MQTT
96      {"mqtt", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events'),MQTTClient=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));if(!a||!a.host)throw new Error('options is invalid');return c.options={host:a.host,port:a.port||1883,client_id:a.clientId||c._getRandomClientId(),username:a.username||'',password:a.password||'',keepalive_interval:a.keepalive_interval||60},c._fail=a.fail||function(){},c._success=a.success||function(){},c.connected=!1,c._connect(),c}return _inherits(b,a),_createClass(b,[{key:'_getRandomClientId',value:function a(){return'amp-'+parseInt(1e6*Math.random())}},{key:'_connect',value:function a(){if(this.mqttInstance=__native.MQTT.start(this.options,function b(a){-2===a&&(this._fail(),this.emit('error','connect failed')),-1===a&&(this.connected=!1,this.emit('disconnect')),0===a&&(this.connected=!0,this._success(),this.emit('connect'))}.bind(this)),!this.mqttInstance)return this._fail(),void this.emit('error','connect failed')}},{key:'subscribe',value:function c(a){if(!this.mqttInstance||!a||!a.topic)throw new Error('mqtt not init or options invalid');if(!1===this.connected)return void this.emit('error','subscirbe fail: not connected');var b=__native.MQTT.subscribe(this.mqttInstance,a.topic,a.qos||0,function(a,b){this.emit('message',a,b)}.bind(this));0>b?('function'==typeof a.fail&&a.fail(),this.emit('error','subscribe error')):'function'==typeof a.success&&a.success()}},{key:'unsubscribe',value:function c(a){if(!this.mqttInstance||!a||!a.topic)throw new Error('mqtt not init or mqtt topic is invalid');if(!1===this.connected)return void this.emit('error','unsubscribe fail: not connected');var b=__native.MQTT.unsubscribe(this.mqttInstance,a.topic,function(){}.bind(this));return 0>b?('function'==typeof a.fail&&a.fail(),void this.emit('error','unsubscribe error')):void('function'==typeof a.success&&a.success())}},{key:'publish',value:function b(a){if(!this.mqttInstance||!a||!a.topic||!a.message)throw new Error('mqtt not init or options invalid');return!1===this.connected?void this.emit('error','publish fail: not connected'):void __native.MQTT.publish(this.mqttInstance,a.topic,a.message,a.qos||0,function(b){return 0>b?('function'==typeof a.fail&&a.fail(),void this.emit('error',a.topic)):void('function'==typeof a.success&&a.success())}.bind(this))}},{key:'close',value:function a(){if(!this.mqttInstance)throw new Error('mqtt not init');__native.MQTT.close(this.mqttInstance,function(a){return 0==a?void this.emit('close'):void this.emit('error','mqtt client close error')}.bind(this))}}]),b}(EventEmitter);function createClient(a){return new MQTTClient(a)}module.exports={createClient:createClient};"},
97 #endif
98 
99     {"netmgr", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events'),netMgr=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));if(!a||!a.name)throw new Error('device info error');return c.options={name:a.name},c.name=a.name,c._init(),c.dev_handler=c._getDev(),c}return _inherits(b,a),_createClass(b,[{key:'_init',value:function a(){0!==__native.NETMGR.serviceInit()&&this.emit('error','netmgr init error')}},{key:'_getDev',value:function b(){console.log('netMgr._getDev: '+this.name);var a=__native.NETMGR.getDev(this.name);return a?a:void this.emit('error','netmgr get dev error '+this.name)}},{key:'setMsgCb',value:function b(a){__native.NETMGR.setMsgCb(this.dev_handler,a)}},{key:'delMsgCb',value:function b(a){__native.NETMGR.delMsgCb(this.dev_handler,a)}},{key:'setAutoReconnect',value:function c(a){var b=__native.NETMGR.setAutoReconnect(this.dev_handler,a);0!==b&&this.emit('error','netmgr set auto reconnect error')}},{key:'connect',value:function b(a){a={ssid:a.ssid,password:a.password,bssid:a.bssid||'',timeout_ms:a.timeout_ms||18e3},__native.NETMGR.connect(this.dev_handler,a,function(b){return'DISCONNECT'==b?void this.emit('disconnect',a.ssid):void this.emit('connect',a.ssid)}.bind(this))}},{key:'disconnect',value:function b(){var a=__native.NETMGR.disconnect(this.dev_handler);return 0===a?void this.emit('disconnect',ssid):void this.emit('error','netmgr disconnect error')}},{key:'getState',value:function b(){var a=__native.NETMGR.getState(this.dev_handler);return 0===a?'disconnecting':1===a?'disconnected':2===a?'connecting':3===a?'connected':4===a?'obtaining ip':5===a?'network connected':6===a?'failed':void 0}},{key:'saveConfig',value:function b(){var a=__native.NETMGR.saveConfig(this.dev_handler);0!==a&&this.emit('error','netmgr save config error')}},{key:'setIfConfig',value:function c(a){a={dhcp_en:a.dhcp_en||!0,ip_addr:a.ip_addr||'',mask:a.mask||'',gw:a.gw||'',dns_server:a.dns_server||'',mac:a.mac||''};var b=__native.NETMGR.setIfConfig(this.dev_handler,a);0!==b&&this.emit('error','netmgr save config error')}},{key:'getIfConfig',value:function b(){var a=__native.NETMGR.getIfConfig(this.dev_handler);a||this.emit('error','get if config error')}}]),b}(EventEmitter);function openNetMgrClient(a){return new netMgr(a)}module.exports={openNetMgrClient:openNetMgrClient};"},
100 
101 #if defined(JSE_NET_ADDON_CELLULAR) || defined(JSE_NET_ADDON_WIFI)
102      {"network", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events'),netWork=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));if(!a||!a.type)throw new Error('net type is error');return c.options={type:a.type||'cellular',devName:a.devName||''},c._init(),c._cellularStatus(),c.dev_handler=c._getDev(c.devName),c}return _inherits(b,a),_createClass(b,[{key:'_init',value:function a(){0!==__native.NETMGR.serviceInit()&&this.emit('error','netmgr init error')}},{key:'_getDev',value:function c(a){var b=__native.NETMGR.getDev(a);return b?b:void this.emit('error','netmgr get dev error '+a)}},{key:'_cellularStatus',value:function b(){var a=this.type;'cellular'!=a||0!==__native.CELLULAR.onConnect(function b(a){1===a?this.emit('connect'):this.emit('disconnect')}.bind(this))&&this.emit('error','network status error')}},{key:'setMsgCb',value:function b(a){__native.NETMGR.setMsgCb(this.dev_handler,a)}},{key:'delMsgCb',value:function b(a){__native.NETMGR.delMsgCb(this.dev_handler,a)}},{key:'setAutoReconnect',value:function c(a){var b=__native.NETMGR.setAutoReconnect(this.dev_handler,a);0!==b&&this.emit('error','netmgr set auto reconnect error')}},{key:'connect',value:function b(a){a={ssid:a.ssid,password:a.password,bssid:a.bssid||'',timeout_ms:a.timeout_ms||18e3},__native.NETMGR.connect(this.dev_handler,a,function(b){return'DISCONNECT'==b?void this.emit('disconnect',a.ssid):void this.emit('connect',a.ssid)}.bind(this))}},{key:'disconnect',value:function b(){var a=__native.NETMGR.disconnect(this.dev_handler);return 0===a?void this.emit('disconnect',ssid):void this.emit('error','netmgr disconnect error')}},{key:'getStatus',value:function b(){if('wifi'==this.type){var a=__native.NETMGR.getState(this.dev_handler);switch(a){case 0:return'disconnecting';case 1:return'disconnected';case 2:return'connecting';case 3:return'connected';case 4:return'obtaining ip';case 5:return'network connected';case 6:return'failed';}}return'cellular'==this.type?1==__native.CELLULAR.getStatus()?'connect':'disconnect':void 0}},{key:'getInfo',value:function b(){var a={simInfo:null,locatorInfo:null,wifiInfo:null};return'wifi'==this.type?(a.wifiInfo=__native.WIFI.getIfConfig(),a):'cellular'==this.type?(a.simInfo=__native.CELLULAR.getSimInfo(),a.locatorInfo=__native.CELLULAR.getLocatorInfo(),a):void 0}},{key:'saveConfig',value:function b(){var a=__native.NETMGR.saveConfig(this.dev_handler);0!==a&&this.emit('error','netmgr save config error')}},{key:'setIfConfig',value:function c(a){a={dhcp_en:a.dhcp_en||!0,ip_addr:a.ip_addr||'',mask:a.mask||'',gw:a.gw||'',dns_server:a.dns_server||'',mac:a.mac||''};var b=__native.NETMGR.setIfConfig(this.dev_handler,a);0!==b&&this.emit('error','netmgr save config error')}},{key:'getIfConfig',value:function b(){var a=__native.NETMGR.getIfConfig(this.dev_handler);a||this.emit('error','get if config error')}}]),b}(EventEmitter);function openNetWorkClient(a){return new netWork(a)}module.exports={openNetWorkClient:openNetWorkClient};"},
103 #endif
104 
105     {"onewire", "\"use strict\";var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,\"value\"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError(\"Cannot call a class as a function\")}var HW_ONEWIRE=function(){function a(b){if(_classCallCheck(this,a),!b||!b.id)throw new Error(\"options is invalid\");this.options={id:b.id},this.success=b.success||function(){},this.fail=b.fail||function(){},this._open()}return _createClass(a,[{key:\"_open\",value:function a(){return this.onewireinstance=__native.ONEWIRE.open(this.options.id),this.onewireinstance?void this.success():void this.fail()}},{key:\"setspeed\",value:function b(a){if(!this.onewireinstance)throw new Error(\"onewire not init\");__native.ONEWIRE.setspeed(this.onewireinstance,a)}},{key:\"reset\",value:function a(){if(!this.onewireinstance)throw new Error(\"onewire not init\");__native.ONEWIRE.reset(this.onewireinstance)}},{key:\"readByte\",value:function a(){if(!this.onewireinstance)throw new Error(\"onewire not init\");return __native.ONEWIRE.readByte(this.onewireinstance)}},{key:\"writeByte\",value:function b(a){if(!this.onewireinstance)throw new Error(\"onewire not init\");return __native.ONEWIRE.writeByte(this.onewireinstance,a)}},{key:\"close\",value:function a(){if(!this.onewireinstance)throw new Error(\"onewire not init\");__native.ONEWIRE.close(this.onewireinstance)}}]),a}();function open(a){return new HW_ONEWIRE(a)}module.exports={open:open};"},
106 
107 #ifdef JSE_ADVANCED_ADDON_PAYBOX
108      {"paybox", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events'),PayboxClient=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));if(!a||!a.xpPrductKey||!a.xpDeviceSecret)throw new Error('device info error');return c.options={mqttPrductKey:a.mqttPrductKey?a.mqttPrductKey:'null',supplierId:a.supplierId?a.supplierId:'null',itemId:a.itemId?a.itemId:'null',boxModel:a.boxModel?a.boxModel:'null',boxVersion:a.boxVersion?a.boxVersion:'null',xpPrductKey:a.xpPrductKey,xpPrductSecret:a.xpPrductSecret?a.xpPrductSecret:'null',xpDeviceSecret:a.xpDeviceSecret},c.fail=a.fail||function(){},c.success=a.success||function(){},c.opened=!1,c.onFlag=!1,c._open(),c._on(),c}return _inherits(b,a),_createClass(b,[{key:'_open',value:function a(){return this.payboxInstance=__native.PAYBOX.open(this.options),0>this.payboxInstance?void this.fail():void(this.opened=!0,this.success())}},{key:'_on',value:function a(){if(0>this.payboxInstance)throw new Error('PAYBOX not init');__native.PAYBOX.on(this.payboxInstance,function(a,b){this.emit(a,b)}.bind(this))}},{key:'close',value:function b(){if(0>this.payboxInstance)throw new Error('device not init...');var a=__native.PAYBOX.close(this.payboxInstance);return 0==a?void(this.opened=!1,this.emit('close')):void this.emit('error','paybox client close falied')}}]),b}(EventEmitter);function open(a){return new PayboxClient(a)}module.exports={open:open};"},
109 #endif
110 
111 #ifdef JSE_CORE_ADDON_PM
112      {"pm", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events');module.exports=new(function(a){function b(){_classCallCheck(this,b);var a=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a._onPwrkey(),a}return _inherits(b,a),_createClass(b,[{key:'_onPwrkey',value:function a(){__native.PM.onPwrkey(function(a){this.emit('powerKey',a)}.bind(this))}},{key:'setAutosleepMode',value:function c(a){var b=__native.PM.setAutosleepMode(a);if(0>b)return void this.emit('error',b)}},{key:'getAutosleepMode',value:function b(){var a=__native.PM.getAutosleepMode();if(0>a)return void this.emit('error',a)}},{key:'sleep',value:function b(){var a=__native.PM.sleep();if(0>a)return void this.emit('error',a)}},{key:'powerReset',value:function b(){var a=__native.PM.powerReset();if(0>a)return void this.emit('error',a)}},{key:'powerDown',value:function b(){var a=__native.PM.powerDown();if(0>a)return void this.emit('error',a)}},{key:'wakelockLock',value:function b(){var a=__native.PM.wakelockLock();if(0>a)return void this.emit('error',a)}},{key:'wakelockUnlock',value:function b(){var a=__native.PM.wakelockUnlock();if(0>a)return void this.emit('error',a)}},{key:'wakelockTimedlock',value:function c(a){var b=__native.PM.wakelockTimedlock(a);if(0>b)return void this.emit('error',b)}}]),b}(EventEmitter));"},
113 #endif
114 
115 #ifdef JSE_HW_ADDON_PWM
116      {"pwm", "\"use strict\";var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,\"value\"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError(\"Cannot call a class as a function\")}var HW_PWM=function(){function a(b){if(_classCallCheck(this,a),!b||!b.id)throw new Error(\"options is invalid\");this.options={id:b.id},this.success=b.success||function(){},this.fail=b.fail||function(){},this._open()}return _createClass(a,[{key:\"_open\",value:function a(){return this.pwmInstance=__native.PWM.open(this.options.id),this.pwmInstance?void this.success():void this.fail()}},{key:\"set\",value:function b(a){if(!this.pwmInstance||!a)throw new Error(\"pwm not init or params is invalid\");__native.PWM.setConfig(this.pwmInstance,a)}},{key:\"get\",value:function a(){if(!this.pwmInstance)throw new Error(\"pwm not init\");return __native.PWM.getConfig(this.pwmInstance)}},{key:\"close\",value:function a(){if(!this.pwmInstance)throw new Error(\"pwm not init\");__native.PWM.close(this.pwmInstance)}}]),a}();function open(a){return new HW_PWM(a)}module.exports={open:open};"},
117 #endif
118 
119 #ifdef JSE_HW_ADDON_RTC
120      {"rtc", "'use strict';function start(){__native.RTC.open()}function setTime(a){if(!a)throw new Error('params is invalid');if(!(a instanceof Date))throw new Error('params is invalid');var b={year:a.getYear(),month:a.getMonth(),day:a.getDate(),hour:a.getHours(),minute:a.getMinutes(),second:a.getSeconds()};__native.RTC.setTime(b)}function getTime(){var a=__native.RTC.getTime();return console.log(a),new Date(parseInt(a.year)+1900,parseInt(a.month),parseInt(a.day),parseInt(a.hour),parseInt(a.minute),parseInt(a.second))}function close(){__native.RTC.close()}module.exports={start:start,setTime:setTime,getTime:getTime,close:close};"},
121 #endif
122 
123 #ifdef JSE_ADVANCED_ADDON_SMARTCARD
124      {"smartcard", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events');module.exports=new(function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this))}return _inherits(b,a),_createClass(b,[{key:'init',value:function a(){return __native.smartcard.init()}},{key:'deinit',value:function a(){return __native.smartcard.deinit()}},{key:'select',value:function b(a){return __native.smartcard.select(a)}}]),b}(EventEmitter));"},
125 #endif
126 
127 #ifdef JSE_HW_ADDON_SPI
128      {"spi", "\"use strict\";var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,\"value\"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError(\"Cannot call a class as a function\")}var HW_SPI=function(){function a(b){if(_classCallCheck(this,a),!b||!b.id)throw new Error(\"options is invalid\");this.options={id:b.id},this.success=b.success||function(){},this.fail=b.fail||function(){},this._open()}return _createClass(a,[{key:\"_open\",value:function a(){return this.spiInstance=__native.SPI.open(this.options.id),this.spiInstance?void this.success():void this.fail()}},{key:\"write\",value:function b(a){if(!this.spiInstance||!a)throw new Error(\"spi not init or params is invalid\");__native.SPI.write(this.spiInstance,a)}},{key:\"read\",value:function b(a){if(!this.spiInstance||!a)throw new Error(\"spi not init or params is invalid\");return __native.SPI.read(this.spiInstance,a)}},{key:\"readWrite\",value:function c(a,b){if(!this.spiInstance||!a||!b)throw new Error(\"spi not init or params is invalid\");return __native.SPI.sendRecv(this.spiInstance,a,b)}},{key:\"close\",value:function a(){if(!this.spiInstance)throw new Error(\"spi not init\");__native.SPI.close(this.spiInstance)}}]),a}();function open(a){return new HW_SPI(a)}module.exports={open:open};"},
129 #endif
130 
131 #ifdef JSE_NET_ADDON_TCP
132      {"tcp", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events');function stringToBytesArray(a){for(var b,c,d=[],e=0;e<a.length;e++){b=a.charCodeAt(e),c=[];do c.push(255&b),b>>=8;while(b);d=d.concat(c.reverse())}return d}var TCPClient=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));if(!a||!a.host||!a.port)throw new Error('invalid params');return c.options={host:a.host,port:a.port},c.success=a.success||function(){},c.fail=a.fail||function(){},c._connect(),c}return _inherits(b,a),_createClass(b,[{key:'_connect',value:function a(){this.connected=!1;0>__native.TCP.createSocket(this.options,function b(a){return 0>a?(this.fail(),void this.emit('error','tcp connect error')):void(this.tcpClientInstance=a,this.connected=!0,this.success(),this.emit('connect'),this._onListening())}.bind(this))&&(this.fail(),this.emit('error','tcp connect error'))}},{key:'send',value:function b(a){if(a.message instanceof Array||(a.message=stringToBytesArray(a.message)),!1===this.connected)throw new Error('tcp not connected');__native.TCP.send(this.tcpClientInstance,a.message,function(b){return 0>b?(this.emit('error','tcp send error'),void(a.fail&&a.fail())):void(this.emit('send','tcp send success'),a.success&&a.success())}.bind(this))}},{key:'_onListening',value:function a(){if(!this.tcpClientInstance)throw new Error('tcpserver not init');__native.TCP.recv(this.tcpClientInstance,function(a,b){return-2===a?(this.connected=!1,void this.emit('error','tcp receive message error')):-1===a?(this.connected=!1,void this.emit('disconnect')):void(0<a&&this.emit('message',b))}.bind(this))}},{key:'close',value:function b(){if(!this.tcpClientInstance)throw new Error('tcpserver not init');var a=__native.TCP.close(this.tcpClientInstance);return 0==a?void this.emit('close','tcp socket close success'):void this.emit('error','tcp socket close error')}},{key:'reconnect',value:function a(){this.tcpClientInstance&&__native.TCP.close(this.tcpClientInstance),this._connect()}}]),b}(EventEmitter);function createClient(a){return new TCPClient(a)}module.exports={createClient:createClient};"},
133 #endif
134 
135 #ifdef JSE_HW_ADDON_TIMER
136      {"timer", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}var HW_TIMER=function(){function a(b){if(_classCallCheck(this,a),!b||!b.id)throw new Error('options is invalid');this.options={id:b.id},this.success=b.success||function(){},this.fail=b.fail||function(){},this._open()}return _createClass(a,[{key:'_open',value:function a(){return this.timerInstance=__native.TIMER.open(this.options.id),this.timerInstance?void this.success():void this.fail()}},{key:'setTimeout',value:function d(a,b){if(!this.timerInstance)throw new Error('timer not init');var c=__native.TIMER.setTimeout(this.timerInstance,a,b);if(0!=c)throw new Error('set time out failed')}},{key:'clearTimeout',value:function b(){if(!this.timerInstance)throw new Error('timer not init');var a=__native.TIMER.clearTimeout(this.timerInstance);if(0!=a)throw new Error('clear time out failed')}},{key:'setInterval',value:function d(a,b){if(!this.timerInstance)throw new Error('timer not init');var c=__native.TIMER.setInterval(this.timerInstance,a,b);if(0!=c)throw new Error('set interval failed')}},{key:'clearInterval',value:function b(){if(!this.timerInstance)throw new Error('timer not init');var a=__native.TIMER.clearInterval(this.timerInstance);if(0!=a)throw new Error('clear interval failed')}},{key:'close',value:function a(){if(!this.timerInstance)throw new Error('timer not init');__native.TIMER.close(this.timerInstance)}}]),a}();function open(a){return new HW_TIMER(a)}module.exports={open:open};"},
137 #endif
138 
139 #ifdef JSE_ADVANCED_ADDON_TTS
140      {"tts", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events');module.exports=new(function(a){function b(){_classCallCheck(this,b);var a=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a._onState(),a}return _inherits(b,a),_createClass(b,[{key:'play',value:function c(a,b){if(!a)throw new Error('invalid params');return __native.TTS.play(a,b)}},{key:'stop',value:function a(){return __native.TTS.stop()}},{key:'getState',value:function a(){return __native.TTS.getState()}},{key:'_onState',value:function a(){__native.TTS.onState(function(a){this.emit('state',a)}.bind(this))}},{key:'setPitch',value:function b(a){if(!a)throw new Error('invalid params');return __native.TTS.setPitch(a)}},{key:'setSpeed',value:function b(a){if(!a)throw new Error('invalid params');return __native.TTS.setSpeed(a)}},{key:'getSpeed',value:function a(){return __native.TTS.getSpeed()}},{key:'setVolume',value:function b(a){if(!a)throw new Error('invalid params');return __native.TTS.setVolume(a)}},{key:'getVolume',value:function a(){return __native.TTS.getVolume()}}]),b}(EventEmitter));"},
141 #endif
142 
143 #ifdef JSE_HW_ADDON_UART
144      {"uart", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events'),HW_UART=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));if(!a||!a.id)throw new Error('options is invalid');return c.options={id:a.id,mode:a.mode},c.success=a.success||function(){},c.fail=a.fail||function(){},c._open(),'poll'!==c.options.mode&&c._onData(),c}return _inherits(b,a),_createClass(b,[{key:'_open',value:function a(){return this.uartInstance=__native.UART.open(this.options.id),null===this.uartInstance?void this.fail():void this.success()}},{key:'write',value:function b(a){if(null===this.uartInstance||!a)throw new Error('uart not init');__native.UART.write(this.uartInstance,a)}},{key:'read',value:function a(){if(null===this.uartInstance)throw new Error('uart not init');return __native.UART.read(this.uartInstance)}},{key:'off',value:function a(){if(null===this.uartInstance)throw new Error('uart not init');this.removeAllListeners('data')}},{key:'_onData',value:function a(){if(null===this.uartInstance)throw new Error('uart not init');__native.UART.on(this.uartInstance,function(a,b){this.emit('data',a,b)}.bind(this))}},{key:'close',value:function a(){if(null===this.uartInstance)throw new Error('uart not init');__native.UART.close(this.uartInstance)}},{key:'on_mode',value:function a(){if(null===this.uartInstance)throw new Error('uart not init');this._onData()}}]),b}(EventEmitter);function open(a){return new HW_UART(a)}module.exports={open:open};"},
145 #endif
146 
147 #ifdef JSE_NET_ADDON_UDP
148      {"udp", "'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=require('events');function stringToBytesArray(a){for(var b,c,d=[],e=0;e<a.length;e++){b=a.charCodeAt(e),c=[];do c.push(255&b),b>>=8;while(b);d=d.concat(c.reverse())}return d}var UDPClient=function(a){function b(){_classCallCheck(this,b);var a=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.udpClientInstance=__native.UDP.createSocket(),a.localPort=0,a}return _inherits(b,a),_createClass(b,[{key:'bind',value:function b(a){if(this.localPort=a||0,0>__native.UDP.bind(this.udpClientInstance,this.localPort))throw new Error('bind error');this._onListening()}},{key:'send',value:function b(a){a.message instanceof Array||(a.message=stringToBytesArray(a.message)),__native.UDP.sendto(this.udpClientInstance,a,function(b){return 0>b?(this.emit('error','udp send error'),void(a.fail&&a.fail())):void(this.emit('send','udp send success'),a.success&&a.success())}.bind(this))}},{key:'close',value:function b(){var a=__native.UDP.close(this.udpClientInstance);return 0>a?void console.log('close udp socket faild'):void this.emit('close','udp client close')}},{key:'_onListening',value:function a(){__native.UDP.recvfrom(this.udpClientInstance,function(a,b,c){return-4===c?void this.emit('error','udp client receive data error'):void(0<c&&this.emit('message',a,b))}.bind(this))}}]),b}(EventEmitter);function createSocket(a){return new UDPClient(a)}module.exports={createSocket:createSocket};"},
149 #endif
150 
151 #ifdef JSE_ADVANCED_ADDON_UI
152      {"ui", "'use strict';module.exports=__native.UI;"},
153 #endif
154 
155 #ifdef JSE_ADVANCED_ADDON_UND
156      {"und", "'use strict';module.exports=__native.UND;"},
157 #endif
158 
159 #ifdef JSE_ADVANCED_ADDON_UI
160      {"vm", "'use strict';module.exports=__native.VM;"},
161 #endif
162 
163 #ifdef JSE_HW_ADDON_WDG
164      {"wdg", "'use strict';function start(a){if(!a)throw new Error('params is invalid');__native.WDG.start(a)}function feed(){__native.WDG.feed()}function stop(){__native.WDG.stop()}module.exports={start:start,feed:feed,stop:stop};"},
165 #endif
166 
167     {"wifi", "'use strict';var event=require('events');function setIfConfig(a){if(!a)throw new Error('params is invalid');__native.WIFI.set_ifconfig(a)}function getIfConfig(){var a=__native.WIFI.get_ifconfig();if(!a)throw'get ifconfig failed';return a}function connect(a){if(!a)throw new Error('invalid params');__native.WIFI.connect(a,function(a){1==a&&(console.log('wifi connected success'),event.emit('connect'))})}function disconnect(){return __native.WIFI.disconnect()}function getState(){var a;return a=__native.WIFI.getState(),a}module.exports={setIfConfig:setIfConfig,getIfConfig:getIfConfig,connect:connect,disconnect:disconnect,getState:getState};"},
168 
169 #ifdef JSE_CORE_ADDON_INITJS
170     {"init", "globalThis=new Function(\"return this;\")(),globalThis.process=system,function(t){var n,e=t.Promise,o=e&&\"resolve\"in e&&\"reject\"in e&&\"all\"in e&&\"race\"in e&&(new e(function(t){n=t}),\"function\"==typeof n);\"undefined\"!=typeof exports&&exports?(exports.Promise=o?e:T,exports.Polyfill=T):\"function\"==typeof define&&define.amd?define(function(){return o?e:T}):o||(t.Promise=T);function r(){}var i=\"pending\",f=\"sealed\",c=\"fulfilled\",u=\"rejected\";function a(t){return\"[object Array]\"===Object.prototype.toString.call(t)}var s,h=\"undefined\"!=typeof setImmediate?setImmediate:setTimeout,l=[];function p(){for(var t=0;t<l.length;t++)l[t][0](l[t][1]);s=!(l=[])}function d(t,n){l.push([t,n]),s||(s=!0,h(p,1))}function y(t,n){function e(t){b(n,t)}try{t(function(t){_(n,t)},e)}catch(t){e(t)}}function w(t){var n=t.owner,e=n.state_,o=n.data_,r=t[e],i=t.then;if(\"function\"==typeof r){e=c;try{o=r(o)}catch(t){b(i,t)}}m(i,o)||(e===c&&_(i,o),e===u&&b(i,o))}function m(n,e){var o;try{if(n===e)throw new TypeError(\"A promises callback cannot return that same promise.\");if(e&&(\"function\"==typeof e||\"object\"==typeof e)){var t=e.then;if(\"function\"==typeof t)return t.call(e,function(t){o||(o=!0,(e!==t?_:v)(n,t))},function(t){o||(o=!0,b(n,t))}),1}}catch(t){return o||b(n,t),1}}function _(t,n){t!==n&&m(t,n)||v(t,n)}function v(t,n){t.state_===i&&(t.state_=f,t.data_=n,d(j,t))}function b(t,n){t.state_===i&&(t.state_=f,t.data_=n,d(P,t))}function g(t){var n=t.then_;t.then_=void 0;for(var e=0;e<n.length;e++)w(n[e])}function j(t){t.state_=c,g(t)}function P(t){t.state_=u,g(t)}function T(t){if(\"function\"!=typeof t)throw new TypeError(\"Promise constructor takes a function argument\");if(this instanceof T==!1)throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");this.then_=[],y(t,this)}T.prototype={constructor:T,state_:i,then_:null,data_:void 0,then:function(t,n){var e={owner:this,then:new this.constructor(r),fulfilled:t,rejected:n};return this.state_===c||this.state_===u?d(w,e):this.then_.push(e),e.then},catch:function(t){return this.then(null,t)}},T.all=function(c){if(!a(c))throw new TypeError(\"You must pass an array to Promise.all().\");return new this(function(e,t){var o=[],r=0;function n(n){return r++,function(t){o[n]=t,--r||e(o)}}for(var i,f=0;f<c.length;f++)(i=c[f])&&\"function\"==typeof i.then?i.then(n(f),t):o[f]=i;r||e(o)})},T.race=function(r){if(!a(r))throw new TypeError(\"You must pass an array to Promise.race().\");return new this(function(t,n){for(var e,o=0;o<r.length;o++)(e=r[o])&&\"function\"==typeof e.then?e.then(t,n):t(e)})},T.resolve=function(n){return n&&\"object\"==typeof n&&n.constructor===this?n:new this(function(t){t(n)})},T.reject=function(e){return new this(function(t,n){n(e)})}}(\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:this);"},
171 #endif
172 
173 };
174 
175 int libjs_num = (sizeof(LIBJS_ENTRIES)/ sizeof(LIBJS_ENTRIES[0]));
176 
177 #endif /* JSE_HIGHLEVEL_JSAPI */
178