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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//
// TuyaSmartBleMeshGroup.h
// TuyaSmartBLEMeshKit
//
// Copyright (c) 2014-2021 Tuya Inc. (https://developer.tuya.com)
 
#import <Foundation/Foundation.h>
 
NS_ASSUME_NONNULL_BEGIN
 
@class TuyaSmartBleMeshGroup;
 
@protocol TuyaSmartBleMeshGroupDelegate <NSObject>
 
/// Group response of SIG mesh device joining gateway.
/// @param group TuyaSmartBleMeshGroup.
/// @param responseCode 1: Exceeded the maximum number of scenes 2: sub device timeout 3: set value out of range 4: write file error 5: other errors.
- (void)meshGroup:(TuyaSmartBleMeshGroup *)group addResponseCode:(NSArray <NSNumber *> *)responseCode;
 
/// SIG mesh device removes response from gateway group.
/// @param group TuyaSmartBleMeshGroup.
/// @param responseCode 1: Exceeded the maximum number of scenes 2: sub device timeout 3: set value out of range 4: write file error 5: other errors.
- (void)meshGroup:(TuyaSmartBleMeshGroup *)group removeResponseCode:(NSArray <NSNumber *> *)responseCode;
  
@end
 
@interface TuyaSmartBleMeshGroup : NSObject
 
@property (nonatomic, weak, nullable) id<TuyaSmartBleMeshGroupDelegate> delegate;
 
@property (nonatomic, strong, readonly) TuyaSmartGroupModel *meshGroupModel;
 
/// Get mesh group object.
/// @param groupId The group ID.
+ (instancetype)meshGroupWithGroupId:(NSInteger)groupId;
 
/// Get mesh group object.
/// @param groupId The group ID.
- (instancetype)initWithGroupId:(NSInteger)groupId NS_DESIGNATED_INITIALIZER;
 
- (instancetype)init NS_UNAVAILABLE;
 
/// Assign group ID to cloud.
/// @param meshId The mesh ID.
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
+ (void)getBleMeshGroupAddressFromCluondWithMeshId:(NSString *)meshId
                                           success:(TYSuccessInt)success
                                           failure:(TYFailureError)failure;
 
/// Create mesh group.
/// @param groupName Mesh group name.
/// @param meshId The mesh ID.
/// @param localId Local short address of the group.
/// @param pcc Group device size class
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
+ (void)createMeshGroupWithGroupName:(NSString *)groupName
                              meshId:(NSString *)meshId
                             localId:(NSString *)localId
                                 pcc:(NSString *)pcc
                             success:(TYSuccessInt)success
                             failure:(TYFailureError)failure;
 
+ (NSInteger)getBleMeshGroupAddress;
 
+ (NSInteger)getBleMeshGroupCount;
 
- (void)deleteBleMeshGroupAddress:(NSInteger)address;
 
/// Modify mesh group name.
/// @param meshGroupName The mesh group name.
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
- (void)updateMeshGroupName:(NSString *)meshGroupName success:(TYSuccessHandler)success failure:(TYFailureError)failure;
 
/// Delete mesh group.
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
- (void)removeMeshGroupWithSuccess:(TYSuccessHandler)success failure:(TYFailureError)failure;
 
/// Add device.
/// @param deviceId The device ID.
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
- (void)addDeviceWithDeviceId:(NSString *)deviceId success:(TYSuccessHandler)success failure:(TYFailureError)failure;
 
/// Batch modify equipment.
/// @param deviceList The device list.
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
- (void)editDeviceWithDeviceList:(NSArray *)deviceList success:(TYSuccessHandler)success failure:(TYFailureError)failure;
 
/// Remove the device.
/// @param deviceId The device ID.
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
- (void)removeDeviceWithDeviceId:(NSString *)deviceId success:(TYSuccessHandler)success failure:(TYFailureError)failure;
 
/// Get the list information of devices in the group.
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
- (void)getDeviceListInfoWithSuccess:(void (^)(NSArray <TuyaSmartDeviceModel *> *deviceList))success failure:(TYFailureError)failure;
 
/// Get the list information of devices in the group.
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
/// @deprecated This method is deprecated, Use TuyaSmartBleMeshGroup getDeviceListInfoWithSuccess:failure: instead.
- (void)getDeviveListInfoWithSuccess:(void (^)(NSArray <TuyaSmartDeviceModel *> *deviceList))success failure:(TYFailureError)failure __deprecated_msg("This method is deprecated, Use [TuyaSmartBleMeshGroup getDeviceListInfoWithSuccess:failure:] instead");
 
@end
 
#pragma mark - SIG Mesh
 
@interface TuyaSmartBleMeshGroup (SIGMesh)
 
/// Add sig mesh sub device group through sig mesh gateway.
/// It is necessary to ensure that the relationship of the sub devices belongs to the sig mesh gateway.
/// @param subList Gateway sub equipment to be operated.
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
- (void)addSubDeviceWithSubList:(NSArray<TuyaSmartDeviceModel *> * _Nonnull )subList success:(nullable TYSuccessHandler)success failure:(nullable TYFailureError)failure;
 
/// Delete sig mesh sub device group through sig mesh gateway.
/// It is necessary to ensure that the relationship of the sub devices belongs to the sig mesh gateway.
/// @param subList Gateway sub equipment to be operated.
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
- (void)removeSubDeviceWithSubList:(NSArray<TuyaSmartDeviceModel *> * _Nonnull )subList success:(nullable TYSuccessHandler)success failure:(nullable TYFailureError)failure;
 
- (void)publishDps:(NSDictionary *)dps success:(nullable TYSuccessHandler)success failure:(nullable TYFailureError)failure;
 
/// Custom param publish
/// @param params param:dictionary  { "localId":"c050" ,"dps":{"1":true}  “pcc”:"1510"}
/// @param success Called when the task finishes successfully.
/// @param failure Called when the task is interrupted by an error.
- (void)publishDpsWithParams:(NSDictionary *)params success:(TYSuccessHandler)success failure:(TYFailureError)failure;
 
@end
 
NS_ASSUME_NONNULL_END