Skip to content

Commit eb86614

Browse files
Add client type to debug print out
1 parent c5023fa commit eb86614

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

examples/chip-tool/commands/icd/ICDCommand.cpp

+13-11
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <app/icd/client/DefaultICDClientStorage.h>
2222
#include <crypto/DefaultSessionKeystore.h>
2323
#include <crypto/RawKeySessionKeystore.h>
24+
#include <string>
2425

2526
using namespace ::chip;
2627
using namespace ::chip::app;
@@ -36,31 +37,32 @@ CHIP_ERROR ICDListCommand::RunCommand()
3637
return CHIP_ERROR_NO_MEMORY;
3738
}
3839
app::DefaultICDClientStorage::ICDClientInfoIteratorWrapper clientInfoIteratorWrapper(iter);
39-
fprintf(stderr, " +-----------------------------------------------------------------------------+\n");
40-
fprintf(stderr, " | %-75s |\n", "Known ICDs:");
41-
fprintf(stderr, " +-----------------------------------------------------------------------------+\n");
42-
fprintf(stderr, " | %20s | %15s | %15s | %16s |\n", "Fabric Index:Node ID", "Start Counter", "Counter Offset",
43-
"MonitoredSubject");
40+
fprintf(stderr, " +------------------------------------------------------------------------------------------+\n");
41+
fprintf(stderr, " | %-88s |\n", "Known ICDs:");
42+
fprintf(stderr, " +------------------------------------------------------------------------------------------+\n");
43+
fprintf(stderr, " | %20s | %15s | %15s | %16s | %10s |\n", "Fabric Index:Node ID", "Start Counter", "Counter Offset",
44+
"MonitoredSubject", "ClientType");
4445

4546
while (iter->Next(info))
4647
{
47-
fprintf(stderr, " +-----------------------------------------------------------------------------+\n");
48-
fprintf(stderr, " | %3" PRIu32 ":" ChipLogFormatX64 " | %15" PRIu32 " | %15" PRIu32 " | " ChipLogFormatX64 " |\n",
48+
fprintf(stderr, " +------------------------------------------------------------------------------------------+\n");
49+
fprintf(stderr, " | %3" PRIu32 ":" ChipLogFormatX64 " | %15" PRIu32 " | %15" PRIu32 " | " ChipLogFormatX64 " | %10u |\n",
4950
static_cast<uint32_t>(info.peer_node.GetFabricIndex()), ChipLogValueX64(info.peer_node.GetNodeId()),
50-
info.start_icd_counter, info.offset, ChipLogValueX64(info.monitored_subject));
51+
info.start_icd_counter, info.offset, ChipLogValueX64(info.monitored_subject),
52+
static_cast<uint8_t>(info.client_type));
5153

5254
static_assert(std::is_same<decltype(CHIPCommand::sSessionKeystore), Crypto::RawKeySessionKeystore>::value,
5355
"The following BytesToHex can copy/encode the key bytes from sharedKey to hexadecimal format, which only "
5456
"works for RawKeySessionKeystore");
5557
Encoding::BytesToHex(info.aes_key_handle.As<Crypto::Symmetric128BitsKeyByteArray>(), Crypto::kAES_CCM128_Key_Length,
5658
icdAesKeyHex, sizeof(icdAesKeyHex), chip::Encoding::HexFlags::kNullTerminate);
57-
fprintf(stderr, " | aes key: %60s |\n", icdAesKeyHex);
59+
fprintf(stderr, " | aes key: %60s |\n", icdAesKeyHex);
5860
Encoding::BytesToHex(info.hmac_key_handle.As<Crypto::Symmetric128BitsKeyByteArray>(), Crypto::kHMAC_CCM128_Key_Length,
5961
icdHmacKeyHex, sizeof(icdHmacKeyHex), chip::Encoding::HexFlags::kNullTerminate);
60-
fprintf(stderr, " | hmac key: %60s |\n", icdHmacKeyHex);
62+
fprintf(stderr, " | hmac key: %60s |\n", icdHmacKeyHex);
6163
}
6264

63-
fprintf(stderr, " +-----------------------------------------------------------------------------+\n");
65+
fprintf(stderr, " +------------------------------------------------------------------------------------------+\n");
6466
SetCommandExitStatus(CHIP_NO_ERROR);
6567
return CHIP_NO_ERROR;
6668
}

0 commit comments

Comments
 (0)