Last Updated on : 2023-07-13 07:14:41download
Multi-Control Linkage UI BizBundle provides the service logic and UI to implement linking multi-control devices in the multi-control linkage module.
In this feature, a device data point (DP) is linked with a DP of another device to create a multi-control group. When a device of the multi-control group is controlled, the linked status of other devices in the group is synchronously changed.
For example, 3 two-gang Zigbee sub-device switches, the first DP of each switch is linked with the first DP of the other two switches to create a multi-control group. When the first DP for one of these switches is set to off
, the first DP of the other two switches is synchronously set to off
.
Currently, the following devices are supported by multi-control linkage:
Add the components of the Multi-Control Linkage UI BizBundle to the Podfile
and run the command pod update
.
source 'https://github.com/tuya/tuya-private-specs.git'
source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'
target 'your_target_name' do
# Added the multi-control linkage BizBundle.
pod 'ThingSmartDeviceSyncBizBundle'
end
Before the integration with the UI BizBundle, you must query the target device IDs.
The UI BizBundle relies on the implementation of the protocol ThingDeviceSyncProtocol.h
to provide services. You can view the ThingDeviceSyncProtocol.h
file in the ThingModuleServices
component.
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol ThingDeviceSyncProtocol <NSObject>
typedef NS_ENUM(NSInteger, ThingDeviceSyncControlState) {
ThingDeviceSyncControlStateNone = 0, // The device bean does not exist.
ThingDeviceSyncControlStateSupport, // Multi-control linkage is supported.
ThingDeviceSyncControlStateNotSupport, // Multi-control linkage is not supported.
};
/**
Navigates to the multi-control linkage page.
@param devId The device ID of the main device.
@result ThingDeviceSyncControlState The status of multi-control linkage for the main device.
*/
- (ThingDeviceSyncControlState)gotoMultiControl:(NSString *)devId;
/**
Checks whether the current main device supports multi-control linkage.
@param devId The device ID of the main device.
@result BOOL Indicates whether the main device supports multi-control linkage.
*/
- (BOOL)isSupportMultiControl:(NSString *)devId;
@end
NS_ASSUME_NONNULL_END
ObjC:
#import <ThingSmartBizCore/ThingSmartBizCore.h>
#import <ThingModuleServices/ThingDeviceSyncProtocol.h>
// Implements the protocol method.
- (void)isSupportMultiControl {
NSString *deviceId = @"deviceId";
id<ThingDeviceSyncProtocol> impl = [[ThingSmartBizCore sharedInstance] serviceOfProtocol:@protocol(ThingDeviceSyncProtocol)];
BOOL isSupport = [impl isSupportMultiControl:deviceId];
}
Swift:
let impl = ThingSmartBizCore.sharedInstance().service(of:ThingDeviceSyncProtocol.self) as?ThingDeviceSyncProtocol
impl?.isSupportMultiControl(devId: @"deviceId")
ObjC:
#import <ThingSmartBizCore/ThingSmartBizCore.h>
#import <ThingModuleServices/ThingDeviceSyncProtocol.h>
// Implements the protocol method.
- (void)gotoMultiControl {
NSString *deviceId = @"deviceId";
id<ThingDeviceSyncProtocol> impl = [[ThingSmartBizCore sharedInstance] serviceOfProtocol:@protocol(ThingDeviceSyncProtocol)];
ThingDeviceSyncControlState state = [impl gotoMultiControl:deviceId];
}
Swift:
let impl = ThingSmartBizCore.sharedInstance().service(of:ThingDeviceSyncProtocol.self) as?ThingDeviceSyncProtocol
impl?.gotoMultiControl(devId: @"deviceId")
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback