@@ -43,12 +43,12 @@ - (instancetype)init
43
43
}
44
44
45
45
- (void )setXPCConnection : (MTRDeviceControllerXPCConnection *)xpcConnection
46
- controllerId : (id <NSCopying >)controllerId
47
- deviceId : (NSNumber *)deviceId
46
+ controllerID : (id <NSCopying >)controllerID
47
+ deviceID : (NSNumber *)deviceID
48
48
{
49
49
self.xpcConnection = xpcConnection;
50
- self.xpcControllerId = controllerId ;
51
- self.deviceId = deviceId ;
50
+ self.xpcControllerID = controllerID ;
51
+ self.deviceID = deviceID ;
52
52
self.shouldUseXPC = YES ;
53
53
}
54
54
@@ -78,9 +78,9 @@ static CHIP_ERROR AppendAttibuteValueToArray(
78
78
return err;
79
79
}
80
80
81
- - (void )readAttributeWithEndpointId : (NSNumber * _Nullable)endpointId
82
- clusterId : (NSNumber * _Nullable)clusterId
83
- attributeId : (NSNumber * _Nullable)attributeId
81
+ - (void )readAttributeWithEndpointID : (NSNumber * _Nullable)endpointID
82
+ clusterID : (NSNumber * _Nullable)clusterID
83
+ attributeID : (NSNumber * _Nullable)attributeID
84
84
clientQueue : (dispatch_queue_t )clientQueue
85
85
completion : (MTRDeviceResponseHandler)completion
86
86
{
@@ -97,16 +97,16 @@ - (void)readAttributeWithEndpointId:(NSNumber * _Nullable)endpointId
97
97
completion (nil , [NSError errorWithDomain: MTRErrorDomain code: MTRErrorCodeGeneralError userInfo: nil ]);
98
98
return ;
99
99
}
100
- __auto_type controllerId = self.xpcControllerId ;
101
- NSNumber * nodeId = self.deviceId ;
100
+ __auto_type controllerId = self.xpcControllerID ;
101
+ NSNumber * nodeId = self.deviceID ;
102
102
[xpcConnection
103
103
getProxyHandleWithCompletion: ^(dispatch_queue_t _Nonnull queue, MTRDeviceControllerXPCProxyHandle * _Nullable handle) {
104
104
if (handle) {
105
105
[handle.proxy readAttributeCacheWithController: controllerId
106
106
nodeId: nodeId.unsignedLongLongValue
107
- endpointId: endpointId
108
- clusterId: clusterId
109
- attributeId: attributeId
107
+ endpointId: endpointID
108
+ clusterId: clusterID
109
+ attributeId: attributeID
110
110
completion: ^(id _Nullable values, NSError * _Nullable error) {
111
111
completion ([MTRDeviceController decodeXPCResponseValues: values], error);
112
112
__auto_type handleRetainer = handle;
@@ -121,7 +121,7 @@ - (void)readAttributeWithEndpointId:(NSNumber * _Nullable)endpointId
121
121
}
122
122
123
123
dispatch_async (DeviceLayer::PlatformMgrImpl ().GetWorkQueue (), ^{
124
- if (endpointId == nil && clusterId == nil ) {
124
+ if (endpointID == nil && clusterID == nil ) {
125
125
MTR_LOG_ERROR (" Error: currently read from attribute cache does not support wildcards for both endpoint and cluster" );
126
126
completionHandler (nil , [NSError errorWithDomain: MTRErrorDomain code: MTRErrorCodeInvalidArgument userInfo: nil ]);
127
127
return ;
@@ -135,39 +135,39 @@ - (void)readAttributeWithEndpointId:(NSNumber * _Nullable)endpointId
135
135
136
136
NSMutableArray * result = [[NSMutableArray alloc ] init ];
137
137
CHIP_ERROR err = CHIP_NO_ERROR;
138
- if (endpointId == nil ) {
138
+ if (endpointID == nil ) {
139
139
err = self.cppAttributeCache ->ForEachAttribute (
140
- static_cast <chip::ClusterId>([clusterId unsignedLongValue ]), [&](const app::ConcreteAttributePath & path) {
141
- if (attributeId == nil
142
- || static_cast <chip::AttributeId>([attributeId unsignedLongValue ]) == path.mAttributeId ) {
140
+ static_cast <chip::ClusterId>([clusterID unsignedLongValue ]), [&](const app::ConcreteAttributePath & path) {
141
+ if (attributeID == nil
142
+ || static_cast <chip::AttributeId>([attributeID unsignedLongValue ]) == path.mAttributeId ) {
143
143
(void ) AppendAttibuteValueToArray (path, self.cppAttributeCache , result);
144
144
}
145
145
return CHIP_NO_ERROR;
146
146
});
147
- } else if (clusterId == nil ) {
147
+ } else if (clusterID == nil ) {
148
148
err = self.cppAttributeCache ->ForEachCluster (
149
- static_cast <chip::EndpointId>([endpointId unsignedShortValue ]), [&](chip::ClusterId enumeratedClusterId) {
150
- (void ) self.cppAttributeCache ->ForEachAttribute (static_cast <chip::EndpointId>([endpointId unsignedShortValue ]),
149
+ static_cast <chip::EndpointId>([endpointID unsignedShortValue ]), [&](chip::ClusterId enumeratedClusterId) {
150
+ (void ) self.cppAttributeCache ->ForEachAttribute (static_cast <chip::EndpointId>([endpointID unsignedShortValue ]),
151
151
enumeratedClusterId, [&](const app::ConcreteAttributePath & path) {
152
- if (attributeId == nil
153
- || static_cast <chip::AttributeId>([attributeId unsignedLongValue ]) == path.mAttributeId ) {
152
+ if (attributeID == nil
153
+ || static_cast <chip::AttributeId>([attributeID unsignedLongValue ]) == path.mAttributeId ) {
154
154
(void ) AppendAttibuteValueToArray (path, self.cppAttributeCache , result);
155
155
}
156
156
return CHIP_NO_ERROR;
157
157
});
158
158
return CHIP_NO_ERROR;
159
159
});
160
- } else if (attributeId == nil ) {
161
- err = self.cppAttributeCache ->ForEachAttribute (static_cast <chip::EndpointId>([endpointId unsignedShortValue ]),
162
- static_cast <chip::ClusterId>([clusterId unsignedLongValue ]), [&](const app::ConcreteAttributePath & path) {
160
+ } else if (attributeID == nil ) {
161
+ err = self.cppAttributeCache ->ForEachAttribute (static_cast <chip::EndpointId>([endpointID unsignedShortValue ]),
162
+ static_cast <chip::ClusterId>([clusterID unsignedLongValue ]), [&](const app::ConcreteAttributePath & path) {
163
163
(void ) AppendAttibuteValueToArray (path, self.cppAttributeCache , result);
164
164
return CHIP_NO_ERROR;
165
165
});
166
166
} else {
167
167
app::ConcreteAttributePath path;
168
- path.mEndpointId = static_cast <chip::EndpointId>([endpointId unsignedShortValue ]);
169
- path.mClusterId = static_cast <chip::ClusterId>([clusterId unsignedLongValue ]);
170
- path.mAttributeId = static_cast <chip::AttributeId>([attributeId unsignedLongValue ]);
168
+ path.mEndpointId = static_cast <chip::EndpointId>([endpointID unsignedShortValue ]);
169
+ path.mClusterId = static_cast <chip::ClusterId>([clusterID unsignedLongValue ]);
170
+ path.mAttributeId = static_cast <chip::AttributeId>([attributeID unsignedLongValue ]);
171
171
err = AppendAttibuteValueToArray (path, self.cppAttributeCache , result);
172
172
}
173
173
if (err == CHIP_NO_ERROR) {
@@ -179,3 +179,20 @@ - (void)readAttributeWithEndpointId:(NSNumber * _Nullable)endpointId
179
179
}
180
180
181
181
@end
182
+
183
+ @implementation MTRAttributeCacheContainer (Deprecated)
184
+
185
+ - (void )readAttributeWithEndpointId : (NSNumber * _Nullable)endpointId
186
+ clusterId : (NSNumber * _Nullable)clusterId
187
+ attributeId : (NSNumber * _Nullable)attributeId
188
+ clientQueue : (dispatch_queue_t )clientQueue
189
+ completion : (MTRDeviceResponseHandler)completion
190
+ {
191
+ [self readAttributeWithEndpointID: endpointId
192
+ clusterID: clusterId
193
+ attributeID: attributeId
194
+ clientQueue: clientQueue
195
+ completion: completion];
196
+ }
197
+
198
+ @end
0 commit comments