Last Updated on : 2024-08-16 09:00:27download
This topic introduces how to configure do-not-disturb settings for device messages.
API description
- (void)setDeviceDNDSettingStatus:(BOOL)flags success:(ThingSuccessHandler)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
flags | Specifies whether to turn the do-not-disturb switch on or off. |
success | The success callback. |
failure | The failure callback, which returns a failure reason. |
Sample code
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
BOOL flags = YES;
[messageSetting setDeviceDNDSettingStatus:flags success:^{
// Set the status successfully.
} failure:^(NSError *error) {
}];
API description
- (void)getDeviceDNDSettingstatusSuccess:(ThingSuccessBOOL)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
success | The success callback, which returns a Boolean value. |
failure | The failure callback, which returns a failure reason. |
Sample code
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
[messageSetting getDeviceDNDSettingstatusSuccess:^(BOOL result){
// If result is YES, the do-not-disturb switch is turned on for device messages.
} failure:^(NSError *error) {
}];
API description
- (void)getDNDDeviceListSuccess:(ThingSuccessList)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
success | The success callback, which returns an array of device lists of all homes. |
failure | The failure callback, which returns a failure reason. |
Sample code
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
[messageSetting getDNDDeviceListSuccess:^(NSArray *list){
// Get device lists successfully.
} failure:^(NSError *error) {
}];
A recurrent do-not-disturb period can take effect repeatedly within a week. For example, during the do-not-disturb period from 8:00 to 12:00 on Monday to Friday, you do not receive any device alerts.
API description
- (void)getDNDListSuccess:(ThingSuccessList)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
success | The success callback, which returns an array of time periods. |
failure | The failure callback, which returns a failure reason. |
Sample code
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
[messageSetting getDNDListSuccess:^(NSArray *list){
// Get the list of do-not-disturb periods successfully.
} failure:^(NSError *error) {
}];
API description
- (void)addDNDWithDNDRequestModel:(ThingSmartMessageSettingDNDRequestModel *)requestModel success:(ThingSuccessHandler)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
requestModel | The request model for adding a do-not-disturb period.
|
success | The success callback. |
failure | The failure callback, which returns a failure reason. |
Sample code
//ThingSmartMessageSettingDNDRequestModel *requestModel = [[ThingSmartMessageSettingDNDRequestModel alloc] init];
//requestModel.startTime = @"07:10";
//requestModel.endTime = @"23:00";
//requestModel.devIDs = @[@"***",@"***"];
//0 means close that day, 1 means open on the day. @"0000111" means Friday to Sunday open. 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:^{
// Add a do-not-disturb period successfully.
} failure:^(NSError *error) {
}];
API description
- (void)modifyDNDWithTimerID:(long)timerID DNDRequestModel:(ThingSmartMessageSettingDNDRequestModel *)requestModel success:(ThingSuccessHandler)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
timerID | The ID of a do-not-disturb period. |
requestModel | The request model for modifying a do-not-disturb period.
|
success | The success callback. |
failure | The failure callback, which returns a failure reason. |
Sample code
//ThingSmartMessageSettingDNDRequestModel *requestModel = [[ThingSmartMessageSettingDNDRequestModel alloc] init];
//requestModel.startTime = @"07:10";
//requestModel.endTime = @"23:00";
//requestModel.devIDs = @[@"***",@"***"];
//0 means close that day, 1 means open on the day. @"0000111" means Friday to Sunday open. 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:^{
// Modify the do-not-disturb period successfully.
} failure:^(NSError *error) {
}];
API description
- (void)removeDNDWithTimerID:(long)timerID success:(ThingSuccessHandler)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
timerID | The timer ID. |
success | The success callback. |
failure | The failure callback, which returns a failure reason. |
Sample code
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
//long timerID = 1108056;
[messageSetting removeDNDWithTimerID:timerID success:^{
// Remove the do-not-disturb period successfully.
} failure:^(NSError *error) {
}];
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback