UNPKG

@iotize/tap

Version:

IoTize Device client for Javascript

16 lines (14 loc) 5.23 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@iotize/tap"),require("@iotize/tap/client/api"),require("@iotize/tap/client/impl"),require("@iotize/tap/service/core")):"function"==typeof define&&define.amd?define("@iotize/tap/service/impl/lora",["exports","@iotize/tap","@iotize/tap/client/api","@iotize/tap/client/impl","@iotize/tap/service/core"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).iotize=e.iotize||{},e.iotize.tap=e.iotize.tap||{},e.iotize.tap.service=e.iotize.tap.service||{},e.iotize.tap.service.impl=e.iotize.tap.service.impl||{},e.iotize.tap.service.impl.lora={}),e.iotize.tap,e.iotize.tap.client.api,e.iotize.tap.client.impl,e.iotize.tap.service.core)}(this,(function(e,t,o,i,r){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},n(e,t)};Object.create;function a(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var i,r,n=o.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(r)throw r.error}}return a}function s(e,t,o){if(o||2===arguments.length)for(var i,r=0,n=t.length;r<n;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;i.TapStreamReader.prototype.readLoraConfig=function(){var e={};return e.classA=this.readBoolean(1),e.classB=this.readBoolean(1),e.classC=this.readBoolean(1),e.dataLoggingEnabled=this.readBoolean(1),e.singlePacketEnabled=this.readBoolean(1),e},i.TapStreamWriter.prototype.writeLoraConfig=function(e){return this.writeBoolean(e.classA,1),this.writeBoolean(e.classB,1),this.writeBoolean(e.classC,1),this.writeBoolean(e.dataLoggingEnabled,1),this.writeBoolean(e.singlePacketEnabled,1),this};var p=function(){function e(){}return e.prototype.encode=function(e,t){return void 0===t&&(t=new i.TapStreamWriter),t.writeLoraConfig(e),t.toBytes},e.prototype.decode=function(e){return(e instanceof i.TapStreamReader?e:i.TapStreamReader.create(e)).readLoraConfig()},e}(),c=new p,l=Object.freeze({__proto__:null,loraConfig:c}),u=Object.assign(Object.assign({},r.converters),l),f={getIds:{method:o.TapRequestFrame.MethodType.GET,pathAlias:"/lora/ids",path:"/1024//90"},putIds:{method:o.TapRequestFrame.MethodType.PUT,pathAlias:"/lora/ids",path:"/1024//90"},getConfig:{method:o.TapRequestFrame.MethodType.GET,pathAlias:"/lora/config",path:"/1024//91",responseBodyDecoder:u.loraConfig},putConfig:{method:o.TapRequestFrame.MethodType.PUT,pathAlias:"/lora/config",path:"/1024//91",bodyEncoder:u.loraConfig}},d=function(e){function t(){var t=e.apply(this,s([],a(arguments)))||this;return t.resources=f,t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}(t,e),t.prototype.getIds=function(){return this.serviceCallRunner.execute(this.getIdsCall())},t.prototype.getIdsCall=function(){return Object.assign({},this.resources.getIds)},t.prototype.putIds=function(e){return this.serviceCallRunner.execute(this.putIdsCall(e))},t.prototype.putIdsCall=function(e){var t=Object.assign({},this.resources.putIds);return t.body=e,t},t.prototype.getConfig=function(){return this.serviceCallRunner.execute(this.getConfigCall())},t.prototype.getConfigCall=function(){return Object.assign({},this.resources.getConfig)},t.prototype.putConfig=function(e){return this.serviceCallRunner.execute(this.putConfigCall(e))},t.prototype.putConfigCall=function(e){var t=Object.assign({},this.resources.putConfig);return t.body=e,t},t}(t.AbstractService),h=t.extendServiceContainer("lora",d);e.LORA_SERVICE_CALLS=f,e.LoraConfigConverter=p,e.LoraResourceMetaData={"/lora/ids":{put:{minApiVersion:1,configModeRequired:!1,schema:{$ref:"./definitions.yaml#/Bytes"}}},"/lora/config":{put:{minApiVersion:1,configModeRequired:!1,schema:{$ref:"./definitions.yaml#/LoraConfig"}}}},e.LoraService=d,e._TAP_SERVICE_EXTENSION_LORA_=h,e.loraConverters=l,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=iotize-tap-service-impl-lora.umd.min.js.map