更新时间:2023-06-05 02:49:23下载pdf
涂鸦智能摄像机 UI 业务包 提供了多种接入方式,您可以实现通过组件化快速集成多个业务包。业务包详情请参考 IPC UI 业务包。
将您的 Podfile 引用改为如下形式:
source "https://github.com/tuya/tuya-pod-specs.git"
source 'https://cdn.cocoapods.org/'
target 'your_target_name' do
# ThingSmart SDK
pod "ThingSmartHomeKit"
# 添加设备控制业务包,需要指定固定版本号
pod 'ThingSmartPanelBizBundle', 'xxx'
# 添加摄像机面板业务包
pod 'ThingSmartCameraPanelBizBundle', 'xxx'
# 若需要RN摄像机页面面,请添加摄像机 RN 面板业务包
pod 'ThingSmartCameraRNPanelBizBundle', 'xxx'
end
TuyaSmartCameraPanelSDK
类来实现摄像机控制面板,新版业务包提供一套组件化方案来调用各个业务包的功能接口。ThingSmartCameraPanelBizBundle
)和旧版 SDK(TuyaSmartCameraPanelSDK
)不兼容,不能同时集成。旧版调用方式
[TuyaSmartPanelSDK sharedInstance].homeId = deviceModel.homeId;
[[TuyaSmartPanelSDK sharedInstance] gotoPanelViewControllerWithDevice:deviceModel completion:^(NSError *error) {
NSLog(@"load error: %@", error);
}];
切换到新版调用方式
详细方式请参考 设备控制 UI 业务包。
id<ThingPanelProtocol> impl = [[ThingSmartBizCore sharedInstance] serviceOfProtocol:@protocol(ThingPanelProtocol)];
[impl gotoPanelViewControllerWithDevice:deviceModel group:nil initialProps:nil contextProps:nil completion:^(NSError * _Nullable error) {
if (error) {
NSLog(@"Load error: %@", error);
}
}];
TuyaSmartPanelSDKDelegate
回调面板内事件。当找不到设备对应的面板容器时,旧版调用方式为:
#pragma mark - TuyaSmartPanelSDKDelegate
- (nullable UIViewController *)requireSpecialPanelForDevice:(nullable TuyaSmartDeviceModel *)device orGroup:(nullable TuyaSmartGroupModel *)group {
}
切换到新版调用方式,针对不同类型的设备,提供不同的协议。例如:
ThingRNCameraProtocol
:IPC RN 面板。可以选择自行实现,或者直接接入 IPC 面板业务包 ThingSmartCameraRNPanelBizBundle
。
[[ThingSmartBizCore sharedInstance] registerService:@protocol(ThingRNCameraProtocol) withInstance:self];
#pragma mark - ThingRNCameraProtocol
- (UIViewController *)cameraRNPanelViewControllerWithDeviceId:(NSString *)devId {
}
ThingCameraProtocol
:IPC 原生面板。可以选择自行实现,或者直接接入 IPC 面板业务包 ThingSmartCameraPanelBizBundle
。
[[ThingSmartBizCore sharedInstance] registerService:@protocol(ThingCameraProtocol) withInstance:self];
#pragma mark - ThingCameraProtocol
- (UIViewController *)viewControllerWithDeviceId:(NSString *)devId uiName:(NSString *)uiName {
}
旧版调用方式
#pragma mark - TuyaSmartCameraPanelSDK
UIViewController *vc = [[TuyaSmartCameraPanelSDK sharedInstance] cameraViewControllerWithDeviceModel:deviceModel];
[self.nav pushViewControllver:vc animated:YES];
切换到新版调用方式
id<ThingCameraProtocol> impl = [[ThingSmartBizCore sharedInstance] serviceOfProtocol:@protocol(ThingCameraProtocol)];
UIViewController *vc = [impl viewControllerWithDeviceId:self.deviceModel.devId uiName:self.device.uiName];
[self.navigationController pushViewController:vc animated:YES];
如果您需要获取或者跳转其它面板,请参考 IPC UI 业务包 接口注释说明。
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈