Last Updated on : 2024-05-14 02:42:33download
The app sends a sub-device pairing command to the cloud, which forwards the command to the gateway to initiate the pairing process. After the sub-device receives the pairing command, it registers and activates with the cloud through the gateway. On success, the cloud notifies the app of the result.
The sub-device connects to the cloud through a Wi-Fi or wired gateway as an intermediary.
val scankey = ThingActivatorCoreKit.getScanDeviceManager().startGatewaySubDeviceSearch(
gatewayId: String,
millisTimeOut: Long,
thingActivatorScanCallback: ThingActivatorScanCallback
)
Parameter description
Parameters | Description |
---|---|
gwId | The gateway ID. |
millisTimeOut | The timeout value, in milliseconds. |
thingActivatorScanCallback | The search timeout callback. |
ThingActivatorCoreKit.getScanDeviceManager().stopScan(scankey)
val builder = ThingDeviceActiveBuilder()
.setActiveModel(ThingDeviceActiveModeEnum.SUB)
.setSubSearchBeans(thingActivatorScanDeviceBeans)
.setTimeOut(timeout)
.setListener(object : IThingDeviceActiveListener {
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) {
}
})
val activeManager = ThingActivatorCoreKit.getActiveManager().newThingActiveManager()
activeManager.startActive(builder)
Parameter description
Parameters | Description |
---|---|
subSearchBeans | The list of discovered devices. |
timeout | The timeout value, in seconds. |
activeModel | The pairing capability enum. |
listener | The callback for the result of pairing. |
val builder = ThingDeviceActiveBuilder()
.setActiveModel(ThingDeviceActiveModeEnum.SUB)
.setTimeOut(120)
.setGwId(mScanBuilder.gwId)
.setListener(object : IThingDeviceActiveListener {
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) {
}
})
val activeManager = ThingActivatorCoreKit.getActiveManager().newThingActiveManager()
activeManager.startActive(builder)
Parameter description
Parameters | Description |
---|---|
gwid | The gateway ID. |
timeout | The timeout value, in seconds. |
activeModel | The pairing capability enum. |
listener | The callback for the result of pairing. |
mThingActivatorManager.stopActive()
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback