Skip to content

Commit 9d78909

Browse files
Log the outgoing write values and command payloads in MTRBaseDevice.
Note that this is the code MTRDevice_Concrete ends up calling into, so this logs the MTRDevice_Concrete behavior as well.
1 parent 7b8467b commit 9d78909

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/darwin/Framework/CHIP/MTRBaseDevice.mm

+10
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,8 @@ - (void)writeAttributeWithEndpointID:(NSNumber *)endpointID
11581158
queue:(dispatch_queue_t)queue
11591159
completion:(MTRDeviceResponseHandler)completion
11601160
{
1161+
MTR_LOG("%@ write %@ 0x%llx 0x%llx: %@", self, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue, value);
1162+
11611163
auto * bridge = new MTRDataValueDictionaryCallbackBridge(queue, completion,
11621164
^(ExchangeManager & exchangeManager, const SessionHandle & session, MTRDataValueDictionaryCallback successCb,
11631165
MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) {
@@ -1367,6 +1369,8 @@ - (void)_invokeCommandWithEndpointID:(NSNumber *)endpointID
13671369
timeoutMs = MTRClampedNumber(timeoutMs, @(1), @(UINT16_MAX));
13681370
}
13691371

1372+
MTR_LOG("%@ invoke %@ 0x%llx 0x%llx: %@", self, endpointID, clusterID.unsignedLongLongValue, commandID.unsignedLongLongValue, commandFields);
1373+
13701374
auto * bridge = new MTRDataValueDictionaryCallbackBridge(queue, completion,
13711375
^(ExchangeManager & exchangeManager, const SessionHandle & session, MTRDataValueDictionaryCallback successCb,
13721376
MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) {
@@ -2148,6 +2152,12 @@ - (void)downloadLogOfType:(MTRDiagnosticLogType)type
21482152
completion:completion];
21492153
}
21502154

2155+
- (NSString *)description
2156+
{
2157+
return [NSString
2158+
stringWithFormat:@"<%@: %p, node: %016llX-%016llX (%llu)>", NSStringFromClass(self.class), self, _deviceController.compressedFabricID.unsignedLongLongValue, _nodeID, _nodeID];
2159+
}
2160+
21512161
@end
21522162

21532163
@implementation MTRBaseDevice (Deprecated)

0 commit comments

Comments
 (0)