From 2ddf56315a769557ed57ec98905a99381c73ebe7 Mon Sep 17 00:00:00 2001 From: Lazar Kovacic Date: Mon, 27 May 2024 14:09:22 +0200 Subject: [PATCH 01/16] Add basic logic for reporting application installation status --- examples/tv-app/tv-common/include/AppTv.h | 6 ++++ .../tv-common/shell/AppTvShellCommands.cpp | 19 +++++++++++ examples/tv-app/tv-common/src/AppTv.cpp | 33 +++++++++++++++++++ .../CommissionerDiscoveryController.cpp | 14 +++++--- .../CommissionerDiscoveryController.h | 12 +++++++ 5 files changed, 79 insertions(+), 5 deletions(-) diff --git a/examples/tv-app/tv-common/include/AppTv.h b/examples/tv-app/tv-common/include/AppTv.h index 34f5bd8dc4c958..179e780de0b041 100644 --- a/examples/tv-app/tv-common/include/AppTv.h +++ b/examples/tv-app/tv-common/include/AppTv.h @@ -147,10 +147,16 @@ class DLL_EXPORT ContentAppFactoryImpl : public ContentAppFactory void InstallContentApp(uint16_t vendorId, uint16_t productId); // Remove the app from the list of mContentApps bool UninstallContentApp(uint16_t vendorId, uint16_t productId); + // Set App's Installation Status + void SetAppInstallationStatus(uint16_t vendorId, uint16_t productId, + Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError status); + // Get App's Installation Status + Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError GetAppInstallationStatus(uint16_t vendorId, uint16_t productId); protected: std::vector> mContentApps; std::vector mAdminVendorIds{}; + std::map mAppInstallationStatus{}; }; } // namespace AppPlatform diff --git a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp index b39e84ad40f89a..8ed160232ef31e 100644 --- a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp +++ b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp @@ -292,6 +292,25 @@ static CHIP_ERROR AppPlatformHandler(int argc, char ** argv) return CHIP_NO_ERROR; } + else if (strcmp(argv[0], "setinstallstatus") == 0) + { + if (argc < 3) + { + return PrintAllCommands(); + } + char * eptr; + + uint16_t vid = (uint16_t) strtol(argv[1], &eptr, 10); + uint16_t pid = (uint16_t) strtol(argv[2], &eptr, 10); + uint16_t appInstallationStatus = (uint16_t) strtol(argv[3], &eptr, 10); + + ContentAppFactoryImpl * factory = GetContentAppFactoryImpl(); + factory->SetAppInstallationStatus(vid, pid, static_cast(appInstallationStatus)); + + ChipLogProgress(DeviceLayer, "set app installation status"); + + return CHIP_NO_ERROR; + } else if (strcmp(argv[0], "add") == 0) { if (argc < 2) diff --git a/examples/tv-app/tv-common/src/AppTv.cpp b/examples/tv-app/tv-common/src/AppTv.cpp index 9987b4cdd67d6e..95ceee02969446 100644 --- a/examples/tv-app/tv-common/src/AppTv.cpp +++ b/examples/tv-app/tv-common/src/AppTv.cpp @@ -158,6 +158,16 @@ class MyAppInstallationService : public AppInstallationService { return ContentAppPlatform::GetInstance().LoadContentAppByClient(vendorId, productId) != nullptr; } + + CommissionerDeclaration::CdError GetInstallationStatusOfApp(uint16_t vendorId, uint16_t productId) override + { + ContentAppFactoryImpl * factory = GetContentAppFactoryImpl(); + return factory->GetAppInstallationStatus(vendorId, productId); + + // ContentAppFactoryImpl * factory = GetContentAppFactoryImpl(); + // factory->InstallContentApp(vendorId, productId); + // return CommissionerDeclaration::CdError::kAppInstallConsentPending; + } }; MyAppInstallationService gMyAppInstallationService; @@ -627,6 +637,29 @@ bool ContentAppFactoryImpl::UninstallContentApp(uint16_t vendorId, uint16_t prod return false; } +void ContentAppFactoryImpl::SetAppInstallationStatus(uint16_t vendorId, uint16_t productId, CommissionerDeclaration::CdError status) +{ + std::map::iterator it; + it = mAppInstallationStatus.find(vendorId); + if (it != mAppInstallationStatus.end()) { + mAppInstallationStatus[vendorId] = status; + return; + } + + mAppInstallationStatus.insert({vendorId, status}); +} + +CommissionerDeclaration::CdError ContentAppFactoryImpl::GetAppInstallationStatus(uint16_t vendorId, uint16_t productId) +{ + std::map::iterator it; + it = mAppInstallationStatus.find(vendorId); + if (it != mAppInstallationStatus.end()) { + return mAppInstallationStatus[vendorId]; + } + + return CommissionerDeclaration::CdError::kAppInstallConsentPending; +} + Access::Privilege ContentAppFactoryImpl::GetVendorPrivilege(uint16_t vendorId) { for (size_t i = 0; i < mAdminVendorIds.size(); ++i) diff --git a/src/controller/CommissionerDiscoveryController.cpp b/src/controller/CommissionerDiscoveryController.cpp index d1a5747491ad50..86499fde0c4d7f 100644 --- a/src/controller/CommissionerDiscoveryController.cpp +++ b/src/controller/CommissionerDiscoveryController.cpp @@ -230,11 +230,6 @@ void CommissionerDiscoveryController::InternalOk() { ChipLogDetail(AppServer, "UX InternalOk: app not installed."); - // notify client that app will be installed - CommissionerDeclaration cd; - cd.SetErrorCode(CommissionerDeclaration::CdError::kAppInstallConsentPending); - mUdcServer->SendCDCMessage(cd, Transport::PeerAddress::UDP(client->GetPeerAddress().GetIPAddress(), client->GetCdPort())); - // dialog ChipLogDetail(Controller, "------PROMPT USER: %s is requesting to install app on this TV. vendorId=%d, productId=%d", client->GetDeviceName(), client->GetVendorId(), client->GetProductId()); @@ -244,6 +239,15 @@ void CommissionerDiscoveryController::InternalOk() mUserPrompter->PromptForAppInstallOKPermission(client->GetVendorId(), client->GetProductId(), client->GetDeviceName()); } ChipLogDetail(Controller, "------Via Shell Enter: app install "); + + CommissionerDeclaration::CdError appInstallStatus = mAppInstallationService->GetInstallationStatusOfApp(client->GetVendorId(), client->GetProductId()); + + if (appInstallStatus != CommissionerDeclaration::CdError::kNoError) { + // notify client the current app's installation status + CommissionerDeclaration cd; + cd.SetErrorCode(appInstallStatus); + mUdcServer->SendCDCMessage(cd, Transport::PeerAddress::UDP(client->GetPeerAddress().GetIPAddress(), client->GetCdPort())); + } return; } diff --git a/src/controller/CommissionerDiscoveryController.h b/src/controller/CommissionerDiscoveryController.h index b2211641fd0ede..07f59304e075a1 100644 --- a/src/controller/CommissionerDiscoveryController.h +++ b/src/controller/CommissionerDiscoveryController.h @@ -235,6 +235,18 @@ class DLL_EXPORT AppInstallationService */ virtual bool LookupTargetContentApp(uint16_t vendorId, uint16_t productId) = 0; + /** + * @brief + * Called to check app's installation status. + * + * This will be called by the main chip thread so any blocking work should be moved to a separate thread. + * + * @param[in] vendorId The vendorId in the DNS-SD advertisement of the requesting commissionee. + * @param[in] productId The productId in the DNS-SD advertisement of the requesting commissionee. + * + */ + virtual chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError GetInstallationStatusOfApp(uint16_t vendorId, uint16_t productId) = 0; + virtual ~AppInstallationService() = default; }; From 970a793f9d12abceddae3a36c47dcad2f77ed84b Mon Sep 17 00:00:00 2001 From: Lazar Kovacic Date: Mon, 27 May 2024 14:20:58 +0200 Subject: [PATCH 02/16] Update documentation and clean up the code --- examples/tv-app/tv-common/shell/AppTvShellCommands.cpp | 3 +++ examples/tv-app/tv-common/src/AppTv.cpp | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp index 8ed160232ef31e..7b32b1bb605f2b 100644 --- a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp +++ b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp @@ -205,6 +205,9 @@ static CHIP_ERROR PrintAllCommands() streamer_printf(sout, " add-admin-vendor Add vendor ID to list which will receive admin privileges. Usage: app " "add-admin-vendor 65521\r\n"); + streamer_printf(sout, " app install Install app with given vendor ID and product ID. Usage: app install 65521 32768\r\n"); + streamer_printf(sout, " app uinstall Uinstall app at given vendor ID and product ID. Usage: app uninstall 65521 32768\r\n"); + streamer_printf(sout, " app setinstallstatus Set app's installation status for a given vendor ID and product ID. Usage: app setinstallstatus 65521 32768 13. Installation status can be found at: UserDirectedCommissioning.h\r\n"); #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED #if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE streamer_printf(sout, " print-app-access Print all ACLs for app platform fabric. Usage: app print-app-access\r\n"); diff --git a/examples/tv-app/tv-common/src/AppTv.cpp b/examples/tv-app/tv-common/src/AppTv.cpp index 95ceee02969446..603ec1bade2947 100644 --- a/examples/tv-app/tv-common/src/AppTv.cpp +++ b/examples/tv-app/tv-common/src/AppTv.cpp @@ -163,10 +163,6 @@ class MyAppInstallationService : public AppInstallationService { ContentAppFactoryImpl * factory = GetContentAppFactoryImpl(); return factory->GetAppInstallationStatus(vendorId, productId); - - // ContentAppFactoryImpl * factory = GetContentAppFactoryImpl(); - // factory->InstallContentApp(vendorId, productId); - // return CommissionerDeclaration::CdError::kAppInstallConsentPending; } }; From a42b4a0dde8e8916d32ecb16ebdf2eae604e426d Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Mon, 27 May 2024 12:21:38 +0000 Subject: [PATCH 03/16] Restyled by whitespace --- examples/tv-app/tv-common/include/AppTv.h | 2 +- examples/tv-app/tv-common/src/AppTv.cpp | 2 +- src/controller/CommissionerDiscoveryController.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/tv-app/tv-common/include/AppTv.h b/examples/tv-app/tv-common/include/AppTv.h index 179e780de0b041..1e724d6289efdb 100644 --- a/examples/tv-app/tv-common/include/AppTv.h +++ b/examples/tv-app/tv-common/include/AppTv.h @@ -148,7 +148,7 @@ class DLL_EXPORT ContentAppFactoryImpl : public ContentAppFactory // Remove the app from the list of mContentApps bool UninstallContentApp(uint16_t vendorId, uint16_t productId); // Set App's Installation Status - void SetAppInstallationStatus(uint16_t vendorId, uint16_t productId, + void SetAppInstallationStatus(uint16_t vendorId, uint16_t productId, Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError status); // Get App's Installation Status Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError GetAppInstallationStatus(uint16_t vendorId, uint16_t productId); diff --git a/examples/tv-app/tv-common/src/AppTv.cpp b/examples/tv-app/tv-common/src/AppTv.cpp index 603ec1bade2947..5195122de66bc9 100644 --- a/examples/tv-app/tv-common/src/AppTv.cpp +++ b/examples/tv-app/tv-common/src/AppTv.cpp @@ -159,7 +159,7 @@ class MyAppInstallationService : public AppInstallationService return ContentAppPlatform::GetInstance().LoadContentAppByClient(vendorId, productId) != nullptr; } - CommissionerDeclaration::CdError GetInstallationStatusOfApp(uint16_t vendorId, uint16_t productId) override + CommissionerDeclaration::CdError GetInstallationStatusOfApp(uint16_t vendorId, uint16_t productId) override { ContentAppFactoryImpl * factory = GetContentAppFactoryImpl(); return factory->GetAppInstallationStatus(vendorId, productId); diff --git a/src/controller/CommissionerDiscoveryController.h b/src/controller/CommissionerDiscoveryController.h index 07f59304e075a1..a0a4028bf3a207 100644 --- a/src/controller/CommissionerDiscoveryController.h +++ b/src/controller/CommissionerDiscoveryController.h @@ -237,7 +237,7 @@ class DLL_EXPORT AppInstallationService /** * @brief - * Called to check app's installation status. + * Called to check app's installation status. * * This will be called by the main chip thread so any blocking work should be moved to a separate thread. * From 4af41f7264564b68ba05bf3b405ec2a75a8894f6 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Mon, 27 May 2024 12:21:39 +0000 Subject: [PATCH 04/16] Restyled by clang-format --- examples/tv-app/tv-common/include/AppTv.h | 3 ++- .../tv-common/shell/AppTvShellCommands.cpp | 20 +++++++++++++------ examples/tv-app/tv-common/src/AppTv.cpp | 8 +++++--- .../CommissionerDiscoveryController.cpp | 9 ++++++--- .../CommissionerDiscoveryController.h | 3 ++- 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/examples/tv-app/tv-common/include/AppTv.h b/examples/tv-app/tv-common/include/AppTv.h index 1e724d6289efdb..5616c7a5dbfc2e 100644 --- a/examples/tv-app/tv-common/include/AppTv.h +++ b/examples/tv-app/tv-common/include/AppTv.h @@ -151,7 +151,8 @@ class DLL_EXPORT ContentAppFactoryImpl : public ContentAppFactory void SetAppInstallationStatus(uint16_t vendorId, uint16_t productId, Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError status); // Get App's Installation Status - Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError GetAppInstallationStatus(uint16_t vendorId, uint16_t productId); + Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError GetAppInstallationStatus(uint16_t vendorId, + uint16_t productId); protected: std::vector> mContentApps; diff --git a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp index 7b32b1bb605f2b..796dcd9437d2d5 100644 --- a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp +++ b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp @@ -205,9 +205,16 @@ static CHIP_ERROR PrintAllCommands() streamer_printf(sout, " add-admin-vendor Add vendor ID to list which will receive admin privileges. Usage: app " "add-admin-vendor 65521\r\n"); - streamer_printf(sout, " app install Install app with given vendor ID and product ID. Usage: app install 65521 32768\r\n"); - streamer_printf(sout, " app uinstall Uinstall app at given vendor ID and product ID. Usage: app uninstall 65521 32768\r\n"); - streamer_printf(sout, " app setinstallstatus Set app's installation status for a given vendor ID and product ID. Usage: app setinstallstatus 65521 32768 13. Installation status can be found at: UserDirectedCommissioning.h\r\n"); + streamer_printf(sout, + " app install Install app with given vendor ID and product ID. Usage: app install " + "65521 32768\r\n"); + streamer_printf(sout, + " app uinstall Uinstall app at given vendor ID and product ID. Usage: app uninstall " + "65521 32768\r\n"); + streamer_printf( + sout, + " app setinstallstatus Set app's installation status for a given vendor ID and product ID. " + "Usage: app setinstallstatus 65521 32768 13. Installation status can be found at: UserDirectedCommissioning.h\r\n"); #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED #if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE streamer_printf(sout, " print-app-access Print all ACLs for app platform fabric. Usage: app print-app-access\r\n"); @@ -303,12 +310,13 @@ static CHIP_ERROR AppPlatformHandler(int argc, char ** argv) } char * eptr; - uint16_t vid = (uint16_t) strtol(argv[1], &eptr, 10); - uint16_t pid = (uint16_t) strtol(argv[2], &eptr, 10); + uint16_t vid = (uint16_t) strtol(argv[1], &eptr, 10); + uint16_t pid = (uint16_t) strtol(argv[2], &eptr, 10); uint16_t appInstallationStatus = (uint16_t) strtol(argv[3], &eptr, 10); ContentAppFactoryImpl * factory = GetContentAppFactoryImpl(); - factory->SetAppInstallationStatus(vid, pid, static_cast(appInstallationStatus)); + factory->SetAppInstallationStatus( + vid, pid, static_cast(appInstallationStatus)); ChipLogProgress(DeviceLayer, "set app installation status"); diff --git a/examples/tv-app/tv-common/src/AppTv.cpp b/examples/tv-app/tv-common/src/AppTv.cpp index 5195122de66bc9..55040ae295f816 100644 --- a/examples/tv-app/tv-common/src/AppTv.cpp +++ b/examples/tv-app/tv-common/src/AppTv.cpp @@ -637,19 +637,21 @@ void ContentAppFactoryImpl::SetAppInstallationStatus(uint16_t vendorId, uint16_t { std::map::iterator it; it = mAppInstallationStatus.find(vendorId); - if (it != mAppInstallationStatus.end()) { + if (it != mAppInstallationStatus.end()) + { mAppInstallationStatus[vendorId] = status; return; } - mAppInstallationStatus.insert({vendorId, status}); + mAppInstallationStatus.insert({ vendorId, status }); } CommissionerDeclaration::CdError ContentAppFactoryImpl::GetAppInstallationStatus(uint16_t vendorId, uint16_t productId) { std::map::iterator it; it = mAppInstallationStatus.find(vendorId); - if (it != mAppInstallationStatus.end()) { + if (it != mAppInstallationStatus.end()) + { return mAppInstallationStatus[vendorId]; } diff --git a/src/controller/CommissionerDiscoveryController.cpp b/src/controller/CommissionerDiscoveryController.cpp index 86499fde0c4d7f..b251a52b350ca7 100644 --- a/src/controller/CommissionerDiscoveryController.cpp +++ b/src/controller/CommissionerDiscoveryController.cpp @@ -240,13 +240,16 @@ void CommissionerDiscoveryController::InternalOk() } ChipLogDetail(Controller, "------Via Shell Enter: app install "); - CommissionerDeclaration::CdError appInstallStatus = mAppInstallationService->GetInstallationStatusOfApp(client->GetVendorId(), client->GetProductId()); + CommissionerDeclaration::CdError appInstallStatus = + mAppInstallationService->GetInstallationStatusOfApp(client->GetVendorId(), client->GetProductId()); - if (appInstallStatus != CommissionerDeclaration::CdError::kNoError) { + if (appInstallStatus != CommissionerDeclaration::CdError::kNoError) + { // notify client the current app's installation status CommissionerDeclaration cd; cd.SetErrorCode(appInstallStatus); - mUdcServer->SendCDCMessage(cd, Transport::PeerAddress::UDP(client->GetPeerAddress().GetIPAddress(), client->GetCdPort())); + mUdcServer->SendCDCMessage(cd, + Transport::PeerAddress::UDP(client->GetPeerAddress().GetIPAddress(), client->GetCdPort())); } return; } diff --git a/src/controller/CommissionerDiscoveryController.h b/src/controller/CommissionerDiscoveryController.h index a0a4028bf3a207..afdfb49d599277 100644 --- a/src/controller/CommissionerDiscoveryController.h +++ b/src/controller/CommissionerDiscoveryController.h @@ -245,7 +245,8 @@ class DLL_EXPORT AppInstallationService * @param[in] productId The productId in the DNS-SD advertisement of the requesting commissionee. * */ - virtual chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError GetInstallationStatusOfApp(uint16_t vendorId, uint16_t productId) = 0; + virtual chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError + GetInstallationStatusOfApp(uint16_t vendorId, uint16_t productId) = 0; virtual ~AppInstallationService() = default; }; From 5a47bcc69ab2e0896c4b8e2afb85fc2f2b41e992 Mon Sep 17 00:00:00 2001 From: Lazar Kovacic Date: Tue, 28 May 2024 13:15:11 +0200 Subject: [PATCH 05/16] Update app installation code --- examples/tv-app/android/java/TVApp-JNI.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/examples/tv-app/android/java/TVApp-JNI.cpp b/examples/tv-app/android/java/TVApp-JNI.cpp index f154b0759c2b1a..22f94303e97b96 100644 --- a/examples/tv-app/android/java/TVApp-JNI.cpp +++ b/examples/tv-app/android/java/TVApp-JNI.cpp @@ -240,6 +240,22 @@ class MyPincodeService : public PasscodeService }; MyPincodeService gMyPincodeService; +class MyAppInstallationService : public AppInstallationService +{ + bool LookupTargetContentApp(uint16_t vendorId, uint16_t productId) override + { + return ContentAppPlatform::GetInstance().LoadContentAppByClient(vendorId, productId) != nullptr; + } + + CommissionerDeclaration::CdError GetInstallationStatusOfApp(uint16_t vendorId, uint16_t productId) override + { + return CommissionerDeclaration::CdError::kAppInstallConsentPending; + } +}; + +MyAppInstallationService gMyAppInstallationService; + + class MyPostCommissioningListener : public PostCommissioningListener { void CommissioningCompleted(uint16_t vendorId, uint16_t productId, NodeId nodeId, Messaging::ExchangeManager & exchangeMgr, @@ -373,6 +389,7 @@ void TvAppJNI::InitializeCommissioner(JNIMyUserPrompter * userPrompter) { cdc->SetPasscodeService(&gMyPincodeService); cdc->SetUserPrompter(userPrompter); + cdc->SetAppInstallationService(&gMyAppInstallationService); cdc->SetPostCommissioningListener(&gMyPostCommissioningListener); } From fd4769e1bbac7746f3a432ac69be9070149f8a28 Mon Sep 17 00:00:00 2001 From: Lazar Kovacic Date: Tue, 28 May 2024 13:17:59 +0200 Subject: [PATCH 06/16] Update with comment --- examples/tv-app/android/java/TVApp-JNI.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/tv-app/android/java/TVApp-JNI.cpp b/examples/tv-app/android/java/TVApp-JNI.cpp index 22f94303e97b96..1281c8ea1760cc 100644 --- a/examples/tv-app/android/java/TVApp-JNI.cpp +++ b/examples/tv-app/android/java/TVApp-JNI.cpp @@ -247,6 +247,8 @@ class MyAppInstallationService : public AppInstallationService return ContentAppPlatform::GetInstance().LoadContentAppByClient(vendorId, productId) != nullptr; } + // TODO: Dummy code for Android OS, needs to be updated with package manager + // retrieving correct app's installation status CommissionerDeclaration::CdError GetInstallationStatusOfApp(uint16_t vendorId, uint16_t productId) override { return CommissionerDeclaration::CdError::kAppInstallConsentPending; From 007460ce4aa516da1f0eb11a6c0a34b4c88e0366 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 28 May 2024 11:18:17 +0000 Subject: [PATCH 07/16] Restyled by whitespace --- examples/tv-app/android/java/TVApp-JNI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tv-app/android/java/TVApp-JNI.cpp b/examples/tv-app/android/java/TVApp-JNI.cpp index 1281c8ea1760cc..193503686e2815 100644 --- a/examples/tv-app/android/java/TVApp-JNI.cpp +++ b/examples/tv-app/android/java/TVApp-JNI.cpp @@ -247,7 +247,7 @@ class MyAppInstallationService : public AppInstallationService return ContentAppPlatform::GetInstance().LoadContentAppByClient(vendorId, productId) != nullptr; } - // TODO: Dummy code for Android OS, needs to be updated with package manager + // TODO: Dummy code for Android OS, needs to be updated with package manager // retrieving correct app's installation status CommissionerDeclaration::CdError GetInstallationStatusOfApp(uint16_t vendorId, uint16_t productId) override { From 22d9239e772202b3696f8147ed6e8bc2ccde8f44 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 28 May 2024 11:18:18 +0000 Subject: [PATCH 08/16] Restyled by clang-format --- examples/tv-app/android/java/TVApp-JNI.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/tv-app/android/java/TVApp-JNI.cpp b/examples/tv-app/android/java/TVApp-JNI.cpp index 193503686e2815..9e47662f39fa3f 100644 --- a/examples/tv-app/android/java/TVApp-JNI.cpp +++ b/examples/tv-app/android/java/TVApp-JNI.cpp @@ -257,7 +257,6 @@ class MyAppInstallationService : public AppInstallationService MyAppInstallationService gMyAppInstallationService; - class MyPostCommissioningListener : public PostCommissioningListener { void CommissioningCompleted(uint16_t vendorId, uint16_t productId, NodeId nodeId, Messaging::ExchangeManager & exchangeMgr, From 8e42f422e08ee449392dd2ef19db067b2b7d1cea Mon Sep 17 00:00:00 2001 From: Lazar Kovacic Date: Wed, 29 May 2024 12:07:44 +0200 Subject: [PATCH 09/16] Update code per comments --- examples/tv-app/tv-common/include/AppTv.h | 2 +- examples/tv-app/tv-common/src/AppTv.cpp | 24 ++++++++++++------- .../CommissionerDiscoveryController.cpp | 13 ++++------ .../CommissionerDiscoveryController.h | 6 +++-- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/examples/tv-app/tv-common/include/AppTv.h b/examples/tv-app/tv-common/include/AppTv.h index 5616c7a5dbfc2e..a6ac2bc62f092d 100644 --- a/examples/tv-app/tv-common/include/AppTv.h +++ b/examples/tv-app/tv-common/include/AppTv.h @@ -157,7 +157,7 @@ class DLL_EXPORT ContentAppFactoryImpl : public ContentAppFactory protected: std::vector> mContentApps; std::vector mAdminVendorIds{}; - std::map mAppInstallationStatus{}; + std::map mAppInstallationStatus{}; }; } // namespace AppPlatform diff --git a/examples/tv-app/tv-common/src/AppTv.cpp b/examples/tv-app/tv-common/src/AppTv.cpp index 55040ae295f816..bde0d4be7e3407 100644 --- a/examples/tv-app/tv-common/src/AppTv.cpp +++ b/examples/tv-app/tv-common/src/AppTv.cpp @@ -633,26 +633,34 @@ bool ContentAppFactoryImpl::UninstallContentApp(uint16_t vendorId, uint16_t prod return false; } +std::string createSearchIndex(uint16_t vendorId, uint16_t productId) { + // Format the IDs into a string + std::string formattedString = std::to_string(vendorId) + ":" + std::to_string(productId); + return formattedString; +} + void ContentAppFactoryImpl::SetAppInstallationStatus(uint16_t vendorId, uint16_t productId, CommissionerDeclaration::CdError status) { - std::map::iterator it; - it = mAppInstallationStatus.find(vendorId); + std::string searchIndex = createSearchIndex(vendorId, productId); + std::map::iterator it; + it = mAppInstallationStatus.find(searchIndex); if (it != mAppInstallationStatus.end()) { - mAppInstallationStatus[vendorId] = status; + mAppInstallationStatus[searchIndex] = status; return; } - mAppInstallationStatus.insert({ vendorId, status }); + mAppInstallationStatus.insert({ searchIndex, status }); } CommissionerDeclaration::CdError ContentAppFactoryImpl::GetAppInstallationStatus(uint16_t vendorId, uint16_t productId) { - std::map::iterator it; - it = mAppInstallationStatus.find(vendorId); + std::string searchIndex = createSearchIndex(vendorId, productId); + std::map::iterator it; + it = mAppInstallationStatus.find(searchIndex); if (it != mAppInstallationStatus.end()) { - return mAppInstallationStatus[vendorId]; + return mAppInstallationStatus[searchIndex]; } return CommissionerDeclaration::CdError::kAppInstallConsentPending; @@ -715,7 +723,7 @@ CHIP_ERROR AppTvInit() ContentAppPlatform::GetInstance().SetupAppPlatform(); ContentAppPlatform::GetInstance().SetContentAppFactory(&gFactory); gFactory.InstallContentApp((uint16_t) 1, (uint16_t) 11); - gFactory.InstallContentApp((uint16_t) 65521, (uint16_t) 32768); + gFactory.InstallContentApp((uint16_t) 65521, (uint16_t) 32769); gFactory.InstallContentApp((uint16_t) 9050, (uint16_t) 22); gFactory.InstallContentApp((uint16_t) 1111, (uint16_t) 22); uint16_t value; diff --git a/src/controller/CommissionerDiscoveryController.cpp b/src/controller/CommissionerDiscoveryController.cpp index b251a52b350ca7..f03dae2c603785 100644 --- a/src/controller/CommissionerDiscoveryController.cpp +++ b/src/controller/CommissionerDiscoveryController.cpp @@ -243,14 +243,11 @@ void CommissionerDiscoveryController::InternalOk() CommissionerDeclaration::CdError appInstallStatus = mAppInstallationService->GetInstallationStatusOfApp(client->GetVendorId(), client->GetProductId()); - if (appInstallStatus != CommissionerDeclaration::CdError::kNoError) - { - // notify client the current app's installation status - CommissionerDeclaration cd; - cd.SetErrorCode(appInstallStatus); - mUdcServer->SendCDCMessage(cd, - Transport::PeerAddress::UDP(client->GetPeerAddress().GetIPAddress(), client->GetCdPort())); - } + // notify client the current app's installation status + CommissionerDeclaration cd; + cd.SetErrorCode(appInstallStatus); + mUdcServer->SendCDCMessage(cd, + Transport::PeerAddress::UDP(client->GetPeerAddress().GetIPAddress(), client->GetCdPort())); return; } diff --git a/src/controller/CommissionerDiscoveryController.h b/src/controller/CommissionerDiscoveryController.h index afdfb49d599277..5f3f020f7d33b3 100644 --- a/src/controller/CommissionerDiscoveryController.h +++ b/src/controller/CommissionerDiscoveryController.h @@ -238,8 +238,10 @@ class DLL_EXPORT AppInstallationService /** * @brief * Called to check app's installation status. - * - * This will be called by the main chip thread so any blocking work should be moved to a separate thread. + * + * CdError status is designed for CommissionerDeclaration and should be set by using SetErrorCode() and + * sent back to the client as a CDC Message. It is expected that app installation can have following statuses: + * kNoError, kAppInstallConsentPending, kAppInstalling, kAppInstallFailed, kAppInstalledRetryNeeded * * @param[in] vendorId The vendorId in the DNS-SD advertisement of the requesting commissionee. * @param[in] productId The productId in the DNS-SD advertisement of the requesting commissionee. From 4ae3a36e018d59b03adb601df5187820925cc6bc Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 29 May 2024 10:08:06 +0000 Subject: [PATCH 10/16] Restyled by whitespace --- src/controller/CommissionerDiscoveryController.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controller/CommissionerDiscoveryController.h b/src/controller/CommissionerDiscoveryController.h index 5f3f020f7d33b3..bf4ac2aee7c123 100644 --- a/src/controller/CommissionerDiscoveryController.h +++ b/src/controller/CommissionerDiscoveryController.h @@ -238,8 +238,8 @@ class DLL_EXPORT AppInstallationService /** * @brief * Called to check app's installation status. - * - * CdError status is designed for CommissionerDeclaration and should be set by using SetErrorCode() and + * + * CdError status is designed for CommissionerDeclaration and should be set by using SetErrorCode() and * sent back to the client as a CDC Message. It is expected that app installation can have following statuses: * kNoError, kAppInstallConsentPending, kAppInstalling, kAppInstallFailed, kAppInstalledRetryNeeded * From 106d30c481dd59964f75a97ab17b5dce65c8a5b1 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 29 May 2024 10:08:06 +0000 Subject: [PATCH 11/16] Restyled by clang-format --- examples/tv-app/tv-common/src/AppTv.cpp | 3 ++- src/controller/CommissionerDiscoveryController.cpp | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/tv-app/tv-common/src/AppTv.cpp b/examples/tv-app/tv-common/src/AppTv.cpp index bde0d4be7e3407..8fb54473596429 100644 --- a/examples/tv-app/tv-common/src/AppTv.cpp +++ b/examples/tv-app/tv-common/src/AppTv.cpp @@ -633,7 +633,8 @@ bool ContentAppFactoryImpl::UninstallContentApp(uint16_t vendorId, uint16_t prod return false; } -std::string createSearchIndex(uint16_t vendorId, uint16_t productId) { +std::string createSearchIndex(uint16_t vendorId, uint16_t productId) +{ // Format the IDs into a string std::string formattedString = std::to_string(vendorId) + ":" + std::to_string(productId); return formattedString; diff --git a/src/controller/CommissionerDiscoveryController.cpp b/src/controller/CommissionerDiscoveryController.cpp index f03dae2c603785..60348a941d4f95 100644 --- a/src/controller/CommissionerDiscoveryController.cpp +++ b/src/controller/CommissionerDiscoveryController.cpp @@ -246,8 +246,7 @@ void CommissionerDiscoveryController::InternalOk() // notify client the current app's installation status CommissionerDeclaration cd; cd.SetErrorCode(appInstallStatus); - mUdcServer->SendCDCMessage(cd, - Transport::PeerAddress::UDP(client->GetPeerAddress().GetIPAddress(), client->GetCdPort())); + mUdcServer->SendCDCMessage(cd, Transport::PeerAddress::UDP(client->GetPeerAddress().GetIPAddress(), client->GetCdPort())); return; } From 40eb3df2c898f10dbc9bcc05fcfaa49f57333a21 Mon Sep 17 00:00:00 2001 From: Lazar Kovacic Date: Thu, 30 May 2024 22:43:22 +0200 Subject: [PATCH 12/16] Update examples/tv-app/tv-common/shell/AppTvShellCommands.cpp Co-authored-by: chrisdecenzo <61757564+chrisdecenzo@users.noreply.github.com> --- examples/tv-app/tv-common/shell/AppTvShellCommands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp index 796dcd9437d2d5..6f63a4656729c2 100644 --- a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp +++ b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp @@ -209,7 +209,7 @@ static CHIP_ERROR PrintAllCommands() " app install Install app with given vendor ID and product ID. Usage: app install " "65521 32768\r\n"); streamer_printf(sout, - " app uinstall Uinstall app at given vendor ID and product ID. Usage: app uninstall " + " app uninstall Uinstall app at given vendor ID and product ID. Usage: app uninstall " "65521 32768\r\n"); streamer_printf( sout, From 8246f0e8b3cf33d56775144e82fcbcf80062ee94 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 30 May 2024 20:43:55 +0000 Subject: [PATCH 13/16] Restyled by clang-format --- examples/tv-app/tv-common/shell/AppTvShellCommands.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp index 6f63a4656729c2..d10c69a6d9de94 100644 --- a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp +++ b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp @@ -208,9 +208,10 @@ static CHIP_ERROR PrintAllCommands() streamer_printf(sout, " app install Install app with given vendor ID and product ID. Usage: app install " "65521 32768\r\n"); - streamer_printf(sout, - " app uninstall Uinstall app at given vendor ID and product ID. Usage: app uninstall " - "65521 32768\r\n"); + streamer_printf( + sout, + " app uninstall Uinstall app at given vendor ID and product ID. Usage: app uninstall " + "65521 32768\r\n"); streamer_printf( sout, " app setinstallstatus Set app's installation status for a given vendor ID and product ID. " From 0184744e4fcafc7520b3e6dca842d8150721b303 Mon Sep 17 00:00:00 2001 From: Lazar Kovacic Date: Tue, 4 Jun 2024 18:10:29 +0200 Subject: [PATCH 14/16] Update code per comments --- examples/tv-app/android/java/TVApp-JNI.cpp | 2 +- examples/tv-app/tv-common/include/AppTv.h | 6 ++--- .../tv-common/shell/AppTvShellCommands.cpp | 12 +++++----- examples/tv-app/tv-common/src/AppTv.cpp | 22 ++++++++++++------- .../CommissionerDiscoveryController.cpp | 2 +- .../CommissionerDiscoveryController.h | 6 ++--- 6 files changed, 28 insertions(+), 22 deletions(-) diff --git a/examples/tv-app/android/java/TVApp-JNI.cpp b/examples/tv-app/android/java/TVApp-JNI.cpp index 9e47662f39fa3f..928c85bd92a41e 100644 --- a/examples/tv-app/android/java/TVApp-JNI.cpp +++ b/examples/tv-app/android/java/TVApp-JNI.cpp @@ -249,7 +249,7 @@ class MyAppInstallationService : public AppInstallationService // TODO: Dummy code for Android OS, needs to be updated with package manager // retrieving correct app's installation status - CommissionerDeclaration::CdError GetInstallationStatusOfApp(uint16_t vendorId, uint16_t productId) override + CommissionerDeclaration::CdError GetAppInstallationErrorCode(uint16_t vendorId, uint16_t productId) override { return CommissionerDeclaration::CdError::kAppInstallConsentPending; } diff --git a/examples/tv-app/tv-common/include/AppTv.h b/examples/tv-app/tv-common/include/AppTv.h index a6ac2bc62f092d..f5eb2337274240 100644 --- a/examples/tv-app/tv-common/include/AppTv.h +++ b/examples/tv-app/tv-common/include/AppTv.h @@ -147,9 +147,9 @@ class DLL_EXPORT ContentAppFactoryImpl : public ContentAppFactory void InstallContentApp(uint16_t vendorId, uint16_t productId); // Remove the app from the list of mContentApps bool UninstallContentApp(uint16_t vendorId, uint16_t productId); - // Set App's Installation Status - void SetAppInstallationStatus(uint16_t vendorId, uint16_t productId, - Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError status); + // Set App's Installation Error Status + void SetAppInstallationErrorStatus(uint16_t vendorId, uint16_t productId, + Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError errorStatus); // Get App's Installation Status Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError GetAppInstallationStatus(uint16_t vendorId, uint16_t productId); diff --git a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp index d10c69a6d9de94..fcfce360e68a5b 100644 --- a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp +++ b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp @@ -214,8 +214,8 @@ static CHIP_ERROR PrintAllCommands() "65521 32768\r\n"); streamer_printf( sout, - " app setinstallstatus Set app's installation status for a given vendor ID and product ID. " - "Usage: app setinstallstatus 65521 32768 13. Installation status can be found at: UserDirectedCommissioning.h\r\n"); + " app setinstallerrorstatus Set app's installation error status for a given vendor ID and product ID. " + "Usage: app setinstallerrorstatus 65521 32768 13. Installation error status can be found at: UserDirectedCommissioning.h\r\n"); #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED #if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE streamer_printf(sout, " print-app-access Print all ACLs for app platform fabric. Usage: app print-app-access\r\n"); @@ -303,7 +303,7 @@ static CHIP_ERROR AppPlatformHandler(int argc, char ** argv) return CHIP_NO_ERROR; } - else if (strcmp(argv[0], "setinstallstatus") == 0) + else if (strcmp(argv[0], "setinstallerrorstatus") == 0) { if (argc < 3) { @@ -313,11 +313,11 @@ static CHIP_ERROR AppPlatformHandler(int argc, char ** argv) uint16_t vid = (uint16_t) strtol(argv[1], &eptr, 10); uint16_t pid = (uint16_t) strtol(argv[2], &eptr, 10); - uint16_t appInstallationStatus = (uint16_t) strtol(argv[3], &eptr, 10); + uint16_t appInstallationErrorStatus = (uint16_t) strtol(argv[3], &eptr, 10); ContentAppFactoryImpl * factory = GetContentAppFactoryImpl(); - factory->SetAppInstallationStatus( - vid, pid, static_cast(appInstallationStatus)); + factory->SetAppInstallationErrorStatus( + vid, pid, static_cast(appInstallationErrorStatus)); ChipLogProgress(DeviceLayer, "set app installation status"); diff --git a/examples/tv-app/tv-common/src/AppTv.cpp b/examples/tv-app/tv-common/src/AppTv.cpp index 8fb54473596429..241c899658bf9c 100644 --- a/examples/tv-app/tv-common/src/AppTv.cpp +++ b/examples/tv-app/tv-common/src/AppTv.cpp @@ -159,7 +159,7 @@ class MyAppInstallationService : public AppInstallationService return ContentAppPlatform::GetInstance().LoadContentAppByClient(vendorId, productId) != nullptr; } - CommissionerDeclaration::CdError GetInstallationStatusOfApp(uint16_t vendorId, uint16_t productId) override + CommissionerDeclaration::CdError GetAppInstallationErrorCode(uint16_t vendorId, uint16_t productId) override { ContentAppFactoryImpl * factory = GetContentAppFactoryImpl(); return factory->GetAppInstallationStatus(vendorId, productId); @@ -640,18 +640,18 @@ std::string createSearchIndex(uint16_t vendorId, uint16_t productId) return formattedString; } -void ContentAppFactoryImpl::SetAppInstallationStatus(uint16_t vendorId, uint16_t productId, CommissionerDeclaration::CdError status) +void ContentAppFactoryImpl::SetAppInstallationErrorStatus(uint16_t vendorId, uint16_t productId, CommissionerDeclaration::CdError errorStatus) { std::string searchIndex = createSearchIndex(vendorId, productId); std::map::iterator it; it = mAppInstallationStatus.find(searchIndex); if (it != mAppInstallationStatus.end()) { - mAppInstallationStatus[searchIndex] = status; + mAppInstallationStatus[searchIndex] = errorStatus; return; } - mAppInstallationStatus.insert({ searchIndex, status }); + mAppInstallationStatus.insert({ searchIndex, errorStatus }); } CommissionerDeclaration::CdError ContentAppFactoryImpl::GetAppInstallationStatus(uint16_t vendorId, uint16_t productId) @@ -721,12 +721,18 @@ std::list ContentAppFactoryImpl::GetAllowedClusterListForStaticEndpoi CHIP_ERROR AppTvInit() { #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED + // test data for apps + const uint16_t APP1_VENDOR_ID = 1; const uint16_t APP1_PRODUCT_ID = 11; + const uint16_t APP2_VENDOR_ID = 65521; const uint16_t APP2_PRODUCT_ID = 32769; + const uint16_t APP3_VENDOR_ID = 9050; const uint16_t APP3_PRODUCT_ID = 22; + const uint16_t APP4_VENDOR_ID = 1111; const uint16_t APP4_PRODUCT_ID = 22; + ContentAppPlatform::GetInstance().SetupAppPlatform(); ContentAppPlatform::GetInstance().SetContentAppFactory(&gFactory); - gFactory.InstallContentApp((uint16_t) 1, (uint16_t) 11); - gFactory.InstallContentApp((uint16_t) 65521, (uint16_t) 32769); - gFactory.InstallContentApp((uint16_t) 9050, (uint16_t) 22); - gFactory.InstallContentApp((uint16_t) 1111, (uint16_t) 22); + gFactory.InstallContentApp(APP1_VENDOR_ID, APP1_PRODUCT_ID); + gFactory.InstallContentApp(APP2_VENDOR_ID, APP2_PRODUCT_ID); + gFactory.InstallContentApp(APP3_VENDOR_ID, APP3_PRODUCT_ID); + gFactory.InstallContentApp(APP4_VENDOR_ID, APP4_PRODUCT_ID); uint16_t value; if (DeviceLayer::GetDeviceInstanceInfoProvider()->GetVendorId(value) != CHIP_NO_ERROR) { diff --git a/src/controller/CommissionerDiscoveryController.cpp b/src/controller/CommissionerDiscoveryController.cpp index 60348a941d4f95..bee0bc39da433c 100644 --- a/src/controller/CommissionerDiscoveryController.cpp +++ b/src/controller/CommissionerDiscoveryController.cpp @@ -241,7 +241,7 @@ void CommissionerDiscoveryController::InternalOk() ChipLogDetail(Controller, "------Via Shell Enter: app install "); CommissionerDeclaration::CdError appInstallStatus = - mAppInstallationService->GetInstallationStatusOfApp(client->GetVendorId(), client->GetProductId()); + mAppInstallationService->GetAppInstallationErrorCode(client->GetVendorId(), client->GetProductId()); // notify client the current app's installation status CommissionerDeclaration cd; diff --git a/src/controller/CommissionerDiscoveryController.h b/src/controller/CommissionerDiscoveryController.h index bf4ac2aee7c123..7a5d6031ca5e29 100644 --- a/src/controller/CommissionerDiscoveryController.h +++ b/src/controller/CommissionerDiscoveryController.h @@ -237,10 +237,10 @@ class DLL_EXPORT AppInstallationService /** * @brief - * Called to check app's installation status. + * Called to get app's installation error code. * * CdError status is designed for CommissionerDeclaration and should be set by using SetErrorCode() and - * sent back to the client as a CDC Message. It is expected that app installation can have following statuses: + * sent back to the client as a CDC Message. It is expected that app during installation can return following errors: * kNoError, kAppInstallConsentPending, kAppInstalling, kAppInstallFailed, kAppInstalledRetryNeeded * * @param[in] vendorId The vendorId in the DNS-SD advertisement of the requesting commissionee. @@ -248,7 +248,7 @@ class DLL_EXPORT AppInstallationService * */ virtual chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError - GetInstallationStatusOfApp(uint16_t vendorId, uint16_t productId) = 0; + GetAppInstallationErrorCode(uint16_t vendorId, uint16_t productId) = 0; virtual ~AppInstallationService() = default; }; From de7b390473c044059e7c3384d9488ede284b1699 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 4 Jun 2024 16:10:49 +0000 Subject: [PATCH 15/16] Restyled by whitespace --- examples/tv-app/tv-common/src/AppTv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tv-app/tv-common/src/AppTv.cpp b/examples/tv-app/tv-common/src/AppTv.cpp index 241c899658bf9c..31f08db3af403d 100644 --- a/examples/tv-app/tv-common/src/AppTv.cpp +++ b/examples/tv-app/tv-common/src/AppTv.cpp @@ -726,7 +726,7 @@ CHIP_ERROR AppTvInit() const uint16_t APP2_VENDOR_ID = 65521; const uint16_t APP2_PRODUCT_ID = 32769; const uint16_t APP3_VENDOR_ID = 9050; const uint16_t APP3_PRODUCT_ID = 22; const uint16_t APP4_VENDOR_ID = 1111; const uint16_t APP4_PRODUCT_ID = 22; - + ContentAppPlatform::GetInstance().SetupAppPlatform(); ContentAppPlatform::GetInstance().SetContentAppFactory(&gFactory); gFactory.InstallContentApp(APP1_VENDOR_ID, APP1_PRODUCT_ID); From 2ca4374e46f96361edb43188733ef63da7750989 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 4 Jun 2024 16:10:50 +0000 Subject: [PATCH 16/16] Restyled by clang-format --- examples/tv-app/tv-common/include/AppTv.h | 2 +- .../tv-common/shell/AppTvShellCommands.cpp | 16 +++++++++------- examples/tv-app/tv-common/src/AppTv.cpp | 15 ++++++++++----- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/examples/tv-app/tv-common/include/AppTv.h b/examples/tv-app/tv-common/include/AppTv.h index f5eb2337274240..3cc65f14f53ea7 100644 --- a/examples/tv-app/tv-common/include/AppTv.h +++ b/examples/tv-app/tv-common/include/AppTv.h @@ -149,7 +149,7 @@ class DLL_EXPORT ContentAppFactoryImpl : public ContentAppFactory bool UninstallContentApp(uint16_t vendorId, uint16_t productId); // Set App's Installation Error Status void SetAppInstallationErrorStatus(uint16_t vendorId, uint16_t productId, - Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError errorStatus); + Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError errorStatus); // Get App's Installation Status Protocols::UserDirectedCommissioning::CommissionerDeclaration::CdError GetAppInstallationStatus(uint16_t vendorId, uint16_t productId); diff --git a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp index fcfce360e68a5b..e2e4cca6a59500 100644 --- a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp +++ b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp @@ -212,10 +212,11 @@ static CHIP_ERROR PrintAllCommands() sout, " app uninstall Uinstall app at given vendor ID and product ID. Usage: app uninstall " "65521 32768\r\n"); - streamer_printf( - sout, - " app setinstallerrorstatus Set app's installation error status for a given vendor ID and product ID. " - "Usage: app setinstallerrorstatus 65521 32768 13. Installation error status can be found at: UserDirectedCommissioning.h\r\n"); + streamer_printf(sout, + " app setinstallerrorstatus Set app's installation error status for a given vendor " + "ID and product ID. " + "Usage: app setinstallerrorstatus 65521 32768 13. Installation error status can be found at: " + "UserDirectedCommissioning.h\r\n"); #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED #if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE streamer_printf(sout, " print-app-access Print all ACLs for app platform fabric. Usage: app print-app-access\r\n"); @@ -311,13 +312,14 @@ static CHIP_ERROR AppPlatformHandler(int argc, char ** argv) } char * eptr; - uint16_t vid = (uint16_t) strtol(argv[1], &eptr, 10); - uint16_t pid = (uint16_t) strtol(argv[2], &eptr, 10); + uint16_t vid = (uint16_t) strtol(argv[1], &eptr, 10); + uint16_t pid = (uint16_t) strtol(argv[2], &eptr, 10); uint16_t appInstallationErrorStatus = (uint16_t) strtol(argv[3], &eptr, 10); ContentAppFactoryImpl * factory = GetContentAppFactoryImpl(); factory->SetAppInstallationErrorStatus( - vid, pid, static_cast(appInstallationErrorStatus)); + vid, pid, + static_cast(appInstallationErrorStatus)); ChipLogProgress(DeviceLayer, "set app installation status"); diff --git a/examples/tv-app/tv-common/src/AppTv.cpp b/examples/tv-app/tv-common/src/AppTv.cpp index 31f08db3af403d..5d65da34caceaf 100644 --- a/examples/tv-app/tv-common/src/AppTv.cpp +++ b/examples/tv-app/tv-common/src/AppTv.cpp @@ -640,7 +640,8 @@ std::string createSearchIndex(uint16_t vendorId, uint16_t productId) return formattedString; } -void ContentAppFactoryImpl::SetAppInstallationErrorStatus(uint16_t vendorId, uint16_t productId, CommissionerDeclaration::CdError errorStatus) +void ContentAppFactoryImpl::SetAppInstallationErrorStatus(uint16_t vendorId, uint16_t productId, + CommissionerDeclaration::CdError errorStatus) { std::string searchIndex = createSearchIndex(vendorId, productId); std::map::iterator it; @@ -722,10 +723,14 @@ CHIP_ERROR AppTvInit() { #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED // test data for apps - const uint16_t APP1_VENDOR_ID = 1; const uint16_t APP1_PRODUCT_ID = 11; - const uint16_t APP2_VENDOR_ID = 65521; const uint16_t APP2_PRODUCT_ID = 32769; - const uint16_t APP3_VENDOR_ID = 9050; const uint16_t APP3_PRODUCT_ID = 22; - const uint16_t APP4_VENDOR_ID = 1111; const uint16_t APP4_PRODUCT_ID = 22; + const uint16_t APP1_VENDOR_ID = 1; + const uint16_t APP1_PRODUCT_ID = 11; + const uint16_t APP2_VENDOR_ID = 65521; + const uint16_t APP2_PRODUCT_ID = 32769; + const uint16_t APP3_VENDOR_ID = 9050; + const uint16_t APP3_PRODUCT_ID = 22; + const uint16_t APP4_VENDOR_ID = 1111; + const uint16_t APP4_PRODUCT_ID = 22; ContentAppPlatform::GetInstance().SetupAppPlatform(); ContentAppPlatform::GetInstance().SetContentAppFactory(&gFactory);