@@ -101,7 +101,9 @@ class MyUserPrompter : public UserPrompter
101
101
102
102
// tv should override this with a dialog prompt
103
103
inline void PromptForAppInstallOKPermission (uint16_t vendorId, uint16_t productId, const char * commissioneeName) override
104
- { return ; }
104
+ {
105
+ return ;
106
+ }
105
107
};
106
108
107
109
MyUserPrompter gMyUserPrompter ;
@@ -543,7 +545,8 @@ ContentApp * ContentAppFactoryImpl::LoadContentApp(const CatalogVendorApp & vend
543
545
vendorApp.catalogVendorId , vendorApp.applicationId );
544
546
int index = 0 ;
545
547
546
- for (auto & contentApp : mContentApps ) {
548
+ for (auto & contentApp : mContentApps )
549
+ {
547
550
548
551
auto app = contentApp.get ();
549
552
@@ -570,35 +573,51 @@ void ContentAppFactoryImpl::AddAdminVendorId(uint16_t vendorId)
570
573
571
574
void ContentAppFactoryImpl::InstallContentApp (uint16_t vendorId, uint16_t productId)
572
575
{
573
- ChipLogProgress (DeviceLayer, " ContentAppFactoryImpl: InstallContentApp vendorId=%d productId=%d " ,
574
- vendorId, productId);
575
- if (vendorId == 1 && productId == 11 ) {
576
- mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" Vendor1" , vendorId, " exampleid" , productId, " Version1" , " 34567890" ));
577
- } else if (vendorId == 65521 && productId == 32768 ) {
578
- mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" Vendor2" , vendorId, " exampleString" , productId, " Version2" , " 20202021" ));
579
- } else if (vendorId == 9050 && productId == 22 ) {
576
+ ChipLogProgress (DeviceLayer, " ContentAppFactoryImpl: InstallContentApp vendorId=%d productId=%d " , vendorId, productId);
577
+ if (vendorId == 1 && productId == 11 )
578
+ {
579
+ mContentApps .emplace_back (
580
+ std::make_unique<ContentAppImpl>(" Vendor1" , vendorId, " exampleid" , productId, " Version1" , " 34567890" ));
581
+ }
582
+ else if (vendorId == 65521 && productId == 32768 )
583
+ {
584
+ mContentApps .emplace_back (
585
+ std::make_unique<ContentAppImpl>(" Vendor2" , vendorId, " exampleString" , productId, " Version2" , " 20202021" ));
586
+ }
587
+ else if (vendorId == 9050 && productId == 22 )
588
+ {
580
589
mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" Vendor3" , vendorId, " App3" , productId, " Version3" , " 20202021" ));
581
- } else if (vendorId == 1111 && productId == 22 ) {
582
- mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" TestSuiteVendor" , vendorId, " applicationId" , productId, " v2" , " 20202021" ));
583
- } else {
584
- mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" NewAppVendor" , vendorId, " newAppApplicationId" , productId, " v2" , " 20202021" ));
590
+ }
591
+ else if (vendorId == 1111 && productId == 22 )
592
+ {
593
+ mContentApps .emplace_back (
594
+ std::make_unique<ContentAppImpl>(" TestSuiteVendor" , vendorId, " applicationId" , productId, " v2" , " 20202021" ));
595
+ }
596
+ else
597
+ {
598
+ mContentApps .emplace_back (
599
+ std::make_unique<ContentAppImpl>(" NewAppVendor" , vendorId, " newAppApplicationId" , productId, " v2" , " 20202021" ));
585
600
}
586
601
}
587
602
588
603
bool ContentAppFactoryImpl::UninstallContentApp (uint16_t vendorId, uint16_t productId)
589
604
{
590
- ChipLogProgress (DeviceLayer, " ContentAppFactoryImpl: UninstallContentApp vendorId=%d productId=%d " ,
591
- vendorId, productId);
605
+ ChipLogProgress (DeviceLayer, " ContentAppFactoryImpl: UninstallContentApp vendorId=%d productId=%d " , vendorId, productId);
592
606
593
607
int index = 0 ;
594
- for (auto & contentApp : mContentApps ) {
608
+ for (auto & contentApp : mContentApps )
609
+ {
595
610
596
611
auto app = contentApp.get ();
597
612
598
- ChipLogProgress (DeviceLayer, " Looking next vid=%d pid=%d" , app->GetApplicationBasicDelegate ()->HandleGetVendorId (), app->GetApplicationBasicDelegate ()->HandleGetProductId ());
613
+ ChipLogProgress (DeviceLayer, " Looking next vid=%d pid=%d" , app->GetApplicationBasicDelegate ()->HandleGetVendorId (),
614
+ app->GetApplicationBasicDelegate ()->HandleGetProductId ());
599
615
600
- if (app->MatchesPidVid (productId, vendorId)) {
601
- ChipLogProgress (DeviceLayer, " Found an app vid=%d pid=%d. Uninstalling it." , app->GetApplicationBasicDelegate ()->HandleGetVendorId (), app->GetApplicationBasicDelegate ()->HandleGetProductId ());
616
+ if (app->MatchesPidVid (productId, vendorId))
617
+ {
618
+ ChipLogProgress (DeviceLayer, " Found an app vid=%d pid=%d. Uninstalling it." ,
619
+ app->GetApplicationBasicDelegate ()->HandleGetVendorId (),
620
+ app->GetApplicationBasicDelegate ()->HandleGetProductId ());
602
621
mContentApps .erase (mContentApps .begin () + index );
603
622
return true ;
604
623
}
@@ -664,10 +683,10 @@ CHIP_ERROR AppTvInit()
664
683
#if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED
665
684
ContentAppPlatform::GetInstance ().SetupAppPlatform ();
666
685
ContentAppPlatform::GetInstance ().SetContentAppFactory (&gFactory );
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 );
686
+ gFactory .InstallContentApp ((uint16_t ) 1 , (uint16_t ) 11 );
687
+ gFactory .InstallContentApp ((uint16_t ) 65521 , (uint16_t ) 32768 );
688
+ gFactory .InstallContentApp ((uint16_t ) 9050 , (uint16_t ) 22 );
689
+ gFactory .InstallContentApp ((uint16_t ) 1111 , (uint16_t ) 22 );
671
690
uint16_t value;
672
691
if (DeviceLayer::GetDeviceInstanceInfoProvider ()->GetVendorId (value) != CHIP_NO_ERROR)
673
692
{
0 commit comments