@iotize/tap
Version:
IoTize Device client for Javascript
16 lines (14 loc) • 15.1 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@iotize/tap"),require("@iotize/tap/client/api"),require("@iotize/tap/service/core")):"function"==typeof define&&define.amd?define("@iotize/tap/service/impl/wifi",["exports","@iotize/tap","@iotize/tap/client/api","@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.wifi={}),e.iotize.tap,e.iotize.tap.client.api,e.iotize.tap.service.core)}(this,(function(e,t,i,o){"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 r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},r(e,t)};Object.create;function s(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var o,r,s=i.call(e),n=[];try{for(;(void 0===t||t-- >0)&&!(o=s.next()).done;)n.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return n}function n(e,t,i){if(i||2===arguments.length)for(var o,r=0,s=t.length;r<s;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var p,a,u,l;Object.create;e.WifiMode=void 0,(p=e.WifiMode||(e.WifiMode={}))[p.PEER_TO_PEER=0]="PEER_TO_PEER",p[p.NETWORK=1]="NETWORK",e.WifiProtocol=void 0,(a=e.WifiProtocol||(e.WifiProtocol={}))[a.B=1]="B",a[a.G=2]="G",a[a.N=4]="N",e.WifiSSIDVisibility=void 0,(u=e.WifiSSIDVisibility||(e.WifiSSIDVisibility={}))[u.VISIBLE=0]="VISIBLE",u[u.HIDDEN_FROM_SCAN=1]="HIDDEN_FROM_SCAN",u[u.HIDDEN=2]="HIDDEN",e.WifiKeyVisibility=void 0,(l=e.WifiKeyVisibility||(e.WifiKeyVisibility={}))[l.VISIBLE=0]="VISIBLE",l[l.HIDDEN=1]="HIDDEN";var c=o.createEnumConverter(e.WifiMode,1),y=o.createEnumArrayConverter(e.WifiMode,1),d=o.createEnumConverter(e.WifiProtocol,1),h=o.createEnumArrayConverter(e.WifiProtocol,1),f=o.createEnumConverter(e.WifiSSIDVisibility,1),g=o.createEnumArrayConverter(e.WifiSSIDVisibility,1),m=o.createEnumConverter(e.WifiKeyVisibility,1),b=o.createEnumArrayConverter(e.WifiKeyVisibility,1),C=Object.freeze({__proto__:null,wifiMode:c,wifiModeArray:y,wifiProtocol:d,wifiProtocolArray:h,wifiSSIDVisibility:f,wifiSSIDVisibilityArray:g,wifiKeyVisibility:m,wifiKeyVisibilityArray:b}),w=Object.assign(Object.assign({},o.converters),C),T={getMode:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/mode",path:"/1024//15",responseBodyDecoder:w.wifiMode},putMode:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/mode",path:"/1024//15",bodyEncoder:w.wifiMode},getKey:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/key",path:"/1024//16",responseBodyDecoder:w.ascii},putKey:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/key",path:"/1024//16",bodyEncoder:w.ascii},getHostname:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/hostname",path:"/1024//35",responseBodyDecoder:w.ascii},getIp:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/ip",path:"/1024//30",responseBodyDecoder:w.stringIpv4},putIp:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/ip",path:"/1024//30",bodyEncoder:w.stringIpv4},getGatewayIp:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/gateway-ip",path:"/1024//31",responseBodyDecoder:w.stringIpv4},putGatewayIp:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/gateway-ip",path:"/1024//31",bodyEncoder:w.stringIpv4},getIpMask:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/ip-mask",path:"/1024//32",responseBodyDecoder:w.stringIpv4mask},putIpMask:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/ip-mask",path:"/1024//32",bodyEncoder:w.stringIpv4mask},getDnsIp:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/dns-ip",path:"/1024//124",responseBodyDecoder:w.stringIpv4},putDnsIp:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/dns-ip",path:"/1024//124",bodyEncoder:w.stringIpv4},getSSID:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/ssid",path:"/1024//25",responseBodyDecoder:w.ascii},putSSID:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/ssid",path:"/1024//25",bodyEncoder:w.ascii},getCountryCode:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/country-code",path:"/1024//95",responseBodyDecoder:w.uint16},putCountryCode:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/country-code",path:"/1024//95",bodyEncoder:w.uint16},getProtocol:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/protocol",path:"/1024//96",responseBodyDecoder:w.wifiProtocol},putProtocol:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/protocol",path:"/1024//96",bodyEncoder:w.wifiProtocolArray},getTxPower:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/tx-power",path:"/1024//97",responseBodyDecoder:w.int8},putTxPower:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/tx-power",path:"/1024//97",bodyEncoder:w.int8},getSSIDVisibility:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/ssid-visibility",path:"/1024//98",responseBodyDecoder:w.wifiSSIDVisibility},putSSIDVisibility:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/ssid-visibility",path:"/1024//98",bodyEncoder:w.wifiSSIDVisibility},getKeyVisibility:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/key-visibility",path:"/1024//99",responseBodyDecoder:w.wifiKeyVisibility},putKeyVisibility:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/key-visibility",path:"/1024//99",bodyEncoder:w.wifiKeyVisibility},getNetworkMode:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/network-mode",path:"/1024//128",responseBodyDecoder:w.wifiMode},putNetworkMode:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/network-mode",path:"/1024//128",bodyEncoder:w.wifiMode},getDisabled:{method:i.TapRequestFrame.MethodType.GET,pathAlias:"/wifi/disabled",path:"/1024//129",responseBodyDecoder:w.boolean},putDisabled:{method:i.TapRequestFrame.MethodType.PUT,pathAlias:"/wifi/disabled",path:"/1024//129",bodyEncoder:w.boolean}},v=function(e){function t(){var t=e.apply(this,n([],s(arguments)))||this;return t.resources=T,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 i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(t,e),t.prototype.getMode=function(){return this.serviceCallRunner.execute(this.getModeCall())},t.prototype.getModeCall=function(){return Object.assign({},this.resources.getMode)},t.prototype.putMode=function(e){return this.serviceCallRunner.execute(this.putModeCall(e))},t.prototype.putModeCall=function(e){var t=Object.assign({},this.resources.putMode);return t.body=e,t},t.prototype.getKey=function(){return this.serviceCallRunner.execute(this.getKeyCall())},t.prototype.getKeyCall=function(){return Object.assign({},this.resources.getKey)},t.prototype.putKey=function(e){return this.serviceCallRunner.execute(this.putKeyCall(e))},t.prototype.putKeyCall=function(e){var t=Object.assign({},this.resources.putKey);return t.body=e,t},t.prototype.getHostname=function(){return this.serviceCallRunner.execute(this.getHostnameCall())},t.prototype.getHostnameCall=function(){return Object.assign({},this.resources.getHostname)},t.prototype.getIp=function(){return this.serviceCallRunner.execute(this.getIpCall())},t.prototype.getIpCall=function(){return Object.assign({},this.resources.getIp)},t.prototype.putIp=function(e){return this.serviceCallRunner.execute(this.putIpCall(e))},t.prototype.putIpCall=function(e){var t=Object.assign({},this.resources.putIp);return t.body=e,t},t.prototype.getGatewayIp=function(){return this.serviceCallRunner.execute(this.getGatewayIpCall())},t.prototype.getGatewayIpCall=function(){return Object.assign({},this.resources.getGatewayIp)},t.prototype.putGatewayIp=function(e){return this.serviceCallRunner.execute(this.putGatewayIpCall(e))},t.prototype.putGatewayIpCall=function(e){var t=Object.assign({},this.resources.putGatewayIp);return t.body=e,t},t.prototype.getIpMask=function(){return this.serviceCallRunner.execute(this.getIpMaskCall())},t.prototype.getIpMaskCall=function(){return Object.assign({},this.resources.getIpMask)},t.prototype.putIpMask=function(e){return this.serviceCallRunner.execute(this.putIpMaskCall(e))},t.prototype.putIpMaskCall=function(e){var t=Object.assign({},this.resources.putIpMask);return t.body=e,t},t.prototype.getDnsIp=function(){return this.serviceCallRunner.execute(this.getDnsIpCall())},t.prototype.getDnsIpCall=function(){return Object.assign({},this.resources.getDnsIp)},t.prototype.putDnsIp=function(e){return this.serviceCallRunner.execute(this.putDnsIpCall(e))},t.prototype.putDnsIpCall=function(e){var t=Object.assign({},this.resources.putDnsIp);return t.body=e,t},t.prototype.getSSID=function(){return this.serviceCallRunner.execute(this.getSSIDCall())},t.prototype.getSSIDCall=function(){return Object.assign({},this.resources.getSSID)},t.prototype.putSSID=function(e){return this.serviceCallRunner.execute(this.putSSIDCall(e))},t.prototype.putSSIDCall=function(e){var t=Object.assign({},this.resources.putSSID);return t.body=e,t},t.prototype.getCountryCode=function(){return this.serviceCallRunner.execute(this.getCountryCodeCall())},t.prototype.getCountryCodeCall=function(){return Object.assign({},this.resources.getCountryCode)},t.prototype.putCountryCode=function(e){return this.serviceCallRunner.execute(this.putCountryCodeCall(e))},t.prototype.putCountryCodeCall=function(e){var t=Object.assign({},this.resources.putCountryCode);return t.body=e,t},t.prototype.getProtocol=function(){return this.serviceCallRunner.execute(this.getProtocolCall())},t.prototype.getProtocolCall=function(){return Object.assign({},this.resources.getProtocol)},t.prototype.putProtocol=function(e){return this.serviceCallRunner.execute(this.putProtocolCall(e))},t.prototype.putProtocolCall=function(e){var t=Object.assign({},this.resources.putProtocol);return t.body=e,t},t.prototype.getTxPower=function(){return this.serviceCallRunner.execute(this.getTxPowerCall())},t.prototype.getTxPowerCall=function(){return Object.assign({},this.resources.getTxPower)},t.prototype.putTxPower=function(e){return this.serviceCallRunner.execute(this.putTxPowerCall(e))},t.prototype.putTxPowerCall=function(e){var t=Object.assign({},this.resources.putTxPower);return t.body=e,t},t.prototype.getSSIDVisibility=function(){return this.serviceCallRunner.execute(this.getSSIDVisibilityCall())},t.prototype.getSSIDVisibilityCall=function(){return Object.assign({},this.resources.getSSIDVisibility)},t.prototype.putSSIDVisibility=function(e){return this.serviceCallRunner.execute(this.putSSIDVisibilityCall(e))},t.prototype.putSSIDVisibilityCall=function(e){var t=Object.assign({},this.resources.putSSIDVisibility);return t.body=e,t},t.prototype.getKeyVisibility=function(){return this.serviceCallRunner.execute(this.getKeyVisibilityCall())},t.prototype.getKeyVisibilityCall=function(){return Object.assign({},this.resources.getKeyVisibility)},t.prototype.putKeyVisibility=function(e){return this.serviceCallRunner.execute(this.putKeyVisibilityCall(e))},t.prototype.putKeyVisibilityCall=function(e){var t=Object.assign({},this.resources.putKeyVisibility);return t.body=e,t},t.prototype.getNetworkMode=function(){return this.serviceCallRunner.execute(this.getNetworkModeCall())},t.prototype.getNetworkModeCall=function(){return Object.assign({},this.resources.getNetworkMode)},t.prototype.putNetworkMode=function(e){return this.serviceCallRunner.execute(this.putNetworkModeCall(e))},t.prototype.putNetworkModeCall=function(e){var t=Object.assign({},this.resources.putNetworkMode);return t.body=e,t},t.prototype.getDisabled=function(){return this.serviceCallRunner.execute(this.getDisabledCall())},t.prototype.getDisabledCall=function(){return Object.assign({},this.resources.getDisabled)},t.prototype.putDisabled=function(e){return this.serviceCallRunner.execute(this.putDisabledCall(e))},t.prototype.putDisabledCall=function(e){var t=Object.assign({},this.resources.putDisabled);return t.body=e,t},t}(t.AbstractService),I=t.extendServiceContainer("wifi",v);e.WIFI_SERVICE_CALLS=T,e.WifiResourceMetaData={"/wifi/mode":{put:{minApiVersion:1,configModeRequired:!1,schema:{$ref:"./definitions.yaml#/WifiMode"}}},"/wifi/key":{put:{minApiVersion:1,configModeRequired:!1,schema:{type:"string",minLength:8,maxLength:64}}},"/wifi/ip":{put:{minApiVersion:1,configModeRequired:!1,schema:{type:"string",format:"ipv4",pattern:"^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$"}}},"/wifi/gateway-ip":{put:{minApiVersion:1,configModeRequired:!1,schema:{type:"string",format:"ipv4"}}},"/wifi/ip-mask":{put:{minApiVersion:1,configModeRequired:!1,schema:{type:"string",format:"ipv4mask"}}},"/wifi/dns-ip":{put:{minApiVersion:1,configModeRequired:!1,schema:{type:"string",format:"ipv4"}}},"/wifi/ssid":{put:{minApiVersion:1,configModeRequired:!1,schema:{type:"string",maxLength:32,minLength:1,pattern:'^[^ !#;+\\]\\/"\\t][^+\\]\\/"\\t]{0,30}[^ !#;+\\]\\/"\\t]$|^[^ !#;+\\]\\/"\\t]$'}}},"/wifi/country-code":{put:{minApiVersion:1.88,configModeRequired:!1,schema:{type:"integer",format:"uint16"}}},"/wifi/protocol":{put:{minApiVersion:1.88,configModeRequired:!1,schema:{type:"array",items:{$ref:"./definitions.yaml#/WifiProtocol"}}}},"/wifi/tx-power":{put:{minApiVersion:1.88,configModeRequired:!1,schema:{type:"integer",format:"int8"}}},"/wifi/ssid-visibility":{put:{minApiVersion:1.88,configModeRequired:!1,schema:{$ref:"./definitions.yaml#/WifiSSIDVisibility"}}},"/wifi/key-visibility":{put:{minApiVersion:1.88,configModeRequired:!1,schema:{$ref:"./definitions.yaml#/WifiKeyVisibility"}}},"/wifi/network-mode":{put:{minApiVersion:2.13,configModeRequired:!1,schema:{$ref:"./definitions.yaml#/WifiMode"}}},"/wifi/disabled":{put:{minApiVersion:2.13,configModeRequired:!1,schema:{type:"boolean"}}}},e.WifiService=v,e._TAP_SERVICE_EXTENSION_WIFI_=I,e.wifiConverters=C,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=iotize-tap-service-impl-wifi.umd.min.js.map