Last Updated on : 2024-05-14 02:39:13download
The app scans the device’s QR code to pair with it. This is a quick way to pair a single device. It applies to directly connected devices and Bluetooth devices.
ThingActivatorCoreKit.getCommonBizOpt().parseQrCode("qrcodeurl", new Business.ResultListener<ScanActionBean>() {
@Override
public void onFailure(BusinessResponse bizResponse, ScanActionBean bizResult, String apiName) {
}
@Override
public void onSuccess(BusinessResponse bizResponse, ScanActionBean bizResult, String apiName) {
}
});
Parameter description
| Parameters | Description |
|---|---|
| qrcodeurl | The string of the QR code. |
Description of ScanActionBean
| Parameters | Description |
|---|---|
| actionName | The scan type.
|
| actionData | Device Information |
val builder = ThingDeviceActiveBuilder()
.setActiveModel(ThingDeviceActiveModeEnum.QR)
.setContext(context)
.setUuid(uuid)
.setRelationId(homeId)
.setTimeOut(timeout)
.setListener(object : IThingDeviceStatePauseActiveListener {
override fun onFind(devId: String) {
}
override fun onBind(devId: String) {
}
override fun onActiveSuccess(deviceBean: DeviceBean) {
}
override fun onActiveError(errorBean: ThingDeviceActiveErrorBean) {
}
override fun onActiveLimited(limitBean: ThingDeviceActiveLimitBean) {
}
override fun onActivatorStatePauseCallback(stateData: PauseStateData?) {
}
})
val activeManager = ThingActivatorCoreKit.getActiveManager().newThingActiveManager()
activeManager.startActive(builder)
Parameter description
| Parameters | Description |
|---|---|
| context | The context. |
| uuid | The unique identifier of the device. |
| relationId | The ID of the home with which the device is bound. |
| timeout | The timeout value, in seconds. |
| activeModel | The pairing capability enum. |
| listener | The callback for the result of pairing. |
val builder = ThingDeviceActiveBuilder()
.setActiveModel(ThingDeviceActiveModeEnum.BT_QRCODE)
.setUuid(uuid)
.setMac(mac)
.setRelationId(homeId)
.setTimeOut(timeout)
.setListener(object : IThingDeviceStatePauseActiveListener {
override fun onFind(devId: String) {
}
override fun onBind(devId: String) {
}
override fun onActiveSuccess(deviceBean: DeviceBean) {
}
override fun onActiveError(errorBean: ThingDeviceActiveErrorBean) {
}
override fun onActiveLimited(limitBean: ThingDeviceActiveLimitBean) {
}
override fun onActivatorStatePauseCallback(stateData: PauseStateData?) {
}
})
val activeManager = ThingActivatorCoreKit.getActiveManager().newThingActiveManager()
activeManager.startActive(builder)
Parameter description
| Parameters | Description |
|---|---|
| mac | The MAC address of the device. |
| uuid | The unique identifier of the device. |
| relationId | The ID of the home with which the device is bound. |
| timeout | The timeout value, in seconds. |
| activeModel | The pairing capability enum. |
| listener | The callback for the result of pairing. |
activeManager.stopActive()
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback