更新时间:2024-10-09 02:39:29下载pdf
消息推送开关为总开关,关闭状态下无法接收到设备告警、家庭消息、通知消息等任何消息。
接口说明
- (void)getPushStatusWithSuccess:(__nullable ThingSuccessBOOL)success failure:(__nullable ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
success | 成功回调,返回布尔值,其中 false 表示无法接收到设备告警、家庭消息、通知消息等任何消息 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
[[ThingSmartSDK sharedInstance] getPushStatusWithSuccess:^(BOOL result) {
// 当 result == YES 时,表示推送开关开启
} failure:^(NSError *error) {
}];
Swift:
ThingSmartSDK.sharedInstance().getPushStatus(withSuccess: { result in
// 当 result == YES 时,表示推送开关开启
}, failure: { error in
})
消息推送开关为总开关,关闭状态下无法接收到设备告警、家庭消息、通知消息等任何消息。
接口说明
- (void)setPushStatusWithStatus:(BOOL)enable success:(__nullable ThingSuccessHandler)success failure:(__nullable ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
enable | 开启或关闭 |
success | 成功回调 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
BOOL enable = YES;
[[ThingSmartSDK sharedInstance] setPushStatusWithStatus:enable success:^{
// 设置成功
} failure:^(NSError *error) {
}];
Swift:
let enable = true
ThingSmartSDK.sharedInstance().setPushStatusWithStatus(enable, success: {
// 设置成功
}, failure: { error in
})
查询是否开启设备告警推送
接口说明
- (void)getDevicePushStatusWithSuccess:(__nullable ThingSuccessBOOL)success failure:(__nullable ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
success | 成功回调,返回布尔值 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
[[ThingSmartSDK sharedInstance] getDevicePushStatusWithSuccess:^(BOOL result) {
// 当 result == YES 时,表示接收设备告警消息推送
} failure:^(NSError *error) {
}];
Swift:
ThingSmartSDK.sharedInstance().getDevicePushStatus(withSuccess: { result in
// 当 result == YES 时,表示接收设备告警消息推送
}, failure: { error in
})
开启或者关闭设备告警推送
接口说明
- (void)setDevicePushStatusWithStauts:(BOOL)enable success:(__nullable ThingSuccessHandler)success failure:(__nullable ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
enable | 开启或关闭 |
success | 成功回调 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
BOOL enable = YES;
[[ThingSmartSDK sharedInstance] setDevicePushStatusWithStauts:enable success:^{
// 设置成功
} failure:^(NSError *error) {
}];
Swift:
let enable = true
ThingSmartSDK.sharedInstance().setDevicePushStatusWithStauts(enable, success: {
// 设置成功
}, failure: { error in
})
查询是否开启家庭通知推送
接口说明
- (void)getFamilyPushStatusWithSuccess:(__nullable ThingSuccessBOOL)success failure:(__nullable ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
success | 成功回调,返回布尔值 |
failure | 失败回调,返回失败原因 |
示例代码
[[ThingSmartSDK sharedInstance] getFamilyPushStatusWithSuccess:^(BOOL result) {
// 当 result == YES 时,表示接收家庭消息推送
} failure:^(NSError *error) {
}];
开启或者关闭家庭通知推送
接口说明
- (void)setFamilyPushStatusWithStauts:(BOOL)enable success:(__nullable ThingSuccessHandler)success failure:(__nullable ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
enable | 开启或关闭 |
success | 成功回调 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
BOOL enable = YES;
[[ThingSmartSDK sharedInstance] setFamilyPushStatusWithStauts:enable success:^{
// 设置成功
} failure:^(NSError *error) {
}];
Swift:
let enable = true
ThingSmartSDK.sharedInstance().setFamilyPushStatusWithStauts(enable, success: {
// 设置成功
}, failure: { error in
})
查询是否开启消息通知推送
接口说明
- (void)getNoticePushStatusWithSuccess:(__nullable ThingSuccessBOOL)success failure:(__nullable ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
success | 成功回调,返回布尔值 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
[[ThingSmartSDK sharedInstance] getNoticePushStatusWithSuccess:^(BOOL result) {
// 当 result == YES 时,表示接收通知消息推送
} failure:^(NSError *error) {
}];
Swift:
ThingSmartSDK.sharedInstance().getNoticePushStatus(withSuccess: { result in
// 当 result == YES 时,表示接收通知消息推送
}, failure: { error in
})
开启或者关闭消息通知推送
接口说明
- (void)setNoticePushStatusWithStauts:(BOOL)enable success:(__nullable ThingSuccessHandler)success failure:(__nullable ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
enable | 开启或关闭,YES 表示开启 |
success | 成功回调 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
BOOL enable = YES;
[[ThingSmartSDK sharedInstance] setNoticePushStatusWithStauts:enable success:^{
// 设置成功
} failure:^(NSError *error) {
}];
Swift:
let enable = true
ThingSmartSDK.sharedInstance().setNoticePushStatusWithStauts(enable, success: {
// 设置成功
}, failure: { error in
})
查询是否开启营销消息推送
接口说明
- (void)getMarketingPushStatusWithSuccess:(__nullable ThingSuccessBOOL)success failure:(__nullable ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
success | 成功回调,返回布尔值 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
[[ThingSmartSDK sharedInstance] getMarketingPushStatusWithSuccess:^(BOOL result) {
// 当 result == YES 时,表示接收营销消息推送
} failure:^(NSError *error) {
}];
Swift:
ThingSmartSDK.sharedInstance().getMarketingPushStatus(withSuccess: { result in
// 当 result == YES 时,表示接收营销消息推送
}, failure: { error in
})
开启或者关闭营销消息推送
接口说明
- (void)setMarketingPushStatusWithStauts:(BOOL)enable success:(__nullable ThingSuccessHandler)success failure:(__nullable ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
enable | 开启或关闭 |
success | 成功回调 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
BOOL enable = YES;
[[ThingSmartSDK sharedInstance] setMarketingPushStatusWithStauts:enable success:^{
// 设置成功
} failure:^(NSError *error) {
}];
Swift:
let enable = true
ThingSmartSDK.sharedInstance().setMarketingPushStatusWithStauts(enable, success: {
// 设置成功
}, failure: { error in
})
接口说明
- (void)setDeviceDNDSettingStatus:(BOOL)flags success:(ThingSuccessHandler)success failure:(ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
flags | 开启或关闭 |
success | 成功回调 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
BOOL flags = YES;
[messageSetting setDeviceDNDSettingStatus:flags success:^{
// 设置成功
} failure:^(NSError *error) {
}];
Swift:
//let messageSetting = ThingSmartMessageSetting()
let flags = true
messageSetting.setDeviceDNDSettingStatus(flags, success: {
// 设置成功
}, failure: { error in
})
接口说明
- (void)getDeviceDNDSettingstatusSuccess:(ThingSuccessBOOL)success failure:(ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
success | 成功回调,返回布尔值 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
[messageSetting getDeviceDNDSettingstatusSuccess:^(BOOL result){
// 当 result == YES 时,表示设备消息免打扰开关状态为开启
} failure:^(NSError *error) {
}];
Swift:
//let messageSetting = ThingSmartMessageSetting()
messageSetting.getDeviceDNDSettingstatusSuccess({ result in
// 当 result == YES 时,表示设备消息免打扰开关状态为开启
}, failure: { error in
})
接口说明
- (void)getDNDDeviceListSuccess:(ThingSuccessList)success failure:(ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
success | 成功回调,返回所有家庭下所有设备列表数组 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
[messageSetting getDNDDeviceListSuccess:^(NSArray *list){
//获取设备列表成功
} failure:^(NSError *error) {
}];
Swift:
let messageSetting = ThingSmartMessageSetting()
messageSetting.getDNDDeviceListSuccess({ list in
//获取设备列表成功
}, failure: { error in
})
通过以下接口,获取所有消息免打扰时间段,包含周期性免打扰和一次性免打扰。
接口说明
- (void)getAllDNDListWithSuccess:(void(^)(ThingSmartMessageDNDListEntity * _Nullable result))success failure:(ThingFailureError)failure;
参数说明
参数 | 说明 |
---|---|
success | 成功回调 |
failure | 失败回调,返回失败原因 |
ThingSmartMessageDNDListEntity
数据模型
字段 | 说明 |
---|---|
periodDNDList | 周期性免打扰时间段列表 |
onceDNDList | 一次性免打扰时间段列表 |
示例代码
Objective-C:
ThingSmartMessageSetting *setting = [[ThingSmartMessageSetting alloc] init];
[setting getAllDNDListWithSuccess:^(ThingSmartMessageDNDListEntity * _Nullable result) {
} failure:^(NSError *error) {
}];
Swift
let setting = ThingSmartMessageSetting()
setting.getAllDNDList { result in
} failure: { error in
}
接口说明
- (void)getDNDListSuccess:(ThingSuccessList)success failure:(ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
success | 成功回调,返回时间段数组 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
[messageSetting getDNDListSuccess:^(NSArray *list){
//获取消息免打扰时间段列表成功
} failure:^(NSError *error) {
}];
Swift:
//let messageSetting = ThingSmartMessageSetting()
messageSetting.getDNDListSuccess({ list in
//获取消息免打扰时间段列表成功
}, failure: { error in
})
周期性免打扰指的是同一个免打扰时段,可以设置为一周内重复生效。例如周一到周五的 8:00-12:00 处于免打扰时间段内,不会收到设备告警消息。
接口说明
- (void)addDNDWithDNDRequestModel:(ThingSmartMessageSettingDNDRequestModel *)requestModel success:(ThingSuccessHandler)success failure:(ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
requestModel | 添加消息免打扰请求模型:
|
success | 成功回调 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
//ThingSmartMessageSettingDNDRequestModel *requestModel = [[ThingSmartMessageSettingDNDRequestModel alloc] init];
//requestModel.startTime = @"07:10";
//requestModel.endTime = @"23:00";
//requestModel.devIDs = @[@"***",@"***"];
//0 means disabled and 1 means enabled. @"0000111" means it is enabled from Friday to Sunday. That's the same thing as index =0 starting on Monday
//requestModel.loops = @"0000111";
//requestModel.isAllDevIDs = YES;
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
[messageSetting addDNDWithDNDRequestModel:requestModel success:^{
//添加成功
} failure:^(NSError *error) {
}];
Swift:
//let requestModel = ThingSmartMessageSettingDNDRequestModel()
//requestModel.startTime = "07:10"
//requestModel.endTime = "23:00"
//requestModel.devIDs = ["***", "***"]
//0 means disabled and 1 means enabled. @"0000111" means it is enabled from Friday to Sunday. That's the same thing as index =0 starting on Monday
//requestModel.loops = "0000111"
//requestModel.isAllDevIDs = true
//let messageSetting = ThingSmartMessageSetting()
messageSetting.addDND(withDNDRequestModel: requestModel, success: {
//添加成功
}, failure: { error in
})
一次性免打扰指的是将来的某个时间段内处于免打扰状态,不会收到设备告警消息,只会生效一次。
接口说明
- (void)addOnceDNDWithRequestModel:(ThingSmartMessageOnceDNDRequestModel *)requestModel
success:(ThingSuccessHandler)success
failure:(ThingFailureError)failure;
参数说明
参数 | 说明 |
---|---|
requestModel | 添加免打扰请求模型 |
success | 成功回调 |
failure | 失败回调,返回失败原因 |
ThingSmartMessageOnceDNDRequestModel
数据模型
字段 | 说明 |
---|---|
startTime | 免打扰开始时间,字符串格式 "yyyy-MM-dd HH:mm" |
endTime | 免打扰结束时间,字符串格式 "yyyy-MM-dd HH:mm" |
devIDs | 免打扰设备 ID 列表 |
isAllDevIDs | 所有设备是否都支持免打扰设置(DND)。当该值为 true 时,devIDs 可以为空 |
示例代码
Objective-C:
ThingSmartMessageOnceDNDRequestModel *requestModel = [[ThingSmartMessageOnceDNDRequestModel alloc] init];
requestModel.startTime = @"2024-07-01 00:00";
requestModel.endTime = @"2024-07-01 12:00";
requestModel.devIDs = @[@"xx", @"xx"];
requestModel.isAllDevIDs = NO;
ThingSmartMessageSetting *setting = [[ThingSmartMessageSetting alloc] init];
[setting addOnceDNDWithRequestModel:requestModel success:^{
} failure:^(NSError *error) {
}];
Swift:
let requestModel = ThingSmartMessageOnceDNDRequestModel()
requestModel.startTime = "2024-07-01 00:00"
requestModel.endTime = "2024-07-01 12:00"
requestModel.devIDs = ["xx","xx"]
requestModel.isAllDevIDs = false
let setting = ThingSmartMessageSetting()
setting.addOnceDND(with: requestModel) {
} failure: { error in
}
接口说明
- (void)modifyDNDWithTimerID:(long)timerID DNDRequestModel:(ThingSmartMessageSettingDNDRequestModel *)requestModel success:(ThingSuccessHandler)success failure:(ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
timerID | 免打扰时间段 ID |
requestModel | 添加消息免打扰请求模型:
|
success | 成功回调 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
//ThingSmartMessageSettingDNDRequestModel *requestModel = [[ThingSmartMessageSettingDNDRequestModel alloc] init];
//requestModel.startTime = @"07:10";
//requestModel.endTime = @"23:00";
//requestModel.devIDs = @[@"***",@"***"];
//0 means disabled and 1 means enabled. @"0000111" means it is enabled from Friday to Sunday. That's the same thing as index =0 starting on Monday
//requestModel.loops = @"0000111";
//requestModel.isAllDevIDs = YES;
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
//long timerID = 1108056;
[messageSetting modifyDNDWithTimerID:timerID DNDRequestModel:requestModel success:^{
//修改成功
} failure:^(NSError *error) {
}];
Swift:
//let requestModel = ThingSmartMessageSettingDNDRequestModel()
//requestModel.startTime = "07:10"
//requestModel.endTime = "23:00"
//requestModel.devIDs = ["***", "***"]
//0 means disabled and 1 means enabled. @"0000111" means it is enabled from Friday to Sunday. That's the same thing as index =0 starting on Monday
//requestModel.loops = "0000111"
//requestModel.isAllDevIDs = true
//let messageSetting = ThingSmartMessageSetting()
//let timerID = 1108056
messageSetting.modifyDND(withTimerID: timerID, dndRequestModel: requestModel, success: {
//修改成功
}, failure: { error in
})
接口说明
- (void)modifyOnceDNDWithTimerID:(long)timerID
requestModel:(ThingSmartMessageOnceDNDRequestModel *)requestModel
success:(ThingSuccessHandler)success
failure:(ThingFailureError)failure;
参数说明
参数 | 说明 |
---|---|
timerID | 免打扰时间段 ID |
requestModel | 修改消息免打扰请求模型 |
success | 成功回调 |
failure | 失败回调,返回失败原因 |
ThingSmartMessageOnceDNDRequestModel
数据模型
字段 | 说明 |
---|---|
startTime | 免打扰开始时间,字符串格式 "yyyy-MM-dd HH:mm" |
endTime | 免打扰结束时间,字符串格式 "yyyy-MM-dd HH:mm" |
devIDs | 免打扰设备 ID 列表 |
isAllDevIDs | 所有设备是否都支持免打扰设置(DND)。当该值为 true 时,devIDs 可以为空 |
示例代码
Objective-C:
ThingSmartMessageOnceDNDRequestModel *requestModel = [[ThingSmartMessageOnceDNDRequestModel alloc] init];
requestModel.startTime = @"2024-07-02 18:00";
requestModel.endTime = @"2024-07-03 06:00";
requestModel.isAllDevIDs = YES;
ThingSmartMessageSetting *setting = [[ThingSmartMessageSetting alloc] init];
[setting modifyOnceDNDWithTimerID:123456 requestModel:requestModel success:^{
} failure:^(NSError *error) {
}];
Swift:
let requestModel = ThingSmartMessageOnceDNDRequestModel()
requestModel.startTime = "2024-07-02 18:00"
requestModel.endTime = "2024-07-03 06:00"
requestModel.isAllDevIDs = true
let setting = ThingSmartMessageSetting()
setting.modifyOnceDND(withTimerID: 123456, requestModel: requestModel) {
} failure: { error in
}
接口说明
- (void)removeDNDWithTimerID:(long)timerID success:(ThingSuccessHandler)success failure:(ThingFailureError)failure
参数说明
参数 | 说明 |
---|---|
timerID | 定时器 ID |
success | 成功回调 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C:
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
//long timerID = 1108056;
[messageSetting removeDNDWithTimerID:timerID success:^{
//移除成功
} failure:^(NSError *error) {
}];
Swift:
//let messageSetting = ThingSmartMessageSetting()
//let timerID = 1108056
messageSetting.removeDND(withTimerID: timerID, success: {
//移除成功
}, failure: { error in
})
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈