更新时间:2024-06-11 06:26:08下载pdf
接口说明
//1.扫描附近的蓝牙门锁设备
IThingBleLockActivator # void startScan(int scanTimeOut, IThingResultCallback<ScanDeviceBean> callback);
//2.将扫描到的蓝牙门锁设备进行配网
IThingBleLockActivator # void startActivator(long siteId, ScanDeviceBean scanDeviceBean, IBleActivatorListener listener);
参数说明
参数 | 说明 |
---|---|
siteId | 站点 ID |
scanDeviceBean | 扫描到的设备模型 |
listener | 配网结果回调 |
示例代码
HashMap<String, ScanDeviceBean> map = new HashMap<>();
ThingOSLock.getBleLockActivator().startScan(60 * 1000, new IThingResultCallback<ScanDeviceBean>() {
@Override
public void onSuccess(ScanDeviceBean result) {
//Scanned device successfully
if (map.get(result.getUuid()) != null) {
return;
}
map.put(result.getUuid(), result);
ThingOSLock.getBleLockActivator().startActivator(siteId, result, new IBleActivatorListener() {
@Override
public void onSuccess(DeviceBean deviceBean) {
//Activated device successfully
}
@Override
public void onFailure(int code, String msg, Object handle) {
//Failed to activate device
}
});
}
@Override
public void onError(String errorCode, String errorMessage) {
//Failed to scan device
}
});
IThingBleLockActivator # getActivatorDeviceInfo
方法。stopScan
和 stopActivator
方法。接口说明
//1.扫描附近的蓝牙网关设备
IThingBleGatewayActivator # void startScan(int scanTimeOut, IThingResultCallback<ScanDeviceBean> callback);
//2.将扫描到的蓝牙网关设备进行配网
IThingBleGatewayActivator # void startActivator(long siteId, ScanDeviceBean scanDeviceBean, String ssid, String password, IBleActivatorListener listener);
参数说明
参数 | 说明 |
---|---|
scanTimeOut | 设备扫描超时时间,单位毫秒 |
siteId | 站点 ID |
scanDeviceBean | 扫描到的设备模型 |
ssid | Wi-Fi SSID |
password | Wi-Fi 密码 |
listener | 配网结果回调 |
示例代码
HashMap<String, ScanDeviceBean> map = new HashMap<>();
ThingOSLock.getBleGatewayActivator().startScan(60 * 1000, new IThingResultCallback<ScanDeviceBean>() {
@Override
public void onSuccess(ScanDeviceBean result) {
//Scanned device successfully
if (map.get(result.getUuid()) != null) {
return;
}
map.put(result.getUuid(), result);
ThingOSLock.getBleGatewayActivator().startActivator(site_id, result, wifiName,
wifiPassword,new IBleActivatorListener() {
@Override
public void onSuccess(DeviceBean deviceBean) {
//Activated device successfully
}
@Override
public void onFailure(int code, String msg, Object handle) {
//Failed to activate device
}
});
}
@Override
public void onError(String errorCode, String errorMessage) {
//Failed to scan device
}
});
在进行蓝牙网关设备配网时,需确保连接的 Wi-Fi 网络能够正常访问,且 Wi-Fi 网络需为 2.4 GHz 频段。
接口说明
//1.开启设备扫描
IThingZigbeeWiredGatewayActivator # void startSearch(IGwSearchListener callback);
//2.将扫描到的设备进行配网
IThingZigbeeWiredGatewayActivator # void startActivator(Context context, long siteId, long timeout, HgwBean hgwBean, IThingSmartActivatorListener listener);
//3.停止设备扫描
IThingZigbeeWiredGatewayActivator # void stopSearch();
//4.停止 Zigbee 有线网关设备扫描 & 入网
IThingZigbeeWiredGatewayActivator # void stopActivator();
参数说明
参数 | 说明 |
---|---|
context | 传入当前 Activity 的 Context |
siteId | 站点 ID |
hgwBean | 扫描到的设备基础模型 |
timeout | 超时时间,单位秒 |
listener | 配网结果回调 |
示例代码
ThingOSLock.getZigbeeWiredGatewayActivator().startSearch(new IGwSearchListener() {
@Override
public void onDevFind(HgwBean gw) {
//The callback of device discovery
ThingOSLock.getZigbeeWiredGatewayActivator().startActivator(ZigbeeWiredGatewayConfigActivity.this, siteId, 60, gw, new IThingSmartActivatorListener() {
@Override
public void onError(String errorCode, String errorMsg) {
//The failure callback of device activation
}
@Override
public void onActiveSuccess(DeviceBean devResp) {
//The success callback of device activation
}
@Override
public void onStep(String step, Object data) {
}
});
}
});
接口说明
//1.扫描并添加 Zigbee 门锁设备
IThingGwSubDeviceActivator # void startActivator(long siteId,String gwDevId, long timeout, IThingSmartActivatorListener listener);
//2.停止 Zigbee 门锁设备入网
IThingZigbeeWiredGatewayActivator # void stopActivator();
参数说明
参数 | 说明 |
---|---|
gwDevId | Zigbee 网关设备 ID |
timeout | 超时时间,单位秒 |
listener | 配网结果回调 |
示例代码
ThingOSLock.getGwSubDeviceActivator().startActivator(siteId, gwId, 60, new IThingSmartActivatorListener() {
@Override
public void onError(String errorCode, String errorMsg) {
//Failed to activate the sub-device
}
@Override
public void onActiveSuccess(DeviceBean devResp) {
//Activated the sub-device successfully
}
@Override
public void onStep(String step, Object data) {
}
});
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈