@@ -548,7 +548,6 @@ ContentApp * ContentAppFactoryImpl::LoadContentApp(const CatalogVendorApp & vend
548
548
549
549
for (auto & contentApp : mContentApps ) {
550
550
551
-
552
551
auto app = contentApp.get ();
553
552
554
553
ChipLogProgress (DeviceLayer, " Looking next=%s " , app->GetApplicationBasicDelegate ()->GetCatalogVendorApp ()->applicationId );
@@ -572,7 +571,7 @@ void ContentAppFactoryImpl::AddAdminVendorId(uint16_t vendorId)
572
571
mAdminVendorIds .push_back (vendorId);
573
572
}
574
573
575
- void ContentAppFactoryImpl::AddContentApp (uint16_t vendorId, uint16_t productId)
574
+ void ContentAppFactoryImpl::InstallContentApp (uint16_t vendorId, uint16_t productId)
576
575
{
577
576
if (vendorId == 1 && productId == 11 ) {
578
577
mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" Vendor1" , vendorId, " exampleid" , productId, " Version1" , " 34567890" ));
@@ -587,6 +586,28 @@ void ContentAppFactoryImpl::AddContentApp(uint16_t vendorId, uint16_t productId)
587
586
}
588
587
}
589
588
589
+ void ContentAppFactoryImpl::UninstallContentApp (uint16_t vendorId, uint16_t productId)
590
+ {
591
+ ChipLogProgress (DeviceLayer, " ContentAppFactoryImpl: RemoveContentApp vendorId=%d productId=%d " ,
592
+ vendorId, productId);
593
+
594
+ int index = 0 ;
595
+ for (auto & contentApp : mContentApps ) {
596
+
597
+ auto app = contentApp.get ();
598
+
599
+ ChipLogProgress (DeviceLayer, " Looking next vid=%d pid=%d" , app->GetApplicationBasicDelegate ()->HandleGetVendorId (), app->GetApplicationBasicDelegate ()->HandleGetProductId ());
600
+
601
+ if (app->MatchesPidVid (productId, vendorId)) {
602
+ ChipLogProgress (DeviceLayer, " Found an app. vid=%d pid=%d. Uninstalling it." , app->GetApplicationBasicDelegate ()->HandleGetVendorId (), app->GetApplicationBasicDelegate ()->HandleGetProductId ());
603
+ mContentApps .erase (mContentApps .begin () + index );
604
+ return ;
605
+ }
606
+
607
+ index ++;
608
+ }
609
+ }
610
+
590
611
Access::Privilege ContentAppFactoryImpl::GetVendorPrivilege (uint16_t vendorId)
591
612
{
592
613
for (size_t i = 0 ; i < mAdminVendorIds .size (); ++i)
@@ -643,10 +664,10 @@ CHIP_ERROR AppTvInit()
643
664
#if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED
644
665
ContentAppPlatform::GetInstance ().SetupAppPlatform ();
645
666
ContentAppPlatform::GetInstance ().SetContentAppFactory (&gFactory );
646
- gFactory .AddContentApp ((uint16_t )1 , (uint16_t )11 );
647
- // gFactory.AddContentApp ((uint16_t)65521, (uint16_t)32768);
648
- gFactory .AddContentApp ((uint16_t )9050 , (uint16_t )22 );
649
- gFactory .AddContentApp ((uint16_t )1111 , (uint16_t )22 );
667
+ gFactory .InstallContentApp ((uint16_t )1 , (uint16_t )11 );
668
+ gFactory .InstallContentApp ((uint16_t )65521 , (uint16_t )32768 );
669
+ gFactory .InstallContentApp ((uint16_t )9050 , (uint16_t )22 );
670
+ gFactory .InstallContentApp ((uint16_t )1111 , (uint16_t )22 );
650
671
uint16_t value;
651
672
if (DeviceLayer::GetDeviceInstanceInfoProvider ()->GetVendorId (value) != CHIP_NO_ERROR)
652
673
{
0 commit comments