更新时间:2024-08-22 02:50:27下载pdf
本文介绍如何管理消息推送。
ThingSmartBusinessExtensionKit
组件提供了比 ThingSmartMessage
更多的功能。如果您仍直接在使用 ThingSmartMessage
,请参考 此链接。
根据消息类型,查询推送开关。消息类型分为:
接口说明
- (void)getMessagePushSwitchStatusWithType:(ThingSmartMessagePushSwitchType)type
success:(ThingSuccessBOOL _Nullable)success
failure:(ThingFailureError _Nullable)failure;
参数说明
参数 | 说明 |
---|---|
type | 消息类型:
|
success | 成功回调,返回推送开关状态 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C
[[ThingSmartMessagePushSetting new] getMessagePushSwitchStatusWithType:ThingSmartMessagePushSwitchTypeFamily success:^(BOOL result) {
} failure:^(NSError *error) {
}];
Swift
ThingSmartMessagePushSetting().getMessagePushSwitchStatus(with: .family) { result in
} failure: { error in
}
接口说明
- (void)setMessagePushSwitchStatusWithRequestModel:(ThingSmartMessagePushSwitchRequestModel *_Nonnull)requestModel
success:(__nullable ThingSuccessHandler)success
failure:(__nullable ThingFailureError)failure;
参数说明
参数 | 说明 |
---|---|
requestModel | 请求模型 |
success | 成功回调 |
failure | 失败回调,返回失败原因 |
ThingSmartMessagePushSwitchRequestModel
数据模型
字段 | 说明 |
---|---|
type | 消息类型:
|
open | 开关状态 |
示例代码
Objective-C
ThingSmartMessagePushSwitchRequestModel *requesModel = [[ThingSmartMessagePushSwitchRequestModel alloc] init];
requesModel.open = open;
requesModel.type = type;
[[ThingSmartMessagePushSetting new] setMessagePushSwitchStatusWithRequestModel:requesModel success:^{
} failure:^(NSError *error) {
}];
Swift
let requestModel = ThingSmartMessagePushSwitchRequestModel()
requestModel.open = true
requestModel.type = .family
ThingSmartMessagePushSetting().setMessagePushSwitchStatusWith(requestModel) {
} failure: { erro in
}
设备告警支持通过系统推送、电话和短信三种方式通知用户,可分别设置开关状态。其中,电话通知和短信通知需要另外开通增值服务,可咨询对接商务人员。同时,接入 高级功能 UI 业务包,提供用户购买服务的页面。
接口说明
- (void)getDeviceAlarmSwitchStatusWithPushChannel:(ThingSmartDeviceAlarmPushChannel)pushChannel
success:(ThingSuccessBOOL _Nullable)success
failure:(ThingFailureError _Nullable)failure;
参数说明
参数 | 说明 |
---|---|
pushChannel | 推送通道:
|
success | 成功回调,返回推送开关状态 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C
[[ThingSmartMessagePushSetting new] getDeviceAlarmSwitchStatusWithPushChannel:ThingSmartDeviceAlarmPushChannelSystem success:^(BOOL result) {
} failure:^(NSError *error) {
}];
Swift
ThingSmartMessagePushSetting().getDeviceAlarmSwitchStatus(with: .system) { result in
} failure: { error in
}
接口说明
- (void)setDeviceAlarmSwitchStatusWithRequestModel:(ThingSmartDeviceAlarmSwitchRequestModel *_Nonnull)requestModel
success:(__nullable ThingSuccessHandler)success
failure:(__nullable ThingFailureError)failure;
参数说明
参数 | 说明 |
---|---|
requestModel | 请求模型 |
success | 成功回调 |
failure | 失败回调,返回失败原因 |
ThingSmartDeviceAlarmSwitchRequestModel
数据模型
字段 | 说明 |
---|---|
pushChannel | 推送通道:
|
open | 开关状态 |
示例代码
Objective-C
ThingSmartDeviceAlarmSwitchRequestModel *requestModel = [[ThingSmartDeviceAlarmSwitchRequestModel alloc] init];
requestModel.open = YES;
requestModel.pushChannel = ThingSmartDeviceAlarmPushChannelSystem;
[[ThingSmartMessagePushSetting new] setDeviceAlarmSwitchStatusWithRequestModel:requestModel success:^{
} failure:^(NSError *error) {
}];
Swift
let requestModel = ThingSmartDeviceAlarmSwitchRequestModel()
requestModel.open = true
requestModel.pushChannel = .system
ThingSmartMessagePushSetting().setDeviceAlarmSwitchStatusWith(requestModel) {
} failure: { erro in
}
接口说明
- (void)getDeviceAlarmThrottleTimeWithPushChannel:(ThingSmartDeviceAlarmPushChannel)pushChannel
success:(ThingSuccessInt _Nullable )success
failure:(ThingFailureError _Nullable )failure;
参数说明
参数 | 说明 |
---|---|
pushChannel | 推送通道:
|
success | 成功回调,返回节流时间,单位分钟 |
failure | 失败回调,返回失败原因 |
示例代码
Objective-C
[[ThingSmartMessagePushSetting new] getDeviceAlarmThrottleTimeWithPushChannel:ThingSmartDeviceAlarmPushChannelSystem success:^(int result) {
} failure:^(NSError *error) {
}];
Swift
ThingSmartMessagePushSetting().getDeviceAlarmThrottleTime(with: .system) { time in
} failure: { error in
}
接口说明
- (void)setDeviceAlarmThrottleTimeWithRequestModel:(ThingSmartDeviceAlarmThrottleTimeRequestModel *_Nonnull)requestModel
success:(__nullable ThingSuccessBOOL)success
failure:(__nullable ThingFailureError)failure;
参数说明
参数 | 说明 |
---|---|
requestModel | 请求模型 |
success | 成功回调 |
failure | 失败回调,返回失败原因 |
ThingSmartDeviceAlarmThrottleTimeRequestModel
数据模型
字段 | 说明 |
---|---|
pushChannel | 推送通道:
|
minute | 节流时间,单位分钟 |
示例代码
Objective-C
ThingSmartDeviceAlarmThrottleTimeRequestModel *requestModel = [[ThingSmartDeviceAlarmThrottleTimeRequestModel alloc] init];
requestModel.minute = 10;
requestModel.pushChannel = ThingSmartDeviceAlarmPushChannelSystem;
[[ThingSmartMessagePushSetting new] setDeviceAlarmThrottleTimeWithRequestModel:requestModel success:^(BOOL result) {
} failure:^(NSError *error) {
}];
Swift
let requestModel = ThingSmartDeviceAlarmThrottleTimeRequestModel()
requestModel.minute = 10
requestModel.pushChannel = .system
ThingSmartMessagePushSetting().setDeviceAlarmThrottleTimeWith(requestModel) { result in
} failure: { error in
}
接口说明
- (void)getDeviceAlarmServiceInfoWithRequestModel:(ThingSmartDeviceAlarmServiceRequestModel *_Nonnull)requestModel
success:(void(^_Nullable)(NSArray <ThingSmartDeviceAlarmServiceInfoEntity *>* _Nullable result))success
failure:(ThingFailureError _Nullable )failure;
参数说明
参数 | 说明 |
---|---|
requestModel | 请求模型 |
success | 成功回调,返回设备告警配置列表 |
failure | 失败回调,返回失败原因 |
ThingSmartDeviceAlarmServiceRequestModel
数据模型
字段 | 说明 |
---|---|
pushChannel | 推送通道:
|
homeId | 家庭 ID |
deviceId | 设备 ID |
ThingSmartDeviceAlarmServiceInfoEntity
数据模型
字段 | 说明 |
---|---|
configId | 配置 ID |
configName | 配置名称 |
selected | 是否选中该配置 |
示例代码
Objective-C
ThingSmartDeviceAlarmServiceRequestModel *requestModel = [[ThingSmartDeviceAlarmServiceRequestModel alloc] init];
requestModel.deviceId = deviceId;
requestModel.pushChannel = pushChannel;
requestModel.homeId = familyId;
[[ThingSmartMessagePushSetting new] getDeviceAlarmServiceInfoWithRequestModel:requestModel success:^(NSArray<ThingSmartDeviceAlarmServiceInfoEntity *> * _Nullable result) {
} failure:^(NSError *error) {
}];
Swift
let requestModel = ThingSmartDeviceAlarmServiceRequestModel()
requestModel.homeId = 123
requestModel.deviceId = "xx"
requestModel.pushChannel = .system
ThingSmartMessagePushSetting().getDeviceAlarmServiceInfo(requestModel) { list in
} failure: { error in
}
接口说明
- (void)setDeviceAlarmServiceInfoWithRequestModel:(ThingSmartDeviceAlarmServiceUpdateRequestModel *_Nonnull)requestModel
success:(ThingSuccessBOOL _Nullable )success
failure:(ThingFailureError _Nullable )failure;
参数说明
参数 | 说明 |
---|---|
requestModel | 请求模型 |
success | 成功回调 |
failure | 失败回调,返回失败原因 |
ThingSmartDeviceAlarmServiceUpdateRequestModel
数据模型
字段 | 说明 |
---|---|
pushChannel | 推送通道:
|
homeId | 家庭 ID |
deviceId | 设备 ID |
configIds | 配置 ID 列表 |
示例代码
Objective-C
ThingSmartDeviceAlarmServiceUpdateRequestModel *requestModel = [[ThingSmartDeviceAlarmServiceUpdateRequestModel alloc] init];
requestModel.deviceId = deviceId;
requestModel.pushChannel = pushChannel;
requestModel.configIds = configIds;
requestModel.homeId = familyId;
[[ThingSmartMessagePushSetting new] setDeviceAlarmServiceInfoWithRequestModel:requestModel success:^(BOOL result) {
} failure:^(NSError *error) {
}];
Swift
let requestModel = ThingSmartDeviceAlarmServiceUpdateRequestModel()
requestModel.homeId = 123
requestModel.deviceId = "xx"
requestModel.pushChannel = .system
requestModel.configIds = ["xx","xx"]
ThingSmartMessagePushSetting().setDeviceAlarmServiceInfoWith(requestModel) { result in
} failure: { erro in
}
仅支持查询电话和短信通知的购买情况。
接口说明
- (void)getDeviceAlarmPurchaseInfoWithPushChannel:(ThingSmartDeviceAlarmPushChannel)pushChannel
success:(void(^_Nullable)(ThingSmartDeviceAlarmPurchaseEntity * _Nullable result))success
failure:(ThingFailureError _Nullable )failure;
参数说明
参数 | 说明 |
---|---|
pushChannel | 推送通道:
|
success | 成功回调,返回购买信息 |
failure | 失败回调,返回失败原因 |
ThingSmartDeviceAlarmPurchaseEntity
数据模型
字段 | 说明 |
---|---|
expireDate | 过期时间 |
packageStatus | 购买状态:
|
remainingTimes | 剩余次数 |
packageDesc | 描述 |
示例代码
Objective-C
[[ThingSmartMessagePushSetting new] getDeviceAlarmPurchaseInfoWithPushChannel:channel success:^(ThingSmartDeviceAlarmPurchaseEntity * _Nullable result) {
} failure:^(NSError *error) {
}];
Swift
ThingSmartMessagePushSetting().getDeviceAlarmPurchaseInfo(with: .phone) { result in
} failure: { error in
}
仅支持查询电话和短信推送通道下的告警设备列表。
接口说明
- (void)getDeviceAlarmListWithRequestModel:(ThingSmartDeviceAlarmListRequestModel *_Nonnull)requestModel
success:(void(^_Nullable)(ThingSmartDeviceAlarmListEntity * _Nullable result))success
failure:(ThingFailureError _Nullable )failure;
参数说明
参数 | 说明 |
---|---|
requestModel | 请求模型 |
success | 成功回调,返回设备列表 |
failure | 失败回调,返回失败原因 |
ThingSmartDeviceAlarmListRequestModel
数据模型
字段 | 说明 |
---|---|
pageNumber | 分页编号 |
pageSize | 分页大小 |
homeId | 家庭 ID |
pushChannel | 推送通道:
|
ThingSmartDeviceAlarmListEntity
数据模型
字段 | 说明 |
---|---|
hasMore | 是否还有更多数据 |
devices | 设备列表 |
ThingSmartDeviceAlarmItemEntity
数据模型
字段 | 说明 |
---|---|
deviceId | 设备 ID |
name | 设备名称 |
iconUrl | 设备图标 |
selectedNum | 设备已选择的告警配置数量 |
totalNum | 总告警配置数量 |
示例代码
Objective-C
ThingSmartDeviceAlarmListRequestModel *requestModel = [[ThingSmartDeviceAlarmListRequestModel alloc] init];
requestModel.pushChannel = ThingSmartDeviceAlarmPushChannelPhone;
requestModel.pageNumber = 1;
requestModel.pageSize = 15;
requestModel.homeId = familyId;
[[ThingSmartMessagePushSetting new] getDeviceAlarmListWithRequestModel:requestModel success:^(ThingSmartDeviceAlarmListEntity * _Nullable result) {
} failure:^(NSError *error) {
}];
Swift
let requestModel = ThingSmartDeviceAlarmListRequestModel()
requestModel.homeId = 123
requestModel.pageSize = 15
requestModel.pageNumber = 1
requestModel.pushChannel = .phone
ThingSmartMessagePushSetting().getDeviceAlarmList(with: requestModel) { list in
} failure: { error in
}
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈