更新时间:2024-11-13 02:00:11下载pdf
增值服务 UI 业务包提供 IPC 增值服务 v2.0 框架下的各类 IPC 增值服务,涵盖了 C 端用户在增值服务购买和使用过程中的全部功能,包括商品展示、下单购买、服务查询和订单展示等。
通过与 IPC 增值服务业务包的对接,您能够快速便捷地集成和应用多项增值服务,例如 IPC 云存储服务、托管服务、视频巡检服务、4G 流量服务以及 AI 事件服务等。
SDK 和 UI 业务包需要更新至 v5.17.0 及以上版本,才能使用增值服务 v2.0。
导入相关头文件。
Objective-C
#import <ThingSmartCameraKit/ThingSmartCameraVAS.h>
Swift
在 xxx_Bridging-Header.h
桥接文件中,添加以下内容:
#import <ThingSmartCameraKit/ThingSmartCameraVAS.h>
[ThingModule.routeService openRoute:response.url withParams:nil]
进行页面跳转。接口说明
- (void)fetchValueAddedServiceUrlWithParams:(ThingSmartCameraVASParams *)params success:(nullable ThingSmartCameraVASSuccess)success failure:(nullable ThingSmartCameraVASFailure)failure
参数 | 类型 | 说明 |
---|---|---|
params | ThingSmartCameraVASParams | 请求参数 |
success | ThingSmartCameraVASSuccess | 成功回调 |
failure | ThingSmartCameraVASFailure | 失败回调 |
ThingSmartCameraVASParams
字段 | 类型 | 说明 |
---|---|---|
spaceId | long long | 空间 ID,传入 homeId |
languageCode | NSString | 标准语言码 |
hybridType | ThingCameraVASHybridType | 程序类型 |
devId | NSString | 设备 ID |
categoryCode | ThingCameraVASCategoryCode | 增值服务品类码 |
extInfo | NSDictionary | 扩展信息 |
接口说明
- (void)fetchInspectionDetailUrlWithParams:(ThingSmartCameraVASInspectionParams *)params success:(nullable ThingSmartCameraVASSuccess)success failure:(nullable ThingSmartCameraVASFailure)failure
参数 | 类型 | 说明 |
---|---|---|
params | ThingSmartCameraVASInspectionParams | 请求参数 |
success | ThingSmartCameraVASSuccess | 成功回调 |
failure | ThingSmartCameraVASFailure | 失败回调 |
ThingSmartCameraVASInspectionParams
字段 | 类型 | 说明 |
---|---|---|
spaceId | long long | 空间 ID,传入 homeId |
devId | NSString | 设备 ID |
time | NSInteger | 时间,从 ThingSmartCameraMessageModel 中获取 |
reportId | NSString | 报告 ID,即 ThingSmartCameraMessageModel 的 extendParams 属性中的 inspectionReportId |
languageCode | NSString | 标准语言码,例如 en |
hybridType | ThingCameraVASHybridType | 程序类型,详情见下表 |
extInfo | NSDictionary | 扩展信息 |
ThingCameraVASHybridType
枚举值 | 说明 |
---|---|
ThingCameraVASHybridTypeH5 | H5 类型,不再迭代,请切换至小程序类型 |
ThingCameraVASHybridTypeMiniApp | 小程序类型 |
ThingCameraVASHybridTypeUnknown | 未知类型,服务出现异常 |
H5 类型不再迭代,为了提升性能和用户体验,强烈建议使用小程序类型。
示例代码
Objective-C
//增值服务
ThingSmartCameraVASParams *cameraVASParams = [[ThingSmartCameraVASParams alloc] initWithSpaceId:deviceModel.homeId languageCode:@"zh" hybridType:ThingCameraVASHybridTypeMiniApp categoryCode:ThingCameraVASCategoryCodeCloud devId:devId extInfo:nil];
ThingSmartCameraVAS *cameraVAS = [[ThingSmartCameraVAS alloc] init];
[cameraVAS fetchValueAddedServiceUrlWithParams:cameraVASParams success:^(id<ThingSmartCameraVASResponse> _Nullable response) {
[ThingModule.routeService openRoute:response.url withParams:nil];
} failure:^(NSError * _Nullable error) {
}];
//巡检报告
ThingSmartCameraMessageModel *cameraMessageModel;
NSString *reportId = cameraMessageModel.extendParams[@"inspectionReportId"];
ThingSmartCameraVASInspectionParams *inspectionParams = [[ThingSmartCameraVASInspectionParams alloc] initWithSpaceId:deviceModel.homeId devId:devId languageCode:@"zh" hybridType:ThingCameraVASHybridTypeMiniApp reportId:reportId time:cameraMessageModel.time extInfo:nil];
ThingSmartCameraVAS *cameraVAS = [[ThingSmartCameraVAS alloc] init];
[cameraVAS fetchInspectionDetailUrlWithParams:inspectionParams success:^(id<ThingSmartCameraVASResponse> _Nullable response) {
[ThingModule.routeService openRoute:response.url withParams:nil];
} failure:^(NSError * _Nullable error) {
}];
Swift
//增值服务
let cameraVASParams = ThingSmartCameraVASParams(spaceId: device.deviceModel.homeId, languageCode: "zh", hybridType: ThingCameraVASHybridType.miniApp, categoryCode: ThingCameraVASCategoryCode.cloud, devId: device.deviceModel.devId, extInfo: nil)
let vas = ThingSmartCameraVAS();
vas.fetchValueAddedServiceUrl(with: cameraVASParams) { res in
ThingModule.routeService()?.openRoute(res!.url!, withParams: nil)
} failure: { error in
}
//巡检报告
var messageList: [ThingSmartCameraMessageModel] = []
let cameraMessageModel : ThingSmartCameraMessageModel? = messageList.first
if let reportId = cameraMessageModel?.extendParams["inspectionReportId"] {
let inspectionParams = ThingSmartCameraVASInspectionParams(spaceId: device.deviceModel.homeId, devId: device.deviceModel.devId, languageCode: "zh", hybridType: ThingCameraVASHybridType.miniApp, reportId: reportId as! String, time: cameraMessageModel!.time, extInfo: nil)
let vas = ThingSmartCameraVAS();
vas.fetchInspectionDetailUrl(with: inspectionParams) { res in
ThingModule.routeService()?.openRoute(res!.url!, withParams: nil)
} failure: { error in
}
} else {
}
跳转云存储购买页前,先确认设备是否支持云存储服务,可通过 支持云存储 进行判断。
开通云存储服务后,可以查看和播放云存储视频。详细 API 请参考 云存储录像。
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈