This document is deprecated, please go to Tuya Developer Documentation Center to view the latest version: Tuya Smart Doc
1. Cloud Service BizBundle
Tuya smart cameras provide cloud storage video services, and cloud storage services can be activated through this bizBundle. After active cloud storage service, you can view and play cloud storage videos through IPC SDK.
1.1. Integrate
Add the TuyaSmartCloudServiceBizBundle
in the project's Podfile
file and execute thepod update
command.
source "https://github.com/TuyaInc/TuyaPublicSpecs.git"
source 'https://cdn.cocoapods.org/'
target 'your_target_name' do
# Add cloud service bizBundle
pod 'TuyaSmartCloudServiceBizBundle'
end
1.2. Service protocol
The cloud service bizBundle implements the TYCameraCloudServiceProtocol
protocol to provide services. View theTYCameraCloudServiceProtocol.h
file in the TYModuleServices
as follows:
#import <Foundation/Foundation.h>
@class TuyaSmartDeviceModel;
@protocol TYCameraCloudServiceProtocol <NSObject>
/**
* Request cloud service product page
*
* @param deviceModel which device that want to activate cloud services
*/
- (void)requestCloudServicePageWithDevice:(TuyaSmartDeviceModel *)deviceModel completionBlock:(void(^)(__kindof UIViewController *page, NSError *error))callback;
@end
1.2.1. Service Required By BizBundle
None.
1.3. User guidance
1.3.1. Precautions
- Before using any method, be sure to confirm that the user is logged in.
- The cloud storage service corresponds to the device one by one. When request the cloud storage service page, you need to pass in the
TuyaSmartDeviceModel
of the corresponding device. - Get the cloud service page as
UIViewController
, be sure to useUINavigationController
topush
orpresent
it.
Cloud storage services are strongly related to user information. The cloud storage service purchase page depends on the navigation controller and sets the navigation bar content, so the navigation controller needs to be packaged.
1.3.2. Get cloud service page (UIViewController)
Objc
id<TYCameraCloudServiceProtocol> impl = [[TuyaSmartBizCore sharedInstance] serviceOfProtocol:@protocol(TYCameraCloudServiceProtocol)];
[impl requestCloudServicePageWithDevice:self.deviceModel completionBlock:^(__kindof UIViewController *page, NSError *error) {
if (page) {
[self.navigationController pushViewController:page animated:YES];
}
}];
Swift
let impl = TuyaSmartBizCore.sharedInstance().service(of: TYCameraCloudServiceProtocol.self)
(impl as? TYCameraCloudServiceProtocol)?.requestCloudServicePage(deviceModel, completionBlock: { (page, error) in
guard let cloudServiceVc = page {
print("\(error!)")
return
}
yourNaviController.pushViewController(cloudServiceVc, animated: true)
})