Skip to content

Commit ebcb5c0

Browse files
Addressed comments by sharadb-amazon
1 parent 30dcbd4 commit ebcb5c0

File tree

5 files changed

+28
-24
lines changed

5 files changed

+28
-24
lines changed

examples/tv-casting-app/linux/simple-app-helper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ CHIP_ERROR CommandHandler(int argc, char ** argv)
451451
targetCastingPlayer->VerifyOrEstablishConnection(connectionCallbacks, matter::casting::core::kCommissioningWindowTimeoutSec,
452452
idOptions);
453453
ChipLogProgress(AppServer, "CommandHandler() request, VerifyOrEstablishConnection() called, calling StopDiscovery()");
454-
// Stop discovery since we have found are connecting to the desired CastingPlayer.
454+
// Stop discovery since we have discovered, and are now connecting to the desired CastingPlayer.
455455
matter::casting::core::CastingPlayerDiscovery::GetInstance()->StopDiscovery();
456456
return CHIP_NO_ERROR;
457457
}

examples/tv-casting-app/tv-casting-common/core/Endpoint.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ class Endpoint : public std::enable_shared_from_this<Endpoint>
105105
*/
106106
std::vector<chip::ClusterId> GetServerList()
107107
{
108-
ChipLogProgress(AppServer, "Endpoint::GetServerList() mClusters.size(): %d", static_cast<int>(mClusters.size()));
109108
std::vector<chip::ClusterId> serverList;
110109
for (auto const & cluster : mClusters)
111110
{
@@ -151,8 +150,8 @@ class Endpoint : public std::enable_shared_from_this<Endpoint>
151150

152151
void LogDetail() const
153152
{
154-
ChipLogProgress(AppServer, "Endpoint::LogDetail() Endpoint ID: %d, Vendor ID: %d, Product ID: %d", mAttributes.mId,
155-
mAttributes.mVendorId, mAttributes.mProductId);
153+
ChipLogProgress(AppServer, "Endpoint::LogDetail() Endpoint ID: %d, Vendor ID: %d, Product ID: %d, Clusters: %d",
154+
mAttributes.mId, mAttributes.mVendorId, mAttributes.mProductId, static_cast<int>(mClusters.size()));
156155
}
157156
};
158157

examples/tv-casting-app/tv-casting-common/support/CastingStore.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ std::vector<core::CastingPlayer> CastingStore::ReadAll()
7878
size_t castingStoreDataSize = 0;
7979
err = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgr().Get(kCastingStoreDataKey, castingStoreData,
8080
kCastingStoreDataMaxBytes, &castingStoreDataSize);
81-
VerifyOrReturnValue(err == CHIP_NO_ERROR, std::vector<core::CastingPlayer>(),
82-
ChipLogError(AppServer, "KeyValueStoreMgr.Get failed %" CHIP_ERROR_FORMAT, err.Format()));
81+
VerifyOrReturnValue(
82+
err == CHIP_NO_ERROR, std::vector<core::CastingPlayer>(),
83+
ChipLogError(AppServer, "CastingStore::ReadAll() KeyValueStoreMgr.Get failed %" CHIP_ERROR_FORMAT, err.Format()));
8384
ChipLogProgress(AppServer, "CastingStore::ReadAll() Read TLV(CastingStoreData) from KVS store with size: %lu bytes",
8485
static_cast<unsigned long>(castingStoreDataSize));
8586

@@ -478,7 +479,7 @@ CHIP_ERROR CastingStore::WriteAll(std::vector<core::CastingPlayer> castingPlayer
478479

479480
for (auto & castingPlayer : castingPlayers)
480481
{
481-
ChipLogProgress(AppServer, "CastingStore::WriteAll() writing castingPlayer:");
482+
ChipLogProgress(AppServer, "CastingStore::WriteAll() writing CastingPlayer:");
482483
chip::TLV::TLVType castingPlayerContainerType;
483484
// CastingPlayer container starts
484485
ReturnErrorOnFailure(
@@ -550,7 +551,8 @@ CHIP_ERROR CastingStore::WriteAll(std::vector<core::CastingPlayer> castingPlayer
550551
ReturnErrorOnFailure(tlvWriter.StartContainer(chip::TLV::ContextTag(kCastingPlayerEndpointServerListContainerTag),
551552
chip::TLV::kTLVType_Structure, serverListContainerType));
552553
std::vector<chip::ClusterId> serverList = endpoint->GetServerList();
553-
ChipLogProgress(AppServer, "CastingStore::WriteAll() writing CastingPlayer Endpoint ServerList:");
554+
ChipLogProgress(AppServer, "CastingStore::WriteAll() writing CastingPlayer Endpoint ID: %d ServerList.size(): %d",
555+
endpoint->GetId(), static_cast<int>(serverList.size()));
554556
for (chip::ClusterId clusterId : serverList)
555557
{
556558
ChipLogProgress(AppServer, "CastingStore::WriteAll() clusterId: %d", clusterId);

examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp

+11-9
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ void ChipDeviceEventHandler::Handle(const chip::DeviceLayer::ChipDeviceEvent * e
6262
CastingPlayer::GetTargetCastingPlayer()->SetNodeId(targetNodeId);
6363
CastingPlayer::GetTargetCastingPlayer()->SetFabricIndex(targetFabricIndex);
6464

65+
ChipLogProgress(AppServer, "ChipDeviceEventHandler::Handle() calling FindOrEstablishSession()");
6566
CastingPlayer::GetTargetCastingPlayer()->FindOrEstablishSession(
6667
nullptr,
6768
[](void * context, chip::Messaging::ExchangeManager & exchangeMgr, const chip::SessionHandle & sessionHandle) {
@@ -144,12 +145,12 @@ void ChipDeviceEventHandler::HandleBindingsChangedViaCluster(const chip::DeviceL
144145
bool & runPostCommissioning, chip::NodeId & targetNodeId,
145146
chip::FabricIndex & targetFabricIndex)
146147
{
147-
ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleBindingsChangedViaCluster called");
148+
ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleBindingsChangedViaCluster() called");
148149

149150
if (CastingPlayer::GetTargetCastingPlayer()->IsConnected())
150151
{
151152
// re-use existing nodeId and fabricIndex
152-
ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleBindingsChangedViaCluster already connected to video player");
153+
ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleBindingsChangedViaCluster() already connected to video player");
153154
runPostCommissioning = true;
154155
targetNodeId = CastingPlayer::GetTargetCastingPlayer()->GetNodeId();
155156
targetFabricIndex = CastingPlayer::GetTargetCastingPlayer()->GetFabricIndex();
@@ -159,7 +160,7 @@ void ChipDeviceEventHandler::HandleBindingsChangedViaCluster(const chip::DeviceL
159160
else if (sUdcInProgress)
160161
{
161162
ChipLogProgress(AppServer,
162-
"ChipDeviceEventHandler::HandleBindingsChangedViaCluster UDC is in progress while handling "
163+
"ChipDeviceEventHandler::HandleBindingsChangedViaCluster() UDC is in progress while handling "
163164
"kBindingsChangedViaCluster with "
164165
"fabricIndex: %d",
165166
event->BindingsChanged.fabricIndex);
@@ -170,15 +171,15 @@ void ChipDeviceEventHandler::HandleBindingsChangedViaCluster(const chip::DeviceL
170171
for (const auto & binding : chip::BindingTable::GetInstance())
171172
{
172173
ChipLogProgress(AppServer,
173-
"ChipDeviceEventHandler::HandleBindingsChangedViaCluster Read cached binding type=%d fabrixIndex=%d "
174+
"ChipDeviceEventHandler::HandleBindingsChangedViaCluster() Read cached binding type=%d fabrixIndex=%d "
174175
"nodeId=0x" ChipLogFormatX64
175176
" groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI,
176177
binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local,
177178
binding.remote, ChipLogValueMEI(binding.clusterId.value_or(0)));
178179
if (binding.type == MATTER_UNICAST_BINDING && event->BindingsChanged.fabricIndex == binding.fabricIndex)
179180
{
180181
ChipLogProgress(AppServer,
181-
"ChipDeviceEventHandler::HandleBindingsChangedViaCluster Matched accessingFabricIndex with "
182+
"ChipDeviceEventHandler::HandleBindingsChangedViaCluster() Matched accessingFabricIndex with "
182183
"nodeId=0x" ChipLogFormatX64,
183184
ChipLogValueX64(binding.nodeId));
184185
targetNodeId = binding.nodeId;
@@ -190,9 +191,10 @@ void ChipDeviceEventHandler::HandleBindingsChangedViaCluster(const chip::DeviceL
190191

191192
if (targetNodeId == 0 && runPostCommissioning == false)
192193
{
193-
ChipLogError(AppServer,
194-
"ChipDeviceEventHandler::HandleBindingsChangedViaCluster accessingFabricIndex: %d did not match bindings",
195-
event->BindingsChanged.fabricIndex);
194+
ChipLogError(
195+
AppServer,
196+
"ChipDeviceEventHandler::HandleBindingsChangedViaCluster() accessingFabricIndex: %d did not match bindings",
197+
event->BindingsChanged.fabricIndex);
196198
CastingPlayer::GetTargetCastingPlayer()->mOnCompleted(CHIP_ERROR_INCORRECT_STATE,
197199
CastingPlayer::GetTargetCastingPlayer());
198200
return;
@@ -204,7 +206,7 @@ void ChipDeviceEventHandler::HandleCommissioningComplete(const chip::DeviceLayer
204206
bool & runPostCommissioning, chip::NodeId & targetNodeId,
205207
chip::FabricIndex & targetFabricIndex)
206208
{
207-
ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleCommissioningComplete called");
209+
ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleCommissioningComplete() called");
208210
sUdcInProgress = false;
209211
targetNodeId = event->CommissioningComplete.nodeId;
210212
targetFabricIndex = event->CommissioningComplete.fabricIndex;

examples/tv-casting-app/tv-casting-common/support/EndpointListLoader.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ void EndpointListLoader::Initialize(chip::Messaging::ExchangeManager * exchangeM
5353

5454
chip::NodeId targetCastingPlayerNodeId = CastingPlayer::GetTargetCastingPlayer()->GetNodeId();
5555
chip::FabricIndex targetCastingPlayerFabricIndex = CastingPlayer::GetTargetCastingPlayer()->GetFabricIndex();
56-
ChipLogProgress(AppServer, "EndpointListLoader::Initialize() targetCastingPlayerNodeId: 0x" ChipLogFormatX64,
57-
ChipLogValueX64(targetCastingPlayerNodeId));
58-
ChipLogProgress(AppServer, "EndpointListLoader::Initialize() targetCastingPlayerFabricIndex: %d",
59-
targetCastingPlayerFabricIndex);
56+
ChipLogProgress(AppServer,
57+
"EndpointListLoader::Initialize() targetCastingPlayerNodeId: 0x" ChipLogFormatX64
58+
", targetCastingPlayerFabricIndex: %d",
59+
ChipLogValueX64(targetCastingPlayerNodeId), targetCastingPlayerFabricIndex);
6060

6161
for (const auto & binding : chip::BindingTable::GetInstance())
6262
{
@@ -90,9 +90,10 @@ CHIP_ERROR EndpointListLoader::Load()
9090

9191
chip::NodeId targetCastingPlayerNodeId = CastingPlayer::GetTargetCastingPlayer()->GetNodeId();
9292
chip::FabricIndex targetCastingPlayerFabricIndex = CastingPlayer::GetTargetCastingPlayer()->GetFabricIndex();
93-
ChipLogProgress(AppServer, "EndpointListLoader::Load() targetCastingPlayerNodeId: 0x" ChipLogFormatX64,
94-
ChipLogValueX64(targetCastingPlayerNodeId));
95-
ChipLogProgress(AppServer, "EndpointListLoader::Load() targetCastingPlayerFabricIndex: %d", targetCastingPlayerFabricIndex);
93+
ChipLogProgress(AppServer,
94+
"EndpointListLoader::Load() targetCastingPlayerNodeId: 0x" ChipLogFormatX64
95+
", targetCastingPlayerFabricIndex: %d",
96+
ChipLogValueX64(targetCastingPlayerNodeId), targetCastingPlayerFabricIndex);
9697

9798
int endpointIndex = -1;
9899
bool isLoadingRequired = false;

0 commit comments

Comments
 (0)