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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
//
// TuyaSmartDeviceModel.h
// TuyaSmartDeviceCoreKit
//
// Copyright (c) 2014-2021 Tuya Inc. (https://developer.tuya.com)
 
#ifndef TuyaSmart_TuyaSmartDeviceModel
#define TuyaSmart_TuyaSmartDeviceModel
 
#import "TuyaSmartSchemaModel.h"
#import "TuyaSmartDeviceModuleModel.h"
#import "TuyaSmartStandSchemaModel.h"
 
typedef enum : NSUInteger {
    
    TuyaSmartDeviceModelTypeWifiDev,         /// Wi-Fi
    
    TuyaSmartDeviceModelTypeBle,             /// Single Point Bluetooth Device
    
    TuyaSmartDeviceModelTypeGprs,            /// Gprs
    
    TuyaSmartDeviceModelTypeNBIoT,           /// NB-IoT
    
    TuyaSmartDeviceModelTypeZigbeeGateway,   /// Zigbee Gateway
    
    TuyaSmartDeviceModelTypeZigbeeSubDev,    /// Zigbee subDevice
    
    TuyaSmartDeviceModelTypeMeshBleSubDev,   /// Mesh
    
    TuyaSmartDeviceModelTypeInfraredGateway, /// Infrared gateway
    
    TuyaSmartDeviceModelTypeInfraredSubDev,  /// Infrared subDevice
    
    TuyaSmartDeviceModelTypeWifiGateway,     /// Wi-Fi Gateway
    
    TuyaSmartDeviceModelTypeWifiSubDev,      /// Wi-Fi subDevice
    
    TuyaSmartDeviceModelTypeSIGMeshGateway,  /// SIG Mesh Gateway
    
    TuyaSmartDeviceModelTypeSIGMeshSubDev,   /// SIG Mesh subDevice
    
} TuyaSmartDeviceModelType;
 
@interface TuyaSmartDeviceModel : NSObject
 
/// device Id
@property (nonatomic, strong) NSString     *devId;
 
/// name of device
@property (nonatomic, strong) NSString     *name;
 
/// link of device icon
@property (nonatomic, strong) NSString     *iconUrl;
 
/// ability of device
@property (nonatomic, assign) NSInteger    ability;
 
/// online of device
@property (nonatomic, assign) BOOL         isOnline;
 
/// cloud online of device
@property (nonatomic, assign) BOOL         isCloudOnline;
 
/// whether the device is shared
@property (nonatomic, assign) BOOL         isShare;
 
@property (nonatomic, strong) NSString     *verSw;
 
/// data point of device
@property (nonatomic, strong) NSDictionary *dps;
 
/// data point execution time of device
@property (nonatomic, strong) NSDictionary *dpsTime;
 
/// product Id
@property (nonatomic, strong) NSString     *productId;
 
/// whether to support group
@property (nonatomic, assign) BOOL         supportGroup;
 
/// whether to support standard group
@property (nonatomic, assign) BOOL         supportSGroup;
 
/// type of gateway
@property (nonatomic, strong) NSString     *gwType;
 
/// protocol version of gateway
@property (nonatomic, assign) double       pv;
 
#if TARGET_OS_IOS
 
/// online status of LAN
@property (nonatomic, assign) BOOL         isLocalOnline;
 
/// gateway protocol version of LAN
@property (nonatomic, assign) double       lpv;
 
#endif
 
/// hardware baseline version
@property (nonatomic, assign) double       bv;
 
/// lat, lon
@property (nonatomic, strong) NSString     *latitude;
@property (nonatomic, strong) NSString     *longitude;
 
/// dp name
@property (nonatomic, strong) NSDictionary *dpName;
 
/// schema of device
@property (nonatomic, strong) NSString     *schema;
@property (nonatomic, strong) NSString     *schemaExt;
@property (nonatomic, strong) NSArray<TuyaSmartSchemaModel *> *schemaArray;
 
@property (nonatomic, strong) NSString     *runtimeEnv;
 
/// attribute
@property (nonatomic, assign) NSUInteger    attribute;
 
@property (nonatomic, strong) NSString     *localKey;
 
@property (nonatomic, strong) NSString     *uuid;
 
/// Media Access Control Address
@property (nonatomic, strong) NSString *mac;
 
/// The network communication ability:0.wifi;1.cable;2.gprs;3.nb-iot; 10:bluetooth;11.blemesh;12.zigbee.
@property (nonatomic, assign) NSUInteger   capability;
 
@property (nonatomic, strong) NSString     *timezoneId;
 
@property (nonatomic, assign) long long    homeId;
@property (nonatomic, assign) long long    roomId;
@property (nonatomic, assign) long long    sharedTime;
 
/// order
@property (nonatomic, assign) NSInteger    displayOrder;
@property (nonatomic, assign) NSInteger    homeDisplayOrder;
 
@property (nonatomic, strong) NSString     *ip;
 
/// skills
@property (nonatomic, strong) NSDictionary *skills;
 
@property (nonatomic, strong) NSString     *cloudId;
 
#pragma mark - panel
 
@property (nonatomic, assign) BOOL         rnFind;
@property (nonatomic, assign) long long    i18nTime;
@property (nonatomic, strong) NSString     *ui;
@property (nonatomic, strong) NSString     *uiId;
@property (nonatomic, strong) NSString     *uiVersion;
@property (nonatomic, strong) NSString     *uiPhase;
@property (nonatomic, strong) NSString     *uiType;
@property (nonatomic, strong) NSString     *uiName;
@property (nonatomic, strong) NSDictionary *uiConfig;
@property (nonatomic, strong) NSDictionary *panelConfig;
@property (nonatomic, strong) NSString     *category;
@property (nonatomic, strong) NSString     *categoryCode;
@property (nonatomic, strong) NSArray      *quickOpDps;
@property (nonatomic, strong) NSArray      *displayDps;
@property (nonatomic, strong) NSArray      *faultDps;
@property (nonatomic, strong) NSDictionary *displayMsgs;
@property (nonatomic, strong) NSString     *switchDp;
 
@property (nonatomic, assign) BOOL         isNewFirmware;
@property (nonatomic, assign) NSTimeInterval activeTime;
@property (nonatomic, assign) long         errorCode;
 
@property (nonatomic, assign) TuyaSmartDeviceModelType deviceType;
@property (nonatomic, assign) BOOL         upgrading;
 
@property (nonatomic, strong) NSDictionary *originJson;
 
@property (nonatomic, strong) TuyaSmartDeviceModuleModel *moduleMap;
 
@property (nonatomic, assign) NSUInteger    bizAttribute;
 
@property (nonatomic, strong) NSDictionary *meta;
 
- (BOOL)attributeIsSupport:(NSUInteger)i;
- (BOOL)capabilityIsSupport:(NSUInteger)i;
- (BOOL)devAttributeIsSupport:(NSUInteger)i;
- (BOOL)baseAttributeIsSupport:(NSUInteger)i;
- (BOOL)protocolAttributeIsSupport:(NSUInteger)i;
 
#pragma mark - subdevice
/// node Id
@property (nonatomic, strong) NSString     *nodeId;
@property (nonatomic, strong) NSString     *parentId;
 
/// mesh
@property (nonatomic, strong) NSString     *vendorInfo;
@property (nonatomic, assign) BOOL         isMeshBleOnline;
@property (nonatomic, strong) NSString     *pcc;
 
#pragma mark - discovery device
/// mark:  0: 1<<0 auto  3:1<<3 route
@property (nonatomic, assign) NSUInteger devAttribute;
 
/// sig mesh dev key
@property (nonatomic, strong) NSString     *devKey;
 
/// Whether to standardize.
@property (nonatomic, assign) BOOL standard;
@property (nonatomic, strong) TuyaSmartStandSchemaModel *standSchemaModel;
 
/// dpCodes
@property (nonatomic, strong, readonly) NSDictionary *dpCodes;
 
/// Last dp update time.
@property (nonatomic, assign) NSTimeInterval dpMaxTime;
 
/// Is it a virtual device.
@property (nonatomic, assign) BOOL isVirtualDevice;
 
// Use `baseAttributeIsSupport: index` to check feature
//
// index rules:
// 9: Tuya ble mesh device
// 10: Support network check
@property (nonatomic, assign) NSUInteger baseAttribute;
 
// Use `protocolAttributeIsSupport: index` to check feature
//
// index rules:
// 0: support sigmesh feature
// 1: support zigbee feature
// 2: support subpieces feature
@property (nonatomic, assign) NSInteger protocolAttribute;
 
/// Whether auto-upgrade is supported. Currently NB/Bluetooth mesh devices do not support auto-upgrade.
@property (nonatomic, assign) BOOL supportAuto;
 
/// Support OTA upgrade method, from left to right, decreasing priority:
/// 0: WIFI, 1: BLE, 2: SIGMESH, 3: NB
@property (nonatomic, strong) NSArray *otaUpgradeModes;
 
@end
 
#endif