From 4a7b5034f9b747dbd6f8e6fad086042ec0cdc45f Mon Sep 17 00:00:00 2001 From: Rohit Date: Fri, 1 Aug 2025 15:15:41 +0530 Subject: [PATCH] all-device-type-app: Add mock delegates. Generate mocks. Set app delegates --- .../main/esp_matter_console_helpers.cpp | 91 +++++-- .../mock_account_login_delegate.cpp | 3 + .../mock_account_login_delegate.h | 8 +- .../mock_delegates/mock_actions_delegate.cpp | 131 ++++++++++ .../mock_delegates/mock_actions_delegate.h | 65 +++++ .../mock_application_basic_delegate.cpp | 70 ++++++ .../mock_application_basic_delegate.h | 51 ++++ .../mock_application_launcher_delegate.cpp | 56 +++++ .../mock_application_launcher_delegate.h | 48 ++++ .../mock_audio_output_delegate.cpp | 49 ++++ .../mock_audio_output_delegate.h | 46 ++++ ...k_boolean_state_configuration_delegate.cpp | 35 +++ ...ock_boolean_state_configuration_delegate.h | 43 ++++ ...ettings_user_level_management_delegate.cpp | 143 +++++++++++ ..._settings_user_level_management_delegate.h | 76 ++++++ ...k_camera_av_stream_management_delegate.cpp | 146 +++++++++++ ...ock_camera_av_stream_management_delegate.h | 81 ++++++ .../mock_delegates/mock_channel_delegate.cpp | 112 +++++++++ .../mock_delegates/mock_channel_delegate.h | 68 +++++ .../mock_closure_control_delegate.cpp | 68 +++++ .../mock_closure_control_delegate.h | 54 ++++ .../mock_closure_dimension_delegate.cpp | 39 +++ .../mock_closure_dimension_delegate.h | 48 ++++ .../mock_commissioner_control_delegate.cpp | 49 ++++ .../mock_commissioner_control_delegate.h | 46 ++++ .../mock_commodity_price_delegate.cpp | 25 ++ .../mock_commodity_price_delegate.h | 39 +++ .../mock_commodity_tariff_delegate.h | 41 +++ .../mock_content_app_observer_delegate.cpp | 32 +++ .../mock_content_app_observer_delegate.h | 42 ++++ .../mock_content_control_delegate.cpp | 155 ++++++++++++ .../mock_content_control_delegate.h | 58 +++++ .../mock_content_launcher_delegate.cpp | 71 ++++++ .../mock_content_launcher_delegate.h | 52 ++++ ...mock_device_energy_management_delegate.cpp | 137 ++++++++++ .../mock_device_energy_management_delegate.h | 79 ++++++ .../mock_dishwasher_alarm_delegate.cpp | 35 +++ .../mock_dishwasher_alarm_delegate.h | 44 ++++ .../mock_door_lock_delegate.cpp | 102 ++++++++ .../mock_delegates/mock_door_lock_delegate.h | 52 ++++ ...ck_electrical_grid_conditions_delegate.cpp | 24 ++ ...mock_electrical_grid_conditions_delegate.h | 43 ++++ ..._electrical_power_measurement_delegate.cpp | 210 ++++++++++++++++ ...ck_electrical_power_measurement_delegate.h | 73 ++++++ .../mock_energy_evse_delegate.cpp | 217 ++++++++++++++++ .../mock_energy_evse_delegate.h | 98 ++++++++ .../mock_fan_control_delegate.cpp | 28 +++ .../mock_fan_control_delegate.h | 44 ++++ .../mock_keypad_input_delegate.cpp | 37 +++ .../mock_keypad_input_delegate.h | 44 ++++ .../mock_laundry_dryer_controls_delegate.cpp | 28 +++ .../mock_laundry_dryer_controls_delegate.h | 43 ++++ .../mock_laundry_washer_controls_delegate.cpp | 35 +++ .../mock_laundry_washer_controls_delegate.h | 44 ++++ .../mock_low_power_delegate.cpp | 28 +++ .../mock_delegates/mock_low_power_delegate.h | 41 +++ .../mock_media_input_delegate.cpp | 63 +++++ .../mock_media_input_delegate.h | 46 ++++ .../mock_media_playback_delegate.cpp | 237 ++++++++++++++++++ .../mock_media_playback_delegate.h | 74 ++++++ .../mock_delegates/mock_messages_delegate.cpp | 61 +++++ .../mock_delegates/mock_messages_delegate.h | 52 ++++ .../mock_microwave_oven_control_delegate.cpp | 94 +++++++ .../mock_microwave_oven_control_delegate.h | 57 +++++ .../mock_mode_base_delegate.cpp | 57 +++++ .../mock_delegates/mock_mode_base_delegate.h | 82 ++++++ .../mock_operational_state_delegate.cpp | 74 ++++++ .../mock_operational_state_delegate.h | 52 ++++ .../mock_power_topology_delegate.cpp | 35 +++ .../mock_power_topology_delegate.h | 43 ++++ ...mock_push_av_stream_transport_delegate.cpp | 179 +++++++++++++ .../mock_push_av_stream_transport_delegate.h | 91 +++++++ .../mock_resource_monitoring_delegate.cpp | 49 ++++ .../mock_resource_monitoring_delegate.h | 46 ++++ .../mock_service_area_delegate.cpp | 51 ++++ .../mock_service_area_delegate.h | 47 ++++ .../mock_target_navigator_delegate.cpp | 52 ++++ .../mock_target_navigator_delegate.h | 47 ++++ .../mock_thermostat_delegate.cpp | 165 ++++++++++++ .../mock_delegates/mock_thermostat_delegate.h | 64 +++++ ...read_border_router_management_delegate.cpp | 100 ++++++++ ...thread_border_router_management_delegate.h | 53 ++++ .../mock_time_synchronization_delegate.cpp | 85 +++++++ .../mock_time_synchronization_delegate.h | 52 ++++ ...ck_tls_certificate_management_delegate.cpp | 133 ++++++++++ ...mock_tls_certificate_management_delegate.h | 74 ++++++ .../mock_tls_client_management_delegate.cpp | 81 ++++++ .../mock_tls_client_management_delegate.h | 54 ++++ ...lve_configuration_and_control_delegate.cpp | 42 ++++ ...valve_configuration_and_control_delegate.h | 45 ++++ .../mock_wake_on_lan_delegate.cpp | 28 +++ .../mock_wake_on_lan_delegate.h | 41 +++ .../mock_water_heater_management_delegate.cpp | 79 ++++++ .../mock_water_heater_management_delegate.h | 55 ++++ ...ock_webrtc_transport_provider_delegate.cpp | 69 +++++ .../mock_webrtc_transport_provider_delegate.h | 58 +++++ ...ck_webrtc_transport_requestor_delegate.cpp | 50 ++++ ...mock_webrtc_transport_requestor_delegate.h | 46 ++++ .../mock_window_covering_delegate.cpp | 35 +++ .../mock_window_covering_delegate.h | 42 ++++ .../mock_zone_management_delegate.cpp | 95 +++++++ .../mock_zone_management_delegate.h | 56 +++++ 102 files changed, 6799 insertions(+), 19 deletions(-) create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_actions_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_actions_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_application_basic_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_application_basic_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_application_launcher_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_application_launcher_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_audio_output_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_audio_output_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_boolean_state_configuration_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_boolean_state_configuration_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_camera_av_settings_user_level_management_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_camera_av_settings_user_level_management_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_camera_av_stream_management_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_camera_av_stream_management_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_channel_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_channel_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_closure_control_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_closure_control_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_closure_dimension_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_closure_dimension_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_commissioner_control_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_commissioner_control_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_commodity_price_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_commodity_price_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_commodity_tariff_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_content_app_observer_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_content_app_observer_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_content_control_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_content_control_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_content_launcher_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_content_launcher_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_device_energy_management_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_device_energy_management_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_dishwasher_alarm_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_dishwasher_alarm_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_door_lock_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_door_lock_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_electrical_grid_conditions_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_electrical_grid_conditions_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_electrical_power_measurement_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_electrical_power_measurement_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_energy_evse_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_energy_evse_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_fan_control_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_fan_control_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_keypad_input_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_keypad_input_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_laundry_dryer_controls_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_laundry_dryer_controls_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_laundry_washer_controls_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_laundry_washer_controls_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_low_power_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_low_power_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_media_input_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_media_input_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_media_playback_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_media_playback_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_messages_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_messages_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_microwave_oven_control_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_microwave_oven_control_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_mode_base_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_mode_base_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_operational_state_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_operational_state_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_power_topology_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_power_topology_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_push_av_stream_transport_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_push_av_stream_transport_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_resource_monitoring_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_resource_monitoring_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_service_area_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_service_area_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_target_navigator_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_target_navigator_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_thermostat_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_thermostat_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_thread_border_router_management_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_thread_border_router_management_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_time_synchronization_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_time_synchronization_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_tls_certificate_management_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_tls_certificate_management_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_tls_client_management_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_tls_client_management_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_valve_configuration_and_control_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_valve_configuration_and_control_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_wake_on_lan_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_wake_on_lan_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_water_heater_management_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_water_heater_management_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_provider_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_provider_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_requestor_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_requestor_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_window_covering_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_window_covering_delegate.h create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_zone_management_delegate.cpp create mode 100644 examples/all_device_types_app/main/mock_delegates/mock_zone_management_delegate.h diff --git a/examples/all_device_types_app/main/esp_matter_console_helpers.cpp b/examples/all_device_types_app/main/esp_matter_console_helpers.cpp index 3eb98b30b..f58888014 100644 --- a/examples/all_device_types_app/main/esp_matter_console_helpers.cpp +++ b/examples/all_device_types_app/main/esp_matter_console_helpers.cpp @@ -36,6 +36,22 @@ #include #include "electrical_measurement/electrical_measurement.h" #include "mock_delegates/mock_chime_delegate.h" +#include "mock_delegates/mock_thermostat_delegate.h" +#include "mock_delegates/mock_door_lock_delegate.h" +#include "mock_delegates/mock_window_covering_delegate.h" +#include "mock_delegates/mock_valve_configuration_and_control_delegate.h" +#include "mock_delegates/mock_water_heater_management_delegate.h" +#include "mock_delegates/mock_microwave_oven_control_delegate.h" +#include "mock_delegates/mock_operational_state_delegate.h" +#include "mock_delegates/mock_energy_evse_delegate.h" +#include "mock_delegates/mock_electrical_power_measurement_delegate.h" +#include "mock_delegates/mock_mode_base_delegate.h" +#include "mock_delegates/mock_fan_control_delegate.h" +#include "mock_delegates/mock_closure_control_delegate.h" +#include "mock_delegates/mock_closure_dimension_delegate.h" +#include "mock_delegates/mock_device_energy_management_delegate.h" +#include "mock_delegates/mock_commodity_price_delegate.h" +#include "mock_delegates/mock_commodity_tariff_delegate.h" // External variables for electrical sensor initialization bool g_electrical_sensor_created = false; @@ -174,9 +190,6 @@ static void initialize_console(void) namespace esp_matter { -static chip::app::Clusters::PowerTopology::PowerTopologyDelegate powerTopologyDelegate; -static chip::app::Clusters::Chime::MockChimeDelegate chimeDelegate; - namespace data_model { int create(uint8_t device_type_index) @@ -270,6 +283,8 @@ int create(uint8_t device_type_index) } case ESP_MATTER_THERMOSTAT: { esp_matter::endpoint::thermostat::config_t thermostat_config; + static chip::app::Clusters::Thermostat::MockThermostatDelegate thermostatDelegate; + thermostat_config.thermostat.delegate = &thermostatDelegate; thermostat_config.thermostat.feature_flags = cluster::thermostat::feature::auto_mode::get_id(); endpoint = esp_matter::endpoint::thermostat::create(node, &thermostat_config, ENDPOINT_FLAG_NONE, NULL); break; @@ -291,17 +306,15 @@ int create(uint8_t device_type_index) } case ESP_MATTER_DOOR_LOCK: { esp_matter::endpoint::door_lock::config_t door_lock_config; + static chip::app::Clusters::DoorLock::MockDoorLockDelegate doorLockDelegate; + door_lock_config.door_lock.delegate = &doorLockDelegate; endpoint = esp_matter::endpoint::door_lock::create(node, &door_lock_config, ENDPOINT_FLAG_NONE, NULL); - cluster_t *door_lock_cluster = cluster::get(endpoint, chip::app::Clusters::DoorLock::Id); - VerifyOrReturnError(door_lock_cluster, ESP_ERR_INVALID_STATE, ESP_LOGE(TAG, "Failed to get door lock cluster")); - cluster::door_lock::feature::pin_credential::config_t pin_credential_config; - cluster::door_lock::feature::user::config_t user_config; - cluster::door_lock::feature::pin_credential::add(door_lock_cluster, &pin_credential_config); - cluster::door_lock::feature::user::add(door_lock_cluster, &user_config); break; } case ESP_MATTER_WINDOW_COVERING_DEVICE: { esp_matter::endpoint::window_covering::config_t window_covering_config; + static chip::app::Clusters::WindowCovering::MockWindowCoveringDelegate windowCoveringDelegate; + window_covering_config.window_covering.delegate = &windowCoveringDelegate; window_covering_config.window_covering.feature_flags = cluster::window_covering::feature::lift::get_id(); endpoint = esp_matter::endpoint::window_covering::create(node, &window_covering_config, ENDPOINT_FLAG_NONE, NULL); cluster_t *cluster = cluster::get(endpoint, chip::app::Clusters::WindowCovering::Id); @@ -358,11 +371,15 @@ int create(uint8_t device_type_index) } case ESP_MATTER_MODE_SELECT_DEVICE: { esp_matter::endpoint::mode_select::config_t mode_select_config; + static chip::app::Clusters::ModeBase::MockModeBaseDelegate modeSelectDelegate; + mode_select_config.mode_select.delegate = &modeSelectDelegate; endpoint = esp_matter::endpoint::mode_select::create(node, &mode_select_config, ENDPOINT_FLAG_NONE, NULL); break; } case ESP_MATTER_RAC: { esp_matter::endpoint::room_air_conditioner::config_t room_air_conditioner_config; + static chip::app::Clusters::Thermostat::MockThermostatDelegate racThermostatDelegate; + room_air_conditioner_config.thermostat.delegate = &racThermostatDelegate; room_air_conditioner_config.thermostat.feature_flags = cluster::thermostat::feature::cooling::get_id(); endpoint = esp_matter::endpoint::room_air_conditioner::create(node, &room_air_conditioner_config, ENDPOINT_FLAG_NONE, NULL); break; @@ -404,6 +421,8 @@ int create(uint8_t device_type_index) } case ESP_MATTER_AIR_PURIFIER: { esp_matter::endpoint::air_purifier::config_t air_purifier_config; + static chip::app::Clusters::FanControl::MockFanControlDelegate airPurifierFanDelegate; + air_purifier_config.fan_control.delegate = &airPurifierFanDelegate; endpoint = esp_matter::endpoint::air_purifier::create(node, &air_purifier_config, ENDPOINT_FLAG_NONE, NULL); break; } @@ -414,16 +433,22 @@ int create(uint8_t device_type_index) } case ESP_MATTER_ROBOTIC_VACUUM_CLEANER: { esp_matter::endpoint::robotic_vacuum_cleaner::config_t robotic_vacuum_cleaner_config; + static chip::app::Clusters::ModeBase::MockModeBaseDelegate rvcRunModeDelegate; + robotic_vacuum_cleaner_config.rvc_run_mode.delegate = &rvcRunModeDelegate; endpoint = esp_matter::endpoint::robotic_vacuum_cleaner::create(node, &robotic_vacuum_cleaner_config, ENDPOINT_FLAG_NONE, NULL); break; } case ESP_MATTER_LAUNDRY_WASHER: { esp_matter::endpoint::laundry_washer::config_t laundry_washer_config; + static chip::app::Clusters::OperationalState::MockOperationalStateDelegate laundryWasherOpStateDelegate; + laundry_washer_config.operational_state.delegate = &laundryWasherOpStateDelegate; endpoint = esp_matter::endpoint::laundry_washer::create(node, &laundry_washer_config, ENDPOINT_FLAG_NONE, NULL); break; } case ESP_MATTER_DISH_WASHER: { esp_matter::endpoint::dish_washer::config_t dish_washer_config; + static chip::app::Clusters::OperationalState::MockOperationalStateDelegate dishWasherOpStateDelegate; + dish_washer_config.operational_state.delegate = &dishWasherOpStateDelegate; endpoint = esp_matter::endpoint::dish_washer::create(node, &dish_washer_config, ENDPOINT_FLAG_NONE, NULL); break; } @@ -465,11 +490,14 @@ int create(uint8_t device_type_index) } case ESP_MATTER_ELECTRICAL_SENSOR: { esp_matter::endpoint::electrical_sensor::config_t electrical_sensor_config; + static chip::app::Clusters::PowerTopology::PowerTopologyDelegate powerTopologyDelegate; + static chip::app::Clusters::ElectricalPowerMeasurement::MockElectricalPowerMeasurementDelegate electricalPowerMeasurementDelegate; electrical_sensor_config.power_topology.feature_flags = esp_matter::cluster::power_topology::feature::set_topology::get_id(); electrical_sensor_config.power_topology.delegate = &powerTopologyDelegate; electrical_sensor_config.electrical_power_measurement.feature_flags = esp_matter::cluster::electrical_power_measurement::feature::direct_current::get_id() | esp_matter::cluster::electrical_power_measurement::feature::alternating_current::get_id(); + electrical_sensor_config.electrical_power_measurement.delegate = &electricalPowerMeasurementDelegate; endpoint = esp_matter::endpoint::electrical_sensor::create(node, &electrical_sensor_config, ENDPOINT_FLAG_NONE, NULL); if (endpoint) { @@ -505,9 +533,13 @@ int create(uint8_t device_type_index) } case ESP_MATTER_ENERGY_EVSE: { esp_matter::endpoint::energy_evse::config_t energy_evse_config; + static chip::app::Clusters::EnergyEvse::MockEnergyEVSEDelegate energyEvseDelegate; + static chip::app::Clusters::ModeBase::MockModeBaseDelegate evseModeDelegate; + static chip::app::Clusters::DeviceEnergyManagement::MockDeviceEnergyManagementDelegate evseDemDelegate; + energy_evse_config.energy_evse.delegate = &energyEvseDelegate; + energy_evse_config.energy_evse_mode.delegate = &evseModeDelegate; + energy_evse_config.device_energy_management.delegate = &evseDemDelegate; endpoint = esp_matter::endpoint::energy_evse::create(node, &energy_evse_config, ENDPOINT_FLAG_NONE, NULL); - cluster_t *energy_evse_cluster = cluster::get(endpoint, chip::app::Clusters::EnergyEvse::Id); - cluster::energy_evse::feature::charging_preferences::add(energy_evse_cluster); esp_matter::endpoint::power_source::config_t power_source_config; esp_matter::endpoint_t *ps_endpoint = esp_matter::endpoint::power_source::create(node, &power_source_config, ENDPOINT_FLAG_NONE, NULL); @@ -522,28 +554,42 @@ int create(uint8_t device_type_index) } case ESP_MATTER_MICROWAVE_OVEN: { esp_matter::endpoint::microwave_oven::config_t microwave_oven_config; - microwave_oven_config.microwave_oven_control.feature_flags = esp_matter::cluster::microwave_oven_control::feature::power_as_number::get_id(); + static chip::app::Clusters::MicrowaveOvenControl::MockMicrowaveOvenControlDelegate microwaveOvenControlDelegate; + static chip::app::Clusters::OperationalState::MockOperationalStateDelegate operationalStateDelegate; + static chip::app::Clusters::ModeBase::MockModeBaseDelegate microwaveOvenModeDelegate; + microwave_oven_config.microwave_oven_control.delegate = µwaveOvenControlDelegate; + microwave_oven_config.operational_state.delegate = &operationalStateDelegate; + microwave_oven_config.microwave_oven_mode.delegate = µwaveOvenModeDelegate; endpoint = esp_matter::endpoint::microwave_oven::create(node, µwave_oven_config, ENDPOINT_FLAG_NONE, NULL); break; } case ESP_MATTER_EXTRACTOR_HOOD: { esp_matter::endpoint::extractor_hood::config_t extractor_hood_config; + static chip::app::Clusters::FanControl::MockFanControlDelegate extractorHoodFanDelegate; + extractor_hood_config.fan_control.delegate = &extractorHoodFanDelegate; endpoint = esp_matter::endpoint::extractor_hood::create(node, &extractor_hood_config, ENDPOINT_FLAG_NONE, NULL); break; } case ESP_MATTER_LAUNDRY_DRYER: { esp_matter::endpoint::laundry_dryer::config_t laundry_dryer_config; + static chip::app::Clusters::OperationalState::MockOperationalStateDelegate laundryDryerOpStateDelegate; + laundry_dryer_config.operational_state.delegate = &laundryDryerOpStateDelegate; endpoint = esp_matter::endpoint::laundry_dryer::create(node, &laundry_dryer_config, ENDPOINT_FLAG_NONE, NULL); break; } case ESP_MATTER_WATER_VALVE: { esp_matter::endpoint::water_valve::config_t water_valve_config; + static chip::app::Clusters::ValveConfigurationAndControl::MockValveConfigurationAndControlDelegate valveDelegate; + water_valve_config.valve_configuration_and_control.delegate = &valveDelegate; endpoint = esp_matter::endpoint::water_valve::create(node, &water_valve_config, ENDPOINT_FLAG_NONE, NULL); break; } case ESP_MATTER_DEVICE_ENERGY_MANAGEMENT: { esp_matter::endpoint::device_energy_management::config_t device_energy_management_config; - device_energy_management_config.device_energy_management.feature_flags = esp_matter::cluster::device_energy_management::feature::power_forecast_reporting::get_id(); + static chip::app::Clusters::ModeBase::MockModeBaseDelegate demModeDelegate; + static chip::app::Clusters::DeviceEnergyManagement::MockDeviceEnergyManagementDelegate demDelegate; + device_energy_management_config.device_energy_management_mode.delegate = &demModeDelegate; + device_energy_management_config.device_energy_management.delegate = &demDelegate; endpoint = esp_matter::endpoint::device_energy_management::create(node, &device_energy_management_config, ENDPOINT_FLAG_NONE, NULL); break; } @@ -582,7 +628,13 @@ int create(uint8_t device_type_index) } case ESP_MATTER_WATER_HEATER: { esp_matter::endpoint::water_heater::config_t water_heater_config; + static chip::app::Clusters::WaterHeaterManagement::MockWaterHeaterManagementDelegate waterHeaterManagementDelegate; + static chip::app::Clusters::Thermostat::MockThermostatDelegate waterHeaterThermostatDelegate; + static chip::app::Clusters::ModeBase::MockModeBaseDelegate waterHeaterModeDelegate; water_heater_config.thermostat.feature_flags = cluster::thermostat::feature::heating::get_id(); + water_heater_config.thermostat.delegate = &waterHeaterThermostatDelegate; + water_heater_config.water_heater_management.delegate = &waterHeaterManagementDelegate; + water_heater_config.water_heater_mode.delegate = &waterHeaterModeDelegate; endpoint = esp_matter::endpoint::water_heater::create(node, &water_heater_config, ENDPOINT_FLAG_NONE, NULL); break; } @@ -603,6 +655,7 @@ int create(uint8_t device_type_index) } case ESP_MATTER_CHIME: { esp_matter::endpoint::chime::config_t chime_config; + static chip::app::Clusters::Chime::MockChimeDelegate chimeDelegate; chime_config.chime.delegate = &chimeDelegate; endpoint = esp_matter::endpoint::chime::create(node, &chime_config, ENDPOINT_FLAG_NONE, NULL); break; @@ -619,13 +672,17 @@ int create(uint8_t device_type_index) } case ESP_MATTER_CLOSURE: { esp_matter::endpoint::closure::config_t closure_config; + static chip::app::Clusters::ClosureControl::MockClosureControlDelegate closureControlDelegate; + closure_config.closure_control.delegate = &closureControlDelegate; closure_config.closure_control.feature_flags = cluster::closure_control::feature::positioning::get_id(); endpoint = esp_matter::endpoint::closure::create(node, &closure_config, ENDPOINT_FLAG_NONE, NULL); break; } case ESP_MATTER_CLOSURE_PANEL: { esp_matter::endpoint::closure_panel::config_t closure_panel_config; - closure_panel_config.closure_dimension.feature_flags = cluster::closure_dimension::feature::positioning::get_id() | cluster::closure_dimension::feature::rotation::get_id(); + static chip::app::Clusters::ClosureDimension::MockClosureDimensionDelegate closureDimensionDelegate; + closure_panel_config.closure_dimension.delegate = &closureDimensionDelegate; + closure_panel_config.closure_dimension.feature_flags = cluster::closure_dimension::feature::positioning::get_id(); endpoint = esp_matter::endpoint::closure_panel::create(node, &closure_panel_config, ENDPOINT_FLAG_NONE, NULL); break; } @@ -633,10 +690,14 @@ int create(uint8_t device_type_index) esp_matter::endpoint::electrical_energy_tariff::config_t electrical_energy_tariff_config; endpoint = esp_matter::endpoint::electrical_energy_tariff::create(node, &electrical_energy_tariff_config, ENDPOINT_FLAG_NONE, NULL); + static chip::app::Clusters::CommodityPrice::MockCommodityPriceDelegate commodityPriceDelegate; cluster::commodity_price::config_t commodity_price_config; + commodity_price_config.delegate = &commodityPriceDelegate; cluster::commodity_price::create(endpoint, &commodity_price_config, CLUSTER_FLAG_SERVER); + static chip::app::Clusters::CommodityTariff::MockCommodityTariffDelegate commodityTariffDelegate; cluster::commodity_tariff::config_t commodity_tariff_config; + commodity_tariff_config.delegate = &commodityTariffDelegate; commodity_tariff_config.feature_flags = cluster::commodity_tariff::feature::pricing::get_id(); cluster::commodity_tariff::create(endpoint, &commodity_tariff_config, CLUSTER_FLAG_SERVER); @@ -644,7 +705,9 @@ int create(uint8_t device_type_index) } case ESP_MATTER_ELECTRICAL_METER: { esp_matter::endpoint::electrical_meter::config_t electrical_meter_config; + static chip::app::Clusters::ElectricalPowerMeasurement::MockElectricalPowerMeasurementDelegate electricalMeterPowerDelegate; electrical_meter_config.electrical_power_measurement.feature_flags = cluster::electrical_power_measurement::feature::direct_current::get_id(); + electrical_meter_config.electrical_power_measurement.delegate = &electricalMeterPowerDelegate; electrical_meter_config.electrical_energy_measurement.feature_flags = cluster::electrical_energy_measurement::feature::imported_energy::get_id() | cluster::electrical_energy_measurement::feature::exported_energy::get_id() | cluster::electrical_energy_measurement::feature::cumulative_energy::get_id() | diff --git a/examples/all_device_types_app/main/mock_delegates/mock_account_login_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_account_login_delegate.cpp index a3df16c38..57b6febfa 100644 --- a/examples/all_device_types_app/main/mock_delegates/mock_account_login_delegate.cpp +++ b/examples/all_device_types_app/main/mock_delegates/mock_account_login_delegate.cpp @@ -19,6 +19,7 @@ void MockAccountLoginDelegate::SetSetupPin(char * setupPin) { // Implement your own logic here. ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; } bool MockAccountLoginDelegate::HandleLogin(const chip::CharSpan &tempAccountIdentifierString, const chip::CharSpan &setupPinString, @@ -41,12 +42,14 @@ void MockAccountLoginDelegate::HandleGetSetupPin(CommandResponseHelper - #include /* @@ -17,9 +15,9 @@ * This file provides a mock implementation of the AccountLogin::Delegate interface * that returns success for all methods. * For more details, take a look at the delegate interface in the Matter SDK. - * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/master/src/app/clusters/account-login-server/account-login-delegate.h - * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/master/examples/tv-app/android/include/account-login/AccountLoginManager.h and - * https://github.com/project-chip/connectedhomeip/blob/master/examples/tv-app/android/include/account-login/AccountLoginManager.cpp + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/account-login-server/account-login-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/android/include/account-login/AccountLoginManager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/android/include/account-login/AccountLoginManager.cpp */ namespace chip { diff --git a/examples/all_device_types_app/main/mock_delegates/mock_actions_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_actions_delegate.cpp new file mode 100644 index 000000000..e064a71e2 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_actions_delegate.cpp @@ -0,0 +1,131 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_actions_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace Actions { + +CHIP_ERROR MockActionsDelegate::ReadActionAtIndex(uint16_t index, ActionStructStorage &action) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR MockActionsDelegate::ReadEndpointListAtIndex(uint16_t index, EndpointListStorage &epList) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +bool MockActionsDelegate::HaveActionWithId(uint16_t aActionId, uint16_t &aActionIndex) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return false; +} + +Protocols::InteractionModel::Status MockActionsDelegate::HandleInstantAction(uint16_t actionId, Optional invokeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockActionsDelegate::HandleInstantActionWithTransition(uint16_t actionId, uint16_t transitionTime, + Optional invokeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockActionsDelegate::HandleStartAction(uint16_t actionId, Optional invokeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockActionsDelegate::HandleStartActionWithDuration(uint16_t actionId, uint32_t duration, + Optional invokeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockActionsDelegate::HandleStopAction(uint16_t actionId, Optional invokeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockActionsDelegate::HandlePauseAction(uint16_t actionId, Optional invokeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockActionsDelegate::HandlePauseActionWithDuration(uint16_t actionId, uint32_t duration, + Optional invokeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockActionsDelegate::HandleResumeAction(uint16_t actionId, Optional invokeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockActionsDelegate::HandleEnableAction(uint16_t actionId, Optional invokeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockActionsDelegate::HandleEnableActionWithDuration(uint16_t actionId, uint32_t duration, + Optional invokeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockActionsDelegate::HandleDisableAction(uint16_t actionId, Optional invokeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockActionsDelegate::HandleDisableActionWithDuration(uint16_t actionId, uint32_t duration, + Optional invokeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +} // namespace Actions +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_actions_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_actions_delegate.h new file mode 100644 index 000000000..0f01649f5 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_actions_delegate.h @@ -0,0 +1,65 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include +#include + +/* + * Mock Actions Delegate Implementation + * This file provides a mock implementation of the Actions::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/actions-server/actions-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/include/bridged-actions-stub.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace Actions { + +class MockActionsDelegate : public Delegate { +public: + MockActionsDelegate() = default; + virtual ~MockActionsDelegate() = default; + + // Action list management + CHIP_ERROR ReadActionAtIndex(uint16_t index, ActionStructStorage &action) override; + CHIP_ERROR ReadEndpointListAtIndex(uint16_t index, EndpointListStorage &epList) override; + bool HaveActionWithId(uint16_t aActionId, uint16_t &aActionIndex) override; + + // Action command handlers + Protocols::InteractionModel::Status HandleInstantAction(uint16_t actionId, Optional invokeId) override; + Protocols::InteractionModel::Status HandleInstantActionWithTransition(uint16_t actionId, uint16_t transitionTime, + Optional invokeId) override; + Protocols::InteractionModel::Status HandleStartAction(uint16_t actionId, Optional invokeId) override; + Protocols::InteractionModel::Status HandleStartActionWithDuration(uint16_t actionId, uint32_t duration, + Optional invokeId) override; + Protocols::InteractionModel::Status HandleStopAction(uint16_t actionId, Optional invokeId) override; + Protocols::InteractionModel::Status HandlePauseAction(uint16_t actionId, Optional invokeId) override; + Protocols::InteractionModel::Status HandlePauseActionWithDuration(uint16_t actionId, uint32_t duration, + Optional invokeId) override; + Protocols::InteractionModel::Status HandleResumeAction(uint16_t actionId, Optional invokeId) override; + Protocols::InteractionModel::Status HandleEnableAction(uint16_t actionId, Optional invokeId) override; + Protocols::InteractionModel::Status HandleEnableActionWithDuration(uint16_t actionId, uint32_t duration, + Optional invokeId) override; + Protocols::InteractionModel::Status HandleDisableAction(uint16_t actionId, Optional invokeId) override; + Protocols::InteractionModel::Status HandleDisableActionWithDuration(uint16_t actionId, uint32_t duration, + Optional invokeId) override; + +private: + static constexpr const char * LOG_TAG = "MockActionsDelegate"; +}; + +} // namespace Actions +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_application_basic_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_application_basic_delegate.cpp new file mode 100644 index 000000000..0ac7f588b --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_application_basic_delegate.cpp @@ -0,0 +1,70 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_application_basic_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ApplicationBasic { + +CHIP_ERROR MockApplicationBasicDelegate::HandleGetVendorName(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeNull(); +} + +uint16_t MockApplicationBasicDelegate::HandleGetVendorId() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +CHIP_ERROR MockApplicationBasicDelegate::HandleGetApplicationName(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeNull(); +} + +uint16_t MockApplicationBasicDelegate::HandleGetProductId() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +CHIP_ERROR MockApplicationBasicDelegate::HandleGetApplicationVersion(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeNull(); +} + +CHIP_ERROR MockApplicationBasicDelegate::HandleGetAllowedVendorList(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeEmptyList(); +} + +std::list MockApplicationBasicDelegate::GetAllowedVendorList() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return std::list(); +} + +} // namespace ApplicationBasic +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_application_basic_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_application_basic_delegate.h new file mode 100644 index 000000000..eb3d4fd32 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_application_basic_delegate.h @@ -0,0 +1,51 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock ApplicationBasic Delegate Implementation + * This file provides a mock implementation of the ApplicationBasic::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/application-basic-server/application-basic-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/application-basic/ApplicationBasicManager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/application-basic/ApplicationBasicManager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ApplicationBasic { + +class MockApplicationBasicDelegate : public Delegate { +public: + MockApplicationBasicDelegate() : Delegate() {} + MockApplicationBasicDelegate(uint16_t szCatalogVendorId, const char * szApplicationId) + : Delegate(szCatalogVendorId, szApplicationId) {} + virtual ~MockApplicationBasicDelegate() = default; + + // Application basic attribute handlers + CHIP_ERROR HandleGetVendorName(app::AttributeValueEncoder &aEncoder) override; + uint16_t HandleGetVendorId() override; + CHIP_ERROR HandleGetApplicationName(app::AttributeValueEncoder &aEncoder) override; + uint16_t HandleGetProductId() override; + CHIP_ERROR HandleGetApplicationVersion(app::AttributeValueEncoder &aEncoder) override; + CHIP_ERROR HandleGetAllowedVendorList(app::AttributeValueEncoder &aEncoder) override; + std::list GetAllowedVendorList() override; + +private: + static constexpr const char * LOG_TAG = "MockApplicationBasicDelegate"; +}; + +} // namespace ApplicationBasic +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_application_launcher_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_application_launcher_delegate.cpp new file mode 100644 index 000000000..0edbebf1c --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_application_launcher_delegate.cpp @@ -0,0 +1,56 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_application_launcher_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ApplicationLauncher { + +CHIP_ERROR MockApplicationLauncherDelegate::HandleGetCatalogList(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeEmptyList(); +} + +void MockApplicationLauncherDelegate::HandleLaunchApp(CommandResponseHelper &helper, const ByteSpan &data, + const Application &application) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + LauncherResponseType response; + response.status = ApplicationLauncherStatusEnum::kSuccess; + helper.Success(response); +} + +void MockApplicationLauncherDelegate::HandleStopApp(CommandResponseHelper &helper, const Application &application) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + LauncherResponseType response; + response.status = ApplicationLauncherStatusEnum::kSuccess; + helper.Success(response); +} + +void MockApplicationLauncherDelegate::HandleHideApp(CommandResponseHelper &helper, const Application &application) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + LauncherResponseType response; + response.status = ApplicationLauncherStatusEnum::kSuccess; + helper.Success(response); +} + +} // namespace ApplicationLauncher +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_application_launcher_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_application_launcher_delegate.h new file mode 100644 index 000000000..05a2bc551 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_application_launcher_delegate.h @@ -0,0 +1,48 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +#include + +/* + * Mock ApplicationLauncher Delegate Implementation + * This file provides a mock implementation of the ApplicationLauncher::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/application-launcher-server/application-launcher-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/application-launcher/ApplicationLauncherManager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/application-launcher/ApplicationLauncherManager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ApplicationLauncher { + +class MockApplicationLauncherDelegate : public Delegate { +public: + MockApplicationLauncherDelegate() = default; + MockApplicationLauncherDelegate(bool featureMapContentPlatform) : Delegate(featureMapContentPlatform) {} + + CHIP_ERROR HandleGetCatalogList(app::AttributeValueEncoder &aEncoder) override; + void HandleLaunchApp(CommandResponseHelper &helper, const ByteSpan &data, + const Application &application) override; + void HandleStopApp(CommandResponseHelper &helper, const Application &application) override; + void HandleHideApp(CommandResponseHelper &helper, const Application &application) override; + +private: + const char *LOG_TAG = "application_launcher"; +}; + +} // namespace ApplicationLauncher +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_audio_output_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_audio_output_delegate.cpp new file mode 100644 index 000000000..390585ad8 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_audio_output_delegate.cpp @@ -0,0 +1,49 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_audio_output_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace AudioOutput { + +uint8_t MockAudioOutputDelegate::HandleGetCurrentOutput() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +CHIP_ERROR MockAudioOutputDelegate::HandleGetOutputList(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeEmptyList(); +} + +bool MockAudioOutputDelegate::HandleRenameOutput(const uint8_t &index, const chip::CharSpan &name) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +bool MockAudioOutputDelegate::HandleSelectOutput(const uint8_t &index) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +} // namespace AudioOutput +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_audio_output_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_audio_output_delegate.h new file mode 100644 index 000000000..6e7b4fe0d --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_audio_output_delegate.h @@ -0,0 +1,46 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +#include + +/* + * Mock AudioOutput Delegate Implementation + * This file provides a mock implementation of the AudioOutput::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/audio-output-server/audio-output-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/audio-output/AudioOutputManager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/audio-output/AudioOutputManager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace AudioOutput { + +class MockAudioOutputDelegate : public Delegate { +public: + MockAudioOutputDelegate() = default; + + uint8_t HandleGetCurrentOutput() override; + CHIP_ERROR HandleGetOutputList(app::AttributeValueEncoder &aEncoder) override; + bool HandleRenameOutput(const uint8_t &index, const chip::CharSpan &name) override; + bool HandleSelectOutput(const uint8_t &index) override; + +private: + const char *LOG_TAG = "audio_output"; +}; + +} // namespace AudioOutput +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_boolean_state_configuration_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_boolean_state_configuration_delegate.cpp new file mode 100644 index 000000000..fd4e52db8 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_boolean_state_configuration_delegate.cpp @@ -0,0 +1,35 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_boolean_state_configuration_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace BooleanStateConfiguration { + +CHIP_ERROR MockBooleanStateConfigurationDelegate::HandleSuppressAlarm(BooleanStateConfiguration::AlarmModeBitmap alarmToSuppress) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockBooleanStateConfigurationDelegate::HandleEnableDisableAlarms(chip::BitMask alarms) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +} // namespace BooleanStateConfiguration +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_boolean_state_configuration_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_boolean_state_configuration_delegate.h new file mode 100644 index 000000000..de582bf1a --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_boolean_state_configuration_delegate.h @@ -0,0 +1,43 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock BooleanStateConfiguration Delegate Implementation + * This file provides a mock implementation of the BooleanStateConfiguration::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/boolcfg-stub.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace BooleanStateConfiguration { + +class MockBooleanStateConfigurationDelegate : public Delegate { +public: + MockBooleanStateConfigurationDelegate() : Delegate() {} + virtual ~MockBooleanStateConfigurationDelegate() = default; + + // Boolean state configuration command handlers + CHIP_ERROR HandleSuppressAlarm(BooleanStateConfiguration::AlarmModeBitmap alarmToSuppress) override; + CHIP_ERROR HandleEnableDisableAlarms(chip::BitMask alarms) override; + +private: + static constexpr const char * LOG_TAG = "MockBooleanStateConfigurationDelegate"; +}; + +} // namespace BooleanStateConfiguration +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_camera_av_settings_user_level_management_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_camera_av_settings_user_level_management_delegate.cpp new file mode 100644 index 000000000..d99dc767c --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_camera_av_settings_user_level_management_delegate.cpp @@ -0,0 +1,143 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_camera_av_settings_user_level_management_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace CameraAvSettingsUserLevelManagement { + +void MockCameraAVSettingsUserLevelManagementDelegate::ShutdownApp() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +bool MockCameraAVSettingsUserLevelManagementDelegate::CanChangeMPTZ() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +void MockCameraAVSettingsUserLevelManagementDelegate::VideoStreamAllocated(uint16_t aStreamID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +void MockCameraAVSettingsUserLevelManagementDelegate::VideoStreamDeallocated(uint16_t aStreamID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +void MockCameraAVSettingsUserLevelManagementDelegate::DefaultViewportUpdated(Globals::Structs::ViewportStruct::Type aViewport) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +Protocols::InteractionModel::Status MockCameraAVSettingsUserLevelManagementDelegate::MPTZSetPosition(Optional aPan, Optional aTilt, + Optional aZoom, PhysicalPTZCallback * callback) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + if (callback) { + callback->OnPhysicalMovementComplete(Protocols::InteractionModel::Status::Success); + } + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockCameraAVSettingsUserLevelManagementDelegate::MPTZRelativeMove(Optional aPan, Optional aTilt, + Optional aZoom, PhysicalPTZCallback * callback) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + if (callback) { + callback->OnPhysicalMovementComplete(Protocols::InteractionModel::Status::Success); + } + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockCameraAVSettingsUserLevelManagementDelegate::MPTZMoveToPreset(uint8_t aPreset, Optional aPan, Optional aTilt, + Optional aZoom, PhysicalPTZCallback * callback) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + if (callback) { + callback->OnPhysicalMovementComplete(Protocols::InteractionModel::Status::Success); + } + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockCameraAVSettingsUserLevelManagementDelegate::MPTZSavePreset(uint8_t aPreset) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockCameraAVSettingsUserLevelManagementDelegate::MPTZRemovePreset(uint8_t aPreset) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockCameraAVSettingsUserLevelManagementDelegate::DPTZSetViewport(uint16_t aVideoStreamID, + Globals::Structs::ViewportStruct::Type aViewport) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockCameraAVSettingsUserLevelManagementDelegate::DPTZRelativeMove(uint16_t aVideoStreamID, Optional aDeltaX, + Optional aDeltaY, Optional aZoomDelta, + Globals::Structs::ViewportStruct::Type &aViewport) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +CHIP_ERROR MockCameraAVSettingsUserLevelManagementDelegate::PersistentAttributesLoadedCallback() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockCameraAVSettingsUserLevelManagementDelegate::LoadMPTZPresets(std::vector &mptzPresetHelpers) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + mptzPresetHelpers.clear(); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockCameraAVSettingsUserLevelManagementDelegate::LoadDPTZStreams(std::vector &dptzStreams) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + dptzStreams.clear(); + return CHIP_NO_ERROR; +} + +} // namespace CameraAvSettingsUserLevelManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_camera_av_settings_user_level_management_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_camera_av_settings_user_level_management_delegate.h new file mode 100644 index 000000000..087608cce --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_camera_av_settings_user_level_management_delegate.h @@ -0,0 +1,76 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include +#include + +/* + * Mock CameraAVSettingsUserLevelManagement Delegate Implementation + * This file provides a mock implementation of the CameraAVSettingsUserLevelManagement::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/camera-av-settings-user-level-management-server/camera-av-settings-user-level-management-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/include/camera-av-settings-user-level-management-instance.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/camera-av-settings-user-level-management-stub.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace CameraAvSettingsUserLevelManagement { + +class MockCameraAVSettingsUserLevelManagementDelegate : public CameraAvSettingsUserLevelManagementDelegate { +public: + MockCameraAVSettingsUserLevelManagementDelegate() : CameraAvSettingsUserLevelManagementDelegate() {} + virtual ~MockCameraAVSettingsUserLevelManagementDelegate() = default; + + // Shutdown handler + void ShutdownApp() override; + + // Camera AV settings management + bool CanChangeMPTZ() override; + + // DPTZ stream handling + void VideoStreamAllocated(uint16_t aStreamID) override; + void VideoStreamDeallocated(uint16_t aStreamID) override; + void DefaultViewportUpdated(Globals::Structs::ViewportStruct::Type aViewport) override; + + // MPTZ command handlers + Protocols::InteractionModel::Status MPTZSetPosition(Optional aPan, Optional aTilt, + Optional aZoom, PhysicalPTZCallback * callback) override; + Protocols::InteractionModel::Status MPTZRelativeMove(Optional aPan, Optional aTilt, + Optional aZoom, PhysicalPTZCallback * callback) override; + Protocols::InteractionModel::Status MPTZMoveToPreset(uint8_t aPreset, Optional aPan, Optional aTilt, + Optional aZoom, PhysicalPTZCallback * callback) override; + Protocols::InteractionModel::Status MPTZSavePreset(uint8_t aPreset) override; + Protocols::InteractionModel::Status MPTZRemovePreset(uint8_t aPreset) override; + + // DPTZ command handlers + Protocols::InteractionModel::Status DPTZSetViewport(uint16_t aVideoStreamID, + Globals::Structs::ViewportStruct::Type aViewport) override; + Protocols::InteractionModel::Status DPTZRelativeMove(uint16_t aVideoStreamID, Optional aDeltaX, + Optional aDeltaY, Optional aZoomDelta, + Globals::Structs::ViewportStruct::Type &aViewport) override; + + // Persistent attributes callback + CHIP_ERROR PersistentAttributesLoadedCallback() override; + + // Load handlers + CHIP_ERROR LoadMPTZPresets(std::vector &mptzPresetHelpers) override; + CHIP_ERROR LoadDPTZStreams(std::vector &dptzStreams) override; + +private: + static constexpr const char * LOG_TAG = "MockCameraAVSettingsUserLevelMgmtDelegate"; +}; + +} // namespace CameraAvSettingsUserLevelManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_camera_av_stream_management_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_camera_av_stream_management_delegate.cpp new file mode 100644 index 000000000..7abd279a0 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_camera_av_stream_management_delegate.cpp @@ -0,0 +1,146 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_camera_av_stream_management_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace CameraAvStreamManagement { + +Protocols::InteractionModel::Status MockCameraAVStreamManagementDelegate::VideoStreamAllocate(const VideoStreamStruct &allocateArgs, + uint16_t &outStreamID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + outStreamID = 0; + return Protocols::InteractionModel::Status::Success; +} + +void MockCameraAVStreamManagementDelegate::OnVideoStreamAllocated(const VideoStreamStruct &allocatedStream, StreamAllocationAction action) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +Protocols::InteractionModel::Status MockCameraAVStreamManagementDelegate::VideoStreamModify(const uint16_t streamID, const Optional waterMarkEnabled, + const Optional osdEnabled) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockCameraAVStreamManagementDelegate::VideoStreamDeallocate(const uint16_t streamID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockCameraAVStreamManagementDelegate::AudioStreamAllocate(const AudioStreamStruct &allocateArgs, + uint16_t &outStreamID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + outStreamID = 0; + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockCameraAVStreamManagementDelegate::AudioStreamDeallocate(const uint16_t streamID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockCameraAVStreamManagementDelegate::SnapshotStreamAllocate(const SnapshotStreamAllocateArgs &allocateArgs, + uint16_t &outStreamID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + outStreamID = 0; + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockCameraAVStreamManagementDelegate::SnapshotStreamModify(const uint16_t streamID, const Optional waterMarkEnabled, + const Optional osdEnabled) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockCameraAVStreamManagementDelegate::SnapshotStreamDeallocate(const uint16_t streamID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +void MockCameraAVStreamManagementDelegate::OnStreamUsagePrioritiesChanged() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +void MockCameraAVStreamManagementDelegate::OnAttributeChanged(AttributeId attributeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +Protocols::InteractionModel::Status MockCameraAVStreamManagementDelegate::CaptureSnapshot(const DataModel::Nullable streamID, + const VideoResolutionStruct &resolution, + ImageSnapshot &outImageSnapshot) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +CHIP_ERROR MockCameraAVStreamManagementDelegate::PersistentAttributesLoadedCallback() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockCameraAVStreamManagementDelegate::OnTransportAcquireAudioVideoStreams(uint16_t audioStreamID, uint16_t videoStreamID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockCameraAVStreamManagementDelegate::OnTransportReleaseAudioVideoStreams(uint16_t audioStreamID, uint16_t videoStreamID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +const std::vector &MockCameraAVStreamManagementDelegate::GetAllocatedVideoStreams() const +{ + return mAllocatedVideoStreams; +} + +const std::vector &MockCameraAVStreamManagementDelegate::GetAllocatedAudioStreams() const +{ + return mAllocatedAudioStreams; +} + +} // namespace CameraAvStreamManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_camera_av_stream_management_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_camera_av_stream_management_delegate.h new file mode 100644 index 000000000..df584c0f7 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_camera_av_stream_management_delegate.h @@ -0,0 +1,81 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include +#include + +/* + * Mock CameraAVStreamManagement Delegate Implementation + * This file provides a mock implementation of the CameraAVStreamMgmtDelegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/camera-av-stream-management-server/camera-av-stream-management-server.h + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace CameraAvStreamManagement { + +class MockCameraAVStreamManagementDelegate : public CameraAVStreamManagementDelegate { +public: + MockCameraAVStreamManagementDelegate() = default; + virtual ~MockCameraAVStreamManagementDelegate() = default; + + // Video stream handlers + Protocols::InteractionModel::Status VideoStreamAllocate(const VideoStreamStruct &allocateArgs, + uint16_t &outStreamID) override; + void OnVideoStreamAllocated(const VideoStreamStruct &allocatedStream, StreamAllocationAction action) override; + Protocols::InteractionModel::Status VideoStreamModify(const uint16_t streamID, const Optional waterMarkEnabled, + const Optional osdEnabled) override; + Protocols::InteractionModel::Status VideoStreamDeallocate(const uint16_t streamID) override; + + // Audio stream handlers + Protocols::InteractionModel::Status AudioStreamAllocate(const AudioStreamStruct &allocateArgs, + uint16_t &outStreamID) override; + Protocols::InteractionModel::Status AudioStreamDeallocate(const uint16_t streamID) override; + + // Snapshot stream handlers + Protocols::InteractionModel::Status SnapshotStreamAllocate(const SnapshotStreamAllocateArgs &allocateArgs, + uint16_t &outStreamID) override; + Protocols::InteractionModel::Status SnapshotStreamModify(const uint16_t streamID, const Optional waterMarkEnabled, + const Optional osdEnabled) override; + Protocols::InteractionModel::Status SnapshotStreamDeallocate(const uint16_t streamID) override; + + // Callback handlers + void OnStreamUsagePrioritiesChanged() override; + void OnAttributeChanged(AttributeId attributeId) override; + + // Capture snapshot + Protocols::InteractionModel::Status CaptureSnapshot(const DataModel::Nullable streamID, + const VideoResolutionStruct &resolution, + ImageSnapshot &outImageSnapshot) override; + + // Persistent attributes callback + CHIP_ERROR PersistentAttributesLoadedCallback() override; + + // Transport stream handlers + CHIP_ERROR OnTransportAcquireAudioVideoStreams(uint16_t audioStreamID, uint16_t videoStreamID) override; + CHIP_ERROR OnTransportReleaseAudioVideoStreams(uint16_t audioStreamID, uint16_t videoStreamID) override; + + // Stream accessors + const std::vector &GetAllocatedVideoStreams() const override; + const std::vector &GetAllocatedAudioStreams() const override; + +private: + static constexpr const char * LOG_TAG = "MockCameraAVStreamMgmtDelegate"; + std::vector mAllocatedVideoStreams; + std::vector mAllocatedAudioStreams; +}; + +} // namespace CameraAvStreamManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_channel_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_channel_delegate.cpp new file mode 100644 index 000000000..d171db61f --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_channel_delegate.cpp @@ -0,0 +1,112 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_channel_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace Channel { + +CHIP_ERROR MockChannelDelegate::HandleGetChannelList(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeEmptyList(); +} + +CHIP_ERROR MockChannelDelegate::HandleGetLineup(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeNull(); +} + +CHIP_ERROR MockChannelDelegate::HandleGetCurrentChannel(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeNull(); +} + +void MockChannelDelegate::HandleChangeChannel(CommandResponseHelper &helper, + const chip::CharSpan &match) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::ChangeChannelResponse::Type response; + response.status = ChannelStatusEnum::kSuccess; + helper.Success(response); +} + +bool MockChannelDelegate::HandleChangeChannelByNumber(const uint16_t &majorNumber, const uint16_t &minorNumber) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +bool MockChannelDelegate::HandleSkipChannel(const int16_t &count) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +void MockChannelDelegate::HandleGetProgramGuide(CommandResponseHelper &helper, + const chip::Optional &startTime, const chip::Optional &endTime, + const chip::Optional> &channelList, + const chip::Optional &pageToken, + const chip::Optional> &recordingFlag, + const chip::Optional> &externalIdList, + const chip::Optional &data) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::ProgramGuideResponse::Type response; + helper.Success(response); +} + +bool MockChannelDelegate::HandleRecordProgram(const chip::CharSpan &programIdentifier, bool shouldRecordSeries, + const DataModel::DecodableList &externalIdList, + const chip::ByteSpan &data) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +bool MockChannelDelegate::HandleCancelRecordProgram(const chip::CharSpan &programIdentifier, bool shouldRecordSeries, + const DataModel::DecodableList &externalIdList, + const chip::ByteSpan &data) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +uint32_t MockChannelDelegate::GetFeatureMap(chip::EndpointId endpoint) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint16_t MockChannelDelegate::GetClusterRevision(chip::EndpointId endpoint) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +} // namespace Channel +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_channel_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_channel_delegate.h new file mode 100644 index 000000000..bb4e8d2e0 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_channel_delegate.h @@ -0,0 +1,68 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +#include + +/* + * Mock Channel Delegate Implementation + * This file provides a mock implementation of the Channel::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/channel-server/channel-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/channel/ChannelManager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/channel/ChannelManager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace Channel { + +class MockChannelDelegate : public Delegate { +public: + MockChannelDelegate() = default; + + CHIP_ERROR HandleGetChannelList(app::AttributeValueEncoder &aEncoder) override; + CHIP_ERROR HandleGetLineup(app::AttributeValueEncoder &aEncoder) override; + CHIP_ERROR HandleGetCurrentChannel(app::AttributeValueEncoder &aEncoder) override; + + void HandleChangeChannel(CommandResponseHelper &helper, + const chip::CharSpan &match) override; + bool HandleChangeChannelByNumber(const uint16_t &majorNumber, const uint16_t &minorNumber) override; + bool HandleSkipChannel(const int16_t &count) override; + void HandleGetProgramGuide(CommandResponseHelper &helper, + const chip::Optional &startTime, const chip::Optional &endTime, + const chip::Optional> &channelList, + const chip::Optional &pageToken, + const chip::Optional> &recordingFlag, + const chip::Optional> &externalIdList, + const chip::Optional &data) override; + + bool HandleRecordProgram(const chip::CharSpan &programIdentifier, bool shouldRecordSeries, + const DataModel::DecodableList &externalIdList, + const chip::ByteSpan &data) override; + + bool HandleCancelRecordProgram(const chip::CharSpan &programIdentifier, bool shouldRecordSeries, + const DataModel::DecodableList &externalIdList, + const chip::ByteSpan &data) override; + + uint32_t GetFeatureMap(chip::EndpointId endpoint) override; + uint16_t GetClusterRevision(chip::EndpointId endpoint) override; + +private: + const char *LOG_TAG = "channel"; +}; + +} // namespace Channel +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_closure_control_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_closure_control_delegate.cpp new file mode 100644 index 000000000..1f0d99add --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_closure_control_delegate.cpp @@ -0,0 +1,68 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_closure_control_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ClosureControl { + +Protocols::InteractionModel::Status MockClosureControlDelegate::HandleStopCommand() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockClosureControlDelegate::HandleMoveToCommand(const Optional &position, + const Optional &latch, + const Optional &speed) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockClosureControlDelegate::HandleCalibrateCommand() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +bool MockClosureControlDelegate::IsReadyToMove() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +ElapsedS MockClosureControlDelegate::GetCalibrationCountdownTime() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return ElapsedS(0); +} + +ElapsedS MockClosureControlDelegate::GetMovingCountdownTime() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return ElapsedS(0); +} + +ElapsedS MockClosureControlDelegate::GetWaitingForMotionCountdownTime() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return ElapsedS(0); +} + +} // namespace ClosureControl +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_closure_control_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_closure_control_delegate.h new file mode 100644 index 000000000..0a138801c --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_closure_control_delegate.h @@ -0,0 +1,54 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include +#include + +/* + * Mock ClosureControl Delegate Implementation + * This file provides a mock implementation of the ClosureControl::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/closure-control-server/closure-control-cluster-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/closure-app/closure-common/include/ClosureControlEndpoint.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/closure-app/closure-common/src/ClosureControlEndpoint.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ClosureControl { + +class MockClosureControlDelegate : public DelegateBase { +public: + MockClosureControlDelegate() : DelegateBase() {} + virtual ~MockClosureControlDelegate() = default; + + // Closure control command handlers + Protocols::InteractionModel::Status HandleStopCommand() override; + Protocols::InteractionModel::Status HandleMoveToCommand(const Optional &position, + const Optional &latch, + const Optional &speed) override; + Protocols::InteractionModel::Status HandleCalibrateCommand() override; + + // Attribute getters + bool IsReadyToMove() override; + ElapsedS GetCalibrationCountdownTime() override; + ElapsedS GetMovingCountdownTime() override; + ElapsedS GetWaitingForMotionCountdownTime() override; + +private: + static constexpr const char * LOG_TAG = "MockClosureControlDelegate"; +}; + +} // namespace ClosureControl +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_closure_dimension_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_closure_dimension_delegate.cpp new file mode 100644 index 000000000..59ddb5ea2 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_closure_dimension_delegate.cpp @@ -0,0 +1,39 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_closure_dimension_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ClosureDimension { + +Protocols::InteractionModel::Status MockClosureDimensionDelegate::HandleSetTarget(const Optional &position, + const Optional &latch, + const Optional &speed) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockClosureDimensionDelegate::HandleStep(const StepDirectionEnum &direction, + const uint16_t &numberOfSteps, + const Optional &speed) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +} // namespace ClosureDimension +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_closure_dimension_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_closure_dimension_delegate.h new file mode 100644 index 000000000..26ccd5f70 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_closure_dimension_delegate.h @@ -0,0 +1,48 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include +#include + +/* + * Mock ClosureDimension Delegate Implementation + * This file provides a mock implementation of the ClosureDimension::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/closure-dimension-server/closure-dimension-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/closure-app/closure-common/include/ClosureDimensionEndpoint.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/closure-app/closure-common/src/ClosureDimensionEndpoint.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ClosureDimension { + +class MockClosureDimensionDelegate : public DelegateBase { +public: + MockClosureDimensionDelegate() : DelegateBase() {} + virtual ~MockClosureDimensionDelegate() = default; + + // Closure dimension command handlers + Protocols::InteractionModel::Status HandleSetTarget(const Optional &position, + const Optional &latch, + const Optional &speed) override; + Protocols::InteractionModel::Status HandleStep(const StepDirectionEnum &direction, const uint16_t &numberOfSteps, + const Optional &speed) override; + +private: + static constexpr const char * LOG_TAG = "MockClosureDimensionDelegate"; +}; + +} // namespace ClosureDimension +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_commissioner_control_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_commissioner_control_delegate.cpp new file mode 100644 index 000000000..03ae8c93e --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_commissioner_control_delegate.cpp @@ -0,0 +1,49 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_commissioner_control_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace CommissionerControl { + +CHIP_ERROR MockCommissionerControlDelegate::HandleCommissioningApprovalRequest(const CommissioningApprovalRequest &request) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockCommissionerControlDelegate::ValidateCommissionNodeCommand(NodeId clientNodeId, uint64_t requestId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockCommissionerControlDelegate::GetCommissioningWindowParams(CommissioningWindowParams &outParams) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockCommissionerControlDelegate::HandleCommissionNode(const CommissioningWindowParams ¶ms) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +} // namespace CommissionerControl +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_commissioner_control_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_commissioner_control_delegate.h new file mode 100644 index 000000000..70216557b --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_commissioner_control_delegate.h @@ -0,0 +1,46 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock CommissionerControl Delegate Implementation + * This file provides a mock implementation of the CommissionerControl::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/commissioner-control-server/commissioner-control-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/fabric-bridge-app/linux/include/CommissionerControlDelegate.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/fabric-bridge-app/linux/CommissionerControlDelegate.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace CommissionerControl { + +class MockCommissionerControlDelegate : public Delegate { +public: + MockCommissionerControlDelegate() = default; + virtual ~MockCommissionerControlDelegate() = default; + + // Commissioner control management + CHIP_ERROR HandleCommissioningApprovalRequest(const CommissioningApprovalRequest &request) override; + CHIP_ERROR ValidateCommissionNodeCommand(NodeId clientNodeId, uint64_t requestId) override; + CHIP_ERROR GetCommissioningWindowParams(CommissioningWindowParams &outParams) override; + CHIP_ERROR HandleCommissionNode(const CommissioningWindowParams ¶ms) override; + +private: + static constexpr const char * LOG_TAG = "MockCommissionerControlDelegate"; +}; + +} // namespace CommissionerControl +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_commodity_price_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_commodity_price_delegate.cpp new file mode 100644 index 000000000..c4a1cf52e --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_commodity_price_delegate.cpp @@ -0,0 +1,25 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_commodity_price_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace CommodityPrice { + +// Note: This delegate is mostly a placeholder as mentioned in the original header +// There are no delegated methods since these are largely implemented in the +// commodity-price-server.cpp Instance class + +} // namespace CommodityPrice +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_commodity_price_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_commodity_price_delegate.h new file mode 100644 index 000000000..dafcf3f2b --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_commodity_price_delegate.h @@ -0,0 +1,39 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock CommodityPrice Delegate Implementation + * This file provides a mock implementation of the CommodityPrice::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/commodity-price-server/commodity-price-server.h + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace CommodityPrice { + +class MockCommodityPriceDelegate : public Delegate { +public: + MockCommodityPriceDelegate() = default; + virtual ~MockCommodityPriceDelegate() = default; + + // Note: This delegate is mostly a placeholder as mentioned in the original header + // There are no delegated methods since these are largely implemented in the + // commodity-price-server.cpp Instance class +}; + +} // namespace CommodityPrice +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_commodity_tariff_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_commodity_tariff_delegate.h new file mode 100644 index 000000000..56c10aa64 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_commodity_tariff_delegate.h @@ -0,0 +1,41 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock CommodityTariff Delegate Implementation + * This file provides a mock implementation of the CommodityTariff::Delegate interface. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/commodity-tariff-server/commodity-tariff-server.h + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace CommodityTariff { + +class MockCommodityTariffDelegate : public Delegate { +public: + MockCommodityTariffDelegate() = default; + virtual ~MockCommodityTariffDelegate() = default; + + // Note: This delegate is mostly a placeholder. + // The Delegate class has no pure virtual methods - all functionality is + // implemented in the base class with attribute accessors and setters. + +private: + static constexpr const char * LOG_TAG = "MockCommodityTariffDelegate"; +}; + +} // namespace CommodityTariff +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_content_app_observer_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_content_app_observer_delegate.cpp new file mode 100644 index 000000000..ff92a6688 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_content_app_observer_delegate.cpp @@ -0,0 +1,32 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_content_app_observer_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ContentAppObserver { + +void MockContentAppObserverDelegate::HandleContentAppMessage(CommandResponseHelper &helper, + const chip::Optional &data, const chip::CharSpan &encodingHint) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + + Commands::ContentAppMessageResponse::Type response; + helper.Success(response); + return; +} + +} // namespace ContentAppObserver +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_content_app_observer_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_content_app_observer_delegate.h new file mode 100644 index 000000000..7137f0873 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_content_app_observer_delegate.h @@ -0,0 +1,42 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock ContentAppObserver Delegate Implementation + * This file provides a mock implementation of the ContentAppObserver::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/content-app-observer/content-app-observer-delegate.h + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ContentAppObserver { + +class MockContentAppObserverDelegate : public Delegate { +public: + MockContentAppObserverDelegate() = default; + virtual ~MockContentAppObserverDelegate() = default; + + // Content app observer command handlers + void HandleContentAppMessage(CommandResponseHelper &helper, + const chip::Optional &data, const chip::CharSpan &encodingHint) override; + +private: + static constexpr const char * LOG_TAG = "MockContentAppObserverDelegate"; +}; + +} // namespace ContentAppObserver +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_content_control_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_content_control_delegate.cpp new file mode 100644 index 000000000..7f8f20a6c --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_content_control_delegate.cpp @@ -0,0 +1,155 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_content_control_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ContentControl { + +bool MockContentControlDelegate::HandleGetEnabled() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return false; +} + +CHIP_ERROR MockContentControlDelegate::HandleGetOnDemandRatings(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeEmptyList(); +} + +chip::CharSpan MockContentControlDelegate::HandleGetOnDemandRatingThreshold() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return chip::CharSpan(); +} + +CHIP_ERROR MockContentControlDelegate::HandleGetScheduledContentRatings(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeEmptyList(); +} + +chip::CharSpan MockContentControlDelegate::HandleGetScheduledContentRatingThreshold() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return chip::CharSpan(); +} + +uint32_t MockContentControlDelegate::HandleGetScreenDailyTime() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint32_t MockContentControlDelegate::HandleGetRemainingScreenTime() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +bool MockContentControlDelegate::HandleGetBlockUnrated() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return false; +} + +void MockContentControlDelegate::HandleUpdatePIN(chip::CharSpan oldPIN, chip::CharSpan newPIN) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +void MockContentControlDelegate::HandleResetPIN(CommandResponseHelper &helper) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::ResetPINResponse::Type response; + helper.Success(response); +} + +void MockContentControlDelegate::HandleEnable() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +void MockContentControlDelegate::HandleDisable() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +void MockContentControlDelegate::HandleAddBonusTime(Optional PINCode, uint32_t bonusTime) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +void MockContentControlDelegate::HandleSetScreenDailyTime(uint32_t screenDailyTime) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +void MockContentControlDelegate::HandleBlockUnratedContent() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +void MockContentControlDelegate::HandleUnblockUnratedContent() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +void MockContentControlDelegate::HandleSetOnDemandRatingThreshold(chip::CharSpan rating) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +void MockContentControlDelegate::HandleSetScheduledContentRatingThreshold(chip::CharSpan rating) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +uint32_t MockContentControlDelegate::GetFeatureMap(chip::EndpointId endpoint) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +} // namespace ContentControl +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_content_control_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_content_control_delegate.h new file mode 100644 index 000000000..b599b5b15 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_content_control_delegate.h @@ -0,0 +1,58 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once +#include + +/* + * Mock ContentControl Delegate Implementation + * This file provides a mock implementation of the ContentControl::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/master/src/app/clusters/content-control-server/content-control-delegate.h + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ContentControl { + +class MockContentControlDelegate : public Delegate { +public: + MockContentControlDelegate() = default; + + bool HandleGetEnabled() override; + CHIP_ERROR HandleGetOnDemandRatings(app::AttributeValueEncoder &aEncoder) override; + chip::CharSpan HandleGetOnDemandRatingThreshold() override; + CHIP_ERROR HandleGetScheduledContentRatings(app::AttributeValueEncoder &aEncoder) override; + chip::CharSpan HandleGetScheduledContentRatingThreshold() override; + uint32_t HandleGetScreenDailyTime() override; + uint32_t HandleGetRemainingScreenTime() override; + bool HandleGetBlockUnrated() override; + + void HandleUpdatePIN(chip::CharSpan oldPIN, chip::CharSpan newPIN) override; + void HandleResetPIN(CommandResponseHelper &helper) override; + void HandleEnable() override; + void HandleDisable() override; + void HandleAddBonusTime(Optional PINCode, uint32_t bonusTime) override; + void HandleSetScreenDailyTime(uint32_t screenDailyTime) override; + void HandleBlockUnratedContent() override; + void HandleUnblockUnratedContent() override; + void HandleSetOnDemandRatingThreshold(chip::CharSpan rating) override; + void HandleSetScheduledContentRatingThreshold(chip::CharSpan rating) override; + + uint32_t GetFeatureMap(chip::EndpointId endpoint) override; + +private: + const char *LOG_TAG = "content_control"; +}; + +} // namespace ContentControl +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_content_launcher_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_content_launcher_delegate.cpp new file mode 100644 index 000000000..84abb50f9 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_content_launcher_delegate.cpp @@ -0,0 +1,71 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_content_launcher_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ContentLauncher { + +void MockContentLauncherDelegate::HandleLaunchContent(CommandResponseHelper &helper, + const DataModel::DecodableList ¶meterList, bool autoplay, + const CharSpan &data, const Optional playbackPreferences, + bool useCurrentContext) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::LauncherResponse::Type response; + response.status = StatusEnum::kSuccess; + helper.Success(response); +} + +void MockContentLauncherDelegate::HandleLaunchUrl(CommandResponseHelper &helper, const CharSpan &contentUrl, + const CharSpan &displayString, const BrandingInformation &brandingInformation) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::LauncherResponse::Type response; + response.status = StatusEnum::kSuccess; + helper.Success(response); +} + +CHIP_ERROR MockContentLauncherDelegate::HandleGetAcceptHeaderList(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeEmptyList(); +} + +uint32_t MockContentLauncherDelegate::HandleGetSupportedStreamingProtocols() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint32_t MockContentLauncherDelegate::GetFeatureMap(chip::EndpointId endpoint) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint16_t MockContentLauncherDelegate::GetClusterRevision(chip::EndpointId endpoint) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +} // namespace ContentLauncher +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_content_launcher_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_content_launcher_delegate.h new file mode 100644 index 000000000..bafedfbc2 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_content_launcher_delegate.h @@ -0,0 +1,52 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +#include + +/* + * Mock ContentLauncher Delegate Implementation + * This file provides a mock implementation of the ContentLauncher::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/content-launch-server/content-launch-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/content-launcher/ContentLauncherManager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/content-launcher/ContentLauncherManager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ContentLauncher { + +class MockContentLauncherDelegate : public Delegate { +public: + MockContentLauncherDelegate() = default; + + void HandleLaunchContent(CommandResponseHelper &helper, + const DataModel::DecodableList ¶meterList, bool autoplay, + const CharSpan &data, const Optional playbackPreferences, + bool useCurrentContext) override; + void HandleLaunchUrl(CommandResponseHelper &helper, const CharSpan &contentUrl, + const CharSpan &displayString, const BrandingInformation &brandingInformation) override; + CHIP_ERROR HandleGetAcceptHeaderList(app::AttributeValueEncoder &aEncoder) override; + uint32_t HandleGetSupportedStreamingProtocols() override; + uint32_t GetFeatureMap(chip::EndpointId endpoint) override; + uint16_t GetClusterRevision(chip::EndpointId endpoint) override; + +private: + const char *LOG_TAG = "content_launcher"; +}; + +} // namespace ContentLauncher +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_device_energy_management_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_device_energy_management_delegate.cpp new file mode 100644 index 000000000..b2214188d --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_device_energy_management_delegate.cpp @@ -0,0 +1,137 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_device_energy_management_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace DeviceEnergyManagement { + +Protocols::InteractionModel::Status MockDeviceEnergyManagementDelegate::PowerAdjustRequest(const int64_t power, const uint32_t duration, + AdjustmentCauseEnum cause) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockDeviceEnergyManagementDelegate::CancelPowerAdjustRequest() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockDeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t requestedStartTime, + AdjustmentCauseEnum cause) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockDeviceEnergyManagementDelegate::PauseRequest(const uint32_t duration, AdjustmentCauseEnum cause) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockDeviceEnergyManagementDelegate::ResumeRequest() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status +MockDeviceEnergyManagementDelegate::ModifyForecastRequest(const uint32_t forecastID, + const DataModel::DecodableList &slotAdjustments, + AdjustmentCauseEnum cause) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status +MockDeviceEnergyManagementDelegate::RequestConstraintBasedForecast(const DataModel::DecodableList &constraints, + AdjustmentCauseEnum cause) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockDeviceEnergyManagementDelegate::CancelRequest() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +ESATypeEnum MockDeviceEnergyManagementDelegate::GetESAType() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return ESATypeEnum::kOther; +} + +bool MockDeviceEnergyManagementDelegate::GetESACanGenerate() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return false; +} + +ESAStateEnum MockDeviceEnergyManagementDelegate::GetESAState() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return ESAStateEnum::kOffline; +} + +int64_t MockDeviceEnergyManagementDelegate::GetAbsMinPower() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +int64_t MockDeviceEnergyManagementDelegate::GetAbsMaxPower() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +OptOutStateEnum MockDeviceEnergyManagementDelegate::GetOptOutState() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return OptOutStateEnum::kNoOptOut; +} + +const DataModel::Nullable &MockDeviceEnergyManagementDelegate::GetPowerAdjustmentCapability() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return mPowerAdjustCapability; +} + +const DataModel::Nullable &MockDeviceEnergyManagementDelegate::GetForecast() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return mForecast; +} + +CHIP_ERROR MockDeviceEnergyManagementDelegate::SetESAState(ESAStateEnum esaState) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +} // namespace DeviceEnergyManagement +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_device_energy_management_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_device_energy_management_delegate.h new file mode 100644 index 000000000..f2d031330 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_device_energy_management_delegate.h @@ -0,0 +1,79 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock DeviceEnergyManagement Delegate Implementation + * This file provides a mock implementation of the DeviceEnergyManagement::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/device-energy-management-server/device-energy-management-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/device-energy-management/include/DeviceEnergyManagementDelegateImpl.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace DeviceEnergyManagement { + +class MockDeviceEnergyManagementDelegate : public Delegate { +public: + MockDeviceEnergyManagementDelegate() = default; + virtual ~MockDeviceEnergyManagementDelegate() = default; + + // Command handlers + Protocols::InteractionModel::Status PowerAdjustRequest(const int64_t power, const uint32_t duration, + AdjustmentCauseEnum cause) override; + + Protocols::InteractionModel::Status CancelPowerAdjustRequest() override; + + Protocols::InteractionModel::Status StartTimeAdjustRequest(const uint32_t requestedStartTime, + AdjustmentCauseEnum cause) override; + + Protocols::InteractionModel::Status PauseRequest(const uint32_t duration, AdjustmentCauseEnum cause) override; + + Protocols::InteractionModel::Status ResumeRequest() override; + + Protocols::InteractionModel::Status + ModifyForecastRequest(const uint32_t forecastID, + const DataModel::DecodableList &slotAdjustments, + AdjustmentCauseEnum cause) override; + + Protocols::InteractionModel::Status + RequestConstraintBasedForecast(const DataModel::DecodableList &constraints, + AdjustmentCauseEnum cause) override; + + Protocols::InteractionModel::Status CancelRequest() override; + + // Attribute getters + ESATypeEnum GetESAType() override; + bool GetESACanGenerate() override; + ESAStateEnum GetESAState() override; + int64_t GetAbsMinPower() override; + int64_t GetAbsMaxPower() override; + OptOutStateEnum GetOptOutState() override; + const DataModel::Nullable &GetPowerAdjustmentCapability() override; + const DataModel::Nullable &GetForecast() override; + + // Attribute setter + CHIP_ERROR SetESAState(ESAStateEnum esaState) override; + +private: + static constexpr const char * LOG_TAG = "MockDeviceEnergyManagementDelegate"; + DataModel::Nullable mPowerAdjustCapability; + DataModel::Nullable mForecast; +}; + +} // namespace DeviceEnergyManagement +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_dishwasher_alarm_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_dishwasher_alarm_delegate.cpp new file mode 100644 index 000000000..1ba4f6ac1 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_dishwasher_alarm_delegate.cpp @@ -0,0 +1,35 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_dishwasher_alarm_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace DishwasherAlarm { + +bool MockDishwasherAlarmDelegate::ModifyEnabledAlarmsCallback(const BitMask mask) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +bool MockDishwasherAlarmDelegate::ResetAlarmsCallback(const BitMask alarms) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +} // namespace DishwasherAlarm +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_dishwasher_alarm_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_dishwasher_alarm_delegate.h new file mode 100644 index 000000000..c220d55e4 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_dishwasher_alarm_delegate.h @@ -0,0 +1,44 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock DishwasherAlarm Delegate Implementation + * This file provides a mock implementation of the DishwasherAlarm::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/dishwasher-alarm-stub.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace DishwasherAlarm { + +class MockDishwasherAlarmDelegate : public Delegate { +public: + MockDishwasherAlarmDelegate() : Delegate() {} + MockDishwasherAlarmDelegate(EndpointId endpoint) : Delegate(endpoint) {} + virtual ~MockDishwasherAlarmDelegate() = default; + + // Dishwasher alarm callbacks + bool ModifyEnabledAlarmsCallback(const BitMask mask) override; + bool ResetAlarmsCallback(const BitMask alarms) override; + +private: + static constexpr const char * LOG_TAG = "MockDishwasherAlarmDelegate"; +}; + +} // namespace DishwasherAlarm +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_door_lock_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_door_lock_delegate.cpp new file mode 100644 index 000000000..e08af6f16 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_door_lock_delegate.cpp @@ -0,0 +1,102 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_door_lock_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace DoorLock { + +CHIP_ERROR MockDoorLockDelegate::GetAliroReaderVerificationKey(MutableByteSpan &verificationKey) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + verificationKey.reduce_size(0); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockDoorLockDelegate::GetAliroReaderGroupIdentifier(MutableByteSpan &groupIdentifier) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + groupIdentifier.reduce_size(0); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockDoorLockDelegate::GetAliroReaderGroupSubIdentifier(MutableByteSpan &groupSubIdentifier) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_FOUND; +} + +CHIP_ERROR MockDoorLockDelegate::GetAliroExpeditedTransactionSupportedProtocolVersionAtIndex(size_t index, MutableByteSpan &protocolVersion) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR MockDoorLockDelegate::GetAliroGroupResolvingKey(MutableByteSpan &groupResolvingKey) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + groupResolvingKey.reduce_size(0); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockDoorLockDelegate::GetAliroSupportedBLEUWBProtocolVersionAtIndex(size_t index, MutableByteSpan &protocolVersion) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +uint8_t MockDoorLockDelegate::GetAliroBLEAdvertisingVersion() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint16_t MockDoorLockDelegate::GetNumberOfAliroCredentialIssuerKeysSupported() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint16_t MockDoorLockDelegate::GetNumberOfAliroEndpointKeysSupported() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +CHIP_ERROR MockDoorLockDelegate::SetAliroReaderConfig(const ByteSpan &signingKey, const ByteSpan &verificationKey, + const ByteSpan &groupIdentifier, const Optional &groupResolvingKey) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockDoorLockDelegate::ClearAliroReaderConfig() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +} // namespace DoorLock +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_door_lock_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_door_lock_delegate.h new file mode 100644 index 000000000..66c504396 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_door_lock_delegate.h @@ -0,0 +1,52 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock DoorLock Delegate Implementation + * This file provides a mock implementation of the DoorLock::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/door-lock-server/door-lock-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/lock-app/lock-common/include/LockEndpoint.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/lock-app/lock-common/src/LockEndpoint.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace DoorLock { + +class MockDoorLockDelegate : public Delegate { +public: + MockDoorLockDelegate() = default; + + CHIP_ERROR GetAliroReaderVerificationKey(MutableByteSpan &verificationKey) override; + CHIP_ERROR GetAliroReaderGroupIdentifier(MutableByteSpan &groupIdentifier) override; + CHIP_ERROR GetAliroReaderGroupSubIdentifier(MutableByteSpan &groupSubIdentifier) override; + CHIP_ERROR GetAliroExpeditedTransactionSupportedProtocolVersionAtIndex(size_t index, MutableByteSpan &protocolVersion) override; + CHIP_ERROR GetAliroGroupResolvingKey(MutableByteSpan &groupResolvingKey) override; + CHIP_ERROR GetAliroSupportedBLEUWBProtocolVersionAtIndex(size_t index, MutableByteSpan &protocolVersion) override; + uint8_t GetAliroBLEAdvertisingVersion() override; + uint16_t GetNumberOfAliroCredentialIssuerKeysSupported() override; + uint16_t GetNumberOfAliroEndpointKeysSupported() override; + CHIP_ERROR SetAliroReaderConfig(const ByteSpan &signingKey, const ByteSpan &verificationKey, + const ByteSpan &groupIdentifier, const Optional &groupResolvingKey) override; + CHIP_ERROR ClearAliroReaderConfig() override; + +private: + const char *LOG_TAG = "door_lock"; +}; + +} // namespace DoorLock +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_electrical_grid_conditions_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_electrical_grid_conditions_delegate.cpp new file mode 100644 index 000000000..303db5c3b --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_electrical_grid_conditions_delegate.cpp @@ -0,0 +1,24 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_electrical_grid_conditions_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ElectricalGridConditions { + +// Note: This is a placeholder delegate with no delegated methods currently +// The implementation is empty as there are no virtual methods to override + +} // namespace ElectricalGridConditions +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_electrical_grid_conditions_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_electrical_grid_conditions_delegate.h new file mode 100644 index 000000000..3633aa482 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_electrical_grid_conditions_delegate.h @@ -0,0 +1,43 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock ElectricalGridConditions Delegate Implementation + * This file provides a mock implementation of the ElectricalGridConditions::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/electrical-grid-conditions-server/electrical-grid-conditions-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/energy-gateway-app/electrical-grid-conditions/include/ElectricalGridConditionsDelegate.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/energy-gateway-app/electrical-grid-conditions/src/ElectricalGridConditionsDelegate.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ElectricalGridConditions { + +class MockElectricalGridConditionsDelegate : public Delegate { +public: + MockElectricalGridConditionsDelegate() : Delegate() {} + virtual ~MockElectricalGridConditionsDelegate() = default; + + // Electrical grid conditions management + // Note: This is a placeholder delegate with no delegated methods currently + +private: + static constexpr const char * LOG_TAG = "MockElectricalGridConditionsDelegate"; +}; + +} // namespace ElectricalGridConditions +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_electrical_power_measurement_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_electrical_power_measurement_delegate.cpp new file mode 100644 index 000000000..eb3af8d4f --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_electrical_power_measurement_delegate.cpp @@ -0,0 +1,210 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_electrical_power_measurement_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ElectricalPowerMeasurement { + +PowerModeEnum MockElectricalPowerMeasurementDelegate::GetPowerMode() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return PowerModeEnum::kUnknownEnumValue; +} + +uint8_t MockElectricalPowerMeasurementDelegate::GetNumberOfMeasurementTypes() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +CHIP_ERROR MockElectricalPowerMeasurementDelegate::StartAccuracyRead() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockElectricalPowerMeasurementDelegate::GetAccuracyByIndex(uint8_t index, Structs::MeasurementAccuracyStruct::Type &accuracy) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR MockElectricalPowerMeasurementDelegate::EndAccuracyRead() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockElectricalPowerMeasurementDelegate::StartRangesRead() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockElectricalPowerMeasurementDelegate::GetRangeByIndex(uint8_t index, Structs::MeasurementRangeStruct::Type &range) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR MockElectricalPowerMeasurementDelegate::EndRangesRead() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockElectricalPowerMeasurementDelegate::StartHarmonicCurrentsRead() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockElectricalPowerMeasurementDelegate::GetHarmonicCurrentsByIndex(uint8_t index, Structs::HarmonicMeasurementStruct::Type &harmonic) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR MockElectricalPowerMeasurementDelegate::EndHarmonicCurrentsRead() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockElectricalPowerMeasurementDelegate::StartHarmonicPhasesRead() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockElectricalPowerMeasurementDelegate::GetHarmonicPhasesByIndex(uint8_t index, Structs::HarmonicMeasurementStruct::Type &harmonic) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR MockElectricalPowerMeasurementDelegate::EndHarmonicPhasesRead() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +DataModel::Nullable MockElectricalPowerMeasurementDelegate::GetVoltage() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockElectricalPowerMeasurementDelegate::GetActiveCurrent() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockElectricalPowerMeasurementDelegate::GetReactiveCurrent() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockElectricalPowerMeasurementDelegate::GetApparentCurrent() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockElectricalPowerMeasurementDelegate::GetActivePower() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockElectricalPowerMeasurementDelegate::GetReactivePower() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockElectricalPowerMeasurementDelegate::GetApparentPower() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockElectricalPowerMeasurementDelegate::GetRMSVoltage() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockElectricalPowerMeasurementDelegate::GetRMSCurrent() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockElectricalPowerMeasurementDelegate::GetRMSPower() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockElectricalPowerMeasurementDelegate::GetFrequency() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockElectricalPowerMeasurementDelegate::GetPowerFactor() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockElectricalPowerMeasurementDelegate::GetNeutralCurrent() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +} // namespace ElectricalPowerMeasurement +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_electrical_power_measurement_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_electrical_power_measurement_delegate.h new file mode 100644 index 000000000..dd62be5ef --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_electrical_power_measurement_delegate.h @@ -0,0 +1,73 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock ElectricalPowerMeasurement Delegate Implementation + * This file provides a mock implementation of the ElectricalPowerMeasurement::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/energy-reporting/include/ElectricalPowerMeasurementDelegate.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ElectricalPowerMeasurement { + +class MockElectricalPowerMeasurementDelegate : public Delegate { +public: + MockElectricalPowerMeasurementDelegate() = default; + virtual ~MockElectricalPowerMeasurementDelegate() = default; + + // Delegate interface + PowerModeEnum GetPowerMode() override; + uint8_t GetNumberOfMeasurementTypes() override; + + CHIP_ERROR StartAccuracyRead() override; + CHIP_ERROR GetAccuracyByIndex(uint8_t index, Structs::MeasurementAccuracyStruct::Type &accuracy) override; + CHIP_ERROR EndAccuracyRead() override; + + CHIP_ERROR StartRangesRead() override; + CHIP_ERROR GetRangeByIndex(uint8_t index, Structs::MeasurementRangeStruct::Type &range) override; + CHIP_ERROR EndRangesRead() override; + + CHIP_ERROR StartHarmonicCurrentsRead() override; + CHIP_ERROR GetHarmonicCurrentsByIndex(uint8_t index, Structs::HarmonicMeasurementStruct::Type &harmonic) override; + CHIP_ERROR EndHarmonicCurrentsRead() override; + + CHIP_ERROR StartHarmonicPhasesRead() override; + CHIP_ERROR GetHarmonicPhasesByIndex(uint8_t index, Structs::HarmonicMeasurementStruct::Type &harmonic) override; + CHIP_ERROR EndHarmonicPhasesRead() override; + + DataModel::Nullable GetVoltage() override; + DataModel::Nullable GetActiveCurrent() override; + DataModel::Nullable GetReactiveCurrent() override; + DataModel::Nullable GetApparentCurrent() override; + DataModel::Nullable GetActivePower() override; + DataModel::Nullable GetReactivePower() override; + DataModel::Nullable GetApparentPower() override; + DataModel::Nullable GetRMSVoltage() override; + DataModel::Nullable GetRMSCurrent() override; + DataModel::Nullable GetRMSPower() override; + DataModel::Nullable GetFrequency() override; + DataModel::Nullable GetPowerFactor() override; + DataModel::Nullable GetNeutralCurrent() override; +private: + static constexpr const char * LOG_TAG = "MockElectricalPowerMeasurementDelegate"; +}; + +} // namespace ElectricalPowerMeasurement +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_energy_evse_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_energy_evse_delegate.cpp new file mode 100644 index 000000000..1749d2d9e --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_energy_evse_delegate.cpp @@ -0,0 +1,217 @@ +#include "mock_energy_evse_delegate.h" +#include "esp_log.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace EnergyEvse { + +Protocols::InteractionModel::Status MockEnergyEVSEDelegate::Disable() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockEnergyEVSEDelegate::EnableCharging(const DataModel::Nullable &enableChargeTime, const int64_t &minimumChargeCurrent, + const int64_t &maximumChargeCurrent) +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockEnergyEVSEDelegate::EnableDischarging(const DataModel::Nullable &enableDischargeTime, const int64_t &maximumDischargeCurrent) +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockEnergyEVSEDelegate::StartDiagnostics() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockEnergyEVSEDelegate::SetTargets(const DataModel::DecodableList &chargingTargetSchedules) +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockEnergyEVSEDelegate::LoadTargets() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockEnergyEVSEDelegate::GetTargets(DataModel::List &chargingTargetSchedules) +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockEnergyEVSEDelegate::ClearTargets() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +StateEnum MockEnergyEVSEDelegate::GetState() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return StateEnum::kUnknownEnumValue; +} + +SupplyStateEnum MockEnergyEVSEDelegate::GetSupplyState() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return SupplyStateEnum::kUnknownEnumValue; +} + +FaultStateEnum MockEnergyEVSEDelegate::GetFaultState() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return FaultStateEnum::kNoError; +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetChargingEnabledUntil() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetDischargingEnabledUntil() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +int64_t MockEnergyEVSEDelegate::GetCircuitCapacity() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +int64_t MockEnergyEVSEDelegate::GetMinimumChargeCurrent() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +int64_t MockEnergyEVSEDelegate::GetMaximumChargeCurrent() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +int64_t MockEnergyEVSEDelegate::GetMaximumDischargeCurrent() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +int64_t MockEnergyEVSEDelegate::GetUserMaximumChargeCurrent() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint32_t MockEnergyEVSEDelegate::GetRandomizationDelayWindow() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetNextChargeStartTime() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetNextChargeTargetTime() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetNextChargeRequiredEnergy() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetNextChargeTargetSoC() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetApproximateEVEfficiency() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetStateOfCharge() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetBatteryCapacity() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetVehicleID() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetSessionID() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetSessionDuration() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetSessionEnergyCharged() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +DataModel::Nullable MockEnergyEVSEDelegate::GetSessionEnergyDischarged() +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +CHIP_ERROR MockEnergyEVSEDelegate::SetUserMaximumChargeCurrent(int64_t aNewValue) +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockEnergyEVSEDelegate::SetRandomizationDelayWindow(uint32_t aNewValue) +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockEnergyEVSEDelegate::SetApproximateEVEfficiency(DataModel::Nullable aNewValue) +{ + ESP_LOGI(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +} // namespace EnergyEvse +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_energy_evse_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_energy_evse_delegate.h new file mode 100644 index 000000000..bb7287020 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_energy_evse_delegate.h @@ -0,0 +1,98 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock EnergyEVSE Delegate Implementation + * This file provides a mock implementation of the EnergyEVSE::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/energy-evse-server/energy-evse-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/energy-evse/include/EnergyEvseDelegateImpl.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace EnergyEvse { + +class MockEnergyEVSEDelegate : public Delegate { +public: + MockEnergyEVSEDelegate() = default; + + Protocols::InteractionModel::Status Disable() override; + + Protocols::InteractionModel::Status EnableCharging(const DataModel::Nullable &enableChargeTime, + const int64_t &minimumChargeCurrent, + const int64_t &maximumChargeCurrent) override; + + Protocols::InteractionModel::Status EnableDischarging(const DataModel::Nullable &enableDischargeTime, + const int64_t &maximumDischargeCurrent) override; + + Protocols::InteractionModel::Status StartDiagnostics() override; + + Protocols::InteractionModel::Status + SetTargets(const DataModel::DecodableList &chargingTargetSchedules) override; + + Protocols::InteractionModel::Status LoadTargets() override; + + Protocols::InteractionModel::Status + GetTargets(DataModel::List &chargingTargetSchedules) override; + + Protocols::InteractionModel::Status ClearTargets() override; + + // ------------------------------------------------------------------ + // Get attribute methods + StateEnum GetState() override; + SupplyStateEnum GetSupplyState() override; + FaultStateEnum GetFaultState() override; + DataModel::Nullable GetChargingEnabledUntil() override; + DataModel::Nullable GetDischargingEnabledUntil() override; + int64_t GetCircuitCapacity() override; + int64_t GetMinimumChargeCurrent() override; + int64_t GetMaximumChargeCurrent() override; + int64_t GetMaximumDischargeCurrent() override; + int64_t GetUserMaximumChargeCurrent() override; + uint32_t GetRandomizationDelayWindow() override; + /* PREF attributes */ + DataModel::Nullable GetNextChargeStartTime() override; + DataModel::Nullable GetNextChargeTargetTime() override; + DataModel::Nullable GetNextChargeRequiredEnergy() override; + DataModel::Nullable GetNextChargeTargetSoC() override; + DataModel::Nullable GetApproximateEVEfficiency() override; + + /* SOC attributes */ + DataModel::Nullable GetStateOfCharge() override; + DataModel::Nullable GetBatteryCapacity() override; + + /* PNC attributes*/ + DataModel::Nullable GetVehicleID() override; + + /* Session SESS attributes */ + DataModel::Nullable GetSessionID() override; + DataModel::Nullable GetSessionDuration() override; + DataModel::Nullable GetSessionEnergyCharged() override; + DataModel::Nullable GetSessionEnergyDischarged() override; + + // ------------------------------------------------------------------ + // Set attribute methods + CHIP_ERROR SetUserMaximumChargeCurrent(int64_t aNewValue) override; + CHIP_ERROR SetRandomizationDelayWindow(uint32_t aNewValue) override; + CHIP_ERROR SetApproximateEVEfficiency(DataModel::Nullable aNewValue) override; +private: + static constexpr const char * LOG_TAG = "energy-evse"; +}; + +} // namespace EnergyEvse +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_fan_control_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_fan_control_delegate.cpp new file mode 100644 index 000000000..c8807af7e --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_fan_control_delegate.cpp @@ -0,0 +1,28 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_fan_control_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace FanControl { + +Protocols::InteractionModel::Status MockFanControlDelegate::HandleStep(StepDirectionEnum aDirection, bool aWrap, bool aLowestOff) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +} // namespace FanControl +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_fan_control_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_fan_control_delegate.h new file mode 100644 index 000000000..2248d000c --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_fan_control_delegate.h @@ -0,0 +1,44 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include +#include + +/* + * Mock FanControl Delegate Implementation + * This file provides a mock implementation of the FanControl::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/fan-control-server/fan-control-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace FanControl { + +class MockFanControlDelegate : public Delegate { +public: + MockFanControlDelegate() : Delegate(kInvalidEndpointId) {} + MockFanControlDelegate(EndpointId aEndpoint) : Delegate(aEndpoint) {} + virtual ~MockFanControlDelegate() = default; + + // Fan control command handlers + Protocols::InteractionModel::Status HandleStep(StepDirectionEnum aDirection, bool aWrap, bool aLowestOff) override; + +private: + static constexpr const char * LOG_TAG = "MockFanControlDelegate"; +}; + +} // namespace FanControl +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_keypad_input_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_keypad_input_delegate.cpp new file mode 100644 index 000000000..be4f5809e --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_keypad_input_delegate.cpp @@ -0,0 +1,37 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_keypad_input_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace KeypadInput { + +void MockKeypadInputDelegate::HandleSendKey(CommandResponseHelper &helper, const CECKeyCodeEnum &keyCode) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::SendKeyResponse::Type response; + response.status = KeypadInputStatusEnum::kSuccess; + helper.Success(response); +} + +uint32_t MockKeypadInputDelegate::GetFeatureMap(chip::EndpointId endpoint) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +} // namespace KeypadInput +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_keypad_input_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_keypad_input_delegate.h new file mode 100644 index 000000000..fa7d7e39a --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_keypad_input_delegate.h @@ -0,0 +1,44 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +#include + +/* + * Mock KeypadInput Delegate Implementation + * This file provides a mock implementation of the KeypadInput::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/keypad-input-server/keypad-input-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/keypad-input/KeypadInputManager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/keypad-input/KeypadInputManager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace KeypadInput { + +class MockKeypadInputDelegate : public Delegate { +public: + MockKeypadInputDelegate() = default; + + void HandleSendKey(CommandResponseHelper &helper, const CECKeyCodeEnum &keyCode) override; + uint32_t GetFeatureMap(chip::EndpointId endpoint) override; + +private: + const char *LOG_TAG = "keypad_input"; +}; + +} // namespace KeypadInput +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_laundry_dryer_controls_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_laundry_dryer_controls_delegate.cpp new file mode 100644 index 000000000..ac029b75d --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_laundry_dryer_controls_delegate.cpp @@ -0,0 +1,28 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_laundry_dryer_controls_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace LaundryDryerControls { + +CHIP_ERROR MockLaundryDryerControlsDelegate::GetSupportedDrynessLevelAtIndex(size_t index, DrynessLevelEnum &supportedDryness) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +} // namespace LaundryDryerControls +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_laundry_dryer_controls_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_laundry_dryer_controls_delegate.h new file mode 100644 index 000000000..3a7c75a87 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_laundry_dryer_controls_delegate.h @@ -0,0 +1,43 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock LaundryDryerControls Delegate Implementation + * This file provides a mock implementation of the LaundryDryerControls::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/include/laundry-dryer-controls-delegate-impl.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/laundry-dryer-controls-delegate-impl.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace LaundryDryerControls { + +class MockLaundryDryerControlsDelegate : public Delegate { +public: + MockLaundryDryerControlsDelegate() : Delegate() {} + virtual ~MockLaundryDryerControlsDelegate() = default; + + // Laundry dryer controls management + CHIP_ERROR GetSupportedDrynessLevelAtIndex(size_t index, DrynessLevelEnum &supportedDryness) override; + +private: + static constexpr const char * LOG_TAG = "MockLaundryDryerControlsDelegate"; +}; + +} // namespace LaundryDryerControls +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_laundry_washer_controls_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_laundry_washer_controls_delegate.cpp new file mode 100644 index 000000000..84e70ecd9 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_laundry_washer_controls_delegate.cpp @@ -0,0 +1,35 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_laundry_washer_controls_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace LaundryWasherControls { + +CHIP_ERROR MockLaundryWasherControlsDelegate::GetSpinSpeedAtIndex(size_t index, MutableCharSpan &spinSpeed) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR MockLaundryWasherControlsDelegate::GetSupportedRinseAtIndex(size_t index, NumberOfRinsesEnum &supportedRinse) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +} // namespace LaundryWasherControls +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_laundry_washer_controls_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_laundry_washer_controls_delegate.h new file mode 100644 index 000000000..c37f7f682 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_laundry_washer_controls_delegate.h @@ -0,0 +1,44 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock LaundryWasherControls Delegate Implementation + * This file provides a mock implementation of the LaundryWasherControls::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/include/laundry-washer-controls-delegate-impl.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace LaundryWasherControls { + +class MockLaundryWasherControlsDelegate : public Delegate { +public: + MockLaundryWasherControlsDelegate() : Delegate() {} + virtual ~MockLaundryWasherControlsDelegate() = default; + + // Laundry washer controls management + CHIP_ERROR GetSpinSpeedAtIndex(size_t index, MutableCharSpan &spinSpeed) override; + CHIP_ERROR GetSupportedRinseAtIndex(size_t index, NumberOfRinsesEnum &supportedRinse) override; + +private: + static constexpr const char * LOG_TAG = "MockLaundryWasherControlsDelegate"; +}; + +} // namespace LaundryWasherControls +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_low_power_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_low_power_delegate.cpp new file mode 100644 index 000000000..a9e641bbb --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_low_power_delegate.cpp @@ -0,0 +1,28 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_low_power_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace LowPower { + +bool MockLowPowerDelegate::HandleSleep() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +} // namespace LowPower +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_low_power_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_low_power_delegate.h new file mode 100644 index 000000000..76147f2cc --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_low_power_delegate.h @@ -0,0 +1,41 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock LowPower Delegate Implementation + * This file provides a mock implementation of the LowPower::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/low-power-server/low-power-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/low-power/LowPowerManager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/low-power/LowPowerManager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace LowPower { + +class MockLowPowerDelegate : public Delegate { +public: + MockLowPowerDelegate() = default; + + bool HandleSleep() override; + +private: + const char *LOG_TAG = "low_power"; +}; + +} // namespace LowPower +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_media_input_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_media_input_delegate.cpp new file mode 100644 index 000000000..06a073ce2 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_media_input_delegate.cpp @@ -0,0 +1,63 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_media_input_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace MediaInput { + +CHIP_ERROR MockMediaInputDelegate::HandleGetInputList(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeEmptyList(); +} + +uint8_t MockMediaInputDelegate::HandleGetCurrentInput() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +bool MockMediaInputDelegate::HandleSelectInput(const uint8_t index) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +bool MockMediaInputDelegate::HandleShowInputStatus() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +bool MockMediaInputDelegate::HandleHideInputStatus() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +bool MockMediaInputDelegate::HandleRenameInput(const uint8_t index, const chip::CharSpan &name) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +} // namespace MediaInput +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_media_input_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_media_input_delegate.h new file mode 100644 index 000000000..b7b737718 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_media_input_delegate.h @@ -0,0 +1,46 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock MediaInput Delegate Implementation + * This file provides a mock implementation of the MediaInput::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/media-input-server/media-input-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/media-input/MediaInputManager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/media-input/MediaInputManager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace MediaInput { + +class MockMediaInputDelegate : public Delegate { +public: + MockMediaInputDelegate() = default; + + CHIP_ERROR HandleGetInputList(app::AttributeValueEncoder &aEncoder) override; + uint8_t HandleGetCurrentInput() override; + bool HandleSelectInput(const uint8_t index) override; + bool HandleShowInputStatus() override; + bool HandleHideInputStatus() override; + bool HandleRenameInput(const uint8_t index, const chip::CharSpan &name) override; + +private: + const char *LOG_TAG = "media_input"; +}; + +} // namespace MediaInput +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_media_playback_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_media_playback_delegate.cpp new file mode 100644 index 000000000..a0b1c42d3 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_media_playback_delegate.cpp @@ -0,0 +1,237 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_media_playback_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace MediaPlayback { + +PlaybackStateEnum MockMediaPlaybackDelegate::HandleGetCurrentState() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return PlaybackStateEnum::kPlaying; +} + +uint64_t MockMediaPlaybackDelegate::HandleGetStartTime() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint64_t MockMediaPlaybackDelegate::HandleGetDuration() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +CHIP_ERROR MockMediaPlaybackDelegate::HandleGetSampledPosition(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeNull(); +} + +float MockMediaPlaybackDelegate::HandleGetPlaybackSpeed() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 1.0f; +} + +uint64_t MockMediaPlaybackDelegate::HandleGetSeekRangeStart() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint64_t MockMediaPlaybackDelegate::HandleGetSeekRangeEnd() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +CHIP_ERROR MockMediaPlaybackDelegate::HandleGetActiveAudioTrack(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeNull(); +} + +CHIP_ERROR MockMediaPlaybackDelegate::HandleGetAvailableAudioTracks(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeEmptyList(); +} + +CHIP_ERROR MockMediaPlaybackDelegate::HandleGetActiveTextTrack(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeNull(); +} + +CHIP_ERROR MockMediaPlaybackDelegate::HandleGetAvailableTextTracks(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeEmptyList(); +} + +void MockMediaPlaybackDelegate::HandlePlay(CommandResponseHelper &helper) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::PlaybackResponse::Type response; + response.status = MediaPlaybackStatusEnum::kSuccess; + helper.Success(response); +} + +void MockMediaPlaybackDelegate::HandlePause(CommandResponseHelper &helper) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::PlaybackResponse::Type response; + response.status = MediaPlaybackStatusEnum::kSuccess; + helper.Success(response); +} + +void MockMediaPlaybackDelegate::HandleStop(CommandResponseHelper &helper) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::PlaybackResponse::Type response; + response.status = MediaPlaybackStatusEnum::kSuccess; + helper.Success(response); +} + +void MockMediaPlaybackDelegate::HandleFastForward(CommandResponseHelper &helper, + const chip::Optional &audioAdvanceUnmuted) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::PlaybackResponse::Type response; + response.status = MediaPlaybackStatusEnum::kSuccess; + helper.Success(response); +} + +void MockMediaPlaybackDelegate::HandlePrevious(CommandResponseHelper &helper) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::PlaybackResponse::Type response; + response.status = MediaPlaybackStatusEnum::kSuccess; + helper.Success(response); +} + +void MockMediaPlaybackDelegate::HandleRewind(CommandResponseHelper &helper, + const chip::Optional &audioAdvanceUnmuted) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::PlaybackResponse::Type response; + response.status = MediaPlaybackStatusEnum::kSuccess; + helper.Success(response); +} + +void MockMediaPlaybackDelegate::HandleSkipBackward(CommandResponseHelper &helper, + const uint64_t &deltaPositionMilliseconds) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::PlaybackResponse::Type response; + response.status = MediaPlaybackStatusEnum::kSuccess; + helper.Success(response); +} + +void MockMediaPlaybackDelegate::HandleSkipForward(CommandResponseHelper &helper, + const uint64_t &deltaPositionMilliseconds) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::PlaybackResponse::Type response; + response.status = MediaPlaybackStatusEnum::kSuccess; + helper.Success(response); +} + +void MockMediaPlaybackDelegate::HandleSeek(CommandResponseHelper &helper, + const uint64_t &positionMilliseconds) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::PlaybackResponse::Type response; + response.status = MediaPlaybackStatusEnum::kSuccess; + helper.Success(response); +} + +void MockMediaPlaybackDelegate::HandleNext(CommandResponseHelper &helper) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::PlaybackResponse::Type response; + response.status = MediaPlaybackStatusEnum::kSuccess; + helper.Success(response); +} + +void MockMediaPlaybackDelegate::HandleStartOver(CommandResponseHelper &helper) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::PlaybackResponse::Type response; + response.status = MediaPlaybackStatusEnum::kSuccess; + helper.Success(response); +} + +bool MockMediaPlaybackDelegate::HandleActivateAudioTrack(const chip::CharSpan &trackId, const uint8_t &audioOutputIndex) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +bool MockMediaPlaybackDelegate::HandleActivateTextTrack(const chip::CharSpan &trackId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +bool MockMediaPlaybackDelegate::HandleDeactivateTextTrack() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +uint32_t MockMediaPlaybackDelegate::GetFeatureMap(chip::EndpointId endpoint) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint16_t MockMediaPlaybackDelegate::GetClusterRevision(chip::EndpointId endpoint) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +} // namespace MediaPlayback +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_media_playback_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_media_playback_delegate.h new file mode 100644 index 000000000..920157f4a --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_media_playback_delegate.h @@ -0,0 +1,74 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock MediaPlayback Delegate Implementation + * This file provides a mock implementation of the MediaPlayback::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/media-playback-server/media-playback-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/media-playback/MediaPlaybackManager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/media-playback/MediaPlaybackManager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace MediaPlayback { + +class MockMediaPlaybackDelegate : public Delegate { +public: + MockMediaPlaybackDelegate() = default; + + PlaybackStateEnum HandleGetCurrentState() override; + uint64_t HandleGetStartTime() override; + uint64_t HandleGetDuration() override; + CHIP_ERROR HandleGetSampledPosition(app::AttributeValueEncoder &aEncoder) override; + float HandleGetPlaybackSpeed() override; + uint64_t HandleGetSeekRangeStart() override; + uint64_t HandleGetSeekRangeEnd() override; + CHIP_ERROR HandleGetActiveAudioTrack(app::AttributeValueEncoder &aEncoder) override; + CHIP_ERROR HandleGetAvailableAudioTracks(app::AttributeValueEncoder &aEncoder) override; + CHIP_ERROR HandleGetActiveTextTrack(app::AttributeValueEncoder &aEncoder) override; + CHIP_ERROR HandleGetAvailableTextTracks(app::AttributeValueEncoder &aEncoder) override; + + void HandlePlay(CommandResponseHelper &helper) override; + void HandlePause(CommandResponseHelper &helper) override; + void HandleStop(CommandResponseHelper &helper) override; + void HandleFastForward(CommandResponseHelper &helper, + const chip::Optional &audioAdvanceUnmuted) override; + void HandlePrevious(CommandResponseHelper &helper) override; + void HandleRewind(CommandResponseHelper &helper, + const chip::Optional &audioAdvanceUnmuted) override; + void HandleSkipBackward(CommandResponseHelper &helper, + const uint64_t &deltaPositionMilliseconds) override; + void HandleSkipForward(CommandResponseHelper &helper, + const uint64_t &deltaPositionMilliseconds) override; + void HandleSeek(CommandResponseHelper &helper, + const uint64_t &positionMilliseconds) override; + void HandleNext(CommandResponseHelper &helper) override; + void HandleStartOver(CommandResponseHelper &helper) override; + bool HandleActivateAudioTrack(const chip::CharSpan &trackId, const uint8_t &audioOutputIndex) override; + bool HandleActivateTextTrack(const chip::CharSpan &trackId) override; + bool HandleDeactivateTextTrack() override; + + uint32_t GetFeatureMap(chip::EndpointId endpoint) override; + uint16_t GetClusterRevision(chip::EndpointId endpoint) override; + +private: + const char *LOG_TAG = "media_playback"; +}; + +} // namespace MediaPlayback +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_messages_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_messages_delegate.cpp new file mode 100644 index 000000000..7003f4b8e --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_messages_delegate.cpp @@ -0,0 +1,61 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_messages_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace Messages { + +CHIP_ERROR MockMessagesDelegate::HandlePresentMessagesRequest( + const ByteSpan &messageId, const MessagePriorityEnum &priority, + const chip::BitMask &messageControl, const DataModel::Nullable &startTime, + const DataModel::Nullable &duration, const CharSpan &messageText, + const chip::Optional> & + responses) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockMessagesDelegate::HandleCancelMessagesRequest(const DataModel::DecodableList &messageIds) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockMessagesDelegate::HandleGetMessages(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeEmptyList(); +} + +CHIP_ERROR MockMessagesDelegate::HandleGetActiveMessageIds(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeEmptyList(); +} + +uint32_t MockMessagesDelegate::GetFeatureMap(chip::EndpointId endpoint) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +} // namespace Messages +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_messages_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_messages_delegate.h new file mode 100644 index 000000000..bc8219871 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_messages_delegate.h @@ -0,0 +1,52 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock Messages Delegate Implementation + * This file provides a mock implementation of the Messages::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/messages-server/messages-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/messages/MessagesManager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/messages/MessagesManager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace Messages { + +class MockMessagesDelegate : public Delegate { +public: + MockMessagesDelegate() = default; + + CHIP_ERROR HandlePresentMessagesRequest( + const ByteSpan &messageId, const MessagePriorityEnum &priority, + const chip::BitMask &messageControl, const DataModel::Nullable &startTime, + const DataModel::Nullable &duration, const CharSpan &messageText, + const chip::Optional> & + responses) override; + CHIP_ERROR HandleCancelMessagesRequest(const DataModel::DecodableList &messageIds) override; + + CHIP_ERROR HandleGetMessages(app::AttributeValueEncoder &aEncoder) override; + CHIP_ERROR HandleGetActiveMessageIds(app::AttributeValueEncoder &aEncoder) override; + + uint32_t GetFeatureMap(chip::EndpointId endpoint) override; + +private: + const char *LOG_TAG = "messages"; +}; + +} // namespace Messages +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_microwave_oven_control_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_microwave_oven_control_delegate.cpp new file mode 100644 index 000000000..7dfd6deb1 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_microwave_oven_control_delegate.cpp @@ -0,0 +1,94 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_microwave_oven_control_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace MicrowaveOvenControl { + +Protocols::InteractionModel::Status MockMicrowaveOvenControlDelegate::HandleSetCookingParametersCallback(uint8_t cookMode, uint32_t cookTimeSec, + bool startAfterSetting, + Optional powerSettingNum, + Optional wattSettingIndex) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockMicrowaveOvenControlDelegate::HandleModifyCookTimeSecondsCallback(uint32_t finalCookTimeSec) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +CHIP_ERROR MockMicrowaveOvenControlDelegate::GetWattSettingByIndex(uint8_t index, uint16_t &wattSetting) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_FOUND; +} + +uint32_t MockMicrowaveOvenControlDelegate::GetMaxCookTimeSec() const +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint8_t MockMicrowaveOvenControlDelegate::GetPowerSettingNum() const +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint8_t MockMicrowaveOvenControlDelegate::GetMinPowerNum() const +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint8_t MockMicrowaveOvenControlDelegate::GetMaxPowerNum() const +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint8_t MockMicrowaveOvenControlDelegate::GetPowerStepNum() const +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint8_t MockMicrowaveOvenControlDelegate::GetCurrentWattIndex() const +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint16_t MockMicrowaveOvenControlDelegate::GetWattRating() const +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +} // namespace MicrowaveOvenControl +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_microwave_oven_control_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_microwave_oven_control_delegate.h new file mode 100644 index 000000000..db1fec655 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_microwave_oven_control_delegate.h @@ -0,0 +1,57 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock MicrowaveOvenControl Delegate Implementation + * This file provides a mock implementation of the MicrowaveOvenControl::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace MicrowaveOvenControl { + +class MockMicrowaveOvenControlDelegate : public Delegate { +public: + MockMicrowaveOvenControlDelegate() = default; + virtual ~MockMicrowaveOvenControlDelegate() = default; + + // Delegate interface + Protocols::InteractionModel::Status HandleSetCookingParametersCallback(uint8_t cookMode, uint32_t cookTimeSec, + bool startAfterSetting, + Optional powerSettingNum, + Optional wattSettingIndex) override; + + Protocols::InteractionModel::Status HandleModifyCookTimeSecondsCallback(uint32_t finalCookTimeSec) override; + + CHIP_ERROR GetWattSettingByIndex(uint8_t index, uint16_t &wattSetting) override; + + uint32_t GetMaxCookTimeSec() const override; + uint8_t GetPowerSettingNum() const override; + uint8_t GetMinPowerNum() const override; + uint8_t GetMaxPowerNum() const override; + uint8_t GetPowerStepNum() const override; + uint8_t GetCurrentWattIndex() const override; + uint16_t GetWattRating() const override; +private: + static constexpr const char * LOG_TAG = "MockMicrowaveOvenControlDelegate"; +}; + +} // namespace MicrowaveOvenControl +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_mode_base_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_mode_base_delegate.cpp new file mode 100644 index 000000000..6b3532e39 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_mode_base_delegate.cpp @@ -0,0 +1,57 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_mode_base_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ModeBase { + +CHIP_ERROR MockModeBaseDelegate::Init() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockModeBaseDelegate::GetModeLabelByIndex(uint8_t modeIndex, MutableCharSpan &label) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR MockModeBaseDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t &value) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR MockModeBaseDelegate::GetModeTagsByIndex(uint8_t modeIndex, DataModel::List &modeTags) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +void MockModeBaseDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::ChangeToModeResponse::Type &response) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + response.status = to_underlying(StatusCode::kSuccess); + return; +} + +} // namespace ModeBase +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_mode_base_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_mode_base_delegate.h new file mode 100644 index 000000000..3c01a191b --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_mode_base_delegate.h @@ -0,0 +1,82 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock Delegate for all clusters derived from ModeBase cluster: + * ModeEVSE, ModeOven, ModeRVSRun, ModeRVSClean, ModeDishwasher, ModeWaterHeater, ModeRefrigerator, ModeLaundryWasher and ModeMicrowaveOven clusters. + * This file provides a mock implementation of the ModeBase Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/mode-base-server/mode-base-server.h + * 2. Delegate Implementation: + * ModeEVSE: + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/energy-evse/include/energy-evse-modes.h + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/energy-evse/src/energy-evse-mode.cpp + * + * ModeOven: + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/include/oven-modes.h + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp + * + * ModeRVSRun, ModeRVSClean: + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/rvc-app/rvc-common/include/rvc-mode-delegates.h + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/rvc-app/rvc-common/src/rvc-mode-delegates.cpp + * + * ModeDishwasher: + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/include/dishwasher-mode.h + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp + * + * ModeWaterHeater: + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/water-heater/include/water-heater-mode.h + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/water-heater/src/water-heater-mode.cpp + * + * ModeRefrigerator: + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/include/tcc-mode.h + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp + * + * ModeLaundryWasher: + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/include/laundry-washer-mode.h + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp + * + * ModeRefrigerator: + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/include/microwave-oven-mode.h + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/microwave-oven-mode.cpp + * + * ModeDeviceEnergyManagement: + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/device-energy-management/include/device-energy-management-modes.h + * https://github.com/espressif/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/device-energy-management/src/device-energy-management-mode.cpp + * + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ModeBase { + +class MockModeBaseDelegate : public Delegate { +public: + MockModeBaseDelegate() = default; + + CHIP_ERROR Init() override; + CHIP_ERROR GetModeLabelByIndex(uint8_t modeIndex, MutableCharSpan &label) override; + CHIP_ERROR GetModeValueByIndex(uint8_t modeIndex, uint8_t &value) override; + CHIP_ERROR GetModeTagsByIndex(uint8_t modeIndex, DataModel::List &modeTags) override; + void HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::ChangeToModeResponse::Type &response) override; + +private: + const char *LOG_TAG = "mode_base"; +}; + +} // namespace ModeBase +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_operational_state_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_operational_state_delegate.cpp new file mode 100644 index 000000000..53df29d28 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_operational_state_delegate.cpp @@ -0,0 +1,74 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_operational_state_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace OperationalState { + +app::DataModel::Nullable MockOperationalStateDelegate::GetCountdownTime() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return app::DataModel::Nullable(); +} + +CHIP_ERROR MockOperationalStateDelegate::GetOperationalStateAtIndex(size_t index, GenericOperationalState &operationalState) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_FOUND; +} + +CHIP_ERROR MockOperationalStateDelegate::GetOperationalPhaseAtIndex(size_t index, MutableCharSpan &operationalPhase) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_FOUND; +} + +void MockOperationalStateDelegate::HandlePauseStateCallback(GenericOperationalError &err) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + err.Set(to_underlying(ErrorStateEnum::kNoError)); + return; +} + +void MockOperationalStateDelegate::HandleResumeStateCallback(GenericOperationalError &err) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + err.Set(to_underlying(ErrorStateEnum::kNoError)); + return; +} + +void MockOperationalStateDelegate::HandleStartStateCallback(GenericOperationalError &err) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + err.Set(to_underlying(ErrorStateEnum::kNoError)); + return; +} + +void MockOperationalStateDelegate::HandleStopStateCallback(GenericOperationalError &err) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + err.Set(to_underlying(ErrorStateEnum::kNoError)); + return; +} + +} // namespace OperationalState +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_operational_state_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_operational_state_delegate.h new file mode 100644 index 000000000..adef61d78 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_operational_state_delegate.h @@ -0,0 +1,52 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include +#include + +/* + * Mock OperationalState Delegate Implementation + * This file provides a mock implementation of the OperationalState::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/operational-state-server/operational-state-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/include/operational-state-delegate-impl.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace OperationalState { + +class MockOperationalStateDelegate : public Delegate { +public: + MockOperationalStateDelegate() = default; + virtual ~MockOperationalStateDelegate() = default; + + // Operational state management + app::DataModel::Nullable GetCountdownTime() override; + CHIP_ERROR GetOperationalStateAtIndex(size_t index, GenericOperationalState &operationalState) override; + CHIP_ERROR GetOperationalPhaseAtIndex(size_t index, MutableCharSpan &operationalPhase) override; + + // Command callbacks + void HandlePauseStateCallback(GenericOperationalError &err) override; + void HandleResumeStateCallback(GenericOperationalError &err) override; + void HandleStartStateCallback(GenericOperationalError &err) override; + void HandleStopStateCallback(GenericOperationalError &err) override; + +private: + static constexpr const char * LOG_TAG = "MockOperationalStateDelegate"; +}; + +} // namespace OperationalState +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_power_topology_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_power_topology_delegate.cpp new file mode 100644 index 000000000..46eb52a42 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_power_topology_delegate.cpp @@ -0,0 +1,35 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_power_topology_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace PowerTopology { + +CHIP_ERROR MockPowerTopologyDelegate::GetAvailableEndpointAtIndex(size_t index, EndpointId &endpointId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR MockPowerTopologyDelegate::GetActiveEndpointAtIndex(size_t index, EndpointId &endpointId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +} // namespace PowerTopology +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_power_topology_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_power_topology_delegate.h new file mode 100644 index 000000000..ca00f21ea --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_power_topology_delegate.h @@ -0,0 +1,43 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock PowerTopology Delegate Implementation + * This file provides a mock implementation of the PowerTopology::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/power-topology-server/power-topology-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/power-topology-stub.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace PowerTopology { + +class MockPowerTopologyDelegate : public Delegate { +public: + MockPowerTopologyDelegate() = default; + virtual ~MockPowerTopologyDelegate() = default; + + // Delegate interface + CHIP_ERROR GetAvailableEndpointAtIndex(size_t index, EndpointId &endpointId) override; + CHIP_ERROR GetActiveEndpointAtIndex(size_t index, EndpointId &endpointId) override; + +private: + static constexpr const char * LOG_TAG = "MockPowerTopologyDelegate"; +}; + +} // namespace PowerTopology +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_push_av_stream_transport_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_push_av_stream_transport_delegate.cpp new file mode 100644 index 000000000..eb33f724e --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_push_av_stream_transport_delegate.cpp @@ -0,0 +1,179 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_push_av_stream_transport_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { + +Protocols::InteractionModel::Status MockPushAvStreamTransportDelegate::AllocatePushTransport( + const PushAvStreamTransport::Structs::TransportOptionsStruct::Type &transportOptions, const uint16_t connectionID, + FabricIndex accessingFabricIndex) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockPushAvStreamTransportDelegate::DeallocatePushTransport(const uint16_t connectionID) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockPushAvStreamTransportDelegate::ModifyPushTransport( + const uint16_t connectionID, const PushAvStreamTransport::TransportOptionsStorage transportOptions) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status +MockPushAvStreamTransportDelegate::SetTransportStatus(const std::vector connectionIDList, + PushAvStreamTransport::TransportStatusEnum transportStatus) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockPushAvStreamTransportDelegate::ManuallyTriggerTransport( + const uint16_t connectionID, PushAvStreamTransport::TriggerActivationReasonEnum activationReason, + const Optional &timeControl) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +bool MockPushAvStreamTransportDelegate::ValidateStreamUsage(PushAvStreamTransport::StreamUsageEnum streamUsage) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +bool MockPushAvStreamTransportDelegate::ValidateSegmentDuration(uint16_t segmentDuration, + const Optional> &videoStreamId) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +Protocols::InteractionModel::Status +MockPushAvStreamTransportDelegate::ValidateBandwidthLimit(PushAvStreamTransport::StreamUsageEnum streamUsage, + const Optional> &videoStreamId, + const Optional> &audioStreamId) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status +MockPushAvStreamTransportDelegate::SelectVideoStream(PushAvStreamTransport::StreamUsageEnum streamUsage, uint16_t &videoStreamId) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + videoStreamId = 0; + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status +MockPushAvStreamTransportDelegate::SelectAudioStream(PushAvStreamTransport::StreamUsageEnum streamUsage, uint16_t &audioStreamId) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + audioStreamId = 0; + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockPushAvStreamTransportDelegate::SetVideoStream(uint16_t videoStreamId) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockPushAvStreamTransportDelegate::SetAudioStream(uint16_t audioStreamId) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockPushAvStreamTransportDelegate::ValidateZoneId(uint16_t zoneId) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +bool MockPushAvStreamTransportDelegate::ValidateMotionZoneListSize(size_t zoneListSize) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +PushAvStreamTransport::PushAvStreamTransportStatusEnum +MockPushAvStreamTransportDelegate::GetTransportBusyStatus(const uint16_t connectionID) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return PushAvStreamTransport::PushAvStreamTransportStatusEnum::kIdle; +} + +void MockPushAvStreamTransportDelegate::OnAttributeChanged(AttributeId attributeId) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +CHIP_ERROR MockPushAvStreamTransportDelegate::LoadCurrentConnections( + std::vector ¤tConnections) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockPushAvStreamTransportDelegate::PersistentAttributesLoadedCallback() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +void MockPushAvStreamTransportDelegate::SetTLSCerts(Tls::CertificateTable::BufferedClientCert &clientCertEntry, + Tls::CertificateTable::BufferedRootCert &rootCertEntry) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +CHIP_ERROR MockPushAvStreamTransportDelegate::IsHardPrivacyModeActive(bool &isActive) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + isActive = false; + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockPushAvStreamTransportDelegate::IsSoftRecordingPrivacyModeActive(bool &isActive) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + isActive = false; + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockPushAvStreamTransportDelegate::IsSoftLivestreamPrivacyModeActive(bool &isActive) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + isActive = false; + return CHIP_NO_ERROR; +} + +void MockPushAvStreamTransportDelegate::SetPushAvStreamTransportServer(PushAvStreamTransportServer * server) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + mServer = server; + return; +} + +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_push_av_stream_transport_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_push_av_stream_transport_delegate.h new file mode 100644 index 000000000..5af271b87 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_push_av_stream_transport_delegate.h @@ -0,0 +1,91 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include +#include + +namespace chip { +namespace app { +namespace Clusters { + +class MockPushAvStreamTransportDelegate : public PushAvStreamTransportDelegate { +public: + MockPushAvStreamTransportDelegate() = default; + virtual ~MockPushAvStreamTransportDelegate() = default; + + Protocols::InteractionModel::Status + AllocatePushTransport(const PushAvStreamTransport::Structs::TransportOptionsStruct::Type &transportOptions, + const uint16_t connectionID, FabricIndex accessingFabricIndex) override; + + Protocols::InteractionModel::Status DeallocatePushTransport(const uint16_t connectionID) override; + + Protocols::InteractionModel::Status + ModifyPushTransport(const uint16_t connectionID, + const PushAvStreamTransport::TransportOptionsStorage transportOptions) override; + + Protocols::InteractionModel::Status SetTransportStatus(const std::vector connectionIDList, + PushAvStreamTransport::TransportStatusEnum transportStatus) override; + + Protocols::InteractionModel::Status ManuallyTriggerTransport( + const uint16_t connectionID, PushAvStreamTransport::TriggerActivationReasonEnum activationReason, + const Optional &timeControl) override; + + bool ValidateStreamUsage(PushAvStreamTransport::StreamUsageEnum streamUsage) override; + + bool ValidateSegmentDuration(uint16_t segmentDuration, + const Optional> &videoStreamId) override; + + Protocols::InteractionModel::Status + ValidateBandwidthLimit(PushAvStreamTransport::StreamUsageEnum streamUsage, + const Optional> &videoStreamId, + const Optional> &audioStreamId) override; + + Protocols::InteractionModel::Status SelectVideoStream(PushAvStreamTransport::StreamUsageEnum streamUsage, + uint16_t &videoStreamId) override; + + Protocols::InteractionModel::Status SelectAudioStream(PushAvStreamTransport::StreamUsageEnum streamUsage, + uint16_t &audioStreamId) override; + + Protocols::InteractionModel::Status SetVideoStream(uint16_t videoStreamId) override; + + Protocols::InteractionModel::Status SetAudioStream(uint16_t audioStreamId) override; + + Protocols::InteractionModel::Status ValidateZoneId(uint16_t zoneId) override; + + bool ValidateMotionZoneListSize(size_t zoneListSize) override; + + PushAvStreamTransport::PushAvStreamTransportStatusEnum GetTransportBusyStatus(const uint16_t connectionID) override; + + void OnAttributeChanged(AttributeId attributeId) override; + + CHIP_ERROR + LoadCurrentConnections(std::vector ¤tConnections) override; + + CHIP_ERROR PersistentAttributesLoadedCallback() override; + + void SetTLSCerts(Tls::CertificateTable::BufferedClientCert &clientCertEntry, + Tls::CertificateTable::BufferedRootCert &rootCertEntry) override; + + CHIP_ERROR IsHardPrivacyModeActive(bool &isActive) override; + + CHIP_ERROR IsSoftRecordingPrivacyModeActive(bool &isActive) override; + + CHIP_ERROR IsSoftLivestreamPrivacyModeActive(bool &isActive) override; + + void SetPushAvStreamTransportServer(PushAvStreamTransportServer * server) override; + +private: + static constexpr const char * LOG_TAG = "MockPushAvStreamTransportDelegate"; + PushAvStreamTransportServer * mServer = nullptr; +}; + +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_resource_monitoring_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_resource_monitoring_delegate.cpp new file mode 100644 index 000000000..3ff8fda21 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_resource_monitoring_delegate.cpp @@ -0,0 +1,49 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_resource_monitoring_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ResourceMonitoring { + +CHIP_ERROR MockResourceMonitoringDelegate::Init() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +Protocols::InteractionModel::Status MockResourceMonitoringDelegate::OnResetCondition() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockResourceMonitoringDelegate::PreResetCondition() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockResourceMonitoringDelegate::PostResetCondition() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +} // namespace ResourceMonitoring +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_resource_monitoring_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_resource_monitoring_delegate.h new file mode 100644 index 000000000..b8e250ad5 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_resource_monitoring_delegate.h @@ -0,0 +1,46 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock ResourceMonitoring Delegate Implementation + * This file provides a mock implementation of the ResourceMonitoring::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/resource-monitoring-server/resource-monitoring-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/include/resource-monitoring-delegates.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ResourceMonitoring { + +class MockResourceMonitoringDelegate : public Delegate { +public: + MockResourceMonitoringDelegate() = default; + virtual ~MockResourceMonitoringDelegate() = default; + + // Resource monitoring management + CHIP_ERROR Init() override; + Protocols::InteractionModel::Status OnResetCondition() override; + Protocols::InteractionModel::Status PreResetCondition() override; + Protocols::InteractionModel::Status PostResetCondition() override; + +private: + static constexpr const char * LOG_TAG = "MockResourceMonitoringDelegate"; +}; + +} // namespace ResourceMonitoring +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_service_area_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_service_area_delegate.cpp new file mode 100644 index 000000000..68e4b31e4 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_service_area_delegate.cpp @@ -0,0 +1,51 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_service_area_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ServiceArea { + +CHIP_ERROR MockServiceAreaDelegate::Init() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +bool MockServiceAreaDelegate::IsSetSelectedAreasAllowed(MutableCharSpan &statusText) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +bool MockServiceAreaDelegate::IsValidSelectAreasSet(const Span &selectedAreas, SelectAreasStatus &locationStatus, + MutableCharSpan &statusText) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + locationStatus = SelectAreasStatus::kSuccess; + return true; +} + +bool MockServiceAreaDelegate::HandleSkipArea(uint32_t skippedArea, MutableCharSpan &skipStatusText) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +} // namespace ServiceArea +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_service_area_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_service_area_delegate.h new file mode 100644 index 000000000..47f09fd9b --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_service_area_delegate.h @@ -0,0 +1,47 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock ServiceArea Delegate Implementation + * This file provides a mock implementation of the ServiceArea::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/service-area-server/service-area-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ServiceArea { + +class MockServiceAreaDelegate : public Delegate { +public: + MockServiceAreaDelegate() : Delegate() {} + virtual ~MockServiceAreaDelegate() = default; + + // Service area management + CHIP_ERROR Init() override; + bool IsSetSelectedAreasAllowed(MutableCharSpan &statusText) override; + bool IsValidSelectAreasSet(const Span &selectedAreas, SelectAreasStatus &locationStatus, + MutableCharSpan &statusText) override; + bool HandleSkipArea(uint32_t skippedArea, MutableCharSpan &skipStatusText) override; + +private: + static constexpr const char * LOG_TAG = "MockServiceAreaDelegate"; +}; + +} // namespace ServiceArea +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_target_navigator_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_target_navigator_delegate.cpp new file mode 100644 index 000000000..726d520f1 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_target_navigator_delegate.cpp @@ -0,0 +1,52 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_target_navigator_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace TargetNavigator { + +CHIP_ERROR MockTargetNavigatorDelegate::HandleGetTargetList(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeEmptyList(); +} + +uint8_t MockTargetNavigatorDelegate::HandleGetCurrentTarget() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +void MockTargetNavigatorDelegate::HandleNavigateTarget(CommandResponseHelper &helper, + const uint64_t &target, const CharSpan &data) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + Commands::NavigateTargetResponse::Type response; + response.status = TargetNavigatorStatusEnum::kSuccess; + helper.Success(response); +} + +uint16_t MockTargetNavigatorDelegate::GetClusterRevision(chip::EndpointId endpoint) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +} // namespace TargetNavigator +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_target_navigator_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_target_navigator_delegate.h new file mode 100644 index 000000000..2d5cda4a5 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_target_navigator_delegate.h @@ -0,0 +1,47 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +#include + +/* + * Mock TargetNavigator Delegate Implementation + * This file provides a mock implementation of the TargetNavigator::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/target-navigator-server/target-navigator-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/target-navigator/TargetNavigatorManager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/target-navigator/TargetNavigatorManager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace TargetNavigator { + +class MockTargetNavigatorDelegate : public Delegate { +public: + MockTargetNavigatorDelegate() = default; + + CHIP_ERROR HandleGetTargetList(app::AttributeValueEncoder &aEncoder) override; + uint8_t HandleGetCurrentTarget() override; + void HandleNavigateTarget(CommandResponseHelper &helper, + const uint64_t &target, const CharSpan &data) override; + uint16_t GetClusterRevision(chip::EndpointId endpoint) override; + +private: + const char *LOG_TAG = "target_navigator"; +}; + +} // namespace TargetNavigator +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_thermostat_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_thermostat_delegate.cpp new file mode 100644 index 000000000..84a5be6f1 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_thermostat_delegate.cpp @@ -0,0 +1,165 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_thermostat_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +std::optional MockThermostatDelegate::GetMaxAtomicWriteTimeout(chip::AttributeId attributeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return std::nullopt; +} + +CHIP_ERROR MockThermostatDelegate::GetPresetTypeAtIndex(size_t index, Structs::PresetTypeStruct::Type &presetType) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +uint8_t MockThermostatDelegate::GetNumberOfPresets() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +CHIP_ERROR MockThermostatDelegate::GetPresetAtIndex(size_t index, PresetStructWithOwnedMembers &preset) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR MockThermostatDelegate::GetActivePresetHandle(DataModel::Nullable &activePresetHandle) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + activePresetHandle.SetNull(); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockThermostatDelegate::SetActivePresetHandle(const DataModel::Nullable &newActivePresetHandle) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +void MockThermostatDelegate::InitializePendingPresets() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +CHIP_ERROR MockThermostatDelegate::AppendToPendingPresetList(const PresetStructWithOwnedMembers &preset) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockThermostatDelegate::GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers &preset) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR MockThermostatDelegate::CommitPendingPresets() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +void MockThermostatDelegate::ClearPendingPresetList() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +uint8_t MockThermostatDelegate::GetMaxThermostatSuggestions() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +uint8_t MockThermostatDelegate::GetNumberOfThermostatSuggestions() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +CHIP_ERROR MockThermostatDelegate::GetThermostatSuggestionAtIndex( + size_t index, ThermostatSuggestionStructWithOwnedMembers &thermostatSuggestion) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +void MockThermostatDelegate::GetCurrentThermostatSuggestion( + DataModel::Nullable ¤tThermostatSuggestion) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + currentThermostatSuggestion.SetNull(); + return; +} + +DataModel::Nullable +MockThermostatDelegate::GetThermostatSuggestionNotFollowingReason() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +CHIP_ERROR +MockThermostatDelegate::AppendToThermostatSuggestionsList(const Structs::ThermostatSuggestionStruct::Type &thermostatSuggestion) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockThermostatDelegate::RemoveFromThermostatSuggestionsList(size_t indexToRemove) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockThermostatDelegate::GetUniqueID(uint8_t &uniqueID) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + uniqueID = 0; + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockThermostatDelegate::ReEvaluateCurrentSuggestion() +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockThermostatDelegate::GetScheduleTypeAtIndex(size_t index, Structs::ScheduleTypeStruct::Type &scheduleType) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_thermostat_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_thermostat_delegate.h new file mode 100644 index 000000000..e7f57e99a --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_thermostat_delegate.h @@ -0,0 +1,64 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock Thermostat Delegate Implementation + * This file provides a mock implementation of the Thermostat::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/thermostat-server/thermostat-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/thermostat/thermostat-common/include/thermostat-delegate-impl.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/thermostat/thermostat-common/src/thermostat-delegate-impl.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +class MockThermostatDelegate : public Delegate { +public: + MockThermostatDelegate() = default; + + std::optional GetMaxAtomicWriteTimeout(chip::AttributeId attributeId) override; + CHIP_ERROR GetPresetTypeAtIndex(size_t index, Structs::PresetTypeStruct::Type &presetType) override; + uint8_t GetNumberOfPresets() override; + CHIP_ERROR GetPresetAtIndex(size_t index, PresetStructWithOwnedMembers &preset) override; + CHIP_ERROR GetActivePresetHandle(DataModel::Nullable &activePresetHandle) override; + CHIP_ERROR SetActivePresetHandle(const DataModel::Nullable &newActivePresetHandle) override; + void InitializePendingPresets() override; + CHIP_ERROR AppendToPendingPresetList(const PresetStructWithOwnedMembers &preset) override; + CHIP_ERROR GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers &preset) override; + CHIP_ERROR CommitPendingPresets() override; + void ClearPendingPresetList() override; + uint8_t GetMaxThermostatSuggestions() override; + uint8_t GetNumberOfThermostatSuggestions() override; + CHIP_ERROR GetThermostatSuggestionAtIndex(size_t index, + ThermostatSuggestionStructWithOwnedMembers &thermostatSuggestion) override; + void GetCurrentThermostatSuggestion( + DataModel::Nullable ¤tThermostatSuggestion) override; + DataModel::Nullable GetThermostatSuggestionNotFollowingReason() override; + CHIP_ERROR + AppendToThermostatSuggestionsList(const Structs::ThermostatSuggestionStruct::Type &thermostatSuggestion) override; + CHIP_ERROR RemoveFromThermostatSuggestionsList(size_t indexToRemove) override; + CHIP_ERROR GetUniqueID(uint8_t &uniqueID) override; + CHIP_ERROR ReEvaluateCurrentSuggestion() override; + CHIP_ERROR GetScheduleTypeAtIndex(size_t index, Structs::ScheduleTypeStruct::Type &scheduleType) override; + +private: + const char *LOG_TAG = "thermostat"; +}; + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_thread_border_router_management_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_thread_border_router_management_delegate.cpp new file mode 100644 index 000000000..e5ec44768 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_thread_border_router_management_delegate.cpp @@ -0,0 +1,100 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_thread_border_router_management_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ThreadBorderRouterManagement { + +CHIP_ERROR MockThreadBorderRouterManagementDelegate::Init(AttributeChangeCallback * attributeChangeCallback) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +bool MockThreadBorderRouterManagementDelegate::GetPanChangeSupported() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return false; +} + +void MockThreadBorderRouterManagementDelegate::GetBorderRouterName(MutableCharSpan &borderRouterName) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + borderRouterName.reduce_size(0); + return; +} + +CHIP_ERROR MockThreadBorderRouterManagementDelegate::GetBorderAgentId(MutableByteSpan &borderAgentId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +uint16_t MockThreadBorderRouterManagementDelegate::GetThreadVersion() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +bool MockThreadBorderRouterManagementDelegate::GetInterfaceEnabled() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return false; +} + +CHIP_ERROR MockThreadBorderRouterManagementDelegate::GetDataset(Thread::OperationalDataset &dataset, DatasetType type) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_FOUND; +} + +void MockThreadBorderRouterManagementDelegate::SetActiveDataset(const Thread::OperationalDataset &activeDataset, uint32_t sequenceNum, + ActivateDatasetCallback * callback) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +CHIP_ERROR MockThreadBorderRouterManagementDelegate::CommitActiveDataset() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockThreadBorderRouterManagementDelegate::RevertActiveDataset() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockThreadBorderRouterManagementDelegate::SetPendingDataset(const Thread::OperationalDataset &pendingDataset) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +} // namespace ThreadBorderRouterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_thread_border_router_management_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_thread_border_router_management_delegate.h new file mode 100644 index 000000000..a0ac58485 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_thread_border_router_management_delegate.h @@ -0,0 +1,53 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include +#include + +/* + * Mock ThreadBorderRouterManagement Delegate Implementation + * This file provides a mock implementation of the ThreadBorderRouterManagement::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/thread-border-router-management-server/thread-br-delegate.h + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ThreadBorderRouterManagement { + +class MockThreadBorderRouterManagementDelegate : public Delegate { +public: + MockThreadBorderRouterManagementDelegate() : Delegate() {} + virtual ~MockThreadBorderRouterManagementDelegate() = default; + + // Thread Border Router management + CHIP_ERROR Init(AttributeChangeCallback * attributeChangeCallback) override; + bool GetPanChangeSupported() override; + void GetBorderRouterName(MutableCharSpan &borderRouterName) override; + CHIP_ERROR GetBorderAgentId(MutableByteSpan &borderAgentId) override; + uint16_t GetThreadVersion() override; + bool GetInterfaceEnabled() override; + CHIP_ERROR GetDataset(Thread::OperationalDataset &dataset, DatasetType type) override; + void SetActiveDataset(const Thread::OperationalDataset &activeDataset, uint32_t sequenceNum, + ActivateDatasetCallback * callback) override; + CHIP_ERROR CommitActiveDataset() override; + CHIP_ERROR RevertActiveDataset() override; + CHIP_ERROR SetPendingDataset(const Thread::OperationalDataset &pendingDataset) override; + +private: + static constexpr const char * LOG_TAG = "MockThreadBRMgmtDelegate"; +}; + +} // namespace ThreadBorderRouterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_time_synchronization_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_time_synchronization_delegate.cpp new file mode 100644 index 000000000..d2d8108a7 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_time_synchronization_delegate.cpp @@ -0,0 +1,85 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_time_synchronization_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace TimeSynchronization { + +void MockTimeSynchronizationDelegate::TimeZoneListChanged(const Span timeZoneList) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +bool MockTimeSynchronizationDelegate::HandleUpdateDSTOffset(const CharSpan name) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return false; +} + +bool MockTimeSynchronizationDelegate::IsNTPAddressValid(const CharSpan ntp) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +bool MockTimeSynchronizationDelegate::IsNTPAddressDomain(const CharSpan ntp) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +CHIP_ERROR MockTimeSynchronizationDelegate::UpdateTimeFromPlatformSource(chip::Callback::Callback * callback) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +CHIP_ERROR MockTimeSynchronizationDelegate::UpdateTimeUsingNTPFallback(const CharSpan &fallbackNTP, + chip::Callback::Callback * callback) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +void MockTimeSynchronizationDelegate::UTCTimeAvailabilityChanged(uint64_t time) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +void MockTimeSynchronizationDelegate::TrustedTimeSourceAvailabilityChanged(bool available, GranularityEnum granularity) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +void MockTimeSynchronizationDelegate::NotifyTimeFailure() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +} // namespace TimeSynchronization +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_time_synchronization_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_time_synchronization_delegate.h new file mode 100644 index 000000000..3a9be460b --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_time_synchronization_delegate.h @@ -0,0 +1,52 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock TimeSynchronization Delegate Implementation + * This file provides a mock implementation of the TimeSynchronization::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/time-synchronization-server/time-synchronization-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/time-synchronization-server/DefaultTimeSyncDelegate.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/time-synchronization-server/DefaultTimeSyncDelegate.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace TimeSynchronization { + +class MockTimeSynchronizationDelegate : public Delegate { +public: + MockTimeSynchronizationDelegate() : Delegate() {} + virtual ~MockTimeSynchronizationDelegate() = default; + + // Time synchronization management + void TimeZoneListChanged(const Span timeZoneList) override; + bool HandleUpdateDSTOffset(const CharSpan name) override; + bool IsNTPAddressValid(const CharSpan ntp) override; + bool IsNTPAddressDomain(const CharSpan ntp) override; + CHIP_ERROR UpdateTimeFromPlatformSource(chip::Callback::Callback * callback) override; + CHIP_ERROR UpdateTimeUsingNTPFallback(const CharSpan &fallbackNTP, + chip::Callback::Callback * callback) override; + void UTCTimeAvailabilityChanged(uint64_t time) override; + void TrustedTimeSourceAvailabilityChanged(bool available, GranularityEnum granularity) override; + void NotifyTimeFailure() override; + +private: + static constexpr const char * LOG_TAG = "MockTimeSynchronizationDelegate"; +}; + +} // namespace TimeSynchronization +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_tls_certificate_management_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_tls_certificate_management_delegate.cpp new file mode 100644 index 000000000..5bcb758d2 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_tls_certificate_management_delegate.cpp @@ -0,0 +1,133 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_tls_certificate_management_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { + +Protocols::InteractionModel::Status +MockTlsCertificateManagementDelegate::ProvisionRootCert(EndpointId matterEndpoint, FabricIndex fabric, + const ProvisionRootCertificateType &provisionReq, Tls::TLSCAID &outCaid) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + outCaid = 0; + return Protocols::InteractionModel::Status::Success; +} + +CHIP_ERROR MockTlsCertificateManagementDelegate::LoadedRootCerts(EndpointId matterEndpoint, FabricIndex fabric, + LoadedRootCertificateCallback loadedCallback) const +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockTlsCertificateManagementDelegate::RootCertsForFabric(EndpointId matterEndpoint, FabricIndex fabric, + RootCertificateListCallback loadedCallback) const +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockTlsCertificateManagementDelegate::FindRootCert(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCAID id, + LoadedRootCertificateCallback loadedCallback) const +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_FOUND; +} + +CHIP_ERROR MockTlsCertificateManagementDelegate::LookupRootCertByFingerprint(EndpointId matterEndpoint, FabricIndex fabric, + const ByteSpan &fingerprint, + LoadedRootCertificateCallback loadedCallback) const +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_FOUND; +} + +CHIP_ERROR MockTlsCertificateManagementDelegate::LookupRootCert(EndpointId matterEndpoint, FabricIndex fabric, + const ByteSpan &cert, + LoadedRootCertificateCallback loadedCallback) const +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_FOUND; +} + +Protocols::InteractionModel::Status MockTlsCertificateManagementDelegate::RemoveRootCert(EndpointId matterEndpoint, + FabricIndex fabric, Tls::TLSCAID id) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockTlsCertificateManagementDelegate::GenerateClientCsr(EndpointId matterEndpoint, + FabricIndex fabric, + const ClientCsrType &request, + GeneratedCsrCallback loadedCallback) const +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Failure; +} + +Protocols::InteractionModel::Status +MockTlsCertificateManagementDelegate::ProvisionClientCert(EndpointId matterEndpoint, FabricIndex fabric, + const ProvisionClientCertificateType &provisionReq) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +CHIP_ERROR MockTlsCertificateManagementDelegate::LoadedClientCerts(EndpointId matterEndpoint, FabricIndex fabric, + LoadedClientCertificateCallback loadedCallback) const +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockTlsCertificateManagementDelegate::ClientCertsForFabric(EndpointId matterEndpoint, FabricIndex fabric, + ClientCertificateListCallback loadedCallback) const +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockTlsCertificateManagementDelegate::FindClientCert(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCCDID id, + LoadedClientCertificateCallback loadedCallback) const +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_FOUND; +} + +CHIP_ERROR MockTlsCertificateManagementDelegate::LookupClientCertByFingerprint(EndpointId matterEndpoint, FabricIndex fabric, + const ByteSpan &fingerprint, + LoadedClientCertificateCallback loadedCallback) const +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_FOUND; +} + +CHIP_ERROR MockTlsCertificateManagementDelegate::LookupClientCert(EndpointId matterEndpoint, FabricIndex fabric, + const ByteSpan &certificate, + LoadedClientCertificateCallback loadedCallback) const +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_FOUND; +} + +Protocols::InteractionModel::Status MockTlsCertificateManagementDelegate::RemoveClientCert(EndpointId matterEndpoint, + FabricIndex fabric, Tls::TLSCCDID id) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_tls_certificate_management_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_tls_certificate_management_delegate.h new file mode 100644 index 000000000..3465b7812 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_tls_certificate_management_delegate.h @@ -0,0 +1,74 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include +#include + +namespace chip { +namespace app { +namespace Clusters { + +class MockTlsCertificateManagementDelegate : public TlsCertificateManagementDelegate { +public: + MockTlsCertificateManagementDelegate() = default; + virtual ~MockTlsCertificateManagementDelegate() = default; + + Protocols::InteractionModel::Status ProvisionRootCert(EndpointId matterEndpoint, FabricIndex fabric, + const ProvisionRootCertificateType &provisionReq, + Tls::TLSCAID &outCaid) override; + + CHIP_ERROR LoadedRootCerts(EndpointId matterEndpoint, FabricIndex fabric, + LoadedRootCertificateCallback loadedCallback) const override; + + CHIP_ERROR RootCertsForFabric(EndpointId matterEndpoint, FabricIndex fabric, + RootCertificateListCallback loadedCallback) const override; + + CHIP_ERROR FindRootCert(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCAID id, + LoadedRootCertificateCallback loadedCallback) const override; + + CHIP_ERROR LookupRootCertByFingerprint(EndpointId matterEndpoint, FabricIndex fabric, const ByteSpan &fingerprint, + LoadedRootCertificateCallback loadedCallback) const override; + + CHIP_ERROR LookupRootCert(EndpointId matterEndpoint, FabricIndex fabric, const ByteSpan &cert, + LoadedRootCertificateCallback loadedCallback) const override; + + Protocols::InteractionModel::Status RemoveRootCert(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCAID id) override; + + Protocols::InteractionModel::Status GenerateClientCsr(EndpointId matterEndpoint, FabricIndex fabric, + const ClientCsrType &request, + GeneratedCsrCallback loadedCallback) const override; + + Protocols::InteractionModel::Status ProvisionClientCert(EndpointId matterEndpoint, FabricIndex fabric, + const ProvisionClientCertificateType &provisionReq) override; + + CHIP_ERROR LoadedClientCerts(EndpointId matterEndpoint, FabricIndex fabric, + LoadedClientCertificateCallback loadedCallback) const override; + + CHIP_ERROR ClientCertsForFabric(EndpointId matterEndpoint, FabricIndex fabric, + ClientCertificateListCallback loadedCallback) const override; + + CHIP_ERROR FindClientCert(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCCDID id, + LoadedClientCertificateCallback loadedCallback) const override; + + CHIP_ERROR LookupClientCertByFingerprint(EndpointId matterEndpoint, FabricIndex fabric, const ByteSpan &fingerprint, + LoadedClientCertificateCallback loadedCallback) const override; + + CHIP_ERROR LookupClientCert(EndpointId matterEndpoint, FabricIndex fabric, const ByteSpan &certificate, + LoadedClientCertificateCallback loadedCallback) const override; + + Protocols::InteractionModel::Status RemoveClientCert(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCCDID id) override; + +private: + static constexpr const char * LOG_TAG = "MockTlsCertificateManagementDelegate"; +}; + +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_tls_client_management_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_tls_client_management_delegate.cpp new file mode 100644 index 000000000..5266701a5 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_tls_client_management_delegate.cpp @@ -0,0 +1,81 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_tls_client_management_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { + +CHIP_ERROR MockTlsClientManagementDelegate::Init(PersistentStorageDelegate &storage) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockTlsClientManagementDelegate::ForEachEndpoint(EndpointId matterEndpoint, FabricIndex fabric, + LoadedEndpointCallback callback) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockTlsClientManagementDelegate::FindProvisionedEndpointByID(EndpointId matterEndpoint, FabricIndex fabric, + uint16_t endpointID, LoadedEndpointCallback callback) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_ERROR_NOT_FOUND; +} + +Protocols::InteractionModel::ClusterStatusCode MockTlsClientManagementDelegate::ProvisionEndpoint( + EndpointId matterEndpoint, FabricIndex fabric, + const TlsClientManagement::Commands::ProvisionEndpoint::DecodableType &provisionReq, uint16_t &endpointID) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + endpointID = 0; + return Protocols::InteractionModel::ClusterStatusCode(Protocols::InteractionModel::Status::Success); +} + +Protocols::InteractionModel::Status MockTlsClientManagementDelegate::RemoveProvisionedEndpointByID(EndpointId matterEndpoint, + FabricIndex fabric, + uint16_t endpointID) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +void MockTlsClientManagementDelegate::RemoveFabric(FabricIndex fabricIndex) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +CHIP_ERROR MockTlsClientManagementDelegate::MutateEndpointReferenceCount(EndpointId matterEndpoint, FabricIndex fabric, + uint16_t endpointID, int8_t delta) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockTlsClientManagementDelegate::RootCertCanBeRemoved(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCAID id) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockTlsClientManagementDelegate::ClientCertCanBeRemoved(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCCDID id) +{ + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_tls_client_management_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_tls_client_management_delegate.h new file mode 100644 index 000000000..3ffa1d5bd --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_tls_client_management_delegate.h @@ -0,0 +1,54 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include +#include + +namespace chip { +namespace app { +namespace Clusters { + +class MockTlsClientManagementDelegate : public TlsClientManagementDelegate { +public: + MockTlsClientManagementDelegate() = default; + virtual ~MockTlsClientManagementDelegate() = default; + + CHIP_ERROR Init(PersistentStorageDelegate &storage) override; + + CHIP_ERROR ForEachEndpoint(EndpointId matterEndpoint, FabricIndex fabric, LoadedEndpointCallback callback) override; + + CHIP_ERROR FindProvisionedEndpointByID(EndpointId matterEndpoint, FabricIndex fabric, uint16_t endpointID, + LoadedEndpointCallback callback) override; + + Protocols::InteractionModel::ClusterStatusCode + ProvisionEndpoint(EndpointId matterEndpoint, FabricIndex fabric, + const TlsClientManagement::Commands::ProvisionEndpoint::DecodableType &provisionReq, + uint16_t &endpointID) override; + + Protocols::InteractionModel::Status RemoveProvisionedEndpointByID(EndpointId matterEndpoint, FabricIndex fabric, + uint16_t endpointID) override; + + void RemoveFabric(FabricIndex fabricIndex) override; + + CHIP_ERROR MutateEndpointReferenceCount(EndpointId matterEndpoint, FabricIndex fabric, uint16_t endpointID, + int8_t delta) override; + + // CertificateDependencyChecker interface + CHIP_ERROR RootCertCanBeRemoved(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCAID id) override; + + CHIP_ERROR ClientCertCanBeRemoved(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCCDID id) override; + +private: + static constexpr const char * LOG_TAG = "MockTlsClientManagementDelegate"; +}; + +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_valve_configuration_and_control_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_valve_configuration_and_control_delegate.cpp new file mode 100644 index 000000000..ecddf8e2c --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_valve_configuration_and_control_delegate.cpp @@ -0,0 +1,42 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_valve_configuration_and_control_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ValveConfigurationAndControl { + +DataModel::Nullable MockValveConfigurationAndControlDelegate::HandleOpenValve(DataModel::Nullable level) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return DataModel::Nullable(); +} + +CHIP_ERROR MockValveConfigurationAndControlDelegate::HandleCloseValve() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +void MockValveConfigurationAndControlDelegate::HandleRemainingDurationTick(uint32_t duration) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +} // namespace ValveConfigurationAndControl +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_valve_configuration_and_control_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_valve_configuration_and_control_delegate.h new file mode 100644 index 000000000..82ecd8805 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_valve_configuration_and_control_delegate.h @@ -0,0 +1,45 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock ValveConfigurationAndControl Delegate Implementation + * This file provides a mock implementation of the ValveConfigurationAndControl::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/linux/ValveControlDelegate.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/all-clusters-app/linux/ValveControlDelegate.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ValveConfigurationAndControl { + +class MockValveConfigurationAndControlDelegate : public Delegate { +public: + MockValveConfigurationAndControlDelegate() : Delegate() {} + virtual ~MockValveConfigurationAndControlDelegate() = default; + + // Valve configuration and control handlers + DataModel::Nullable HandleOpenValve(DataModel::Nullable level) override; + CHIP_ERROR HandleCloseValve() override; + void HandleRemainingDurationTick(uint32_t duration) override; + +private: + static constexpr const char * LOG_TAG = "MockValveConfigurationAndControlDelegate"; +}; + +} // namespace ValveConfigurationAndControl +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_wake_on_lan_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_wake_on_lan_delegate.cpp new file mode 100644 index 000000000..af1ab0052 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_wake_on_lan_delegate.cpp @@ -0,0 +1,28 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_wake_on_lan_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace WakeOnLan { + +CHIP_ERROR MockWakeOnLanDelegate::HandleGetMacAddress(app::AttributeValueEncoder &aEncoder) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return aEncoder.EncodeNull(); +} + +} // namespace WakeOnLan +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_wake_on_lan_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_wake_on_lan_delegate.h new file mode 100644 index 000000000..51fe6436c --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_wake_on_lan_delegate.h @@ -0,0 +1,41 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock WakeOnLan Delegate Implementation + * This file provides a mock implementation of the WakeOnLan::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/wake-on-lan-server/wake-on-lan-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/wake-on-lan/WakeOnLanManager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/tv-app/tv-common/clusters/wake-on-lan/WakeOnLanManager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace WakeOnLan { + +class MockWakeOnLanDelegate : public Delegate { +public: + MockWakeOnLanDelegate() = default; + + CHIP_ERROR HandleGetMacAddress(app::AttributeValueEncoder &aEncoder) override; + +private: + const char *LOG_TAG = "wake_on_lan"; +}; + +} // namespace WakeOnLan +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_water_heater_management_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_water_heater_management_delegate.cpp new file mode 100644 index 000000000..d8074f59d --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_water_heater_management_delegate.cpp @@ -0,0 +1,79 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_water_heater_management_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace WaterHeaterManagement { + +Protocols::InteractionModel::Status MockWaterHeaterManagementDelegate::HandleBoost(uint32_t duration, Optional oneShot, + Optional emergencyBoost, Optional temporarySetpoint, + Optional targetPercentage, Optional targetReheat) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockWaterHeaterManagementDelegate::HandleCancelBoost() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +BitMask MockWaterHeaterManagementDelegate::GetHeaterTypes() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return BitMask(); +} + +BitMask MockWaterHeaterManagementDelegate::GetHeatDemand() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return BitMask(); +} + +uint16_t MockWaterHeaterManagementDelegate::GetTankVolume() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +Energy_mWh MockWaterHeaterManagementDelegate::GetEstimatedHeatRequired() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Energy_mWh(0); +} + +Percent MockWaterHeaterManagementDelegate::GetTankPercentage() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Percent(0); +} + +BoostStateEnum MockWaterHeaterManagementDelegate::GetBoostState() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return BoostStateEnum::kUnknownEnumValue; +} + +} // namespace WaterHeaterManagement +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_water_heater_management_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_water_heater_management_delegate.h new file mode 100644 index 000000000..85d2d6399 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_water_heater_management_delegate.h @@ -0,0 +1,55 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock WaterHeaterManagement Delegate Implementation + * This file provides a mock implementation of the WaterHeaterManagement::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/water-heater-management-server/water-heater-management-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/water-heater/include/WhmDelegate.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/energy-management-app/energy-management-common/water-heater/src/WhmDelegateImpl.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace WaterHeaterManagement { + +class MockWaterHeaterManagementDelegate : public Delegate { +public: + MockWaterHeaterManagementDelegate() = default; + virtual ~MockWaterHeaterManagementDelegate() = default; + + // Delegate interface + Protocols::InteractionModel::Status HandleBoost(uint32_t duration, Optional oneShot, + Optional emergencyBoost, Optional temporarySetpoint, + Optional targetPercentage, Optional targetReheat) override; + + Protocols::InteractionModel::Status HandleCancelBoost() override; + + // Get attribute methods + BitMask GetHeaterTypes() override; + BitMask GetHeatDemand() override; + uint16_t GetTankVolume() override; + Energy_mWh GetEstimatedHeatRequired() override; + Percent GetTankPercentage() override; + BoostStateEnum GetBoostState() override; + +private: + static constexpr const char * LOG_TAG = "MockWaterHeaterManagementDelegate"; +}; + +} // namespace WaterHeaterManagement +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_provider_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_provider_delegate.cpp new file mode 100644 index 000000000..51c480d73 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_provider_delegate.cpp @@ -0,0 +1,69 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_webrtc_transport_provider_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace WebRTCTransportProvider { + +CHIP_ERROR MockWebRTCTransportProviderDelegate::HandleSolicitOffer(const OfferRequestArgs &args, WebRTCSessionStruct &outSession, + bool &outDeferredOffer) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + outDeferredOffer = false; + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockWebRTCTransportProviderDelegate::HandleProvideOffer(const ProvideOfferRequestArgs &args, WebRTCSessionStruct &outSession) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockWebRTCTransportProviderDelegate::HandleProvideAnswer(uint16_t sessionId, const std::string &sdpAnswer) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockWebRTCTransportProviderDelegate::HandleProvideICECandidates(uint16_t sessionId, const std::vector &candidates) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockWebRTCTransportProviderDelegate::HandleEndSession(uint16_t sessionId, WebRTCEndReasonEnum reasonCode, + DataModel::Nullable videoStreamID, + DataModel::Nullable audioStreamID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockWebRTCTransportProviderDelegate::ValidateStreamUsage(StreamUsageEnum streamUsage, + Optional> &videoStreamId, + Optional> &audioStreamId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +} // namespace WebRTCTransportProvider +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_provider_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_provider_delegate.h new file mode 100644 index 000000000..37b3bb31a --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_provider_delegate.h @@ -0,0 +1,58 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock WebRTCTransportProvider Delegate Implementation + * This file provides a mock implementation of the WebRTCTransportProvider::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/webrtc-transport-provider-server/webrtc-transport-provider-server.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/camera-app/linux/include/clusters/webrtc_provider/webrtc-provider-manager.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/camera-app/linux/src/clusters/webrtc_provider/webrtc-provider-manager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace WebRTCTransportProvider { + +class MockWebRTCTransportProviderDelegate : public Delegate { +public: + MockWebRTCTransportProviderDelegate() = default; + virtual ~MockWebRTCTransportProviderDelegate() = default; + + // Delegate interface + CHIP_ERROR HandleSolicitOffer(const OfferRequestArgs &args, WebRTCSessionStruct &outSession, + bool &outDeferredOffer) override; + + CHIP_ERROR HandleProvideOffer(const ProvideOfferRequestArgs &args, WebRTCSessionStruct &outSession) override; + + CHIP_ERROR HandleProvideAnswer(uint16_t sessionId, const std::string &sdpAnswer) override; + + CHIP_ERROR HandleProvideICECandidates(uint16_t sessionId, const std::vector &candidates) override; + + CHIP_ERROR HandleEndSession(uint16_t sessionId, WebRTCEndReasonEnum reasonCode, + DataModel::Nullable videoStreamID, + DataModel::Nullable audioStreamID) override; + + CHIP_ERROR ValidateStreamUsage(StreamUsageEnum streamUsage, + Optional> &videoStreamId, + Optional> &audioStreamId) override; + +private: + static constexpr const char * LOG_TAG = "MockWebRTCTransportProviderDelegate"; +}; + +} // namespace WebRTCTransportProvider +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_requestor_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_requestor_delegate.cpp new file mode 100644 index 000000000..fa8e858d0 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_requestor_delegate.cpp @@ -0,0 +1,50 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_webrtc_transport_requestor_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace WebRTCTransportRequestor { + +CHIP_ERROR MockWebRTCTransportRequestorDelegate::HandleOffer(const WebRTCSessionStruct &session, const OfferArgs &args) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockWebRTCTransportRequestorDelegate::HandleAnswer(const WebRTCSessionStruct &session, const std::string &sdpAnswer) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockWebRTCTransportRequestorDelegate::HandleICECandidates(const WebRTCSessionStruct &session, + const std::vector &candidates) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockWebRTCTransportRequestorDelegate::HandleEnd(const WebRTCSessionStruct &session, WebRTCEndReasonEnum reasonCode) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +} // namespace WebRTCTransportRequestor +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_requestor_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_requestor_delegate.h new file mode 100644 index 000000000..407b1e441 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_webrtc_transport_requestor_delegate.h @@ -0,0 +1,46 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include +#include + +/* + * Mock WebRTCTransportRequestor Delegate Implementation + * This file provides a mock implementation of the WebRTCTransportRequestor::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/webrtc-transport-requestor-server/webrtc-transport-requestor-cluster.h + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace WebRTCTransportRequestor { + +class MockWebRTCTransportRequestorDelegate : public Delegate { +public: + MockWebRTCTransportRequestorDelegate() : Delegate() {} + virtual ~MockWebRTCTransportRequestorDelegate() = default; + + // WebRTC transport requestor handlers + CHIP_ERROR HandleOffer(const WebRTCSessionStruct &session, const OfferArgs &args) override; + CHIP_ERROR HandleAnswer(const WebRTCSessionStruct &session, const std::string &sdpAnswer) override; + CHIP_ERROR HandleICECandidates(const WebRTCSessionStruct &session, + const std::vector &candidates) override; + CHIP_ERROR HandleEnd(const WebRTCSessionStruct &session, WebRTCEndReasonEnum reasonCode) override; + +private: + static constexpr const char * LOG_TAG = "MockWebRTCTransportRequestorDelegate"; +}; + +} // namespace WebRTCTransportRequestor +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_window_covering_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_window_covering_delegate.cpp new file mode 100644 index 000000000..0c45e7263 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_window_covering_delegate.cpp @@ -0,0 +1,35 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_window_covering_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace WindowCovering { + +CHIP_ERROR MockWindowCoveringDelegate::HandleMovement(WindowCoveringType type) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockWindowCoveringDelegate::HandleStopMotion() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +} // namespace WindowCovering +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_window_covering_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_window_covering_delegate.h new file mode 100644 index 000000000..973f75e78 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_window_covering_delegate.h @@ -0,0 +1,42 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +/* + * Mock WindowCovering Delegate Implementation + * This file provides a mock implementation of the WindowCovering::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/window-covering-server/window-covering-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/chef/common/clusters/window-covering/chef-window-covering.h and + * https://github.com/project-chip/connectedhomeip/blob/d144bbb/examples/chef/common/clusters/window-covering/chef-window-covering.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace WindowCovering { + +class MockWindowCoveringDelegate : public Delegate { +public: + MockWindowCoveringDelegate() = default; + + CHIP_ERROR HandleMovement(WindowCoveringType type) override; + CHIP_ERROR HandleStopMotion() override; + +private: + const char *LOG_TAG = "window_covering"; +}; + +} // namespace WindowCovering +} // namespace Clusters +} // namespace app +} // namespace chip \ No newline at end of file diff --git a/examples/all_device_types_app/main/mock_delegates/mock_zone_management_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_zone_management_delegate.cpp new file mode 100644 index 000000000..48a52b766 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_zone_management_delegate.cpp @@ -0,0 +1,95 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_zone_management_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ZoneManagement { + +Protocols::InteractionModel::Status MockZoneManagementDelegate::CreateTwoDCartesianZone(const TwoDCartesianZoneStorage &zone, + uint16_t &outZoneID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + outZoneID = 0; + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockZoneManagementDelegate::UpdateTwoDCartesianZone(uint16_t zoneID, const TwoDCartesianZoneStorage &zone) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockZoneManagementDelegate::RemoveZone(uint16_t zoneID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockZoneManagementDelegate::CreateTrigger(const ZoneTriggerControlStruct &zoneTrigger) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockZoneManagementDelegate::UpdateTrigger(const ZoneTriggerControlStruct &zoneTrigger) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +Protocols::InteractionModel::Status MockZoneManagementDelegate::RemoveTrigger(uint16_t zoneID) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return Protocols::InteractionModel::Status::Success; +} + +void MockZoneManagementDelegate::OnAttributeChanged(AttributeId attributeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return; +} + +CHIP_ERROR MockZoneManagementDelegate::PersistentAttributesLoadedCallback() +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockZoneManagementDelegate::LoadZones(std::vector &aZones) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + aZones.clear(); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MockZoneManagementDelegate::LoadTriggers(std::vector &aTriggers) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + aTriggers.clear(); + return CHIP_NO_ERROR; +} + +} // namespace ZoneManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_zone_management_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_zone_management_delegate.h new file mode 100644 index 000000000..30f658241 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_zone_management_delegate.h @@ -0,0 +1,56 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include +#include + +/* + * Mock ZoneManagement Delegate Implementation + * This file provides a mock implementation of the ZoneManagement::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/d144bbb/src/app/clusters/zone-management-server/zone-management-server.h + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace ZoneManagement { + +class MockZoneManagementDelegate : public Delegate { +public: + MockZoneManagementDelegate() : Delegate() {} + virtual ~MockZoneManagementDelegate() = default; + + // Zone management command handlers + Protocols::InteractionModel::Status CreateTwoDCartesianZone(const TwoDCartesianZoneStorage &zone, + uint16_t &outZoneID) override; + Protocols::InteractionModel::Status UpdateTwoDCartesianZone(uint16_t zoneID, const TwoDCartesianZoneStorage &zone) override; + Protocols::InteractionModel::Status RemoveZone(uint16_t zoneID) override; + Protocols::InteractionModel::Status CreateTrigger(const ZoneTriggerControlStruct &zoneTrigger) override; + Protocols::InteractionModel::Status UpdateTrigger(const ZoneTriggerControlStruct &zoneTrigger) override; + Protocols::InteractionModel::Status RemoveTrigger(uint16_t zoneID) override; + + // Callback handlers + void OnAttributeChanged(AttributeId attributeId) override; + CHIP_ERROR PersistentAttributesLoadedCallback() override; + + // Load handlers + CHIP_ERROR LoadZones(std::vector &aZones) override; + CHIP_ERROR LoadTriggers(std::vector &aTriggers) override; + +private: + static constexpr const char * LOG_TAG = "MockZoneManagementDelegate"; +}; + +} // namespace ZoneManagement +} // namespace Clusters +} // namespace app +} // namespace chip