@@ -104,12 +104,10 @@ class MyUserPrompter : public UserPrompter
104
104
// tv should override this with a dialog prompt
105
105
inline void PromptForAppInstallOKPermission (uint16_t vendorId, uint16_t productId, const char * commissioneeName) override
106
106
{
107
- // mContentApps[5] = ContentAppImpl("Vendor1", vendorId, "exampleid", productId, "Version3", "20202021");
107
+ ChipLogError (Controller, " Adding Content App" );
108
+ gFactory .AddContentApp ((uint16_t )65521 , (uint16_t )32768 );
108
109
109
- gFactory .AddContentApp (vendorId, productId);
110
- // ContentAppFactoryImpl::GetContentAppFactoryImpl().AddContentApp(vendorId, productId);
111
-
112
- ContentAppPlatform::GetInstance ().LoadContentAppByClient (vendorId, productId);
110
+ // ContentAppPlatform::GetInstance().LoadContentAppByClient(vendorId, productId);
113
111
114
112
return ;
115
113
}
@@ -552,19 +550,23 @@ ContentApp * ContentAppFactoryImpl::LoadContentApp(const CatalogVendorApp & vend
552
550
{
553
551
ChipLogProgress (DeviceLayer, " ContentAppFactoryImpl: LoadContentAppByAppId catalogVendorId=%d applicationId=%s " ,
554
552
vendorApp.catalogVendorId , vendorApp.applicationId );
553
+ int index = 0 ;
554
+
555
+ for (auto & contentApp : mContentApps ) {
555
556
556
- for (size_t i = 0 ; i < ArraySize (mContentApps ); ++i)
557
- {
558
- auto & app = mContentApps [i];
559
557
560
- ChipLogProgress (DeviceLayer, " Looking next=%s " , app.GetApplicationBasicDelegate ()->GetCatalogVendorApp ()->applicationId );
561
- if (app.GetApplicationBasicDelegate ()->GetCatalogVendorApp ()->Matches (vendorApp))
558
+ auto app = contentApp.get ();
559
+
560
+ ChipLogProgress (DeviceLayer, " Looking next=%s " , app->GetApplicationBasicDelegate ()->GetCatalogVendorApp ()->applicationId );
561
+ if (app->GetApplicationBasicDelegate ()->GetCatalogVendorApp ()->Matches (vendorApp))
562
562
{
563
- ContentAppPlatform::GetInstance ().AddContentApp (& app, &contentAppEndpoint, Span<DataVersion>(gDataVersions [i ]),
563
+ ContentAppPlatform::GetInstance ().AddContentApp (app, &contentAppEndpoint, Span<DataVersion>(gDataVersions [index ]),
564
564
Span<const EmberAfDeviceType>(gContentAppDeviceType ));
565
- return & app;
565
+ return app;
566
566
}
567
+ index ++;
567
568
}
569
+
568
570
ChipLogProgress (DeviceLayer, " LoadContentAppByAppId NOT FOUND catalogVendorId=%d applicationId=%s " , vendorApp.catalogVendorId ,
569
571
vendorApp.applicationId );
570
572
@@ -578,7 +580,17 @@ void ContentAppFactoryImpl::AddAdminVendorId(uint16_t vendorId)
578
580
579
581
void ContentAppFactoryImpl::AddContentApp (uint16_t vendorId, uint16_t productId)
580
582
{
581
- // mContentApps[5] = ContentAppImpl("Vendor1", vendorId, "exampleid", productId, "Version3", "20202021");
583
+ if (vendorId == 1 && productId == 11 ) {
584
+ mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" Vendor1" , vendorId, " exampleid" , productId, " Version1" , " 34567890" ));
585
+ } else if (vendorId == 65521 && productId == 32768 ) {
586
+ mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" Vendor2" , vendorId, " exampleString" , productId, " Version2" , " 20202021" ));
587
+ } else if (vendorId == 9050 && productId == 22 ) {
588
+ mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" Vendor3" , vendorId, " App3" , productId, " Version3" , " 20202021" ));
589
+ } else if (vendorId == 1111 && productId == 22 ) {
590
+ mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" TestSuiteVendor" , vendorId, " applicationId" , productId, " v2" , " 20202021" ));
591
+ } else {
592
+ mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" NewAppVendor" , vendorId, " newAppApplicationId" , productId, " v2" , " 20202021" ));
593
+ }
582
594
}
583
595
584
596
Access::Privilege ContentAppFactoryImpl::GetVendorPrivilege (uint16_t vendorId)
@@ -637,6 +649,10 @@ CHIP_ERROR AppTvInit()
637
649
#if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED
638
650
ContentAppPlatform::GetInstance ().SetupAppPlatform ();
639
651
ContentAppPlatform::GetInstance ().SetContentAppFactory (&gFactory );
652
+ gFactory .AddContentApp ((uint16_t )1 , (uint16_t )11 );
653
+ // gFactory.AddContentApp((uint16_t)65521, (uint16_t)32768);
654
+ // gFactory.AddContentApp((uint16_t)9050, (uint16_t)22);
655
+ // gFactory.AddContentApp((uint16_t)1111, (uint16_t)22);
640
656
uint16_t value;
641
657
if (DeviceLayer::GetDeviceInstanceInfoProvider ()->GetVendorId (value) != CHIP_NO_ERROR)
642
658
{
0 commit comments