3.0.113 • Published 27 days ago

@tencent-iot/plugin-wificonf-softap v3.0.113

Weekly downloads
-
License
MIT
Repository
-
Last release
27 days ago

qcloud-iotexplorer-appdev-plugin-wificonf-softap

腾讯云物联网开发平台应用开发小程序端WIFI配网方式之SoftAp SDK

安装依赖

npm install qcloud-iotexplorer-appdev-sdk
npm install qcloud-iotexplorer-appdev-plugin-wificonf-core

安装SDK

npm install qcloud-iotexplorer-appdev-plugin-wificonf-softap

使用

step1.向sdk里面注册SoftAp插件,sdk的初始化方式,请参考qcloud-iotexplorer-appdev-sdk

import SoftApPlug from 'qcloud-iotexplorer-appdev-plugin-wificonf-softap';

sdk.usePlugin(SoftApPlug);

> step2.开始softap配网,配网流程祥见[官方文档](https://cloud.tencent.com/document/product/1081/48406)

import { constants as WifiConfConstants } from 'qcloud-iotexplorer-appdev-plugin-wificonf-core';

const { MpStatType, MyStatDimension, WifiConfErrorMsg, WifiConfStepCode, } = WifiConfConstants;

/**

  • softap配网 */ export function SoftApConfigure({ token, wifiInfo = { SSID: ''; password: ''; BSSID: ''; }, familyId = 'default', roomId, reporter, onStepChange, onStatusChange, }) { const onProgress = (data) => { reporter.info(data.code, data.detail);

    switch (data.code) {
      case WifiConfStepCode.CREATE_UDP_CONNECTION_SUCCESS:
        onStepChange(1);
        break;
    
      case WifiConfStepCode.PROTOCOL_SUCCESS:
        onStepChange(2);
        break;
      case WifiConfStepCode.SOFTAP_GET_DEVICE_SIGNATURE_SUCCESS:
      case WifiConfStepCode.BUSINESS_QUERY_TOKEN_STATE_SUCCESS:
        onStepChange(3);
        break;
      case WifiConfStepCode.WIFI_CONF_SUCCESS:
        onStepChange(4);
        break;
    }

    };

    const onComplete = ({ productId, deviceName }) => { onStatusChange({ status: 'success', productId, deviceName, }); };

    const onError = async ({ code, detail }) => { reporter.error(code, detail);

    onStatusChange({ status: 'error' });

    };

    sdk.plugins'wifiConfSoftAp'.start({ wifiConfToken: token, targetWifiInfo: wifiInfo, autoRetry: true, // 自动处理故障流程 familyId, roomId, onProgress, onComplete, onError }); }

3.0.113

27 days ago

3.0.112

3 months ago

3.0.109

8 months ago

3.0.108

8 months ago

3.0.111

6 months ago

3.0.110

7 months ago

3.0.101

1 year ago

3.0.103

1 year ago

3.0.102

1 year ago

3.0.105

12 months ago

3.0.104

12 months ago

3.0.107

12 months ago

3.0.100

1 year ago

3.0.0-alpha.9

1 year ago

3.0.0-alpha.8

1 year ago

3.0.0

1 year ago

3.0.0-alpha.7

1 year ago

3.0.0-alpha.6

1 year ago

3.0.0-alpha.5

1 year ago

3.0.0-alpha.4

1 year ago

3.0.0-alpha.3

1 year ago

3.0.0-alpha.2

1 year ago

3.0.0-alpha.1

1 year ago