Ethernet Wired
1. Overview
This article mainly introduces how to use the Device Pairing SDK (Wtih UI) and Device Pairing SDK (Without UI) to configure Ethernet (Ethernet) wired network.
2. Preconditions
- Confirm completion Preparation
- Confirm the completion of Environment Build
- Complete Device Pairing SDK (With UI) or Device Pairing SDK (without UI) integration
3. Use
3.1 Device Pairing Process
Device Pairing by Ethernet (Ethernet) wired means that the device is connected to the network (router) through a wired line, eliminating the need for the user to enter the account/password during the device pairing process, directly sending the device pairing information to the device, and finally completing the registration, Binding and other activation operations.
3.2 Device Pairing SDK (With UI)
3.2.1 Jump to the Device Pairingk 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
3.3.2 Discover device
WifiScanner wifiScanner = new WifiScanner(this);
wifiScanner.findDeviceByMDns(2000L)
.onTerminateDetach()
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(this)))
.subscribe(new Consumer<List<LANDeviceEntity>>() {
@Override
public void accept(List<LANDeviceEntity> lanDeviceEntities) 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 Send device pairing information
AccessConfigBean accessConfigBean = new AccessConfigBean(
"coapServer",
"bindKey"
);
AccessAPManager manager = new AccessAPManager.WifiAccessBuilder()
.setAccessInfo(accessConfigBean)
.setDeviceIp("Device ip address")
.setAccessMode(AccessAPManager.WifiAccessMode.ACCESS_MODE_TETHERNET)
.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 right time, otherwise there may be device pairing data cache, 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 ip address | Obtained by mDNS search |
accessMode | String | Device network type | For details, please refer to the value below |
accessMode value
Value | Type of data | Describe |
---|---|---|
ACCESS_MODE_GATEWAY | enum | Use Ethernet for network configuration, see appendix Supported network access device list |