From ed324437e642b7cf742426fe3beadb37b28db789 Mon Sep 17 00:00:00 2001 From: pankore <86098180+pankore@users.noreply.github.com> Date: Thu, 23 Mar 2023 23:09:58 +0800 Subject: [PATCH] setdeviceinstanceinfoprovider use factorydataprovider by default (#25706) --- examples/all-clusters-app/ameba/main/chipinterface.cpp | 2 -- examples/chef/ameba/main/chipinterface.cpp | 9 ++++++--- examples/light-switch-app/ameba/main/chipinterface.cpp | 9 ++++++--- examples/lighting-app/ameba/main/chipinterface.cpp | 9 ++++++--- examples/ota-requestor-app/ameba/main/chipinterface.cpp | 8 +++++--- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/examples/all-clusters-app/ameba/main/chipinterface.cpp b/examples/all-clusters-app/ameba/main/chipinterface.cpp index 380cf4bd62c117..c0e918e2082a86 100644 --- a/examples/all-clusters-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-app/ameba/main/chipinterface.cpp @@ -172,9 +172,7 @@ extern "C" void ChipTest(void) // Set DeviceInstanceInfoProvider after CHIPDeviceManager init // CHIPDeviceManager init will set GenericDeviceInsanceInfoProvider first -#if CONFIG_ENABLE_AMEBA_FACTORY_DATA SetDeviceInstanceInfoProvider(&mFactoryDataProvider); -#endif chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, 0); diff --git a/examples/chef/ameba/main/chipinterface.cpp b/examples/chef/ameba/main/chipinterface.cpp index 5a0b3f21d2417a..f68fca04254cf7 100644 --- a/examples/chef/ameba/main/chipinterface.cpp +++ b/examples/chef/ameba/main/chipinterface.cpp @@ -127,11 +127,10 @@ extern "C" void ChipTest(void) initPref(); - // Initialize device attestation, commissionable data and device instance info - // TODO: Use our own DeviceInstanceInfoProvider - // SetDeviceInstanceInfoProvider(&mFactoryDataProvider); + mFactoryDataProvider.Init(); SetCommissionableDataProvider(&mFactoryDataProvider); SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider); + CHIPDeviceManager & deviceMgr = CHIPDeviceManager::GetInstance(); err = deviceMgr.Init(&EchoCallbacks); @@ -144,6 +143,10 @@ extern "C" void ChipTest(void) ChipLogProgress(DeviceLayer, "DeviceManagerInit() - OK\r\n"); } + // Set DeviceInstanceInfoProvider after CHIPDeviceManager init + // CHIPDeviceManager init will set GenericDeviceInsanceInfoProvider first + SetDeviceInstanceInfoProvider(&mFactoryDataProvider); + chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, 0); statusLED1.Init(STATUS_LED_GPIO_NUM); diff --git a/examples/light-switch-app/ameba/main/chipinterface.cpp b/examples/light-switch-app/ameba/main/chipinterface.cpp index 24e32a72decf39..85e4c401514d99 100644 --- a/examples/light-switch-app/ameba/main/chipinterface.cpp +++ b/examples/light-switch-app/ameba/main/chipinterface.cpp @@ -132,11 +132,10 @@ extern "C" void ChipTest(void) initPref(); - // Initialize device attestation, commissionable data and device instance info - // TODO: Use our own DeviceInstanceInfoProvider - // SetDeviceInstanceInfoProvider(&mFactoryDataProvider); + mFactoryDataProvider.Init(); SetCommissionableDataProvider(&mFactoryDataProvider); SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider); + CHIPDeviceManager & deviceMgr = CHIPDeviceManager::GetInstance(); err = deviceMgr.Init(&EchoCallbacks); @@ -149,6 +148,10 @@ extern "C" void ChipTest(void) ChipLogProgress(DeviceLayer, "DeviceManagerInit() - OK\r\n"); } + // Set DeviceInstanceInfoProvider after CHIPDeviceManager init + // CHIPDeviceManager init will set GenericDeviceInsanceInfoProvider first + SetDeviceInstanceInfoProvider(&mFactoryDataProvider); + chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, 0); statusLED1.Init(STATUS_LED_GPIO_NUM); diff --git a/examples/lighting-app/ameba/main/chipinterface.cpp b/examples/lighting-app/ameba/main/chipinterface.cpp index a45222a1207c30..f46fe7ad320557 100644 --- a/examples/lighting-app/ameba/main/chipinterface.cpp +++ b/examples/lighting-app/ameba/main/chipinterface.cpp @@ -148,11 +148,10 @@ extern "C" void ChipTest(void) initPref(); - // Initialize device attestation, commissionable data and device instance info - // TODO: Use our own DeviceInstanceInfoProvider - // SetDeviceInstanceInfoProvider(&mFactoryDataProvider); + mFactoryDataProvider.Init(); SetCommissionableDataProvider(&mFactoryDataProvider); SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider); + CHIPDeviceManager & deviceMgr = CHIPDeviceManager::GetInstance(); err = deviceMgr.Init(&EchoCallbacks); @@ -165,6 +164,10 @@ extern "C" void ChipTest(void) ChipLogProgress(DeviceLayer, "DeviceManagerInit() - OK\r\n"); } + // Set DeviceInstanceInfoProvider after CHIPDeviceManager init + // CHIPDeviceManager init will set GenericDeviceInsanceInfoProvider first + SetDeviceInstanceInfoProvider(&mFactoryDataProvider); + chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, 0); statusLED1.Init(STATUS_LED_GPIO_NUM); diff --git a/examples/ota-requestor-app/ameba/main/chipinterface.cpp b/examples/ota-requestor-app/ameba/main/chipinterface.cpp index 865d98c1a165cd..2dd76a6dba308b 100644 --- a/examples/ota-requestor-app/ameba/main/chipinterface.cpp +++ b/examples/ota-requestor-app/ameba/main/chipinterface.cpp @@ -95,9 +95,7 @@ extern "C" void ChipTest(void) initPref(); - // Initialize device attestation, commissionable data and device instance info - // TODO: Use our own DeviceInstanceInfoProvider - // SetDeviceInstanceInfoProvider(&mFactoryDataProvider); + mFactoryDataProvider.Init(); SetCommissionableDataProvider(&mFactoryDataProvider); SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider); @@ -112,5 +110,9 @@ extern "C" void ChipTest(void) ChipLogProgress(DeviceLayer, "DeviceManagerInit() - OK\r\n"); } + // Set DeviceInstanceInfoProvider after CHIPDeviceManager init + // CHIPDeviceManager init will set GenericDeviceInsanceInfoProvider first + SetDeviceInstanceInfoProvider(&mFactoryDataProvider); + chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, 0); }