Skip to content

Commit

Permalink
[factorydata] dont use exampledacprovider (#26382)
Browse files Browse the repository at this point in the history
- set fallback within factorydataprovider itself
  • Loading branch information
pankore authored and pull[bot] committed Jun 21, 2023
1 parent 6ca0e7b commit 1223234
Show file tree
Hide file tree
Showing 6 changed files with 386 additions and 340 deletions.
15 changes: 6 additions & 9 deletions examples/all-clusters-app/ameba/main/CHIPDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,14 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb)
SuccessOrExit(err);

err = mFactoryDataProvider.Init();
if (err == CHIP_NO_ERROR)
if (err != CHIP_NO_ERROR)
{
SetCommissionableDataProvider(&mFactoryDataProvider);
SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider);
SetDeviceInstanceInfoProvider(&mFactoryDataProvider);
}
else
{
ChipLogProgress(DeviceLayer, "Using example DAC provider");
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
ChipLogError(DeviceLayer, "Error initializing FactoryData!");
ChipLogError(DeviceLayer, "Check if you have flashed it correctly!");
}
SetCommissionableDataProvider(&mFactoryDataProvider);
SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider);
SetDeviceInstanceInfoProvider(&mFactoryDataProvider);

if (CONFIG_NETWORK_LAYER_BLE)
{
Expand Down
15 changes: 6 additions & 9 deletions examples/light-switch-app/ameba/main/CHIPDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,14 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb)
SuccessOrExit(err);

err = mFactoryDataProvider.Init();
if (err == CHIP_NO_ERROR)
if (err != CHIP_NO_ERROR)
{
SetCommissionableDataProvider(&mFactoryDataProvider);
SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider);
SetDeviceInstanceInfoProvider(&mFactoryDataProvider);
}
else
{
ChipLogProgress(DeviceLayer, "Using example DAC provider");
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
ChipLogError(DeviceLayer, "Error initializing FactoryData!");
ChipLogError(DeviceLayer, "Check if you have flashed it correctly!");
}
SetCommissionableDataProvider(&mFactoryDataProvider);
SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider);
SetDeviceInstanceInfoProvider(&mFactoryDataProvider);

if (CONFIG_NETWORK_LAYER_BLE)
{
Expand Down
15 changes: 6 additions & 9 deletions examples/lighting-app/ameba/main/CHIPDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,14 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb)
SuccessOrExit(err);

err = mFactoryDataProvider.Init();
if (err == CHIP_NO_ERROR)
if (err != CHIP_NO_ERROR)
{
SetCommissionableDataProvider(&mFactoryDataProvider);
SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider);
SetDeviceInstanceInfoProvider(&mFactoryDataProvider);
}
else
{
ChipLogProgress(DeviceLayer, "Using example DAC provider");
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
ChipLogError(DeviceLayer, "Error initializing FactoryData!");
ChipLogError(DeviceLayer, "Check if you have flashed it correctly!");
}
SetCommissionableDataProvider(&mFactoryDataProvider);
SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider);
SetDeviceInstanceInfoProvider(&mFactoryDataProvider);

if (CONFIG_NETWORK_LAYER_BLE)
{
Expand Down
15 changes: 6 additions & 9 deletions examples/ota-requestor-app/ameba/main/CHIPDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,14 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb)
SuccessOrExit(err);

err = mFactoryDataProvider.Init();
if (err == CHIP_NO_ERROR)
if (err != CHIP_NO_ERROR)
{
SetCommissionableDataProvider(&mFactoryDataProvider);
SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider);
SetDeviceInstanceInfoProvider(&mFactoryDataProvider);
}
else
{
ChipLogProgress(DeviceLayer, "Using example DAC provider");
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
ChipLogError(DeviceLayer, "Error initializing FactoryData!");
ChipLogError(DeviceLayer, "Check if you have flashed it correctly!");
}
SetCommissionableDataProvider(&mFactoryDataProvider);
SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider);
SetDeviceInstanceInfoProvider(&mFactoryDataProvider);

if (CONFIG_NETWORK_LAYER_BLE)
{
Expand Down
Loading

0 comments on commit 1223234

Please sign in to comment.