更新时间:2024-05-14 02:42:15下载pdf
App 发送子设备配网指令到云端,云端进而通知网关开始配网子设备。子设备收到配网命令后通过网关向云端注册激活,成功后云端通知 App 添加设备成功。
子设备一般不具备联网能力,需要借助网关来和云端通信,网关通过 Wi-Fi 或者有线网络连云。
val scankey = ThingActivatorCoreKit.getScanDeviceManager().startGatewaySubDeviceSearch(
gatewayId: String,
millisTimeOut: Long,
thingActivatorScanCallback: ThingActivatorScanCallback
)
参数说明
参数 | 说明 |
---|---|
gwId | 网关 ID |
millisTimeOut | 超时时间,单位为毫秒(ms) |
thingActivatorScanCallback | 搜索超时回调 |
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)
参数说明
参数 | 说明 |
---|---|
subSearchBeans | 扫描到的设备实体列表 |
timeout | 超时时长,单位为秒(s) |
activeModel | 配网能力枚举 |
listener | 配网结果回调 |
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)
参数说明
参数 | 说明 |
---|---|
gwid | 网关 ID |
timeout | 超时时长,单位为秒(s) |
activeModel | 配网能力枚举 |
listener | 配网结果回调 |
mThingActivatorManager.stopActive()
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈