@@ -98,12 +98,6 @@ class MyUserPrompter : public UserPrompter
98
98
99
99
// tv should override this with a dialog prompt
100
100
inline void PromptCommissioningFailed (const char * commissioneeName, CHIP_ERROR error) override { return ; }
101
-
102
- // tv should override this with a dialog prompt
103
- inline void PromptForAppInstallOKPermission (uint16_t vendorId, uint16_t productId, const char * commissioneeName) override
104
- {
105
- return ;
106
- }
107
101
};
108
102
109
103
MyUserPrompter gMyUserPrompter ;
@@ -583,28 +577,33 @@ void ContentAppFactoryImpl::InstallContentApp(uint16_t vendorId, uint16_t produc
583
577
ChipLogProgress (DeviceLayer, " ContentAppFactoryImpl: InstallContentApp vendorId=%d productId=%d " , vendorId, productId);
584
578
if (vendorId == 1 && productId == 11 )
585
579
{
586
- mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" Vendor1" , vendorId, " exampleid" , productId, " Version1" ,
587
- " 34567890" , make_default_supported_clusters ()));
580
+ auto ptr = std::make_unique<ContentAppImpl>(" Vendor1" , vendorId, " exampleid" , productId, " Version1" , " 34567890" ,
581
+ make_default_supported_clusters ());
582
+ mContentApps .emplace_back (std::move (ptr));
588
583
}
589
- else if (vendorId == 65521 && productId == 32768 )
584
+ else if (vendorId == 65521 && productId == 32769 )
590
585
{
591
- mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" Vendor2" , vendorId, " exampleString" , productId, " Version2" ,
592
- " 20202021" , make_default_supported_clusters ()));
586
+ auto ptr = std::make_unique<ContentAppImpl>(" Vendor2" , vendorId, " exampleString" , productId, " Version2" , " 20202021" ,
587
+ make_default_supported_clusters ());
588
+ mContentApps .emplace_back (std::move (ptr));
593
589
}
594
590
else if (vendorId == 9050 && productId == 22 )
595
591
{
596
- mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" Vendor3" , vendorId, " App3" , productId, " Version3" , " 20202021" ,
597
- make_default_supported_clusters ()));
592
+ auto ptr = std::make_unique<ContentAppImpl>(" Vendor3" , vendorId, " App3" , productId, " Version3" , " 20202021" ,
593
+ make_default_supported_clusters ());
594
+ mContentApps .emplace_back (std::move (ptr));
598
595
}
599
596
else if (vendorId == 1111 && productId == 22 )
600
597
{
601
- mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" TestSuiteVendor" , vendorId, " applicationId" , productId, " v2" ,
602
- " 20202021" , make_default_supported_clusters ()));
598
+ auto ptr = std::make_unique<ContentAppImpl>(" TestSuiteVendor" , vendorId, " applicationId" , productId, " v2" , " 20202021" ,
599
+ make_default_supported_clusters ());
600
+ mContentApps .emplace_back (std::move (ptr));
603
601
}
604
602
else
605
603
{
606
- mContentApps .emplace_back (std::make_unique<ContentAppImpl>(" NewAppVendor" , vendorId, " newAppApplicationId" , productId, " v2" ,
607
- " 20202021" , make_default_supported_clusters ()));
604
+ auto ptr = std::make_unique<ContentAppImpl>(" NewAppVendor" , vendorId, " newAppApplicationId" , productId, " v2" , " 20202021" ,
605
+ make_default_supported_clusters ());
606
+ mContentApps .emplace_back (std::move (ptr));
608
607
}
609
608
}
610
609
@@ -627,6 +626,7 @@ bool ContentAppFactoryImpl::UninstallContentApp(uint16_t vendorId, uint16_t prod
627
626
app->GetApplicationBasicDelegate ()->HandleGetVendorId (),
628
627
app->GetApplicationBasicDelegate ()->HandleGetProductId ());
629
628
mContentApps .erase (mContentApps .begin () + index );
629
+ // TODO: call ContentAppPlatform->RemoveContentApp(ids...)
630
630
return true ;
631
631
}
632
632
@@ -635,6 +635,18 @@ bool ContentAppFactoryImpl::UninstallContentApp(uint16_t vendorId, uint16_t prod
635
635
return false ;
636
636
}
637
637
638
+ void ContentAppFactoryImpl::LogInstalledApps ()
639
+ {
640
+ for (auto & contentApp : mContentApps )
641
+ {
642
+ auto app = contentApp.get ();
643
+
644
+ ChipLogProgress (DeviceLayer, " Content app vid=%d pid=%d is on ep=%d" ,
645
+ app->GetApplicationBasicDelegate ()->HandleGetVendorId (),
646
+ app->GetApplicationBasicDelegate ()->HandleGetProductId (), app->GetEndpointId ());
647
+ }
648
+ }
649
+
638
650
Access::Privilege ContentAppFactoryImpl::GetVendorPrivilege (uint16_t vendorId)
639
651
{
640
652
for (size_t i = 0 ; i < mAdminVendorIds .size (); ++i)
@@ -689,12 +701,22 @@ std::list<ClusterId> ContentAppFactoryImpl::GetAllowedClusterListForStaticEndpoi
689
701
CHIP_ERROR AppTvInit ()
690
702
{
691
703
#if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED
704
+ // test data for apps
705
+ constexpr uint16_t kApp1VendorId = 1 ;
706
+ constexpr uint16_t kApp1ProductId = 11 ;
707
+ constexpr uint16_t kApp2VendorId = 65521 ;
708
+ constexpr uint16_t kApp2ProductId = 32769 ;
709
+ constexpr uint16_t kApp3VendorId = 9050 ;
710
+ constexpr uint16_t kApp3ProductId = 22 ;
711
+ constexpr uint16_t kApp4VendorId = 1111 ;
712
+ constexpr uint16_t kApp4ProductId = 22 ;
713
+
692
714
ContentAppPlatform::GetInstance ().SetupAppPlatform ();
693
715
ContentAppPlatform::GetInstance ().SetContentAppFactory (&gFactory );
694
- gFactory .InstallContentApp (( uint16_t ) 1 , ( uint16_t ) 11 );
695
- gFactory .InstallContentApp (( uint16_t ) 65521 , ( uint16_t ) 32768 );
696
- gFactory .InstallContentApp (( uint16_t ) 9050 , ( uint16_t ) 22 );
697
- gFactory .InstallContentApp (( uint16_t ) 1111 , ( uint16_t ) 22 );
716
+ gFactory .InstallContentApp (kApp1VendorId , kApp1ProductId );
717
+ gFactory .InstallContentApp (kApp2VendorId , kApp2ProductId );
718
+ gFactory .InstallContentApp (kApp3VendorId , kApp3ProductId );
719
+ gFactory .InstallContentApp (kApp4VendorId , kApp4ProductId );
698
720
uint16_t value;
699
721
if (DeviceLayer::GetDeviceInstanceInfoProvider ()->GetVendorId (value) != CHIP_NO_ERROR)
700
722
{
0 commit comments