From 30492171735bcd04806a36413419b264dc5b4fc7 Mon Sep 17 00:00:00 2001 From: Jean-Francois Penven <67962328+jepenven-silabs@users.noreply.github.com> Date: Mon, 17 Apr 2023 10:04:18 -0400 Subject: [PATCH] Move header to common place (#26105) --- examples/chef/efr32/src/main.cpp | 2 +- .../silabs/SiWx917/src/main.cpp | 2 +- .../silabs/efr32/src/main.cpp | 2 +- .../lighting-app/silabs/SiWx917/src/main.cpp | 2 +- .../lighting-app/silabs/efr32/src/main.cpp | 2 +- examples/lock-app/silabs/SiWx917/src/main.cpp | 2 +- examples/lock-app/silabs/efr32/src/main.cpp | 2 +- .../platform/silabs/SiWx917/matter_config.cpp | 8 ++--- .../platform/silabs/SiWx917/matter_config.h | 35 ------------------- .../platform/silabs/efr32/matter_config.cpp | 14 ++++---- .../silabs/{efr32 => }/matter_config.h | 2 +- examples/thermostat/silabs/efr32/src/main.cpp | 2 +- .../window-app/silabs/SiWx917/src/main.cpp | 2 +- examples/window-app/silabs/efr32/src/main.cpp | 2 +- 14 files changed, 22 insertions(+), 57 deletions(-) delete mode 100644 examples/platform/silabs/SiWx917/matter_config.h rename examples/platform/silabs/{efr32 => }/matter_config.h (98%) diff --git a/examples/chef/efr32/src/main.cpp b/examples/chef/efr32/src/main.cpp index 291337b24c8330..f1aa92f95935d8 100644 --- a/examples/chef/efr32/src/main.cpp +++ b/examples/chef/efr32/src/main.cpp @@ -50,7 +50,7 @@ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; int main(void) { init_efrPlatform(); - if (EFR32MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) + if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) appError(CHIP_ERROR_INTERNAL); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/light-switch-app/silabs/SiWx917/src/main.cpp b/examples/light-switch-app/silabs/SiWx917/src/main.cpp index 66f158cd48809e..bdafdfbf61cb08 100644 --- a/examples/light-switch-app/silabs/SiWx917/src/main.cpp +++ b/examples/light-switch-app/silabs/SiWx917/src/main.cpp @@ -51,7 +51,7 @@ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; int main(void) { init_ccpPlatform(); - if (SI917MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) + if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) { appError(CHIP_ERROR_INTERNAL); } diff --git a/examples/light-switch-app/silabs/efr32/src/main.cpp b/examples/light-switch-app/silabs/efr32/src/main.cpp index 97aff97aea535b..cd16d5f31b0ac2 100644 --- a/examples/light-switch-app/silabs/efr32/src/main.cpp +++ b/examples/light-switch-app/silabs/efr32/src/main.cpp @@ -50,7 +50,7 @@ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; int main(void) { init_efrPlatform(); - if (EFR32MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) + if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) appError(CHIP_ERROR_INTERNAL); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/lighting-app/silabs/SiWx917/src/main.cpp b/examples/lighting-app/silabs/SiWx917/src/main.cpp index f1103e3340310c..ce2ae970887a40 100644 --- a/examples/lighting-app/silabs/SiWx917/src/main.cpp +++ b/examples/lighting-app/silabs/SiWx917/src/main.cpp @@ -52,7 +52,7 @@ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; int main(void) { init_ccpPlatform(); - if (SI917MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) + if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) { appError(CHIP_ERROR_INTERNAL); } diff --git a/examples/lighting-app/silabs/efr32/src/main.cpp b/examples/lighting-app/silabs/efr32/src/main.cpp index 54fccb26ba8f35..73d81d7c2979c5 100644 --- a/examples/lighting-app/silabs/efr32/src/main.cpp +++ b/examples/lighting-app/silabs/efr32/src/main.cpp @@ -52,7 +52,7 @@ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; int main(void) { init_efrPlatform(); - if (EFR32MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) + if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) appError(CHIP_ERROR_INTERNAL); gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage()); diff --git a/examples/lock-app/silabs/SiWx917/src/main.cpp b/examples/lock-app/silabs/SiWx917/src/main.cpp index 44ef40f931b19a..d28689ff99cfb5 100644 --- a/examples/lock-app/silabs/SiWx917/src/main.cpp +++ b/examples/lock-app/silabs/SiWx917/src/main.cpp @@ -51,7 +51,7 @@ int main(void) { init_ccpPlatform(); - if (SI917MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) + if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) appError(CHIP_ERROR_INTERNAL); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/lock-app/silabs/efr32/src/main.cpp b/examples/lock-app/silabs/efr32/src/main.cpp index e9fc2130f29009..aef9ed112eb164 100644 --- a/examples/lock-app/silabs/efr32/src/main.cpp +++ b/examples/lock-app/silabs/efr32/src/main.cpp @@ -50,7 +50,7 @@ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; int main(void) { init_efrPlatform(); - if (EFR32MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) + if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) appError(CHIP_ERROR_INTERNAL); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/platform/silabs/SiWx917/matter_config.cpp b/examples/platform/silabs/SiWx917/matter_config.cpp index 93c8d3250f9f25..e49b743f01164c 100644 --- a/examples/platform/silabs/SiWx917/matter_config.cpp +++ b/examples/platform/silabs/SiWx917/matter_config.cpp @@ -57,7 +57,7 @@ using namespace ::chip::DeviceLayer; #include "SiWx917DeviceDataProvider.h" #if EFR32_OTA_ENABLED -void SI917MatterConfig::InitOTARequestorHandler(System::Layer * systemLayer, void * appState) +void SilabsMatterConfig::InitOTARequestorHandler(System::Layer * systemLayer, void * appState) { #if 0 // TODO : OTA is not planned now for CCP OTAConfig::Init(); @@ -65,7 +65,7 @@ void SI917MatterConfig::InitOTARequestorHandler(System::Layer * systemLayer, voi } #endif -void SI917MatterConfig::ConnectivityEventCallback(const ChipDeviceEvent * event, intptr_t arg){ +void SilabsMatterConfig::ConnectivityEventCallback(const ChipDeviceEvent * event, intptr_t arg){ // Initialize OTA only when Thread or WiFi connectivity is established /*if (((event->Type == DeviceEventType::kThreadConnectivityChange) && (event->ThreadConnectivityChange.Result == kConnectivity_Established)) || @@ -79,7 +79,7 @@ void SI917MatterConfig::ConnectivityEventCallback(const ChipDeviceEvent * event, SILABS_LOG("Scheduling OTA Requestor initialization") } -CHIP_ERROR SI917MatterConfig::InitMatter(const char * appName) +CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) { CHIP_ERROR err; @@ -159,7 +159,7 @@ CHIP_ERROR SI917MatterConfig::InitMatter(const char * appName) } #ifdef SL_WIFI -void SI917MatterConfig::InitWiFi(void) +void SilabsMatterConfig::InitWiFi(void) { #ifdef RS911X_WIFI /* diff --git a/examples/platform/silabs/SiWx917/matter_config.h b/examples/platform/silabs/SiWx917/matter_config.h deleted file mode 100644 index 6b3bb622a075a2..00000000000000 --- a/examples/platform/silabs/SiWx917/matter_config.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2022 Silabs. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include - -class SI917MatterConfig -{ -public: - static CHIP_ERROR InitMatter(const char * appName); - -private: - static CHIP_ERROR InitOpenThread(void); - static void InitWiFi(void); - static void ConnectivityEventCallback(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); - static void InitOTARequestorHandler(chip::System::Layer * systemLayer, void * appState); -}; diff --git a/examples/platform/silabs/efr32/matter_config.cpp b/examples/platform/silabs/efr32/matter_config.cpp index b530d5aa934f38..32cdad602c23e7 100644 --- a/examples/platform/silabs/efr32/matter_config.cpp +++ b/examples/platform/silabs/efr32/matter_config.cpp @@ -57,7 +57,7 @@ static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeys #include #ifdef CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS -ICDSubscriptionCallback EFR32MatterConfig::mICDSubscriptionHandler; +ICDSubscriptionCallback SilabsMatterConfig::mICDSubscriptionHandler; #endif // CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS #if CHIP_ENABLE_OPENTHREAD @@ -87,10 +87,10 @@ void UnlockOpenThreadTask(void) } // ================================================================================ -// EFR32MatterConfig Methods +// SilabsMatterConfig Methods // ================================================================================ -CHIP_ERROR EFR32MatterConfig::InitOpenThread(void) +CHIP_ERROR SilabsMatterConfig::InitOpenThread(void) { SILABS_LOG("Initializing OpenThread stack"); ReturnErrorOnFailure(ThreadStackMgr().InitThreadStack()); @@ -111,13 +111,13 @@ CHIP_ERROR EFR32MatterConfig::InitOpenThread(void) #endif // CHIP_ENABLE_OPENTHREAD #if EFR32_OTA_ENABLED -void EFR32MatterConfig::InitOTARequestorHandler(System::Layer * systemLayer, void * appState) +void SilabsMatterConfig::InitOTARequestorHandler(System::Layer * systemLayer, void * appState) { OTAConfig::Init(); } #endif -void EFR32MatterConfig::ConnectivityEventCallback(const ChipDeviceEvent * event, intptr_t arg) +void SilabsMatterConfig::ConnectivityEventCallback(const ChipDeviceEvent * event, intptr_t arg) { // Initialize OTA only when Thread or WiFi connectivity is established if (((event->Type == DeviceEventType::kThreadConnectivityChange) && @@ -133,7 +133,7 @@ void EFR32MatterConfig::ConnectivityEventCallback(const ChipDeviceEvent * event, } } -CHIP_ERROR EFR32MatterConfig::InitMatter(const char * appName) +CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) { CHIP_ERROR err; @@ -223,7 +223,7 @@ CHIP_ERROR EFR32MatterConfig::InitMatter(const char * appName) } #ifdef SL_WIFI -void EFR32MatterConfig::InitWiFi(void) +void SilabsMatterConfig::InitWiFi(void) { #ifdef WF200_WIFI // Start wfx bus communication task. diff --git a/examples/platform/silabs/efr32/matter_config.h b/examples/platform/silabs/matter_config.h similarity index 98% rename from examples/platform/silabs/efr32/matter_config.h rename to examples/platform/silabs/matter_config.h index e4acdb107bad1f..4983abac4189b1 100644 --- a/examples/platform/silabs/efr32/matter_config.h +++ b/examples/platform/silabs/matter_config.h @@ -26,7 +26,7 @@ #include "ICDSubscriptionCallback.h" #endif // CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS -class EFR32MatterConfig +class SilabsMatterConfig { public: static CHIP_ERROR InitMatter(const char * appName); diff --git a/examples/thermostat/silabs/efr32/src/main.cpp b/examples/thermostat/silabs/efr32/src/main.cpp index 5cfef676d77c8a..0af7a99a6a8dd9 100644 --- a/examples/thermostat/silabs/efr32/src/main.cpp +++ b/examples/thermostat/silabs/efr32/src/main.cpp @@ -50,7 +50,7 @@ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; int main(void) { init_efrPlatform(); - if (EFR32MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) + if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) appError(CHIP_ERROR_INTERNAL); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/window-app/silabs/SiWx917/src/main.cpp b/examples/window-app/silabs/SiWx917/src/main.cpp index 9545aae1e4acd5..22625fe778fad3 100644 --- a/examples/window-app/silabs/SiWx917/src/main.cpp +++ b/examples/window-app/silabs/SiWx917/src/main.cpp @@ -48,7 +48,7 @@ int main(void) CHIP_ERROR err = CHIP_NO_ERROR; init_ccpPlatform(); - if (SI917MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) + if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) appError(CHIP_ERROR_INTERNAL); gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage()); diff --git a/examples/window-app/silabs/efr32/src/main.cpp b/examples/window-app/silabs/efr32/src/main.cpp index 12c1af9c9ad710..6d5b54723f163d 100644 --- a/examples/window-app/silabs/efr32/src/main.cpp +++ b/examples/window-app/silabs/efr32/src/main.cpp @@ -50,7 +50,7 @@ int main(void) CHIP_ERROR err = CHIP_NO_ERROR; init_efrPlatform(); - if (EFR32MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) + if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) appError(CHIP_ERROR_INTERNAL); gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage());