Skip to content

Commit

Permalink
samples: matter: common: Cleaned up samples common directory
Browse files Browse the repository at this point in the history
This commit creates directories for commons in the samples.

Signed-off-by: Patryk Lipinski <patryk.lipinski@nordicsemi.no>
  • Loading branch information
LipinskiPNordicSemi authored and nordicjm committed Jan 5, 2024
1 parent 77018b8 commit 33cfc1c
Show file tree
Hide file tree
Showing 56 changed files with 167 additions and 166 deletions.
14 changes: 7 additions & 7 deletions applications/matter_bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ target_sources(app PRIVATE
${COMMON_ROOT}/src/bridge/binding_handler.cpp
src/zap-generated/IMClusterCommandHandler.cpp
src/zap-generated/callback-stub.cpp
${COMMON_ROOT}/src/led_widget.cpp
${COMMON_ROOT}/src/persistent_storage_util.cpp
${COMMON_ROOT}/src/task_executor.cpp
${COMMON_ROOT}/src/board.cpp
${COMMON_ROOT}/src/matter_init.cpp
${COMMON_ROOT}/src/led/led_widget.cpp
${COMMON_ROOT}/src/ps_storage/persistent_storage_util.cpp
${COMMON_ROOT}/src/tasks/task_executor.cpp
${COMMON_ROOT}/src/board/board.cpp
${COMMON_ROOT}/src/init/matter_init.cpp
)

if(CONFIG_BRIDGED_DEVICE_BT)
Expand Down Expand Up @@ -146,11 +146,11 @@ endif() # CONFIG_BRIDGE_HUMIDITY_SENSOR_BRIDGED_DEVICE
endif() # CONFIG_BRIDGED_DEVICE_BT

if(CONFIG_CHIP_OTA_REQUESTOR OR CONFIG_MCUMGR_TRANSPORT_BT)
target_sources(app PRIVATE ${COMMON_ROOT}/src/ota_util.cpp)
target_sources(app PRIVATE ${COMMON_ROOT}/src/dfu/ota/ota_util.cpp)
endif()

if(CONFIG_MCUMGR_TRANSPORT_BT)
target_sources(app PRIVATE ${COMMON_ROOT}/src/dfu_over_smp.cpp)
target_sources(app PRIVATE ${COMMON_ROOT}/src/dfu/smp/dfu_over_smp.cpp)
endif()

chip_configure_data_model(app
Expand Down
28 changes: 17 additions & 11 deletions applications/matter_bridge/src/app_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,33 @@

#include "app_task.h"

#include "bridge_manager.h"
#include "bridge_storage_manager.h"
#include "matter_init.h"
#include "task_executor.h"

#ifdef CONFIG_BRIDGED_DEVICE_BT
#include "ble_bridged_device_factory.h"
#include "ble_connectivity_manager.h"
#include <bluetooth/services/lbs.h>
#else
#include "simulated_bridged_device_factory.h"
#endif /* CONFIG_BRIDGED_DEVICE_BT */

#include "board/board.h"
#include "bridge/bridge_manager.h"
#include "bridge/bridge_storage_manager.h"
#include "init/matter_init.h"
#include "tasks/task_executor.h"

#ifdef CONFIG_BRIDGED_DEVICE_BT
#include "bridge/ble_connectivity_manager.h"
#endif

#ifdef CONFIG_CHIP_OTA_REQUESTOR
#include "dfu/ota/ota_util.h"
#endif /* CONFIG_BRIDGED_DEVICE_BT */

#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/server/OnboardingCodesUtil.h>

#ifdef CONFIG_CHIP_OTA_REQUESTOR
#include "ota_util.h"
#endif

#ifdef CONFIG_BRIDGED_DEVICE_BT
#include <bluetooth/services/lbs.h>
#endif /* CONFIG_BRIDGED_DEVICE_BT */
#include <zephyr/logging/log.h>

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);
Expand Down
3 changes: 0 additions & 3 deletions applications/matter_bridge/src/app_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@

#pragma once

#include "board.h"

#include <platform/CHIPDeviceLayer.h>

class AppTask {
public:

static AppTask &Instance()
{
static AppTask sAppTask;
Expand Down
12 changes: 6 additions & 6 deletions applications/matter_weather_station/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ target_sources(app PRIVATE
src/buzzer.cpp
src/zap-generated/IMClusterCommandHandler.cpp
src/zap-generated/callback-stub.cpp
${COMMON_ROOT}/src/led_widget.cpp
${COMMON_ROOT}/src/dfu_over_smp.cpp
${COMMON_ROOT}/src/task_executor.cpp
${COMMON_ROOT}/src/board.cpp
${COMMON_ROOT}/src/matter_init.cpp
${COMMON_ROOT}/src/led/led_widget.cpp
${COMMON_ROOT}/src/dfu/smp/dfu_over_smp.cpp
${COMMON_ROOT}/src/tasks/task_executor.cpp
${COMMON_ROOT}/src/board/board.cpp
${COMMON_ROOT}/src/init/matter_init.cpp
)

if(CONFIG_CHIP_OTA_REQUESTOR OR CONFIG_MCUMGR_TRANSPORT_BT)
target_sources(app PRIVATE ${COMMON_ROOT}/src/ota_util.cpp)
target_sources(app PRIVATE ${COMMON_ROOT}/src/dfu/ota/ota_util.cpp)
endif()

chip_configure_data_model(app
Expand Down
33 changes: 16 additions & 17 deletions applications/matter_weather_station/src/app_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,38 @@

#include "app_task.h"

#include "board.h"
#include "task_executor.h"

#include "battery.h"
#include "buzzer.h"
#include "led_widget.h"
#include "matter_init.h"

#include <DeviceInfoProviderImpl.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app/clusters/ota-requestor/OTATestEventTriggerDelegate.h>
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include "board/board.h"
#include "init/matter_init.h"
#include "led/led_widget.h"
#include "tasks/task_executor.h"

#ifdef CONFIG_CHIP_OTA_REQUESTOR
#include "ota_util.h"
#include "dfu/ota/ota_util.h"
#endif

#ifdef CONFIG_MCUMGR_TRANSPORT_BT
#include "dfu_over_smp.h"
#include "dfu/smp/dfu_over_smp.h"
#endif

#include <DeviceInfoProviderImpl.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app/clusters/ota-requestor/OTATestEventTriggerDelegate.h>
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>

#include <zephyr/drivers/sensor.h>
#include <zephyr/logging/log.h>

LOG_MODULE_DECLARE(app);

using namespace ::chip;
using namespace ::chip::DeviceLayer;
using namespace ::chip::app;

#include <zephyr/logging/log.h>

LOG_MODULE_DECLARE(app);

namespace
{
enum class FunctionTimerMode { kDisabled, kFactoryResetTrigger, kFactoryResetComplete };
Expand Down
2 changes: 1 addition & 1 deletion applications/matter_weather_station/src/app_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#pragma once

#include "led_widget.h"
#include "led/led_widget.h"

#include <app/clusters/identify-server/identify-server.h>
#include <platform/CHIPDeviceLayer.h>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
*/

#include "board.h"
#include "task_executor.h"
#include "tasks/task_executor.h"

#include <app/server/Server.h>
#include <platform/CHIPDeviceLayer.h>

#include <zephyr/logging/log.h>

#ifdef CONFIG_MCUMGR_TRANSPORT_BT
#include "dfu_over_smp.h"
#include "dfu/smp/dfu_over_smp.h"
#endif

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

#pragma once

#include "board_config.h"
#include "board_consts.h"
#include "led_util.h"
#include "led_widget.h"
#include "board/board_config.h"
#include "board/board_consts.h"
#include "led/led_util.h"
#include "led/led_widget.h"

enum class DeviceState : uint8_t { DeviceDisconnected, DeviceAdvertisingBLE, DeviceConnectedBLE, DeviceProvisioned };
enum class DeviceLeds : uint8_t { LED1, LED2, LED3, LED4 };
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion samples/matter/common/src/bridge/bridge_storage_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#pragma once

#include "matter_bridged_device.h"
#include "persistent_storage_util.h"
#include "ps_storage/persistent_storage_util.h"

#ifdef CONFIG_BRIDGED_DEVICE_BT
#include <zephyr/bluetooth/addr.h>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#error "DFUOverSMP requires MCUMGR module configs enabled"
#endif

#include "ota_util.h"
#include "dfu/ota/ota_util.h"

#include <platform/CHIPDeviceLayer.h>

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#include "fabric_table_delegate.h"

#ifdef CONFIG_CHIP_OTA_REQUESTOR
#include "ota_util.h"
#include "dfu/ota/ota_util.h"
#endif

#ifdef CONFIG_MCUMGR_TRANSPORT_BT
#include "dfu_over_smp.h"
#include "dfu/smp/dfu_over_smp.h"
#endif

#include <app/clusters/network-commissioning/network-commissioning.h>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions samples/matter/light_bulb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ target_sources(app PRIVATE
src/zcl_callbacks.cpp
src/zap-generated/IMClusterCommandHandler.cpp
src/zap-generated/callback-stub.cpp
${COMMON_ROOT}/src/led_widget.cpp
${COMMON_ROOT}/src/pwm_device.cpp
${COMMON_ROOT}/src/task_executor.cpp
${COMMON_ROOT}/src/board.cpp
${COMMON_ROOT}/src/matter_init.cpp
${COMMON_ROOT}/src/led/led_widget.cpp
${COMMON_ROOT}/src/pwm/pwm_device.cpp
${COMMON_ROOT}/src/tasks/task_executor.cpp
${COMMON_ROOT}/src/board/board.cpp
${COMMON_ROOT}/src/init/matter_init.cpp
)

if(CONFIG_CHIP_OTA_REQUESTOR OR CONFIG_MCUMGR_TRANSPORT_BT)
target_sources(app PRIVATE ${COMMON_ROOT}/src/ota_util.cpp)
target_sources(app PRIVATE ${COMMON_ROOT}/src/dfu/ota/ota_util.cpp)
endif()

if(CONFIG_MCUMGR_TRANSPORT_BT)
zephyr_library_link_libraries(MCUBOOT_BOOTUTIL)
target_sources(app PRIVATE ${COMMON_ROOT}/src/dfu_over_smp.cpp)
target_sources(app PRIVATE ${COMMON_ROOT}/src/dfu/smp/dfu_over_smp.cpp)
endif()

chip_configure_data_model(app
Expand Down
32 changes: 16 additions & 16 deletions samples/matter/light_bulb/src/app_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@

#include "app_task.h"

#include "matter_init.h"
#include "pwm_device.h"
#include "task_executor.h"
#ifdef CONFIG_AWS_IOT_INTEGRATION
#include "aws_iot_integration.h"
#endif

#include "init/matter_init.h"
#include "pwm/pwm_device.h"
#include "tasks/task_executor.h"

#ifdef CONFIG_CHIP_OTA_REQUESTOR
#include "dfu/ota/ota_util.h"
#endif

#include <app-common/zap-generated/attributes/Accessors.h>
#include <app/DeferredAttributePersistenceProvider.h>
#include <app/clusters/identify-server/identify-server.h>
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>

#ifdef CONFIG_CHIP_OTA_REQUESTOR
#include "ota_util.h"
#endif

#ifdef CONFIG_AWS_IOT_INTEGRATION
#include "aws_iot_integration.h"
#endif

#include <zephyr/logging/log.h>

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);
Expand Down Expand Up @@ -285,11 +285,11 @@ void AppTask::UpdateClusterState()
CHIP_ERROR AppTask::Init()
{
/* Initialize Matter stack */
ReturnErrorOnFailure(
Nordic::Matter::PrepareServer(MatterEventHandler, Nordic::Matter::InitData{ .mPostServerInitClbk = [] {
app::SetAttributePersistenceProvider(&gDeferredAttributePersister);
return CHIP_NO_ERROR;
} }));
ReturnErrorOnFailure(Nordic::Matter::PrepareServer(
MatterEventHandler, Nordic::Matter::InitData{ .mPostServerInitClbk = [] {
app::SetAttributePersistenceProvider(&gDeferredAttributePersister);
return CHIP_NO_ERROR;
} }));

if (!GetBoard().Init(ButtonEventHandler)) {
LOG_ERR("User interface initialization failed.");
Expand Down
4 changes: 2 additions & 2 deletions samples/matter/light_bulb/src/app_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#pragma once

#include "board.h"
#include "pwm_device.h"
#include "board/board.h"
#include "pwm/pwm_device.h"

#include <platform/CHIPDeviceLayer.h>

Expand Down
14 changes: 7 additions & 7 deletions samples/matter/light_switch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ target_sources(app PRIVATE
src/shell_commands.cpp
src/zap-generated/IMClusterCommandHandler.cpp
src/zap-generated/callback-stub.cpp
${COMMON_ROOT}/src/binding_handler.cpp
${COMMON_ROOT}/src/led_widget.cpp
${COMMON_ROOT}/src/task_executor.cpp
${COMMON_ROOT}/src/board.cpp
${COMMON_ROOT}/src/matter_init.cpp
${COMMON_ROOT}/src/binding/binding_handler.cpp
${COMMON_ROOT}/src/led/led_widget.cpp
${COMMON_ROOT}/src/board/board.cpp
${COMMON_ROOT}/src/tasks/task_executor.cpp
${COMMON_ROOT}/src/init/matter_init.cpp
)

if(CONFIG_CHIP_OTA_REQUESTOR OR CONFIG_MCUMGR_TRANSPORT_BT)
target_sources(app PRIVATE ${COMMON_ROOT}/src/ota_util.cpp)
target_sources(app PRIVATE ${COMMON_ROOT}/src/dfu/ota/ota_util.cpp)
endif()

if(CONFIG_MCUMGR_TRANSPORT_BT)
zephyr_library_link_libraries(MCUBOOT_BOOTUTIL)
target_sources(app PRIVATE ${COMMON_ROOT}/src/dfu_over_smp.cpp)
target_sources(app PRIVATE ${COMMON_ROOT}/src/dfu/smp/dfu_over_smp.cpp)
endif()

chip_configure_data_model(app
Expand Down
13 changes: 7 additions & 6 deletions samples/matter/light_switch/src/app_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
#include "app_task.h"

#include "light_switch.h"
#include "matter_init.h"
#include "task_executor.h"

#include "board.h"
#include <app/clusters/identify-server/identify-server.h>
#include <app/server/OnboardingCodesUtil.h>
#include "board/board.h"
#include "init/matter_init.h"
#include "tasks/task_executor.h"

#ifdef CONFIG_CHIP_OTA_REQUESTOR
#include "ota_util.h"
#include "dfu/ota/ota_util.h"
#endif

#include <app/clusters/identify-server/identify-server.h>
#include <app/server/OnboardingCodesUtil.h>

#include <zephyr/logging/log.h>

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);
Expand Down
2 changes: 1 addition & 1 deletion samples/matter/light_switch/src/app_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#pragma once

#include "board.h"
#include "board/board.h"

#include <platform/CHIPDeviceLayer.h>

Expand Down
Loading

0 comments on commit 33cfc1c

Please sign in to comment.