更新时间:2024-03-04 07:31:44
设备离线是指设备完成配网后,出现掉线、无网络响应的情况。您可以为设备开启离线告警,发生设备离线的情况后,设备会向指定用户发送通知。用户可以订阅消息推送功能来开启该功能。
接口说明
- (void)getOfflineReminderSupportStatusWithSuccess:(nullable ThingSuccessBOOL)success failure:(nullable ThingFailureError)failure;
参数说明
参数 | 说明 |
---|---|
success | 获取离线告警成功回调 |
failure | 失败回调 |
示例代码
Objc:
- (void)getCurrentOfflineReminderSupportStatus {
// self.device = [ThingSmartDevice deviceWithDeviceId:@"your_device_id"];
[self.device getOfflineReminderSupportStatusWithSuccess:^(BOOL result) {
NSLog(@"get current offline reminder support status: %d", result);
} failure:^(NSError *error) {
NSLog(@"get current Wifi Info failure: %@", error);
}];
}
Swift:
func getCurrentOfflineReminderSupportStatus() {
device?.getOfflineReminderSupportStatus(success: { status in
print("get current offline reminder support status: \(status)")
}, failure: { (error) in
if let e = error {
print("get current offline reminder support status failure: \(e)")
}
})
}
接口说明
- (void)getOfflineReminderStatusWithSuccess:(nullable ThingSuccessBOOL)success failure:(nullable ThingFailureError)failure;
参数说明
参数 | 说明 |
---|---|
success | 获取离线告警状态成功回调 |
failure | 失败回调 |
示例代码
Objc:
- (void)getCurrentOfflineReminderStatus {
// self.device = [ThingSmartDevice deviceWithDeviceId:@"your_device_id"];
[self.device getOfflineReminderStatusWithSuccess:^(BOOL result) {
NSLog(@"get current offline reminder status: %d", result);
} failure:^(NSError *error) {
NSLog(@"get current Wifi Info failure: %@", error);
}];
}
Swift:
func getCurrentOfflineReminderStatus() {
device?.getOfflineReminderStatusWithSuccess(success: { status in
print("get current offline reminder status: \(status)")
}, failure: { (error) in
if let e = error {
print("get current offline reminder status failure: \(e)")
}
})
}
接口说明
- (void)setOfflineReminderStatus:(BOOL)status success:(nullable ThingSuccessBOOL)success failure:(nullable ThingFailureError)failure;
参数说明
参数 | 说明 |
---|---|
status | 离线告警状态 |
success | 设置离线告警状态成功回调 |
failure | 失败回调 |
示例代码
Objc:
- (void)setOfflineReminderStatus:(BOOL)status {
// self.device = [ThingSmartDevice deviceWithDeviceId:@"your_device_id"];
[self.device setOfflineReminderStatus:status success:^(BOOL result) {
NSLog(@"set Offline Reminder Status: %d", result);
} failure:^(NSError *error) {
NSLog(@"set Offline Reminder Status failure: %@", error);
}];
}
Swift:
func setOfflineReminderStatus(status: Bool) {
device?.getOfflineReminderStatusWithSuccess(success: { status in
print("set offline reminder status: \(status)")
}, failure: { (error) in
if let e = error {
print("set offline reminder status failure: \(e)")
}
})
}
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈