From 272fe501ff90e1bf147b30dee48ce7817ac256eb Mon Sep 17 00:00:00 2001 From: Alexander D'abreu Date: Fri, 26 Aug 2022 09:45:45 -0600 Subject: [PATCH 1/3] Add DevinfoInit to CC13xx all clusters --- examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn | 2 ++ examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp | 7 +++++++ examples/all-clusters-minimal-app/cc13x2x7_26x2x7/BUILD.gn | 2 ++ .../cc13x2x7_26x2x7/main/AppTask.cpp | 7 +++++++ 4 files changed, 18 insertions(+) diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn index 48f3ef5b7583f9..3194d47bb0f188 100644 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn @@ -78,6 +78,7 @@ ti_simplelink_executable("all-clusters-app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", + "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", "${project_dir}/main/AppTask.cpp", "${project_dir}/main/ClusterManager.cpp", "${project_dir}/main/Globals.cpp", @@ -102,6 +103,7 @@ ti_simplelink_executable("all-clusters-app") { "${project_dir}", "${project_dir}/main", "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/examples/providers/", ] cflags = [ diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp index b00e11a766a6da..09762791f4cf1a 100644 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR @@ -64,6 +65,7 @@ static QueueHandle_t sAppEventQueue; static Button_Handle sAppLeftHandle; static Button_Handle sAppRightHandle; +static DeviceInfoProviderImpl sExampleDeviceInfoProvider; AppTask AppTask::sAppTask; @@ -243,6 +245,11 @@ int AppTask::Init() PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + + // Initialize info provider + sExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); + SetDeviceInfoProvider(&sExampleDeviceInfoProvider); + chip::Server::GetInstance().Init(initParams); ConfigurationMgr().LogDeviceConfig(); diff --git a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/BUILD.gn b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/BUILD.gn index 9c870ec32fa84e..6c20ed346ec530 100644 --- a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/BUILD.gn @@ -78,6 +78,7 @@ ti_simplelink_executable("all-clusters-minimal-app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", + "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", "${project_dir}/main/AppTask.cpp", "${project_dir}/main/ClusterManager.cpp", "${project_dir}/main/Globals.cpp", @@ -102,6 +103,7 @@ ti_simplelink_executable("all-clusters-minimal-app") { "${project_dir}", "${project_dir}/main", "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/examples/providers/", ] cflags = [ diff --git a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/AppTask.cpp index b00e11a766a6da..09762791f4cf1a 100644 --- a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR @@ -64,6 +65,7 @@ static QueueHandle_t sAppEventQueue; static Button_Handle sAppLeftHandle; static Button_Handle sAppRightHandle; +static DeviceInfoProviderImpl sExampleDeviceInfoProvider; AppTask AppTask::sAppTask; @@ -243,6 +245,11 @@ int AppTask::Init() PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + + // Initialize info provider + sExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); + SetDeviceInfoProvider(&sExampleDeviceInfoProvider); + chip::Server::GetInstance().Init(initParams); ConfigurationMgr().LogDeviceConfig(); From 8c6e2225e03ecdbc5e5d067fd3fb0e1ebce7e1a4 Mon Sep 17 00:00:00 2001 From: Alexander D'abreu Date: Fri, 26 Aug 2022 13:56:38 -0600 Subject: [PATCH 2/3] Add Devinfo init to lock-app --- examples/lock-app/cc13x2x7_26x2x7/BUILD.gn | 2 ++ examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn b/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn index 57792e12f69e0c..f885f8dc87fa5c 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn @@ -78,6 +78,7 @@ ti_simplelink_executable("lock_app") { "${project_dir}/main/BoltLockManager.cpp", "${project_dir}/main/ZclCallbacks.cpp", "${project_dir}/main/main.cpp", + "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", ] deps = [ @@ -96,6 +97,7 @@ ti_simplelink_executable("lock_app") { include_dirs = [ "${project_dir}", "${project_dir}/main", + "${chip_root}/examples/providers/", ] cflags = [ diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp index a0d30130644e43..4854eb4c5af0d8 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR @@ -63,6 +64,7 @@ static LED_Handle sAppRedHandle; static LED_Handle sAppGreenHandle; static Button_Handle sAppLeftHandle; static Button_Handle sAppRightHandle; +static DeviceInfoProviderImpl sExampleDeviceInfoProvider; AppTask AppTask::sAppTask; @@ -166,6 +168,11 @@ int AppTask::Init() PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + + // Initialize info provider + sExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); + SetDeviceInfoProvider(&sExampleDeviceInfoProvider); + chip::Server::GetInstance().Init(initParams); // Initialize device attestation config From 2b4fa00bf26df7a72145ac26681bc27df7d8fed0 Mon Sep 17 00:00:00 2001 From: Alexander D'abreu Date: Fri, 26 Aug 2022 19:21:13 -0600 Subject: [PATCH 3/3] Update style --- examples/lock-app/cc13x2x7_26x2x7/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn b/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn index f885f8dc87fa5c..ba2b327339e516 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn @@ -74,11 +74,11 @@ ti_simplelink_executable("lock_app") { output_name = "chip-${ti_simplelink_board}-lock-example.out" sources = [ + "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", "${project_dir}/main/AppTask.cpp", "${project_dir}/main/BoltLockManager.cpp", "${project_dir}/main/ZclCallbacks.cpp", "${project_dir}/main/main.cpp", - "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", ] deps = [