NB-IoT Device Pairing

Last Updated on : 2024-06-24 08:05:12download

Narrowband Internet of Things (NB-IoT) is a low-power wide-area network radio technology for cellular network devices. NB-IoT focuses on long battery life and high connection density. An NB-IoT device comes with a SIM card slot or eSIM embedded on board. In the pairing process, an NB-IoT device gets registered and activated with the cloud through a cellular network.

Parse QR code

Read the QR code and get the UUID.

ThingActivatorCoreKit.getCommonBizOpt().parseQrCode("str", new Business.ResultListener<ScanActionBean>() {
                @Override
                public void onFailure(BusinessResponse bizResponse, ScanActionBean bizResult, String apiName) {

                }

                @Override
                public void onSuccess(BusinessResponse bizResponse, ScanActionBean bizResult, String apiName) {

                }
            });

Request parameters

Parameters Description
code The string of the QR code.

Description of ScanActionBean

Parameters Description
actionName The actionName for an NB-IoT device is "device_net_conn_bind_nb".
actionData The device information.

Start pairing

        val builder = ThingDeviceActiveBuilder()
        builder.uuid = ""
        builder.relationId = homeId //homeId
        builder.activeModel = ThingDeviceActiveModeEnum.NB
        builder.listener = object : IThingDeviceActiveListener {
            override fun onActiveError(errorBean: ThingDeviceActiveErrorBean) {

            }

            override fun onActiveLimited(limitBean: ThingDeviceActiveLimitBean) {

            }

            override fun onActiveSuccess(deviceBean: DeviceBean) {

            }

            override fun onBind(devId: String) {

            }

            override fun onFind(devId: String) {

            }

        }

val activeManager = ThingActivatorCoreKit.getActiveManager().newThingActiveManager()

activeManager.startActive(builder)

Parameter description

Parameters Description
uuid The UUID of the device, extracted from the QR code.
relationId The home ID.
activeModel The pairing capability enum.
listener The callback for the result of pairing.

Stop pairing

mThingActivatorManager.stopActive()