1
wei
2021-01-21 62d098cb78296feaa6f786a20748921338db838c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
// TuyaSmartRouterActivator.h
// TuyaSmartActivatorKit
//
// Copyright (c) 2014-2021 Tuya Inc. (https://developer.tuya.com)
 
#import <TuyaSmartDeviceKit/TuyaSmartDeviceKit.h>
 
NS_ASSUME_NONNULL_BEGIN
 
@class TuyaSmartRouterActivator;
 
@protocol TuyaSmartRouterActivatorDelegate <NSObject>
 
/// Callback for configuration network status update.
/// @param activator The activator instance.
/// @param deviceModel The TuyaSmartDeviceModel.
/// @param error The error message.
- (void)routerActivator:(TuyaSmartRouterActivator *)activator didReceiveAutoConfigDevice:(TuyaSmartDeviceModel *)deviceModel error:(NSError *)error;
 
@end
 
@interface TuyaSmartRouterActivator : NSObject
 
/// Return the delegate of TuyaSmartRouterActivator.
@property (nonatomic, weak) id<TuyaSmartRouterActivatorDelegate> delegate;
 
 
/// Get the list of all gateway router devices under the current home.
/// @param homeId Current home ID.
/// @return Current list of all home gateway router devices.
- (NSArray <TuyaSmartDeviceModel *> *)autoActiveRouterDeviceListWithHomeId:(long long)homeId;
 
 
/// Obtain configuration token (valid for 10 minutes).
/// @param success Called when the task finishes successfully. TYSuccessString will be returned.
/// @param failure Called when the task is interrupted by an error.
- (void)getTokenSuccess:(TYSuccessString)success
                failure:(TYFailureError)failure;
 
 
/// Start discovering devices.
/// @param devIds Device ID list.
/// @param type Type, 0 to start discover device.
/// @param timeout Timeout, default 100 seconds
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
- (void)startDiscoverRouterWithDevIds:(NSArray<NSString *> *)devIds
                                 type:(NSInteger)type
                              timeout:(NSTimeInterval)timeout
                              success:(TYSuccessHandler)success
                              failure:(TYFailureError)failure;
 
 
/// Start discovering devices.
/// @param devIds Device ID list.
/// @param token Configuration token.
/// @param type Type, 0 to start discover device.
/// @param timeout Timeout, default 100 seconds
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
- (void)startDiscoverRouterWithDevIds:(NSArray<NSString *> *)devIds
                                token:(NSString *)token
                                 type:(NSInteger)type
                              timeout:(NSTimeInterval)timeout
                              success:(TYSuccessHandler)success
                              failure:(TYFailureError)failure;
 
 
/// Stop discovering devices.
- (void)stopDiscover;
 
 
/// Binding devices to home.
/// @param homeId HomeId.
/// @param devIds Device ID list.
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
- (void)bindDeviceWithHomeId:(long long)homeId devIds:(NSArray <NSString *>*)devIds success:(TYSuccessHandler)success failure:(TYFailureError)failure;
 
@end
 
NS_ASSUME_NONNULL_END