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
//
// TYCoreCacheService.h
// TuyaSmartDeviceCoreKit
//
// Copyright (c) 2014-2021 Tuya Inc. (https://developer.tuya.com)
 
#import <Foundation/Foundation.h>
 
NS_ASSUME_NONNULL_BEGIN
 
@protocol TYCoreCacheServiceDelegate <NSObject>
 
- (void)deviceWillRemove:(NSString *)devId;
- (void)groupWillRemove:(long long)groupId;
 
 
- (void)deviceWillAdd:(TuyaSmartDeviceModel *)deviceModel homeId:(long long)homeId;
- (void)groupWillAdd:(TuyaSmartGroupModel *)groupModel homeId:(long long)homeId;
 
- (void)deviceListWillAdd:(NSArray<TuyaSmartDeviceModel *> *)deviceList homeId:(long long)homeId;
 
@end
 
@interface TYCoreCacheService : NSObject
 
TYSDK_SINGLETON;
 
@property (nonatomic, weak) id<TYCoreCacheServiceDelegate> delegate;
 
/// Device cache.
@property (nonatomic, strong, readonly) NSMutableDictionary<NSString *, TuyaSmartDeviceModel *> *deviceData;
 
/// Group caching.
@property (nonatomic, strong, readonly) NSMutableDictionary<NSString *, TuyaSmartGroupModel *> *groupData;
 
/// Group product information cache.
@property (nonatomic, strong, readonly) NSMutableDictionary<NSString *, NSDictionary *> *groupProductData;
 
/// Group device relationship cache.
@property (nonatomic, strong, readonly) NSMutableDictionary<NSString *, NSArray<NSString *> *> *groupDeviceRelation;
 
/// Mesh information.
@property (nonatomic, strong, readonly) NSMutableDictionary<NSString *, TuyaSmartBleMeshModel *> *meshData;
 
/// Mesh Group information.
@property (nonatomic, strong, readonly) NSMutableDictionary *meshGroupAddData;
 
 
- (void)setCacheHandlerQueue:(dispatch_queue_t)queue;
 
- (void)reset;
 
- (TuyaSmartDeviceModel *)getDeviceInfoWithDevId:(NSString *)devId;
 
- (TuyaSmartGroupModel *)getGroupInfoWithGroupId:(long long)groupId;
 
- (NSDictionary *)getGroupProductWithProductId:(NSString *)productId;
 
- (NSArray <TuyaSmartDeviceModel *> *)getDeviceListWithGroupId:(long long)groupId;
 
- (void)updateGroupProductList:(NSArray <NSDictionary *> *)groupProductList;
 
- (void)updateDeviceGroupRelationWithDeviceList:(NSArray *)deviceList groupId:(long long)groupId;
 
- (void)updateDeviceGroupRelationWithDeviceList:(NSArray *)deviceList groupId:(long long)groupId shouldNotify:(BOOL)shouldNotify;
 
- (NSArray <TuyaSmartDeviceModel *> *)getAllDeviceList;
- (NSArray <TuyaSmartGroupModel *> *)getAllGroupList;
 
- (void)updateSharedDeviceList:(NSArray <TuyaSmartDeviceModel *> *)deviceList;
 
- (void)updateSharedGroupList:(NSArray <TuyaSmartGroupModel *> *)groupList;
 
- (NSArray <TuyaSmartDeviceModel *> *)getDeviceListWithHomeId:(long long)homeId;
// remove delegates
 
- (void)removeDeviceWithDevId:(NSString *)devId;
- (void)removeGroupWithGroupId:(long long)groupId;
 
// add delegate
 
- (void)addDeviceModel:(TuyaSmartDeviceModel *)deviceModel homeId:(long long)homeId;
- (void)addGroupModel:(TuyaSmartGroupModel *)groupModel homeId:(long long)homeId;
 
- (void)addDeviceModelList:(NSArray<TuyaSmartDeviceModel *> *)deviceModelList homeId:(long long)homeId;
 
// mesh
- (TuyaSmartBleMeshModel *)getMeshModelWithHomeId:(long long)homeId isSigMesh:(BOOL)isSigMesh;
- (TuyaSmartBleMeshModel *)getMeshModelWithMeshId:(NSString *)meshId;
- (void)updateMeshModel:(TuyaSmartBleMeshModel *)meshModel;
- (NSArray<TuyaSmartBleMeshModel *> *)getAllMeshList;
 
- (NSInteger)getMeshGroupAddressFromLocalWithMeshId:(NSString *)meshId;
- (NSInteger)getMeshGroupCountFromLocalWithMeshId:(NSString *)meshId;
- (void)removeMeshGroupWithAddress:(NSInteger)address meshId:(NSString *)meshId;
 
/// This is a special sharing type of device, such as sharing the family and sharing the device at the same time, to distinguish.
- (NSArray <NSString *> *)getSpecialSharedDevIds;
 
@end
 
NS_ASSUME_NONNULL_END