Wi-Fi AP

Description

1. Overview

This article mainly introduces how to use the Device Pairing SDK (With UI) and Device Pairing SDK (Without UI) to configure Wi-Fi AP network.

2. Preconditions

  1. Confirm completion Preparation
  2. Confirm the completion of Environment Build
  3. Complete Device Pairing SDK (With UI) or Device Pairing SDK (without UI) integration

3. Use

3.1 Device Pairing Process

Wi-Fi Ap network access means that after the device turns on the hotspot mode, the SDK sends the device pairing information to the device by connecting to the device's hotspot, and the device connects to Lumiyun through the Wi-Fi account and password in the device pairing information, and finally completes the activation operation .

3.2 Device Pairing SDK (With UI)

3.2.1 Jump to the device pairing device list page

Jump to the select device list page, which lists all the devices supported by the current SDK.

   LMAccessSDKManager.Companion.getInstance()
                .gotoAccessListPage(
                        this,
                        "homeId",
                        "roomId",
                        "coapServer",
                        new LumiResultCallBack() {
                            @Override
                            public void success(@NonNull WeakReference<Activity> weakReference, @Nullable String s) {

                            }

                            @Override
                            public void fail(@Nullable Integer integer, @Nullable String s) {

                            }
                        }
                );

Parameter Description

Field Type of data Describe Access channel
homeId String Home location Interface acquisition, see Aqara Developer Platform
roomId String Room location Interface acquisition, see Aqara Developer Platform
coapServer String Device network domain name (which server the device connects to) Interface acquisition, see Aqara Developer Platform

3.2.2 Jump to the specified device configuration page

LMAccessSDKManager.Companion.getInstance()
        .gotoAccessConfigModule(
                this,
                "deviceModel",
                "homeId",
                "roomId",
                "coapServer",
                new LumiResultCallBack() {
                    @Override
                    public void success(@NonNull WeakReference<Activity> weakReference, @Nullable String s) {

                    }

                    @Override
                    public void fail(@Nullable Integer integer, @Nullable String s) {

                    }
                }

        );

Parameter Description

Field Type of data Describe Access channel
deviceModel String Device model value See appendix List of supported network access devices
homeId String Home location Interface acquisition, see Aqara Developer Platform
roomId String Room location Interface acquisition, see Aqara Developer Platform
coapServer String Device network domain name (which server the device connects to) Interface acquisition, see Aqara Developer Platform

3.3 Device Pairing SDK (without UI)

3.3.1 Get BindKey

The third-party app needs to request the cloud interface to obtain by itself. See Interface Documentation

WifiScanner wifiScanner = new WifiScanner(this);
wifiScanner.findDeviceByWifi(2000L)
        .onTerminateDetach()
        .as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(this)))
        .subscribe(new Consumer<List<android.net.wifi.ScanResult>>() {
            @Override
            public void accept(List<android.net.wifi.ScanResult> scanResults) throws Exception {

            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable throwable) throws Exception {

            }
        });

Parameter Description

Field Type of data Describe Description
intervalTime long Intervals How many milliseconds the SDK calls back the result

3.3.3 Connect to the Wi-Fi hotspot of the device and send the configuration information

AccessConfigBean accessConfigBean = new AccessConfigBean(
        "ssid",
        "password",
        "coapServer",
        "bindKey"
);

AccessAPManager manager = new AccessAPManager.WifiAccessBuilder()
        .setAccessInfo(accessConfigBean)
        .setDeviceAp("Device hotspot ssid")
        .setAccessMode(AccessAPManager.WifiAccessMode.ACCESS_MODE_UDP)
        .setAccessListener(new IAccessListener() {
            @Override
            public void connectSuccess() {

            }

            @Override
            public void accessResult(@Nullable String s) {

            }

            @Override
            public void accessFail(int i, @Nullable String s) {

            }
        })
        .build(this);
//Start to configure the network
manager.startAccess();

//Call resource recycling at the appropriate time, otherwise there may be data caching in the device pairing, resulting in unsuccessful problems.
manager.onDestroy();

Parameter Description

Field Type of data Describe Access channel
ssid String Wi-Fi Name Wi-Fi Search Acquisition
password String Wi-Fi Password User input
coapServer String Device access server Interface acquisition, see Aqara Developer Platform
bindKey String Device network unique identifier The third-party app requests the interface to obtain by itself
bleMac String Device hotspot ssid Get via wifi search
accessMode String Device network type For details, please refer to the value below

accessMode value

Value Type of data Describe
ACCESS_MODE_UDP enum Use UDP for transmission, see appendix [supported network access device list]Supported network access device list
ACCESS_MODE_TCP enum Use TCP for transmission, see appendix [supported network access device list]Supported network access device list
ACCESS_MODE_HTTP enum Use HTTP for transmission, see appendix [supported network access device list]Supported network access device list
Copyright © 2023 Lumi United Technology Co., Ltd. all right reserved,powered by GitbookFile Modify: 2024-04-24 15:18:24

results matching ""

    No results matching ""