@@ -1000,6 +1000,8 @@ - (void)readAttributePaths:(NSArray<MTRAttributeRequestPath *> * _Nullable)attri
1000
1000
queue:(dispatch_queue_t)queue
1001
1001
completion:(MTRDeviceResponseHandler)completion
1002
1002
{
1003
+ MTR_LOG("%@ readAttributePaths: %@, eventPaths: %@", self, attributePaths, eventPaths);
1004
+
1003
1005
[self readAttributePaths:attributePaths eventPaths:eventPaths params:params includeDataVersion:NO queue:queue completion:completion];
1004
1006
}
1005
1007
@@ -1010,6 +1012,9 @@ - (void)readAttributePaths:(NSArray<MTRAttributeRequestPath *> * _Nullable)attri
1010
1012
queue:(dispatch_queue_t)queue
1011
1013
completion:(MTRDeviceResponseHandler)completion
1012
1014
{
1015
+ // NOTE: Do not log the read here. This is called ether from
1016
+ // readAttributePaths:eventPaths:params:queue:completion: or MTRDevice, both
1017
+ // of which already log, and we want to be able to tell the two codepaths apart.
1013
1018
if ((attributePaths == nil || [attributePaths count] == 0) && (eventPaths == nil || [eventPaths count] == 0)) {
1014
1019
// No paths, just return an empty array.
1015
1020
dispatch_async(queue, ^{
@@ -1166,6 +1171,19 @@ - (void)writeAttributeWithEndpointID:(NSNumber *)endpointID
1166
1171
timedWriteTimeout:(NSNumber * _Nullable)timeoutMs
1167
1172
queue:(dispatch_queue_t)queue
1168
1173
completion:(MTRDeviceResponseHandler)completion
1174
+ {
1175
+ MTR_LOG("%@ write %@ 0x%llx 0x%llx: %@", self, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue, value);
1176
+
1177
+ [self _writeAttributeWithEndpointID:endpointID clusterID:clusterID attributeID:attributeID value:value timedWriteTimeout:timeoutMs queue:queue completion:completion];
1178
+ }
1179
+
1180
+ - (void)_writeAttributeWithEndpointID:(NSNumber *)endpointID
1181
+ clusterID:(NSNumber *)clusterID
1182
+ attributeID:(NSNumber *)attributeID
1183
+ value:(id)value
1184
+ timedWriteTimeout:(NSNumber * _Nullable)timeoutMs
1185
+ queue:(dispatch_queue_t)queue
1186
+ completion:(MTRDeviceResponseHandler)completion
1169
1187
{
1170
1188
auto * bridge = new MTRDataValueDictionaryCallbackBridge(queue, completion,
1171
1189
^(ExchangeManager & exchangeManager, const SessionHandle & session, MTRDataValueDictionaryCallback successCb,
@@ -1346,6 +1364,7 @@ - (void)invokeCommandWithEndpointID:(NSNumber *)endpointID
1346
1364
commandFields:commandFields
1347
1365
timedInvokeTimeout:timeoutMs
1348
1366
serverSideProcessingTimeout:nil
1367
+ logCall:YES
1349
1368
queue:queue
1350
1369
completion:completion];
1351
1370
}
@@ -1356,6 +1375,7 @@ - (void)_invokeCommandWithEndpointID:(NSNumber *)endpointID
1356
1375
commandFields:(id)commandFields
1357
1376
timedInvokeTimeout:(NSNumber * _Nullable)timeoutMs
1358
1377
serverSideProcessingTimeout:(NSNumber * _Nullable)serverSideProcessingTimeout
1378
+ logCall:(BOOL)logCall
1359
1379
queue:(dispatch_queue_t)queue
1360
1380
completion:(MTRDeviceResponseHandler)completion
1361
1381
{
@@ -1376,6 +1396,10 @@ - (void)_invokeCommandWithEndpointID:(NSNumber *)endpointID
1376
1396
timeoutMs = MTRClampedNumber(timeoutMs, @(1), @(UINT16_MAX));
1377
1397
}
1378
1398
1399
+ if (logCall) {
1400
+ MTR_LOG("%@ invoke %@ 0x%llx 0x%llx: %@", self, endpointID, clusterID.unsignedLongLongValue, commandID.unsignedLongLongValue, commandFields);
1401
+ }
1402
+
1379
1403
auto * bridge = new MTRDataValueDictionaryCallbackBridge(queue, completion,
1380
1404
^(ExchangeManager & exchangeManager, const SessionHandle & session, MTRDataValueDictionaryCallback successCb,
1381
1405
MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) {
@@ -1499,6 +1523,7 @@ - (void)_invokeKnownCommandWithEndpointID:(NSNumber *)endpointID
1499
1523
commandFields:commandFields
1500
1524
timedInvokeTimeout:timeout
1501
1525
serverSideProcessingTimeout:serverSideProcessingTimeout
1526
+ logCall:YES
1502
1527
queue:queue
1503
1528
completion:responseHandler];
1504
1529
}
@@ -2157,6 +2182,12 @@ - (void)downloadLogOfType:(MTRDiagnosticLogType)type
2157
2182
completion:completion];
2158
2183
}
2159
2184
2185
+ - (NSString *)description
2186
+ {
2187
+ return [NSString
2188
+ stringWithFormat:@"<%@: %p, node: %016llX-%016llX (%llu)>", NSStringFromClass(self.class), self, _deviceController.compressedFabricID.unsignedLongLongValue, _nodeID, _nodeID];
2189
+ }
2190
+
2160
2191
@end
2161
2192
2162
2193
@implementation MTRBaseDevice (Deprecated)
0 commit comments