Last Updated on : 2023-05-22 06:38:29download
This topic describes the IPC UI BizBundles with different features. You can integrate with the desired UI BizBundles based on your business requirements.
Tuya IPC Panel BizBundle for iOS (TuyaSmartCameraPanelBizBundle
) is the panel SDK that provides a series of IPC features developed based on Smart Life App SDK.
The following features are supported:
Add the following code block to the Podfile
:
source "https://github.com/tuya/tuya-pod-specs"
source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'
target 'your_target_name' do
# Adds the IPC Panel BizBundle.
pod 'TuyaSmartCameraPanelBizBundle'
end
In the root directory of your project, run pod update
to integrate a third-party library by using CocoaPods. For more information about CocoaPods, see CocoaPods Guides.
Add the following permission declaration to info.plist
of your project:
The BizBundle encapsulates a series of React Native (RN) API methods for panels. This requires specific declarations of privacy and permissions from Apple.
NSPhotoLibraryAddUsageDescription
NSMicrophoneUsageDescription
The BizBundle relies on the implementation of the protocol TYCameraProtocol
to provide services. You can view the TYCameraProtocol.h
file in the TYModuleServices
component.
#import <UIKit/UIKit.h>
@class TuyaSmartDeviceModel;
@protocol TYCameraProtocol <NSObject>
/**
Returns the IPC native panel.
@param devId The device ID of the IPC.
@param uiName The UI name of the IPC. The value is included in `deviceModel` and varies depending on different panel versions.
*/
- (UIViewController *)viewControllerWithDeviceId:(NSString *)devId uiName:(NSString *)uiName;
@optional
/**
Navigates to the IPC playback panel.
@param deviceModel The device model.
*/
- (void)deviceGotoCameraNewPlayBackPanel:(TuyaSmartDeviceModel *)deviceModel;
/**
Navigates to the IPC cloud storage panel.
@param deviceModel The device model.
*/
- (void)deviceGotoCameraCloudStoragePanel:(TuyaSmartDeviceModel *)deviceModel;
/**
Navigates to the IPC message center panel.
@param deviceModel The device model.
*/
- (void)deviceGotoCameraMessageCenterPanel:(TuyaSmartDeviceModel *)deviceModel;
/**
Navigates to the IPC photo album panel.
@param deviceModel The device model.
*/
- (void)deviceGotoPhotoLibrary:(TuyaSmartDeviceModel *)deviceModel;
@end
The BizBundle depends on the following protocols: TYSmartHomeDataProtocol
and TYOTAGeneralProtocol
.
TYSmartHomeDataProtocol
: provides current home information required to load the device panel and must be implemented.
/**
Returns the current home. If the current user does not have a home, `nil` is returned.
@return TuyaSmartHome
*/
- (TuyaSmartHome *)getCurrentHome;
TYOTAGeneralProtocol
: enters the device panel and checks for device firmware updates. The following API method is implemented to check for device firmware updates:
/**
Checks for device firmware updates, and if any, shows the update prompt.
@param deviceModel The device that checks for firmware updates.
@param isManual Specifies whether to enable manual checking of firmware updates.
@param theme The theme color.
`YES`: Manually check for updates. A loading dialog box appears during the check. If a new update is found (check for updates, forced updates, and update notifications), OTA VC is displayed.
`NO`: Automatically check for updates. A loading dialog box does not appear during the check. When forced updates and update notifications are enabled, the firmware update prompt appears. Click **OK** to show OTA VC.
*/
- (void)checkFirmwareUpgrade:(TuyaSmartDeviceModel *)deviceModel isManual:(BOOL)isManual theme:(TYOTAControllerTheme)theme;
deviceModel.category
must be sp
.getCurrentHome
method provided by the protocol TYSmartHomeDataProtocol
must be implemented first.TuyaSmartCameraPanelSDK
are mutually exclusive and cannot be integrated at the same time. For more information about the migration, see Migrate to BizBundle SDK.ObjC:
#import <TuyaSmartBizCore/TuyaSmartBizCore.h>
#import <TYModuleServices/TYSmartHomeDataProtocol.h>
- (void)initCurrentHome {
// Registers the protocol to be implemented.
[[TuyaSmartBizCore sharedInstance] registerService:@protocol(TYSmartHomeDataProtocol) withInstance:self];
}
// Implements the protocol method.
- (TuyaSmartHome *)getCurrentHome {
TuyaSmartHome *home = [TuyaSmartHome homeWithHomeId:@"Current home ID"];
return home;
}
Swift:
import TuyaSmartDeviceKit
class TYActivatorTest: NSObject,TYSmartHomeDataProtocol{
func test() {
TuyaSmartBizCore.sharedInstance().registerService(TYSmartHomeDataProtocol.self, withInstance: self)
}
func getCurrentHome() -> TuyaSmartHome! {
let home = TuyaSmartHome.init(homeId: 111)
return home
}
}
An IPC native preview panel supports a bunch of features. For example, you can implement live video preview, switching between video definition modes, audio switch control, screenshots, video recording, video talk, motion detection, PTZ control, preset point addition or deletion, and auto-patrol control.
ObjC:
id<TYCameraProtocol> impl = [[TuyaSmartBizCore sharedInstance] serviceOfProtocol:@protocol(TYCameraProtocol)];
UIViewController *vc = [impl viewControllerWithDeviceId:self.deviceModel.devId uiName:self.device.uiName];
[self.navigationController pushViewController:vc animated:YES];
Swift:
let impl = TuyaSmartBizCore.sharedInstance().service(of: TYCameraProtocol.self) as? TYCameraProtocol
impl?.viewControllerWithDeviceId(withDeviceId: deviceModel.devId!, uiName: deviceModel.uiName)
Tuya IPC RN Panel BizBundle for iOS (TuyaSmartCameraRNPanelBizBundle
) is the panel SDK that provides a series of IPC features developed based on Smart Life App SDK.
The following features are supported:
Add the following code block to the Podfile
:
source "https://github.com/tuya/tuya-private-specs.git"
source 'https://cdn.cocoapods.org/'
target 'your_target_name' do
# Adds the panel control BizBundle.
pod 'TuyaSmartPanelBizBundle'
# After you add the IPC Panel BizBundle and integrate with the RN BizBundle, integrate with this BizBundle to implement features such as native albums as expected.
pod 'TuyaSmartCameraPanelBizBundle'
# Adds the IPC RN Panel BizBundle.
pod 'TuyaSmartCameraRNPanelBizBundle'
end
In the root directory of your project, run pod update
to integrate a third-party library by using CocoaPods. For more information about CocoaPods, see CocoaPods Guides.
Add the following permission declaration to info.plist
of your project:
The BizBundle encapsulates a series of RN API methods for panels. This requires specific declarations of privacy and permissions from Apple.
NSPhotoLibraryAddUsageDescription
NSMicrophoneUsageDescription
The BizBundle relies on the implementation of the protocol TYRNCameraProtocol
to provide services. You can view the TYRNCameraProtocol.h
file in the TYModuleServices
component.
#import <UIKit/UIKit.h>
@protocol TYRNCameraProtocol <NSObject>
/**
Returns the IPC RN panel.
@param devId The device ID of the IPC.
*/
- (UIViewController *)cameraRNPanelViewControllerWithDeviceId:(NSString *)devId;
@end
The BizBundle depends on the following protocols: TYSmartHomeDataProtocol
and TYOTAGeneralProtocol
.
TYSmartHomeDataProtocol
: provides current home information required to load the device panel and must be implemented.
/**
Returns the current home. If the current user does not have a home, `nil` is returned.
@return TuyaSmartHome
*/
- (TuyaSmartHome *)getCurrentHome;
TYOTAGeneralProtocol
: enters the device panel and checks for device firmware updates. The following API method is implemented to check for device firmware updates:
/**
Checks for device firmware updates, and if any, shows the update prompt.
@param deviceModel The device that checks for firmware updates.
@param isManual Specifies whether to enable manual checking of firmware updates.
@param theme The theme color.
`YES`: Manually check for updates. A loading dialog box appears during the check. If a new update is found (check for updates, forced updates, and update notifications), OTA VC is displayed.
`NO`: Automatically check for updates. A loading dialog box does not appear during the check. When forced updates and update notifications are enabled, the firmware update prompt appears. Click **OK** to show OTA VC.
*/
- (void)checkFirmwareUpgrade:(TuyaSmartDeviceModel *)deviceModel isManual:(BOOL)isManual theme:(TYOTAControllerTheme)theme;
deviceModel.category
must be sp
.getCurrentHome
method provided by the protocol TYSmartHomeDataProtocol
must be implemented first.TuyaSmartCameraPanelBizBundle
. The IPC album panel and other certain features are supported by the latter BizBundle.ObjC:
#import <TuyaSmartBizCore/TuyaSmartBizCore.h>
#import <TYModuleServices/TYSmartHomeDataProtocol.h>
- (void)initCurrentHome {
// Registers the protocol to be implemented.
[[TuyaSmartBizCore sharedInstance] registerService:@protocol(TYSmartHomeDataProtocol) withInstance:self];
}
// Implements the protocol method.
- (TuyaSmartHome *)getCurrentHome {
TuyaSmartHome *home = [TuyaSmartHome homeWithHomeId:@"Current home ID"];
return home;
}
Swift:
import TuyaSmartDeviceKit
class TYActivatorTest: NSObject,TYSmartHomeDataProtocol{
func test() {
TuyaSmartBizCore.sharedInstance().registerService(TYSmartHomeDataProtocol.self, withInstance: self)
}
func getCurrentHome() -> TuyaSmartHome! {
let home = TuyaSmartHome.init(homeId: 111)
return home
}
}
TYRNCameraProtocol
You need to register and implement the protocol method of TYRNCameraProtocol
only when custom RN panels are required. In this case, custom IPC panels are returned. By default, TuyaSmartPanelBizBundle
provides the implementation logic.
ObjC:
[[TuyaSmartBizCore sharedInstance] registerService:@protocol(TYRNCameraProtocol) withInstance:self];
Swift:
TuyaSmartBizCore.sharedInstance().registerService(TYRNCameraProtocol.self, withInstance: self)
An IPC RN preview panel supports a bunch of features. For example, you can implement live video preview, switching between video definition modes, audio switch control, screenshots, video recording, and video talk.
ObjC:
id<TYRNCameraProtocol> impl = [[TuyaSmartBizCore sharedInstance] serviceOfProtocol:@protocol(TYRNCameraProtocol)];
UIViewController *vc = [impl cameraRNPanelViewControllerWithDeviceId:self.deviceModel.devId];
[self.navigationController pushViewController:vc animated:YES];
Swift:
let impl = TuyaSmartBizCore.sharedInstance().service(of: TYRNCameraProtocol.self) as? TYRNCameraProtocol
impl?.cameraRNPanelViewControllerWithDeviceId(withDeviceId: deviceModel.devId!)
Tuya IPC Setting Panel BizBundle for iOS (TuyaSmartCameraSettingBizBundle
) is the panel SDK that provides a series of IPC setting features developed based on Smart Life App SDK.
The following features are supported:
Add the following code block to the Podfile
:
source "https://github.com/tuya/tuya-private-specs.git"
source 'https://cdn.cocoapods.org/'
target 'your_target_name' do
# Adds the IPC Setting Panel BizBundle.
pod 'TuyaSmartCameraSettingBizBundle'
end
In the root directory of your project, run pod update
to integrate a third-party library by using CocoaPods. For more information about CocoaPods, see CocoaPods Guides.
The BizBundle depends on the protocol TYCameraSettingProtocol
to provide services. You can view the TYCameraSettingProtocol.h
file in the TYModuleServices
component.
#import <UIKit/UIKit.h>
@protocol TYCameraSettingProtocol <NSObject>
/**
Generate settingViewController
Returns the IPC setting panel.
@param params The parameters of the camera setting page. For example, the homepage is indicated by @{@"devId" : Device ID, @"cameraSettingPanelIdentifier" : @"cameraSettingIndexIdentifier"}.
*/
- (UIViewController *)settingViewControllerWithDeviceParams:(NSDictionary *)params;
/**
Generate config item
Generates custom settings.
@param tag see developer doc identifiers.
@param visible whether is visible or not
@param callBack you can custom jump action
*/
- (id)generateSettingCustomModelWithTag:(NSString *)tag visible:(BOOL)visible callBack:(void(^_Nullable)(void))callBack;
/**
Config custom setting action and display
Configures whether settings are visible and navigates between settings.
@param items custom items, generated by generateSettingCustomModelWithTag:visible:callBack:
*/
- (void)configCustomItemWithItems:(NSArray<id>*)items;
@end
deviceModel.category
must be sp
.TYCameraSettingProtocol
You need to register and implement the protocol method of TYCameraSettingProtocol
only when custom IPC setting panels are required. In this case, custom IPC setting panels are returned. By default, TuyaSmartCameraSettingBizBundle
provides the implementation logic.
ObjC:
[[TuyaSmartBizCore sharedInstance] registerService:@protocol(TYCameraSettingProtocol) withInstance:self];
Swift:
TuyaSmartBizCore.sharedInstance().registerService(TYCameraSettingProtocol.self, withInstance: self)
Customizes the configurations of the setting page. For example, display or hide features, and capture tap events. Required API methods are defined in TYCameraSettingProtocol
.
API description
/**
Generate config item
Generates custom settings.
@param tag see developer doc identifiers.
@param visible whether is visible or not
@param callBack you can custom jump action
*/
- (id)generateSettingCustomModelWithTag:(NSString *)tag visible:(BOOL)visible callBack:(void(^_Nullable)(void))callBack;
Parameters
Parameter | Description |
---|---|
visible | Specifies whether to display a feature. Valid values:
|
callBack | The callback of a tap event. The navigation event in the callback can be customized. |
tag | The tag of a feature. Its values are described in the following table. |
Values of tag
Value | Feature |
---|---|
cameraSetting_iconInfoItem | Device icon and name |
cameraSetting_infoItem | Information about the device |
cameraSetting_autoItem | Tap-to-run and automation scenes |
cameraSetting_networkItem | Device network information |
cameraSetting_thirdPartyItem | Third-party services supported |
cameraSetting_privateModeCfgItem | Privacy mode switch |
cameraSetting_basicSectionHeaderCfgItem | Basic setting title |
cameraSetting_basicFuncCfgItem | Basic setting |
cameraSetting_nightvisionCfgItem | Night vision mode |
cameraSetting_irNightCfgItem | Infrared night vision |
cameraSetting_displaySettingCfgItem | Image adjustment |
cameraSetting_soundCfgItem | Audio adjustment |
cameraSetting_workModeCfgItem | Working mode |
cameraSetting_advanceSectionHeaderCfgItem | Advanced setting title |
cameraSetting_detectCfgItem | Detection alerts |
cameraSetting_pirFuncCfgItem | Passive infrared (PIR) |
cameraSetting_powerCfgItem | Battery management |
cameraSetting_bellCfgItem | Bell setting |
cameraSetting_sirenSettingCfgItem | Buzzer adjustment |
cameraSetting_videoLayoutCfgItem | Video layout |
cameraSetting_presentPointCfgItem | Preset point setting |
cameraSetting_onvifCfgItem | ONVIF |
cameraSetting_gatewaySectionHeaderCfgItem | Gateway title |
cameraSetting_gatewayCfgItem | Gateways |
cameraSetting_storageSectionHeaderCfgItem | Storage setting title |
cameraSetting_storageCfgItem | Storage settings |
cameraSetting_valueAddedSectionHeaderCfgItem | Value-added service title |
cameraSetting_valueAddedCfgItem | Value-added service |
cameraSetting_offlineSectionHeaderCfgItem | Title of a device offline notification |
cameraSetting_offlineCfgItem | Device offline notifications |
cameraSetting_otherSectionHeaderCfgItem | Other titles |
cameraSetting_feedbackCfgItem | FAQ and feedback |
cameraSetting_shareDeviceCfgItem | Device sharing |
cameraSetting_firmwareCfgItem | OTA firmware update |
cameraSetting_restartCfgItem | Device restart |
cameraSetting_removeCfgItem | Device removal |
cameraSetting_indicatorLightItem | Status indicator |
cameraSetting_besharedItem | Device source |
cameraSetting_soundDetectedItem | Sound detection |
cameraSetting_apModeItem | AP mode |
cameraSetting_unlockItem | Remote unlocking |
cameraSetting_cloudDisk | Pages of cloud disks managed on a base station |
cameraSetting_privacyZone | Privacy area setting |
cameraSetting_recording_time | Time setting of a single video clip |
cameraSetting_parking_mode | Parking mode setting |
cameraSetting_collision_alert | Collision alert |
cameraSetting_antiDismantle | Anti-pry alert switch |
cameraSetting_notification | Push notification settings |
cameraSetting_carInspection | Vehicle model detection switch |
cameraSetting_nonCarInspection | Non-motor vehicle detection switch |
cameraSetting_thirdPartyHeaderItem | Third-party title supported |
cameraSetting_pirSetItem | PIR setting |
cameraSetting_stationDoorbellItem | Setting of base station bell |
cameraSetting_stationDetectionItem | Base station detection alert |
API description
/**
Config custom setting action and display
Configures whether settings are visible and navigates between settings.
@param items custom items, generated by generateSettingCustomModelWithTag:visible:callBack:
*/
- (void)configCustomItemWithItems:(NSArray<id>*)items;
Parameters
Parameter | Description |
---|---|
items | An array of items generated by generateSettingCustomModelWithTag:visible:callBack: . |
ObjC:
id <TYCameraSettingProtocol> cameraSettingProtocol = [[TuyaSmartBizCore sharedInstance] serviceOfProtocol:@protocol(TYCameraSettingProtocol)];
id item1 = [cameraSettingProtocol generateSettingCustomModelWithTag:@"cameraSetting_infoItem" visible:NO callBack:nil];
id item2 = [cameraSettingProtocol generateSettingCustomModelWithTag:@"cameraSetting_networkItem" visible:NO callBack:nil];
[cameraSettingProtocol configCustomItemWithItems:@[item1, item2]];
Swift:
let cameraSettingProtocolImpl = TuyaSmartBizCore.sharedInstance().service(of: TYCameraSettingProtocol.self) as? TYCameraSettingProtocol
if let impl = cameraSettingProtocolImpl {
let item1 = impl.generateSettingCustomModel(withTag: "cameraSetting_infoItem", visible: false, callBack: nil)
let item2 = impl.generateSettingCustomModel(withTag: "cameraSetting_networkItem", visible: false, callBack: nil)
impl.configCustomItem(withItems: [item1!, item2!])
}
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback