Skip to content

Commit bf3cd7f

Browse files
committed
Added option to log the content apps
1 parent 999d9fe commit bf3cd7f

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

examples/tv-app/android/java/AppImpl.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,16 @@ EndpointId ContentAppFactoryImpl::RemoveContentApp(EndpointId epId)
416416
return kInvalidEndpointId;
417417
}
418418

419+
void ContentAppFactoryImpl::LogInstalledApps()
420+
{
421+
for (auto & contentApp : mContentApps)
422+
{
423+
ChipLogProgress(DeviceLayer, "Content app vid=%d pid=%d is on ep=%d",
424+
contentApp->GetApplicationBasicDelegate()->HandleGetVendorId(),
425+
contentApp->GetApplicationBasicDelegate()->HandleGetProductId(), contentApp->GetEndpointId());
426+
}
427+
}
428+
419429
void ContentAppFactoryImpl::AddAdminVendorId(uint16_t vendorId)
420430
{
421431
mAdminVendorIds.push_back(vendorId);

examples/tv-app/android/java/AppImpl.h

+2
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ class DLL_EXPORT ContentAppFactoryImpl : public ContentAppFactory
198198

199199
void setContentAppCommandDelegate(ContentAppCommandDelegate * commandDelegate);
200200

201+
void LogInstalledApps();
202+
201203
protected:
202204
// TODO: Update to use unique_ptr instead of raw pointers
203205
std::vector<ContentAppImpl *> mContentApps;

examples/tv-app/android/java/AppPlatformShellCommands-JNI.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,17 @@ char * AppPlatformHandler(int argc, char ** argv)
269269
}
270270
return response;
271271
}
272+
else if (strcmp(argv[0], "print-apps") == 0)
273+
{
274+
ContentAppFactoryImpl * factory = GetContentAppFactoryImpl();
275+
factory->LogInstalledApps();
276+
277+
ChipLogProgress(DeviceLayer, "logged installed apps");
278+
279+
strcpy(response, "logged installed apps");
280+
281+
return response;
282+
}
272283
else if (strcmp(argv[0], "remove-app-access") == 0)
273284
{
274285
Access::GetAccessControl().DeleteAllEntriesForFabric(GetDeviceCommissioner()->GetFabricIndex());

0 commit comments

Comments
 (0)