diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d893eaf02..3f25ff32e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -374,6 +374,18 @@ build_esp_matter_examples_pytest_C2: python tools/ci/memory_analyzer.py --chip esp32c2 --job_name "build_esp_matter_examples_pytest_C2" --ref_map_file light_mr_base.map --example "light" fi +.build_generated_data_model_all_device_types_app_H2: &build_generated_data_model_all_device_types_app_H2 + - *setup_ot_rcp + - cd ${ESP_MATTER_PATH}/examples/all_device_types_app + - echo "CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL=y" >> sdkconfig.defaults + - idf.py set-target esp32h2 + - idf.py build + +.build_generated_data_model_examples_pytest_C3: &build_generated_data_model_examples_pytest_C3 + - cd ${ESP_MATTER_PATH} + - echo "CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL=y" >> ${ESP_MATTER_PATH}/examples/light/sdkconfig.defaults + - pip install -r tools/ci/requirements-build.txt + - python tools/ci/build_apps.py ./examples --pytest_c3 build_override_sdkconfig_examples: resource_group: build_override_sdkconfig_examples @@ -385,6 +397,8 @@ build_override_sdkconfig_examples: - *build_esp32c6_wifi_thread_example - *build_controller_otbr_example - *build_lit_icd_example + - *build_generated_data_model_examples_pytest_C3 + - *build_generated_data_model_all_device_types_app_H2 build_zap_light_example: resource_group: build_zap_light_example @@ -467,7 +481,6 @@ build_nopytest_remaining_examples_manual: --parallel-index ${CI_NODE_INDEX:-1} parallel: 2 - build_esp_matter_examples_pytest_C3: resource_group: build_esp_matter_examples_pytest_C3 extends: @@ -490,7 +503,6 @@ build_esp_matter_examples_pytest_C3: - pip install -r tools/ci/requirements-build.txt - python tools/ci/build_apps.py ./examples --pytest_c3 - pytest_esp32c3_esp_matter_dut: stage: target_test image: ${DOCKER_IMAGE_NAME}:chip_${CHIP_SHORT_HASH}_idf_${IDF_CHECKOUT_REF} @@ -809,3 +821,55 @@ pre_commit_check: tags: - build + +data_model_gen_unit_tests: + image: $CI_DOCKER_REGISTRY/esp-env-v6.0:1 + stage: pre_check + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" || $CI_COMMIT_BRANCH == "main" + script: + - pip install -r ${ESP_MATTER_PATH}/tools/data_model_gen/requirements.txt + - cd ${ESP_MATTER_PATH}/tools/data_model_gen + - python tests/run_tests.py -v + tags: + - build + +data_model_gen_check: + image: ${DOCKER_IMAGE_NAME}:chip_${CHIP_SHORT_HASH}_idf_${IDF_CHECKOUT_REF} + stage: pre_check + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" || $CI_COMMIT_BRANCH == "main" + script: + # Link CHIP submodule from Docker image cache + - rm -rf ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip + - ln -s ${CHIP_SUBMODULE_PATH} ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip + # Install data_model_gen dependencies and pre-commit + - pip install -r ${ESP_MATTER_PATH}/tools/data_model_gen/requirements.txt + - pip install pre-commit + # Regenerate data model from scratch + - cd ${ESP_MATTER_PATH}/tools/data_model_gen + - python data_model_gen.py --clean --no-colored-logs + # Format generated code with pre-commit hooks (astyle, codespell, etc.) + - cd ${ESP_MATTER_PATH} + - pre-commit install-hooks + - find components/esp_matter/data_model/generated -name '*.cpp' -o -name '*.h' | xargs pre-commit run --files || true + # Fail if generated+formatted files differ from what is committed + - | + UNTRACKED=$(git ls-files --others --exclude-standard components/esp_matter/data_model/generated/) + if ! git diff --quiet components/esp_matter/data_model/generated/ || [ -n "$UNTRACKED" ]; then + echo "ERROR: Generated data model code is out of date or not properly formatted." + echo "" + echo "To fix: run the following locally and commit the result:" + echo " cd tools/data_model_gen && python data_model_gen.py --clean" + echo " pre-commit run --files \$(find components/esp_matter/data_model/generated -name '*.cpp' -o -name '*.h')" + echo "" + git diff --stat components/esp_matter/data_model/generated/ + if [ -n "$UNTRACKED" ]; then + echo "Untracked files:" + echo "$UNTRACKED" + fi + exit 1 + fi + echo "Generated data model files are up to date and properly formatted." + tags: + - build diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 0a9fa4096..7896b20bc 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,50 @@ +# 14-April-2026 + +## Generated Data Model (Experimental) + +### Added +- Experimental support for a **generated data model** based on Matter Specification XMLs. +- Generated sources are available under: + - `components/esp_matter/data_model/generated/` + +### Changed +- Legacy handwritten data model implementation moved to: + - `components/esp_matter/data_model/legacy/` +- Data model can now be generated using: + +``` +python tools/data_model_gen/data_model_gen.py +``` +- Some APIs and namespaces have been updated with the generated data model. +- The examples below are representative and not a complete list of changes. + + +e.g. + +- Namespace updates include: +``` +- namespace wifi {} → namespace wi_fi {} +``` + +- Color Control Cluster Attribute API's +``` +attribute_t *create_primary_n_x(cluster_t * cluster, uint16_t value, uint8_t index); +attribute_t *create_primary_n_y(cluster_t * cluster, uint16_t value, uint8_t index); +attribute_t *create_primary_n_intensity(cluster_t * cluster, nullable value, uint8_t index); +``` +to + +``` +attribute_t *create_primary_1_x(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_1_y(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_1_intensity(cluster_t *cluster, nullable value); +``` + +### Configuration +- Enable via `CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL` (menuconfig → ESP Matter → Generated Data Model) +- Existing implementations is used by default + + # 5-Mar-2026 ### Controller API changes diff --git a/components/esp_matter/CMakeLists.txt b/components/esp_matter/CMakeLists.txt index 26be45c86..3a5520e77 100644 --- a/components/esp_matter/CMakeLists.txt +++ b/components/esp_matter/CMakeLists.txt @@ -48,6 +48,27 @@ if (CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER) list(APPEND INCLUDE_DIRS_LIST "zap_common" "data_model") list(APPEND PRIV_INCLUDE_DIRS_LIST "data_model/private") + + if(CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL) + foreach(GENERATED_DATA_MODEL_PATH "device_types" "clusters") + list(APPEND SRC_DIRS_LIST "data_model/generated/${GENERATED_DATA_MODEL_PATH}") + list(APPEND INCLUDE_DIRS_LIST "data_model/generated/${GENERATED_DATA_MODEL_PATH}") + + file(GLOB DIRS CONFIGURE_DEPENDS "data_model/generated/${GENERATED_DATA_MODEL_PATH}/*") + foreach(DIR ${DIRS}) + if(IS_DIRECTORY ${DIR}) + list(APPEND SRC_DIRS_LIST ${DIR}) + list(APPEND INCLUDE_DIRS_LIST ${DIR}) + endif() + endforeach() + endforeach() + + list(APPEND PRIV_INCLUDE_DIRS_LIST "data_model/generated") + list(APPEND SRC_DIRS_LIST "data_model/generated/") + else() + list(APPEND SRC_DIRS_LIST "data_model/legacy") + list(APPEND INCLUDE_DIRS_LIST "data_model/legacy") + endif() endif(CONFIG_ESP_MATTER_ENABLE_DATA_MODEL) else() list(APPEND EXCLUDE_SRCS_LIST "esp_matter_identify.cpp" diff --git a/components/esp_matter/Kconfig b/components/esp_matter/Kconfig index 91c011e11..ff2c4b90c 100644 --- a/components/esp_matter/Kconfig +++ b/components/esp_matter/Kconfig @@ -224,6 +224,16 @@ menu "ESP Matter" If enabled, we will not use zap to define the data model of the node. All of the endpoints are dynamic. + config ESP_MATTER_ENABLE_GENERATED_DATA_MODEL + bool "Enable Generated Data Model" + default n + depends on ESP_MATTER_ENABLE_DATA_MODEL + help + An experimental feature to use data model generated via automated scripts instead of legacy implementation. + When enabled: + - Generated clusters and endpoints are used. + - Legacy data model code is not compiled. More details can be found in the README.md file in the tools/data_model_gen directory. + config ESP_MATTER_ENABLE_MATTER_SERVER bool "Enable Matter Server" default y diff --git a/components/esp_matter/data_model/esp_matter_attribute.h b/components/esp_matter/data_model/esp_matter_attribute.h index e39bfcb4b..f1f6d9647 100644 --- a/components/esp_matter/data_model/esp_matter_attribute.h +++ b/components/esp_matter/data_model/esp_matter_attribute.h @@ -13,1410 +13,9 @@ // limitations under the License. #pragma once - -#include - -namespace esp_matter { -namespace cluster { - -/** Specific attribute create APIs - * - * If some standard attribute is not present here, it can be added. - * If a custom attribute needs to be created, the low level esp_matter::attribute::create() API can be used. - */ - -namespace global { -namespace attribute { -attribute_t *create_cluster_revision(cluster_t *cluster, uint16_t value); -attribute_t *create_feature_map(cluster_t *cluster, uint32_t value); -} /* attribute */ -} /* global */ - -namespace descriptor { -namespace attribute { -attribute_t *create_device_type_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_server_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_client_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_parts_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_tag_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_endpoint_unique_id(cluster_t *cluster, uint8_t *value, uint16_t length); -} /* attribute */ -} /* descriptor */ - -namespace actions { -namespace attribute { - -constexpr uint16_t k_max_setup_url_length = 256; - -attribute_t *create_action_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_endpoint_lists(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_setup_url(cluster_t *cluster, char *value, uint16_t length); -} /* attribute */ -} /* actions */ - -namespace access_control { -namespace attribute { -attribute_t *create_acl(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_extension(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_subjects_per_access_control_entry(cluster_t *cluster, uint16_t value); -attribute_t *create_targets_per_access_control_entry(cluster_t *cluster, uint16_t value); -attribute_t *create_access_control_entries_per_fabric(cluster_t *cluster, uint16_t value); -#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS -attribute_t *create_commissioning_arl(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_arl(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +#include +#if CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL +#include "generated/clusters/all_clusters.h" +#else +#include "legacy/esp_matter_attribute_impl.h" #endif -} /* attribute */ -} /* access_control */ - -namespace basic_information { -constexpr uint8_t k_max_node_label_length = 32; - -namespace attribute { -attribute_t *create_data_model_revision(cluster_t *cluster, uint16_t value); -attribute_t *create_vendor_name(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_vendor_id(cluster_t *cluster, uint16_t value); -attribute_t *create_product_name(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_product_id(cluster_t *cluster, uint16_t value); -attribute_t *create_node_label(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_location(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_hardware_version(cluster_t *cluster, uint16_t value); -attribute_t *create_hardware_version_string(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_software_version(cluster_t *cluster, uint32_t value); -attribute_t *create_software_version_string(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_unique_id(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_capability_minima(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_specification_version(cluster_t *cluster, uint32_t value); -attribute_t *create_max_paths_per_invoke(cluster_t *cluster, uint16_t value); -attribute_t *create_configuration_version(cluster_t *cluster, uint32_t value); - -/** These attributes are optional for the cluster, but when added to this cluster, the value is maintained internally. - * If the attributes are added in some other cluster, then the value is not maintained internally. - **/ -attribute_t *create_manufacturing_date(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_part_number(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_product_url(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_product_label(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_serial_number(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_local_config_disabled(cluster_t *cluster, bool value); -attribute_t *create_reachable(cluster_t *cluster, bool value); -attribute_t *create_product_appearance(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -} /* attribute */ -} /* basic_information */ - -namespace binding { -namespace attribute { -attribute_t *create_binding(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -} /* attribute */ -} /* binding */ - -namespace ota_software_update_requestor { -namespace attribute { -attribute_t *create_default_ota_providers(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_update_possible(cluster_t *cluster, bool value); -attribute_t *create_update_state(cluster_t *cluster, uint8_t value); -attribute_t *create_update_state_progress(cluster_t *cluster, nullable value); -} /* attribute */ -} /* ota_software_update_requestor */ - -namespace general_commissioning { -namespace attribute { -attribute_t *create_breadcrumb(cluster_t *cluster, uint64_t value); -attribute_t *create_basic_commissioning_info(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_regulatory_config(cluster_t *cluster, uint8_t value); -attribute_t *create_location_capability(cluster_t *cluster, uint8_t value); -attribute_t *create_supports_concurrent_connection(cluster_t *cluster, bool value); -attribute_t *create_tc_accepted_version(cluster_t *cluster, uint16_t value); -attribute_t *create_tc_min_required_version(cluster_t *cluster, uint16_t value); -attribute_t *create_tc_acknowledgements(cluster_t *cluster, uint16_t value); -attribute_t *create_tc_acknowledgements_required(cluster_t *cluster, bool value); -attribute_t *create_tc_update_deadline(cluster_t *cluster, nullable value); -} /* attribute */ -} /* general_commissioning */ - -#ifndef CONFIG_CUSTOM_NETWORK_CONFIG -namespace network_commissioning { -namespace attribute { -attribute_t *create_max_networks(cluster_t *cluster, uint8_t value); -attribute_t *create_networks(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_scan_max_time_seconds(cluster_t *cluster, uint8_t value); -attribute_t *create_connect_max_time_seconds(cluster_t *cluster, uint8_t value); -attribute_t *create_interface_enabled(cluster_t *cluster, bool value); -attribute_t *create_last_networking_status(cluster_t *cluster, nullable value); -attribute_t *create_last_network_id(cluster_t *cluster, uint8_t *value, uint16_t length); -attribute_t *create_last_connect_error_value(cluster_t *cluster, nullable value); -attribute_t *create_supported_wifi_bands(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_supported_thread_features(cluster_t *cluster, uint16_t value); -attribute_t *create_thread_version(cluster_t *cluster, uint16_t value); -} /* attribute */ -} /* network_commissioning */ -#endif // CONFIG_CUSTOM_NETWORK_CONFIG - -namespace general_diagnostics { -namespace attribute { -attribute_t *create_network_interfaces(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_reboot_count(cluster_t *cluster, uint16_t value); -attribute_t *create_up_time(cluster_t *cluster, uint64_t value); -attribute_t *create_total_operational_hours(cluster_t *cluster, uint32_t value); -attribute_t *create_boot_reason(cluster_t *cluster, uint8_t value); -attribute_t *create_active_hardware_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_active_radio_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_active_network_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_test_event_triggers_enabled(cluster_t *cluster, bool value); -} /* attribute */ -} /* general_diagnostics */ - -namespace software_diagnostics { -namespace attribute { -attribute_t *create_current_heap_high_watermark(cluster_t *cluster, uint64_t value); -attribute_t *create_thread_metrics(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_current_heap_free(cluster_t *cluster, uint64_t value); -attribute_t *create_current_heap_used(cluster_t *cluster, uint64_t value); -} /* attribute */ -} /* software_diagnostics */ - -namespace administrator_commissioning { -namespace attribute { -attribute_t *create_window_status(cluster_t *cluster, uint8_t value); -attribute_t *create_admin_fabric_index(cluster_t *cluster, uint16_t value); -attribute_t *create_admin_vendor_id(cluster_t *cluster, uint16_t value); -} /* attribute */ -} /* administrator_commissioning */ - -namespace operational_credentials { -namespace attribute { -attribute_t *create_nocs(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_fabrics(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_supported_fabrics(cluster_t *cluster, uint8_t value); -attribute_t *create_commissioned_fabrics(cluster_t *cluster, uint8_t value); -attribute_t *create_trusted_root_certificates(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_current_fabric_index(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* operational_credentials */ - -namespace group_key_management { -namespace attribute { -attribute_t *create_group_key_map(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_group_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_max_groups_per_fabric(cluster_t *cluster, uint16_t value); -attribute_t *create_max_group_keys_per_fabric(cluster_t *cluster, uint16_t value); -} /* attribute */ -} /* group_key_management */ - -namespace icd_management { -namespace attribute { -constexpr uint8_t k_user_active_mode_trigger_instruction_length = 128; - -attribute_t *create_idle_mode_duration(cluster_t *cluster, uint32_t value); -attribute_t *create_active_mode_duration(cluster_t *cluster, uint32_t value); -attribute_t *create_active_mode_threshold(cluster_t *cluster, uint16_t value); -attribute_t *create_registered_clients(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_icd_counter(cluster_t *cluster, uint32_t value); -attribute_t *create_clients_supported_per_fabric(cluster_t *cluster, uint16_t value); -attribute_t *create_user_active_mode_trigger_hint(cluster_t *cluster, uint32_t value); -attribute_t *create_user_active_mode_trigger_instruction(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_maximum_check_in_backoff(cluster_t *cluster, uint32_t value); -} /* attribute */ -} /* icd_management */ - -namespace wifi_network_diagnostics { -namespace attribute { -attribute_t *create_bssid(cluster_t *cluster, uint8_t *value, uint16_t length); -attribute_t *create_security_type(cluster_t *cluster, nullable value); -attribute_t *create_wifi_version(cluster_t *cluster, nullable value); -attribute_t *create_channel_number(cluster_t *cluster, nullable value); -attribute_t *create_rssi(cluster_t *cluster, nullable value); - -/** These attributes are optional for the cluster, but when added to this cluster, the value is maintained internally. - * If the attributes are added in some other cluster, then the value is not maintained internally. - **/ -attribute_t *create_beacon_lost_count(cluster_t *cluster, nullable value); -attribute_t *create_beacon_rx_count(cluster_t *cluster, nullable value); -attribute_t *create_packet_multicast_rx_count(cluster_t *cluster, nullable value); -attribute_t *create_packet_multicast_tx_count(cluster_t *cluster, nullable value); -attribute_t *create_packet_unicast_rx_count(cluster_t *cluster, nullable value); -attribute_t *create_packet_unicast_tx_count(cluster_t *cluster, nullable value); -attribute_t *create_current_max_rate(cluster_t *cluster, nullable value); -attribute_t *create_overrun_count(cluster_t *cluster, nullable value); -} /* attribute */ -} /* wifi_network_diagnostics */ - -namespace thread_network_diagnostics { -namespace attribute { -attribute_t *create_channel(cluster_t *cluster, nullable value); -attribute_t *create_routing_role(cluster_t *cluster, nullable value); -attribute_t *create_network_name(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_pan_id(cluster_t *cluster, nullable value); -attribute_t *create_extended_pan_id(cluster_t *cluster, nullable value); -attribute_t *create_mesh_local_prefix(cluster_t *cluster, uint8_t *value, uint16_t length); -attribute_t *create_neighbor_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_route_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_partition_id(cluster_t *cluster, nullable value); -attribute_t *create_weighting(cluster_t *cluster, nullable value); -attribute_t *create_data_version(cluster_t *cluster, nullable value); -attribute_t *create_stable_data_version(cluster_t *cluster, nullable value); -attribute_t *create_leader_router_id(cluster_t *cluster, nullable value); -attribute_t *create_security_policy(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_channel_page0_mask(cluster_t *cluster, uint8_t *value, uint16_t length); -attribute_t *create_operational_dataset_components(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_active_network_faults_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_ext_address(cluster_t *cluster, nullable value); -attribute_t *create_rloc16(cluster_t *cluster, nullable value); -attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value); -attribute_t *create_detached_role_count(cluster_t *cluster, uint16_t value); -attribute_t *create_child_role_count(cluster_t *cluster, uint16_t value); -attribute_t *create_router_role_count(cluster_t *cluster, uint16_t value); -attribute_t *create_leader_role_count(cluster_t *cluster, uint16_t value); -attribute_t *create_attach_attempt_count(cluster_t *cluster, uint16_t value); -attribute_t *create_partition_id_change_count(cluster_t *cluster, uint16_t value); -attribute_t *create_better_partition_attach_attempt_count(cluster_t *cluster, uint16_t value); -attribute_t *create_parent_change_count(cluster_t *cluster, uint16_t value); -attribute_t *create_tx_total_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_unicast_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_broadcast_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_ack_requested_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_acked_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_no_ack_requested_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_data_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_data_poll_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_beacon_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_beacon_request_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_other_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_retry_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_direct_max_retry_expiry_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_indirect_max_retry_expiry_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_err_cca_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_err_abort_count(cluster_t *cluster, uint32_t value); -attribute_t *create_tx_err_busy_channel_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_total_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_unicast_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_broadcast_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_data_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_data_poll_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_beacon_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_beacon_request_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_other_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_address_filtered_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_dest_addr_filtered_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_duplicated_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_err_no_frame_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_err_unknown_neighbor_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_err_invalid_src_addr_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_err_sec_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_err_fcs_count(cluster_t *cluster, uint32_t value); -attribute_t *create_rx_err_other_count(cluster_t *cluster, uint32_t value); -attribute_t *create_active_timestamp(cluster_t *cluster, nullable value); -attribute_t *create_pending_timestamp(cluster_t *cluster, nullable value); -attribute_t *create_delay(cluster_t *cluster, nullable value); -} /* attribute */ -} /* thread_network_diagnostics */ - -namespace ethernet_network_diagnostics { -namespace attribute { -attribute_t *create_phy_rate(cluster_t *cluster, nullable value); -attribute_t *create_full_duplex(cluster_t *cluster, nullable value); -attribute_t *create_packet_rx_count(cluster_t *cluster, uint64_t value); -attribute_t *create_packet_tx_count(cluster_t *cluster, uint64_t value); -attribute_t *create_tx_err_count(cluster_t *cluster, uint64_t value); -attribute_t *create_collision_count(cluster_t *cluster, uint64_t value); -attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value); -attribute_t *create_carrier_detect(cluster_t *cluster, nullable value); -attribute_t *create_time_since_reset(cluster_t *cluster, uint64_t value); -} /* attribute */ -} /* ethernet_network_diagnostics */ - -namespace bridged_device_basic_information { -constexpr uint8_t k_max_vendor_name_length = 32; -constexpr uint8_t k_max_product_name_length = 32; -constexpr uint8_t k_max_node_label_length = 32; -constexpr uint8_t k_max_hardware_version_string_length = 64; -constexpr uint8_t k_max_software_version_string_length = 64; -constexpr uint8_t k_max_manufacturing_date_length = 16; -constexpr uint8_t k_max_part_number_length = 32; -constexpr uint16_t k_max_product_url_length = 256; -constexpr uint8_t k_max_product_label_length = 64; -constexpr uint8_t k_max_serial_number_length = 32; -constexpr uint8_t k_max_unique_id_length = 32; - -namespace attribute { -attribute_t *create_vendor_name(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_vendor_id(cluster_t *cluster, uint16_t value); -attribute_t *create_product_name(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_product_id(cluster_t *cluster, uint16_t value); -attribute_t *create_node_label(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_hardware_version(cluster_t *cluster, uint16_t value); -attribute_t *create_hardware_version_string(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_software_version(cluster_t *cluster, uint32_t value); -attribute_t *create_software_version_string(cluster_t *cluster, char *value, uint16_t length); - -/** These attributes are optional for the cluster, but when added to this cluster, the value is maintained internally. - * If the attributes are added in some other cluster, then the value is not maintained internally. - **/ -attribute_t *create_manufacturing_date(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_part_number(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_product_url(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_product_label(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_serial_number(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_reachable(cluster_t *cluster, bool value); -attribute_t *create_unique_id(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_product_appearance(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_configuration_version(cluster_t *cluster, uint32_t *value); - -} /* attribute */ -} /* bridged_device_basic_information */ - -namespace user_label { -namespace attribute { -attribute_t *create_label_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -} /* attribute */ -} /* user_label */ - -namespace fixed_label { -namespace attribute { -attribute_t *create_label_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -} /* attribute */ -} /* fixed_label */ - -namespace identify { -namespace attribute { -attribute_t *create_identify_time(cluster_t *cluster, uint16_t value); -attribute_t *create_identify_type(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* identify */ - -namespace groups { -namespace attribute { -attribute_t *create_name_support(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* groups */ - -namespace scenes_management { -namespace attribute { -attribute_t *create_scene_table_size(cluster_t *cluster, uint16_t value); -attribute_t *create_fabric_scene_info(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); -} /* attribute */ -} /* scenes_management */ - -namespace on_off { -namespace attribute { -attribute_t *create_on_off(cluster_t *cluster, bool value); -attribute_t *create_global_scene_control(cluster_t *cluster, bool value); -attribute_t *create_on_time(cluster_t *cluster, uint16_t value); -attribute_t *create_off_wait_time(cluster_t *cluster, uint16_t value); -attribute_t *create_start_up_on_off(cluster_t *cluster, nullable value); -} /* attribute */ -} /* on_off */ - -namespace level_control { -namespace attribute { -attribute_t *create_current_level(cluster_t *cluster, nullable value); -attribute_t *create_on_level(cluster_t *cluster, nullable value); -attribute_t *create_options(cluster_t *cluster, uint8_t value); -attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value); -attribute_t *create_min_level(cluster_t *cluster, uint8_t value); -attribute_t *create_max_level(cluster_t *cluster, uint8_t value); -attribute_t *create_current_frequency(cluster_t *cluster, uint16_t value); -attribute_t *create_min_frequency(cluster_t *cluster, uint16_t value); -attribute_t *create_max_frequency(cluster_t *cluster, uint16_t value); -attribute_t *create_on_off_transition_time(cluster_t *cluster, uint16_t value); -attribute_t *create_on_transition_time(cluster_t* cluster, nullable value); -attribute_t *create_off_transition_time(cluster_t* cluster, nullable value); -attribute_t *create_default_move_rate(cluster_t* cluster, nullable value); -attribute_t *create_start_up_current_level(cluster_t *cluster, nullable value); -} /* attribute */ -} /* level_control */ - -namespace color_control { -constexpr uint8_t k_max_compensation_text_length = 254; - -namespace attribute { -attribute_t *create_current_hue(cluster_t *cluster, uint8_t value); -attribute_t *create_current_saturation(cluster_t *cluster, uint8_t value); -attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value); -attribute_t *create_color_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_color_control_options(cluster_t *cluster, uint8_t value); -attribute_t *create_enhanced_color_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_color_capabilities(cluster_t *cluster, uint16_t value); -attribute_t *create_color_temperature_mireds(cluster_t *cluster, uint16_t value); -attribute_t *create_color_temp_physical_min_mireds(cluster_t *cluster, uint16_t value); -attribute_t *create_color_temp_physical_max_mireds(cluster_t *cluster, uint16_t value); -attribute_t *create_couple_color_temp_to_level_min_mireds(cluster_t *cluster, uint16_t value); -attribute_t *create_start_up_color_temperature_mireds(cluster_t *cluster, nullable value); -attribute_t *create_current_x(cluster_t *cluster, uint16_t value); -attribute_t *create_current_y(cluster_t *cluster, uint16_t value); -attribute_t *create_drift_compensation(cluster_t *cluster, uint8_t value); -attribute_t *create_compensation_text(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_enhanced_current_hue(cluster_t *cluster, uint16_t value); -attribute_t *create_color_loop_active(cluster_t *cluster, uint8_t value); -attribute_t *create_color_loop_direction(cluster_t *cluster, uint8_t value); -attribute_t *create_color_loop_time(cluster_t *cluster, uint16_t value); -attribute_t *create_color_loop_start_enhanced_hue(cluster_t *cluster, uint16_t value); -attribute_t *create_color_loop_stored_enhanced_hue(cluster_t *cluster, uint16_t value); -attribute_t *create_number_of_primaries(cluster_t *cluster, nullable value); -attribute_t *create_primary_n_x(cluster_t * cluster, uint16_t value, uint8_t index); -attribute_t *create_primary_n_y(cluster_t * cluster, uint16_t value, uint8_t index); -attribute_t *create_primary_n_intensity(cluster_t * cluster, nullable value, uint8_t index); -} /* attribute */ -} /* color_control */ - -namespace fan_control { -namespace attribute { -attribute_t *create_fan_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_fan_mode_sequence(cluster_t *cluster, const uint8_t value); -attribute_t *create_percent_setting(cluster_t *cluster, nullable value); -attribute_t *create_percent_current(cluster_t *cluster, uint8_t value); -attribute_t *create_speed_max(cluster_t *cluster, uint8_t value); -attribute_t *create_speed_setting(cluster_t *cluster, nullable value); -attribute_t *create_speed_current(cluster_t *cluster, uint8_t value); -attribute_t *create_rock_support(cluster_t *cluster, uint8_t value); -attribute_t *create_rock_setting(cluster_t *cluster, uint8_t value); -attribute_t *create_wind_support(cluster_t *cluster, uint8_t value); -attribute_t *create_wind_setting(cluster_t *cluster, uint8_t value); -attribute_t *create_airflow_direction(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* fan_control */ - -namespace thermostat { -const uint8_t k_max_active_preset_handle = 16u; -const uint8_t k_max_active_schedule_handle = 16u; -namespace attribute { -attribute_t *create_local_temperature(cluster_t *cluster, nullable value); -attribute_t *create_outdoor_temperature(cluster_t *cluster, nullable value); -attribute_t *create_occupancy(cluster_t *cluster, uint8_t value); -attribute_t *create_abs_min_heat_setpoint_limit(cluster_t *cluster, int16_t value); -attribute_t *create_abs_max_heat_setpoint_limit(cluster_t *cluster, int16_t value); -attribute_t *create_abs_min_cool_setpoint_limit(cluster_t *cluster, int16_t value); -attribute_t *create_abs_max_cool_setpoint_limit(cluster_t *cluster, int16_t value); -attribute_t *create_pi_cooling_demand(cluster_t *cluster, uint8_t value); -attribute_t *create_pi_heating_demand(cluster_t *cluster, uint8_t value); -attribute_t *create_local_temperature_calibration(cluster_t *cluster, int8_t value); -attribute_t *create_occupied_cooling_setpoint(cluster_t *cluster, int16_t value); -attribute_t *create_occupied_heating_setpoint(cluster_t *cluster, int16_t value); -attribute_t *create_unoccupied_cooling_setpoint(cluster_t *cluster, int16_t value); -attribute_t *create_unoccupied_heating_setpoint(cluster_t *cluster, int16_t value); -attribute_t *create_min_heat_setpoint_limit(cluster_t *cluster, int16_t value); -attribute_t *create_max_heat_setpoint_limit(cluster_t *cluster, int16_t value); -attribute_t *create_min_cool_setpoint_limit(cluster_t *cluster, int16_t value); -attribute_t *create_max_cool_setpoint_limit(cluster_t *cluster, int16_t value); -attribute_t *create_min_setpoint_dead_band(cluster_t *cluster, int8_t value); -attribute_t *create_remote_sensing(cluster_t *cluster, uint8_t value); -attribute_t *create_control_sequence_of_operation(cluster_t *cluster, uint8_t value); -attribute_t *create_system_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_thermostat_running_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_temperature_setpoint_hold(cluster_t *cluster, uint8_t value); -attribute_t *create_temperature_setpoint_hold_duration(cluster_t *cluster, nullable value); -attribute_t *create_thermostat_programming_operation_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_thermostat_running_state(cluster_t *cluster, uint16_t value); -attribute_t *create_setpoint_change_source(cluster_t *cluster, uint8_t value); -attribute_t *create_setpoint_change_amount(cluster_t *cluster, nullable value); -attribute_t *create_setpoint_change_source_timestamp(cluster_t *cluster, uint32_t value); -attribute_t *create_occupied_setback(cluster_t *cluster, nullable value); -attribute_t *create_occupied_setback_min(cluster_t *cluster, nullable value); -attribute_t *create_occupied_setback_max(cluster_t *cluster, nullable value); -attribute_t *create_unoccupied_setback(cluster_t *cluster, nullable value); -attribute_t *create_unoccupied_setback_min(cluster_t *cluster, nullable value); -attribute_t *create_unoccupied_setback_max(cluster_t *cluster, nullable value); -attribute_t *create_emergency_heat_delta(cluster_t *cluster, uint8_t value); -attribute_t *create_ac_type(cluster_t *cluster, uint8_t value); -attribute_t *create_ac_capacity(cluster_t *cluster, uint16_t value); -attribute_t *create_ac_refrigerant_type(cluster_t *cluster, uint8_t value); -attribute_t *create_ac_compressor_type(cluster_t *cluster, uint8_t value); -attribute_t *create_ac_error_code(cluster_t *cluster, uint32_t value); -attribute_t *create_ac_louver_position(cluster_t *cluster, uint8_t value); -attribute_t *create_ac_coil_temperature(cluster_t *cluster, nullable value); -attribute_t *create_ac_capacity_format(cluster_t *cluster, uint8_t value); -attribute_t *create_preset_types(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_schedule_types(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_number_of_presets(cluster_t *cluster, uint8_t value); -attribute_t *create_number_of_schedules(cluster_t *cluster, uint8_t value); -attribute_t *create_number_of_schedule_transitions(cluster_t *cluster, uint8_t value); -attribute_t *create_number_of_schedule_transition_per_day(cluster_t *cluster, nullable value); -attribute_t *create_active_preset_handle(cluster_t *cluster, uint8_t*value, uint16_t length); -attribute_t *create_active_schedule_handle(cluster_t *cluster, uint8_t *value, uint16_t length); -attribute_t *create_presets(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_schedules(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_setpoint_hold_expiry_timestamp(cluster_t *cluster, nullable value); -} /* attribute */ -} /* thermostat */ - -namespace thermostat_user_interface_configuration { -namespace attribute { -attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value); -attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* thermostat_user_interface_configuration */ - -namespace air_quality { -namespace attribute { -attribute_t *create_air_quality(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* air_quality */ - -namespace resource_monitoring { -namespace attribute { -attribute_t *create_condition(cluster_t *cluster, uint8_t value); -attribute_t *create_degradation_direction(cluster_t *cluster, uint8_t value); -attribute_t *create_change_indication(cluster_t *cluster, uint8_t value); -attribute_t *create_in_place_indicator(cluster_t *cluster, bool value); -attribute_t *create_last_changed_time(cluster_t *cluster, nullable value); -attribute_t *create_replacement_product_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -} /* attribute */ -} /* resource_monitoring */ - -namespace hepa_filter_monitoring { -namespace attribute = resource_monitoring::attribute; -} /* hepa_filter_monitoring */ - -namespace activated_carbon_filter_monitoring { -namespace attribute = resource_monitoring::attribute; -} /* activated_carbon_filter_monitoring */ - -namespace concentration_measurement { -namespace attribute { -attribute_t *create_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value); -attribute_t *create_average_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value); -attribute_t *create_uncertainty(cluster_t *cluster, float value); -attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value); -attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value); -attribute_t *create_level_value(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* concentration_measurement */ - -namespace carbon_monoxide_concentration_measurement { -namespace attribute = concentration_measurement::attribute; -} /* carbon_monoxide_concentration_measurement */ - -namespace carbon_dioxide_concentration_measurement { -namespace attribute = concentration_measurement::attribute; -} /* carbon_dioxide_concentration_measurement */ - -namespace nitrogen_dioxide_concentration_measurement { -namespace attribute = concentration_measurement::attribute; -} /* nitrogen_dioxide_concentration_measurement */ - -namespace ozone_concentration_measurement { -namespace attribute = concentration_measurement::attribute; -} /* ozone_concentration_measurement */ - -namespace formaldehyde_concentration_measurement { -namespace attribute = concentration_measurement::attribute; -} /* formaldehyde_concentration_measurement */ - -namespace pm1_concentration_measurement { -namespace attribute = concentration_measurement::attribute; -} /* pm1_concentration_measurement */ - -namespace pm25_concentration_measurement { -namespace attribute = concentration_measurement::attribute; -} /* pm25_concentration_measurement */ - -namespace pm10_concentration_measurement { -namespace attribute = concentration_measurement::attribute; -} /* pm10_concentration_measurement */ - -namespace radon_concentration_measurement { -namespace attribute = concentration_measurement::attribute; -} /* radon_concentration_measurement */ - -namespace total_volatile_organic_compounds_concentration_measurement { -namespace attribute = concentration_measurement::attribute; -} /* total_volatile_organic_compounds_concentration_measurement */ - -namespace operational_state { -namespace attribute { -attribute_t *create_phase_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_current_phase(cluster_t *cluster, nullable value); -attribute_t *create_countdown_time(cluster_t *cluster, nullable value); -attribute_t *create_operational_state_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_operational_state(cluster_t *cluster, uint8_t value); -attribute_t *create_operational_error(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -} /* attribute */ -} /* operational_state */ - -namespace door_lock { -constexpr uint8_t k_max_language_length = 3; -constexpr uint8_t k_max_aliro_reader_verification_key = 65; -constexpr uint8_t k_max_aliro_reader_group_identifier = 16; -constexpr uint8_t k_max_aliro_reader_group_sub_identifier = 16; -constexpr uint8_t k_max_aliro_group_resolving_key = 16; - -namespace attribute { -attribute_t *create_lock_state(cluster_t *cluster, nullable value); -attribute_t *create_lock_type(cluster_t *cluster, uint8_t value); -attribute_t *create_actuator_enabled(cluster_t *cluster, bool value); -attribute_t *create_door_state(cluster_t *cluster, nullable value); -attribute_t *create_door_open_events(cluster_t *cluster, uint32_t value); -attribute_t *create_door_closed_events(cluster_t *cluster, uint32_t value); -attribute_t *create_open_period(cluster_t *cluster, uint16_t value); -attribute_t *create_number_of_total_users_supported(cluster_t *cluster, const uint16_t value); -attribute_t *create_number_of_pin_users_supported(cluster_t *cluster, const uint16_t value); -attribute_t *create_number_of_rfid_users_supported(cluster_t *cluster, const uint16_t value); -attribute_t *create_number_of_weekday_schedules_supported_per_user(cluster_t *cluster, const uint8_t value); -attribute_t *create_number_of_year_day_schedules_supported_per_user(cluster_t *cluster, const uint8_t value); -attribute_t *create_number_of_holiday_schedules_supported(cluster_t *cluster, const uint8_t value); -attribute_t *create_max_pin_code_length(cluster_t *cluster, const uint8_t value); -attribute_t *create_min_pin_code_length(cluster_t *cluster, const uint8_t value); -attribute_t *create_max_rfid_code_length(cluster_t *cluster, const uint8_t value); -attribute_t *create_min_rfid_code_length(cluster_t *cluster, const uint8_t value); -attribute_t *create_credential_rules_support(cluster_t *cluster, const uint8_t value); -attribute_t *create_number_of_credentials_supported_per_user(cluster_t *cluster, const uint8_t value); -attribute_t *create_language(cluster_t *cluster, const char * value, uint16_t length); -attribute_t *create_led_settings(cluster_t *cluster, uint8_t value); -attribute_t *create_auto_relock_time(cluster_t *cluster, uint32_t value); -attribute_t *create_sound_volume(cluster_t *cluster, uint8_t value); -attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max); -attribute_t *create_supported_operating_modes(cluster_t *cluster, const uint16_t value); -attribute_t *create_default_configuration_register(cluster_t *cluster, uint16_t value); -attribute_t *create_enable_local_programming(cluster_t *cluster, bool value); -attribute_t *create_enable_one_touch_locking(cluster_t *cluster, bool value); -attribute_t *create_enable_inside_status_led(cluster_t *cluster, bool value); -attribute_t *create_enable_privacy_mode_button(cluster_t *cluster, bool value); -attribute_t *create_local_programming_features(cluster_t *cluster, uint8_t value); -attribute_t *create_wrong_code_entry_limit(cluster_t *cluster, uint8_t value); -attribute_t *create_user_code_temporary_disable_time(cluster_t *cluster, uint8_t value); -attribute_t *create_send_pin_over_the_air(cluster_t *cluster, bool value); -attribute_t *create_require_pin_for_remote_operation(cluster_t *cluster, bool value); -attribute_t *create_expiring_user_timeout(cluster_t *cluster, uint16_t value); -attribute_t *create_aliro_reader_verification_key(cluster_t *cluster, uint8_t * value, uint16_t length); -attribute_t *create_aliro_reader_group_identifier(cluster_t *cluster, uint8_t * value, uint16_t length); -attribute_t *create_aliro_reader_group_sub_identifier(cluster_t *cluster, uint8_t * value, uint16_t length); -attribute_t *create_aliro_expedited_transaction_supported_protocol_versions(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_aliro_group_resolving_key(cluster_t *cluster, uint8_t * value, uint16_t length); -attribute_t *create_aliro_supported_bleuwb_protocol_versions(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_aliro_ble_advertising_version(cluster_t *cluster, uint8_t value); -attribute_t *create_number_of_aliro_credential_issuer_keys_supported(cluster_t *cluster, uint16_t value); -attribute_t *create_number_of_aliro_endpoint_keys_supported(cluster_t *cluster, uint16_t value); -} /* attribute */ -} /* door_lock */ - -namespace laundry_washer_controls { -namespace attribute { -attribute_t *create_spin_speeds(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_spin_speed_current(cluster_t *cluster, nullable value); -attribute_t *create_number_of_rinses(cluster_t *cluster, uint8_t value); -attribute_t *create_supported_rinses(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -} /* attribute */ -} /* laundry_washer_controls */ - -namespace laundry_dryer_controls { -namespace attribute { -attribute_t *create_supported_dryness_levels(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_selected_dryness_level(cluster_t *cluster, nullable value); -} /* attribute */ -} /* laundry_dryer_controls */ - -namespace smoke_co_alarm { -namespace attribute { -attribute_t *create_expressed_state(cluster_t *cluster, uint8_t value); -attribute_t *create_smoke_state(cluster_t *cluster, uint8_t value); -attribute_t *create_co_state(cluster_t *cluster, uint8_t value); -attribute_t *create_battery_alert(cluster_t *cluster, uint8_t value); -attribute_t *create_device_muted(cluster_t *cluster, uint8_t value); -attribute_t *create_test_in_progress(cluster_t *cluster, bool value); -attribute_t *create_hardware_fault_alert(cluster_t *cluster, bool value); -attribute_t *create_end_of_service_alert(cluster_t *cluster, uint8_t value); -attribute_t *create_interconnect_smoke_alarm(cluster_t *cluster, uint8_t value); -attribute_t *create_interconnect_co_alarm(cluster_t *cluster, uint8_t value); -attribute_t *create_contamination_state(cluster_t *cluster, uint8_t value); -attribute_t *create_smoke_sensitivity_level(cluster_t *cluster, uint8_t value); -attribute_t *create_expiry_date(cluster_t *cluster, uint32_t value); -} /* attribute */ -} /* smoke_co_alarm */ - -namespace window_covering { -namespace attribute { -attribute_t *create_type(cluster_t *cluster, uint8_t value); -attribute_t *create_number_of_actuations_lift(cluster_t *cluster, uint16_t value); -attribute_t *create_number_of_actuations_tilt(cluster_t *cluster, uint16_t value); -attribute_t *create_config_status(cluster_t *cluster, uint8_t value); -attribute_t *create_current_position_lift_percentage(cluster_t *cluster, nullable value); -attribute_t *create_current_position_tilt_percentage(cluster_t *cluster, nullable value); -attribute_t *create_operational_status(cluster_t *cluster, uint8_t value); -attribute_t *create_target_position_lift_percent_100ths(cluster_t *cluster, nullable value); -attribute_t *create_target_position_tilt_percent_100ths(cluster_t *cluster, nullable value); -attribute_t *create_end_product_type(cluster_t *cluster, const uint8_t value); -attribute_t *create_current_position_lift_percent_100ths(cluster_t *cluster, nullable value); -attribute_t *create_current_position_tilt_percent_100ths(cluster_t *cluster, nullable value); -attribute_t *create_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_safety_status(cluster_t *cluster, uint16_t value); -} /* attribute */ -} /* window_covering */ - -namespace switch_cluster { -namespace attribute { -attribute_t *create_number_of_positions(cluster_t *cluster, uint8_t value); -attribute_t *create_current_position(cluster_t *cluster, uint8_t value); -attribute_t *create_multi_press_max(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* switch_cluster */ - -namespace temperature_measurement { -namespace attribute { -attribute_t *create_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_tolerance(cluster_t *cluster, uint16_t value); -} /* attribute */ -} /* temperature_measurement */ - -namespace relative_humidity_measurement { -namespace attribute { -attribute_t *create_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_tolerance(cluster_t *cluster, nullable value); -} /* attribute */ -} /* relative_humidity_measurement */ - -namespace occupancy_sensing { -namespace attribute { -attribute_t *create_occupancy(cluster_t *cluster, uint8_t value); -attribute_t *create_occupancy_sensor_type(cluster_t *cluster, uint8_t value); -attribute_t *create_occupancy_sensor_type_bitmap(cluster_t *cluster, uint8_t value); -attribute_t *create_hold_time(cluster_t *cluster, uint16_t value); -attribute_t *create_hold_time_limits(cluster_t *cluster, uint8_t* value, uint16_t length, uint16_t count); -attribute_t *create_pir_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value); -attribute_t *create_pir_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value); -attribute_t *create_pir_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value); -attribute_t *create_ultrasonic_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value); -attribute_t *create_ultrasonic_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value); -attribute_t *create_ultrasonic_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value); -attribute_t *create_physical_contact_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value); -attribute_t *create_physical_contact_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value); -attribute_t *create_physical_contact_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* occupancy_sensing */ - -namespace boolean_state { -namespace attribute { -attribute_t *create_state_value(cluster_t *cluster, bool value); -} /* attribute */ -} /* boolean_state */ - -namespace boolean_state_configuration { -namespace attribute { -attribute_t *create_current_sensitivity_level(cluster_t *cluster, uint8_t value); -attribute_t *create_supported_sensitivity_levels(cluster_t *cluster, const uint8_t value); -attribute_t *create_default_sensitivity_level(cluster_t *cluster, const uint8_t value); -attribute_t *create_alarms_active(cluster_t *cluster, uint8_t value); -attribute_t *create_alarms_suppressed(cluster_t *cluster, uint8_t value); -attribute_t *create_alarms_enabled(cluster_t *cluster, uint8_t value); -attribute_t *create_alarms_supported(cluster_t *cluster, const uint8_t value); -attribute_t *create_sensor_fault(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* boolean_state_configuration */ - -namespace localization_configuration { - -constexpr uint8_t k_max_active_locale_length = 35; - -namespace attribute { -attribute_t *create_active_locale(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_supported_locales(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -} /* attribute */ -} /* localization_configuration */ - -namespace unit_localization { -namespace attribute { -attribute_t *create_temperature_unit(cluster_t *cluster, uint8_t value); -attribute_t *create_supported_temperature_units(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); - -} /* attribute */ -} /* unit_localization */ - -namespace time_format_localization { -namespace attribute { -attribute_t *create_hour_format(cluster_t *cluster, uint8_t value); -attribute_t *create_active_calendar_type(cluster_t *cluster, uint8_t value); -attribute_t *create_supported_calendar_types(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -} /* attribute */ -} /* time_format_localization */ - -// Note: Attribute name for the below cluster deviates from Matter spec -namespace illuminance_measurement { -namespace attribute { -attribute_t *create_measured_value(cluster_t *cluster, nullable value, nullable min, nullable max); -attribute_t *create_min_measured_value(cluster_t *cluster, nullable value, nullable min, nullable max); -attribute_t *create_max_measured_value(cluster_t *cluster, nullable value, nullable min, nullable max); -attribute_t *create_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max); -attribute_t *create_light_sensor_type(cluster_t *cluster, nullable value, nullable min, nullable max); -} /* attribute */ -} /* illuminance_measurement */ - -// Note: Attribute name for the below cluster deviates from Matter spec -namespace pressure_measurement { -namespace attribute { -attribute_t *create_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max); -attribute_t *create_scaled_value(cluster_t *cluster, nullable value); -attribute_t *create_min_scaled_value(cluster_t *cluster, nullable value); -attribute_t *create_max_scaled_value(cluster_t *cluster, nullable value); -attribute_t *create_scaled_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max); -attribute_t *create_scale(cluster_t *cluster, int8_t value); -} /* attribute */ -} /* pressure_measurement */ - -// Note: Attribute name for the below cluster deviates from Matter spec -namespace flow_measurement { -namespace attribute { -attribute_t *create_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); -attribute_t *create_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max); -} /* attribute */ -} /* flow_measurement */ - -namespace pump_configuration_and_control { -namespace attribute { -attribute_t *create_max_pressure(cluster_t *cluster, nullable value); -attribute_t *create_max_speed(cluster_t *cluster, nullable value); -attribute_t *create_max_flow(cluster_t *cluster, nullable value); -attribute_t *create_min_const_pressure(cluster_t *cluster, nullable value); -attribute_t *create_max_const_pressure(cluster_t *cluster, nullable value); -attribute_t *create_min_comp_pressure(cluster_t *cluster, nullable value); -attribute_t *create_max_comp_pressure(cluster_t *cluster, nullable value); -attribute_t *create_min_const_speed(cluster_t *cluster, nullable value); -attribute_t *create_max_const_speed(cluster_t *cluster, nullable value); -attribute_t *create_min_const_flow(cluster_t *cluster, nullable value); -attribute_t *create_max_const_flow(cluster_t *cluster, nullable value); -attribute_t *create_min_const_temp(cluster_t *cluster, nullable value); -attribute_t *create_max_const_temp(cluster_t *cluster, nullable value); -attribute_t *create_pump_status(cluster_t *cluster, uint16_t value); -attribute_t *create_effective_operation_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_effective_control_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_capacity(cluster_t *cluster, nullable value); -attribute_t *create_speed(cluster_t *cluster, nullable value); -attribute_t *create_lifetime_running_hours(cluster_t *cluster, nullable value); -attribute_t *create_power(cluster_t *cluster, nullable value); -attribute_t *create_lifetime_energy_consumed(cluster_t *cluster, nullable value); -attribute_t *create_operation_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_control_mode(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* pump_configuration_and_control */ - -namespace mode_select { -constexpr uint8_t k_max_description_length = 64; - -namespace attribute { -attribute_t *create_description(cluster_t *cluster, const char * value, uint16_t length); -attribute_t *create_standard_namespace(cluster_t *cluster, const nullable value); -attribute_t *create_supported_modes(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_start_up_mode(cluster_t *cluster, nullable value); -attribute_t *create_on_mode(cluster_t *cluster, nullable value); -} /* attribute */ -} /* mode_select */ - -namespace power_source { -constexpr uint8_t k_max_description_length = 60; -constexpr uint8_t k_max_fault_count = 8; -constexpr uint8_t k_max_designation_count = 20; -constexpr uint8_t k_max_charge_faults_count = 16; -constexpr uint8_t k_max_bat_replacement_description_length = 60; -constexpr uint8_t k_max_endpoint_count = 16; - -namespace attribute { -attribute_t *create_status(cluster_t *cluster, uint8_t value); -attribute_t *create_order(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max); -attribute_t *create_description(cluster_t *cluster, const char * value, uint16_t length); -attribute_t *create_wired_assessed_input_voltage(cluster_t *cluster, nullable value, nullable min, nullable max); -attribute_t *create_wired_assessed_input_frequency(cluster_t *cluster, nullable value, nullable min, nullable max); -attribute_t *create_wired_current_type(cluster_t *cluster, const uint8_t value); -attribute_t *create_wired_assessed_current(cluster_t *cluster, nullable value, nullable min, nullable max); -attribute_t *create_wired_nominal_voltage(cluster_t *cluster, const uint32_t value, uint32_t min, uint32_t max); -attribute_t *create_wired_maximum_current(cluster_t *cluster, const uint32_t value, uint32_t min, uint32_t max); -attribute_t *create_wired_present(cluster_t *cluster, bool value); -attribute_t *create_active_wired_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_bat_voltage(cluster_t *cluster, nullable value, nullable min, nullable max); -attribute_t *create_bat_percent_remaining(cluster_t *cluster, nullable value, nullable min, nullable max); -attribute_t *create_bat_time_remaining(cluster_t *cluster, nullable< uint32_t> value, nullable min, nullable max); -attribute_t *create_bat_charge_level(cluster_t *cluster, uint8_t value); -attribute_t *create_bat_replacement_needed(cluster_t *cluster, bool value); -attribute_t *create_bat_replaceability(cluster_t *cluster, const uint8_t value); -attribute_t *create_bat_present(cluster_t *cluster, bool value); -attribute_t *create_active_bat_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_bat_replacement_description(cluster_t *cluster, const char * value, uint16_t length); -attribute_t *create_bat_common_designation(cluster_t *cluster, const uint8_t value, uint8_t min, uint8_t max); -attribute_t *create_bat_ansi_designation(cluster_t *cluster, const char * value, uint16_t length); -attribute_t *create_bat_iec_designation(cluster_t *cluster, const char * value, uint16_t length); -attribute_t *create_bat_approved_chemistry(cluster_t *cluster, const uint8_t value, uint8_t min, uint8_t max); -attribute_t *create_bat_capacity(cluster_t *cluster, const uint32_t value, uint32_t min, uint32_t max); -attribute_t *create_bat_quantity(cluster_t *cluster, const uint8_t value, uint8_t min, uint8_t max); -attribute_t *create_bat_charge_state(cluster_t *cluster, uint8_t value); -attribute_t *create_bat_time_to_full_charge(cluster_t *cluster, nullable value, nullable min, nullable max); -attribute_t *create_bat_functional_while_charging(cluster_t *cluster, bool value); -attribute_t *create_bat_charging_current(cluster_t *cluster, nullable value, nullable min, nullable max); -attribute_t *create_active_bat_charge_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_endpoint_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -} /* attribute */ -} /* power_source */ - -namespace temperature_control { -constexpr uint8_t k_max_temp_level_count = 16; - -namespace attribute { -attribute_t *create_temperature_setpoint(cluster_t *cluster, int16_t value); -attribute_t *create_min_temperature(cluster_t *cluster, const int16_t value); -attribute_t *create_max_temperature(cluster_t *cluster, const int16_t value); -attribute_t *create_step(cluster_t *cluster, const int16_t value); -attribute_t *create_selected_temperature_level(cluster_t *cluster, uint8_t value); -attribute_t *create_supported_temperature_levels(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -} /* attribute */ -} /* temperature_control */ - -namespace refrigerator_alarm { -namespace attribute { -attribute_t *create_mask(cluster_t *cluster, uint32_t value); -attribute_t *create_state(cluster_t *cluster, uint32_t value); -attribute_t *create_supported(cluster_t *cluster, uint32_t value); -} /* attribute */ -} /* refrigerator_alarm */ - -namespace mode_base { -namespace attribute { -attribute_t *create_supported_modes(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_start_up_mode(cluster_t *cluster, nullable value); -attribute_t *create_on_mode(cluster_t *cluster, nullable value); -} /* attribute */ -} /* mode_base */ - -namespace power_topology { -namespace attribute { -attribute_t *create_available_endpoints(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_active_endpoints(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); -} /* attribute */ -} /* power_topology */ - -namespace electrical_power_measurement { -namespace attribute { -attribute_t *create_power_mode(cluster_t *cluster, uint8_t value); -attribute_t *create_number_of_measurement_types(cluster_t *cluster, const uint8_t value); -attribute_t *create_accuracy(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_ranges(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_voltage(cluster_t *cluster, nullable value); -attribute_t *create_active_current(cluster_t *cluster, nullable value); -attribute_t *create_reactive_current(cluster_t *cluster, nullable value); -attribute_t *create_apparent_current(cluster_t *cluster, nullable value); -attribute_t *create_active_power(cluster_t *cluster, nullable value); -attribute_t *create_reactive_power(cluster_t *cluster, nullable value); -attribute_t *create_apparent_power(cluster_t *cluster, nullable value); -attribute_t *create_rms_voltage(cluster_t *cluster, nullable value); -attribute_t *create_rms_current(cluster_t *cluster, nullable value); -attribute_t *create_rms_power(cluster_t *cluster, nullable value); -attribute_t *create_frequency(cluster_t *cluster, nullable value); -attribute_t *create_harmonic_currents(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_harmonic_phases(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_power_factor(cluster_t *cluster, nullable value); -attribute_t *create_neutral_current(cluster_t *cluster, nullable value); -} /* attribute */ -} /* electrical_power_measurement */ - -namespace electrical_energy_measurement { -namespace attribute { -attribute_t *create_accuracy(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count); -attribute_t *create_cumulative_energy_imported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count); -attribute_t *create_cumulative_energy_exported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count); -attribute_t *create_periodic_energy_imported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count); -attribute_t *create_periodic_energy_exported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count); -attribute_t *create_cumulative_energy_reset(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count); -} /* attribute */ -} /* electrical_energy_measurement */ - -namespace energy_evse { -namespace attribute { - -constexpr uint8_t k_max_vehicle_id_length = 32; - -attribute_t *create_state(cluster_t *cluster, nullable value); -attribute_t *create_supply_state(cluster_t *cluster, uint8_t value); -attribute_t *create_fault_state(cluster_t *cluster, uint8_t value); -attribute_t *create_charging_enabled_until(cluster_t *cluster, nullable value); -attribute_t *create_discharging_enabled_until(cluster_t *cluster, nullable value); -attribute_t *create_circuit_capacity(cluster_t *cluster, int64_t value); -attribute_t *create_minimum_charge_current(cluster_t *cluster, int64_t value); -attribute_t *create_maximum_charge_current(cluster_t *cluster, int64_t value); -attribute_t *create_maximum_discharge_current(cluster_t *cluster, int64_t value); -attribute_t *create_user_maximum_charge_current(cluster_t *cluster, int64_t value); -attribute_t *create_randomization_delay_window(cluster_t *cluster, uint32_t value); -attribute_t *create_next_charge_start_time(cluster_t *cluster, nullable value); -attribute_t *create_next_charge_target_time(cluster_t *cluster, nullable value); -attribute_t *create_next_charge_required_energy(cluster_t *cluster, nullable value); -attribute_t *create_next_charge_target_soc(cluster_t *cluster, nullable value); -attribute_t *create_approximate_ev_efficiency(cluster_t *cluster, nullable value); -attribute_t *create_state_of_charge(cluster_t *cluster, nullable value); -attribute_t *create_battery_capacity(cluster_t *cluster, nullable value); -attribute_t *create_vehicle_id(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_session_id(cluster_t *cluster, nullable value); -attribute_t *create_session_duration(cluster_t *cluster, nullable value); -attribute_t *create_session_energy_charged(cluster_t *cluster, nullable value); -attribute_t *create_session_energy_discharged(cluster_t *cluster, nullable value); -} /* attribute */ -} /* energy_evse */ - -namespace microwave_oven_control { -namespace attribute { -attribute_t *create_cook_time(cluster_t *cluster, uint32_t value); -attribute_t *create_max_cook_time(cluster_t *cluster, uint32_t value); -attribute_t *create_power_setting(cluster_t *cluster, uint8_t value); -attribute_t *create_min_power(cluster_t *cluster, uint8_t value); -attribute_t *create_max_power(cluster_t *cluster, uint8_t value); -attribute_t *create_power_step(cluster_t *cluster, uint8_t value); -attribute_t *create_supported_watts(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_selected_watt_index(cluster_t *cluster, uint8_t value); -attribute_t *create_watt_rating(cluster_t *cluster, uint16_t value); -} /* attribute */ -} /* microwave_oven_control */ - -namespace valve_configuration_and_control { -namespace attribute { -attribute_t *create_open_duration(cluster_t *cluster, nullable value); -attribute_t *create_default_open_duration(cluster_t *cluster, nullable value); -attribute_t *create_auto_close_time(cluster_t *cluster, nullable value); -attribute_t *create_remaining_duration(cluster_t *cluster, nullable value); -attribute_t *create_current_state(cluster_t *cluster, nullable value); -attribute_t *create_target_state(cluster_t *cluster, nullable value); -attribute_t *create_current_level(cluster_t *cluster, nullable value); -attribute_t *create_target_level(cluster_t *cluster, nullable value); -attribute_t *create_default_open_level(cluster_t *cluster, uint8_t value); -attribute_t *create_valve_fault(cluster_t *cluster, uint16_t value); -attribute_t *create_level_step(cluster_t *cluster, const uint8_t value); -} /* attribute */ -} /* valve_configuration_and_control */ - -namespace device_energy_management { -namespace attribute { -attribute_t *create_esa_type(cluster_t *cluster, const uint8_t value); -attribute_t *create_esa_can_generate(cluster_t *cluster, const bool value); -attribute_t *create_esa_state(cluster_t *cluster, uint8_t value); -attribute_t *create_abs_min_power(cluster_t *cluster, int64_t value); -attribute_t *create_abs_max_power(cluster_t *cluster, int64_t value); -attribute_t *create_power_adjustment_capability(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_forecast(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_opt_out_state(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* device_energy_management */ - -namespace application_basic { -constexpr uint8_t k_max_vendor_name_length = 32; -constexpr uint8_t k_max_application_version_length = 32; - -namespace attribute { -attribute_t *create_vendor_name(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_vendor_id(cluster_t *cluster, uint16_t value); -attribute_t *create_application_name(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_product_id(cluster_t *cluster, uint16_t value); -attribute_t *create_application(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_status(cluster_t *cluster, uint16_t value); -attribute_t *create_application_version(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_allowed_vendor_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -} /* attribute */ -} /* application_basic */ - -namespace thread_border_router_management { -namespace attribute { -attribute_t *create_border_router_name(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_border_agent_id(cluster_t *cluster, uint8_t *value, uint16_t length); -attribute_t *create_thread_version(cluster_t *cluster, uint16_t value); -attribute_t *create_interface_enabled(cluster_t *cluster, bool value); -attribute_t *create_active_dataset_timestamp(cluster_t *cluster, nullable value); -attribute_t *create_pending_dataset_timestamp(cluster_t *cluster, nullable value); -} /* attribute */ -} /* thread_border_router_management */ - -namespace wifi_network_management { -namespace attribute { -attribute_t *create_ssid(cluster_t *cluster, uint8_t *value, uint16_t length); -attribute_t *create_passphrase_surrogate(cluster_t *cluster, nullable value); -} /* attribute */ -} /* wifi_network_management */ - -namespace thread_network_directory { -namespace attribute { -attribute_t *create_preferred_extended_pan_id(cluster_t *cluster, uint8_t *value, uint16_t length); -attribute_t *create_thread_networks(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_thread_network_table_size(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* thread_network_directory */ - -namespace service_area { -namespace attribute { -attribute_t *create_supported_areas(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_supported_maps(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_selected_areas(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_current_area(cluster_t *cluster, nullable value); -attribute_t *create_estimated_end_time(cluster_t *cluster, nullable value); -attribute_t *create_progress(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -} /* attribute */ -} /* service_area */ - -namespace water_heater_management { -namespace attribute { -attribute_t *create_heater_types(cluster_t *cluster, uint8_t value); -attribute_t *create_heat_demand(cluster_t *cluster, uint8_t value); -attribute_t *create_tank_volume(cluster_t *cluster, uint16_t value); -attribute_t *create_estimated_heat_required(cluster_t *cluster, int64_t value); -attribute_t *create_tank_percentage(cluster_t *cluster, uint8_t value); -attribute_t *create_boost_state(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* water_heater_management */ - -namespace energy_preference { -namespace attribute { -attribute_t *create_energy_balances(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_current_energy_balance(cluster_t *cluster, uint8_t value); -attribute_t *create_energy_priorities(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_low_power_mode_sensitivities(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_current_low_power_mode_sensitivity(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* energy_preference */ - -namespace commissioner_control { -namespace attribute { -attribute_t *create_supported_device_categories(cluster_t *cluster, uint32_t value); -} /* attribute */ -} /* commissioner_control */ - -namespace ecosystem_information { -namespace attribute { -attribute_t *create_device_directory(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_location_directory(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -} /* attribute */ -} /* ecosystem_information */ - -namespace time_synchronization { -namespace attribute { -attribute_t *create_utc_time(cluster_t *cluster, nullable value); -attribute_t *create_granularity(cluster_t *cluster, uint8_t value); -attribute_t *create_time_source(cluster_t *cluster, uint8_t value); -attribute_t *create_trusted_time_source(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_default_ntp(cluster_t *cluster, char *value, uint16_t length); -attribute_t *create_time_zone(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_dst_offset(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); -attribute_t *create_local_time(cluster_t *cluster, nullable value); -attribute_t *create_time_zone_database(cluster_t *cluster, uint8_t value); -attribute_t *create_ntp_server_available(cluster_t *cluster, bool value); -attribute_t *create_time_zone_list_max_size(cluster_t *cluster, uint8_t value); -attribute_t *create_dst_offset_list_max_size(cluster_t *cluster, uint8_t value); -attribute_t *create_supports_dns_resolve(cluster_t *cluster, bool value); -} /* attribute */ -} /* time_synchronization */ - -namespace camera_av_stream_management { -namespace attribute { -attribute_t *create_max_concurrent_encoders(cluster_t *cluster, uint8_t value); -attribute_t *create_max_encoded_pixel_rate(cluster_t *cluster, uint32_t value); -attribute_t *create_video_sensor_params(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_night_vision_uses_infrared(cluster_t *cluster, bool value); -attribute_t *create_min_viewport_resolution(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_rate_distortion_trade_off_points(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_max_content_buffer_size(cluster_t *cluster, uint32_t value); -attribute_t *create_microphone_capabilities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_speaker_capabilities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_two_way_talk_support(cluster_t *cluster, uint8_t value); -attribute_t *create_snapshot_capabilities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_max_network_bandwidth(cluster_t *cluster, uint32_t value); -attribute_t *create_current_frame_rate(cluster_t *cluster, uint16_t value); -attribute_t *create_hdr_mode_enabled(cluster_t *cluster, bool value); -attribute_t *create_supported_stream_usages(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_allocated_video_streams(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_allocated_audio_streams(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_allocated_snapshot_streams(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_stream_usage_priorities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_soft_recording_privacy_mode_enabled(cluster_t *cluster, bool value); -attribute_t *create_soft_livestream_privacy_mode_enabled(cluster_t *cluster, bool value); -attribute_t *create_hard_privacy_mode_on(cluster_t *cluster, bool value); -attribute_t *create_night_vision(cluster_t *cluster, uint8_t value); -attribute_t *create_night_vision_illum(cluster_t *cluster, uint8_t value); -attribute_t *create_viewport(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_speaker_muted(cluster_t *cluster, bool value); -attribute_t *create_speaker_volume_level(cluster_t *cluster, uint8_t value); -attribute_t *create_speaker_max_level(cluster_t *cluster, uint8_t value); -attribute_t *create_speaker_min_level(cluster_t *cluster, uint8_t value); -attribute_t *create_microphone_muted(cluster_t *cluster, bool value); -attribute_t *create_microphone_volume_level(cluster_t *cluster, uint8_t value); -attribute_t *create_microphone_max_level(cluster_t *cluster, uint8_t value); -attribute_t *create_microphone_min_level(cluster_t *cluster, uint8_t value); -attribute_t *create_microphone_agc_enabled(cluster_t *cluster, bool value); -attribute_t *create_image_rotation(cluster_t *cluster, uint16_t value); -attribute_t *create_image_flip_horizontal(cluster_t *cluster, bool value); -attribute_t *create_image_flip_vertical(cluster_t *cluster, bool value); -attribute_t *create_local_video_recording_enabled(cluster_t *cluster, bool value); -attribute_t *create_local_snapshot_recording_enabled(cluster_t *cluster, bool value); -attribute_t *create_status_light_enabled(cluster_t *cluster, bool value); -attribute_t *create_status_light_brightness(cluster_t *cluster, uint8_t value); - -} /* attribute */ -} /*camera av stream management*/ - -namespace webrtc_transport_provider { -namespace attribute { -attribute_t *create_current_sessions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); - -} /* attribute */ -}/*webrtc transport provider*/ - -namespace webrtc_transport_requestor { -namespace attribute { -attribute_t *create_current_sessions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); - -} /* attribute */ -}/*webrtc transport requestor*/ - -namespace chime { -namespace attribute { - -attribute_t *create_installed_chime_sounds(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_selected_chime(cluster_t *cluster, uint8_t value); -attribute_t *create_enabled(cluster_t *cluster, bool value); -} /* attribute */ -} /* chime */ - -namespace closure_control { -namespace attribute { - -attribute_t *create_countdown_time(cluster_t *cluster, nullable value); -attribute_t *create_main_state(cluster_t *cluster, uint8_t value); -attribute_t *create_current_error_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_overall_current_state(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_overall_target_state(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_latch_control_modes(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* closure_control */ - -namespace closure_dimension { -namespace attribute { - -attribute_t *create_current_state(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_target_state(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_resolution(cluster_t *cluster, uint16_t value); -attribute_t *create_step_value(cluster_t *cluster, uint16_t value); -attribute_t *create_unit(cluster_t *cluster, uint8_t value); -attribute_t *create_unit_range(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_limit_range(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_translation_direction(cluster_t *cluster, uint8_t value); -attribute_t *create_rotation_axis(cluster_t *cluster, uint8_t value); -attribute_t *create_overflow(cluster_t *cluster, uint8_t value); -attribute_t *create_modulation_type(cluster_t *cluster, uint8_t value); -attribute_t *create_latch_control_modes(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* closure_dimension */ - -namespace camera_av_settings_user_level_management { -namespace attribute { - -attribute_t *create_mptz_position(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_max_presets(cluster_t *cluster, uint8_t value); -attribute_t *create_mptz_presets(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_dptz_streams(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_zoom_max(cluster_t *cluster, uint8_t value); -attribute_t *create_tilt_min(cluster_t *cluster, int16_t value); -attribute_t *create_tilt_max(cluster_t *cluster, int16_t value); -attribute_t *create_pan_min(cluster_t *cluster, int16_t value); -attribute_t *create_pan_max(cluster_t *cluster, int16_t value); -attribute_t *create_movement_state(cluster_t *cluster, uint8_t value); -} /* attribute */ -} /* camera_av_settings_user_level_management */ - -namespace push_av_stream_transport { -namespace attribute { - -attribute_t *create_supported_formats(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_current_connections(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -} /* attribute */ -} /* push_av_stream_transport */ - -namespace commodity_tariff { -namespace attribute { -attribute_t *create_tariff_info(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_tariff_unit(cluster_t *cluster, nullable value); -attribute_t *create_start_date(cluster_t *cluster, nullable value); -attribute_t *create_day_entries(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_day_patterns(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_calendar_periods(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_individual_days(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_current_day(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_next_day(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_current_day_entry(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_current_day_entry_date(cluster_t *cluster, nullable value); -attribute_t *create_next_day_entry(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_next_day_entry_date(cluster_t *cluster, nullable value); -attribute_t *create_tariff_components(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_tariff_periods(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_current_tariff_components(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_next_tariff_components(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_default_randomization_offset(cluster_t *cluster, nullable value); -attribute_t *create_default_randomization_type(cluster_t *cluster, nullable value); -} /* attribute */ -} /* commodity_tariff */ - -namespace commodity_price { -namespace attribute { -attribute_t *create_tariff_unit(cluster_t *cluster, uint8_t value); -attribute_t *create_currency(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_current_price(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_price_forecast(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -} /* attribute */ -} /* commodity_price */ - -namespace commodity_metering { -namespace attribute { - -attribute_t *create_metered_quantity(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_metered_quantity_timestamp(cluster_t *cluster, nullable value); -attribute_t *create_tariff_unit(cluster_t *cluster, nullable value); -attribute_t *create_maximum_metered_quantities(cluster_t *cluster, nullable value); -} /* attribute */ -} /* commodity_metering */ - -namespace electrical_grid_conditions { -namespace attribute { - -attribute_t *create_local_generation_available(cluster_t *cluster, nullable value); -attribute_t *create_current_conditions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_forecast_conditions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -} /* attribute */ -} /* electrical_grid_conditions */ - -namespace meter_identification { -namespace attribute { - -attribute_t *create_meter_type(cluster_t *cluster, nullable value); -attribute_t *create_point_of_delivery(cluster_t *cluster, char * value, uint16_t length); -attribute_t *create_meter_serial_number(cluster_t *cluster, char * value, uint16_t length); -attribute_t *create_protocol_version(cluster_t *cluster, char * value, uint16_t length); -attribute_t *create_power_threshold(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -} /* attribute */ -} /* meter_identification */ - -namespace soil_measurement { -namespace attribute { - -attribute_t *create_soil_moisture_measurement_limits(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_soil_moisture_measured_value(cluster_t *cluster, nullable value); -} /* attribute */ -} /* soil_measurement */ - -namespace zone_management { -namespace attribute { - -attribute_t *create_max_user_defined_zones(cluster_t *cluster, uint8_t value); -attribute_t *create_max_zones(cluster_t *cluster, uint8_t value); -attribute_t *create_zones(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_triggers(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -attribute_t *create_sensitivity_max(cluster_t *cluster, uint8_t value); -attribute_t *create_sensitivity(cluster_t *cluster, uint8_t value); -attribute_t *create_two_d_cartesian_max(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); -} /* attribute */ -} /* zone_management */ - -} /* cluster */ -} /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_cluster.h b/components/esp_matter/data_model/esp_matter_cluster.h index ab39ef554..1ad74cdda 100644 --- a/components/esp_matter/data_model/esp_matter_cluster.h +++ b/components/esp_matter/data_model/esp_matter_cluster.h @@ -13,1062 +13,9 @@ // limitations under the License. #pragma once - -#include -#include -#include -#include - -#include -#include -#include - -namespace esp_matter { -namespace cluster { - -/** Specific cluster create APIs - * - * These APIs also create the mandatory attributes and commands for the cluster. If the mandatory attribute is not - * managed internally, then a config is present for that attribute. The constructor for the config will set the - * attribute to the default value from the spec. - * - * If some standard cluster is not present here, it can be added. - * If a custom cluster needs to be created, the low level esp_matter::cluster::create() API can be used. - */ - -/** Note: Some features might appear to be missing in the cluster configuration because a feature configuration is - * only created if there are mandatory attributes managed by Esp-Matter. Since these features do not have any mandatory - * attributes, they have not been added to the cluster configuration. - * To create such features, you can directly pass their feature IDs in the features_flag of the cluster configuration. - */ - -namespace common { - -typedef struct config { - // Empty config for API consistency -} config_t; - -} /* common */ - -namespace descriptor { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* descriptor */ - -namespace actions { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* actions */ - -namespace access_control { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* access_control */ - -namespace basic_information { -typedef struct config { - char node_label[k_max_node_label_length + 1]; - config() : node_label{0} {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* basic_information */ - -namespace binding { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* binding */ - -namespace ota_software_update_provider { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* ota_software_update_provider */ - -namespace ota_software_update_requestor { -typedef struct config { - bool update_possible; - uint8_t update_state; - nullable update_state_progress; - config() : update_possible(true), update_state(0), update_state_progress() {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* ota_software_update_requestor */ - -namespace general_commissioning { -typedef struct config { - uint64_t breadcrumb; - config() : breadcrumb(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* general_commissioning */ - -#ifndef CONFIG_CUSTOM_NETWORK_CONFIG -namespace network_commissioning { -typedef struct config { - uint32_t feature_map; - config() : -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI - feature_map(chip::to_underlying(chip::app::Clusters::NetworkCommissioning::Feature::kWiFiNetworkInterface)) {} -#elif CHIP_DEVICE_CONFIG_ENABLE_THREAD - feature_map(chip::to_underlying(chip::app::Clusters::NetworkCommissioning::Feature::kThreadNetworkInterface)) {} +#include +#if CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL +#include "generated/clusters/all_clusters.h" #else - feature_map(chip::to_underlying(chip::app::Clusters::NetworkCommissioning::Feature::kEthernetNetworkInterface)) {} +#include "legacy/esp_matter_cluster_impl.h" #endif -} config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* network_commissioning */ -#endif // CONFIG_CUSTOM_NETWORK_CONFIG - -namespace diagnostic_logs { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* diagnostic_logs */ - -namespace general_diagnostics { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* general_diagnostics */ - -namespace software_diagnostics { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* software_diagnostics */ - -namespace administrator_commissioning { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* administrator_commissioning */ - -namespace operational_credentials { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* operational_credentials */ - -namespace group_key_management { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, uint8_t flags); -} /* group_key_management */ - -namespace wifi_network_diagnostics { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* wifi_network_diagnostics */ - -namespace thread_network_diagnostics { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* thread_network_diagnostics */ - -namespace ethernet_network_diagnostics { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* ethernet_network_diagnostics */ - -namespace time_synchronization { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* time_synchronization */ - -namespace unit_localization { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* unit_localization */ - -namespace bridged_device_basic_information { -typedef struct config { - bool reachable; - config() : reachable(true) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* bridged_device_basic_information */ - -namespace power_source { -typedef struct config { - uint8_t status; - uint8_t order; - char description[k_max_description_length + 1]; - struct { - feature::wired::config_t wired; - feature::battery::config_t battery; - feature::rechargeable::config_t rechargeable; - feature::replaceable::config_t replaceable; - } features; - uint32_t feature_flags; - config() : status(0), order(0), description{0}, feature_flags(0) {} -} config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* power_source */ - -namespace icd_management { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* icd_management */ - -namespace user_label { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* user_label */ - -namespace fixed_label { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* fixed_label */ - -namespace identify { -typedef struct config { - uint16_t identify_time; - uint8_t identify_type; - config() : identify_time(0), identify_type(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* identify */ - -namespace groups { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -uint8_t get_server_cluster_count(); -} /* groups */ - -namespace scenes_management { -typedef struct config { - uint16_t scene_table_size; - config() : scene_table_size(16) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* scenes_management */ - -namespace on_off { -typedef struct config { - bool on_off; - config() : on_off(false) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* on_off */ - -namespace level_control { -typedef struct config { - nullable current_level; - nullable on_level; - uint8_t options; - config() : current_level(), on_level(), options(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* level_control */ - -namespace color_control { -typedef struct config { - uint8_t color_mode; - uint8_t color_control_options; - uint8_t enhanced_color_mode; - uint16_t color_capabilities; - nullable number_of_primaries; - config() : color_mode(1), color_control_options(0), enhanced_color_mode(1), - color_capabilities(0), number_of_primaries(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* color_control */ - -namespace fan_control { -typedef struct config { - uint8_t fan_mode; - uint8_t fan_mode_sequence; - nullable percent_setting; - uint8_t percent_current; - void *delegate; - config() : fan_mode(0), fan_mode_sequence(2), percent_setting(0), percent_current(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* fan_control */ - -namespace thermostat { -typedef struct config { - nullable local_temperature; - uint8_t control_sequence_of_operation; - uint8_t system_mode; - void *delegate; - struct { - feature::heating::config_t heating; - feature::cooling::config_t cooling; - feature::auto_mode::config_t auto_mode; - feature::occupancy::config_t occupancy; - feature::setback::config_t setback; - feature::local_temperature_not_exposed::config_t local_temperature_not_exposed; - feature::matter_schedule_configuration::config_t matter_schedule_configuration; - } features; - uint32_t feature_flags; - config() : local_temperature(), control_sequence_of_operation(4), system_mode(1), delegate(nullptr), feature_flags(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* thermostat */ - -namespace thermostat_user_interface_configuration { -typedef struct config { - uint8_t temperature_display_mode; - uint8_t keypad_lockout; - config() : temperature_display_mode(0), keypad_lockout(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* thermostat_user_interface_configuration */ - -namespace air_quality { -using config_t = common::config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* air_quality */ - -namespace resource_monitoring { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -} /* resource_monitoring */ - -namespace hepa_filter_monitoring { -using config_t = resource_monitoring::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* hepa_filter_monitoring */ - -namespace activated_carbon_filter_monitoring { -using config_t = resource_monitoring::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* activated_carbon_filter_monitoring */ - -namespace concentration_measurement { -typedef struct config { - uint8_t measurement_medium; - struct { - feature::numeric_measurement::config_t numeric_measurement; - feature::level_indication::config_t level_indication; - feature::peak_measurement::config_t peak_measurement; - feature::average_measurement::config_t average_measurement; - } features; - uint32_t feature_flags; - void *delegate; - config() : measurement_medium(0), feature_flags(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t cluster_id); -} /* concentration_measurement */ - -namespace carbon_monoxide_concentration_measurement { -using config_t = concentration_measurement::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* carbon_monoxide_concentration_measurement */ - -namespace carbon_dioxide_concentration_measurement { -using config_t = concentration_measurement::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* carbon_dioxide_concentration_measurement */ - -namespace nitrogen_dioxide_concentration_measurement { -using config_t = concentration_measurement::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* nitrogen_dioxide_concentration_measurement */ - -namespace ozone_concentration_measurement { -using config_t = concentration_measurement::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* ozone_concentration_measurement */ - -namespace formaldehyde_concentration_measurement { -using config_t = concentration_measurement::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* formaldehyde_concentration_measurement */ - -namespace pm1_concentration_measurement { -using config_t = concentration_measurement::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* pm1_concentration_measurement */ - -namespace pm25_concentration_measurement { -using config_t = concentration_measurement::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* pm25_concentration_measurement */ - -namespace pm10_concentration_measurement { -using config_t = concentration_measurement::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* pm10_concentration_measurement */ - -namespace radon_concentration_measurement { -using config_t = concentration_measurement::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* radon_concentration_measurement */ - -namespace total_volatile_organic_compounds_concentration_measurement { -using config_t = concentration_measurement::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* total_volatile_organic_compounds_concentration_measurement */ - -namespace operational_state { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* operational_state */ - -namespace laundry_washer_mode { -typedef struct config { - uint8_t current_mode; - void *delegate; - config() : current_mode(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* laundry_washer_mode */ - -namespace laundry_washer_controls { -typedef struct config { - struct { - feature::spin::config_t spin; - feature::rinse::config_t rinse; - } features; - uint32_t feature_flags; - void *delegate; - config() : feature_flags(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* laundry_washer_controls */ - -namespace laundry_dryer_controls { -typedef struct config { - nullable selected_dryness_level; - void *delegate; - config() : selected_dryness_level(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* laundry_dryer_controls */ - -namespace dish_washer_mode { -typedef struct config { - uint8_t current_mode; - void *delegate; - config() : current_mode(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* dish_washer_mode */ - -namespace dish_washer_alarm { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* dish_washer_alarm */ - -namespace smoke_co_alarm { -typedef struct config { - uint32_t feature_flags; - config() : feature_flags(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* smoke_co_alarm */ - -namespace door_lock { -typedef struct config { - nullable lock_state; - uint8_t lock_type; - bool actuator_enabled; - uint8_t operating_mode; - uint16_t supported_operating_modes; - void *delegate; - config() : lock_state(0), lock_type(0), actuator_enabled(0), operating_mode(0), supported_operating_modes(0xFFF6), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* door_lock */ - -namespace window_covering { -typedef struct config { - uint8_t type; - uint8_t config_status; - uint8_t operational_status; - const uint8_t end_product_type; - uint8_t mode; - struct { - feature::position_aware_lift::config_t position_aware_lift; - feature::position_aware_tilt::config_t position_aware_tilt; - } features; - uint32_t feature_flags; - void *delegate; - config(uint8_t end_product_type = 0) : type(0), config_status(0), operational_status(0), end_product_type(end_product_type), mode(0), feature_flags(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* window_covering */ - -namespace switch_cluster { -typedef struct config { - uint8_t number_of_positions; - uint8_t current_position; - struct { - feature::momentary_switch_multi_press::config_t momentary_switch_multi_press; - } features; - uint32_t feature_flags; - config() : number_of_positions(2), current_position(0), feature_flags(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* switch_cluster */ - -namespace temperature_measurement { -typedef struct config { - nullable measured_value; - nullable min_measured_value; - nullable max_measured_value; - config() : measured_value(), min_measured_value(), max_measured_value() {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* temperature_measurement */ - -namespace relative_humidity_measurement { -typedef struct config { - nullable measured_value; - nullable min_measured_value; - nullable max_measured_value; - config() : measured_value(), min_measured_value(), max_measured_value() {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* relative_humidity_measurement */ - -namespace occupancy_sensing { -typedef struct config { - uint8_t occupancy; - uint8_t occupancy_sensor_type; - uint8_t occupancy_sensor_type_bitmap; - uint32_t feature_flags; - config() : occupancy(0), occupancy_sensor_type(0), - occupancy_sensor_type_bitmap(0), feature_flags(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* occupancy_sensing */ - -namespace boolean_state { -typedef struct config { - bool state_value; - config() : state_value(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* boolean_state */ - -namespace boolean_state_configuration { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* boolean_state */ - -namespace localization_configuration { -typedef struct config { - char active_locale[k_max_active_locale_length + 1]; - config() : active_locale{0} {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* localization_configuration_cluster */ - -namespace time_format_localization { -typedef struct config { - uint8_t hour_format; - config() : hour_format(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* time_format_localization */ - -namespace illuminance_measurement { -typedef struct config { - nullable measured_value; - nullable min_measured_value; - nullable max_measured_value; - config() : measured_value(0), min_measured_value(), max_measured_value() {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* illuminance_measurement */ - -namespace pressure_measurement { -typedef struct config { - nullable measured_value; - nullable min_measured_value; - nullable max_measured_value; - config() : measured_value(), min_measured_value(), max_measured_value() {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* pressure_measurement */ - -namespace flow_measurement { -typedef struct config { - nullable measured_value; - nullable min_measured_value; - nullable max_measured_value; - config() : measured_value(), min_measured_value(), max_measured_value() {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* flow_measurement */ - -namespace pump_configuration_and_control { -typedef struct config { - // Pump Information Attributes - const nullable max_pressure; - const nullable max_speed; - const nullable max_flow; - // Pump Dynamic Information Attributes - uint8_t effective_operation_mode; - uint8_t effective_control_mode; - nullable capacity; - // Pump Settings Attributes - uint8_t operation_mode; - struct { - feature::constant_pressure::config_t constant_pressure; - feature::compensated_pressure::config_t compensated_pressure; - feature::constant_flow::config_t constant_flow; - feature::constant_speed::config_t constant_speed; - feature::constant_temperature::config_t constant_temperature; - } features; - uint32_t feature_flags; - config( - nullable max_pressure = nullable(), - nullable max_speed = nullable(), - nullable max_flow = nullable() - ) : max_pressure(max_pressure), max_speed(max_speed), max_flow(max_flow), - effective_operation_mode(0), effective_control_mode(0), capacity(), operation_mode(0), feature_flags(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* pump_configuration_and_control */ - -namespace mode_select { -typedef struct config { - char description[k_max_description_length + 1]; - const nullable standard_namespace; - uint8_t current_mode; - void *delegate; - config() : description{0}, standard_namespace(), current_mode(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* mode_select */ - -namespace temperature_control { -typedef struct config { - struct { - feature::temperature_number::config_t temperature_number; - feature::temperature_level::config_t temperature_level; - feature::temperature_step::config_t temperature_step; - } features; - uint32_t feature_flags; - config() : feature_flags(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* temperature_control */ - -namespace refrigerator_alarm { -typedef struct config { - uint32_t mask; - uint32_t state; - uint32_t supported; - config() : mask(1), state(0), supported(1) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* refrigerator_alarm */ - -namespace refrigerator_and_tcc_mode { -typedef struct config { - uint8_t current_mode; - void *delegate; - config() : current_mode(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* refrigerator_and_tcc_mode */ - -namespace rvc_run_mode { -typedef struct config { - uint8_t current_mode; - void *delegate; - config() : current_mode(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* rvc_run_mode */ - -namespace rvc_clean_mode { -typedef struct config { - uint8_t current_mode; - void *delegate; - config() : current_mode(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* rvc_clean_mode */ - -namespace microwave_oven_mode { -typedef struct config { - uint8_t current_mode; - void *delegate; - config() : current_mode(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* microwave_oven_mode */ - -namespace microwave_oven_control { -typedef struct config { - uint32_t feature_flags; - void *delegate; - config() : feature_flags(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* microwave_oven_control */ - -namespace rvc_operational_state { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* rvc_operational_state */ - -namespace keypad_input { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* keypad_input */ - -namespace power_topology { -typedef struct config { - uint32_t feature_flags; - void *delegate; - config() : feature_flags(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* power_topology */ - -namespace electrical_power_measurement { -typedef struct config { - uint32_t feature_flags; - void *delegate; - config() : feature_flags(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* electrical_power_measurement */ - -namespace electrical_energy_measurement { -typedef struct config { - uint32_t feature_flags; - void *delegate; - config() : feature_flags(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* electrical_energy_measurement */ - -namespace energy_evse_mode { -typedef struct config { - uint8_t current_mode; - void *delegate; - config() : current_mode(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* energy_evse_mode */ - -namespace energy_evse { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* energy_evse */ - -namespace valve_configuration_and_control { -typedef struct config { - nullable open_duration; - nullable default_open_duration; - nullable current_state; - nullable target_state; - void *delegate; - config() : open_duration(), default_open_duration(), current_state(), target_state(), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* valve_configuration_and_control */ - -namespace device_energy_management { -typedef struct config { - void *delegate; - uint32_t feature_flags; - config() : delegate(nullptr), feature_flags(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* device_energy_management */ - -namespace device_energy_management_mode { -typedef struct config { - uint8_t current_mode; - void *delegate; - config() : current_mode(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* device_energy_management_mode */ - -namespace application_basic { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* application_basic */ - -namespace thread_border_router_management { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* thread_border_router_management */ - -namespace wifi_network_management { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* wifi_network_management */ - -namespace thread_network_directory { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* thread_network_directory */ - -namespace service_area { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* service_area */ - -namespace water_heater_management { -typedef struct config { - uint8_t heater_types; - uint8_t heat_demand; - uint8_t boost_state; - void *delegate; - config() : heater_types(0), heat_demand(0), boost_state(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* water_heater_management */ - -namespace water_heater_mode { -typedef struct config { - uint8_t current_mode; - void *delegate; - config() : current_mode(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* water_heater_mode */ - -namespace energy_preference { -typedef struct config { - struct { - feature::energy_balance::config_t energy_balance; - feature::low_power_mode_sensitivity::config_t low_power_mode_sensitivity; - } features; - uint32_t feature_flags; - void *delegate; - config() : feature_flags(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* energy_preference */ - -namespace commissioner_control { -typedef struct config { - uint32_t supported_device_categories; - void *delegate; - config() : supported_device_categories(0), delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* commissioner_control */ - -namespace ecosystem_information { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* ecosystem_information */ - -namespace camera_av_stream_management { -typedef struct config { - uint32_t max_content_buffer_size; - uint32_t max_network_bandwidth; - uint32_t feature_flags; - config() : max_content_buffer_size(0), max_network_bandwidth(0), feature_flags(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -}/*camera av stream management*/ - -namespace webrtc_transport_provider { -using config_t = common::config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -}/*webrtc transport provider*/ - -namespace webrtc_transport_requestor { -using config_t = common::config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -}/*webrtc transport requestor*/ - -namespace chime { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* chime */ - -namespace closure_control { -typedef struct config { - void *delegate; - uint32_t feature_flags; - config() : delegate(nullptr), feature_flags(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* closure_control */ - -namespace closure_dimension { -typedef struct config { - void *delegate; - uint32_t feature_flags = 0; - config() : delegate(nullptr), feature_flags(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* closure_dimension */ - -namespace camera_av_settings_user_level_management { -typedef struct config { - uint32_t feature_flags; - config() : feature_flags(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* camera_av_settings_user_level_management */ - -namespace push_av_stream_transport { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* push_av_stream_transport */ - -namespace commodity_tariff { -typedef struct config { - void *delegate; - uint32_t feature_flags; - config() : delegate(nullptr), feature_flags(0) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* commodity_tariff */ - -namespace commodity_price { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* commodity_price */ - -namespace commodity_metering { -using config_t = common::config_t; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* commodity_metering */ - -namespace electrical_grid_conditions { -typedef struct config { - void *delegate; - config() : delegate(nullptr) {} -} config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* electrical_grid_conditions */ - -namespace meter_identification { -using config_t = common::config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* meter_identification */ - -namespace soil_measurement { -using config_t = common::config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* soil_measurement */ - -namespace zone_management { -using config_t = common::config_t; - -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* zone_management */ - -} /* cluster */ -} /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_command.h b/components/esp_matter/data_model/esp_matter_command.h index 1ea508fb3..f135dfdd3 100644 --- a/components/esp_matter/data_model/esp_matter_command.h +++ b/components/esp_matter/data_model/esp_matter_command.h @@ -13,613 +13,9 @@ // limitations under the License. #pragma once - -#include - -namespace esp_matter { -namespace cluster { - -/** Specific command create APIs - * - * If some standard command is not present here, it can be added. - * If a custom command needs to be created, the low level esp_matter::command::create() API can be used. - */ - -namespace actions { -namespace command { -command_t *create_instant_action(cluster_t *cluster); -command_t *create_instant_action_with_transition(cluster_t *cluster); -command_t *create_start_action(cluster_t *cluster); -command_t *create_start_action_with_duration(cluster_t *cluster); -command_t *create_stop_action(cluster_t *cluster); -command_t *create_pause_action(cluster_t *cluster); -command_t *create_pause_action_with_duration(cluster_t *cluster); -command_t *create_resume_action(cluster_t *cluster); -command_t *create_enable_action(cluster_t *cluster); -command_t *create_enable_action_with_duration(cluster_t *cluster); -command_t *create_disable_action(cluster_t *cluster); -command_t *create_disable_action_with_duration(cluster_t *cluster); -} /* command */ -} /* actions */ - -namespace access_control { -namespace command { -command_t *create_review_fabric_restrictions(cluster_t *cluster); -command_t *create_review_fabric_restrictions_response(cluster_t *cluster); -} /* command */ -} /* access_control */ - -namespace bridged_device_basic_information { -namespace command { -command_t *create_keep_active(cluster_t *cluster); -} /* command */ -} /* bridged_device_basic_information */ - -namespace thread_network_diagnostics { -namespace command { -command_t *create_reset_counts(cluster_t *cluster); -} /* command */ -} /* thread_network_diagnostics */ - -namespace wifi_network_diagnostics { -namespace command { -command_t *create_reset_counts(cluster_t *cluster); -} /* command */ -} /* wifi_network_diagnostics */ - -namespace ethernet_network_diagnostics { -namespace command { -command_t *create_reset_counts(cluster_t *cluster); -} /* command */ -} /* ethernet_network_diagnostics */ - -namespace diagnostic_logs { -namespace command { -command_t *create_retrieve_logs_request(cluster_t *cluster); -command_t *create_retrieve_logs_response(cluster_t *cluster); -} /* command */ -} /* diagnostic_logs */ - -namespace general_diagnostics { -namespace command { -command_t *create_test_event_trigger(cluster_t *cluster); -command_t *create_time_snap_shot(cluster_t *cluster); -command_t *create_time_snap_shot_response(cluster_t *cluster); -command_t *create_payload_test_request(cluster_t *cluster); -command_t *create_payload_test_response(cluster_t *cluster); -} /* command */ -} /* general_diagnostics */ - -namespace software_diagnostics { -namespace command { -command_t *create_reset_watermarks(cluster_t *cluster); -} /* command */ -} /* software_diagnostics */ - -namespace group_key_management { -namespace command { -command_t *create_key_set_write(cluster_t *cluster); -command_t *create_key_set_read(cluster_t *cluster); -command_t *create_key_set_remove(cluster_t *cluster); -command_t *create_key_set_read_all_indices(cluster_t *cluster); -command_t *create_key_set_read_response(cluster_t *cluster); -command_t *create_key_set_read_all_indices_response(cluster_t *cluster); -} /* command */ -} /* group_key_management */ - -namespace general_commissioning { -namespace command { -command_t *create_arm_fail_safe(cluster_t *cluster); -command_t *create_set_regulatory_config(cluster_t *cluster); -command_t *create_commissioning_complete(cluster_t *cluster); -command_t *create_arm_fail_safe_response(cluster_t *cluster); -command_t *create_set_regulatory_config_response(cluster_t *cluster); -command_t *create_commissioning_complete_response(cluster_t *cluster); -command_t *create_set_tc_acknowledgements(cluster_t *cluster); -command_t *create_set_tc_acknowledgements_response(cluster_t *cluster); -} /* command */ -} /* general_commissioning */ - -#ifndef CONFIG_CUSTOM_NETWORK_CONFIG -namespace network_commissioning { -namespace command { -command_t *create_scan_networks(cluster_t *cluster); -command_t *create_add_or_update_wifi_network(cluster_t *cluster); -command_t *create_add_or_update_thread_network(cluster_t *cluster); -command_t *create_remove_network(cluster_t *cluster); -command_t *create_connect_network(cluster_t *cluster); -command_t *create_reorder_network(cluster_t *cluster); -command_t *create_scan_networks_response(cluster_t *cluster); -command_t *create_network_config_response(cluster_t *cluster); -command_t *create_connect_network_response(cluster_t *cluster); -} /* command */ -} /* network_commissioning */ -#endif // CONFIG_CUSTOM_NETWORK_CONFIG - -namespace administrator_commissioning { -namespace command { -command_t *create_open_commissioning_window(cluster_t *cluster); -command_t *create_open_basic_commissioning_window(cluster_t *cluster); -command_t *create_revoke_commissioning(cluster_t *cluster); -} /* command */ -} /* administrator_commissioning */ - -namespace operational_credentials { -namespace command { -command_t *create_attestation_request(cluster_t *cluster); -command_t *create_certificate_chain_request(cluster_t *cluster); -command_t *create_csr_request(cluster_t *cluster); -command_t *create_add_noc(cluster_t *cluster); -command_t *create_update_noc(cluster_t *cluster); -command_t *create_update_fabric_label(cluster_t *cluster); -command_t *create_remove_fabric(cluster_t *cluster); -command_t *create_add_trusted_root_certificate(cluster_t *cluster); -command_t *create_attestation_response(cluster_t *cluster); -command_t *create_certificate_chain_response(cluster_t *cluster); -command_t *create_csr_response(cluster_t *cluster); -command_t *create_noc_response(cluster_t *cluster); -command_t *create_set_vid_verification_statement(cluster_t *cluster); -command_t *create_sign_vid_verification_request(cluster_t *cluster); -command_t *create_sign_vid_verification_response(cluster_t *cluster); -} /* command */ -} /* operational_credentials */ - -namespace ota_software_update_provider { -namespace command { -command_t *create_query_image(cluster_t *cluster); -command_t *create_apply_update_request(cluster_t *cluster); -command_t *create_notify_update_applied(cluster_t *cluster); -command_t *create_query_image_response(cluster_t *cluster); -command_t *create_apply_update_response(cluster_t *cluster); -} /* command */ -} /* ota_software_update_provider */ - -namespace ota_software_update_requestor { -namespace command { -command_t *create_announce_ota_provider(cluster_t *cluster); -} /* command */ -} /* ota_software_update_requestor */ - -namespace identify { -namespace command { -command_t *create_identify(cluster_t *cluster); -command_t *create_trigger_effect(cluster_t *cluster); -} /* command */ -} /* identify */ - -namespace groups { -namespace command { -command_t *create_add_group(cluster_t *cluster); -command_t *create_view_group(cluster_t *cluster); -command_t *create_get_group_membership(cluster_t *cluster); -command_t *create_remove_group(cluster_t *cluster); -command_t *create_remove_all_groups(cluster_t *cluster); -command_t *create_add_group_if_identifying(cluster_t *cluster); -command_t *create_add_group_response(cluster_t *cluster); -command_t *create_view_group_response(cluster_t *cluster); -command_t *create_get_group_membership_response(cluster_t *cluster); -command_t *create_remove_group_response(cluster_t *cluster); -} /* command */ -} /* groups */ - -namespace icd_management { -namespace command { -command_t *create_register_client(cluster_t *cluster); -command_t *create_register_client_response(cluster_t *cluster); -command_t *create_unregister_client(cluster_t *cluster); -command_t *create_stay_active_request(cluster_t *cluster); -command_t *create_stay_active_response(cluster_t *cluster); -} /* command */ -} /* icd_management */ - -namespace scenes_management { -namespace command { -command_t *create_add_scene(cluster_t *cluster); -command_t *create_view_scene(cluster_t *cluster); -command_t *create_remove_scene(cluster_t *cluster); -command_t *create_remove_all_scenes(cluster_t *cluster); -command_t *create_store_scene(cluster_t *cluster); -command_t *create_recall_scene(cluster_t *cluster); -command_t *create_get_scene_membership(cluster_t *cluster); -command_t *create_copy_scene(cluster_t *cluster); -command_t *create_add_scene_response(cluster_t *cluster); -command_t *create_view_scene_response(cluster_t *cluster); -command_t *create_remove_scene_response(cluster_t *cluster); -command_t *create_remove_all_scenes_response(cluster_t *cluster); -command_t *create_store_scene_response(cluster_t *cluster); -command_t *create_get_scene_membership_response(cluster_t *cluster); -command_t *create_copy_scene_response(cluster_t *cluster); -} /* command */ -} /* scenes_management */ - -namespace on_off { -namespace command { -command_t *create_off(cluster_t *cluster); -command_t *create_on(cluster_t *cluster); -command_t *create_toggle(cluster_t *cluster); -command_t *create_off_with_effect(cluster_t *cluster); -command_t *create_on_with_recall_global_scene(cluster_t *cluster); -command_t *create_on_with_timed_off(cluster_t *cluster); -} /* command */ -} /* on_off */ - -namespace level_control { -namespace command { -command_t *create_move_to_level(cluster_t *cluster); -command_t *create_move(cluster_t *cluster); -command_t *create_step(cluster_t *cluster); -command_t *create_stop(cluster_t *cluster); -command_t *create_move_to_level_with_on_off(cluster_t *cluster); -command_t *create_move_with_on_off(cluster_t *cluster); -command_t *create_step_with_on_off(cluster_t *cluster); -command_t *create_stop_with_on_off(cluster_t *cluster); -command_t *create_move_to_closest_frequency(cluster_t *cluster); -} /* command */ -} /* level_control */ - -namespace color_control { -namespace command { -command_t *create_move_to_hue(cluster_t *cluster); -command_t *create_move_hue(cluster_t *cluster); -command_t *create_step_hue(cluster_t *cluster); -command_t *create_move_to_saturation(cluster_t *cluster); -command_t *create_move_saturation(cluster_t *cluster); -command_t *create_step_saturation(cluster_t *cluster); -command_t *create_move_to_hue_and_saturation(cluster_t *cluster); -command_t *create_stop_move_step(cluster_t *cluster); -command_t *create_move_to_color_temperature(cluster_t *cluster); -command_t *create_move_color_temperature(cluster_t *cluster); -command_t *create_step_color_temperature(cluster_t *cluster); -command_t *create_move_to_color(cluster_t *cluster); -command_t *create_move_color(cluster_t *cluster); -command_t *create_step_color(cluster_t *cluster); -command_t *create_enhanced_move_to_hue(cluster_t *cluster); -command_t *create_enhanced_move_hue(cluster_t *cluster); -command_t *create_enhanced_step_hue(cluster_t *cluster); -command_t *create_enhanced_move_to_hue_and_saturation(cluster_t *cluster); -command_t *create_color_loop_set(cluster_t *cluster); -} /* command */ -} /* color_control */ - -namespace thermostat { -namespace command { -command_t *create_setpoint_raise_lower(cluster_t *cluster); -command_t *create_set_active_schedule_request(cluster_t *cluster); -command_t *create_set_active_preset_request(cluster_t *cluster); -command_t *create_atomic_request(cluster_t *cluster); -command_t *create_atomic_response(cluster_t *cluster); -} /* command */ -} /* thermostat */ - -namespace operational_state { -namespace command { -command_t *create_pause(cluster_t *cluster); -command_t *create_stop(cluster_t *cluster); -command_t *create_start(cluster_t *cluster); -command_t *create_resume(cluster_t *cluster); -command_t *create_operational_command_response(cluster_t *cluster); -} /* command */ -} /* operational_state */ - -namespace smoke_co_alarm { -namespace command { -command_t *create_self_test_request(cluster_t *cluster); -} /* command */ -} /* smoke_co_alarm */ - -namespace door_lock { -namespace command { -command_t *create_lock_door(cluster_t *cluster); -command_t *create_unlock_door(cluster_t *cluster); -command_t *create_unlock_with_timeout(cluster_t *cluster); -command_t *create_set_weekday_schedule(cluster_t *cluster); -command_t *create_get_weekday_schedule(cluster_t *cluster); -command_t *create_get_weekday_schedule_response(cluster_t *cluster); -command_t *create_clear_weekday_schedule(cluster_t *cluster); -command_t *create_set_year_day_schedule(cluster_t *cluster); -command_t *create_get_year_day_schedule(cluster_t *cluster); -command_t *create_get_year_day_schedule_response(cluster_t *cluster); -command_t *create_clear_year_day_schedule(cluster_t *cluster); -command_t *create_set_holiday_schedule(cluster_t *cluster); -command_t *create_get_holiday_schedule(cluster_t *cluster); -command_t *create_get_holiday_schedule_response(cluster_t *cluster); -command_t *create_clear_holiday_schedule(cluster_t *cluster); -command_t *create_set_user_type(cluster_t *cluster); -command_t *create_get_user_type(cluster_t *cluster); -command_t *create_get_user_type_response(cluster_t *cluster); -command_t *create_set_user(cluster_t *cluster); -command_t *create_get_user(cluster_t *cluster); -command_t *create_get_user_response(cluster_t *cluster); -command_t *create_clear_user(cluster_t *cluster); -command_t *create_set_credential(cluster_t *cluster); -command_t *create_set_credential_response(cluster_t *cluster); -command_t *create_get_credential_status(cluster_t *cluster); -command_t *create_get_credential_status_response(cluster_t *cluster); -command_t *create_clear_credential(cluster_t *cluster); -command_t *create_unbolt_door(cluster_t *cluster); -command_t *create_set_aliro_reader_config(cluster_t *cluster); -command_t *create_clear_aliro_reader_config(cluster_t *cluster); -} /* command */ -} /* door_lock */ - -namespace window_covering { -namespace command { -command_t *create_up_or_open(cluster_t *cluster); -command_t *create_down_or_close(cluster_t *cluster); -command_t *create_stop_motion(cluster_t *cluster); -command_t *create_go_to_lift_percentage(cluster_t *cluster); -command_t *create_go_to_tilt_percentage(cluster_t *cluster); -} /* command */ -} /* window_covering */ - -namespace mode_select { -namespace command { -command_t *create_change_to_mode(cluster_t *cluster); -} /* command */ -} /* mode_select */ - -namespace temperature_control { -namespace command { -command_t *create_set_temperature(cluster_t *cluster); -} /* command */ -} /* temperature_control */ - -namespace fan_control { -namespace command { -command_t *create_step(cluster_t *cluster); -} /* command */ -} /* fan_control */ - -namespace resource_monitoring { -namespace command { -command_t *create_reset_condition(cluster_t *cluster); -} /* command */ -} /* resource_monitoring */ - -namespace hepa_filter_monitoring { -namespace command = resource_monitoring::command; -} /* hepa_filter_monitoring */ - -namespace activated_carbon_filter_monitoring { -namespace command = resource_monitoring::command; -} /* activated_carbon_filter_monitoring */ - -namespace mode_base { -namespace command { -command_t *create_change_to_mode(cluster_t *cluster); -command_t *create_change_to_mode_response(cluster_t *cluster); -} /* command */ -} /* mode_base */ - -namespace keypad_input { -namespace command { -command_t *create_send_key(cluster_t *cluster); -command_t *create_send_key_response(cluster_t *cluster); -} /* command */ -} /* keypad_input */ - -namespace boolean_state_configuration { -namespace command { -command_t *create_suppress_alarm(cluster_t *cluster); -command_t *create_enable_disable_alarm(cluster_t *cluster); -} /* command */ -} /* boolean_state_configuration */ - -namespace energy_evse { -namespace command { -command_t *create_disable(cluster_t *cluster); -command_t *create_enable_charging(cluster_t *cluster); -command_t *create_enable_discharging(cluster_t *cluster); -command_t *create_start_diagnostics(cluster_t *cluster); -command_t *create_set_targets(cluster_t *cluster); -command_t *create_get_targets(cluster_t *cluster); -command_t *create_clear_targets(cluster_t *cluster); -command_t *create_get_targets_response(cluster_t *cluster); -} /* command */ -} /* energy_evse */ - -namespace microwave_oven_control { -namespace command { -command_t *create_set_cooking_parameters(cluster_t *cluster); -command_t *create_add_more_time(cluster_t *cluster); -} /* command */ -} /* microwave_oven_control */ - -namespace valve_configuration_and_control { -namespace command { -command_t *create_open(cluster_t *cluster); -command_t *create_close(cluster_t *cluster); -} /* command */ -} /* valve_configuration_and_control */ - -namespace device_energy_management { -namespace command { -command_t *create_power_adjust_request(cluster_t *cluster); -command_t *create_cancel_power_adjust_request(cluster_t *cluster); -command_t *create_start_time_adjust_request(cluster_t *cluster); -command_t *create_pause_request(cluster_t *cluster); -command_t *create_resume_request(cluster_t *cluster); -command_t *create_modify_forecast_request(cluster_t *cluster); -command_t *create_request_constraint_based_forecast(cluster_t *cluster); -command_t *create_cancel_request(cluster_t *cluster); -} /* command */ -} /* device_energy_management */ - -namespace thread_border_router_management { -namespace command { -command_t *create_get_active_dataset_request(cluster_t *cluster); -command_t *create_get_pending_dataset_request(cluster_t *cluster); -command_t *create_dataset_response(cluster_t *cluster); -command_t *create_set_active_dataset_request(cluster_t *cluster); -command_t *create_set_pending_dataset_request(cluster_t *cluster); -} /* command */ -} /* thread_border_router_management */ - -namespace wifi_network_management { -namespace command { -command_t *create_network_passphrase_request(cluster_t *cluster); -command_t *create_network_passphrase_response(cluster_t *cluster); -} /* command */ -} /* wifi_network_management */ - -namespace thread_network_directory { -namespace command { -command_t *create_add_network(cluster_t *cluster); -command_t *create_remove_network(cluster_t *cluster); -command_t *create_get_operational_dataset(cluster_t *cluster); -command_t *create_operational_dataset_response(cluster_t *cluster); -} /* command */ -} /* thread_network_directory */ - -namespace service_area { -namespace command { -command_t *create_select_areas(cluster_t *cluster); -command_t *create_select_areas_response(cluster_t *cluster); -command_t *create_skip_area(cluster_t *cluster); -command_t *create_skip_area_response(cluster_t *cluster); -} /* command */ -} /* service_area */ - -namespace water_heater_management { -namespace command { -command_t *create_boost(cluster_t *cluster); -command_t *create_cancel_boost(cluster_t *cluster); -} /* command */ -} /* water_heater_management */ - -namespace commissioner_control { -namespace command { -command_t *create_request_commissioning_approval(cluster_t *cluster); -command_t *create_commission_node(cluster_t *cluster); -command_t *create_reverse_open_commissioning_window(cluster_t *cluster); -} /* command */ -} /* commissioner_control */ - -namespace time_synchronization { -namespace command { -command_t *create_set_utc_time(cluster_t *cluster); -command_t *create_set_trusted_time_source(cluster_t *cluster); -command_t *create_set_time_zone(cluster_t *cluster); -command_t *create_set_time_zone_response(cluster_t *cluster); -command_t *create_set_dst_offset(cluster_t *cluster); -command_t *create_set_default_ntp(cluster_t *cluster); -} /* command */ -} /* time_synchronization */ - -namespace camera_av_stream_management { -namespace command { -command_t *create_audio_stream_allocate(cluster_t *cluster); -command_t *create_audio_stream_allocate_response(cluster_t *cluster); -command_t *create_audio_stream_deallocate(cluster_t *cluster); -command_t *create_video_stream_allocate(cluster_t *cluster); -command_t *create_video_stream_allocate_response(cluster_t *cluster); -command_t *create_video_stream_modify(cluster_t *cluster); -command_t *create_video_stream_deallocate(cluster_t *cluster); -command_t *create_snapshot_stream_allocate(cluster_t *cluster); -command_t *create_snapshot_stream_allocate_response(cluster_t *cluster); -command_t *create_snapshot_stream_modify(cluster_t *cluster); -command_t *create_snapshot_stream_deallocate(cluster_t *cluster); -command_t *create_set_stream_priorities(cluster_t *cluster); -command_t *create_capture_snapshot(cluster_t *cluster); -command_t *create_capture_snapshot_response(cluster_t *cluster); -} /* command */ -} /*camera av stream transport*/ - -namespace webrtc_transport_provider { -namespace command { -command_t *create_solicit_offer(cluster_t *cluster); -command_t *create_solicit_offer_response(cluster_t *cluster); -command_t *create_provide_offer(cluster_t *cluster); -command_t *create_provide_offer_response(cluster_t *cluster); -command_t *create_provide_answer(cluster_t *cluster); -command_t *create_provide_ice_candidates(cluster_t *cluster); -command_t *create_end_session(cluster_t *cluster); -} /* command */ -}/*webrtc transport provider*/ - -namespace webrtc_transport_requestor { -namespace command { -command_t *create_offer(cluster_t *cluster); -command_t *create_answer(cluster_t *cluster); -command_t *create_ice_candidates(cluster_t *cluster); -command_t *create_end(cluster_t *cluster); -} /* command */ -}/*webrtc transport requestor*/ - -namespace chime { -namespace command { -command_t *create_play_chime_sound(cluster_t *cluster); -} /* command */ -} /* chime */ - -namespace closure_control { -namespace command { -command_t *create_stop(cluster_t *cluster); -command_t *create_move_to(cluster_t *cluster); -command_t *create_calibrate(cluster_t *cluster); -} /* command */ -} /* closure_control */ - -namespace closure_dimension { -namespace command { -command_t *create_set_target(cluster_t *cluster); -command_t *create_step(cluster_t *cluster); -} /* command */ -} /* closure_dimension */ - -namespace camera_av_settings_user_level_management { -namespace command { -command_t *create_mptz_set_position(cluster_t *cluster); -command_t *create_mptz_relative_move(cluster_t *cluster); -command_t *create_mptz_move_to_preset(cluster_t *cluster); -command_t *create_mptz_save_preset(cluster_t *cluster); -command_t *create_mptz_remove_preset(cluster_t *cluster); -command_t *create_dptz_set_viewport(cluster_t *cluster); -command_t *create_dptz_relative_move(cluster_t *cluster); -} /* command */ -} /* camera_av_settings_user_level_management */ - -namespace push_av_stream_transport { -namespace command { -command_t *create_allocate_push_transport(cluster_t *cluster); -command_t *create_allocate_push_transport_response(cluster_t *cluster); -command_t *create_deallocate_push_transport(cluster_t *cluster); -command_t *create_modify_push_transport(cluster_t *cluster); -command_t *create_set_transport_status(cluster_t *cluster); -command_t *create_manually_trigger_transport(cluster_t *cluster); -command_t *create_find_transport(cluster_t *cluster); -command_t *create_find_transport_response(cluster_t *cluster); -} /* command */ -} /* push_av_stream_transport */ - -namespace commodity_tariff { -namespace command { -command_t *create_get_tariff_component(cluster_t *cluster); -command_t *create_get_tariff_component_response(cluster_t *cluster); -command_t *create_get_day_entry(cluster_t *cluster); -command_t *create_get_day_entry_response(cluster_t *cluster); -} /* command */ -} /* commodity_tariff */ - -namespace commodity_price { -namespace command { -command_t *create_get_detailed_price_request(cluster_t *cluster); -command_t *create_get_detailed_price_response(cluster_t *cluster); -command_t *create_get_detailed_forecast_request(cluster_t *cluster); -command_t *create_get_detailed_forecast_response(cluster_t *cluster); -} /* command */ -} /* commodity_price */ - -namespace zone_management { -namespace command { -command_t *create_two_d_cartesian_zone(cluster_t *cluster); -command_t *create_two_d_cartesian_zone_response(cluster_t *cluster); -command_t *create_update_two_d_cartesian_zone(cluster_t *cluster); -command_t *create_remove_zone(cluster_t *cluster); -command_t *create_or_update_trigger(cluster_t *cluster); -command_t *create_remove_trigger(cluster_t *cluster); -} /* command */ -} /* zone_management */ - -} /* cluster */ -} /* esp_matter */ +#include +#if CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL +#include "generated/clusters/all_clusters.h" +#else +#include "legacy/esp_matter_command_impl.h" +#endif diff --git a/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp b/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp index a0e8c007b..fb4fc12d1 100644 --- a/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp +++ b/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp @@ -42,6 +42,18 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -588,6 +600,116 @@ void MeterIdentificationDelegateInitCB(void *delegate, uint16_t endpoint_id) LogErrorOnFailure(meter_identification_instance->Init()); } +void ApplicationLauncherDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + ApplicationLauncher::Delegate *application_launcher_delegate = static_cast(delegate); + ApplicationLauncher::SetDefaultDelegate(endpoint_id, application_launcher_delegate); +} +void AccountLoginDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + AccountLogin::Delegate *account_login_delegate = static_cast(delegate); + AccountLogin::SetDefaultDelegate(endpoint_id, account_login_delegate); +} +void AudioOutputDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + AudioOutput::Delegate *audio_output_delegate = static_cast(delegate); + AudioOutput::SetDefaultDelegate(endpoint_id, audio_output_delegate); +} +void ChannelDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + Channel::Delegate *channel_delegate = static_cast(delegate); + Channel::SetDefaultDelegate(endpoint_id, channel_delegate); +} +void ContentAppObserverDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + ContentAppObserver::Delegate *content_app_observer_delegate = static_cast(delegate); + ContentAppObserver::SetDefaultDelegate(endpoint_id, content_app_observer_delegate); +} +void ContentControlDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + ContentControl::Delegate *content_control_delegate = static_cast(delegate); + ContentControl::SetDefaultDelegate(endpoint_id, content_control_delegate); +} +void DishwasherModeDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + InitModeDelegate(delegate, endpoint_id, DishwasherMode::Id); +} +void LowPowerDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + LowPower::Delegate *low_power_delegate = static_cast(delegate); + LowPower::SetDefaultDelegate(endpoint_id, low_power_delegate); +} +void MessagesDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + Messages::Delegate *messages_delegate = static_cast(delegate); + Messages::SetDefaultDelegate(endpoint_id, messages_delegate); +} +void MediaInputDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + MediaInput::Delegate *media_input_delegate = static_cast(delegate); + MediaInput::SetDefaultDelegate(endpoint_id, media_input_delegate); +} +void MediaPlaybackDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + MediaPlayback::Delegate *media_playback_delegate = static_cast(delegate); + MediaPlayback::SetDefaultDelegate(endpoint_id, media_playback_delegate); +} +void OvenModeDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + InitModeDelegate(delegate, endpoint_id, OvenMode::Id); +} +void OvenCavityOperationalStateDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + OperationalState::Delegate *operational_state_delegate = static_cast(delegate); + OvenCavityOperationalState::Instance *instance = nullptr; + if (s_operational_state_instances.find(endpoint_id) == s_operational_state_instances.end()) { + instance = new OvenCavityOperationalState::Instance(operational_state_delegate, endpoint_id); + s_operational_state_instances[endpoint_id] = static_cast(instance); + } else { + instance = static_cast(s_operational_state_instances[endpoint_id]); + } + (void) instance->Init(); +} +void RefrigeratorAndTemperatureControlledCabinetModeDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + InitModeDelegate(delegate, endpoint_id, RefrigeratorAndTemperatureControlledCabinetMode::Id); +} +void RvcOperationalStateDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + RvcOperationalState::Delegate *rvc_operational_state_delegate = static_cast(delegate); + RvcOperationalState::Instance *instance = nullptr; + if (s_operational_state_instances.find(endpoint_id) == s_operational_state_instances.end()) { + instance = new RvcOperationalState::Instance(rvc_operational_state_delegate, endpoint_id); + s_operational_state_instances[endpoint_id] = static_cast(instance); + } else { + instance = static_cast(s_operational_state_instances[endpoint_id]); + } + (void) instance->Init(); +} +void TargetNavigatorDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + TargetNavigator::Delegate *target_navigator_delegate = static_cast(delegate); + TargetNavigator::SetDefaultDelegate(endpoint_id, target_navigator_delegate); +} +void WakeOnLanDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + WakeOnLan::Delegate *wake_on_lan_delegate = static_cast(delegate); + WakeOnLan::SetDefaultDelegate(endpoint_id, wake_on_lan_delegate); +} } // namespace delegate_cb } // namespace cluster } // namespace esp_matter diff --git a/components/esp_matter/data_model/esp_matter_delegate_callbacks.h b/components/esp_matter/data_model/esp_matter_delegate_callbacks.h index 42e84777e..93f315819 100644 --- a/components/esp_matter/data_model/esp_matter_delegate_callbacks.h +++ b/components/esp_matter/data_model/esp_matter_delegate_callbacks.h @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#pragma once + namespace esp_matter { namespace cluster { @@ -63,6 +65,24 @@ void CommodityTariffDelegateInitCB(void *delegate, uint16_t endpoint_id); void CommodityPriceDelegateInitCB(void *delegate, uint16_t endpoint_id); void ElectricalGridConditionsDelegateInitCB(void *delegate, uint16_t endpoint_id); void MeterIdentificationDelegateInitCB(void *delegate, uint16_t endpoint_id); + +void ApplicationLauncherDelegateInitCB(void *delegate, uint16_t endpoint_id); +void AccountLoginDelegateInitCB(void *delegate, uint16_t endpoint_id); +void AudioOutputDelegateInitCB(void *delegate, uint16_t endpoint_id); +void ChannelDelegateInitCB(void *delegate, uint16_t endpoint_id); +void ContentAppObserverDelegateInitCB(void *delegate, uint16_t endpoint_id); +void ContentControlDelegateInitCB(void *delegate, uint16_t endpoint_id); +void DishwasherModeDelegateInitCB(void *delegate, uint16_t endpoint_id); +void LowPowerDelegateInitCB(void *delegate, uint16_t endpoint_id); +void MessagesDelegateInitCB(void *delegate, uint16_t endpoint_id); +void MediaInputDelegateInitCB(void *delegate, uint16_t endpoint_id); +void MediaPlaybackDelegateInitCB(void *delegate, uint16_t endpoint_id); +void OvenModeDelegateInitCB(void *delegate, uint16_t endpoint_id); +void OvenCavityOperationalStateDelegateInitCB(void *delegate, uint16_t endpoint_id); +void RefrigeratorAndTemperatureControlledCabinetModeDelegateInitCB(void *delegate, uint16_t endpoint_id); +void RvcOperationalStateDelegateInitCB(void *delegate, uint16_t endpoint_id); +void TargetNavigatorDelegateInitCB(void *delegate, uint16_t endpoint_id); +void WakeOnLanDelegateInitCB(void *delegate, uint16_t endpoint_id); } // namespace delegate_cb } // namespace cluster diff --git a/components/esp_matter/data_model/esp_matter_endpoint.h b/components/esp_matter/data_model/esp_matter_endpoint.h index b29fadee5..16507ebec 100644 --- a/components/esp_matter/data_model/esp_matter_endpoint.h +++ b/components/esp_matter/data_model/esp_matter_endpoint.h @@ -13,1231 +13,9 @@ // limitations under the License. #pragma once - -#include -#include -#include -#include - -/* Replace these with IDs from submodule whenever they are implemented */ -#define ESP_MATTER_ROOT_NODE_DEVICE_TYPE_ID 0x0016 -#define ESP_MATTER_ROOT_NODE_DEVICE_TYPE_VERSION 4 -#define ESP_MATTER_OTA_REQUESTOR_DEVICE_TYPE_ID 0x0012 -#define ESP_MATTER_OTA_REQUESTOR_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_OTA_PROVIDER_DEVICE_TYPE_ID 0x0014 -#define ESP_MATTER_OTA_PROVIDER_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_POWER_SOURCE_DEVICE_TYPE_ID 0x0011 -#define ESP_MATTER_POWER_SOURCE_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_AGGREGATOR_DEVICE_TYPE_ID 0x000E -#define ESP_MATTER_AGGREGATOR_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_BRIDGED_NODE_DEVICE_TYPE_ID 0x0013 -#define ESP_MATTER_BRIDGED_NODE_DEVICE_TYPE_VERSION 3 -#define ESP_MATTER_CONTROL_BRIDGE_DEVICE_TYPE_ID 0x0840 -#define ESP_MATTER_CONTROL_BRIDGE_DEVICE_TYPE_VERSION 3 - -#define ESP_MATTER_ON_OFF_LIGHT_DEVICE_TYPE_ID 0x0100 -#define ESP_MATTER_ON_OFF_LIGHT_DEVICE_TYPE_VERSION 3 -#define ESP_MATTER_DIMMABLE_LIGHT_DEVICE_TYPE_ID 0x0101 -#define ESP_MATTER_DIMMABLE_LIGHT_DEVICE_TYPE_VERSION 3 -#define ESP_MATTER_COLOR_TEMPERATURE_LIGHT_DEVICE_TYPE_ID 0x010C -#define ESP_MATTER_COLOR_TEMPERATURE_LIGHT_DEVICE_TYPE_VERSION 4 -#define ESP_MATTER_EXTENDED_COLOR_LIGHT_DEVICE_TYPE_ID 0x010D -#define ESP_MATTER_EXTENDED_COLOR_LIGHT_DEVICE_TYPE_VERSION 4 - -#define ESP_MATTER_ON_OFF_LIGHT_SWITCH_DEVICE_TYPE_ID 0x0103 -#define ESP_MATTER_ON_OFF_LIGHT_SWITCH_DEVICE_TYPE_VERSION 3 -#define ESP_MATTER_DIMMER_SWITCH_DEVICE_TYPE_ID 0x0104 -#define ESP_MATTER_DIMMER_SWITCH_DEVICE_TYPE_VERSION 3 -#define ESP_MATTER_COLOR_DIMMER_SWITCH_DEVICE_TYPE_ID 0x0105 -#define ESP_MATTER_COLOR_DIMMER_SWITCH_DEVICE_TYPE_VERSION 3 -#define ESP_MATTER_GENERIC_SWITCH_DEVICE_TYPE_ID 0x000F -#define ESP_MATTER_GENERIC_SWITCH_DEVICE_TYPE_VERSION 3 - -#define ESP_MATTER_ON_OFF_PLUG_IN_UNIT_DEVICE_TYPE_ID 0x010A -#define ESP_MATTER_ON_OFF_PLUG_IN_UNIT_DEVICE_TYPE_VERSION 4 -#define ESP_MATTER_DIMMABLE_PLUG_IN_UNIT_DEVICE_TYPE_ID 0x010B -#define ESP_MATTER_DIMMABLE_PLUG_IN_UNIT_DEVICE_TYPE_VERSION 5 -#define ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_ID 0x010F -#define ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_ID 0x0110 -#define ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_VERSION 2 - -#define ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_ID 0x0302 -#define ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_VERSION 3 -#define ESP_MATTER_OCCUPANCY_SENSOR_DEVICE_TYPE_ID 0x0107 -#define ESP_MATTER_OCCUPANCY_SENSOR_DEVICE_TYPE_VERSION 4 -#define ESP_MATTER_CONTACT_SENSOR_DEVICE_TYPE_ID 0x0015 -#define ESP_MATTER_CONTACT_SENSOR_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_LIGHT_SENSOR_DEVICE_TYPE_ID 0x0106 -#define ESP_MATTER_LIGHT_SENSOR_DEVICE_TYPE_VERSION 3 -#define ESP_MATTER_PRESSURE_SENSOR_DEVICE_TYPE_ID 0x0305 -#define ESP_MATTER_PRESSURE_SENSOR_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_FLOW_SENSOR_DEVICE_TYPE_ID 0x0306 -#define ESP_MATTER_FLOW_SENSOR_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_HUMIDITY_SENSOR_DEVICE_TYPE_ID 0x0307 -#define ESP_MATTER_HUMIDITY_SENSOR_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_ROOM_AIR_CONDITIONER_DEVICE_TYPE_ID 0x0072 -#define ESP_MATTER_ROOM_AIR_CONDITIONER_DEVICE_TYPE_VERSION 3 -#define ESP_MATTER_REFRIGERATOR_DEVICE_TYPE_ID 0x0070 -#define ESP_MATTER_REFRIGERATOR_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_TEMPERATURE_CONTROLLED_CABINET_DEVICE_TYPE_ID 0x0071 -#define ESP_MATTER_TEMPERATURE_CONTROLLED_CABINET_DEVICE_TYPE_VERSION 5 -#define ESP_MATTER_LAUNDRY_WASHER_DEVICE_TYPE_ID 0x0073 -#define ESP_MATTER_LAUNDRY_WASHER_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_DISH_WASHER_DEVICE_TYPE_ID 0x0075 -#define ESP_MATTER_DISH_WASHER_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_MICROWAVE_OVEN_DEVICE_TYPE_ID 0x0079 -#define ESP_MATTER_MICROWAVE_OVEN_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_SMOKE_CO_ALARM_DEVICE_TYPE_ID 0x0076 -#define ESP_MATTER_SMOKE_CO_ALARM_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_LAUNDRY_DRYER_DEVICE_TYPE_ID 0x007C -#define ESP_MATTER_LAUNDRY_DRYER_DEVICE_TYPE_VERSION 2 - -#define ESP_MATTER_FAN_DEVICE_TYPE_ID 0x002B -#define ESP_MATTER_FAN_DEVICE_TYPE_VERSION 4 -#define ESP_MATTER_THERMOSTAT_DEVICE_TYPE_ID 0x0301 -#define ESP_MATTER_THERMOSTAT_DEVICE_TYPE_VERSION 4 -#define ESP_MATTER_AIR_QUALITY_SENSOR_DEVICE_TYPE_ID 0x002C -#define ESP_MATTER_AIR_QUALITY_SENSOR_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_AIR_PURIFIER_DEVICE_TYPE_ID 0x002D -#define ESP_MATTER_AIR_PURIFIER_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_ID 0x000A -#define ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_VERSION 3 -#define ESP_MATTER_WINDOW_COVERING_DEVICE_TYPE_ID 0x0202 -#define ESP_MATTER_WINDOW_COVERING_DEVICE_TYPE_VERSION 5 -#define ESP_MATTER_PUMP_DEVICE_TYPE_ID 0x0303 -#define ESP_MATTER_PUMP_DEVICE_TYPE_VERSION 3 -#define ESP_MATTER_PUMP_CONTROLLER_DEVICE_TYPE_ID 0x0304 -#define ESP_MATTER_PUMP_CONTROLLER_DEVICE_TYPE_VERSION 4 -#define ESP_MATTER_MODE_SELECT_DEVICE_TYPE_ID 0x0027 -#define ESP_MATTER_MODE_SELECT_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_ROBOTIC_VACUUM_CLEANER_DEVICE_TYPE_ID 0x0074 -#define ESP_MATTER_ROBOTIC_VACUUM_CLEANER_DEVICE_TYPE_VERSION 4 -#define ESP_MATTER_WATER_LEAK_DETECTOR_DEVICE_TYPE_ID 0x0043 -#define ESP_MATTER_WATER_LEAK_DETECTOR_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_ID 0x0044 -#define ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_COOK_SURFACE_DEVICE_TYPE_ID 0x0077 -#define ESP_MATTER_COOK_SURFACE_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_COOKTOP_DEVICE_TYPE_ID 0x0078 -#define ESP_MATTER_COOKTOP_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_ID 0x0510 -#define ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_OVEN_DEVICE_TYPE_ID 0x007B -#define ESP_MATTER_OVEN_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_WATER_FREEZE_DETECTOR_DEVICE_TYPE_ID 0x0041 -#define ESP_MATTER_WATER_FREEZE_DETECTOR_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_ENERGY_EVSE_DEVICE_TYPE_ID 0x050C -#define ESP_MATTER_ENERGY_EVSE_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_EXTRACTOR_HOOD_DEVICE_TYPE_ID 0x007A -#define ESP_MATTER_EXTRACTOR_HOOD_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_WATER_VALVE_DEVICE_TYPE_ID 0x0042 -#define ESP_MATTER_WATER_VALVE_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_DEVICE_ENERGY_MANAGEMENT_DEVICE_TYPE_ID 0x050D -#define ESP_MATTER_DEVICE_ENERGY_MANAGEMENT_DEVICE_TYPE_VERSION 3 -#define ESP_MATTER_SECONDARY_NETWORK_INTERFACE_DEVICE_TYPE_ID 0x0019 -#define ESP_MATTER_SECONDARY_NETWORK_INTERFACE_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_WATER_HEATER_DEVICE_TYPE_ID 0x050F -#define ESP_MATTER_WATER_HEATER_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_SOLAR_POWER_DEVICE_TYPE_ID 0x0017 -#define ESP_MATTER_SOLAR_POWER_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_BATTERY_STORAGE_DEVICE_TYPE_ID 0x0018 -#define ESP_MATTER_BATTERY_STORAGE_DEVICE_TYPE_VERSION 2 - -#define ESP_MATTER_THREAD_BORDER_ROUTER_DEVICE_TYPE_ID 0x0091 -#define ESP_MATTER_THREAD_BORDER_ROUTER_DEVICE_TYPE_VERSION 2 -#define ESP_MATTER_HEAT_PUMP_DEVICE_TYPE_ID 0x0309 -#define ESP_MATTER_HEAT_PUMP_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_THERMOSTAT_CONTROLLER_DEVICE_TYPE_ID 0x030A -#define ESP_MATTER_THERMOSTAT_CONTROLLER_DEVICE_TYPE_VERSION 1 - -#define ESP_MATTER_CAMERA_DEVICE_TYPE_ID 0x0142 -#define ESP_MATTER_CAMERA_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_CLOSURE_CONTROLLER_DEVICE_TYPE_ID 0x023E -#define ESP_MATTER_CLOSURE_CONTROLLER_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_CLOSURE_DEVICE_TYPE_ID 0x0230 -#define ESP_MATTER_CLOSURE_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_CLOSURE_PANEL_DEVICE_TYPE_ID 0x0231 -#define ESP_MATTER_CLOSURE_PANEL_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_CHIME_DEVICE_TYPE_ID 0x0146 -#define ESP_MATTER_CHIME_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_ELECTRICAL_UTILITY_METER_DEVICE_TYPE_ID 0x0511 -#define ESP_MATTER_ELECTRICAL_UTILITY_METER_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_ELECTRICAL_ENERGY_TARIFF_DEVICE_TYPE_ID 0x0513 -#define ESP_MATTER_ELECTRICAL_ENERGY_TARIFF_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_ELECTRICAL_METER_DEVICE_TYPE_ID 0x0514 -#define ESP_MATTER_ELECTRICAL_METER_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_SOIL_SENSOR_DEVICE_TYPE_ID 0x0045 -#define ESP_MATTER_SOIL_SENSOR_DEVICE_TYPE_VERSION 1 -#define ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_ID 0x0040 -#define ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_VERSION 1 - -namespace esp_matter { - -/** Specific endpoint (device type) create APIs - * - * These APIs also create the mandatory clusters and the mandatory attributes and commands for the clusters. - * The configs has the cluster configs for the mandatory clusters, if it exists. - * - * If some standard endpoint (device type) is not present here, it can be added. - * If a custom endpoint needs to be created, the low level esp_matter::endpoint::create() API can be used. - */ -namespace endpoint { - -typedef struct { - cluster::descriptor::config_t descriptor; - cluster::identify::config_t identify; -} app_base_config; - -typedef struct : app_base_config { - cluster::groups::config_t groups; -} app_with_group_config; - -typedef struct : app_base_config { - cluster::binding::config_t binding; -} app_client_config; - -typedef struct : app_with_group_config { - cluster::on_off::config_t on_off; - cluster::on_off::feature::lighting::config_t on_off_lighting; - cluster::scenes_management::config_t scenes_management; -} on_off_with_lighting_config; - -typedef struct : app_with_group_config { - cluster::scenes_management::config_t scenes_management; - cluster::on_off::config_t on_off; -} on_off_config; - -typedef struct : app_base_config { - cluster::boolean_state::config_t boolean_state; -} app_with_bool_state_config; - -typedef struct { - cluster::descriptor::config_t descriptor; - cluster::operational_state::config_t operational_state; -} app_with_operational_state_config; - -namespace root_node { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::access_control::config_t access_control; - cluster::basic_information::config_t basic_information; - cluster::general_commissioning::config_t general_commissioning; -#ifndef CONFIG_CUSTOM_NETWORK_CONFIG - cluster::network_commissioning::config_t network_commissioning; +#include +#if CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL +#include "generated/device_types/all_device_types.h" +#else +#include "legacy/esp_matter_endpoint_impl.h" #endif - cluster::general_diagnostics::config_t general_diagnostics; - cluster::administrator_commissioning::config_t administrator_commissioning; - cluster::operational_credentials::config_t operational_credentials; - cluster::icd_management::config_t icd_management; - cluster::icd_management::feature::user_active_mode_trigger::config_t icd_user_active_mode_trigger; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* root_node */ - -namespace ota_requestor { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::ota_software_update_requestor::config_t ota_software_update_requestor; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* ota_requestor */ - -namespace ota_provider { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::ota_software_update_provider::config_t ota_software_update_provider; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* ota_provider */ - -namespace power_source { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::power_source::config_t power_source; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* power_source */ - -namespace on_off_light { - -typedef struct config : on_off_with_lighting_config { - config() - { - /* For lighting product, the default identify type should be 0x01: LightOutput*/ - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kLightOutput); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* on_off_light */ - -namespace dimmable_light { -typedef struct config : on_off_light::config_t { - cluster::level_control::config_t level_control; - cluster::level_control::feature::lighting::config_t level_control_lighting; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* dimmable_light */ - -namespace color_temperature_light { -typedef struct config : dimmable_light::config_t { - cluster::color_control::config_t color_control; - cluster::color_control::feature::color_temperature::config_t color_control_color_temperature; - uint16_t color_control_remaining_time; - config() : color_control_remaining_time(0) {} -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* color_temperature_light */ - -namespace extended_color_light { -typedef struct config : dimmable_light::config_t { - cluster::color_control::config_t color_control; - cluster::color_control::feature::color_temperature::config_t color_control_color_temperature; - cluster::color_control::feature::xy::config_t color_control_xy; - uint16_t color_control_remaining_time; - - config() : color_control_remaining_time(0) {} -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* extended_color_light */ - -namespace on_off_light_switch { - -typedef struct config : app_client_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* on_off_light_switch */ - -namespace dimmer_switch { - -typedef struct config : app_client_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* dimmer_switch */ - -namespace color_dimmer_switch { - -typedef struct config : app_client_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* color_dimmer_switch */ - -namespace generic_switch { -typedef struct config : app_base_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } - cluster::switch_cluster::config_t switch_cluster; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* generic_switch */ - -namespace on_off_plug_in_unit { - -typedef struct config : on_off_with_lighting_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* on_off_plug_in_unit */ - -namespace dimmable_plug_in_unit { -typedef struct config : on_off_plug_in_unit::config_t { - cluster::level_control::config_t level_control; - cluster::level_control::feature::lighting::config_t level_control_lighting; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* dimmable_plug_in_unit */ - -namespace fan { -typedef struct config : app_with_group_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); - } - cluster::fan_control::config_t fan_control; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* fan */ - -namespace thermostat { -typedef struct config : app_with_group_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } - cluster::scenes_management::config_t scenes_management; - cluster::thermostat::config_t thermostat; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* thermostat */ - -namespace air_quality_sensor { -typedef struct config : app_base_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } - cluster::air_quality::config_t air_quality; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* air_quality_sensor */ - -namespace air_purifier { -typedef struct config : app_base_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); - } - cluster::fan_control::config_t fan_control; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* air_purifier */ - -namespace dish_washer { -using config_t = app_with_operational_state_config; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* dish_washer */ - -namespace laundry_washer { -using config_t = app_with_operational_state_config; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* laundry_washer */ - -namespace laundry_dryer { -using config_t = app_with_operational_state_config; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* laundry_dryer */ - -namespace smoke_co_alarm { -typedef struct config : app_base_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep); - } - cluster::smoke_co_alarm::config_t smoke_co_alarm; -} config_t; -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* smoke_co_alarm */ - -namespace aggregator { -typedef struct config { - cluster::descriptor::config_t descriptor; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* aggregator */ - -namespace bridged_node { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::bridged_device_basic_information::config_t bridged_device_basic_information; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -endpoint_t *resume(node_t *node, config_t *config, uint8_t flags, uint16_t endpoint_id, void *priv_data); -} /* bridged_node */ - -namespace control_bridge { - -using config_t = app_client_config; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* control_bridge */ - -namespace door_lock { -typedef struct config : app_base_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep); - } - cluster::door_lock::config_t door_lock; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* door_lock */ - -namespace window_covering { -typedef struct config : app_with_group_config { - cluster::window_covering::config_t window_covering; - config(uint8_t end_product_type = 0) : window_covering(end_product_type) - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* window_covering */ - -namespace temperature_sensor { -typedef struct config : app_base_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } - cluster::temperature_measurement::config_t temperature_measurement; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* temperature_sensor */ - -namespace humidity_sensor { -typedef struct config : app_base_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } - cluster::relative_humidity_measurement::config_t relative_humidity_measurement; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* humidity_sensor */ - -namespace occupancy_sensor { -typedef struct config : app_base_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep); - } - cluster::occupancy_sensing::config_t occupancy_sensing; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* occupancy_sensor */ - -namespace contact_sensor { - -typedef struct config : app_with_bool_state_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* contact_sensor */ - -namespace light_sensor { -typedef struct config : app_base_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } - cluster::illuminance_measurement::config_t illuminance_measurement; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* light_sensor */ - -namespace pressure_sensor { -typedef struct config : app_base_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } - cluster::pressure_measurement::config_t pressure_measurement; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* pressure_sensor */ - -namespace flow_sensor { -typedef struct config : app_base_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } - cluster::flow_measurement::config_t flow_measurement; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* flow_sensor */ - -namespace pump { -typedef struct config : app_base_config { - cluster::on_off::config_t on_off; - cluster::pump_configuration_and_control::config_t pump_configuration_and_control; - config( - nullable max_pressure = nullable(), - nullable max_speed = nullable(), - nullable max_flow = nullable() - ) : pump_configuration_and_control(max_pressure, max_speed, max_flow) - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** pump **/ - -namespace pump_controller { -typedef struct config : app_client_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** pump_controller **/ - -namespace mode_select { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::mode_select::config_t mode_select; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** mode_select **/ - -namespace room_air_conditioner { -typedef struct config : app_base_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); - } - cluster::on_off::config_t on_off; - cluster::thermostat::config_t thermostat; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** room air conditioner **/ - -namespace temperature_controlled_cabinet { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::temperature_control::config_t temperature_control; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** temperature_controlled_cabinet **/ - -namespace refrigerator { -typedef struct config { - cluster::descriptor::config_t descriptor; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** refrigerator **/ - -namespace oven { -typedef struct config { - cluster::descriptor::config_t descriptor; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** oven **/ - -namespace robotic_vacuum_cleaner { -typedef struct config : app_base_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); - } - cluster::rvc_run_mode::config_t rvc_run_mode; - cluster::rvc_operational_state::config_t rvc_operational_state; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** robotic_vacuum_cleaner **/ - -namespace water_leak_detector { - -typedef struct config : app_with_bool_state_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* water_leak_detector */ - -namespace water_freeze_detector { - -typedef struct config : app_with_bool_state_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* water_freeze_detector */ - -namespace rain_sensor { - -typedef struct config : app_with_bool_state_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* rain_sensor */ - -namespace electrical_sensor { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::power_topology::config_t power_topology; - cluster::electrical_power_measurement::config_t electrical_power_measurement; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* electrical_sensor */ - -namespace cook_surface { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::temperature_control::config_t temperature_control; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* cook_surface */ - -namespace cooktop { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::on_off::config_t on_off; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* cooktop */ - -namespace energy_evse { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::energy_evse::config_t energy_evse; - cluster::energy_evse_mode::config_t energy_evse_mode; - cluster::device_energy_management::config_t device_energy_management; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* energy_evse */ - -namespace microwave_oven { -typedef struct config : app_with_operational_state_config { - cluster::microwave_oven_mode::config_t microwave_oven_mode; - cluster::microwave_oven_control::config_t microwave_oven_control; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* microwave_oven */ - -namespace extractor_hood { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::fan_control::config_t fan_control; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* extractor_hood */ - -namespace water_valve { -typedef struct config : app_base_config { - cluster::valve_configuration_and_control::config_t valve_configuration_and_control; - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** water_valve **/ - -namespace device_energy_management { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::device_energy_management::config_t device_energy_management; - cluster::device_energy_management_mode::config_t device_energy_management_mode; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* device_energy_management */ - -namespace thread_border_router { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::thread_network_diagnostics::config_t thread_network_diagnostics; - cluster::thread_border_router_management::config_t thread_border_router_management; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* thread_border_router */ - -#ifndef CONFIG_CUSTOM_NETWORK_CONFIG -namespace secondary_network_interface { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::network_commissioning::config_t network_commissioning; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* secondary_network_interface */ -#endif // CONFIG_CUSTOM_NETWORK_CONFIG - -namespace mounted_on_off_control { -typedef struct config : on_off_with_lighting_config { - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** mounted_on_off_control **/ - -namespace mounted_dimmable_load_control { -using config_t = dimmable_light::config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** mounted_dimmable_load_control **/ - -namespace water_heater { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::thermostat::config_t thermostat; - cluster::water_heater_management::config_t water_heater_management; - cluster::water_heater_mode::config_t water_heater_mode; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* water_heater */ - -namespace solar_power { -typedef struct config { - cluster::descriptor::config_t descriptor; - endpoint::power_source::config_t power_source_device; - electrical_sensor::config_t electrical_sensor; - cluster::electrical_energy_measurement::config_t electrical_energy_measurement; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* solar_power */ - -namespace battery_storage { -typedef struct config { - cluster::descriptor::config_t descriptor; - endpoint::power_source::config_t power_source_device; - electrical_sensor::config_t electrical_sensor; - device_energy_management::config_t device_energy_management; - cluster::electrical_energy_measurement::config_t electrical_energy_measurement; - - nullable bat_voltage; - nullable bat_percent_remaining; - nullable bat_time_remaining; - uint32_t bat_capacity; - nullable bat_time_to_full_charge; - nullable bat_charging_current; - - nullable voltage; - nullable active_current; - - config(): bat_voltage(), bat_percent_remaining(), bat_capacity(0), bat_time_to_full_charge(), bat_charging_current(), voltage(0), active_current(0) {} -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** battery_storage **/ - -namespace heat_pump { -typedef struct config { - cluster::descriptor::config_t descriptor; - endpoint::power_source::config_t power_source_device; - electrical_sensor::config_t electrical_sensor; - device_energy_management::config_t device_energy_management; - cluster::electrical_energy_measurement::config_t electrical_energy_measurement; - - nullable voltage; - nullable active_current; - - config(): voltage(0), active_current(0) {} -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** heat_pump **/ - -namespace camera { - -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::camera_av_stream_management::config_t camera_av_stream_management; - cluster::webrtc_transport_provider::config_t webrtc_transport_provider; - cluster::webrtc_transport_requestor::config_t webrtc_transport_requestor; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); - -} /* camera */ - -namespace chime { - -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::chime::config_t chime; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); - -} /* chime */ - -namespace thermostat_controller { -using config_t = app_client_config; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /** thermostat_controller **/ - -namespace closure_controller { -using config_t = app_client_config; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* closure_controller */ - -namespace closure { -typedef struct config : app_base_config { - cluster::closure_control::config_t closure_control; - - config() - { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); - } -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* closure */ - -namespace closure_panel { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::closure_dimension::config_t closure_dimension; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* closure_panel */ - -namespace electrical_utility_meter { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::meter_identification::config_t meter_identification; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* electrical_utility_meter */ - -namespace electrical_energy_tariff { -typedef struct config { - cluster::descriptor::config_t descriptor; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* electrical_energy_tariff */ - -namespace electrical_meter { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::electrical_power_measurement::config_t electrical_power_measurement; - cluster::electrical_energy_measurement::config_t electrical_energy_measurement; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* electrical_meter */ - -namespace soil_sensor { -typedef struct config { - cluster::descriptor::config_t descriptor; - cluster::identify::config_t identify; - cluster::soil_measurement::config_t soil_measurement; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} /* soil_sensor */ - -namespace irrigation_system { -typedef struct config { - cluster::descriptor::config_t descriptor; -} config_t; - -uint32_t get_device_type_id(); -uint8_t get_device_type_version(); -endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); -esp_err_t add(endpoint_t *endpoint, config_t *config); -} -} /* endpoint */ - -namespace node { -/** Standard node create - * - * This creates the node, sets the attribute and the identification callbacks and also adds the root node device type, which - * is by default added to endpoint 0 (since this is the first endpoint which is created). - */ - -typedef struct config { - endpoint::root_node::config_t root_node; -} config_t; - -/** - * @param[in] config Configuration of the root node, a pointer to an object of type `node::config_t`. - * @param[in] attribute_callback This callback is called for every attribute update. The callback implementation shall - * handle the desired attributes and return an appropriate error code. If the attribute - * is not of your interest, please do not return an error code and strictly return ESP_OK. - * @param[in] identify_callback This callback is invoked when clients interact with the Identify Cluster. - * In the callback implementation, an endpoint can identify itself. - * (e.g., by flashing an LED or light). - * @param[in] priv_data Private data to send to the node. This parameter is optional - * and defaults to nullptr.This private data can be accessed in the attribute callback - * for the root endpoint only. - */ -node_t *create(config_t *config, attribute::callback_t attribute_callback, - identification::callback_t identify_callback, void* priv_data = nullptr); - -} /* node */ -} /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_event.h b/components/esp_matter/data_model/esp_matter_event.h index 479a310d5..7e6a746d4 100644 --- a/components/esp_matter/data_model/esp_matter_event.h +++ b/components/esp_matter/data_model/esp_matter_event.h @@ -13,289 +13,9 @@ // limitations under the License. #pragma once - -#include -#include -#include - -namespace esp_matter { -namespace cluster { - -/** Specific event send APIs - * - * If some standard event is not present here, it can be added. - */ - -namespace access_control { -namespace event { -event_t *create_access_control_entry_changed(cluster_t *cluster); -event_t *create_access_control_extension_changed(cluster_t *cluster); -event_t *create_fabric_restriction_review_update(cluster_t *cluster); -} // namespace event -} // namespace access_control - -namespace actions { -namespace event { -event_t *create_state_changed(cluster_t *cluster); -event_t *create_action_failed(cluster_t *cluster); -} // namespace event -} // namespace actions -namespace basic_information { -namespace event { -event_t *create_start_up(cluster_t *cluster); -event_t *create_shut_down(cluster_t *cluster); -event_t *create_leave(cluster_t *cluster); -event_t *create_reachable_changed(cluster_t *cluster); -} // namespace event -} // namespace basic_information - -namespace ota_software_update_requestor { -namespace event { -event_t *create_state_transition(cluster_t *cluster); -event_t *create_version_applied(cluster_t *cluster); -event_t *create_download_error(cluster_t *cluster); -} // namespace event -} // namespace ota_software_update_requestor - -namespace general_diagnostics { -namespace event { -event_t *create_hardware_fault_change(cluster_t *cluster); -event_t *create_radio_fault_change(cluster_t *cluster); -event_t *create_network_fault_change(cluster_t *cluster); -event_t *create_boot_reason(cluster_t *cluster); -} // namespace event -} // namespace general_diagnostics - -namespace wifi_network_diagnostics { -namespace event { -event_t *create_disconnection(cluster_t *cluster); -event_t *create_association_failure(cluster_t *cluster); -event_t *create_connection_status(cluster_t *cluster); -} // namespace event -} // namespace wifi_network_diagnostics - -namespace thread_network_diagnostics { -namespace event { -event_t *create_connection_status(cluster_t *cluster); -event_t *create_network_fault_change(cluster_t *cluster); -} // namespace event -} // namespace thread_network_diagnostics - -namespace software_diagnostics { -namespace event { -event_t *create_software_fault(cluster_t *cluster); -} // namespace event -} // namespace software_diagnostics - -namespace time_synchronization { -namespace event { -event_t *create_dst_table_empty(cluster_t *cluster); -event_t *create_dst_status(cluster_t *cluster); -event_t *create_time_zone_status(cluster_t *cluster); -event_t *create_time_failure(cluster_t *cluster); -event_t *create_missing_trusted_time_source(cluster_t *cluster); -} // namespace event -} // namespace time_synchronization - -namespace bridged_device_basic_information { -namespace event { -event_t *create_active_changed(cluster_t *cluster); -event_t *create_start_up(cluster_t *cluster); -event_t *create_shut_down(cluster_t *cluster); -event_t *create_leave(cluster_t *cluster); -event_t *create_reachable_changed(cluster_t *cluster); -} // namespace event -} // namespace bridged_device_basic_information - -namespace power_source { -namespace event { -event_t *create_wired_fault_change(cluster_t *cluster); -event_t *create_bat_fault_change(cluster_t *cluster); -event_t *create_bat_charge_fault_change(cluster_t *cluster); -} -} - -namespace smoke_co_alarm { -namespace event { -event_t *create_smoke_alarm(cluster_t *cluster); -event_t *create_co_alarm(cluster_t *cluster); -event_t *create_low_battery(cluster_t *cluster); -event_t *create_hardware_fault(cluster_t *cluster); -event_t *create_end_of_service(cluster_t *cluster); -event_t *create_self_test_complete(cluster_t *cluster); -event_t *create_alarm_muted(cluster_t *cluster); -event_t *create_mute_ended(cluster_t *cluster); -event_t *create_interconnect_smoke_alarm(cluster_t *cluster); -event_t *create_interconnect_co_alarm(cluster_t *cluster); -event_t *create_all_clear(cluster_t *cluster); -} // namespace event -} // namespace smoke_co_alarm - -namespace door_lock { -namespace event { -event_t *create_door_lock_alarm(cluster_t *cluster); -event_t *create_door_state_change(cluster_t *cluster); -event_t *create_lock_operation(cluster_t *cluster); -event_t *create_lock_operation_error(cluster_t *cluster); -event_t *create_lock_user_change(cluster_t *cluster); -} // namespace event -} // namespace door_lock - -namespace switch_cluster { -namespace event { -event_t *create_switch_latched(cluster_t *cluster); -event_t *create_initial_press(cluster_t *cluster); -event_t *create_long_press(cluster_t *cluster); -event_t *create_short_release(cluster_t *cluster); -event_t *create_long_release(cluster_t *cluster); -event_t *create_multi_press_ongoing(cluster_t *cluster); -event_t *create_multi_press_complete(cluster_t *cluster); - -esp_err_t send_switch_latched(chip::EndpointId endpoint, uint8_t new_position); -esp_err_t send_initial_press(chip::EndpointId endpoint, uint8_t new_position); -esp_err_t send_long_press(chip::EndpointId endpoint, uint8_t new_position); -esp_err_t send_short_release(chip::EndpointId endpoint, uint8_t previous_position); -esp_err_t send_long_release(chip::EndpointId endpoint, uint8_t previous_position); -esp_err_t send_multi_press_ongoing(chip::EndpointId endpoint, uint8_t new_position, uint8_t count); -esp_err_t send_multi_press_complete(chip::EndpointId endpoint, uint8_t new_position, uint8_t count); -} // namespace event -} // namespace switch_cluster - -namespace boolean_state { -namespace event { -event_t *create_state_change(cluster_t *cluster); -} // namespace event -} // namespace boolean_state - -namespace boolean_state_configuration { -namespace event { -event_t *create_alarms_state_changed(cluster_t *cluster); -event_t *create_sensor_fault(cluster_t *cluster); -} // namespace event -} // namespace boolean_state_configuration - -namespace operational_state { -namespace event { -event_t *create_operational_error(cluster_t *cluster); -event_t *create_operation_completion(cluster_t *cluster); -} // namespace event -} // namespace operational_state - -namespace pump_configuration_and_control { -namespace event { -event_t *create_supply_voltage_low(cluster_t *cluster); -event_t *create_supply_voltage_high(cluster_t *cluster); -event_t *create_power_missing_phase(cluster_t *cluster); -event_t *create_system_pressure_low(cluster_t *cluster); -event_t *create_system_pressure_high(cluster_t *cluster); -event_t *create_dry_running(cluster_t *cluster); -event_t *create_motor_temperature_high(cluster_t *cluster); -event_t *create_pump_motor_fatal_failure(cluster_t *cluster); -event_t *create_electronic_temperature_high(cluster_t *cluster); -event_t *create_pump_blocked(cluster_t *cluster); -event_t *create_sensor_failure(cluster_t *cluster); -event_t *create_electronic_non_fatal_failure(cluster_t *cluster); -event_t *create_electronic_fatal_failure(cluster_t *cluster); -event_t *create_general_fault(cluster_t *cluster); -event_t *create_leakage(cluster_t *cluster); -event_t *create_air_detection(cluster_t *cluster); -event_t *create_turbine_operation(cluster_t *cluster); -} // namespace event -} // namespace pump_configuration_and_control - -namespace electrical_power_measurement { -namespace event { -event_t *create_measurement_period_ranges(cluster_t *cluster); -} // namespace event -} // namespace electrical_power_measurement - -namespace electrical_energy_measurement { -namespace event { -event_t *create_cumulative_energy_measured(cluster_t *cluster); -event_t *create_periodic_energy_measured(cluster_t *cluster); -} // namespace event -} // namespace electrical_energy_measurement - -namespace energy_evse { -namespace event { -event_t *create_ev_connected(cluster_t *cluster); -event_t *create_ev_not_detected(cluster_t *cluster); -event_t *create_energy_transfer_started(cluster_t *cluster); -event_t *create_energy_transfer_stopped(cluster_t *cluster); -event_t *create_fault(cluster_t *cluster); -event_t *create_rfid(cluster_t *cluster); -} /* event */ -} /* energy_evse */ - -namespace valve_configuration_and_control { -namespace event { -event_t *create_valve_state_changed(cluster_t *cluster); -event_t *create_valve_fault(cluster_t *cluster); -} // namespace event -} // namespace valve_configuration_and_control - -namespace device_energy_management { -namespace event { -event_t *create_power_adjust_start(cluster_t *cluster); -event_t *create_power_adjust_end(cluster_t *cluster); -event_t *create_paused(cluster_t *cluster); -event_t *create_resumed(cluster_t *cluster); -} // namespace event -} // namespace device_energy_management - -namespace water_heater_management { -namespace event { -event_t *create_boost_started(cluster_t *cluster); -event_t *create_boost_ended(cluster_t *cluster); -} // namespace event -} // namespace water_heater_management - -namespace commissioner_control { -namespace event { -event_t *create_commissioning_request_result(cluster_t *cluster); -} // namespace event -} // namespace commissioner_control - -namespace occupancy_sensing { -namespace event { -event_t *create_occupancy_changed(cluster_t *cluster); -} // namespace event -} // namespace occupancy_sensing - -namespace closure_control { -namespace event { -event_t *create_operational_error(cluster_t *cluster); -event_t *create_movement_completed(cluster_t *cluster); -event_t *create_engage_state_changed(cluster_t *cluster); -event_t *create_secure_state_changed(cluster_t *cluster); -} // namespace event -} // namespace closure_control - -namespace push_av_stream_transport { -namespace event { -event_t *create_push_transport_begin(cluster_t *cluster); -event_t *create_push_transport_end(cluster_t *cluster); -} // namespace event -} // namespace push_av_stream_transport - -namespace commodity_price { -namespace event { -event_t *create_price_change(cluster_t *cluster); -} // namespace event -} // namespace commodity_price - -namespace electrical_grid_conditions { -namespace event { -event_t *create_current_conditions_changed(cluster_t *cluster); -} // namespace event -} // namespace electrical_grid_conditions - -namespace zone_management { -namespace event { -event_t *create_zone_triggered(cluster_t *cluster); -event_t *create_zone_stopped(cluster_t *cluster); -} // namespace event -} // namespace zone_management - -} // namespace cluster -} // namespace esp_matter +#include +#if CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL +#include "generated/clusters/all_clusters.h" +#else +#include "legacy/esp_matter_event_impl.h" +#endif diff --git a/components/esp_matter/data_model/esp_matter_feature.h b/components/esp_matter/data_model/esp_matter_feature.h index f20455065..7a0d9ab3d 100644 --- a/components/esp_matter/data_model/esp_matter_feature.h +++ b/components/esp_matter/data_model/esp_matter_feature.h @@ -13,2159 +13,9 @@ // limitations under the License. #pragma once - -#include -#include -#include - -#define ESP_MATTER_NONE_FEATURE_ID 0x0000 - -/** Specific feature APIs - * - * These APIs also create the mandatory attributes and commands for the cluster for that particular feature. If the - * mandatory attribute is not managed internally, then a config is present for that attribute. The constructor for the - * config will set the attribute to the default value from the spec. - * - * If some standard feature is not present here, it can be added. - */ - -namespace esp_matter { -namespace cluster { - -namespace descriptor { -namespace feature { -namespace tag_list { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* tag_list */ - -} /* feature */ -} /* descriptor */ - -namespace access_control { -namespace feature { -namespace extension { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* extension */ - -namespace managed_device { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* managed_device */ - -} /* feature */ -} /* access_control */ - -namespace bridged_device_basic_information { -namespace feature { -namespace bridged_icd_support { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* bridged_icd_support */ - -} /* feature */ -} /* bridged_device_basic_information */ - -namespace administrator_commissioning { - -namespace feature { - -namespace basic { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* basic */ - -} /* feature */ -} /* administrator_commissioning */ - -namespace general_commissioning { -namespace feature { -namespace terms_and_conditions { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* terms_and_conditions */ -} /* feature */ -} /* general_commissioning */ - -namespace power_source { -namespace feature { -namespace wired { -typedef struct config { - uint8_t wired_current_type; - config(): wired_current_type(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* wired */ - -namespace battery { -typedef struct config { - uint8_t bat_charge_level; - bool bat_replacement_needed; - uint8_t bat_replaceability; - config(): bat_charge_level(0), bat_replacement_needed(false), bat_replaceability(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* battery */ - -// Rechargeable feature is dependent on Battery feature, in order to add -// Rechargeable feature one must add Battery feature first. -namespace rechargeable { -typedef struct config { - uint8_t bat_charge_state; - bool bat_functional_while_charging; - config(): bat_charge_state(0), bat_functional_while_charging(false) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* rechargeable */ - -// Replaceable feature is dependent on Battery feature, in order to add -// Replaceable feature one must add Battery feature first. -namespace replaceable { -typedef struct config { - char bat_replacement_description[k_max_bat_replacement_description_length + 1]; - uint8_t bat_quantity; - config(): bat_replacement_description{0}, bat_quantity(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* replaceable */ - -} /* feature */ -} /* power_source */ - -namespace scenes_management { -namespace feature { -namespace scene_names { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* scene_names */ - -} /* feature */ -} /* scenes_management */ - -namespace icd_management { -namespace feature { -namespace check_in_protocol_support { -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* check_in_protocol_support */ - -namespace user_active_mode_trigger { -typedef struct config { - uint32_t user_active_mode_trigger_hint; - char user_active_mode_trigger_instruction[attribute::k_user_active_mode_trigger_instruction_length + 1]; - config() : user_active_mode_trigger_hint(0), user_active_mode_trigger_instruction{0} {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* user_active_mode_trigger */ - -namespace long_idle_time_support { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* long_idle_time_support */ - -namespace dynamic_sit_lit_support { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} // namespace dynamic_sit_lit_support - -} /* feature */ -} /* icd_management */ - -namespace on_off { -namespace feature { -namespace lighting { - -typedef struct config { - bool global_scene_control; - uint16_t on_time; - uint16_t off_wait_time; - nullable start_up_on_off; - config() : global_scene_control(1), on_time(0), off_wait_time(0), start_up_on_off(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* lighting */ - -namespace dead_front_behavior { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* dead_front_behavior */ - -namespace off_only { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* off_only */ -} /* feature */ -} /* on_off */ - -namespace level_control { -namespace feature { -namespace on_off { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* on_off */ - -namespace lighting { - -typedef struct config { - uint16_t remaining_time; - uint8_t min_level; - uint8_t max_level; - nullable start_up_current_level; - config() : remaining_time(0), min_level(1), max_level(254), start_up_current_level(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* lighting */ - -namespace frequency { - -typedef struct config { - uint16_t current_frequency; - uint16_t min_frequency; - uint16_t max_frequency; - config() : current_frequency(0), min_frequency(0), max_frequency(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* frequency */ -} /* feature */ -} /* level_control */ - -namespace color_control { -namespace feature { -namespace hue_saturation { - -typedef struct config { - uint8_t current_hue; - uint8_t current_saturation; - config() : current_hue(0), current_saturation(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* hue_saturation */ - -namespace color_temperature { - -typedef struct config { - uint16_t color_temperature_mireds; - uint16_t color_temp_physical_min_mireds; - uint16_t color_temp_physical_max_mireds; - uint16_t couple_color_temp_to_level_min_mireds; - nullable start_up_color_temperature_mireds; - config() : color_temperature_mireds(0x00fa), color_temp_physical_min_mireds(1), - color_temp_physical_max_mireds(0xfeff), couple_color_temp_to_level_min_mireds(1), - start_up_color_temperature_mireds(0x00fa) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* color_temperature */ - -namespace xy { - -typedef struct config { - uint16_t current_x; - uint16_t current_y; - config() : current_x(0x616b), current_y(0x607d) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* xy */ - -// EnhancedHue feature is dependent on HueSaturation feature, in order to add -// EnhancedHue feature one must add HueSaturation feature first. - -namespace enhanced_hue { - -typedef struct config { - uint16_t enhanced_current_hue; - config() : enhanced_current_hue(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* enhanced_hue */ - -// ColorLoop feature is dependent on EnhancedHue feature, in order to add -// ColorLoop feature one must add EnhancedHue feature first. - -namespace color_loop { - -typedef struct config { - uint8_t color_loop_active; - uint8_t color_loop_direction; - uint16_t color_loop_time; - uint16_t color_loop_start_enhanced_hue; - uint16_t color_loop_stored_enhanced_hue; - config() : color_loop_active(0), color_loop_direction(0), color_loop_time(0x19), - color_loop_start_enhanced_hue(0x2300), color_loop_stored_enhanced_hue(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* color_loop */ -} /* feature */ -} /* color_control */ - -namespace window_covering { -namespace feature { - -namespace lift { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* lift */ - -namespace tilt { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* tilt */ - -// PositionAwareLift feature is dependent on Lift feature, in order to add -// PositionAwareLift feature one must add Lift feature first. - -namespace position_aware_lift { - -typedef struct config { - nullable target_position_lift_percent_100ths; - nullable current_position_lift_percent_100ths; - config() : target_position_lift_percent_100ths(), current_position_lift_percent_100ths() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* position_aware_lift */ - -// PositionAwareTilt feature is dependent on Tilt feature, in order to add -// PositionAwareTilt feature one must add Tilt feature first. - -namespace position_aware_tilt { - -typedef struct config { - nullable target_position_tilt_percent_100ths; - nullable current_position_tilt_percent_100ths; - config() : target_position_tilt_percent_100ths(), current_position_tilt_percent_100ths() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* position_aware_tilt */ -} /* feature */ -} /* window_covering */ - -namespace wifi_network_diagnostics { -namespace feature { - -namespace packet_counts { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* packet_counts */ - -namespace error_counts { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* error_counts */ - -} /* feature */ -} /* wifi_network_diagnostics */ - -namespace thread_network_diagnostics { -namespace feature { - -namespace packet_counts { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* packet_counts */ - -namespace error_counts { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* error_counts */ - -namespace mle_counts { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* mle_counts */ - -namespace mac_counts { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* mac_counts */ - -} /* feature */ -} /* thread_network_diagnostics */ - -namespace ethernet_network_diagnostics { -namespace feature { - -namespace packet_counts { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* packet_counts */ - -namespace error_counts { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* error_counts */ - -} /* feature */ -} /* ethernet_network_diagnostics */ - -namespace thermostat { -namespace feature { - -namespace heating { - -typedef struct config { - int16_t occupied_heating_setpoint; - - config(): occupied_heating_setpoint(2000) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* heating */ - -namespace cooling { - -typedef struct config { - int16_t occupied_cooling_setpoint; - - config(): occupied_cooling_setpoint(2600) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* cooling */ - -// Attributes of Occupancy feature may have dependency on Heating, Cooling and Setback -// feature, one must add features according to the usecase first. -namespace occupancy { - -typedef struct config { - uint8_t occupancy; - int16_t unoccupied_cooling_setpoint; - int16_t unoccupied_heating_setpoint; - nullable unoccupied_setback; - nullable unoccupied_setback_min; - nullable unoccupied_setback_max; - - config(): occupancy(1), unoccupied_cooling_setpoint(2600), unoccupied_heating_setpoint(2000), unoccupied_setback(), unoccupied_setback_min(), unoccupied_setback_max() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* occupancy */ - -namespace setback { - -typedef struct config { - nullable occupied_setback; - nullable occupied_setback_min; - nullable occupied_setback_max; - - config(): occupied_setback(), occupied_setback_min(), occupied_setback_max() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* setback */ - -// Auto feature mandates the Heating and Cooling feature, while adding -// Auto feature one must add Heating and Colling features. - -namespace auto_mode { - -typedef struct config { - int8_t min_setpoint_dead_band; - - config(): min_setpoint_dead_band(2) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* auto_mode */ - -namespace local_temperature_not_exposed { - -typedef struct config { - int16_t local_temperature_calibration; - - config(): local_temperature_calibration(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* local_temperature_not_exposed */ - -namespace matter_schedule_configuration { - -typedef struct config { - uint8_t number_of_schedules; - uint8_t number_of_schedule_transitions; - nullable number_of_schedule_transition_per_day; - uint8_t active_schedule_handle[k_max_active_schedule_handle]; - - config(): number_of_schedules(0), number_of_schedule_transitions(0), number_of_schedule_transition_per_day() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* matter_schedule_configuration */ - -namespace presets { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* presets */ - -} /* feature */ -} /* thermostat */ - -namespace air_quality { -namespace feature { - -namespace fair { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* fair */ - -namespace moderate { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* moderate */ - -namespace very_poor { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* very_poor */ - -namespace extremely_poor { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* extremely_poor */ - -} /* feature */ -} /* air_quality */ - -namespace concentration_measurement { -namespace feature { - -namespace numeric_measurement { -typedef struct config { - nullable measured_value; - nullable min_measured_value; - nullable max_measured_value; - uint8_t measurement_unit; - config() : measured_value(), min_measured_value(), max_measured_value(), measurement_unit(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* numeric_measurement */ - -namespace level_indication { -typedef struct config { - uint8_t level_value; - config() : level_value(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* level_indication */ - -namespace medium_level { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* medium_level */ - -namespace critical_level { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* critical_level */ - -namespace peak_measurement { -typedef struct config { - nullable peak_measured_value; - uint32_t peak_measured_value_window; - config() : peak_measured_value(), peak_measured_value_window(1) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* peak_measurement */ - -namespace average_measurement { -typedef struct config { - nullable average_measured_value; - uint32_t average_measured_value_window; - config() : average_measured_value(), average_measured_value_window(1) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* average_measurement */ - -} /* feature */ -} /* concentration_measurement */ - -namespace carbon_monoxide_concentration_measurement { -namespace feature = concentration_measurement::feature; -} /* carbon_monoxide_concentration_measurement */ - -namespace carbon_dioxide_concentration_measurement { -namespace feature = concentration_measurement::feature; -} /* carbon_dioxide_concentration_measurement */ - -namespace nitrogen_dioxide_concentration_measurement { -namespace feature = concentration_measurement::feature; -} /* nitrogen_dioxide_concentration_measurement */ - -namespace ozone_concentration_measurement { -namespace feature = concentration_measurement::feature; -} /* ozone_concentration_measurement */ - -namespace formaldehyde_concentration_measurement { -namespace feature = concentration_measurement::feature; -} /* formaldehyde_concentration_measurement */ - -namespace pm1_concentration_measurement { -namespace feature = concentration_measurement::feature; -} /* pm1_concentration_measurement */ - -namespace pm25_concentration_measurement { -namespace feature = concentration_measurement::feature; -} /* pm25_concentration_measurement */ - -namespace pm10_concentration_measurement { -namespace feature = concentration_measurement::feature; -} /* pm10_concentration_measurement */ - -namespace radon_concentration_measurement { -namespace feature = concentration_measurement::feature; -} /* radon_concentration_measurement */ - -namespace total_volatile_organic_compounds_concentration_measurement { -namespace feature = concentration_measurement::feature; -} /* total_volatile_organic_compounds_concentration_measurement */ - -namespace resource_monitoring { -namespace feature { - -namespace condition { -typedef struct config { - uint8_t condition; - uint8_t degradation_direction; - config() : condition(0), degradation_direction(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* condition */ - -namespace warning { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* warning */ - -namespace replacement_product_list { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* replacement_product_list */ - -} /* feature */ -} /* resource_monitoring */ - -namespace hepa_filter_monitoring { -namespace feature = resource_monitoring::feature; -} /* hepa_filter_monitoring */ - -namespace activated_carbon_filter_monitoring { -namespace feature = resource_monitoring::feature; -} /* activated_carbon_filter_monitoring */ - -namespace laundry_washer_controls { -namespace feature { - -namespace spin { - -typedef struct config { - uint8_t spin_speed_current; - config() : spin_speed_current(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* spin */ - -namespace rinse { - -typedef struct config { - uint8_t number_of_rinses; - config() : number_of_rinses(1) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* rinse */ - -} /* feature */ -} /* laundry_washer_controls */ - -namespace smoke_co_alarm { -namespace feature { - -namespace smoke_alarm { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* smoke_alarm */ - -namespace co_alarm { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* co_alarm */ - -} /* feature */ -} /* smoke_co_alarm */ - -namespace switch_cluster { -namespace feature { - -// Note: Latching and Momentary switch features are mutually exclusive, only one of them shall be supported. - -namespace latching_switch { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* latching_switch */ - -namespace momentary_switch { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* momentary_switch */ - -// MomentarySwitchRelease feature has dependency on MomentarySwitch and !ActionSwitch features, in order to add -// MomentarySwitchRelease feature one must add MomentarySwitch feature first. - -namespace momentary_switch_release { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* momentary_switch_release */ - -// MomentarySwitchLongPress feature has dependency on MomentarySwitch and (MomentarySwitchRelease or ActionSwitch) features, in order to add -// MomentarySwitchLongPress feature one must add MomentarySwitch and (MomentarySwitchRelease or ActionSwitch) features first. - -namespace momentary_switch_long_press { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* momentary_switch_long_press */ - -// MomentarySwitchMultiPress feature has dependency on ActionSwitch or (MomentarySwitch and MomentarySwitchRelease) features, in order to add -// MomentarySwitchMultiPress feature one must add ActionSwitch or (MomentarySwitch and MomentarySwitchRelease) features first. - -namespace momentary_switch_multi_press { - -typedef struct config { - uint8_t multi_press_max; - config() : multi_press_max(2) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* momentary_switch_multi_press */ - -// ActionSwitch feature has dependency on MomentarySwitch feature, in order to add -// ActionSwitch feature one must add MomentarySwitch feature first. - -namespace action_switch { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* action_switch */ -} /* feature */ -} /* switch_cluster */ - -namespace unit_localization { -namespace feature { - -namespace temperature_unit { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* temperature_unit */ - -} /* feature */ -} /* unit_localization */ - -namespace time_format_localization { -namespace feature { - -namespace calendar_format { - -typedef struct config { - uint8_t active_calendar_type; - config() : active_calendar_type(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* calendar_format */ - -} /* feature */ -} /* time_format_localization */ - -namespace mode_select { -namespace feature { - -namespace on_off { - -typedef struct config { - nullable on_mode; - config() : on_mode() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* on_off */ - -} /* feature */ -} /* mode_select */ - -namespace general_diagnostics { -namespace feature { -namespace data_model_test { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* data_model_test */ -} /* feature */ -} /* general diagnostics */ - -namespace software_diagnostics { -namespace feature { - -namespace watermarks { - -typedef struct config { - uint64_t current_heap_high_watermark; - config() : current_heap_high_watermark(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* watermarks */ - -} /* feature */ -} /* software_diagnostics */ - -namespace temperature_control { -namespace feature { - -// TemperatureNumber and TemperatureLevel features are mutually exclusive, -// only one of them shall present. -namespace temperature_number { -typedef struct config { - int16_t temp_setpoint; - int16_t min_temperature; - int16_t max_temperature; - config() : temp_setpoint(1), min_temperature(0), max_temperature(10) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* temperature_number */ - -// TemperatureNumber and TemperatureLevel features are mutually exclusive, -// only one of them shall present. -namespace temperature_level { -typedef struct config { - uint8_t selected_temp_level; - config() : selected_temp_level(1) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* temperature_level */ - -// TemperatureStep feature have conformance of TemperatureNumber feature, -// in order to support TemperatureStep cluster shall support TemperatureNumber. -namespace temperature_step { -typedef struct config { - int16_t step; - config() : step(1) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* temperature_step */ - -} /* feature */ -} /* temperature_control */ - -namespace fan_control { -namespace feature { - -namespace multi_speed { -typedef struct config { - uint8_t speed_max; - nullable speed_setting; - uint8_t speed_current; - config() : speed_max(10), speed_setting(0), speed_current(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* multi_speed */ - -namespace fan_auto { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* fan_auto */ - -namespace rocking { -typedef struct config { - uint8_t rock_support; - uint8_t rock_setting; - config() : rock_support(0), rock_setting(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* rocking */ - -namespace wind { -typedef struct config { - uint8_t wind_support; - uint8_t wind_setting; - config() : wind_support(0), wind_setting(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* wind */ - -namespace step { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* step */ - -namespace airflow_direction { -typedef struct config { - uint8_t airflow_direction; - config() : airflow_direction(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* airflow_direction */ - -} /* feature */ -} /* fan_control */ - -namespace keypad_input { -namespace feature { - -namespace navigation_key_codes { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* navigation_key_codes */ - -namespace location_keys { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* location_keys */ - -namespace number_keys { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* number_keys */ - -} /* feature */ -} /* keypad_input */ - -namespace boolean_state_configuration { -namespace feature { - -namespace visual { - -typedef struct config { - uint8_t alarms_active; - uint8_t alarms_supported; - config() : alarms_active(0), alarms_supported(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* visual */ - -namespace audible { - -typedef struct config { - uint8_t alarms_active; - uint8_t alarms_supported; - config() : alarms_active(0), alarms_supported(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* audible */ - -namespace alarm_suppress { - -typedef struct config { - uint8_t alarms_suppressed; - config() : alarms_suppressed(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* alarm_suppress */ - -namespace sensitivity_level { - -typedef struct config { - uint8_t supported_sensitivity_levels; - config() : supported_sensitivity_levels(10) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* sensitivity_level */ - -} /* feature */ -} /* boolean_state_configuration */ - -namespace power_topology { -namespace feature { - -namespace node_topology { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* node_topology */ - -namespace tree_topology { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* tree_topology */ - -namespace set_topology { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* set_topology */ - -namespace dynamic_power_flow { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* dynamic_power_flow */ - -} /* feature */ -} /* power_topology */ - -namespace electrical_power_measurement { -namespace feature { - -namespace direct_current { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* direct_current */ - -namespace alternating_current { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* alternating_current */ - -namespace polyphase_power { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* polyphase_power */ - -namespace harmonics { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* harmonics */ - -namespace power_quality { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* power_quality */ - -} /* feature */ -} /* electrical_power_measurement */ - -namespace electrical_energy_measurement { -namespace feature { - -namespace imported_energy { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* imported_energy */ - -namespace exported_energy { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* exported_energy */ - -namespace cumulative_energy { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* cumulative_energy */ - -namespace periodic_energy { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* periodic_energy */ - -} /* feature */ -} /* electrical_energy_measurement */ - -namespace door_lock { -namespace feature { - -namespace pin_credential { -typedef struct config { - uint16_t number_pin_users_supported; - uint8_t max_pin_code_length; - uint8_t min_pin_code_length; - uint8_t wrong_code_entry_limit; - uint8_t user_code_temporary_disable_time; - bool require_pin_for_remote_operation; - config() : number_pin_users_supported(5), max_pin_code_length(16), min_pin_code_length(4), - wrong_code_entry_limit(5), user_code_temporary_disable_time(5), - require_pin_for_remote_operation(true) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* pin_credential */ - -namespace rfid_credential { -typedef struct config { - uint16_t number_rfid_users_supported; - uint8_t max_rfid_code_length; - uint8_t min_rfid_code_length; - uint8_t wrong_code_entry_limit; - uint8_t user_code_temporary_disable_time; - config() : number_rfid_users_supported(5), max_rfid_code_length(16), min_rfid_code_length(4), - wrong_code_entry_limit(5), user_code_temporary_disable_time(5) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* rfid_credential */ - -namespace finger_credentials { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* finger_credentials */ - -namespace weekday_access_schedules { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* weekday_access_schedules */ - -namespace door_position_sensor { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* door_position_sensor */ - -namespace face_credentials { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* face_credentials */ - -namespace credential_over_the_air_access { -typedef struct config { - bool require_pin_for_remote_operation; - config() : require_pin_for_remote_operation(false) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* credential_over_the_air_access */ - -namespace user { -typedef struct config { - uint16_t number_of_total_user_supported; - uint8_t credential_rules_supported; - uint8_t number_of_credentials_supported_per_user; - config() : number_of_total_user_supported(5), credential_rules_supported(0), number_of_credentials_supported_per_user(3) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* user */ - -namespace year_day_access_schedules { - -typedef struct config { - uint8_t number_of_year_day_schedules_supported_per_user; - config() : number_of_year_day_schedules_supported_per_user(1) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* year_day_access_schedules */ - -namespace holiday_schedules { - -typedef struct config { - uint8_t number_of_holiday_schedules_supported; - config() : number_of_holiday_schedules_supported(1) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* holiday_schedules */ - -namespace unbolting { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* unbolting */ - -namespace aliro_provisioning { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* aliro_provisioning */ - -namespace aliro_bleuwb { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* aliro_bleuwb */ - -} /* feature */ -}/* door_lock */ - -namespace energy_evse { -namespace feature { -namespace charging_preferences { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* charging_preferences */ - -namespace soc_reporting { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* soc_reporting */ - -namespace plug_and_charge { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* plug_and_charge */ - -namespace rfid { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* rfid */ - -namespace v2x { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* v2x */ - -} /* feature */ -} /* energy_evse */ - -namespace microwave_oven_control { -namespace feature { - -namespace power_as_number { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* power_as_number */ - -namespace power_in_watts { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* power_in_watts */ - -namespace power_number_limits { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* power_number_limits */ - -} /* feature */ -} /* microwave_oven_control */ - -namespace valve_configuration_and_control { -namespace feature { - -namespace time_sync { -typedef struct config { - nullable auto_close_time; - config() : auto_close_time() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* time_sync */ - -namespace level { -typedef struct config { - nullable current_level; - nullable target_level; - config() : current_level(), target_level() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* level */ - -} /* feature */ -} /* valve_configuration_and_control */ - -namespace device_energy_management { -namespace feature { - -namespace power_adjustment { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* power_adjustment */ - -namespace power_forecast_reporting { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* power_forecast_reporting */ - -namespace state_forecast_reporting { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* state_forecast_reporting */ - -namespace start_time_adjustment { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* start_time_adjustment */ - -namespace pausable { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* pausable */ - -namespace forecast_adjustment { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* forecast_adjustment */ - -namespace constraint_based_adjustment { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* constraint_based_adjustment */ - -} /* feature */ -} /* device_energy_management */ - -namespace thread_border_router_management { -namespace feature { - -namespace pan_change { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* pan_change */ - -} /* feature */ -} /* thread_border_router_management */ - -namespace service_area { -namespace feature { - -namespace select_while_running { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* select_while_running */ - -namespace progress_reporting { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* progress_reporting */ - -namespace maps { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* maps */ - -} /* feature */ -} /* service_area */ - -namespace water_heater_management { -namespace feature { - -namespace energy_management { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* energy_management */ - -namespace tank_percent { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* tank_percent */ -} /* feature */ -} /* water_heater_management */ - -namespace energy_preference { -namespace feature { - -namespace energy_balance { -typedef struct config { - uint8_t current_energy_balance; - config() : current_energy_balance(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* energy_balance */ - -namespace low_power_mode_sensitivity { -typedef struct config { - uint8_t current_low_power_mode_sensitivity; - config() : current_low_power_mode_sensitivity(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* low_power_mode_sensitivity */ - -} /* feature */ -} /* energy_preference */ - -namespace pressure_measurement { -namespace feature { - -namespace extended { - -typedef struct config { - nullable scaled_value; - nullable min_scaled_value; - nullable max_scaled_value; - uint8_t scale; - config() : scaled_value(), min_scaled_value(), max_scaled_value(), scale(0) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* extended */ - -} /* feature */ -} /* pressure_measurement */ - -namespace occupancy_sensing { -namespace feature { - -namespace other { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* other */ - -namespace passive_infrared { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* passive_infrared */ - -namespace ultrasonic { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* ultrasonic */ - -namespace physical_contact { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* physical_contact */ - -namespace active_infrared { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* active_infrared */ - -namespace radar { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* radar */ - -namespace rf_sensing { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* rf_sensing */ - -namespace vision { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* vision */ -} /* feature */ -} /* occupancy_sensing */ - -namespace pump_configuration_and_control { -namespace feature { - -namespace constant_pressure { - -typedef struct config { - nullable min_const_pressure; - nullable max_const_pressure; - config() : min_const_pressure(), max_const_pressure() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* constant_pressure */ - -namespace compensated_pressure { - -typedef struct config { - nullable min_comp_pressure; - nullable max_comp_pressure; - config() : min_comp_pressure(), max_comp_pressure() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* compensated_pressure */ - -namespace constant_flow { - -typedef struct config { - nullable min_const_flow; - nullable max_const_flow; - config() : min_const_flow(), max_const_flow() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* constant_flow */ - -namespace constant_speed { - -typedef struct config { - nullable min_const_speed; - nullable max_const_speed; - config() : min_const_speed(), max_const_speed() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* constant_speed */ - -namespace constant_temperature { - -typedef struct config { - nullable min_const_temp; - nullable max_const_temp; - config() : min_const_temp(), max_const_temp() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* constant_temperature */ - -namespace automatic { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* automatic */ - -namespace local_operation { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* automatic */ -} /* feature */ -} /* pump_configuration_and_control */ - -namespace time_synchronization { -namespace feature { - -namespace time_zone { -typedef struct config { - uint8_t time_zone_database; - config() : time_zone_database(2/* None */) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* time_zone */ - -namespace ntp_client { -typedef struct config { - bool supports_dns_resolve; - config() : supports_dns_resolve(false) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* ntp_client */ - -namespace ntp_server { -typedef struct config { - bool ntp_server_available; - config() : ntp_server_available(false) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); -} /* ntp_server */ - -namespace time_sync_client { -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* time_sync_client */ - -} /* feature */ -} /* time_synchronization */ - -namespace camera_av_stream_management { - -namespace feature { -namespace audio { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* audio */ - -namespace video { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* video */ - -namespace snapshot { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* snapshot */ - -namespace privacy { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* privacy */ - -namespace speaker { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* speaker */ - -namespace image_control { -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* image_control */ - -namespace watermark { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* watermark */ - -namespace on_screen_display { -typedef struct config { - config() {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* on_screen_display */ - -namespace local_storage { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* local_storage */ - -namespace high_dynamic_range { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* high_dynamic_range */ - -namespace night_vision { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); - -} /* night_vision */ - -} /* feature */ -}/*camera av stream management*/ - -namespace webrtc_transport_provider { -}/*webrtc_transport_provider*/ - -namespace webrtc_transport_requestor { -}/*webrtc_transport_requestor*/ - -namespace closure_control { -namespace feature { - -namespace positioning { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* positioning */ - -namespace motion_latching { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* motion_latching */ - -namespace instantaneous { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* instantaneous */ - -namespace speed { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* speed */ - -namespace ventilation { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* ventilation */ - -namespace pedestrian { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* pedestrian */ - -namespace calibration { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* calibration */ - -namespace protection { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* protection */ - -namespace manually_operable { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* manually_operable */ - -} /* feature */ -} /* closure_control */ - -namespace closure_dimension { -namespace feature { - -namespace positioning { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* positioning */ - -namespace motion_latching { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* motion_latching */ - -namespace unit { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* unit */ - -namespace limitation { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* limitation */ - -namespace speed { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* speed */ - -namespace translation { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* translation */ - -namespace rotation { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* rotation */ - -namespace modulation { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* modulation */ - -} /* feature */ -} /* closure_dimension */ - -namespace camera_av_settings_user_level_management { -namespace feature { - -namespace digital_ptz { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* digital_ptz */ - -namespace mechanical_pan { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* mechanical_pan */ - -namespace mechanical_tilt { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* mechanical_tilt */ - -namespace mechanical_zoom { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* mechanical_zoom */ - -namespace mechanical_presets { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* mechanical_presets */ - -} /* feature */ -} /* camera_av_settings_user_level_management */ - -namespace push_av_stream_transport { -namespace feature { - -namespace per_zone_sensitivity { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* per_zone_sensitivity */ - -/* Provisional */ -namespace metadata { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* metadata */ - -} /* feature */ -} /* push_av_stream_transport */ - -namespace commodity_tariff { -namespace feature { - -namespace pricing { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* pricing */ - -namespace friendly_credit { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* friendly_credit */ - -namespace auxiliary_load { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* auxiliary_load */ - -namespace peak_period { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* peak_period */ - -namespace power_threshold { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* power_threshold */ - -namespace randomization { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* randomization */ - -} /* feature */ -} /* commodity_tariff */ - -namespace commodity_price { -namespace feature { - -namespace forecasting { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* forecasting */ - -} /* feature */ -} /* commodity_price */ - -namespace electrical_grid_conditions { -namespace feature { - -namespace forecasting { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* forecasting */ - -} /* feature */ -} /* electrical_grid_conditions */ - -namespace meter_identification { -namespace feature { - -namespace power_threshold { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* power_threshold */ - -} /* feature */ -} /* meter_identification */ - -namespace zone_management { -namespace feature { - -namespace two_dimensional_cartesian_zone { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* two_dimensional_cartesian_zone */ - -namespace per_zone_sensitivity { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* per_zone_sensitivity */ - -namespace user_defined { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* user_defined */ - -namespace focus_zones { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* focus_zones */ - -} /* feature */ -} /* zone_management */ - -} /* cluster */ -} /* esp_matter */ +#include +#if CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL +#include "generated/clusters/all_clusters.h" +#else +#include "legacy/esp_matter_feature_impl.h" +#endif diff --git a/components/esp_matter/data_model/esp_matter_macros.h b/components/esp_matter/data_model/esp_matter_macros.h new file mode 100644 index 000000000..b1ac4ec94 --- /dev/null +++ b/components/esp_matter/data_model/esp_matter_macros.h @@ -0,0 +1,40 @@ +// Copyright 2021 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#define CALL_ONCE(cb) \ + [](){ \ + static bool is_called = false; \ + if (!is_called) { \ + cb(); \ + is_called = true; \ + } \ + } + +// convenience macro for checking if features is enabled or not +// must be used only from the ::create() API so that it can find config +// eg: if (has(feature::constant_pressure)) { ... } +#define has_feature(feature_name) ((feature_map & feature::feature_name::get_id()) ? 1 : 0) +#define has_attribute(attribute_name) (esp_matter::attribute::get(cluster, attribute::attribute_name::Id) != nullptr) +#define has_command(command_name, flag) (esp_matter::command::get(cluster, command::command_name::Id, flag) != nullptr) + +// Macros to reduce repetitive validation code +#define VALIDATE_FEATURES_EXACT_ONE(name, ...) \ + do { if (!validate_features(config->feature_flags, feature_policy::k_exact_one, name, {__VA_ARGS__})) \ + return ABORT_CLUSTER_CREATE(cluster); } while(0) + +#define VALIDATE_FEATURES_AT_LEAST_ONE(name, ...) \ + do { if (!validate_features(config->feature_flags, feature_policy::k_at_least_one, name, {__VA_ARGS__})) \ + return ABORT_CLUSTER_CREATE(cluster); } while(0) diff --git a/components/esp_matter/data_model/generated/clusters/access_control/access_control.cpp b/components/esp_matter/data_model/generated/clusters/access_control/access_control.cpp new file mode 100644 index 000000000..e91a72d11 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/access_control/access_control.cpp @@ -0,0 +1,221 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "access_control_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace access_control { + +namespace feature { +namespace extension { +uint32_t get_id() +{ + return Extension::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_extension(cluster, NULL, 0, 0); + event::create_access_control_extension_changed(cluster); + + return ESP_OK; +} +} /* extension */ + +namespace managed_device { +uint32_t get_id() +{ + return ManagedDevice::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); +#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS + attribute::create_commissioning_arl(cluster, NULL, 0, 0); +#endif // CHIP_CONFIG_USE_ACCESS_RESTRICTIONS +#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS + attribute::create_arl(cluster, NULL, 0, 0); +#endif // CHIP_CONFIG_USE_ACCESS_RESTRICTIONS +#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS + command::create_review_fabric_restrictions(cluster); +#endif // CHIP_CONFIG_USE_ACCESS_RESTRICTIONS + command::create_review_fabric_restrictions_response(cluster); + event::create_fabric_restriction_review_update(cluster); + + return ESP_OK; +} +} /* managed_device */ + +} /* feature */ + +namespace attribute { +attribute_t *create_acl(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ACL::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_extension(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(extension), NULL); + return esp_matter::attribute::create(cluster, Extension::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_subjects_per_access_control_entry(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SubjectsPerAccessControlEntry::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(4), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_targets_per_access_control_entry(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, TargetsPerAccessControlEntry::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(3), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_access_control_entries_per_fabric(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, AccessControlEntriesPerFabric::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(4), esp_matter_uint16(65534)); + return attribute; +} + +#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS +attribute_t *create_commissioning_arl(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(managed_device), NULL); + return esp_matter::attribute::create(cluster, CommissioningARL::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} +#endif // CHIP_CONFIG_USE_ACCESS_RESTRICTIONS + +#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS +attribute_t *create_arl(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(managed_device), NULL); + return esp_matter::attribute::create(cluster, ARL::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} +#endif // CHIP_CONFIG_USE_ACCESS_RESTRICTIONS + +} /* attribute */ +namespace command { +#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS +command_t *create_review_fabric_restrictions(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(managed_device), NULL); + return esp_matter::command::create(cluster, ReviewFabricRestrictions::Id, COMMAND_FLAG_ACCEPTED, NULL); +} +#endif // CHIP_CONFIG_USE_ACCESS_RESTRICTIONS + +command_t *create_review_fabric_restrictions_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(managed_device), NULL); + return esp_matter::command::create(cluster, ReviewFabricRestrictionsResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_access_control_entry_changed(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, AccessControlEntryChanged::Id); +} + +event_t *create_access_control_extension_changed(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(extension), NULL); + return esp_matter::event::create(cluster, AccessControlExtensionChanged::Id); +} + +event_t *create_fabric_restriction_review_update(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(managed_device), NULL); + return esp_matter::event::create(cluster, FabricRestrictionReviewUpdate::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, access_control::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, access_control::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterAccessControlPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_subjects_per_access_control_entry(cluster, config->subjects_per_access_control_entry); + attribute::create_targets_per_access_control_entry(cluster, config->targets_per_access_control_entry); + attribute::create_access_control_entries_per_fabric(cluster, config->access_control_entries_per_fabric); + attribute::create_acl(cluster, NULL, 0, 0); + /* Events */ + event::create_access_control_entry_changed(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterAccessControlClusterServerInitCallback, + ESPMatterAccessControlClusterServerShutdownCallback); + } + + return cluster; +} + +} /* access_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/access_control/access_control.h b/components/esp_matter/data_model/generated/clusters/access_control/access_control.h new file mode 100644 index 000000000..d5cf7addb --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/access_control/access_control.h @@ -0,0 +1,75 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace access_control { + +namespace feature { +namespace extension { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* extension */ + +namespace managed_device { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* managed_device */ + +} /* feature */ + +namespace attribute { +attribute_t *create_acl(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_extension(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_subjects_per_access_control_entry(cluster_t *cluster, uint16_t value); +attribute_t *create_targets_per_access_control_entry(cluster_t *cluster, uint16_t value); +attribute_t *create_access_control_entries_per_fabric(cluster_t *cluster, uint16_t value); +#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS +attribute_t *create_commissioning_arl(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +#endif // CHIP_CONFIG_USE_ACCESS_RESTRICTIONS +#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS +attribute_t *create_arl(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +#endif // CHIP_CONFIG_USE_ACCESS_RESTRICTIONS +} /* attribute */ + +namespace command { +#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS +command_t *create_review_fabric_restrictions(cluster_t *cluster); +#endif // CHIP_CONFIG_USE_ACCESS_RESTRICTIONS +command_t *create_review_fabric_restrictions_response(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_access_control_entry_changed(cluster_t *cluster); +event_t *create_access_control_extension_changed(cluster_t *cluster); +event_t *create_fabric_restriction_review_update(cluster_t *cluster); +} /* event */ + +typedef struct config { + uint16_t subjects_per_access_control_entry; + uint16_t targets_per_access_control_entry; + uint16_t access_control_entries_per_fabric; + config() : subjects_per_access_control_entry(4), targets_per_access_control_entry(3), access_control_entries_per_fabric(4) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* access_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/access_control/access_control_ids.h b/components/esp_matter/data_model/generated/clusters/access_control/access_control_ids.h new file mode 100644 index 000000000..292e85b91 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/access_control/access_control_ids.h @@ -0,0 +1,82 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace access_control { + +inline constexpr uint32_t Id = 0x001F; + +namespace feature { +namespace Extension { +inline constexpr uint32_t Id = 0x1; +} /* Extension */ +namespace ManagedDevice { +inline constexpr uint32_t Id = 0x2; +} /* ManagedDevice */ +} /* feature */ + +namespace attribute { +namespace ACL { +inline constexpr uint32_t Id = 0x0000; +} /* ACL */ +namespace Extension { +inline constexpr uint32_t Id = 0x0001; +} /* Extension */ +namespace SubjectsPerAccessControlEntry { +inline constexpr uint32_t Id = 0x0002; +} /* SubjectsPerAccessControlEntry */ +namespace TargetsPerAccessControlEntry { +inline constexpr uint32_t Id = 0x0003; +} /* TargetsPerAccessControlEntry */ +namespace AccessControlEntriesPerFabric { +inline constexpr uint32_t Id = 0x0004; +} /* AccessControlEntriesPerFabric */ +namespace CommissioningARL { +inline constexpr uint32_t Id = 0x0005; +} /* CommissioningARL */ +namespace ARL { +inline constexpr uint32_t Id = 0x0006; +} /* ARL */ +} /* attribute */ + +namespace command { +namespace ReviewFabricRestrictions { +inline constexpr uint32_t Id = 0x00; +} /* ReviewFabricRestrictions */ +namespace ReviewFabricRestrictionsResponse { +inline constexpr uint32_t Id = 0x01; +} /* ReviewFabricRestrictionsResponse */ +} /* command */ + +namespace event { +namespace AccessControlEntryChanged { +inline constexpr uint32_t Id = 0x00; +} /* AccessControlEntryChanged */ +namespace AccessControlExtensionChanged { +inline constexpr uint32_t Id = 0x01; +} /* AccessControlExtensionChanged */ +namespace FabricRestrictionReviewUpdate { +inline constexpr uint32_t Id = 0x02; +} /* FabricRestrictionReviewUpdate */ +} /* event */ + +} /* access_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/account_login/account_login.cpp b/components/esp_matter/data_model/generated/clusters/account_login/account_login.cpp new file mode 100644 index 000000000..a4c3955a7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/account_login/account_login.cpp @@ -0,0 +1,157 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "account_login_cluster"; +constexpr uint16_t cluster_revision = 2; + +static esp_err_t esp_matter_command_callback_get_setup_pin(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::AccountLogin::Commands::GetSetupPIN::DecodableType command_data; + chip::app::CommandHandler *command_obj = (chip::app::CommandHandler *)opaque_ptr; + CHIP_ERROR error = command_data.Decode(tlv_data, command_obj->GetAccessingFabricIndex()); + if (error == CHIP_NO_ERROR) { + emberAfAccountLoginClusterGetSetupPINCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_login(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::AccountLogin::Commands::Login::DecodableType command_data; + chip::app::CommandHandler *command_obj = (chip::app::CommandHandler *)opaque_ptr; + CHIP_ERROR error = command_data.Decode(tlv_data, command_obj->GetAccessingFabricIndex()); + if (error == CHIP_NO_ERROR) { + emberAfAccountLoginClusterLoginCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_logout(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::AccountLogin::Commands::Logout::DecodableType command_data; + chip::app::CommandHandler *command_obj = (chip::app::CommandHandler *)opaque_ptr; + CHIP_ERROR error = command_data.Decode(tlv_data, command_obj->GetAccessingFabricIndex()); + if (error == CHIP_NO_ERROR) { + emberAfAccountLoginClusterLogoutCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace account_login { + +namespace command { +command_t *create_get_setup_pin(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetSetupPIN::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_get_setup_pin); +} + +command_t *create_get_setup_pin_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetSetupPINResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_login(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Login::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_login); +} + +command_t *create_logout(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Logout::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_logout); +} + +} /* command */ + +namespace event { +event_t *create_logged_out(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, LoggedOut::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, account_login::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, account_login::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = AccountLoginDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterAccountLoginPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_get_setup_pin(cluster); + command::create_get_setup_pin_response(cluster); + command::create_login(cluster); + command::create_logout(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* account_login */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/account_login/account_login.h b/components/esp_matter/data_model/generated/clusters/account_login/account_login.h new file mode 100644 index 000000000..0878b9e7c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/account_login/account_login.h @@ -0,0 +1,44 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace account_login { + +namespace command { +command_t *create_get_setup_pin(cluster_t *cluster); +command_t *create_get_setup_pin_response(cluster_t *cluster); +command_t *create_login(cluster_t *cluster); +command_t *create_logout(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_logged_out(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* account_login */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/account_login/account_login_ids.h b/components/esp_matter/data_model/generated/clusters/account_login/account_login_ids.h new file mode 100644 index 000000000..308131c25 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/account_login/account_login_ids.h @@ -0,0 +1,49 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace account_login { + +inline constexpr uint32_t Id = 0x050E; + +namespace command { +namespace GetSetupPIN { +inline constexpr uint32_t Id = 0x00; +} /* GetSetupPIN */ +namespace GetSetupPINResponse { +inline constexpr uint32_t Id = 0x01; +} /* GetSetupPINResponse */ +namespace Login { +inline constexpr uint32_t Id = 0x02; +} /* Login */ +namespace Logout { +inline constexpr uint32_t Id = 0x03; +} /* Logout */ +} /* command */ + +namespace event { +namespace LoggedOut { +inline constexpr uint32_t Id = 0x00; +} /* LoggedOut */ +} /* event */ + +} /* account_login */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/actions/actions.cpp b/components/esp_matter/data_model/generated/clusters/actions/actions.cpp new file mode 100644 index 000000000..ee43fd578 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/actions/actions.cpp @@ -0,0 +1,185 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "actions_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace actions { + +namespace attribute { +attribute_t *create_action_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ActionList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_endpoint_lists(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, EndpointLists::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_setup_url(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_setup_url_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, SetupURL::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_setup_url_length + 1); +} + +} /* attribute */ +namespace command { +command_t *create_instant_action(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, InstantAction::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_instant_action_with_transition(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, InstantActionWithTransition::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_start_action(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, StartAction::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_start_action_with_duration(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, StartActionWithDuration::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_stop_action(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, StopAction::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_pause_action(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, PauseAction::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_pause_action_with_duration(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, PauseActionWithDuration::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_resume_action(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ResumeAction::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_enable_action(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, EnableAction::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_enable_action_with_duration(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, EnableActionWithDuration::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_disable_action(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, DisableAction::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_disable_action_with_duration(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, DisableActionWithDuration::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_state_changed(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, StateChanged::Id); +} + +event_t *create_action_failed(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, ActionFailed::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, actions::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, actions::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ActionsDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterActionsPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_action_list(cluster, NULL, 0, 0); + attribute::create_endpoint_lists(cluster, NULL, 0, 0); + /* Events */ + event::create_state_changed(cluster); + event::create_action_failed(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* actions */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/actions/actions.h b/components/esp_matter/data_model/generated/clusters/actions/actions.h new file mode 100644 index 000000000..e81163c58 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/actions/actions.h @@ -0,0 +1,60 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace actions { + +const uint16_t k_max_setup_url_length = 512u; +namespace attribute { +attribute_t *create_action_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_endpoint_lists(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_setup_url(cluster_t *cluster, char * value, uint16_t length); +} /* attribute */ + +namespace command { +command_t *create_instant_action(cluster_t *cluster); +command_t *create_instant_action_with_transition(cluster_t *cluster); +command_t *create_start_action(cluster_t *cluster); +command_t *create_start_action_with_duration(cluster_t *cluster); +command_t *create_stop_action(cluster_t *cluster); +command_t *create_pause_action(cluster_t *cluster); +command_t *create_pause_action_with_duration(cluster_t *cluster); +command_t *create_resume_action(cluster_t *cluster); +command_t *create_enable_action(cluster_t *cluster); +command_t *create_enable_action_with_duration(cluster_t *cluster); +command_t *create_disable_action(cluster_t *cluster); +command_t *create_disable_action_with_duration(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_state_changed(cluster_t *cluster); +event_t *create_action_failed(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* actions */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/actions/actions_ids.h b/components/esp_matter/data_model/generated/clusters/actions/actions_ids.h new file mode 100644 index 000000000..f10c55980 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/actions/actions_ids.h @@ -0,0 +1,88 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace actions { + +inline constexpr uint32_t Id = 0x0025; + +namespace attribute { +namespace ActionList { +inline constexpr uint32_t Id = 0x0000; +} /* ActionList */ +namespace EndpointLists { +inline constexpr uint32_t Id = 0x0001; +} /* EndpointLists */ +namespace SetupURL { +inline constexpr uint32_t Id = 0x0002; +} /* SetupURL */ +} /* attribute */ + +namespace command { +namespace InstantAction { +inline constexpr uint32_t Id = 0x00; +} /* InstantAction */ +namespace InstantActionWithTransition { +inline constexpr uint32_t Id = 0x01; +} /* InstantActionWithTransition */ +namespace StartAction { +inline constexpr uint32_t Id = 0x02; +} /* StartAction */ +namespace StartActionWithDuration { +inline constexpr uint32_t Id = 0x03; +} /* StartActionWithDuration */ +namespace StopAction { +inline constexpr uint32_t Id = 0x04; +} /* StopAction */ +namespace PauseAction { +inline constexpr uint32_t Id = 0x05; +} /* PauseAction */ +namespace PauseActionWithDuration { +inline constexpr uint32_t Id = 0x06; +} /* PauseActionWithDuration */ +namespace ResumeAction { +inline constexpr uint32_t Id = 0x07; +} /* ResumeAction */ +namespace EnableAction { +inline constexpr uint32_t Id = 0x08; +} /* EnableAction */ +namespace EnableActionWithDuration { +inline constexpr uint32_t Id = 0x09; +} /* EnableActionWithDuration */ +namespace DisableAction { +inline constexpr uint32_t Id = 0x0A; +} /* DisableAction */ +namespace DisableActionWithDuration { +inline constexpr uint32_t Id = 0x0B; +} /* DisableActionWithDuration */ +} /* command */ + +namespace event { +namespace StateChanged { +inline constexpr uint32_t Id = 0x00; +} /* StateChanged */ +namespace ActionFailed { +inline constexpr uint32_t Id = 0x01; +} /* ActionFailed */ +} /* event */ + +} /* actions */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/activated_carbon_filter_monitoring/activated_carbon_filter_monitoring.cpp b/components/esp_matter/data_model/generated/clusters/activated_carbon_filter_monitoring/activated_carbon_filter_monitoring.cpp new file mode 100644 index 000000000..57dae53cc --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/activated_carbon_filter_monitoring/activated_carbon_filter_monitoring.cpp @@ -0,0 +1,191 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "activated_carbon_filter_monitoring_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace activated_carbon_filter_monitoring { + +namespace feature { +namespace condition { +uint32_t get_id() +{ + return Condition::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_condition(cluster, config->condition); + attribute::create_degradation_direction(cluster, config->degradation_direction); + + return ESP_OK; +} +} /* condition */ + +namespace warning { +uint32_t get_id() +{ + return Warning::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* warning */ + +namespace replacement_product_list { +uint32_t get_id() +{ + return ReplacementProductList::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_replacement_product_list(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* replacement_product_list */ + +} /* feature */ + +namespace attribute { +attribute_t *create_condition(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(condition), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, Condition::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_degradation_direction(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(condition), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, DegradationDirection::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(1)); + return attribute; +} + +attribute_t *create_change_indication(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ChangeIndication::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_in_place_indicator(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, InPlaceIndicator::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_last_changed_time(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LastChangedTime::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_replacement_product_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(replacement_product_list), NULL); + return esp_matter::attribute::create(cluster, ReplacementProductList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_reset_condition(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ResetCondition::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, activated_carbon_filter_monitoring::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, activated_carbon_filter_monitoring::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterActivatedCarbonFilterMonitoringPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_change_indication(cluster, config->change_indication); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterActivatedCarbonFilterMonitoringClusterServerInitCallback, + ESPMatterActivatedCarbonFilterMonitoringClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* activated_carbon_filter_monitoring */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/activated_carbon_filter_monitoring/activated_carbon_filter_monitoring.h b/components/esp_matter/data_model/generated/clusters/activated_carbon_filter_monitoring/activated_carbon_filter_monitoring.h new file mode 100644 index 000000000..a02329647 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/activated_carbon_filter_monitoring/activated_carbon_filter_monitoring.h @@ -0,0 +1,69 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace activated_carbon_filter_monitoring { + +namespace feature { +namespace condition { +typedef struct config { + uint8_t condition; + uint8_t degradation_direction; + config() : condition(0), degradation_direction(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* condition */ + +namespace warning { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* warning */ + +namespace replacement_product_list { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* replacement_product_list */ + +} /* feature */ + +namespace attribute { +attribute_t *create_condition(cluster_t *cluster, uint8_t value); +attribute_t *create_degradation_direction(cluster_t *cluster, uint8_t value); +attribute_t *create_change_indication(cluster_t *cluster, uint8_t value); +attribute_t *create_in_place_indicator(cluster_t *cluster, bool value); +attribute_t *create_last_changed_time(cluster_t *cluster, nullable value); +attribute_t *create_replacement_product_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_reset_condition(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t change_indication; + config() : change_indication(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* activated_carbon_filter_monitoring */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/activated_carbon_filter_monitoring/activated_carbon_filter_monitoring_ids.h b/components/esp_matter/data_model/generated/clusters/activated_carbon_filter_monitoring/activated_carbon_filter_monitoring_ids.h new file mode 100644 index 000000000..66cf28cb0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/activated_carbon_filter_monitoring/activated_carbon_filter_monitoring_ids.h @@ -0,0 +1,67 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace activated_carbon_filter_monitoring { + +inline constexpr uint32_t Id = 0x0072; + +namespace feature { +namespace Condition { +inline constexpr uint32_t Id = 0x1; +} /* Condition */ +namespace Warning { +inline constexpr uint32_t Id = 0x2; +} /* Warning */ +namespace ReplacementProductList { +inline constexpr uint32_t Id = 0x4; +} /* ReplacementProductList */ +} /* feature */ + +namespace attribute { +namespace Condition { +inline constexpr uint32_t Id = 0x0000; +} /* Condition */ +namespace DegradationDirection { +inline constexpr uint32_t Id = 0x0001; +} /* DegradationDirection */ +namespace ChangeIndication { +inline constexpr uint32_t Id = 0x0002; +} /* ChangeIndication */ +namespace InPlaceIndicator { +inline constexpr uint32_t Id = 0x0003; +} /* InPlaceIndicator */ +namespace LastChangedTime { +inline constexpr uint32_t Id = 0x0004; +} /* LastChangedTime */ +namespace ReplacementProductList { +inline constexpr uint32_t Id = 0x0005; +} /* ReplacementProductList */ +} /* attribute */ + +namespace command { +namespace ResetCondition { +inline constexpr uint32_t Id = 0x00; +} /* ResetCondition */ +} /* command */ + +} /* activated_carbon_filter_monitoring */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/administrator_commissioning/administrator_commissioning.cpp b/components/esp_matter/data_model/generated/clusters/administrator_commissioning/administrator_commissioning.cpp new file mode 100644 index 000000000..49c4d7150 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/administrator_commissioning/administrator_commissioning.cpp @@ -0,0 +1,142 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "administrator_commissioning_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace administrator_commissioning { + +namespace feature { +namespace basic { +uint32_t get_id() +{ + return Basic::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_open_basic_commissioning_window(cluster); + + return ESP_OK; +} +} /* basic */ + +} /* feature */ + +namespace attribute { +attribute_t *create_window_status(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, WindowStatus::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_admin_fabric_index(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, AdminFabricIndex::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_admin_vendor_id(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, AdminVendorId::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_open_commissioning_window(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, OpenCommissioningWindow::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_open_basic_commissioning_window(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(basic), NULL); + return esp_matter::command::create(cluster, OpenBasicCommissioningWindow::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_revoke_commissioning(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RevokeCommissioning::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, administrator_commissioning::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, administrator_commissioning::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterAdministratorCommissioningPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_window_status(cluster, config->window_status); + attribute::create_admin_fabric_index(cluster, config->admin_fabric_index); + attribute::create_admin_vendor_id(cluster, config->admin_vendor_id); + command::create_open_commissioning_window(cluster); + command::create_revoke_commissioning(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterAdministratorCommissioningClusterServerInitCallback, + ESPMatterAdministratorCommissioningClusterServerShutdownCallback); + } + + return cluster; +} + +} /* administrator_commissioning */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/administrator_commissioning/administrator_commissioning.h b/components/esp_matter/data_model/generated/clusters/administrator_commissioning/administrator_commissioning.h new file mode 100644 index 000000000..609828e3b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/administrator_commissioning/administrator_commissioning.h @@ -0,0 +1,55 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace administrator_commissioning { + +namespace feature { +namespace basic { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* basic */ + +} /* feature */ + +namespace attribute { +attribute_t *create_window_status(cluster_t *cluster, uint8_t value); +attribute_t *create_admin_fabric_index(cluster_t *cluster, nullable value); +attribute_t *create_admin_vendor_id(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_open_commissioning_window(cluster_t *cluster); +command_t *create_open_basic_commissioning_window(cluster_t *cluster); +command_t *create_revoke_commissioning(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t window_status; + nullable admin_fabric_index; + nullable admin_vendor_id; + config() : window_status(0), admin_fabric_index(0), admin_vendor_id(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* administrator_commissioning */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/administrator_commissioning/administrator_commissioning_ids.h b/components/esp_matter/data_model/generated/clusters/administrator_commissioning/administrator_commissioning_ids.h new file mode 100644 index 000000000..7196705e6 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/administrator_commissioning/administrator_commissioning_ids.h @@ -0,0 +1,58 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace administrator_commissioning { + +inline constexpr uint32_t Id = 0x003C; + +namespace feature { +namespace Basic { +inline constexpr uint32_t Id = 0x1; +} /* Basic */ +} /* feature */ + +namespace attribute { +namespace WindowStatus { +inline constexpr uint32_t Id = 0x0000; +} /* WindowStatus */ +namespace AdminFabricIndex { +inline constexpr uint32_t Id = 0x0001; +} /* AdminFabricIndex */ +namespace AdminVendorId { +inline constexpr uint32_t Id = 0x0002; +} /* AdminVendorId */ +} /* attribute */ + +namespace command { +namespace OpenCommissioningWindow { +inline constexpr uint32_t Id = 0x00; +} /* OpenCommissioningWindow */ +namespace OpenBasicCommissioningWindow { +inline constexpr uint32_t Id = 0x01; +} /* OpenBasicCommissioningWindow */ +namespace RevokeCommissioning { +inline constexpr uint32_t Id = 0x02; +} /* RevokeCommissioning */ +} /* command */ + +} /* administrator_commissioning */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/air_quality/air_quality.cpp b/components/esp_matter/data_model/generated/clusters/air_quality/air_quality.cpp new file mode 100644 index 000000000..8b8299934 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/air_quality/air_quality.cpp @@ -0,0 +1,154 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "air_quality_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace air_quality { + +namespace feature { +namespace fair { +uint32_t get_id() +{ + return Fair::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* fair */ + +namespace moderate { +uint32_t get_id() +{ + return Moderate::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* moderate */ + +namespace very_poor { +uint32_t get_id() +{ + return VeryPoor::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* very_poor */ + +namespace extremely_poor { +uint32_t get_id() +{ + return ExtremelyPoor::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* extremely_poor */ + +} /* feature */ + +namespace attribute { +attribute_t *create_air_quality(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, AirQuality::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(6)); + return attribute; +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, air_quality::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, air_quality::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterAirQualityPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_air_quality(cluster, config->air_quality); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* air_quality */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/air_quality/air_quality.h b/components/esp_matter/data_model/generated/clusters/air_quality/air_quality.h new file mode 100644 index 000000000..e880b36c4 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/air_quality/air_quality.h @@ -0,0 +1,60 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace air_quality { + +namespace feature { +namespace fair { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* fair */ + +namespace moderate { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* moderate */ + +namespace very_poor { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* very_poor */ + +namespace extremely_poor { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* extremely_poor */ + +} /* feature */ + +namespace attribute { +attribute_t *create_air_quality(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + uint8_t air_quality; + config() : air_quality(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* air_quality */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/air_quality/air_quality_ids.h b/components/esp_matter/data_model/generated/clusters/air_quality/air_quality_ids.h new file mode 100644 index 000000000..14e01c294 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/air_quality/air_quality_ids.h @@ -0,0 +1,49 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace air_quality { + +inline constexpr uint32_t Id = 0x005B; + +namespace feature { +namespace Fair { +inline constexpr uint32_t Id = 0x1; +} /* Fair */ +namespace Moderate { +inline constexpr uint32_t Id = 0x2; +} /* Moderate */ +namespace VeryPoor { +inline constexpr uint32_t Id = 0x4; +} /* VeryPoor */ +namespace ExtremelyPoor { +inline constexpr uint32_t Id = 0x8; +} /* ExtremelyPoor */ +} /* feature */ + +namespace attribute { +namespace AirQuality { +inline constexpr uint32_t Id = 0x0000; +} /* AirQuality */ +} /* attribute */ + +} /* air_quality */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/alarm_base/alarm_base.cpp b/components/esp_matter/data_model/generated/clusters/alarm_base/alarm_base.cpp new file mode 100644 index 000000000..065c97e63 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/alarm_base/alarm_base.cpp @@ -0,0 +1,122 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "alarm_base_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace alarm_base { + +namespace feature { +namespace reset { +uint32_t get_id() +{ + return Reset::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_latch(cluster, config->latch); + command::create_reset(cluster); + + return ESP_OK; +} +} /* reset */ + +} /* feature */ + +namespace attribute { +attribute_t *create_mask(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Mask::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(4294967295)); + return attribute; +} + +attribute_t *create_latch(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(reset), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, Latch::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(4294967295)); + return attribute; +} + +attribute_t *create_state(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, State::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(4294967295)); + return attribute; +} + +attribute_t *create_supported(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Supported::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(4294967295)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_reset(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(reset), NULL); + return esp_matter::command::create(cluster, Reset::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_modify_enabled_alarms(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ModifyEnabledAlarms::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_notify(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, Notify::Id); +} + +} /* event */ + +} /* alarm_base */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/alarm_base/alarm_base.h b/components/esp_matter/data_model/generated/clusters/alarm_base/alarm_base.h new file mode 100644 index 000000000..7fe846c46 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/alarm_base/alarm_base.h @@ -0,0 +1,54 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace alarm_base { + +namespace feature { +namespace reset { +typedef struct config { + uint32_t latch; + config() : latch(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* reset */ + +} /* feature */ + +namespace attribute { +attribute_t *create_mask(cluster_t *cluster, uint32_t value); +attribute_t *create_latch(cluster_t *cluster, uint32_t value); +attribute_t *create_state(cluster_t *cluster, uint32_t value); +attribute_t *create_supported(cluster_t *cluster, uint32_t value); +} /* attribute */ + +namespace command { +command_t *create_reset(cluster_t *cluster); +command_t *create_modify_enabled_alarms(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_notify(cluster_t *cluster); +} /* event */ + +} /* alarm_base */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/alarm_base/alarm_base_ids.h b/components/esp_matter/data_model/generated/clusters/alarm_base/alarm_base_ids.h new file mode 100644 index 000000000..15aa3ca1c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/alarm_base/alarm_base_ids.h @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace alarm_base { + +inline constexpr uint32_t Id = 0xffff; + +namespace feature { +namespace Reset { +inline constexpr uint32_t Id = 0x1; +} /* Reset */ +} /* feature */ + +namespace attribute { +namespace Mask { +inline constexpr uint32_t Id = 0x0000; +} /* Mask */ +namespace Latch { +inline constexpr uint32_t Id = 0x0001; +} /* Latch */ +namespace State { +inline constexpr uint32_t Id = 0x0002; +} /* State */ +namespace Supported { +inline constexpr uint32_t Id = 0x0003; +} /* Supported */ +} /* attribute */ + +namespace command { +namespace Reset { +inline constexpr uint32_t Id = 0x00; +} /* Reset */ +namespace ModifyEnabledAlarms { +inline constexpr uint32_t Id = 0x01; +} /* ModifyEnabledAlarms */ +} /* command */ + +namespace event { +namespace Notify { +inline constexpr uint32_t Id = 0x00; +} /* Notify */ +} /* event */ + +} /* alarm_base */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/all_clusters.h b/components/esp_matter/data_model/generated/clusters/all_clusters.h new file mode 100644 index 000000000..f189ec9f6 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/all_clusters.h @@ -0,0 +1,152 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include "access_control.h" +#include "account_login.h" +#include "actions.h" +#include "activated_carbon_filter_monitoring.h" +#include "administrator_commissioning.h" +#include "air_quality.h" +#include "alarm_base.h" +#include "application_basic.h" +#include "application_launcher.h" +#include "audio_output.h" +#include "basic_information.h" +#include "binding.h" +#include "boolean_state.h" +#include "boolean_state_configuration.h" +#include "bridged_device_basic_information.h" +#include "camera_av_settings_user_level_management.h" +#include "camera_av_stream_management.h" +#include "carbon_dioxide_concentration_measurement.h" +#include "carbon_monoxide_concentration_measurement.h" +#include "channel.h" +#include "chime.h" +#include "closure_control.h" +#include "closure_dimension.h" +#include "color_control.h" +#include "commissioner_control.h" +#include "commodity_metering.h" +#include "commodity_price.h" +#include "commodity_tariff.h" +#include "content_app_observer.h" +#include "content_control.h" +#include "content_launcher.h" +#include "descriptor.h" +#include "device_energy_management.h" +#include "device_energy_management_mode.h" +#include "diagnostic_logs.h" +#include "dish_washer_alarm.h" +#include "dish_washer_mode.h" +#include "door_lock.h" +#include "ecosystem_information.h" +#include "electrical_energy_measurement.h" +#include "electrical_grid_conditions.h" +#include "electrical_power_measurement.h" +#include "energy_evse.h" +#include "energy_evse_mode.h" +#include "energy_preference.h" +#include "ethernet_network_diagnostics.h" +#include "fan_control.h" +#include "fixed_label.h" +#include "flow_measurement.h" +#include "formaldehyde_concentration_measurement.h" +#include "general_commissioning.h" +#include "general_diagnostics.h" +#include "group_key_management.h" +#include "groups.h" +#include "hepa_filter_monitoring.h" +#include "icd_management.h" +#include "identify.h" +#include "illuminance_measurement.h" +#include "joint_fabric_administrator.h" +#include "joint_fabric_datastore.h" +#include "keypad_input.h" +#include "label.h" +#include "laundry_dryer_controls.h" +#include "laundry_washer_controls.h" +#include "laundry_washer_mode.h" +#include "level_control.h" +#include "localization_configuration.h" +#include "low_power.h" +#include "media_input.h" +#include "media_playback.h" +#include "messages.h" +#include "meter_identification.h" +#include "microwave_oven_control.h" +#include "microwave_oven_mode.h" +#include "mode_base.h" +#include "mode_select.h" +#include "network_commissioning.h" +#include "nitrogen_dioxide_concentration_measurement.h" +#include "occupancy_sensing.h" +#include "on_off.h" +#include "operational_credentials.h" +#include "operational_state.h" +#include "ota_software_update_provider.h" +#include "ota_software_update_requestor.h" +#include "oven_cavity_operational_state.h" +#include "oven_mode.h" +#include "ozone_concentration_measurement.h" +#include "pm10_concentration_measurement.h" +#include "pm1_concentration_measurement.h" +#include "pm2_5_concentration_measurement.h" +#include "power_source.h" +#include "power_source_configuration.h" +#include "power_topology.h" +#include "pressure_measurement.h" +#include "pump_configuration_and_control.h" +#include "push_av_stream_transport.h" +#include "radon_concentration_measurement.h" +#include "refrigerator_alarm.h" +#include "refrigerator_and_temperature_controlled_cabinet_mode.h" +#include "relative_humidity_measurement.h" +#include "rvc_clean_mode.h" +#include "rvc_operational_state.h" +#include "rvc_run_mode.h" +#include "scenes_management.h" +#include "service_area.h" +#include "smoke_co_alarm.h" +#include "software_diagnostics.h" +#include "soil_measurement.h" +#include "switch_cluster.h" +#include "target_navigator.h" +#include "temperature_control.h" +#include "temperature_measurement.h" +#include "thermostat.h" +#include "thermostat_user_interface_configuration.h" +#include "thread_border_router_management.h" +#include "thread_network_diagnostics.h" +#include "thread_network_directory.h" +#include "time_format_localization.h" +#include "time_synchronization.h" +#include "tls_certificate_management.h" +#include "tls_client_management.h" +#include "total_volatile_organic_compounds_concentration_measurement.h" +#include "unit_localization.h" +#include "user_label.h" +#include "valve_configuration_and_control.h" +#include "wake_on_lan.h" +#include "water_heater_management.h" +#include "water_heater_mode.h" +#include "water_tank_level_monitoring.h" +#include "webrtc_transport_provider.h" +#include "webrtc_transport_requestor.h" +#include "wi_fi_network_diagnostics.h" +#include "wi_fi_network_management.h" +#include "window_covering.h" +#include "zone_management.h" diff --git a/components/esp_matter/data_model/generated/clusters/application_basic/application_basic.cpp b/components/esp_matter/data_model/generated/clusters/application_basic/application_basic.cpp new file mode 100644 index 000000000..c433470cb --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/application_basic/application_basic.cpp @@ -0,0 +1,134 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "application_basic_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace application_basic { + +namespace attribute { +attribute_t *create_vendor_name(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, VendorName::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_char_str(value, length)); +} + +attribute_t *create_vendor_id(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, VendorID::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_application_name(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, ApplicationName::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_char_str(value, length)); +} + +attribute_t *create_product_id(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, ProductID::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_application(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Application::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_status(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, Status::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_application_version(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, ApplicationVersion::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_char_str(value, length)); +} + +attribute_t *create_allowed_vendor_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, AllowedVendorList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, application_basic::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, application_basic::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ApplicationBasicDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterApplicationBasicPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_application_name(cluster, NULL, 0); + attribute::create_application(cluster, NULL, 0, 0); + attribute::create_status(cluster, 0); + attribute::create_application_version(cluster, NULL, 0); + attribute::create_allowed_vendor_list(cluster, NULL, 0, 0); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* application_basic */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/application_basic/application_basic.h b/components/esp_matter/data_model/generated/clusters/application_basic/application_basic.h new file mode 100644 index 000000000..ef4b51b7c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/application_basic/application_basic.h @@ -0,0 +1,44 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace application_basic { + +namespace attribute { +attribute_t *create_vendor_name(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_vendor_id(cluster_t *cluster, uint16_t value); +attribute_t *create_application_name(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_product_id(cluster_t *cluster, uint16_t value); +attribute_t *create_application(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_status(cluster_t *cluster, uint8_t value); +attribute_t *create_application_version(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_allowed_vendor_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* application_basic */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/application_basic/application_basic_ids.h b/components/esp_matter/data_model/generated/clusters/application_basic/application_basic_ids.h new file mode 100644 index 000000000..31d5b8a65 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/application_basic/application_basic_ids.h @@ -0,0 +1,55 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace application_basic { + +inline constexpr uint32_t Id = 0x050D; + +namespace attribute { +namespace VendorName { +inline constexpr uint32_t Id = 0x0000; +} /* VendorName */ +namespace VendorID { +inline constexpr uint32_t Id = 0x0001; +} /* VendorID */ +namespace ApplicationName { +inline constexpr uint32_t Id = 0x0002; +} /* ApplicationName */ +namespace ProductID { +inline constexpr uint32_t Id = 0x0003; +} /* ProductID */ +namespace Application { +inline constexpr uint32_t Id = 0x0004; +} /* Application */ +namespace Status { +inline constexpr uint32_t Id = 0x0005; +} /* Status */ +namespace ApplicationVersion { +inline constexpr uint32_t Id = 0x0006; +} /* ApplicationVersion */ +namespace AllowedVendorList { +inline constexpr uint32_t Id = 0x0007; +} /* AllowedVendorList */ +} /* attribute */ + +} /* application_basic */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/application_launcher/application_launcher.cpp b/components/esp_matter/data_model/generated/clusters/application_launcher/application_launcher.cpp new file mode 100644 index 000000000..4033cdf4a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/application_launcher/application_launcher.cpp @@ -0,0 +1,179 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "application_launcher_cluster"; +constexpr uint16_t cluster_revision = 2; + +static esp_err_t esp_matter_command_callback_launch_app(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfApplicationLauncherClusterLaunchAppCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_stop_app(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ApplicationLauncher::Commands::StopApp::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfApplicationLauncherClusterStopAppCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_hide_app(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ApplicationLauncher::Commands::HideApp::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfApplicationLauncherClusterHideAppCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace application_launcher { + +namespace feature { +namespace application_platform { +uint32_t get_id() +{ + return ApplicationPlatform::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_catalog_list(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* application_platform */ + +} /* feature */ + +namespace attribute { +attribute_t *create_catalog_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(application_platform), NULL); + return esp_matter::attribute::create(cluster, CatalogList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_app(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CurrentApp::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_launch_app(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, LaunchApp::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_launch_app); +} + +command_t *create_stop_app(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, StopApp::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_stop_app); +} + +command_t *create_hide_app(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, HideApp::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_hide_app); +} + +command_t *create_launcher_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, LauncherResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, application_launcher::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, application_launcher::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ApplicationLauncherDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterApplicationLauncherPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_launch_app(cluster); + command::create_stop_app(cluster); + command::create_hide_app(cluster); + command::create_launcher_response(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* application_launcher */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/application_launcher/application_launcher.h b/components/esp_matter/data_model/generated/clusters/application_launcher/application_launcher.h new file mode 100644 index 000000000..6750c3c55 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/application_launcher/application_launcher.h @@ -0,0 +1,53 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace application_launcher { + +namespace feature { +namespace application_platform { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* application_platform */ + +} /* feature */ + +namespace attribute { +attribute_t *create_catalog_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_app(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_launch_app(cluster_t *cluster); +command_t *create_stop_app(cluster_t *cluster); +command_t *create_hide_app(cluster_t *cluster); +command_t *create_launcher_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* application_launcher */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/application_launcher/application_launcher_ids.h b/components/esp_matter/data_model/generated/clusters/application_launcher/application_launcher_ids.h new file mode 100644 index 000000000..9adaae49a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/application_launcher/application_launcher_ids.h @@ -0,0 +1,58 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace application_launcher { + +inline constexpr uint32_t Id = 0x050C; + +namespace feature { +namespace ApplicationPlatform { +inline constexpr uint32_t Id = 0x1; +} /* ApplicationPlatform */ +} /* feature */ + +namespace attribute { +namespace CatalogList { +inline constexpr uint32_t Id = 0x0000; +} /* CatalogList */ +namespace CurrentApp { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentApp */ +} /* attribute */ + +namespace command { +namespace LaunchApp { +inline constexpr uint32_t Id = 0x00; +} /* LaunchApp */ +namespace StopApp { +inline constexpr uint32_t Id = 0x01; +} /* StopApp */ +namespace HideApp { +inline constexpr uint32_t Id = 0x02; +} /* HideApp */ +namespace LauncherResponse { +inline constexpr uint32_t Id = 0x03; +} /* LauncherResponse */ +} /* command */ + +} /* application_launcher */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/audio_output/audio_output.cpp b/components/esp_matter/data_model/generated/clusters/audio_output/audio_output.cpp new file mode 100644 index 000000000..4a0913d1d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/audio_output/audio_output.cpp @@ -0,0 +1,157 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "audio_output_cluster"; +constexpr uint16_t cluster_revision = 1; + +static esp_err_t esp_matter_command_callback_select_output(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::AudioOutput::Commands::SelectOutput::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfAudioOutputClusterSelectOutputCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_rename_output(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::AudioOutput::Commands::RenameOutput::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfAudioOutputClusterRenameOutputCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace audio_output { + +namespace feature { +namespace name_updates { +uint32_t get_id() +{ + return NameUpdates::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_rename_output(cluster); + + return ESP_OK; +} +} /* name_updates */ + +} /* feature */ + +namespace attribute { +attribute_t *create_output_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, OutputList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_output(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, CurrentOutput::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +} /* attribute */ +namespace command { +command_t *create_select_output(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SelectOutput::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_select_output); +} + +command_t *create_rename_output(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(name_updates), NULL); + return esp_matter::command::create(cluster, RenameOutput::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_rename_output); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, audio_output::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, audio_output::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = AudioOutputDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterAudioOutputPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_output_list(cluster, NULL, 0, 0); + attribute::create_current_output(cluster, 0); + command::create_select_output(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* audio_output */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/audio_output/audio_output.h b/components/esp_matter/data_model/generated/clusters/audio_output/audio_output.h new file mode 100644 index 000000000..cd5045aa2 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/audio_output/audio_output.h @@ -0,0 +1,51 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace audio_output { + +namespace feature { +namespace name_updates { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* name_updates */ + +} /* feature */ + +namespace attribute { +attribute_t *create_output_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_output(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_select_output(cluster_t *cluster); +command_t *create_rename_output(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* audio_output */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/audio_output/audio_output_ids.h b/components/esp_matter/data_model/generated/clusters/audio_output/audio_output_ids.h new file mode 100644 index 000000000..05dde3fd7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/audio_output/audio_output_ids.h @@ -0,0 +1,52 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace audio_output { + +inline constexpr uint32_t Id = 0x050B; + +namespace feature { +namespace NameUpdates { +inline constexpr uint32_t Id = 0x1; +} /* NameUpdates */ +} /* feature */ + +namespace attribute { +namespace OutputList { +inline constexpr uint32_t Id = 0x0000; +} /* OutputList */ +namespace CurrentOutput { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentOutput */ +} /* attribute */ + +namespace command { +namespace SelectOutput { +inline constexpr uint32_t Id = 0x00; +} /* SelectOutput */ +namespace RenameOutput { +inline constexpr uint32_t Id = 0x01; +} /* RenameOutput */ +} /* command */ + +} /* audio_output */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/basic_information/basic_information.cpp b/components/esp_matter/data_model/generated/clusters/basic_information/basic_information.cpp new file mode 100644 index 000000000..b0d514c55 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/basic_information/basic_information.cpp @@ -0,0 +1,256 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "basic_information_cluster"; +constexpr uint16_t cluster_revision = 5; + +namespace esp_matter { +namespace cluster { +namespace basic_information { + +namespace attribute { +attribute_t *create_data_model_revision(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, DataModelRevision::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_vendor_name(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_vendor_name_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, VendorName::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_vendor_name_length + 1); +} + +attribute_t *create_vendor_id(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, VendorID::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_product_name(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_product_name_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, ProductName::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_product_name_length + 1); +} + +attribute_t *create_product_id(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ProductID::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_node_label(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_node_label_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, NodeLabel::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_char_str(value, length), k_max_node_label_length + 1); +} + +attribute_t *create_location(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, Location::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_char_str(value, length), k_max_location_length + 1); +} + +attribute_t *create_hardware_version(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, HardwareVersion::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_hardware_version_string(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, HardwareVersionString::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_hardware_version_string_length + 1); +} + +attribute_t *create_software_version(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SoftwareVersion::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +attribute_t *create_software_version_string(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, SoftwareVersionString::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_software_version_string_length + 1); +} + +attribute_t *create_manufacturing_date(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, ManufacturingDate::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_manufacturing_date_length + 1); +} + +attribute_t *create_part_number(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_part_number_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, PartNumber::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_part_number_length + 1); +} + +attribute_t *create_product_url(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_product_url_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, ProductURL::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_product_url_length + 1); +} + +attribute_t *create_product_label(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_product_label_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, ProductLabel::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_product_label_length + 1); +} + +attribute_t *create_serial_number(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_serial_number_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, SerialNumber::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_serial_number_length + 1); +} + +attribute_t *create_local_config_disabled(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, LocalConfigDisabled::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_reachable(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, Reachable::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_unique_id(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_unique_id_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, UniqueID::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_unique_id_length + 1); +} + +attribute_t *create_capability_minima(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CapabilityMinima::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_product_appearance(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ProductAppearance::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_specification_version(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SpecificationVersion::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +attribute_t *create_max_paths_per_invoke(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxPathsPerInvoke::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(1), esp_matter_uint16(65534)); + return attribute; +} + +} /* attribute */ + +namespace event { +event_t *create_start_up(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, StartUp::Id); +} + +event_t *create_shut_down(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, ShutDown::Id); +} + +event_t *create_leave(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, Leave::Id); +} + +event_t *create_reachable_changed(cluster_t *cluster) +{ + VerifyOrReturnValue(has_attribute(Reachable), NULL); + return esp_matter::event::create(cluster, ReachableChanged::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, basic_information::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, basic_information::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterBasicInformationPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_data_model_revision(cluster, config->data_model_revision); + attribute::create_vendor_name(cluster, config->vendor_name, sizeof(config->vendor_name)); + attribute::create_vendor_id(cluster, config->vendor_id); + attribute::create_product_name(cluster, config->product_name, sizeof(config->product_name)); + attribute::create_product_id(cluster, config->product_id); + attribute::create_node_label(cluster, config->node_label, sizeof(config->node_label)); + attribute::create_location(cluster, config->location, sizeof(config->location)); + attribute::create_hardware_version(cluster, config->hardware_version); + attribute::create_hardware_version_string(cluster, config->hardware_version_string, sizeof(config->hardware_version_string)); + attribute::create_software_version(cluster, config->software_version); + attribute::create_software_version_string(cluster, config->software_version_string, sizeof(config->software_version_string)); + attribute::create_unique_id(cluster, config->unique_id, sizeof(config->unique_id)); + attribute::create_specification_version(cluster, config->specification_version); + attribute::create_max_paths_per_invoke(cluster, config->max_paths_per_invoke); + attribute::create_capability_minima(cluster, NULL, 0, 0); + /* Events */ + event::create_start_up(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterBasicInformationClusterServerInitCallback, + ESPMatterBasicInformationClusterServerShutdownCallback); + } + + return cluster; +} + +} /* basic_information */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/basic_information/basic_information.h b/components/esp_matter/data_model/generated/clusters/basic_information/basic_information.h new file mode 100644 index 000000000..db6c364d8 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/basic_information/basic_information.h @@ -0,0 +1,91 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace basic_information { + +const uint8_t k_max_vendor_name_length = 32u; +const uint8_t k_max_product_name_length = 32u; +const uint8_t k_max_node_label_length = 32u; +const uint8_t k_max_location_length = 2u; +const uint8_t k_max_hardware_version_string_length = 64u; +const uint8_t k_max_software_version_string_length = 64u; +const uint8_t k_max_manufacturing_date_length = 16u; +const uint8_t k_max_part_number_length = 32u; +const uint16_t k_max_product_url_length = 256u; +const uint8_t k_max_product_label_length = 64u; +const uint8_t k_max_serial_number_length = 32u; +const uint8_t k_max_unique_id_length = 32u; +namespace attribute { +attribute_t *create_data_model_revision(cluster_t *cluster, uint16_t value); +attribute_t *create_vendor_name(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_vendor_id(cluster_t *cluster, uint16_t value); +attribute_t *create_product_name(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_product_id(cluster_t *cluster, uint16_t value); +attribute_t *create_node_label(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_location(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_hardware_version(cluster_t *cluster, uint16_t value); +attribute_t *create_hardware_version_string(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_software_version(cluster_t *cluster, uint32_t value); +attribute_t *create_software_version_string(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_manufacturing_date(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_part_number(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_product_url(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_product_label(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_serial_number(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_local_config_disabled(cluster_t *cluster, bool value); +attribute_t *create_reachable(cluster_t *cluster, bool value); +attribute_t *create_unique_id(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_capability_minima(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_product_appearance(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_specification_version(cluster_t *cluster, uint32_t value); +attribute_t *create_max_paths_per_invoke(cluster_t *cluster, uint16_t value); +} /* attribute */ + +namespace event { +event_t *create_start_up(cluster_t *cluster); +event_t *create_shut_down(cluster_t *cluster); +event_t *create_leave(cluster_t *cluster); +event_t *create_reachable_changed(cluster_t *cluster); +} /* event */ + +typedef struct config { + uint16_t data_model_revision; + char vendor_name[k_max_vendor_name_length + 1]; + uint16_t vendor_id; + char product_name[k_max_product_name_length + 1]; + uint16_t product_id; + char node_label[k_max_node_label_length + 1]; + char location[k_max_location_length + 1]; + uint16_t hardware_version; + char hardware_version_string[k_max_hardware_version_string_length + 1]; + uint32_t software_version; + char software_version_string[k_max_software_version_string_length + 1]; + char unique_id[k_max_unique_id_length + 1]; + uint32_t specification_version; + uint16_t max_paths_per_invoke; + config() : data_model_revision(0), vendor_name{0}, vendor_id(0), product_name{0}, product_id(0), node_label{0}, location{0}, hardware_version(0), hardware_version_string{0}, software_version(0), software_version_string{0}, unique_id{0}, specification_version(0), max_paths_per_invoke(1) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* basic_information */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/basic_information/basic_information_ids.h b/components/esp_matter/data_model/generated/clusters/basic_information/basic_information_ids.h new file mode 100644 index 000000000..de7d5ef03 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/basic_information/basic_information_ids.h @@ -0,0 +1,115 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace basic_information { + +inline constexpr uint32_t Id = 0x0028; + +namespace attribute { +namespace DataModelRevision { +inline constexpr uint32_t Id = 0x0000; +} /* DataModelRevision */ +namespace VendorName { +inline constexpr uint32_t Id = 0x0001; +} /* VendorName */ +namespace VendorID { +inline constexpr uint32_t Id = 0x0002; +} /* VendorID */ +namespace ProductName { +inline constexpr uint32_t Id = 0x0003; +} /* ProductName */ +namespace ProductID { +inline constexpr uint32_t Id = 0x0004; +} /* ProductID */ +namespace NodeLabel { +inline constexpr uint32_t Id = 0x0005; +} /* NodeLabel */ +namespace Location { +inline constexpr uint32_t Id = 0x0006; +} /* Location */ +namespace HardwareVersion { +inline constexpr uint32_t Id = 0x0007; +} /* HardwareVersion */ +namespace HardwareVersionString { +inline constexpr uint32_t Id = 0x0008; +} /* HardwareVersionString */ +namespace SoftwareVersion { +inline constexpr uint32_t Id = 0x0009; +} /* SoftwareVersion */ +namespace SoftwareVersionString { +inline constexpr uint32_t Id = 0x000A; +} /* SoftwareVersionString */ +namespace ManufacturingDate { +inline constexpr uint32_t Id = 0x000B; +} /* ManufacturingDate */ +namespace PartNumber { +inline constexpr uint32_t Id = 0x000C; +} /* PartNumber */ +namespace ProductURL { +inline constexpr uint32_t Id = 0x000D; +} /* ProductURL */ +namespace ProductLabel { +inline constexpr uint32_t Id = 0x000E; +} /* ProductLabel */ +namespace SerialNumber { +inline constexpr uint32_t Id = 0x000F; +} /* SerialNumber */ +namespace LocalConfigDisabled { +inline constexpr uint32_t Id = 0x0010; +} /* LocalConfigDisabled */ +namespace Reachable { +inline constexpr uint32_t Id = 0x0011; +} /* Reachable */ +namespace UniqueID { +inline constexpr uint32_t Id = 0x0012; +} /* UniqueID */ +namespace CapabilityMinima { +inline constexpr uint32_t Id = 0x0013; +} /* CapabilityMinima */ +namespace ProductAppearance { +inline constexpr uint32_t Id = 0x0014; +} /* ProductAppearance */ +namespace SpecificationVersion { +inline constexpr uint32_t Id = 0x0015; +} /* SpecificationVersion */ +namespace MaxPathsPerInvoke { +inline constexpr uint32_t Id = 0x0016; +} /* MaxPathsPerInvoke */ +} /* attribute */ + +namespace event { +namespace StartUp { +inline constexpr uint32_t Id = 0x00; +} /* StartUp */ +namespace ShutDown { +inline constexpr uint32_t Id = 0x01; +} /* ShutDown */ +namespace Leave { +inline constexpr uint32_t Id = 0x02; +} /* Leave */ +namespace ReachableChanged { +inline constexpr uint32_t Id = 0x03; +} /* ReachableChanged */ +} /* event */ + +} /* basic_information */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/binding/binding.cpp b/components/esp_matter/data_model/generated/clusters/binding/binding.cpp new file mode 100644 index 000000000..336fecfef --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/binding/binding.cpp @@ -0,0 +1,84 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "binding_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace binding { + +namespace attribute { +attribute_t *create_binding(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Binding::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, binding::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, binding::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterBindingPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_binding(cluster, NULL, 0, 0); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterBindingClusterServerInitCallback, + ESPMatterBindingClusterServerShutdownCallback); + } + + return cluster; +} + +} /* binding */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/binding/binding.h b/components/esp_matter/data_model/generated/clusters/binding/binding.h new file mode 100644 index 000000000..4dcddda9a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/binding/binding.h @@ -0,0 +1,36 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace binding { + +namespace attribute { +attribute_t *create_binding(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* binding */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/binding/binding_ids.h b/components/esp_matter/data_model/generated/clusters/binding/binding_ids.h new file mode 100644 index 000000000..097128622 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/binding/binding_ids.h @@ -0,0 +1,34 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace binding { + +inline constexpr uint32_t Id = 0x001E; + +namespace attribute { +namespace Binding { +inline constexpr uint32_t Id = 0x0000; +} /* Binding */ +} /* attribute */ + +} /* binding */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/boolean_state/boolean_state.cpp b/components/esp_matter/data_model/generated/clusters/boolean_state/boolean_state.cpp new file mode 100644 index 000000000..2ee4779ca --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/boolean_state/boolean_state.cpp @@ -0,0 +1,99 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "boolean_state_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace boolean_state { + +namespace attribute { +attribute_t *create_state_value(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, StateValue::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +} /* attribute */ + +namespace event { +event_t *create_state_change(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, StateChange::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, boolean_state::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, boolean_state::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_state_value(cluster, config->state_value); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterBooleanStateClusterServerInitCallback, + ESPMatterBooleanStateClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* boolean_state */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/boolean_state/boolean_state.h b/components/esp_matter/data_model/generated/clusters/boolean_state/boolean_state.h new file mode 100644 index 000000000..c2d06242c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/boolean_state/boolean_state.h @@ -0,0 +1,41 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace boolean_state { + +namespace attribute { +attribute_t *create_state_value(cluster_t *cluster, bool value); +} /* attribute */ + +namespace event { +event_t *create_state_change(cluster_t *cluster); +} /* event */ + +typedef struct config { + bool state_value; + config() : state_value(false) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* boolean_state */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/boolean_state/boolean_state_ids.h b/components/esp_matter/data_model/generated/clusters/boolean_state/boolean_state_ids.h new file mode 100644 index 000000000..9dbd619e8 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/boolean_state/boolean_state_ids.h @@ -0,0 +1,40 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace boolean_state { + +inline constexpr uint32_t Id = 0x0045; + +namespace attribute { +namespace StateValue { +inline constexpr uint32_t Id = 0x0000; +} /* StateValue */ +} /* attribute */ + +namespace event { +namespace StateChange { +inline constexpr uint32_t Id = 0x00; +} /* StateChange */ +} /* event */ + +} /* boolean_state */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/boolean_state_configuration/boolean_state_configuration.cpp b/components/esp_matter/data_model/generated/clusters/boolean_state_configuration/boolean_state_configuration.cpp new file mode 100644 index 000000000..dc287d879 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/boolean_state_configuration/boolean_state_configuration.cpp @@ -0,0 +1,270 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "boolean_state_configuration_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace boolean_state_configuration { + +namespace feature { +namespace visual { +uint32_t get_id() +{ + return Visual::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_alarms_active(cluster, config->alarms_active); + attribute::create_alarms_supported(cluster, config->alarms_supported); + command::create_enable_disable_alarm(cluster); + event::create_alarms_state_changed(cluster); + + return ESP_OK; +} +} /* visual */ + +namespace audible { +uint32_t get_id() +{ + return Audible::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_alarms_active(cluster, config->alarms_active); + attribute::create_alarms_supported(cluster, config->alarms_supported); + command::create_enable_disable_alarm(cluster); + event::create_alarms_state_changed(cluster); + + return ESP_OK; +} +} /* audible */ + +namespace alarm_suppress { +uint32_t get_id() +{ + return AlarmSuppress::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(((has_feature(visual)) || (has_feature(audible))), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_alarms_suppressed(cluster, config->alarms_suppressed); + command::create_suppress_alarm(cluster); + + return ESP_OK; +} +} /* alarm_suppress */ + +namespace sensitivity_level { +uint32_t get_id() +{ + return SensitivityLevel::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_current_sensitivity_level(cluster, config->current_sensitivity_level); + attribute::create_supported_sensitivity_levels(cluster, config->supported_sensitivity_levels); + + return ESP_OK; +} +} /* sensitivity_level */ + +} /* feature */ + +namespace attribute { +attribute_t *create_current_sensitivity_level(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(sensitivity_level), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentSensitivityLevel::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_supported_sensitivity_levels(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(sensitivity_level), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, SupportedSensitivityLevels::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(2), esp_matter_uint8(10)); + return attribute; +} + +attribute_t *create_default_sensitivity_level(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, DefaultSensitivityLevel::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_alarms_active(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(visual)) || (has_feature(audible))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, AlarmsActive::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(3)); + return attribute; +} + +attribute_t *create_alarms_suppressed(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(alarm_suppress), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, AlarmsSuppressed::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(3)); + return attribute; +} + +attribute_t *create_alarms_enabled(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, AlarmsEnabled::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(3)); + return attribute; +} + +attribute_t *create_alarms_supported(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(visual)) || (has_feature(audible))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, AlarmsSupported::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(3)); + return attribute; +} + +attribute_t *create_sensor_fault(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SensorFault::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(1)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_suppress_alarm(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(alarm_suppress), NULL); + return esp_matter::command::create(cluster, SuppressAlarm::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_enable_disable_alarm(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(visual)) || (has_feature(audible))), NULL); + return esp_matter::command::create(cluster, EnableDisableAlarm::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_alarms_state_changed(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(visual)) || (has_feature(audible))), NULL); + return esp_matter::event::create(cluster, AlarmsStateChanged::Id); +} + +event_t *create_sensor_fault(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, SensorFault::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, boolean_state_configuration::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, boolean_state_configuration::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = BooleanStateConfigurationDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterBooleanStateConfigurationPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterBooleanStateConfigurationClusterServerInitCallback, + ESPMatterBooleanStateConfigurationClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* boolean_state_configuration */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/boolean_state_configuration/boolean_state_configuration.h b/components/esp_matter/data_model/generated/clusters/boolean_state_configuration/boolean_state_configuration.h new file mode 100644 index 000000000..7e40150a8 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/boolean_state_configuration/boolean_state_configuration.h @@ -0,0 +1,96 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace boolean_state_configuration { + +namespace feature { +namespace visual { +typedef struct config { + uint8_t alarms_active; + uint8_t alarms_supported; + config() : alarms_active(0), alarms_supported(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* visual */ + +namespace audible { +typedef struct config { + uint8_t alarms_active; + uint8_t alarms_supported; + config() : alarms_active(0), alarms_supported(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* audible */ + +namespace alarm_suppress { +typedef struct config { + uint8_t alarms_suppressed; + config() : alarms_suppressed(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* alarm_suppress */ + +namespace sensitivity_level { +typedef struct config { + uint8_t current_sensitivity_level; + uint8_t supported_sensitivity_levels; + config() : current_sensitivity_level(0), supported_sensitivity_levels(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* sensitivity_level */ + +} /* feature */ + +namespace attribute { +attribute_t *create_current_sensitivity_level(cluster_t *cluster, uint8_t value); +attribute_t *create_supported_sensitivity_levels(cluster_t *cluster, uint8_t value); +attribute_t *create_default_sensitivity_level(cluster_t *cluster, uint8_t value); +attribute_t *create_alarms_active(cluster_t *cluster, uint8_t value); +attribute_t *create_alarms_suppressed(cluster_t *cluster, uint8_t value); +attribute_t *create_alarms_enabled(cluster_t *cluster, uint8_t value); +attribute_t *create_alarms_supported(cluster_t *cluster, uint8_t value); +attribute_t *create_sensor_fault(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_suppress_alarm(cluster_t *cluster); +command_t *create_enable_disable_alarm(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_alarms_state_changed(cluster_t *cluster); +event_t *create_sensor_fault(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* boolean_state_configuration */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/boolean_state_configuration/boolean_state_configuration_ids.h b/components/esp_matter/data_model/generated/clusters/boolean_state_configuration/boolean_state_configuration_ids.h new file mode 100644 index 000000000..7f6768d22 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/boolean_state_configuration/boolean_state_configuration_ids.h @@ -0,0 +1,88 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace boolean_state_configuration { + +inline constexpr uint32_t Id = 0x0080; + +namespace feature { +namespace Visual { +inline constexpr uint32_t Id = 0x1; +} /* Visual */ +namespace Audible { +inline constexpr uint32_t Id = 0x2; +} /* Audible */ +namespace AlarmSuppress { +inline constexpr uint32_t Id = 0x4; +} /* AlarmSuppress */ +namespace SensitivityLevel { +inline constexpr uint32_t Id = 0x8; +} /* SensitivityLevel */ +} /* feature */ + +namespace attribute { +namespace CurrentSensitivityLevel { +inline constexpr uint32_t Id = 0x0000; +} /* CurrentSensitivityLevel */ +namespace SupportedSensitivityLevels { +inline constexpr uint32_t Id = 0x0001; +} /* SupportedSensitivityLevels */ +namespace DefaultSensitivityLevel { +inline constexpr uint32_t Id = 0x0002; +} /* DefaultSensitivityLevel */ +namespace AlarmsActive { +inline constexpr uint32_t Id = 0x0003; +} /* AlarmsActive */ +namespace AlarmsSuppressed { +inline constexpr uint32_t Id = 0x0004; +} /* AlarmsSuppressed */ +namespace AlarmsEnabled { +inline constexpr uint32_t Id = 0x0005; +} /* AlarmsEnabled */ +namespace AlarmsSupported { +inline constexpr uint32_t Id = 0x0006; +} /* AlarmsSupported */ +namespace SensorFault { +inline constexpr uint32_t Id = 0x0007; +} /* SensorFault */ +} /* attribute */ + +namespace command { +namespace SuppressAlarm { +inline constexpr uint32_t Id = 0x00; +} /* SuppressAlarm */ +namespace EnableDisableAlarm { +inline constexpr uint32_t Id = 0x01; +} /* EnableDisableAlarm */ +} /* command */ + +namespace event { +namespace AlarmsStateChanged { +inline constexpr uint32_t Id = 0x00; +} /* AlarmsStateChanged */ +namespace SensorFault { +inline constexpr uint32_t Id = 0x01; +} /* SensorFault */ +} /* event */ + +} /* boolean_state_configuration */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/bridged_device_basic_information/bridged_device_basic_information.cpp b/components/esp_matter/data_model/generated/clusters/bridged_device_basic_information/bridged_device_basic_information.cpp new file mode 100644 index 000000000..8f7962268 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/bridged_device_basic_information/bridged_device_basic_information.cpp @@ -0,0 +1,240 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "bridged_device_basic_information_cluster"; +constexpr uint16_t cluster_revision = 5; + +namespace esp_matter { +namespace cluster { +namespace bridged_device_basic_information { + +namespace feature { +namespace bridged_icd_support { +uint32_t get_id() +{ + return BridgedICDSupport::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_keep_active(cluster); + event::create_active_changed(cluster); + + return ESP_OK; +} +} /* bridged_icd_support */ + +} /* feature */ + +namespace attribute { +attribute_t *create_vendor_name(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_vendor_name_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, VendorName::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_vendor_name_length + 1); +} + +attribute_t *create_vendor_id(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, VendorID::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_product_name(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_product_name_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, ProductName::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_product_name_length + 1); +} + +attribute_t *create_product_id(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ProductID::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_node_label(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_node_label_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, NodeLabel::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_char_str(value, length), k_max_node_label_length + 1); +} + +attribute_t *create_hardware_version(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, HardwareVersion::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_hardware_version_string(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, HardwareVersionString::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_hardware_version_string_length + 1); +} + +attribute_t *create_software_version(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SoftwareVersion::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +attribute_t *create_software_version_string(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, SoftwareVersionString::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_software_version_string_length + 1); +} + +attribute_t *create_manufacturing_date(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, ManufacturingDate::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_manufacturing_date_length + 1); +} + +attribute_t *create_part_number(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_part_number_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, PartNumber::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_part_number_length + 1); +} + +attribute_t *create_product_url(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_product_url_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, ProductURL::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_product_url_length + 1); +} + +attribute_t *create_product_label(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_product_label_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, ProductLabel::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_product_label_length + 1); +} + +attribute_t *create_serial_number(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_serial_number_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, SerialNumber::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_serial_number_length + 1); +} + +attribute_t *create_reachable(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, Reachable::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_unique_id(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_unique_id_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, UniqueID::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_unique_id_length + 1); +} + +attribute_t *create_product_appearance(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ProductAppearance::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_keep_active(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(bridged_icd_support), NULL); + return esp_matter::command::create(cluster, KeepActive::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_start_up(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, StartUp::Id); +} + +event_t *create_shut_down(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, ShutDown::Id); +} + +event_t *create_leave(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, Leave::Id); +} + +event_t *create_reachable_changed(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, ReachableChanged::Id); +} + +event_t *create_active_changed(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(bridged_icd_support), NULL); + return esp_matter::event::create(cluster, ActiveChanged::Id); +} + +} /* event */ + +const function_generic_t function_list[] = { + (function_generic_t)MatterBridgedDeviceBasicInformationClusterServerAttributeChangedCallback, +}; + +const int function_flags = CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, bridged_device_basic_information::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, bridged_device_basic_information::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterBridgedDeviceBasicInformationPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_reachable(cluster, config->reachable); + attribute::create_unique_id(cluster, config->unique_id, sizeof(config->unique_id)); + /* Events */ + event::create_reachable_changed(cluster); + } + + return cluster; +} + +} /* bridged_device_basic_information */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/bridged_device_basic_information/bridged_device_basic_information.h b/components/esp_matter/data_model/generated/clusters/bridged_device_basic_information/bridged_device_basic_information.h new file mode 100644 index 000000000..b487f4486 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/bridged_device_basic_information/bridged_device_basic_information.h @@ -0,0 +1,85 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace bridged_device_basic_information { + +const uint8_t k_max_vendor_name_length = 32u; +const uint8_t k_max_product_name_length = 32u; +const uint8_t k_max_node_label_length = 32u; +const uint8_t k_max_hardware_version_string_length = 64u; +const uint8_t k_max_software_version_string_length = 64u; +const uint8_t k_max_manufacturing_date_length = 16u; +const uint8_t k_max_part_number_length = 32u; +const uint16_t k_max_product_url_length = 256u; +const uint8_t k_max_product_label_length = 64u; +const uint8_t k_max_serial_number_length = 32u; +const uint8_t k_max_unique_id_length = 32u; +namespace feature { +namespace bridged_icd_support { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* bridged_icd_support */ + +} /* feature */ + +namespace attribute { +attribute_t *create_vendor_name(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_vendor_id(cluster_t *cluster, uint16_t value); +attribute_t *create_product_name(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_product_id(cluster_t *cluster, uint16_t value); +attribute_t *create_node_label(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_hardware_version(cluster_t *cluster, uint16_t value); +attribute_t *create_hardware_version_string(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_software_version(cluster_t *cluster, uint32_t value); +attribute_t *create_software_version_string(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_manufacturing_date(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_part_number(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_product_url(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_product_label(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_serial_number(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_reachable(cluster_t *cluster, bool value); +attribute_t *create_unique_id(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_product_appearance(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_keep_active(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_start_up(cluster_t *cluster); +event_t *create_shut_down(cluster_t *cluster); +event_t *create_leave(cluster_t *cluster); +event_t *create_reachable_changed(cluster_t *cluster); +event_t *create_active_changed(cluster_t *cluster); +} /* event */ + +typedef struct config { + bool reachable; + char unique_id[k_max_unique_id_length + 1]; + config() : reachable(true), unique_id{0} {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* bridged_device_basic_information */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/bridged_device_basic_information/bridged_device_basic_information_ids.h b/components/esp_matter/data_model/generated/clusters/bridged_device_basic_information/bridged_device_basic_information_ids.h new file mode 100644 index 000000000..0ea931eab --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/bridged_device_basic_information/bridged_device_basic_information_ids.h @@ -0,0 +1,112 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace bridged_device_basic_information { + +inline constexpr uint32_t Id = 0x0039; + +namespace feature { +namespace BridgedICDSupport { +inline constexpr uint32_t Id = 0x100000; +} /* BridgedICDSupport */ +} /* feature */ + +namespace attribute { +namespace VendorName { +inline constexpr uint32_t Id = 0x0001; +} /* VendorName */ +namespace VendorID { +inline constexpr uint32_t Id = 0x0002; +} /* VendorID */ +namespace ProductName { +inline constexpr uint32_t Id = 0x0003; +} /* ProductName */ +namespace ProductID { +inline constexpr uint32_t Id = 0x0004; +} /* ProductID */ +namespace NodeLabel { +inline constexpr uint32_t Id = 0x0005; +} /* NodeLabel */ +namespace HardwareVersion { +inline constexpr uint32_t Id = 0x0007; +} /* HardwareVersion */ +namespace HardwareVersionString { +inline constexpr uint32_t Id = 0x0008; +} /* HardwareVersionString */ +namespace SoftwareVersion { +inline constexpr uint32_t Id = 0x0009; +} /* SoftwareVersion */ +namespace SoftwareVersionString { +inline constexpr uint32_t Id = 0x000A; +} /* SoftwareVersionString */ +namespace ManufacturingDate { +inline constexpr uint32_t Id = 0x000B; +} /* ManufacturingDate */ +namespace PartNumber { +inline constexpr uint32_t Id = 0x000C; +} /* PartNumber */ +namespace ProductURL { +inline constexpr uint32_t Id = 0x000D; +} /* ProductURL */ +namespace ProductLabel { +inline constexpr uint32_t Id = 0x000E; +} /* ProductLabel */ +namespace SerialNumber { +inline constexpr uint32_t Id = 0x000F; +} /* SerialNumber */ +namespace Reachable { +inline constexpr uint32_t Id = 0x0011; +} /* Reachable */ +namespace UniqueID { +inline constexpr uint32_t Id = 0x0012; +} /* UniqueID */ +namespace ProductAppearance { +inline constexpr uint32_t Id = 0x0014; +} /* ProductAppearance */ +} /* attribute */ + +namespace command { +namespace KeepActive { +inline constexpr uint32_t Id = 0x80; +} /* KeepActive */ +} /* command */ + +namespace event { +namespace StartUp { +inline constexpr uint32_t Id = 0x00; +} /* StartUp */ +namespace ShutDown { +inline constexpr uint32_t Id = 0x01; +} /* ShutDown */ +namespace Leave { +inline constexpr uint32_t Id = 0x02; +} /* Leave */ +namespace ReachableChanged { +inline constexpr uint32_t Id = 0x03; +} /* ReachableChanged */ +namespace ActiveChanged { +inline constexpr uint32_t Id = 0x80; +} /* ActiveChanged */ +} /* event */ + +} /* bridged_device_basic_information */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/camera_av_settings_user_level_management/camera_av_settings_user_level_management.cpp b/components/esp_matter/data_model/generated/clusters/camera_av_settings_user_level_management/camera_av_settings_user_level_management.cpp new file mode 100644 index 000000000..4eec64736 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/camera_av_settings_user_level_management/camera_av_settings_user_level_management.cpp @@ -0,0 +1,324 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "camera_av_settings_user_level_management_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace camera_av_settings_user_level_management { + +namespace feature { +namespace digital_ptz { +uint32_t get_id() +{ + return DigitalPTZ::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_dptz_streams(cluster, NULL, 0, 0); + command::create_dptz_set_viewport(cluster); + + return ESP_OK; +} +} /* digital_ptz */ + +namespace mechanical_pan { +uint32_t get_id() +{ + return MechanicalPan::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_mptz_position(cluster, NULL, 0, 0); + attribute::create_pan_min(cluster, 0); + attribute::create_pan_max(cluster, 0); + attribute::create_movement_state(cluster, 0); + command::create_mptz_set_position(cluster); + command::create_mptz_relative_move(cluster); + + return ESP_OK; +} +} /* mechanical_pan */ + +namespace mechanical_tilt { +uint32_t get_id() +{ + return MechanicalTilt::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_mptz_position(cluster, NULL, 0, 0); + attribute::create_tilt_min(cluster, 0); + attribute::create_tilt_max(cluster, 0); + attribute::create_movement_state(cluster, 0); + command::create_mptz_set_position(cluster); + command::create_mptz_relative_move(cluster); + + return ESP_OK; +} +} /* mechanical_tilt */ + +namespace mechanical_zoom { +uint32_t get_id() +{ + return MechanicalZoom::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_mptz_position(cluster, NULL, 0, 0); + attribute::create_zoom_max(cluster, 0); + attribute::create_movement_state(cluster, 0); + command::create_mptz_set_position(cluster); + command::create_mptz_relative_move(cluster); + + return ESP_OK; +} +} /* mechanical_zoom */ + +namespace mechanical_presets { +uint32_t get_id() +{ + return MechanicalPresets::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(((has_feature(mechanical_pan)) || (has_feature(mechanical_tilt)) || (has_feature(mechanical_zoom))), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_max_presets(cluster, 0); + attribute::create_mptz_presets(cluster, NULL, 0, 0); + command::create_mptz_move_to_preset(cluster); + command::create_mptz_save_preset(cluster); + command::create_mptz_remove_preset(cluster); + + return ESP_OK; +} +} /* mechanical_presets */ + +} /* feature */ + +namespace attribute { +attribute_t *create_mptz_position(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(mechanical_pan)) || (has_feature(mechanical_tilt)) || (has_feature(mechanical_zoom))), NULL); + return esp_matter::attribute::create(cluster, MPTZPosition::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_max_presets(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(mechanical_presets), NULL); + return esp_matter::attribute::create(cluster, MaxPresets::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_mptz_presets(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(mechanical_presets), NULL); + return esp_matter::attribute::create(cluster, MPTZPresets::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_dptz_streams(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(digital_ptz), NULL); + return esp_matter::attribute::create(cluster, DPTZStreams::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_zoom_max(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(mechanical_zoom), NULL); + return esp_matter::attribute::create(cluster, ZoomMax::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_tilt_min(cluster_t *cluster, int16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(mechanical_tilt), NULL); + return esp_matter::attribute::create(cluster, TiltMin::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_int16(value)); +} + +attribute_t *create_tilt_max(cluster_t *cluster, int16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(mechanical_tilt), NULL); + return esp_matter::attribute::create(cluster, TiltMax::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_int16(value)); +} + +attribute_t *create_pan_min(cluster_t *cluster, int16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(mechanical_pan), NULL); + return esp_matter::attribute::create(cluster, PanMin::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_int16(value)); +} + +attribute_t *create_pan_max(cluster_t *cluster, int16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(mechanical_pan), NULL); + return esp_matter::attribute::create(cluster, PanMax::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_int16(value)); +} + +attribute_t *create_movement_state(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(mechanical_pan)) || (has_feature(mechanical_tilt)) || (has_feature(mechanical_zoom))), NULL); + return esp_matter::attribute::create(cluster, MovementState::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +} /* attribute */ +namespace command { +command_t *create_mptz_set_position(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(mechanical_pan)) || (has_feature(mechanical_tilt)) || (has_feature(mechanical_zoom))), NULL); + return esp_matter::command::create(cluster, MPTZSetPosition::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_mptz_relative_move(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(mechanical_pan)) || (has_feature(mechanical_tilt)) || (has_feature(mechanical_zoom))), NULL); + return esp_matter::command::create(cluster, MPTZRelativeMove::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_mptz_move_to_preset(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(mechanical_presets), NULL); + return esp_matter::command::create(cluster, MPTZMoveToPreset::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_mptz_save_preset(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(mechanical_presets), NULL); + return esp_matter::command::create(cluster, MPTZSavePreset::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_mptz_remove_preset(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(mechanical_presets), NULL); + return esp_matter::command::create(cluster, MPTZRemovePreset::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_dptz_set_viewport(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(digital_ptz), NULL); + return esp_matter::command::create(cluster, DPTZSetViewport::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_dptz_relative_move(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, DPTZRelativeMove::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, camera_av_settings_user_level_management::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, camera_av_settings_user_level_management::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterCameraAvSettingsUserLevelManagementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("DigitalPTZ,MechanicalPan,MechanicalTilt,MechanicalZoom", + feature::digital_ptz::get_id(), feature::mechanical_pan::get_id(), feature::mechanical_tilt::get_id(), feature::mechanical_zoom::get_id()); + if (feature_map & feature::digital_ptz::get_id()) { + VerifyOrReturnValue(feature::digital_ptz::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::mechanical_pan::get_id()) { + VerifyOrReturnValue(feature::mechanical_pan::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::mechanical_tilt::get_id()) { + VerifyOrReturnValue(feature::mechanical_tilt::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::mechanical_zoom::get_id()) { + VerifyOrReturnValue(feature::mechanical_zoom::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::mechanical_presets::get_id()) { + VerifyOrReturnValue(feature::mechanical_presets::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* camera_av_settings_user_level_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/camera_av_settings_user_level_management/camera_av_settings_user_level_management.h b/components/esp_matter/data_model/generated/clusters/camera_av_settings_user_level_management/camera_av_settings_user_level_management.h new file mode 100644 index 000000000..855b6bc0f --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/camera_av_settings_user_level_management/camera_av_settings_user_level_management.h @@ -0,0 +1,84 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace camera_av_settings_user_level_management { + +namespace feature { +namespace digital_ptz { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* digital_ptz */ + +namespace mechanical_pan { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* mechanical_pan */ + +namespace mechanical_tilt { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* mechanical_tilt */ + +namespace mechanical_zoom { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* mechanical_zoom */ + +namespace mechanical_presets { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* mechanical_presets */ + +} /* feature */ + +namespace attribute { +attribute_t *create_mptz_position(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_max_presets(cluster_t *cluster, uint8_t value); +attribute_t *create_mptz_presets(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_dptz_streams(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_zoom_max(cluster_t *cluster, uint8_t value); +attribute_t *create_tilt_min(cluster_t *cluster, int16_t value); +attribute_t *create_tilt_max(cluster_t *cluster, int16_t value); +attribute_t *create_pan_min(cluster_t *cluster, int16_t value); +attribute_t *create_pan_max(cluster_t *cluster, int16_t value); +attribute_t *create_movement_state(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_mptz_set_position(cluster_t *cluster); +command_t *create_mptz_relative_move(cluster_t *cluster); +command_t *create_mptz_move_to_preset(cluster_t *cluster); +command_t *create_mptz_save_preset(cluster_t *cluster); +command_t *create_mptz_remove_preset(cluster_t *cluster); +command_t *create_dptz_set_viewport(cluster_t *cluster); +command_t *create_dptz_relative_move(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* camera_av_settings_user_level_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/camera_av_settings_user_level_management/camera_av_settings_user_level_management_ids.h b/components/esp_matter/data_model/generated/clusters/camera_av_settings_user_level_management/camera_av_settings_user_level_management_ids.h new file mode 100644 index 000000000..6f45b8093 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/camera_av_settings_user_level_management/camera_av_settings_user_level_management_ids.h @@ -0,0 +1,103 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace camera_av_settings_user_level_management { + +inline constexpr uint32_t Id = 0x0552; + +namespace feature { +namespace DigitalPTZ { +inline constexpr uint32_t Id = 0x1; +} /* DigitalPTZ */ +namespace MechanicalPan { +inline constexpr uint32_t Id = 0x2; +} /* MechanicalPan */ +namespace MechanicalTilt { +inline constexpr uint32_t Id = 0x4; +} /* MechanicalTilt */ +namespace MechanicalZoom { +inline constexpr uint32_t Id = 0x8; +} /* MechanicalZoom */ +namespace MechanicalPresets { +inline constexpr uint32_t Id = 0x10; +} /* MechanicalPresets */ +} /* feature */ + +namespace attribute { +namespace MPTZPosition { +inline constexpr uint32_t Id = 0x0000; +} /* MPTZPosition */ +namespace MaxPresets { +inline constexpr uint32_t Id = 0x0001; +} /* MaxPresets */ +namespace MPTZPresets { +inline constexpr uint32_t Id = 0x0002; +} /* MPTZPresets */ +namespace DPTZStreams { +inline constexpr uint32_t Id = 0x0003; +} /* DPTZStreams */ +namespace ZoomMax { +inline constexpr uint32_t Id = 0x0004; +} /* ZoomMax */ +namespace TiltMin { +inline constexpr uint32_t Id = 0x0005; +} /* TiltMin */ +namespace TiltMax { +inline constexpr uint32_t Id = 0x0006; +} /* TiltMax */ +namespace PanMin { +inline constexpr uint32_t Id = 0x0007; +} /* PanMin */ +namespace PanMax { +inline constexpr uint32_t Id = 0x0008; +} /* PanMax */ +namespace MovementState { +inline constexpr uint32_t Id = 0x0009; +} /* MovementState */ +} /* attribute */ + +namespace command { +namespace MPTZSetPosition { +inline constexpr uint32_t Id = 0x00; +} /* MPTZSetPosition */ +namespace MPTZRelativeMove { +inline constexpr uint32_t Id = 0x01; +} /* MPTZRelativeMove */ +namespace MPTZMoveToPreset { +inline constexpr uint32_t Id = 0x02; +} /* MPTZMoveToPreset */ +namespace MPTZSavePreset { +inline constexpr uint32_t Id = 0x03; +} /* MPTZSavePreset */ +namespace MPTZRemovePreset { +inline constexpr uint32_t Id = 0x04; +} /* MPTZRemovePreset */ +namespace DPTZSetViewport { +inline constexpr uint32_t Id = 0x05; +} /* DPTZSetViewport */ +namespace DPTZRelativeMove { +inline constexpr uint32_t Id = 0x06; +} /* DPTZRelativeMove */ +} /* command */ + +} /* camera_av_settings_user_level_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/camera_av_stream_management/camera_av_stream_management.cpp b/components/esp_matter/data_model/generated/clusters/camera_av_stream_management/camera_av_stream_management.cpp new file mode 100644 index 000000000..cd62777f4 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/camera_av_stream_management/camera_av_stream_management.cpp @@ -0,0 +1,716 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "camera_av_stream_management_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace camera_av_stream_management { + +namespace feature { +namespace audio { +uint32_t get_id() +{ + return Audio::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_microphone_capabilities(cluster, NULL, 0, 0); + attribute::create_allocated_audio_streams(cluster, NULL, 0, 0); + attribute::create_microphone_muted(cluster, false); + attribute::create_microphone_volume_level(cluster, 0); + attribute::create_microphone_max_level(cluster, 0); + attribute::create_microphone_min_level(cluster, 0); + command::create_audio_stream_allocate(cluster); + command::create_audio_stream_allocate_response(cluster); + command::create_audio_stream_deallocate(cluster); + + return ESP_OK; +} +} /* audio */ + +namespace video { +uint32_t get_id() +{ + return Video::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_max_concurrent_encoders(cluster, 0); + attribute::create_max_encoded_pixel_rate(cluster, 0); + attribute::create_video_sensor_params(cluster, NULL, 0, 0); + attribute::create_min_viewport_resolution(cluster, NULL, 0, 0); + attribute::create_rate_distortion_trade_off_points(cluster, NULL, 0, 0); + attribute::create_current_frame_rate(cluster, 0); + attribute::create_allocated_video_streams(cluster, NULL, 0, 0); + attribute::create_viewport(cluster, NULL, 0, 0); + attribute::create_local_video_recording_enabled(cluster, false); + command::create_video_stream_allocate(cluster); + command::create_video_stream_allocate_response(cluster); + command::create_video_stream_modify(cluster); + command::create_video_stream_deallocate(cluster); + + return ESP_OK; +} +} /* video */ + +namespace snapshot { +uint32_t get_id() +{ + return Snapshot::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_max_concurrent_encoders(cluster, 0); + attribute::create_max_encoded_pixel_rate(cluster, 0); + attribute::create_snapshot_capabilities(cluster, NULL, 0, 0); + attribute::create_allocated_snapshot_streams(cluster, NULL, 0, 0); + attribute::create_local_snapshot_recording_enabled(cluster, false); + command::create_snapshot_stream_allocate(cluster); + command::create_snapshot_stream_allocate_response(cluster); + command::create_snapshot_stream_modify(cluster); + command::create_snapshot_stream_deallocate(cluster); + command::create_capture_snapshot(cluster); + command::create_capture_snapshot_response(cluster); + + return ESP_OK; +} +} /* snapshot */ + +namespace privacy { +uint32_t get_id() +{ + return Privacy::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_soft_recording_privacy_mode_enabled(cluster, false); + attribute::create_soft_livestream_privacy_mode_enabled(cluster, false); + + return ESP_OK; +} +} /* privacy */ + +namespace speaker { +uint32_t get_id() +{ + return Speaker::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(audio), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_speaker_capabilities(cluster, NULL, 0, 0); + attribute::create_two_way_talk_support(cluster, 0); + attribute::create_speaker_muted(cluster, false); + attribute::create_speaker_volume_level(cluster, 0); + attribute::create_speaker_max_level(cluster, 0); + attribute::create_speaker_min_level(cluster, 0); + + return ESP_OK; +} +} /* speaker */ + +namespace image_control { +uint32_t get_id() +{ + return ImageControl::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(((has_feature(video)) || (has_feature(snapshot))), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* image_control */ + +namespace watermark { +uint32_t get_id() +{ + return Watermark::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(((has_feature(video)) || (has_feature(snapshot))), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_video_stream_modify(cluster); + command::create_snapshot_stream_modify(cluster); + + return ESP_OK; +} +} /* watermark */ + +namespace on_screen_display { +uint32_t get_id() +{ + return OnScreenDisplay::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(((has_feature(video)) || (has_feature(snapshot))), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_video_stream_modify(cluster); + command::create_snapshot_stream_modify(cluster); + + return ESP_OK; +} +} /* on_screen_display */ + +namespace local_storage { +uint32_t get_id() +{ + return LocalStorage::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_local_video_recording_enabled(cluster, false); + attribute::create_local_snapshot_recording_enabled(cluster, false); + + return ESP_OK; +} +} /* local_storage */ + +namespace high_dynamic_range { +uint32_t get_id() +{ + return HighDynamicRange::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(((has_feature(video)) || (has_feature(snapshot))), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_hdr_mode_enabled(cluster, false); + + return ESP_OK; +} +} /* high_dynamic_range */ + +namespace night_vision { +uint32_t get_id() +{ + return NightVision::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(((has_feature(video)) || (has_feature(snapshot))), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_night_vision_uses_infrared(cluster, false); + attribute::create_night_vision(cluster, 0); + + return ESP_OK; +} +} /* night_vision */ + +} /* feature */ + +namespace attribute { +attribute_t *create_max_concurrent_encoders(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(video)) || (has_feature(snapshot))), NULL); + return esp_matter::attribute::create(cluster, MaxConcurrentEncoders::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_max_encoded_pixel_rate(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(video)) || (has_feature(snapshot))), NULL); + return esp_matter::attribute::create(cluster, MaxEncodedPixelRate::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_video_sensor_params(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(video), NULL); + return esp_matter::attribute::create(cluster, VideoSensorParams::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_night_vision_uses_infrared(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(night_vision), NULL); + return esp_matter::attribute::create(cluster, NightVisionUsesInfrared::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_bool(value)); +} + +attribute_t *create_min_viewport_resolution(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(video), NULL); + return esp_matter::attribute::create(cluster, MinViewportResolution::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_rate_distortion_trade_off_points(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(video), NULL); + return esp_matter::attribute::create(cluster, RateDistortionTradeOffPoints::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_max_content_buffer_size(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, MaxContentBufferSize::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_microphone_capabilities(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(audio), NULL); + return esp_matter::attribute::create(cluster, MicrophoneCapabilities::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_speaker_capabilities(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(speaker), NULL); + return esp_matter::attribute::create(cluster, SpeakerCapabilities::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_two_way_talk_support(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(speaker), NULL); + return esp_matter::attribute::create(cluster, TwoWayTalkSupport::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_snapshot_capabilities(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(snapshot), NULL); + return esp_matter::attribute::create(cluster, SnapshotCapabilities::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_max_network_bandwidth(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, MaxNetworkBandwidth::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_current_frame_rate(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(video), NULL); + return esp_matter::attribute::create(cluster, CurrentFrameRate::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_hdr_mode_enabled(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(high_dynamic_range), NULL); + return esp_matter::attribute::create(cluster, HDRModeEnabled::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_supported_stream_usages(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedStreamUsages::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_allocated_video_streams(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(video), NULL); + return esp_matter::attribute::create(cluster, AllocatedVideoStreams::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_allocated_audio_streams(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(audio), NULL); + return esp_matter::attribute::create(cluster, AllocatedAudioStreams::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_allocated_snapshot_streams(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(snapshot), NULL); + return esp_matter::attribute::create(cluster, AllocatedSnapshotStreams::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_stream_usage_priorities(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, StreamUsagePriorities::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_soft_recording_privacy_mode_enabled(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(privacy), NULL); + return esp_matter::attribute::create(cluster, SoftRecordingPrivacyModeEnabled::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_soft_livestream_privacy_mode_enabled(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(privacy), NULL); + return esp_matter::attribute::create(cluster, SoftLivestreamPrivacyModeEnabled::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_hard_privacy_mode_on(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, HardPrivacyModeOn::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_bool(value)); +} + +attribute_t *create_night_vision(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(night_vision), NULL); + return esp_matter::attribute::create(cluster, NightVision::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); +} + +attribute_t *create_night_vision_illum(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, NightVisionIllum::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); +} + +attribute_t *create_viewport(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(video), NULL); + return esp_matter::attribute::create(cluster, Viewport::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_speaker_muted(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(speaker), NULL); + return esp_matter::attribute::create(cluster, SpeakerMuted::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_speaker_volume_level(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(speaker), NULL); + return esp_matter::attribute::create(cluster, SpeakerVolumeLevel::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); +} + +attribute_t *create_speaker_max_level(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(speaker), NULL); + return esp_matter::attribute::create(cluster, SpeakerMaxLevel::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_speaker_min_level(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(speaker), NULL); + return esp_matter::attribute::create(cluster, SpeakerMinLevel::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_microphone_muted(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(audio), NULL); + return esp_matter::attribute::create(cluster, MicrophoneMuted::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_microphone_volume_level(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(audio), NULL); + return esp_matter::attribute::create(cluster, MicrophoneVolumeLevel::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); +} + +attribute_t *create_microphone_max_level(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(audio), NULL); + return esp_matter::attribute::create(cluster, MicrophoneMaxLevel::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_microphone_min_level(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(audio), NULL); + return esp_matter::attribute::create(cluster, MicrophoneMinLevel::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_microphone_agc_enabled(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, MicrophoneAGCEnabled::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_image_rotation(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, ImageRotation::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); +} + +attribute_t *create_image_flip_horizontal(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, ImageFlipHorizontal::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_image_flip_vertical(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, ImageFlipVertical::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_local_video_recording_enabled(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(video)) && (has_feature(local_storage))), NULL); + return esp_matter::attribute::create(cluster, LocalVideoRecordingEnabled::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_local_snapshot_recording_enabled(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(snapshot)) && (has_feature(local_storage))), NULL); + return esp_matter::attribute::create(cluster, LocalSnapshotRecordingEnabled::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_status_light_enabled(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, StatusLightEnabled::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_status_light_brightness(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, StatusLightBrightness::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); +} + +} /* attribute */ +namespace command { +command_t *create_audio_stream_allocate(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(audio), NULL); + return esp_matter::command::create(cluster, AudioStreamAllocate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_audio_stream_allocate_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(audio), NULL); + return esp_matter::command::create(cluster, AudioStreamAllocateResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_audio_stream_deallocate(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(audio), NULL); + return esp_matter::command::create(cluster, AudioStreamDeallocate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_video_stream_allocate(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(video), NULL); + return esp_matter::command::create(cluster, VideoStreamAllocate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_video_stream_allocate_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(video), NULL); + return esp_matter::command::create(cluster, VideoStreamAllocateResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_video_stream_modify(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(video)) && (((has_feature(watermark)) || (has_feature(on_screen_display))))), NULL); + return esp_matter::command::create(cluster, VideoStreamModify::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_video_stream_deallocate(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(video), NULL); + return esp_matter::command::create(cluster, VideoStreamDeallocate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_snapshot_stream_allocate(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(snapshot), NULL); + return esp_matter::command::create(cluster, SnapshotStreamAllocate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_snapshot_stream_allocate_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(snapshot), NULL); + return esp_matter::command::create(cluster, SnapshotStreamAllocateResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_snapshot_stream_modify(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(snapshot)) && (((has_feature(watermark)) || (has_feature(on_screen_display))))), NULL); + return esp_matter::command::create(cluster, SnapshotStreamModify::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_snapshot_stream_deallocate(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(snapshot), NULL); + return esp_matter::command::create(cluster, SnapshotStreamDeallocate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_set_stream_priorities(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SetStreamPriorities::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_capture_snapshot(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(snapshot), NULL); + return esp_matter::command::create(cluster, CaptureSnapshot::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_capture_snapshot_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(snapshot), NULL); + return esp_matter::command::create(cluster, CaptureSnapshotResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, camera_av_stream_management::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, camera_av_stream_management::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterCameraAvStreamManagementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_max_content_buffer_size(cluster, 0); + attribute::create_max_network_bandwidth(cluster, 0); + attribute::create_supported_stream_usages(cluster, NULL, 0, 0); + attribute::create_stream_usage_priorities(cluster, NULL, 0, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("Audio,Video,Snapshot", + feature::audio::get_id(), feature::video::get_id(), feature::snapshot::get_id()); + if (feature_map & feature::audio::get_id()) { + VerifyOrReturnValue(feature::audio::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::video::get_id()) { + VerifyOrReturnValue(feature::video::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::snapshot::get_id()) { + VerifyOrReturnValue(feature::snapshot::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::privacy::get_id()) { + VerifyOrReturnValue(feature::privacy::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::speaker::get_id()) { + VerifyOrReturnValue(feature::speaker::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::image_control::get_id()) { + VerifyOrReturnValue(feature::image_control::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::watermark::get_id()) { + VerifyOrReturnValue(feature::watermark::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::on_screen_display::get_id()) { + VerifyOrReturnValue(feature::on_screen_display::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::local_storage::get_id()) { + VerifyOrReturnValue(feature::local_storage::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::high_dynamic_range::get_id()) { + VerifyOrReturnValue(feature::high_dynamic_range::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::night_vision::get_id()) { + VerifyOrReturnValue(feature::night_vision::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + command::create_set_stream_priorities(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* camera_av_stream_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/camera_av_stream_management/camera_av_stream_management.h b/components/esp_matter/data_model/generated/clusters/camera_av_stream_management/camera_av_stream_management.h new file mode 100644 index 000000000..9ae53679e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/camera_av_stream_management/camera_av_stream_management.h @@ -0,0 +1,152 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace camera_av_stream_management { + +namespace feature { +namespace audio { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* audio */ + +namespace video { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* video */ + +namespace snapshot { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* snapshot */ + +namespace privacy { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* privacy */ + +namespace speaker { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* speaker */ + +namespace image_control { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* image_control */ + +namespace watermark { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* watermark */ + +namespace on_screen_display { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* on_screen_display */ + +namespace local_storage { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* local_storage */ + +namespace high_dynamic_range { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* high_dynamic_range */ + +namespace night_vision { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* night_vision */ + +} /* feature */ + +namespace attribute { +attribute_t *create_max_concurrent_encoders(cluster_t *cluster, uint8_t value); +attribute_t *create_max_encoded_pixel_rate(cluster_t *cluster, uint32_t value); +attribute_t *create_video_sensor_params(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_night_vision_uses_infrared(cluster_t *cluster, bool value); +attribute_t *create_min_viewport_resolution(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_rate_distortion_trade_off_points(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_max_content_buffer_size(cluster_t *cluster, uint32_t value); +attribute_t *create_microphone_capabilities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_speaker_capabilities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_two_way_talk_support(cluster_t *cluster, uint8_t value); +attribute_t *create_snapshot_capabilities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_max_network_bandwidth(cluster_t *cluster, uint32_t value); +attribute_t *create_current_frame_rate(cluster_t *cluster, uint16_t value); +attribute_t *create_hdr_mode_enabled(cluster_t *cluster, bool value); +attribute_t *create_supported_stream_usages(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_allocated_video_streams(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_allocated_audio_streams(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_allocated_snapshot_streams(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_stream_usage_priorities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_soft_recording_privacy_mode_enabled(cluster_t *cluster, bool value); +attribute_t *create_soft_livestream_privacy_mode_enabled(cluster_t *cluster, bool value); +attribute_t *create_hard_privacy_mode_on(cluster_t *cluster, bool value); +attribute_t *create_night_vision(cluster_t *cluster, uint8_t value); +attribute_t *create_night_vision_illum(cluster_t *cluster, uint8_t value); +attribute_t *create_viewport(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_speaker_muted(cluster_t *cluster, bool value); +attribute_t *create_speaker_volume_level(cluster_t *cluster, uint8_t value); +attribute_t *create_speaker_max_level(cluster_t *cluster, uint8_t value); +attribute_t *create_speaker_min_level(cluster_t *cluster, uint8_t value); +attribute_t *create_microphone_muted(cluster_t *cluster, bool value); +attribute_t *create_microphone_volume_level(cluster_t *cluster, uint8_t value); +attribute_t *create_microphone_max_level(cluster_t *cluster, uint8_t value); +attribute_t *create_microphone_min_level(cluster_t *cluster, uint8_t value); +attribute_t *create_microphone_agc_enabled(cluster_t *cluster, bool value); +attribute_t *create_image_rotation(cluster_t *cluster, uint16_t value); +attribute_t *create_image_flip_horizontal(cluster_t *cluster, bool value); +attribute_t *create_image_flip_vertical(cluster_t *cluster, bool value); +attribute_t *create_local_video_recording_enabled(cluster_t *cluster, bool value); +attribute_t *create_local_snapshot_recording_enabled(cluster_t *cluster, bool value); +attribute_t *create_status_light_enabled(cluster_t *cluster, bool value); +attribute_t *create_status_light_brightness(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_audio_stream_allocate(cluster_t *cluster); +command_t *create_audio_stream_allocate_response(cluster_t *cluster); +command_t *create_audio_stream_deallocate(cluster_t *cluster); +command_t *create_video_stream_allocate(cluster_t *cluster); +command_t *create_video_stream_allocate_response(cluster_t *cluster); +command_t *create_video_stream_modify(cluster_t *cluster); +command_t *create_video_stream_deallocate(cluster_t *cluster); +command_t *create_snapshot_stream_allocate(cluster_t *cluster); +command_t *create_snapshot_stream_allocate_response(cluster_t *cluster); +command_t *create_snapshot_stream_modify(cluster_t *cluster); +command_t *create_snapshot_stream_deallocate(cluster_t *cluster); +command_t *create_set_stream_priorities(cluster_t *cluster); +command_t *create_capture_snapshot(cluster_t *cluster); +command_t *create_capture_snapshot_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* camera_av_stream_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/camera_av_stream_management/camera_av_stream_management_ids.h b/components/esp_matter/data_model/generated/clusters/camera_av_stream_management/camera_av_stream_management_ids.h new file mode 100644 index 000000000..7bc2be6c2 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/camera_av_stream_management/camera_av_stream_management_ids.h @@ -0,0 +1,235 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace camera_av_stream_management { + +inline constexpr uint32_t Id = 0x0551; + +namespace feature { +namespace Audio { +inline constexpr uint32_t Id = 0x1; +} /* Audio */ +namespace Video { +inline constexpr uint32_t Id = 0x2; +} /* Video */ +namespace Snapshot { +inline constexpr uint32_t Id = 0x4; +} /* Snapshot */ +namespace Privacy { +inline constexpr uint32_t Id = 0x8; +} /* Privacy */ +namespace Speaker { +inline constexpr uint32_t Id = 0x10; +} /* Speaker */ +namespace ImageControl { +inline constexpr uint32_t Id = 0x20; +} /* ImageControl */ +namespace Watermark { +inline constexpr uint32_t Id = 0x40; +} /* Watermark */ +namespace OnScreenDisplay { +inline constexpr uint32_t Id = 0x80; +} /* OnScreenDisplay */ +namespace LocalStorage { +inline constexpr uint32_t Id = 0x100; +} /* LocalStorage */ +namespace HighDynamicRange { +inline constexpr uint32_t Id = 0x200; +} /* HighDynamicRange */ +namespace NightVision { +inline constexpr uint32_t Id = 0x400; +} /* NightVision */ +} /* feature */ + +namespace attribute { +namespace MaxConcurrentEncoders { +inline constexpr uint32_t Id = 0x0000; +} /* MaxConcurrentEncoders */ +namespace MaxEncodedPixelRate { +inline constexpr uint32_t Id = 0x0001; +} /* MaxEncodedPixelRate */ +namespace VideoSensorParams { +inline constexpr uint32_t Id = 0x0002; +} /* VideoSensorParams */ +namespace NightVisionUsesInfrared { +inline constexpr uint32_t Id = 0x0003; +} /* NightVisionUsesInfrared */ +namespace MinViewportResolution { +inline constexpr uint32_t Id = 0x0004; +} /* MinViewportResolution */ +namespace RateDistortionTradeOffPoints { +inline constexpr uint32_t Id = 0x0005; +} /* RateDistortionTradeOffPoints */ +namespace MaxContentBufferSize { +inline constexpr uint32_t Id = 0x0006; +} /* MaxContentBufferSize */ +namespace MicrophoneCapabilities { +inline constexpr uint32_t Id = 0x0007; +} /* MicrophoneCapabilities */ +namespace SpeakerCapabilities { +inline constexpr uint32_t Id = 0x0008; +} /* SpeakerCapabilities */ +namespace TwoWayTalkSupport { +inline constexpr uint32_t Id = 0x0009; +} /* TwoWayTalkSupport */ +namespace SnapshotCapabilities { +inline constexpr uint32_t Id = 0x000A; +} /* SnapshotCapabilities */ +namespace MaxNetworkBandwidth { +inline constexpr uint32_t Id = 0x000B; +} /* MaxNetworkBandwidth */ +namespace CurrentFrameRate { +inline constexpr uint32_t Id = 0x000C; +} /* CurrentFrameRate */ +namespace HDRModeEnabled { +inline constexpr uint32_t Id = 0x000D; +} /* HDRModeEnabled */ +namespace SupportedStreamUsages { +inline constexpr uint32_t Id = 0x000E; +} /* SupportedStreamUsages */ +namespace AllocatedVideoStreams { +inline constexpr uint32_t Id = 0x000F; +} /* AllocatedVideoStreams */ +namespace AllocatedAudioStreams { +inline constexpr uint32_t Id = 0x0010; +} /* AllocatedAudioStreams */ +namespace AllocatedSnapshotStreams { +inline constexpr uint32_t Id = 0x0011; +} /* AllocatedSnapshotStreams */ +namespace StreamUsagePriorities { +inline constexpr uint32_t Id = 0x0012; +} /* StreamUsagePriorities */ +namespace SoftRecordingPrivacyModeEnabled { +inline constexpr uint32_t Id = 0x0013; +} /* SoftRecordingPrivacyModeEnabled */ +namespace SoftLivestreamPrivacyModeEnabled { +inline constexpr uint32_t Id = 0x0014; +} /* SoftLivestreamPrivacyModeEnabled */ +namespace HardPrivacyModeOn { +inline constexpr uint32_t Id = 0x0015; +} /* HardPrivacyModeOn */ +namespace NightVision { +inline constexpr uint32_t Id = 0x0016; +} /* NightVision */ +namespace NightVisionIllum { +inline constexpr uint32_t Id = 0x0017; +} /* NightVisionIllum */ +namespace Viewport { +inline constexpr uint32_t Id = 0x0018; +} /* Viewport */ +namespace SpeakerMuted { +inline constexpr uint32_t Id = 0x0019; +} /* SpeakerMuted */ +namespace SpeakerVolumeLevel { +inline constexpr uint32_t Id = 0x001A; +} /* SpeakerVolumeLevel */ +namespace SpeakerMaxLevel { +inline constexpr uint32_t Id = 0x001B; +} /* SpeakerMaxLevel */ +namespace SpeakerMinLevel { +inline constexpr uint32_t Id = 0x001C; +} /* SpeakerMinLevel */ +namespace MicrophoneMuted { +inline constexpr uint32_t Id = 0x001D; +} /* MicrophoneMuted */ +namespace MicrophoneVolumeLevel { +inline constexpr uint32_t Id = 0x001E; +} /* MicrophoneVolumeLevel */ +namespace MicrophoneMaxLevel { +inline constexpr uint32_t Id = 0x001F; +} /* MicrophoneMaxLevel */ +namespace MicrophoneMinLevel { +inline constexpr uint32_t Id = 0x0020; +} /* MicrophoneMinLevel */ +namespace MicrophoneAGCEnabled { +inline constexpr uint32_t Id = 0x0021; +} /* MicrophoneAGCEnabled */ +namespace ImageRotation { +inline constexpr uint32_t Id = 0x0022; +} /* ImageRotation */ +namespace ImageFlipHorizontal { +inline constexpr uint32_t Id = 0x0023; +} /* ImageFlipHorizontal */ +namespace ImageFlipVertical { +inline constexpr uint32_t Id = 0x0024; +} /* ImageFlipVertical */ +namespace LocalVideoRecordingEnabled { +inline constexpr uint32_t Id = 0x0025; +} /* LocalVideoRecordingEnabled */ +namespace LocalSnapshotRecordingEnabled { +inline constexpr uint32_t Id = 0x0026; +} /* LocalSnapshotRecordingEnabled */ +namespace StatusLightEnabled { +inline constexpr uint32_t Id = 0x0027; +} /* StatusLightEnabled */ +namespace StatusLightBrightness { +inline constexpr uint32_t Id = 0x0028; +} /* StatusLightBrightness */ +} /* attribute */ + +namespace command { +namespace AudioStreamAllocate { +inline constexpr uint32_t Id = 0x00; +} /* AudioStreamAllocate */ +namespace AudioStreamAllocateResponse { +inline constexpr uint32_t Id = 0x01; +} /* AudioStreamAllocateResponse */ +namespace AudioStreamDeallocate { +inline constexpr uint32_t Id = 0x02; +} /* AudioStreamDeallocate */ +namespace VideoStreamAllocate { +inline constexpr uint32_t Id = 0x03; +} /* VideoStreamAllocate */ +namespace VideoStreamAllocateResponse { +inline constexpr uint32_t Id = 0x04; +} /* VideoStreamAllocateResponse */ +namespace VideoStreamModify { +inline constexpr uint32_t Id = 0x05; +} /* VideoStreamModify */ +namespace VideoStreamDeallocate { +inline constexpr uint32_t Id = 0x06; +} /* VideoStreamDeallocate */ +namespace SnapshotStreamAllocate { +inline constexpr uint32_t Id = 0x07; +} /* SnapshotStreamAllocate */ +namespace SnapshotStreamAllocateResponse { +inline constexpr uint32_t Id = 0x08; +} /* SnapshotStreamAllocateResponse */ +namespace SnapshotStreamModify { +inline constexpr uint32_t Id = 0x09; +} /* SnapshotStreamModify */ +namespace SnapshotStreamDeallocate { +inline constexpr uint32_t Id = 0x0A; +} /* SnapshotStreamDeallocate */ +namespace SetStreamPriorities { +inline constexpr uint32_t Id = 0x0B; +} /* SetStreamPriorities */ +namespace CaptureSnapshot { +inline constexpr uint32_t Id = 0x0C; +} /* CaptureSnapshot */ +namespace CaptureSnapshotResponse { +inline constexpr uint32_t Id = 0x0D; +} /* CaptureSnapshotResponse */ +} /* command */ + +} /* camera_av_stream_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/carbon_dioxide_concentration_measurement/carbon_dioxide_concentration_measurement.cpp b/components/esp_matter/data_model/generated/clusters/carbon_dioxide_concentration_measurement/carbon_dioxide_concentration_measurement.cpp new file mode 100644 index 000000000..2a83b9f01 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/carbon_dioxide_concentration_measurement/carbon_dioxide_concentration_measurement.cpp @@ -0,0 +1,289 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "carbon_dioxide_concentration_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace carbon_dioxide_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id() +{ + return NumericMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_measured_value(cluster, 0); + attribute::create_min_measured_value(cluster, 0); + attribute::create_max_measured_value(cluster, 0); + attribute::create_measurement_unit(cluster, 0); + + return ESP_OK; +} +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id() +{ + return LevelIndication::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_level_value(cluster, 0); + + return ESP_OK; +} +} /* level_indication */ + +namespace medium_level { +uint32_t get_id() +{ + return MediumLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* medium_level */ + +namespace critical_level { +uint32_t get_id() +{ + return CriticalLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id() +{ + return PeakMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_peak_measured_value(cluster, 0); + attribute::create_peak_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id() +{ + return AverageMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_average_measured_value(cluster, 0); + attribute::create_average_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_uncertainty(cluster_t *cluster, float value) +{ + return esp_matter::attribute::create(cluster, Uncertainty::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_float(value)); +} + +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasurementUnit::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, MeasurementMedium::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_level_value(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(level_indication), NULL); + return esp_matter::attribute::create(cluster, LevelValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, carbon_dioxide_concentration_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, carbon_dioxide_concentration_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterCarbonDioxideConcentrationMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measurement_medium(cluster, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("NumericMeasurement,LevelIndication", + feature::numeric_measurement::get_id(), feature::level_indication::get_id()); + if (feature_map & feature::numeric_measurement::get_id()) { + VerifyOrReturnValue(feature::numeric_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::level_indication::get_id()) { + VerifyOrReturnValue(feature::level_indication::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::medium_level::get_id()) { + VerifyOrReturnValue(feature::medium_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::critical_level::get_id()) { + VerifyOrReturnValue(feature::critical_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::peak_measurement::get_id()) { + VerifyOrReturnValue(feature::peak_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::average_measurement::get_id()) { + VerifyOrReturnValue(feature::average_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* carbon_dioxide_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/carbon_dioxide_concentration_measurement/carbon_dioxide_concentration_measurement.h b/components/esp_matter/data_model/generated/clusters/carbon_dioxide_concentration_measurement/carbon_dioxide_concentration_measurement.h new file mode 100644 index 000000000..bd568c6d4 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/carbon_dioxide_concentration_measurement/carbon_dioxide_concentration_measurement.h @@ -0,0 +1,80 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace carbon_dioxide_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* level_indication */ + +namespace medium_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* medium_level */ + +namespace critical_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_uncertainty(cluster_t *cluster, float value); +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value); +attribute_t *create_level_value(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* carbon_dioxide_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/carbon_dioxide_concentration_measurement/carbon_dioxide_concentration_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/carbon_dioxide_concentration_measurement/carbon_dioxide_concentration_measurement_ids.h new file mode 100644 index 000000000..98a96128c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/carbon_dioxide_concentration_measurement/carbon_dioxide_concentration_measurement_ids.h @@ -0,0 +1,85 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace carbon_dioxide_concentration_measurement { + +inline constexpr uint32_t Id = 0x040D; + +namespace feature { +namespace NumericMeasurement { +inline constexpr uint32_t Id = 0x1; +} /* NumericMeasurement */ +namespace LevelIndication { +inline constexpr uint32_t Id = 0x2; +} /* LevelIndication */ +namespace MediumLevel { +inline constexpr uint32_t Id = 0x4; +} /* MediumLevel */ +namespace CriticalLevel { +inline constexpr uint32_t Id = 0x8; +} /* CriticalLevel */ +namespace PeakMeasurement { +inline constexpr uint32_t Id = 0x10; +} /* PeakMeasurement */ +namespace AverageMeasurement { +inline constexpr uint32_t Id = 0x20; +} /* AverageMeasurement */ +} /* feature */ + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace PeakMeasuredValue { +inline constexpr uint32_t Id = 0x0003; +} /* PeakMeasuredValue */ +namespace PeakMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0004; +} /* PeakMeasuredValueWindow */ +namespace AverageMeasuredValue { +inline constexpr uint32_t Id = 0x0005; +} /* AverageMeasuredValue */ +namespace AverageMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0006; +} /* AverageMeasuredValueWindow */ +namespace Uncertainty { +inline constexpr uint32_t Id = 0x0007; +} /* Uncertainty */ +namespace MeasurementUnit { +inline constexpr uint32_t Id = 0x0008; +} /* MeasurementUnit */ +namespace MeasurementMedium { +inline constexpr uint32_t Id = 0x0009; +} /* MeasurementMedium */ +namespace LevelValue { +inline constexpr uint32_t Id = 0x000A; +} /* LevelValue */ +} /* attribute */ + +} /* carbon_dioxide_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/carbon_monoxide_concentration_measurement/carbon_monoxide_concentration_measurement.cpp b/components/esp_matter/data_model/generated/clusters/carbon_monoxide_concentration_measurement/carbon_monoxide_concentration_measurement.cpp new file mode 100644 index 000000000..f9c3c0b23 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/carbon_monoxide_concentration_measurement/carbon_monoxide_concentration_measurement.cpp @@ -0,0 +1,289 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "carbon_monoxide_concentration_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace carbon_monoxide_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id() +{ + return NumericMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_measured_value(cluster, 0); + attribute::create_min_measured_value(cluster, 0); + attribute::create_max_measured_value(cluster, 0); + attribute::create_measurement_unit(cluster, 0); + + return ESP_OK; +} +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id() +{ + return LevelIndication::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_level_value(cluster, 0); + + return ESP_OK; +} +} /* level_indication */ + +namespace medium_level { +uint32_t get_id() +{ + return MediumLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* medium_level */ + +namespace critical_level { +uint32_t get_id() +{ + return CriticalLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id() +{ + return PeakMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_peak_measured_value(cluster, 0); + attribute::create_peak_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id() +{ + return AverageMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_average_measured_value(cluster, 0); + attribute::create_average_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_uncertainty(cluster_t *cluster, float value) +{ + return esp_matter::attribute::create(cluster, Uncertainty::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_float(value)); +} + +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasurementUnit::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, MeasurementMedium::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_level_value(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(level_indication), NULL); + return esp_matter::attribute::create(cluster, LevelValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, carbon_monoxide_concentration_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, carbon_monoxide_concentration_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterCarbonMonoxideConcentrationMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measurement_medium(cluster, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("NumericMeasurement,LevelIndication", + feature::numeric_measurement::get_id(), feature::level_indication::get_id()); + if (feature_map & feature::numeric_measurement::get_id()) { + VerifyOrReturnValue(feature::numeric_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::level_indication::get_id()) { + VerifyOrReturnValue(feature::level_indication::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::medium_level::get_id()) { + VerifyOrReturnValue(feature::medium_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::critical_level::get_id()) { + VerifyOrReturnValue(feature::critical_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::peak_measurement::get_id()) { + VerifyOrReturnValue(feature::peak_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::average_measurement::get_id()) { + VerifyOrReturnValue(feature::average_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* carbon_monoxide_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/carbon_monoxide_concentration_measurement/carbon_monoxide_concentration_measurement.h b/components/esp_matter/data_model/generated/clusters/carbon_monoxide_concentration_measurement/carbon_monoxide_concentration_measurement.h new file mode 100644 index 000000000..9c3a51f7c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/carbon_monoxide_concentration_measurement/carbon_monoxide_concentration_measurement.h @@ -0,0 +1,80 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace carbon_monoxide_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* level_indication */ + +namespace medium_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* medium_level */ + +namespace critical_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_uncertainty(cluster_t *cluster, float value); +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value); +attribute_t *create_level_value(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* carbon_monoxide_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/carbon_monoxide_concentration_measurement/carbon_monoxide_concentration_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/carbon_monoxide_concentration_measurement/carbon_monoxide_concentration_measurement_ids.h new file mode 100644 index 000000000..dab9175b6 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/carbon_monoxide_concentration_measurement/carbon_monoxide_concentration_measurement_ids.h @@ -0,0 +1,85 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace carbon_monoxide_concentration_measurement { + +inline constexpr uint32_t Id = 0x040C; + +namespace feature { +namespace NumericMeasurement { +inline constexpr uint32_t Id = 0x1; +} /* NumericMeasurement */ +namespace LevelIndication { +inline constexpr uint32_t Id = 0x2; +} /* LevelIndication */ +namespace MediumLevel { +inline constexpr uint32_t Id = 0x4; +} /* MediumLevel */ +namespace CriticalLevel { +inline constexpr uint32_t Id = 0x8; +} /* CriticalLevel */ +namespace PeakMeasurement { +inline constexpr uint32_t Id = 0x10; +} /* PeakMeasurement */ +namespace AverageMeasurement { +inline constexpr uint32_t Id = 0x20; +} /* AverageMeasurement */ +} /* feature */ + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace PeakMeasuredValue { +inline constexpr uint32_t Id = 0x0003; +} /* PeakMeasuredValue */ +namespace PeakMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0004; +} /* PeakMeasuredValueWindow */ +namespace AverageMeasuredValue { +inline constexpr uint32_t Id = 0x0005; +} /* AverageMeasuredValue */ +namespace AverageMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0006; +} /* AverageMeasuredValueWindow */ +namespace Uncertainty { +inline constexpr uint32_t Id = 0x0007; +} /* Uncertainty */ +namespace MeasurementUnit { +inline constexpr uint32_t Id = 0x0008; +} /* MeasurementUnit */ +namespace MeasurementMedium { +inline constexpr uint32_t Id = 0x0009; +} /* MeasurementMedium */ +namespace LevelValue { +inline constexpr uint32_t Id = 0x000A; +} /* LevelValue */ +} /* attribute */ + +} /* carbon_monoxide_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/channel/channel.cpp b/components/esp_matter/data_model/generated/clusters/channel/channel.cpp new file mode 100644 index 000000000..4e3400f82 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/channel/channel.cpp @@ -0,0 +1,305 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "channel_cluster"; +constexpr uint16_t cluster_revision = 2; + +static esp_err_t esp_matter_command_callback_change_channel(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Channel::Commands::ChangeChannel::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfChannelClusterChangeChannelCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_change_channel_by_number(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfChannelClusterChangeChannelByNumberCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_skip_channel(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Channel::Commands::SkipChannel::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfChannelClusterSkipChannelCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_get_program_guide(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Channel::Commands::GetProgramGuide::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfChannelClusterGetProgramGuideCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_record_program(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Channel::Commands::RecordProgram::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfChannelClusterRecordProgramCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_cancel_record_program(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Channel::Commands::CancelRecordProgram::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfChannelClusterCancelRecordProgramCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace channel { + +namespace feature { +namespace channel_list { +uint32_t get_id() +{ + return ChannelList::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_channel_list(cluster, NULL, 0, 0); + command::create_change_channel(cluster); + command::create_change_channel_response(cluster); + + return ESP_OK; +} +} /* channel_list */ + +namespace lineup_info { +uint32_t get_id() +{ + return LineupInfo::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_lineup(cluster, NULL, 0, 0); + command::create_change_channel(cluster); + command::create_change_channel_response(cluster); + + return ESP_OK; +} +} /* lineup_info */ + +namespace electronic_guide { +uint32_t get_id() +{ + return ElectronicGuide::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_get_program_guide(cluster); + command::create_program_guide_response(cluster); + command::create_record_program(cluster); + command::create_cancel_record_program(cluster); + + return ESP_OK; +} +} /* electronic_guide */ + +namespace record_program { +uint32_t get_id() +{ + return RecordProgram::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_record_program(cluster); + command::create_cancel_record_program(cluster); + + return ESP_OK; +} +} /* record_program */ + +} /* feature */ + +namespace attribute { +attribute_t *create_channel_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(channel_list), NULL); + return esp_matter::attribute::create(cluster, ChannelList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_lineup(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(lineup_info), NULL); + return esp_matter::attribute::create(cluster, Lineup::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_channel(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CurrentChannel::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_change_channel(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(channel_list)) || (has_feature(lineup_info))), NULL); + return esp_matter::command::create(cluster, ChangeChannel::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_change_channel); +} + +command_t *create_change_channel_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(channel_list)) || (has_feature(lineup_info))), NULL); + return esp_matter::command::create(cluster, ChangeChannelResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_change_channel_by_number(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeChannelByNumber::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_change_channel_by_number); +} + +command_t *create_skip_channel(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SkipChannel::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_skip_channel); +} + +command_t *create_get_program_guide(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(electronic_guide), NULL); + return esp_matter::command::create(cluster, GetProgramGuide::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_get_program_guide); +} + +command_t *create_program_guide_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(electronic_guide), NULL); + return esp_matter::command::create(cluster, ProgramGuideResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_record_program(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(record_program)) && (has_feature(electronic_guide))), NULL); + return esp_matter::command::create(cluster, RecordProgram::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_record_program); +} + +command_t *create_cancel_record_program(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(record_program)) && (has_feature(electronic_guide))), NULL); + return esp_matter::command::create(cluster, CancelRecordProgram::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_cancel_record_program); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, channel::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, channel::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ChannelDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterChannelPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_change_channel_by_number(cluster); + command::create_skip_channel(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* channel */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/channel/channel.h b/components/esp_matter/data_model/generated/clusters/channel/channel.h new file mode 100644 index 000000000..811b3a07b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/channel/channel.h @@ -0,0 +1,73 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace channel { + +namespace feature { +namespace channel_list { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* channel_list */ + +namespace lineup_info { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* lineup_info */ + +namespace electronic_guide { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* electronic_guide */ + +namespace record_program { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* record_program */ + +} /* feature */ + +namespace attribute { +attribute_t *create_channel_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_lineup(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_channel(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_change_channel(cluster_t *cluster); +command_t *create_change_channel_response(cluster_t *cluster); +command_t *create_change_channel_by_number(cluster_t *cluster); +command_t *create_skip_channel(cluster_t *cluster); +command_t *create_get_program_guide(cluster_t *cluster); +command_t *create_program_guide_response(cluster_t *cluster); +command_t *create_record_program(cluster_t *cluster); +command_t *create_cancel_record_program(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* channel */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/channel/channel_ids.h b/components/esp_matter/data_model/generated/clusters/channel/channel_ids.h new file mode 100644 index 000000000..741ab23e5 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/channel/channel_ids.h @@ -0,0 +1,82 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace channel { + +inline constexpr uint32_t Id = 0x0504; + +namespace feature { +namespace ChannelList { +inline constexpr uint32_t Id = 0x1; +} /* ChannelList */ +namespace LineupInfo { +inline constexpr uint32_t Id = 0x2; +} /* LineupInfo */ +namespace ElectronicGuide { +inline constexpr uint32_t Id = 0x4; +} /* ElectronicGuide */ +namespace RecordProgram { +inline constexpr uint32_t Id = 0x8; +} /* RecordProgram */ +} /* feature */ + +namespace attribute { +namespace ChannelList { +inline constexpr uint32_t Id = 0x0000; +} /* ChannelList */ +namespace Lineup { +inline constexpr uint32_t Id = 0x0001; +} /* Lineup */ +namespace CurrentChannel { +inline constexpr uint32_t Id = 0x0002; +} /* CurrentChannel */ +} /* attribute */ + +namespace command { +namespace ChangeChannel { +inline constexpr uint32_t Id = 0x00; +} /* ChangeChannel */ +namespace ChangeChannelResponse { +inline constexpr uint32_t Id = 0x01; +} /* ChangeChannelResponse */ +namespace ChangeChannelByNumber { +inline constexpr uint32_t Id = 0x02; +} /* ChangeChannelByNumber */ +namespace SkipChannel { +inline constexpr uint32_t Id = 0x03; +} /* SkipChannel */ +namespace GetProgramGuide { +inline constexpr uint32_t Id = 0x04; +} /* GetProgramGuide */ +namespace ProgramGuideResponse { +inline constexpr uint32_t Id = 0x05; +} /* ProgramGuideResponse */ +namespace RecordProgram { +inline constexpr uint32_t Id = 0x06; +} /* RecordProgram */ +namespace CancelRecordProgram { +inline constexpr uint32_t Id = 0x07; +} /* CancelRecordProgram */ +} /* command */ + +} /* channel */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/chime/chime.cpp b/components/esp_matter/data_model/generated/clusters/chime/chime.cpp new file mode 100644 index 000000000..841265d8f --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/chime/chime.cpp @@ -0,0 +1,121 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "chime_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace chime { + +namespace attribute { +attribute_t *create_installed_chime_sounds(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, InstalledChimeSounds::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_selected_chime(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SelectedChime::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_enabled(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, Enabled::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +} /* attribute */ +namespace command { +command_t *create_play_chime_sound(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, PlayChimeSound::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, chime::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, chime::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ChimeDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterChimePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_selected_chime(cluster, config->selected_chime); + attribute::create_enabled(cluster, config->enabled); + attribute::create_installed_chime_sounds(cluster, NULL, 0, 0); + command::create_play_chime_sound(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterChimeClusterServerInitCallback, + ESPMatterChimeClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* chime */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/chime/chime.h b/components/esp_matter/data_model/generated/clusters/chime/chime.h new file mode 100644 index 000000000..912d25a1f --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/chime/chime.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace chime { + +namespace attribute { +attribute_t *create_installed_chime_sounds(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_selected_chime(cluster_t *cluster, uint8_t value); +attribute_t *create_enabled(cluster_t *cluster, bool value); +} /* attribute */ + +namespace command { +command_t *create_play_chime_sound(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t selected_chime; + bool enabled; + void *delegate; + config() : selected_chime(0), enabled(false), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* chime */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/chime/chime_ids.h b/components/esp_matter/data_model/generated/clusters/chime/chime_ids.h new file mode 100644 index 000000000..ec8ede33b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/chime/chime_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace chime { + +inline constexpr uint32_t Id = 0x0556; + +namespace attribute { +namespace InstalledChimeSounds { +inline constexpr uint32_t Id = 0x0000; +} /* InstalledChimeSounds */ +namespace SelectedChime { +inline constexpr uint32_t Id = 0x0001; +} /* SelectedChime */ +namespace Enabled { +inline constexpr uint32_t Id = 0x0002; +} /* Enabled */ +} /* attribute */ + +namespace command { +namespace PlayChimeSound { +inline constexpr uint32_t Id = 0x00; +} /* PlayChimeSound */ +} /* command */ + +} /* chime */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/closure_control/closure_control.cpp b/components/esp_matter/data_model/generated/clusters/closure_control/closure_control.cpp new file mode 100644 index 000000000..d57f1edad --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/closure_control/closure_control.cpp @@ -0,0 +1,367 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "closure_control_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace closure_control { + +namespace feature { +namespace positioning { +uint32_t get_id() +{ + return Positioning::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* positioning */ + +namespace motion_latching { +uint32_t get_id() +{ + return MotionLatching::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_latch_control_modes(cluster, 0); + + return ESP_OK; +} +} /* motion_latching */ + +namespace instantaneous { +uint32_t get_id() +{ + return Instantaneous::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command_t *stop = esp_matter::command::get(cluster, command::Stop::Id, COMMAND_FLAG_ACCEPTED); + if (stop) { + esp_matter::command::destroy(cluster, stop); + } + event_t *movement_completed = esp_matter::event::get(cluster, event::MovementCompleted::Id); + if (movement_completed) { + esp_matter::event::destroy(cluster, movement_completed); + } + + return ESP_OK; +} +} /* instantaneous */ + +namespace speed { +uint32_t get_id() +{ + return Speed::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(((has_feature(positioning)) && (!(has_feature(instantaneous)))), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* speed */ + +namespace ventilation { +uint32_t get_id() +{ + return Ventilation::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(positioning), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* ventilation */ + +namespace pedestrian { +uint32_t get_id() +{ + return Pedestrian::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(positioning), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* pedestrian */ + +namespace calibration { +uint32_t get_id() +{ + return Calibration::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(positioning), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_calibrate(cluster); + + return ESP_OK; +} +} /* calibration */ + +namespace protection { +uint32_t get_id() +{ + return Protection::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* protection */ + +namespace manually_operable { +uint32_t get_id() +{ + return ManuallyOperable::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + event::create_engage_state_changed(cluster); + + return ESP_OK; +} +} /* manually_operable */ + +} /* feature */ + +namespace attribute { +attribute_t *create_countdown_time(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CountdownTime::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_main_state(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, MainState::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_current_error_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CurrentErrorList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_overall_current_state(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, OverallCurrentState::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_overall_target_state(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, OverallTargetState::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_latch_control_modes(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(motion_latching), NULL); + return esp_matter::attribute::create(cluster, LatchControlModes::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_bitmap8(value)); +} + +} /* attribute */ +namespace command { +command_t *create_stop(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(!(has_feature(instantaneous)), NULL); + return esp_matter::command::create(cluster, Stop::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_move_to(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, MoveTo::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_calibrate(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(calibration), NULL); + return esp_matter::command::create(cluster, Calibrate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_operational_error(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, OperationalError::Id); +} + +event_t *create_movement_completed(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(!(has_feature(instantaneous)), NULL); + return esp_matter::event::create(cluster, MovementCompleted::Id); +} + +event_t *create_engage_state_changed(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(manually_operable), NULL); + return esp_matter::event::create(cluster, EngageStateChanged::Id); +} + +event_t *create_secure_state_changed(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, SecureStateChanged::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, closure_control::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, closure_control::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ClosureControlDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterClosureControlPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_main_state(cluster, 0); + attribute::create_current_error_list(cluster, NULL, 0, 0); + attribute::create_overall_current_state(cluster, NULL, 0, 0); + attribute::create_overall_target_state(cluster, NULL, 0, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("Positioning,MotionLatching", + feature::positioning::get_id(), feature::motion_latching::get_id()); + if (feature_map & feature::positioning::get_id()) { + VerifyOrReturnValue(feature::positioning::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::motion_latching::get_id()) { + VerifyOrReturnValue(feature::motion_latching::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::instantaneous::get_id()) { + VerifyOrReturnValue(feature::instantaneous::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::speed::get_id()) { + VerifyOrReturnValue(feature::speed::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::ventilation::get_id()) { + VerifyOrReturnValue(feature::ventilation::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::pedestrian::get_id()) { + VerifyOrReturnValue(feature::pedestrian::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::calibration::get_id()) { + VerifyOrReturnValue(feature::calibration::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::protection::get_id()) { + VerifyOrReturnValue(feature::protection::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::manually_operable::get_id()) { + VerifyOrReturnValue(feature::manually_operable::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + command::create_stop(cluster); + command::create_move_to(cluster); + /* Events */ + event::create_operational_error(cluster); + event::create_movement_completed(cluster); + event::create_secure_state_changed(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* closure_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/closure_control/closure_control.h b/components/esp_matter/data_model/generated/clusters/closure_control/closure_control.h new file mode 100644 index 000000000..923977bd0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/closure_control/closure_control.h @@ -0,0 +1,104 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace closure_control { + +namespace feature { +namespace positioning { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* positioning */ + +namespace motion_latching { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* motion_latching */ + +namespace instantaneous { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* instantaneous */ + +namespace speed { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* speed */ + +namespace ventilation { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* ventilation */ + +namespace pedestrian { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* pedestrian */ + +namespace calibration { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* calibration */ + +namespace protection { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* protection */ + +namespace manually_operable { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* manually_operable */ + +} /* feature */ + +namespace attribute { +attribute_t *create_countdown_time(cluster_t *cluster, nullable value); +attribute_t *create_main_state(cluster_t *cluster, uint8_t value); +attribute_t *create_current_error_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_overall_current_state(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_overall_target_state(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_latch_control_modes(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_stop(cluster_t *cluster); +command_t *create_move_to(cluster_t *cluster); +command_t *create_calibrate(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_operational_error(cluster_t *cluster); +event_t *create_movement_completed(cluster_t *cluster); +event_t *create_engage_state_changed(cluster_t *cluster); +event_t *create_secure_state_changed(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + uint32_t feature_flags; + config() : delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* closure_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/closure_control/closure_control_ids.h b/components/esp_matter/data_model/generated/clusters/closure_control/closure_control_ids.h new file mode 100644 index 000000000..503b3a073 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/closure_control/closure_control_ids.h @@ -0,0 +1,106 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace closure_control { + +inline constexpr uint32_t Id = 0x0104; + +namespace feature { +namespace Positioning { +inline constexpr uint32_t Id = 0x1; +} /* Positioning */ +namespace MotionLatching { +inline constexpr uint32_t Id = 0x2; +} /* MotionLatching */ +namespace Instantaneous { +inline constexpr uint32_t Id = 0x4; +} /* Instantaneous */ +namespace Speed { +inline constexpr uint32_t Id = 0x8; +} /* Speed */ +namespace Ventilation { +inline constexpr uint32_t Id = 0x10; +} /* Ventilation */ +namespace Pedestrian { +inline constexpr uint32_t Id = 0x20; +} /* Pedestrian */ +namespace Calibration { +inline constexpr uint32_t Id = 0x40; +} /* Calibration */ +namespace Protection { +inline constexpr uint32_t Id = 0x80; +} /* Protection */ +namespace ManuallyOperable { +inline constexpr uint32_t Id = 0x100; +} /* ManuallyOperable */ +} /* feature */ + +namespace attribute { +namespace CountdownTime { +inline constexpr uint32_t Id = 0x0000; +} /* CountdownTime */ +namespace MainState { +inline constexpr uint32_t Id = 0x0001; +} /* MainState */ +namespace CurrentErrorList { +inline constexpr uint32_t Id = 0x0002; +} /* CurrentErrorList */ +namespace OverallCurrentState { +inline constexpr uint32_t Id = 0x0003; +} /* OverallCurrentState */ +namespace OverallTargetState { +inline constexpr uint32_t Id = 0x0004; +} /* OverallTargetState */ +namespace LatchControlModes { +inline constexpr uint32_t Id = 0x0005; +} /* LatchControlModes */ +} /* attribute */ + +namespace command { +namespace Stop { +inline constexpr uint32_t Id = 0x00; +} /* Stop */ +namespace MoveTo { +inline constexpr uint32_t Id = 0x01; +} /* MoveTo */ +namespace Calibrate { +inline constexpr uint32_t Id = 0x02; +} /* Calibrate */ +} /* command */ + +namespace event { +namespace OperationalError { +inline constexpr uint32_t Id = 0x00; +} /* OperationalError */ +namespace MovementCompleted { +inline constexpr uint32_t Id = 0x01; +} /* MovementCompleted */ +namespace EngageStateChanged { +inline constexpr uint32_t Id = 0x02; +} /* EngageStateChanged */ +namespace SecureStateChanged { +inline constexpr uint32_t Id = 0x03; +} /* SecureStateChanged */ +} /* event */ + +} /* closure_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/closure_dimension/closure_dimension.cpp b/components/esp_matter/data_model/generated/clusters/closure_dimension/closure_dimension.cpp new file mode 100644 index 000000000..719f952cc --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/closure_dimension/closure_dimension.cpp @@ -0,0 +1,364 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "closure_dimension_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace closure_dimension { + +namespace feature { +namespace positioning { +uint32_t get_id() +{ + return Positioning::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_resolution(cluster, 0); + attribute::create_step_value(cluster, 0); + command::create_step(cluster); + + return ESP_OK; +} +} /* positioning */ + +namespace motion_latching { +uint32_t get_id() +{ + return MotionLatching::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_latch_control_modes(cluster, 0); + + return ESP_OK; +} +} /* motion_latching */ + +namespace unit { +uint32_t get_id() +{ + return Unit::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(positioning), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_unit(cluster, 0); + attribute::create_unit_range(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* unit */ + +namespace limitation { +uint32_t get_id() +{ + return Limitation::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(positioning), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_limit_range(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* limitation */ + +namespace speed { +uint32_t get_id() +{ + return Speed::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(positioning), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* speed */ + +namespace translation { +uint32_t get_id() +{ + return Translation::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(positioning), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_translation_direction(cluster, 0); + + return ESP_OK; +} +} /* translation */ + +namespace rotation { +uint32_t get_id() +{ + return Rotation::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(positioning), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_rotation_axis(cluster, 0); + attribute::create_overflow(cluster, 0); + + return ESP_OK; +} +} /* rotation */ + +namespace modulation { +uint32_t get_id() +{ + return Modulation::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(positioning), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_modulation_type(cluster, 0); + + return ESP_OK; +} +} /* modulation */ + +} /* feature */ + +namespace attribute { +attribute_t *create_current_state(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CurrentState::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_target_state(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, TargetState::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_resolution(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(positioning), NULL); + return esp_matter::attribute::create(cluster, Resolution::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_step_value(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(positioning), NULL); + return esp_matter::attribute::create(cluster, StepValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_unit(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(unit), NULL); + return esp_matter::attribute::create(cluster, Unit::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_unit_range(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(unit), NULL); + return esp_matter::attribute::create(cluster, UnitRange::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_limit_range(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(limitation), NULL); + return esp_matter::attribute::create(cluster, LimitRange::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_translation_direction(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(translation), NULL); + return esp_matter::attribute::create(cluster, TranslationDirection::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_rotation_axis(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(rotation), NULL); + return esp_matter::attribute::create(cluster, RotationAxis::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_overflow(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(rotation), NULL); + return esp_matter::attribute::create(cluster, Overflow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_modulation_type(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(modulation), NULL); + return esp_matter::attribute::create(cluster, ModulationType::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_latch_control_modes(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(motion_latching), NULL); + return esp_matter::attribute::create(cluster, LatchControlModes::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_bitmap8(value)); +} + +} /* attribute */ +namespace command { +command_t *create_set_target(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SetTarget::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_step(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(positioning), NULL); + return esp_matter::command::create(cluster, Step::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, closure_dimension::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, closure_dimension::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ClosureDimensionDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterClosureDimensionPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_current_state(cluster, NULL, 0, 0); + attribute::create_target_state(cluster, NULL, 0, 0); + + uint32_t feature_map = config->feature_flags; + if (feature_map & feature::positioning::get_id()) { + VALIDATE_FEATURES_EXACT_ONE("Translation,Rotation,Modulation", + feature::translation::get_id(), feature::rotation::get_id(), feature::modulation::get_id()); + if (feature_map & feature::translation::get_id()) { + VerifyOrReturnValue(feature::translation::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::rotation::get_id()) { + VerifyOrReturnValue(feature::rotation::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::modulation::get_id()) { + VerifyOrReturnValue(feature::modulation::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + VALIDATE_FEATURES_AT_LEAST_ONE("Positioning,MotionLatching", + feature::positioning::get_id(), feature::motion_latching::get_id()); + if (feature_map & feature::positioning::get_id()) { + VerifyOrReturnValue(feature::positioning::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::motion_latching::get_id()) { + VerifyOrReturnValue(feature::motion_latching::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::unit::get_id()) { + VerifyOrReturnValue(feature::unit::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::limitation::get_id()) { + VerifyOrReturnValue(feature::limitation::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::speed::get_id()) { + VerifyOrReturnValue(feature::speed::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + command::create_set_target(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* closure_dimension */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/closure_dimension/closure_dimension.h b/components/esp_matter/data_model/generated/clusters/closure_dimension/closure_dimension.h new file mode 100644 index 000000000..e291d5f6b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/closure_dimension/closure_dimension.h @@ -0,0 +1,97 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace closure_dimension { + +namespace feature { +namespace positioning { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* positioning */ + +namespace motion_latching { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* motion_latching */ + +namespace unit { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* unit */ + +namespace limitation { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* limitation */ + +namespace speed { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* speed */ + +namespace translation { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* translation */ + +namespace rotation { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* rotation */ + +namespace modulation { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* modulation */ + +} /* feature */ + +namespace attribute { +attribute_t *create_current_state(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_target_state(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_resolution(cluster_t *cluster, uint16_t value); +attribute_t *create_step_value(cluster_t *cluster, uint16_t value); +attribute_t *create_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_unit_range(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_limit_range(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_translation_direction(cluster_t *cluster, uint8_t value); +attribute_t *create_rotation_axis(cluster_t *cluster, uint8_t value); +attribute_t *create_overflow(cluster_t *cluster, uint8_t value); +attribute_t *create_modulation_type(cluster_t *cluster, uint8_t value); +attribute_t *create_latch_control_modes(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_set_target(cluster_t *cluster); +command_t *create_step(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + uint32_t feature_flags; + config() : delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* closure_dimension */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/closure_dimension/closure_dimension_ids.h b/components/esp_matter/data_model/generated/clusters/closure_dimension/closure_dimension_ids.h new file mode 100644 index 000000000..7b4d494ad --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/closure_dimension/closure_dimension_ids.h @@ -0,0 +1,103 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace closure_dimension { + +inline constexpr uint32_t Id = 0x0105; + +namespace feature { +namespace Positioning { +inline constexpr uint32_t Id = 0x1; +} /* Positioning */ +namespace MotionLatching { +inline constexpr uint32_t Id = 0x2; +} /* MotionLatching */ +namespace Unit { +inline constexpr uint32_t Id = 0x4; +} /* Unit */ +namespace Limitation { +inline constexpr uint32_t Id = 0x8; +} /* Limitation */ +namespace Speed { +inline constexpr uint32_t Id = 0x10; +} /* Speed */ +namespace Translation { +inline constexpr uint32_t Id = 0x20; +} /* Translation */ +namespace Rotation { +inline constexpr uint32_t Id = 0x40; +} /* Rotation */ +namespace Modulation { +inline constexpr uint32_t Id = 0x80; +} /* Modulation */ +} /* feature */ + +namespace attribute { +namespace CurrentState { +inline constexpr uint32_t Id = 0x0000; +} /* CurrentState */ +namespace TargetState { +inline constexpr uint32_t Id = 0x0001; +} /* TargetState */ +namespace Resolution { +inline constexpr uint32_t Id = 0x0002; +} /* Resolution */ +namespace StepValue { +inline constexpr uint32_t Id = 0x0003; +} /* StepValue */ +namespace Unit { +inline constexpr uint32_t Id = 0x0004; +} /* Unit */ +namespace UnitRange { +inline constexpr uint32_t Id = 0x0005; +} /* UnitRange */ +namespace LimitRange { +inline constexpr uint32_t Id = 0x0006; +} /* LimitRange */ +namespace TranslationDirection { +inline constexpr uint32_t Id = 0x0007; +} /* TranslationDirection */ +namespace RotationAxis { +inline constexpr uint32_t Id = 0x0008; +} /* RotationAxis */ +namespace Overflow { +inline constexpr uint32_t Id = 0x0009; +} /* Overflow */ +namespace ModulationType { +inline constexpr uint32_t Id = 0x000A; +} /* ModulationType */ +namespace LatchControlModes { +inline constexpr uint32_t Id = 0x000B; +} /* LatchControlModes */ +} /* attribute */ + +namespace command { +namespace SetTarget { +inline constexpr uint32_t Id = 0x00; +} /* SetTarget */ +namespace Step { +inline constexpr uint32_t Id = 0x01; +} /* Step */ +} /* command */ + +} /* closure_dimension */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/color_control/color_control.cpp b/components/esp_matter/data_model/generated/clusters/color_control/color_control.cpp new file mode 100644 index 000000000..3c1d82a9d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/color_control/color_control.cpp @@ -0,0 +1,965 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "color_control_cluster"; +constexpr uint16_t cluster_revision = 8; + +static esp_err_t esp_matter_command_callback_move_to_hue(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::MoveToHue::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterMoveToHueCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_move_hue(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::MoveHue::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterMoveHueCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_step_hue(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::StepHue::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterStepHueCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_move_to_saturation(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::MoveToSaturation::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterMoveToSaturationCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_move_saturation(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::MoveSaturation::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterMoveSaturationCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_step_saturation(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::StepSaturation::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterStepSaturationCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_move_to_hue_and_saturation(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterMoveToHueAndSaturationCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_move_to_color(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::MoveToColor::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterMoveToColorCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_move_color(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::MoveColor::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterMoveColorCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_step_color(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::StepColor::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterStepColorCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_move_to_color_temperature(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterMoveToColorTemperatureCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_enhanced_move_to_hue(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterEnhancedMoveToHueCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_enhanced_move_hue(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterEnhancedMoveHueCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_enhanced_step_hue(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterEnhancedStepHueCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_enhanced_move_to_hue_and_saturation(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHueAndSaturation::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterEnhancedMoveToHueAndSaturationCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_color_loop_set(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterColorLoopSetCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_stop_move_step(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::StopMoveStep::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterStopMoveStepCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_move_color_temperature(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterMoveColorTemperatureCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_step_color_temperature(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ColorControl::Commands::StepColorTemperature::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfColorControlClusterStepColorTemperatureCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace color_control { + +namespace feature { +namespace hue_saturation { +uint32_t get_id() +{ + return HueSaturation::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_current_hue(cluster, config->current_hue); + attribute::create_current_saturation(cluster, config->current_saturation); + command::create_move_to_hue(cluster); + command::create_move_hue(cluster); + command::create_step_hue(cluster); + command::create_move_to_saturation(cluster); + command::create_move_saturation(cluster); + command::create_step_saturation(cluster); + command::create_move_to_hue_and_saturation(cluster); + command::create_stop_move_step(cluster); + + return ESP_OK; +} +} /* hue_saturation */ + +namespace enhanced_hue { +uint32_t get_id() +{ + return EnhancedHue::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_enhanced_current_hue(cluster, config->enhanced_current_hue); + command::create_enhanced_move_to_hue(cluster); + command::create_enhanced_move_hue(cluster); + command::create_enhanced_step_hue(cluster); + command::create_enhanced_move_to_hue_and_saturation(cluster); + + return ESP_OK; +} +} /* enhanced_hue */ + +namespace color_loop { +uint32_t get_id() +{ + return ColorLoop::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_color_loop_active(cluster, config->color_loop_active); + attribute::create_color_loop_direction(cluster, config->color_loop_direction); + attribute::create_color_loop_time(cluster, config->color_loop_time); + attribute::create_color_loop_start_enhanced_hue(cluster, config->color_loop_start_enhanced_hue); + attribute::create_color_loop_stored_enhanced_hue(cluster, config->color_loop_stored_enhanced_hue); + command::create_color_loop_set(cluster); + + return ESP_OK; +} +} /* color_loop */ + +namespace xy { +uint32_t get_id() +{ + return XY::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_current_x(cluster, config->current_x); + attribute::create_current_y(cluster, config->current_y); + command::create_move_to_color(cluster); + command::create_move_color(cluster); + command::create_step_color(cluster); + command::create_stop_move_step(cluster); + + return ESP_OK; +} +} /* xy */ + +namespace color_temperature { +uint32_t get_id() +{ + return ColorTemperature::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_color_temperature_mireds(cluster, config->color_temperature_mireds); + attribute::create_color_temp_physical_min_mireds(cluster, config->color_temp_physical_min_mireds); + attribute::create_color_temp_physical_max_mireds(cluster, config->color_temp_physical_max_mireds); + attribute::create_couple_color_temp_to_level_min_mireds(cluster, config->couple_color_temp_to_level_min_mireds); + attribute::create_start_up_color_temperature_mireds(cluster, config->start_up_color_temperature_mireds); + command::create_move_to_color_temperature(cluster); + command::create_stop_move_step(cluster); + command::create_move_color_temperature(cluster); + command::create_step_color_temperature(cluster); + + return ESP_OK; +} +} /* color_temperature */ + +} /* feature */ + +namespace attribute { +attribute_t *create_current_hue(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(hue_saturation), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentHue::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_current_saturation(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(hue_saturation), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentSaturation::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, RemainingTime::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_current_x(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(xy), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentX::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_current_y(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(xy), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentY::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_drift_compensation(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, DriftCompensation::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(4)); + return attribute; +} + +attribute_t *create_compensation_text(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_compensation_text_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, CompensationText::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_compensation_text_length + 1); +} + +attribute_t *create_color_temperature_mireds(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_temperature), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorTemperatureMireds::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_color_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorMode::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_options(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Options::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(1)); + return attribute; +} + +attribute_t *create_number_of_primaries(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfPrimaries::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(6)); + return attribute; +} + +attribute_t *create_primary_1_x(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary1X::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_primary_1_y(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary1Y::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_primary_1_intensity(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary1Intensity::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_primary_2_x(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary2X::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_primary_2_y(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary2Y::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_primary_2_intensity(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary2Intensity::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_primary_3_x(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary3X::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_primary_3_y(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary3Y::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_primary_3_intensity(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary3Intensity::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_primary_4_x(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary4X::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_primary_4_y(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary4Y::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_primary_4_intensity(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary4Intensity::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_primary_5_x(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary5X::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_primary_5_y(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary5Y::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_primary_5_intensity(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary5Intensity::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_primary_6_x(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary6X::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_primary_6_y(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary6Y::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_primary_6_intensity(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Primary6Intensity::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_white_point_x(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, WhitePointX::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_white_point_y(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, WhitePointY::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_color_point_rx(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorPointRX::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_color_point_ry(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorPointRY::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_color_point_r_intensity(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorPointRIntensity::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_color_point_gx(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorPointGX::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_color_point_gy(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorPointGY::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_color_point_g_intensity(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorPointGIntensity::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_color_point_bx(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorPointBX::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_color_point_by(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorPointBY::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_color_point_b_intensity(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorPointBIntensity::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_enhanced_current_hue(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(enhanced_hue), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, EnhancedCurrentHue::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_enhanced_color_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, EnhancedColorMode::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(3)); + return attribute; +} + +attribute_t *create_color_loop_active(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_loop), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorLoopActive::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(1)); + return attribute; +} + +attribute_t *create_color_loop_direction(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_loop), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorLoopDirection::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(1)); + return attribute; +} + +attribute_t *create_color_loop_time(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_loop), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorLoopTime::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_color_loop_start_enhanced_hue(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_loop), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorLoopStartEnhancedHue::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_color_loop_stored_enhanced_hue(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_loop), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorLoopStoredEnhancedHue::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_color_capabilities(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorCapabilities::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap16(0), esp_matter_bitmap16(65535)); + return attribute; +} + +attribute_t *create_color_temp_physical_min_mireds(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_temperature), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorTempPhysicalMinMireds::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(1), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_color_temp_physical_max_mireds(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_temperature), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ColorTempPhysicalMaxMireds::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65279)); + return attribute; +} + +attribute_t *create_couple_color_temp_to_level_min_mireds(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_temperature), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CoupleColorTempToLevelMinMireds::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_start_up_color_temperature_mireds(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_temperature), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, StartUpColorTemperatureMireds::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(1), esp_matter_nullable_uint16(65279)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_move_to_hue(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(hue_saturation), NULL); + return esp_matter::command::create(cluster, MoveToHue::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_to_hue); +} + +command_t *create_move_hue(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(hue_saturation), NULL); + return esp_matter::command::create(cluster, MoveHue::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_hue); +} + +command_t *create_step_hue(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(hue_saturation), NULL); + return esp_matter::command::create(cluster, StepHue::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_step_hue); +} + +command_t *create_move_to_saturation(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(hue_saturation), NULL); + return esp_matter::command::create(cluster, MoveToSaturation::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_to_saturation); +} + +command_t *create_move_saturation(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(hue_saturation), NULL); + return esp_matter::command::create(cluster, MoveSaturation::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_saturation); +} + +command_t *create_step_saturation(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(hue_saturation), NULL); + return esp_matter::command::create(cluster, StepSaturation::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_step_saturation); +} + +command_t *create_move_to_hue_and_saturation(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(hue_saturation), NULL); + return esp_matter::command::create(cluster, MoveToHueAndSaturation::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_to_hue_and_saturation); +} + +command_t *create_move_to_color(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(xy), NULL); + return esp_matter::command::create(cluster, MoveToColor::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_to_color); +} + +command_t *create_move_color(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(xy), NULL); + return esp_matter::command::create(cluster, MoveColor::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_color); +} + +command_t *create_step_color(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(xy), NULL); + return esp_matter::command::create(cluster, StepColor::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_step_color); +} + +command_t *create_move_to_color_temperature(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_temperature), NULL); + return esp_matter::command::create(cluster, MoveToColorTemperature::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_to_color_temperature); +} + +command_t *create_enhanced_move_to_hue(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(enhanced_hue), NULL); + return esp_matter::command::create(cluster, EnhancedMoveToHue::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_enhanced_move_to_hue); +} + +command_t *create_enhanced_move_hue(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(enhanced_hue), NULL); + return esp_matter::command::create(cluster, EnhancedMoveHue::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_enhanced_move_hue); +} + +command_t *create_enhanced_step_hue(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(enhanced_hue), NULL); + return esp_matter::command::create(cluster, EnhancedStepHue::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_enhanced_step_hue); +} + +command_t *create_enhanced_move_to_hue_and_saturation(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(enhanced_hue), NULL); + return esp_matter::command::create(cluster, EnhancedMoveToHueAndSaturation::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_enhanced_move_to_hue_and_saturation); +} + +command_t *create_color_loop_set(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_loop), NULL); + return esp_matter::command::create(cluster, ColorLoopSet::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_color_loop_set); +} + +command_t *create_stop_move_step(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(hue_saturation)) || (has_feature(xy)) || (has_feature(color_temperature))), NULL); + return esp_matter::command::create(cluster, StopMoveStep::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_stop_move_step); +} + +command_t *create_move_color_temperature(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_temperature), NULL); + return esp_matter::command::create(cluster, MoveColorTemperature::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_color_temperature); +} + +command_t *create_step_color_temperature(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(color_temperature), NULL); + return esp_matter::command::create(cluster, StepColorTemperature::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_step_color_temperature); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t function_list[] = { + (function_generic_t)emberAfColorControlClusterServerInitCallback, + (function_generic_t)MatterColorControlClusterServerShutdownCallback, +}; + +const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_SHUTDOWN_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, color_control::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, color_control::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterColorControlPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_color_mode(cluster, config->color_mode); + attribute::create_options(cluster, config->options); + attribute::create_number_of_primaries(cluster, config->number_of_primaries); + attribute::create_primary_1_x(cluster, config->primary_1_x); + attribute::create_primary_1_y(cluster, config->primary_1_y); + attribute::create_primary_1_intensity(cluster, config->primary_1_intensity); + attribute::create_primary_2_x(cluster, config->primary_2_x); + attribute::create_primary_2_y(cluster, config->primary_2_y); + attribute::create_primary_2_intensity(cluster, config->primary_2_intensity); + attribute::create_primary_3_x(cluster, config->primary_3_x); + attribute::create_primary_3_y(cluster, config->primary_3_y); + attribute::create_primary_3_intensity(cluster, config->primary_3_intensity); + attribute::create_primary_4_x(cluster, config->primary_4_x); + attribute::create_primary_4_y(cluster, config->primary_4_y); + attribute::create_primary_4_intensity(cluster, config->primary_4_intensity); + attribute::create_primary_5_x(cluster, config->primary_5_x); + attribute::create_primary_5_y(cluster, config->primary_5_y); + attribute::create_primary_5_intensity(cluster, config->primary_5_intensity); + attribute::create_primary_6_x(cluster, config->primary_6_x); + attribute::create_primary_6_y(cluster, config->primary_6_y); + attribute::create_primary_6_intensity(cluster, config->primary_6_intensity); + attribute::create_enhanced_color_mode(cluster, config->enhanced_color_mode); + attribute::create_color_capabilities(cluster, config->color_capabilities); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* color_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/color_control/color_control.h b/components/esp_matter/data_model/generated/clusters/color_control/color_control.h new file mode 100644 index 000000000..3bcb95d52 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/color_control/color_control.h @@ -0,0 +1,191 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace color_control { + +const uint8_t k_max_compensation_text_length = 254u; +namespace feature { +namespace hue_saturation { +typedef struct config { + uint8_t current_hue; + uint8_t current_saturation; + config() : current_hue(0), current_saturation(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* hue_saturation */ + +namespace enhanced_hue { +typedef struct config { + uint16_t enhanced_current_hue; + config() : enhanced_current_hue(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* enhanced_hue */ + +namespace color_loop { +typedef struct config { + uint8_t color_loop_active; + uint8_t color_loop_direction; + uint16_t color_loop_time; + uint16_t color_loop_start_enhanced_hue; + uint16_t color_loop_stored_enhanced_hue; + config() : color_loop_active(0), color_loop_direction(0), color_loop_time(0), color_loop_start_enhanced_hue(0), color_loop_stored_enhanced_hue(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* color_loop */ + +namespace xy { +typedef struct config { + uint16_t current_x; + uint16_t current_y; + config() : current_x(0), current_y(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* xy */ + +namespace color_temperature { +typedef struct config { + uint16_t color_temperature_mireds; + uint16_t color_temp_physical_min_mireds; + uint16_t color_temp_physical_max_mireds; + uint16_t couple_color_temp_to_level_min_mireds; + nullable start_up_color_temperature_mireds; + config() : color_temperature_mireds(0), color_temp_physical_min_mireds(0), color_temp_physical_max_mireds(0), couple_color_temp_to_level_min_mireds(0), start_up_color_temperature_mireds(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* color_temperature */ + +} /* feature */ + +namespace attribute { +attribute_t *create_current_hue(cluster_t *cluster, uint8_t value); +attribute_t *create_current_saturation(cluster_t *cluster, uint8_t value); +attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value); +attribute_t *create_current_x(cluster_t *cluster, uint16_t value); +attribute_t *create_current_y(cluster_t *cluster, uint16_t value); +attribute_t *create_drift_compensation(cluster_t *cluster, uint8_t value); +attribute_t *create_compensation_text(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_color_temperature_mireds(cluster_t *cluster, uint16_t value); +attribute_t *create_color_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_options(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_primaries(cluster_t *cluster, nullable value); +attribute_t *create_primary_1_x(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_1_y(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_1_intensity(cluster_t *cluster, nullable value); +attribute_t *create_primary_2_x(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_2_y(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_2_intensity(cluster_t *cluster, nullable value); +attribute_t *create_primary_3_x(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_3_y(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_3_intensity(cluster_t *cluster, nullable value); +attribute_t *create_primary_4_x(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_4_y(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_4_intensity(cluster_t *cluster, nullable value); +attribute_t *create_primary_5_x(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_5_y(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_5_intensity(cluster_t *cluster, nullable value); +attribute_t *create_primary_6_x(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_6_y(cluster_t *cluster, uint16_t value); +attribute_t *create_primary_6_intensity(cluster_t *cluster, nullable value); +attribute_t *create_white_point_x(cluster_t *cluster, uint16_t value); +attribute_t *create_white_point_y(cluster_t *cluster, uint16_t value); +attribute_t *create_color_point_rx(cluster_t *cluster, uint16_t value); +attribute_t *create_color_point_ry(cluster_t *cluster, uint16_t value); +attribute_t *create_color_point_r_intensity(cluster_t *cluster, nullable value); +attribute_t *create_color_point_gx(cluster_t *cluster, uint16_t value); +attribute_t *create_color_point_gy(cluster_t *cluster, uint16_t value); +attribute_t *create_color_point_g_intensity(cluster_t *cluster, nullable value); +attribute_t *create_color_point_bx(cluster_t *cluster, uint16_t value); +attribute_t *create_color_point_by(cluster_t *cluster, uint16_t value); +attribute_t *create_color_point_b_intensity(cluster_t *cluster, nullable value); +attribute_t *create_enhanced_current_hue(cluster_t *cluster, uint16_t value); +attribute_t *create_enhanced_color_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_color_loop_active(cluster_t *cluster, uint8_t value); +attribute_t *create_color_loop_direction(cluster_t *cluster, uint8_t value); +attribute_t *create_color_loop_time(cluster_t *cluster, uint16_t value); +attribute_t *create_color_loop_start_enhanced_hue(cluster_t *cluster, uint16_t value); +attribute_t *create_color_loop_stored_enhanced_hue(cluster_t *cluster, uint16_t value); +attribute_t *create_color_capabilities(cluster_t *cluster, uint16_t value); +attribute_t *create_color_temp_physical_min_mireds(cluster_t *cluster, uint16_t value); +attribute_t *create_color_temp_physical_max_mireds(cluster_t *cluster, uint16_t value); +attribute_t *create_couple_color_temp_to_level_min_mireds(cluster_t *cluster, uint16_t value); +attribute_t *create_start_up_color_temperature_mireds(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_move_to_hue(cluster_t *cluster); +command_t *create_move_hue(cluster_t *cluster); +command_t *create_step_hue(cluster_t *cluster); +command_t *create_move_to_saturation(cluster_t *cluster); +command_t *create_move_saturation(cluster_t *cluster); +command_t *create_step_saturation(cluster_t *cluster); +command_t *create_move_to_hue_and_saturation(cluster_t *cluster); +command_t *create_move_to_color(cluster_t *cluster); +command_t *create_move_color(cluster_t *cluster); +command_t *create_step_color(cluster_t *cluster); +command_t *create_move_to_color_temperature(cluster_t *cluster); +command_t *create_enhanced_move_to_hue(cluster_t *cluster); +command_t *create_enhanced_move_hue(cluster_t *cluster); +command_t *create_enhanced_step_hue(cluster_t *cluster); +command_t *create_enhanced_move_to_hue_and_saturation(cluster_t *cluster); +command_t *create_color_loop_set(cluster_t *cluster); +command_t *create_stop_move_step(cluster_t *cluster); +command_t *create_move_color_temperature(cluster_t *cluster); +command_t *create_step_color_temperature(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t color_mode; + uint8_t options; + nullable number_of_primaries; + uint16_t primary_1_x; + uint16_t primary_1_y; + nullable primary_1_intensity; + uint16_t primary_2_x; + uint16_t primary_2_y; + nullable primary_2_intensity; + uint16_t primary_3_x; + uint16_t primary_3_y; + nullable primary_3_intensity; + uint16_t primary_4_x; + uint16_t primary_4_y; + nullable primary_4_intensity; + uint16_t primary_5_x; + uint16_t primary_5_y; + nullable primary_5_intensity; + uint16_t primary_6_x; + uint16_t primary_6_y; + nullable primary_6_intensity; + uint8_t enhanced_color_mode; + uint16_t color_capabilities; + config() : color_mode(0), options(0), number_of_primaries(0), primary_1_x(0), primary_1_y(0), primary_1_intensity(0), primary_2_x(0), primary_2_y(0), primary_2_intensity(0), primary_3_x(0), primary_3_y(0), primary_3_intensity(0), primary_4_x(0), primary_4_y(0), primary_4_intensity(0), primary_5_x(0), primary_5_y(0), primary_5_intensity(0), primary_6_x(0), primary_6_y(0), primary_6_intensity(0), enhanced_color_mode(0), color_capabilities(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* color_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/color_control/color_control_ids.h b/components/esp_matter/data_model/generated/clusters/color_control/color_control_ids.h new file mode 100644 index 000000000..4b4cb9e67 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/color_control/color_control_ids.h @@ -0,0 +1,265 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace color_control { + +inline constexpr uint32_t Id = 0x0300; + +namespace feature { +namespace HueSaturation { +inline constexpr uint32_t Id = 0x1; +} /* HueSaturation */ +namespace EnhancedHue { +inline constexpr uint32_t Id = 0x2; +} /* EnhancedHue */ +namespace ColorLoop { +inline constexpr uint32_t Id = 0x4; +} /* ColorLoop */ +namespace XY { +inline constexpr uint32_t Id = 0x8; +} /* XY */ +namespace ColorTemperature { +inline constexpr uint32_t Id = 0x10; +} /* ColorTemperature */ +} /* feature */ + +namespace attribute { +namespace CurrentHue { +inline constexpr uint32_t Id = 0x0000; +} /* CurrentHue */ +namespace CurrentSaturation { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentSaturation */ +namespace RemainingTime { +inline constexpr uint32_t Id = 0x0002; +} /* RemainingTime */ +namespace CurrentX { +inline constexpr uint32_t Id = 0x0003; +} /* CurrentX */ +namespace CurrentY { +inline constexpr uint32_t Id = 0x0004; +} /* CurrentY */ +namespace DriftCompensation { +inline constexpr uint32_t Id = 0x0005; +} /* DriftCompensation */ +namespace CompensationText { +inline constexpr uint32_t Id = 0x0006; +} /* CompensationText */ +namespace ColorTemperatureMireds { +inline constexpr uint32_t Id = 0x0007; +} /* ColorTemperatureMireds */ +namespace ColorMode { +inline constexpr uint32_t Id = 0x0008; +} /* ColorMode */ +namespace Options { +inline constexpr uint32_t Id = 0x000F; +} /* Options */ +namespace NumberOfPrimaries { +inline constexpr uint32_t Id = 0x0010; +} /* NumberOfPrimaries */ +namespace Primary1X { +inline constexpr uint32_t Id = 0x0011; +} /* Primary1X */ +namespace Primary1Y { +inline constexpr uint32_t Id = 0x0012; +} /* Primary1Y */ +namespace Primary1Intensity { +inline constexpr uint32_t Id = 0x0013; +} /* Primary1Intensity */ +namespace Primary2X { +inline constexpr uint32_t Id = 0x0015; +} /* Primary2X */ +namespace Primary2Y { +inline constexpr uint32_t Id = 0x0016; +} /* Primary2Y */ +namespace Primary2Intensity { +inline constexpr uint32_t Id = 0x0017; +} /* Primary2Intensity */ +namespace Primary3X { +inline constexpr uint32_t Id = 0x0019; +} /* Primary3X */ +namespace Primary3Y { +inline constexpr uint32_t Id = 0x001A; +} /* Primary3Y */ +namespace Primary3Intensity { +inline constexpr uint32_t Id = 0x001B; +} /* Primary3Intensity */ +namespace Primary4X { +inline constexpr uint32_t Id = 0x0020; +} /* Primary4X */ +namespace Primary4Y { +inline constexpr uint32_t Id = 0x0021; +} /* Primary4Y */ +namespace Primary4Intensity { +inline constexpr uint32_t Id = 0x0022; +} /* Primary4Intensity */ +namespace Primary5X { +inline constexpr uint32_t Id = 0x0024; +} /* Primary5X */ +namespace Primary5Y { +inline constexpr uint32_t Id = 0x0025; +} /* Primary5Y */ +namespace Primary5Intensity { +inline constexpr uint32_t Id = 0x0026; +} /* Primary5Intensity */ +namespace Primary6X { +inline constexpr uint32_t Id = 0x0028; +} /* Primary6X */ +namespace Primary6Y { +inline constexpr uint32_t Id = 0x0029; +} /* Primary6Y */ +namespace Primary6Intensity { +inline constexpr uint32_t Id = 0x002A; +} /* Primary6Intensity */ +namespace WhitePointX { +inline constexpr uint32_t Id = 0x0030; +} /* WhitePointX */ +namespace WhitePointY { +inline constexpr uint32_t Id = 0x0031; +} /* WhitePointY */ +namespace ColorPointRX { +inline constexpr uint32_t Id = 0x0032; +} /* ColorPointRX */ +namespace ColorPointRY { +inline constexpr uint32_t Id = 0x0033; +} /* ColorPointRY */ +namespace ColorPointRIntensity { +inline constexpr uint32_t Id = 0x0034; +} /* ColorPointRIntensity */ +namespace ColorPointGX { +inline constexpr uint32_t Id = 0x0036; +} /* ColorPointGX */ +namespace ColorPointGY { +inline constexpr uint32_t Id = 0x0037; +} /* ColorPointGY */ +namespace ColorPointGIntensity { +inline constexpr uint32_t Id = 0x0038; +} /* ColorPointGIntensity */ +namespace ColorPointBX { +inline constexpr uint32_t Id = 0x003A; +} /* ColorPointBX */ +namespace ColorPointBY { +inline constexpr uint32_t Id = 0x003B; +} /* ColorPointBY */ +namespace ColorPointBIntensity { +inline constexpr uint32_t Id = 0x003C; +} /* ColorPointBIntensity */ +namespace EnhancedCurrentHue { +inline constexpr uint32_t Id = 0x4000; +} /* EnhancedCurrentHue */ +namespace EnhancedColorMode { +inline constexpr uint32_t Id = 0x4001; +} /* EnhancedColorMode */ +namespace ColorLoopActive { +inline constexpr uint32_t Id = 0x4002; +} /* ColorLoopActive */ +namespace ColorLoopDirection { +inline constexpr uint32_t Id = 0x4003; +} /* ColorLoopDirection */ +namespace ColorLoopTime { +inline constexpr uint32_t Id = 0x4004; +} /* ColorLoopTime */ +namespace ColorLoopStartEnhancedHue { +inline constexpr uint32_t Id = 0x4005; +} /* ColorLoopStartEnhancedHue */ +namespace ColorLoopStoredEnhancedHue { +inline constexpr uint32_t Id = 0x4006; +} /* ColorLoopStoredEnhancedHue */ +namespace ColorCapabilities { +inline constexpr uint32_t Id = 0x400A; +} /* ColorCapabilities */ +namespace ColorTempPhysicalMinMireds { +inline constexpr uint32_t Id = 0x400B; +} /* ColorTempPhysicalMinMireds */ +namespace ColorTempPhysicalMaxMireds { +inline constexpr uint32_t Id = 0x400C; +} /* ColorTempPhysicalMaxMireds */ +namespace CoupleColorTempToLevelMinMireds { +inline constexpr uint32_t Id = 0x400D; +} /* CoupleColorTempToLevelMinMireds */ +namespace StartUpColorTemperatureMireds { +inline constexpr uint32_t Id = 0x4010; +} /* StartUpColorTemperatureMireds */ +} /* attribute */ + +namespace command { +namespace MoveToHue { +inline constexpr uint32_t Id = 0x00; +} /* MoveToHue */ +namespace MoveHue { +inline constexpr uint32_t Id = 0x01; +} /* MoveHue */ +namespace StepHue { +inline constexpr uint32_t Id = 0x02; +} /* StepHue */ +namespace MoveToSaturation { +inline constexpr uint32_t Id = 0x03; +} /* MoveToSaturation */ +namespace MoveSaturation { +inline constexpr uint32_t Id = 0x04; +} /* MoveSaturation */ +namespace StepSaturation { +inline constexpr uint32_t Id = 0x05; +} /* StepSaturation */ +namespace MoveToHueAndSaturation { +inline constexpr uint32_t Id = 0x06; +} /* MoveToHueAndSaturation */ +namespace MoveToColor { +inline constexpr uint32_t Id = 0x07; +} /* MoveToColor */ +namespace MoveColor { +inline constexpr uint32_t Id = 0x08; +} /* MoveColor */ +namespace StepColor { +inline constexpr uint32_t Id = 0x09; +} /* StepColor */ +namespace MoveToColorTemperature { +inline constexpr uint32_t Id = 0x0A; +} /* MoveToColorTemperature */ +namespace EnhancedMoveToHue { +inline constexpr uint32_t Id = 0x40; +} /* EnhancedMoveToHue */ +namespace EnhancedMoveHue { +inline constexpr uint32_t Id = 0x41; +} /* EnhancedMoveHue */ +namespace EnhancedStepHue { +inline constexpr uint32_t Id = 0x42; +} /* EnhancedStepHue */ +namespace EnhancedMoveToHueAndSaturation { +inline constexpr uint32_t Id = 0x43; +} /* EnhancedMoveToHueAndSaturation */ +namespace ColorLoopSet { +inline constexpr uint32_t Id = 0x44; +} /* ColorLoopSet */ +namespace StopMoveStep { +inline constexpr uint32_t Id = 0x47; +} /* StopMoveStep */ +namespace MoveColorTemperature { +inline constexpr uint32_t Id = 0x4B; +} /* MoveColorTemperature */ +namespace StepColorTemperature { +inline constexpr uint32_t Id = 0x4C; +} /* StepColorTemperature */ +} /* command */ + +} /* color_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/commissioner_control/commissioner_control.cpp b/components/esp_matter/data_model/generated/clusters/commissioner_control/commissioner_control.cpp new file mode 100644 index 000000000..e8648effc --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/commissioner_control/commissioner_control.cpp @@ -0,0 +1,118 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "commissioner_control_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace commissioner_control { + +namespace attribute { +attribute_t *create_supported_device_categories(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SupportedDeviceCategories::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(4294967295)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_request_commissioning_approval(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RequestCommissioningApproval::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_commission_node(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CommissionNode::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_reverse_open_commissioning_window(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ReverseOpenCommissioningWindow::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_commissioning_request_result(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, CommissioningRequestResult::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, commissioner_control::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, commissioner_control::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = CommissionerControlDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterCommissionerControlPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_supported_device_categories(cluster, config->supported_device_categories); + command::create_request_commissioning_approval(cluster); + command::create_commission_node(cluster); + command::create_reverse_open_commissioning_window(cluster); + /* Events */ + event::create_commissioning_request_result(cluster); + } + + return cluster; +} + +} /* commissioner_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/commissioner_control/commissioner_control.h b/components/esp_matter/data_model/generated/clusters/commissioner_control/commissioner_control.h new file mode 100644 index 000000000..f7978364d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/commissioner_control/commissioner_control.h @@ -0,0 +1,48 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace commissioner_control { + +namespace attribute { +attribute_t *create_supported_device_categories(cluster_t *cluster, uint32_t value); +} /* attribute */ + +namespace command { +command_t *create_request_commissioning_approval(cluster_t *cluster); +command_t *create_commission_node(cluster_t *cluster); +command_t *create_reverse_open_commissioning_window(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_commissioning_request_result(cluster_t *cluster); +} /* event */ + +typedef struct config { + uint32_t supported_device_categories; + void *delegate; + config() : supported_device_categories(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* commissioner_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/commissioner_control/commissioner_control_ids.h b/components/esp_matter/data_model/generated/clusters/commissioner_control/commissioner_control_ids.h new file mode 100644 index 000000000..d09f5fff7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/commissioner_control/commissioner_control_ids.h @@ -0,0 +1,52 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace commissioner_control { + +inline constexpr uint32_t Id = 0x0751; + +namespace attribute { +namespace SupportedDeviceCategories { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedDeviceCategories */ +} /* attribute */ + +namespace command { +namespace RequestCommissioningApproval { +inline constexpr uint32_t Id = 0x00; +} /* RequestCommissioningApproval */ +namespace CommissionNode { +inline constexpr uint32_t Id = 0x01; +} /* CommissionNode */ +namespace ReverseOpenCommissioningWindow { +inline constexpr uint32_t Id = 0x02; +} /* ReverseOpenCommissioningWindow */ +} /* command */ + +namespace event { +namespace CommissioningRequestResult { +inline constexpr uint32_t Id = 0x00; +} /* CommissioningRequestResult */ +} /* event */ + +} /* commissioner_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/commodity_metering/commodity_metering.cpp b/components/esp_matter/data_model/generated/clusters/commodity_metering/commodity_metering.cpp new file mode 100644 index 000000000..91d2021f0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/commodity_metering/commodity_metering.cpp @@ -0,0 +1,107 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "commodity_metering_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace commodity_metering { + +namespace attribute { +attribute_t *create_metered_quantity(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, MeteredQuantity::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_metered_quantity_timestamp(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, MeteredQuantityTimestamp::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_tariff_unit(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, TariffUnit::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); +} + +attribute_t *create_maximum_metered_quantities(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, MaximumMeteredQuantities::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, commodity_metering::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, commodity_metering::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterCommodityMeteringPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_metered_quantity(cluster, NULL, 0, 0); + attribute::create_metered_quantity_timestamp(cluster, 0); + attribute::create_tariff_unit(cluster, 0); + attribute::create_maximum_metered_quantities(cluster, 0); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* commodity_metering */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/commodity_metering/commodity_metering.h b/components/esp_matter/data_model/generated/clusters/commodity_metering/commodity_metering.h new file mode 100644 index 000000000..afb2c613a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/commodity_metering/commodity_metering.h @@ -0,0 +1,39 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace commodity_metering { + +namespace attribute { +attribute_t *create_metered_quantity(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_metered_quantity_timestamp(cluster_t *cluster, nullable value); +attribute_t *create_tariff_unit(cluster_t *cluster, nullable value); +attribute_t *create_maximum_metered_quantities(cluster_t *cluster, nullable value); +} /* attribute */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* commodity_metering */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/commodity_metering/commodity_metering_ids.h b/components/esp_matter/data_model/generated/clusters/commodity_metering/commodity_metering_ids.h new file mode 100644 index 000000000..fbb648e5a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/commodity_metering/commodity_metering_ids.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace commodity_metering { + +inline constexpr uint32_t Id = 0x0B07; + +namespace attribute { +namespace MeteredQuantity { +inline constexpr uint32_t Id = 0x0000; +} /* MeteredQuantity */ +namespace MeteredQuantityTimestamp { +inline constexpr uint32_t Id = 0x0001; +} /* MeteredQuantityTimestamp */ +namespace TariffUnit { +inline constexpr uint32_t Id = 0x0002; +} /* TariffUnit */ +namespace MaximumMeteredQuantities { +inline constexpr uint32_t Id = 0x0003; +} /* MaximumMeteredQuantities */ +} /* attribute */ + +} /* commodity_metering */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/commodity_price/commodity_price.cpp b/components/esp_matter/data_model/generated/clusters/commodity_price/commodity_price.cpp new file mode 100644 index 000000000..5d6ac3aa8 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/commodity_price/commodity_price.cpp @@ -0,0 +1,165 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "commodity_price_cluster"; +constexpr uint16_t cluster_revision = 4; + +namespace esp_matter { +namespace cluster { +namespace commodity_price { + +namespace feature { +namespace forecasting { +uint32_t get_id() +{ + return Forecasting::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_price_forecast(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* forecasting */ + +} /* feature */ + +namespace attribute { +attribute_t *create_tariff_unit(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, TariffUnit::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_currency(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Currency::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_price(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CurrentPrice::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_price_forecast(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(forecasting), NULL); + return esp_matter::attribute::create(cluster, PriceForecast::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_get_detailed_price_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetDetailedPriceRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_get_detailed_price_response(cluster_t *cluster) +{ + VerifyOrReturnValue(has_command(GetDetailedPriceRequest, COMMAND_FLAG_ACCEPTED), NULL); + return esp_matter::command::create(cluster, GetDetailedPriceResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_get_detailed_forecast_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetDetailedForecastRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_get_detailed_forecast_response(cluster_t *cluster) +{ + VerifyOrReturnValue(has_command(GetDetailedForecastRequest, COMMAND_FLAG_ACCEPTED), NULL); + return esp_matter::command::create(cluster, GetDetailedForecastResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_price_change(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, PriceChange::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, commodity_price::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, commodity_price::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = CommodityPriceDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterCommodityPricePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_tariff_unit(cluster, 0); + attribute::create_currency(cluster, NULL, 0, 0); + attribute::create_current_price(cluster, NULL, 0, 0); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* commodity_price */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/commodity_price/commodity_price.h b/components/esp_matter/data_model/generated/clusters/commodity_price/commodity_price.h new file mode 100644 index 000000000..76e77d818 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/commodity_price/commodity_price.h @@ -0,0 +1,59 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace commodity_price { + +namespace feature { +namespace forecasting { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* forecasting */ + +} /* feature */ + +namespace attribute { +attribute_t *create_tariff_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_currency(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_price(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_price_forecast(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_get_detailed_price_request(cluster_t *cluster); +command_t *create_get_detailed_price_response(cluster_t *cluster); +command_t *create_get_detailed_forecast_request(cluster_t *cluster); +command_t *create_get_detailed_forecast_response(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_price_change(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* commodity_price */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/commodity_price/commodity_price_ids.h b/components/esp_matter/data_model/generated/clusters/commodity_price/commodity_price_ids.h new file mode 100644 index 000000000..ae2e714e6 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/commodity_price/commodity_price_ids.h @@ -0,0 +1,70 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace commodity_price { + +inline constexpr uint32_t Id = 0x0095; + +namespace feature { +namespace Forecasting { +inline constexpr uint32_t Id = 0x1; +} /* Forecasting */ +} /* feature */ + +namespace attribute { +namespace TariffUnit { +inline constexpr uint32_t Id = 0x0000; +} /* TariffUnit */ +namespace Currency { +inline constexpr uint32_t Id = 0x0001; +} /* Currency */ +namespace CurrentPrice { +inline constexpr uint32_t Id = 0x0002; +} /* CurrentPrice */ +namespace PriceForecast { +inline constexpr uint32_t Id = 0x0003; +} /* PriceForecast */ +} /* attribute */ + +namespace command { +namespace GetDetailedPriceRequest { +inline constexpr uint32_t Id = 0x00; +} /* GetDetailedPriceRequest */ +namespace GetDetailedPriceResponse { +inline constexpr uint32_t Id = 0x01; +} /* GetDetailedPriceResponse */ +namespace GetDetailedForecastRequest { +inline constexpr uint32_t Id = 0x02; +} /* GetDetailedForecastRequest */ +namespace GetDetailedForecastResponse { +inline constexpr uint32_t Id = 0x03; +} /* GetDetailedForecastResponse */ +} /* command */ + +namespace event { +namespace PriceChange { +inline constexpr uint32_t Id = 0x00; +} /* PriceChange */ +} /* event */ + +} /* commodity_price */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/commodity_tariff/commodity_tariff.cpp b/components/esp_matter/data_model/generated/clusters/commodity_tariff/commodity_tariff.cpp new file mode 100644 index 000000000..b5c70dd54 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/commodity_tariff/commodity_tariff.cpp @@ -0,0 +1,348 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "commodity_tariff_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace commodity_tariff { + +namespace feature { +namespace pricing { +uint32_t get_id() +{ + return Pricing::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* pricing */ + +namespace friendly_credit { +uint32_t get_id() +{ + return FriendlyCredit::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* friendly_credit */ + +namespace auxiliary_load { +uint32_t get_id() +{ + return AuxiliaryLoad::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* auxiliary_load */ + +namespace peak_period { +uint32_t get_id() +{ + return PeakPeriod::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* peak_period */ + +namespace power_threshold { +uint32_t get_id() +{ + return PowerThreshold::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* power_threshold */ + +namespace randomization { +uint32_t get_id() +{ + return Randomization::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_default_randomization_offset(cluster, 0); + attribute::create_default_randomization_type(cluster, 0); + + return ESP_OK; +} +} /* randomization */ + +} /* feature */ + +namespace attribute { +attribute_t *create_tariff_info(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, TariffInfo::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_tariff_unit(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, TariffUnit::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); +} + +attribute_t *create_start_date(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, StartDate::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_day_entries(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, DayEntries::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_day_patterns(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, DayPatterns::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_calendar_periods(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CalendarPeriods::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_individual_days(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, IndividualDays::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_day(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CurrentDay::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_next_day(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, NextDay::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_day_entry(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CurrentDayEntry::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_day_entry_date(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CurrentDayEntryDate::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_next_day_entry(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, NextDayEntry::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_next_day_entry_date(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, NextDayEntryDate::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_tariff_components(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, TariffComponents::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_tariff_periods(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, TariffPeriods::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_tariff_components(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CurrentTariffComponents::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_next_tariff_components(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, NextTariffComponents::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_default_randomization_offset(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(randomization), NULL); + return esp_matter::attribute::create(cluster, DefaultRandomizationOffset::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); +} + +attribute_t *create_default_randomization_type(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(randomization), NULL); + return esp_matter::attribute::create(cluster, DefaultRandomizationType::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); +} + +} /* attribute */ +namespace command { +command_t *create_get_tariff_component(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetTariffComponent::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_get_tariff_component_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetTariffComponentResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_get_day_entry(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetDayEntry::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_get_day_entry_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetDayEntryResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, commodity_tariff::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, commodity_tariff::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = CommodityTariffDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterCommodityTariffPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_tariff_info(cluster, NULL, 0, 0); + attribute::create_tariff_unit(cluster, 0); + attribute::create_start_date(cluster, 0); + attribute::create_day_entries(cluster, NULL, 0, 0); + attribute::create_day_patterns(cluster, NULL, 0, 0); + attribute::create_calendar_periods(cluster, NULL, 0, 0); + attribute::create_individual_days(cluster, NULL, 0, 0); + attribute::create_current_day(cluster, NULL, 0, 0); + attribute::create_next_day(cluster, NULL, 0, 0); + attribute::create_current_day_entry(cluster, NULL, 0, 0); + attribute::create_current_day_entry_date(cluster, 0); + attribute::create_next_day_entry(cluster, NULL, 0, 0); + attribute::create_next_day_entry_date(cluster, 0); + attribute::create_tariff_components(cluster, NULL, 0, 0); + attribute::create_tariff_periods(cluster, NULL, 0, 0); + attribute::create_current_tariff_components(cluster, NULL, 0, 0); + attribute::create_next_tariff_components(cluster, NULL, 0, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("Pricing,FriendlyCredit,AuxiliaryLoad", + feature::pricing::get_id(), feature::friendly_credit::get_id(), feature::auxiliary_load::get_id()); + if (feature_map & feature::pricing::get_id()) { + VerifyOrReturnValue(feature::pricing::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::friendly_credit::get_id()) { + VerifyOrReturnValue(feature::friendly_credit::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::auxiliary_load::get_id()) { + VerifyOrReturnValue(feature::auxiliary_load::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::peak_period::get_id()) { + VerifyOrReturnValue(feature::peak_period::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::power_threshold::get_id()) { + VerifyOrReturnValue(feature::power_threshold::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::randomization::get_id()) { + VerifyOrReturnValue(feature::randomization::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + command::create_get_tariff_component(cluster); + command::create_get_tariff_component_response(cluster); + command::create_get_day_entry(cluster); + command::create_get_day_entry_response(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* commodity_tariff */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/commodity_tariff/commodity_tariff.h b/components/esp_matter/data_model/generated/clusters/commodity_tariff/commodity_tariff.h new file mode 100644 index 000000000..1c632914d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/commodity_tariff/commodity_tariff.h @@ -0,0 +1,96 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace commodity_tariff { + +namespace feature { +namespace pricing { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* pricing */ + +namespace friendly_credit { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* friendly_credit */ + +namespace auxiliary_load { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* auxiliary_load */ + +namespace peak_period { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* peak_period */ + +namespace power_threshold { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_threshold */ + +namespace randomization { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* randomization */ + +} /* feature */ + +namespace attribute { +attribute_t *create_tariff_info(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_tariff_unit(cluster_t *cluster, nullable value); +attribute_t *create_start_date(cluster_t *cluster, nullable value); +attribute_t *create_day_entries(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_day_patterns(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_calendar_periods(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_individual_days(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_day(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_next_day(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_day_entry(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_day_entry_date(cluster_t *cluster, nullable value); +attribute_t *create_next_day_entry(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_next_day_entry_date(cluster_t *cluster, nullable value); +attribute_t *create_tariff_components(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_tariff_periods(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_tariff_components(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_next_tariff_components(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_default_randomization_offset(cluster_t *cluster, nullable value); +attribute_t *create_default_randomization_type(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_get_tariff_component(cluster_t *cluster); +command_t *create_get_tariff_component_response(cluster_t *cluster); +command_t *create_get_day_entry(cluster_t *cluster); +command_t *create_get_day_entry_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + uint32_t feature_flags; + config() : delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* commodity_tariff */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/commodity_tariff/commodity_tariff_ids.h b/components/esp_matter/data_model/generated/clusters/commodity_tariff/commodity_tariff_ids.h new file mode 100644 index 000000000..fbdd38f09 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/commodity_tariff/commodity_tariff_ids.h @@ -0,0 +1,124 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace commodity_tariff { + +inline constexpr uint32_t Id = 0x0700; + +namespace feature { +namespace Pricing { +inline constexpr uint32_t Id = 0x1; +} /* Pricing */ +namespace FriendlyCredit { +inline constexpr uint32_t Id = 0x2; +} /* FriendlyCredit */ +namespace AuxiliaryLoad { +inline constexpr uint32_t Id = 0x4; +} /* AuxiliaryLoad */ +namespace PeakPeriod { +inline constexpr uint32_t Id = 0x8; +} /* PeakPeriod */ +namespace PowerThreshold { +inline constexpr uint32_t Id = 0x10; +} /* PowerThreshold */ +namespace Randomization { +inline constexpr uint32_t Id = 0x20; +} /* Randomization */ +} /* feature */ + +namespace attribute { +namespace TariffInfo { +inline constexpr uint32_t Id = 0x0000; +} /* TariffInfo */ +namespace TariffUnit { +inline constexpr uint32_t Id = 0x0001; +} /* TariffUnit */ +namespace StartDate { +inline constexpr uint32_t Id = 0x0002; +} /* StartDate */ +namespace DayEntries { +inline constexpr uint32_t Id = 0x0003; +} /* DayEntries */ +namespace DayPatterns { +inline constexpr uint32_t Id = 0x0004; +} /* DayPatterns */ +namespace CalendarPeriods { +inline constexpr uint32_t Id = 0x0005; +} /* CalendarPeriods */ +namespace IndividualDays { +inline constexpr uint32_t Id = 0x0006; +} /* IndividualDays */ +namespace CurrentDay { +inline constexpr uint32_t Id = 0x0007; +} /* CurrentDay */ +namespace NextDay { +inline constexpr uint32_t Id = 0x0008; +} /* NextDay */ +namespace CurrentDayEntry { +inline constexpr uint32_t Id = 0x0009; +} /* CurrentDayEntry */ +namespace CurrentDayEntryDate { +inline constexpr uint32_t Id = 0x000A; +} /* CurrentDayEntryDate */ +namespace NextDayEntry { +inline constexpr uint32_t Id = 0x000B; +} /* NextDayEntry */ +namespace NextDayEntryDate { +inline constexpr uint32_t Id = 0x000C; +} /* NextDayEntryDate */ +namespace TariffComponents { +inline constexpr uint32_t Id = 0x000D; +} /* TariffComponents */ +namespace TariffPeriods { +inline constexpr uint32_t Id = 0x000E; +} /* TariffPeriods */ +namespace CurrentTariffComponents { +inline constexpr uint32_t Id = 0x000F; +} /* CurrentTariffComponents */ +namespace NextTariffComponents { +inline constexpr uint32_t Id = 0x0010; +} /* NextTariffComponents */ +namespace DefaultRandomizationOffset { +inline constexpr uint32_t Id = 0x0011; +} /* DefaultRandomizationOffset */ +namespace DefaultRandomizationType { +inline constexpr uint32_t Id = 0x0012; +} /* DefaultRandomizationType */ +} /* attribute */ + +namespace command { +namespace GetTariffComponent { +inline constexpr uint32_t Id = 0x00; +} /* GetTariffComponent */ +namespace GetTariffComponentResponse { +inline constexpr uint32_t Id = 0x00; +} /* GetTariffComponentResponse */ +namespace GetDayEntry { +inline constexpr uint32_t Id = 0x01; +} /* GetDayEntry */ +namespace GetDayEntryResponse { +inline constexpr uint32_t Id = 0x01; +} /* GetDayEntryResponse */ +} /* command */ + +} /* commodity_tariff */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/content_app_observer/content_app_observer.cpp b/components/esp_matter/data_model/generated/clusters/content_app_observer/content_app_observer.cpp new file mode 100644 index 000000000..88a43952e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/content_app_observer/content_app_observer.cpp @@ -0,0 +1,112 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "content_app_observer_cluster"; +constexpr uint16_t cluster_revision = 1; + +static esp_err_t esp_matter_command_callback_content_app_message(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessage::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentAppObserverClusterContentAppMessageCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace content_app_observer { + +namespace command { +command_t *create_content_app_message(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ContentAppMessage::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_content_app_message); +} + +command_t *create_content_app_message_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ContentAppMessageResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, content_app_observer::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, content_app_observer::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ContentAppObserverDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterContentAppObserverPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_content_app_message(cluster); + command::create_content_app_message_response(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* content_app_observer */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/content_app_observer/content_app_observer.h b/components/esp_matter/data_model/generated/clusters/content_app_observer/content_app_observer.h new file mode 100644 index 000000000..39dcdeb56 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/content_app_observer/content_app_observer.h @@ -0,0 +1,38 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace content_app_observer { + +namespace command { +command_t *create_content_app_message(cluster_t *cluster); +command_t *create_content_app_message_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* content_app_observer */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/content_app_observer/content_app_observer_ids.h b/components/esp_matter/data_model/generated/clusters/content_app_observer/content_app_observer_ids.h new file mode 100644 index 000000000..57b63bc09 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/content_app_observer/content_app_observer_ids.h @@ -0,0 +1,37 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace content_app_observer { + +inline constexpr uint32_t Id = 0x0510; + +namespace command { +namespace ContentAppMessage { +inline constexpr uint32_t Id = 0x00; +} /* ContentAppMessage */ +namespace ContentAppMessageResponse { +inline constexpr uint32_t Id = 0x01; +} /* ContentAppMessageResponse */ +} /* command */ + +} /* content_app_observer */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/content_control/content_control.cpp b/components/esp_matter/data_model/generated/clusters/content_control/content_control.cpp new file mode 100644 index 000000000..994cc7057 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/content_control/content_control.cpp @@ -0,0 +1,637 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "content_control_cluster"; +constexpr uint16_t cluster_revision = 1; + +static esp_err_t esp_matter_command_callback_update_pin(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::UpdatePIN::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterUpdatePINCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_reset_pin(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::ResetPIN::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterResetPINCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_enable(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::Enable::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterEnableCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_disable(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::Disable::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterDisableCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_add_bonus_time(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::AddBonusTime::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterAddBonusTimeCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_set_screen_daily_time(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::SetScreenDailyTime::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterSetScreenDailyTimeCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_block_unrated_content(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::BlockUnratedContent::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterBlockUnratedContentCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_unblock_unrated_content(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::UnblockUnratedContent::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterUnblockUnratedContentCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_set_on_demand_rating_threshold(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::SetOnDemandRatingThreshold::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterSetOnDemandRatingThresholdCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_set_scheduled_content_rating_threshold(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::SetScheduledContentRatingThreshold::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterSetScheduledContentRatingThresholdCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_add_block_channels(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::AddBlockChannels::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterAddBlockChannelsCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_remove_block_channels(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::RemoveBlockChannels::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterRemoveBlockChannelsCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_add_block_applications(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::AddBlockApplications::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterAddBlockApplicationsCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_remove_block_applications(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::RemoveBlockApplications::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterRemoveBlockApplicationsCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_set_block_content_time_window(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::SetBlockContentTimeWindow::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterSetBlockContentTimeWindowCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_remove_block_content_time_window(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentControl::Commands::RemoveBlockContentTimeWindow::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentControlClusterRemoveBlockContentTimeWindowCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace content_control { + +namespace feature { +namespace screen_time { +uint32_t get_id() +{ + return ScreenTime::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_screen_daily_time(cluster, config->screen_daily_time); + attribute::create_remaining_screen_time(cluster, config->remaining_screen_time); + command::create_add_bonus_time(cluster); + command::create_set_screen_daily_time(cluster); + event::create_remaining_screen_time_expired(cluster); + + return ESP_OK; +} +} /* screen_time */ + +namespace pin_management { +uint32_t get_id() +{ + return PINManagement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_update_pin(cluster); + command::create_reset_pin(cluster); + command::create_reset_pin_response(cluster); + + return ESP_OK; +} +} /* pin_management */ + +namespace block_unrated { +uint32_t get_id() +{ + return BlockUnrated::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_block_unrated(cluster, config->block_unrated); + command::create_block_unrated_content(cluster); + command::create_unblock_unrated_content(cluster); + + return ESP_OK; +} +} /* block_unrated */ + +namespace on_demand_content_rating { +uint32_t get_id() +{ + return OnDemandContentRating::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_on_demand_rating_threshold(cluster, config->on_demand_rating_threshold, sizeof(config->on_demand_rating_threshold)); + attribute::create_on_demand_ratings(cluster, NULL, 0, 0); + command::create_set_on_demand_rating_threshold(cluster); + + return ESP_OK; +} +} /* on_demand_content_rating */ + +namespace scheduled_content_rating { +uint32_t get_id() +{ + return ScheduledContentRating::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_scheduled_content_rating_threshold(cluster, config->scheduled_content_rating_threshold, sizeof(config->scheduled_content_rating_threshold)); + attribute::create_scheduled_content_ratings(cluster, NULL, 0, 0); + command::create_set_scheduled_content_rating_threshold(cluster); + + return ESP_OK; +} +} /* scheduled_content_rating */ + +namespace block_channels { +uint32_t get_id() +{ + return BlockChannels::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_block_channel_list(cluster, NULL, 0, 0); + command::create_add_block_channels(cluster); + command::create_remove_block_channels(cluster); + + return ESP_OK; +} +} /* block_channels */ + +namespace block_applications { +uint32_t get_id() +{ + return BlockApplications::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_block_application_list(cluster, NULL, 0, 0); + command::create_add_block_applications(cluster); + command::create_remove_block_applications(cluster); + + return ESP_OK; +} +} /* block_applications */ + +namespace block_content_time_window { +uint32_t get_id() +{ + return BlockContentTimeWindow::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_block_content_time_window(cluster, NULL, 0, 0); + command::create_set_block_content_time_window(cluster); + command::create_remove_block_content_time_window(cluster); + event::create_entering_block_content_time_window(cluster); + + return ESP_OK; +} +} /* block_content_time_window */ + +} /* feature */ + +namespace attribute { +attribute_t *create_enabled(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, Enabled::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_on_demand_ratings(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(on_demand_content_rating), NULL); + return esp_matter::attribute::create(cluster, OnDemandRatings::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_on_demand_rating_threshold(cluster_t *cluster, char *value, uint16_t length) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(on_demand_content_rating), NULL); + VerifyOrReturnValue(length <= k_max_on_demand_rating_threshold_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, OnDemandRatingThreshold::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_on_demand_rating_threshold_length + 1); +} + +attribute_t *create_scheduled_content_ratings(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(scheduled_content_rating), NULL); + return esp_matter::attribute::create(cluster, ScheduledContentRatings::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_scheduled_content_rating_threshold(cluster_t *cluster, char *value, uint16_t length) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(scheduled_content_rating), NULL); + VerifyOrReturnValue(length <= k_max_scheduled_content_rating_threshold_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, ScheduledContentRatingThreshold::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_scheduled_content_rating_threshold_length + 1); +} + +attribute_t *create_screen_daily_time(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(screen_time), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ScreenDailyTime::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(86400)); + return attribute; +} + +attribute_t *create_remaining_screen_time(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(screen_time), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, RemainingScreenTime::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(86400)); + return attribute; +} + +attribute_t *create_block_unrated(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(block_unrated), NULL); + return esp_matter::attribute::create(cluster, BlockUnrated::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_block_channel_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(block_channels), NULL); + return esp_matter::attribute::create(cluster, BlockChannelList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_block_application_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(block_applications), NULL); + return esp_matter::attribute::create(cluster, BlockApplicationList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_block_content_time_window(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(block_content_time_window), NULL); + return esp_matter::attribute::create(cluster, BlockContentTimeWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_update_pin(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(pin_management), NULL); + return esp_matter::command::create(cluster, UpdatePIN::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_update_pin); +} + +command_t *create_reset_pin(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(pin_management), NULL); + return esp_matter::command::create(cluster, ResetPIN::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_reset_pin); +} + +command_t *create_reset_pin_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(pin_management), NULL); + return esp_matter::command::create(cluster, ResetPINResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_enable(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Enable::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_enable); +} + +command_t *create_disable(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Disable::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_disable); +} + +command_t *create_add_bonus_time(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(screen_time), NULL); + return esp_matter::command::create(cluster, AddBonusTime::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_add_bonus_time); +} + +command_t *create_set_screen_daily_time(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(screen_time), NULL); + return esp_matter::command::create(cluster, SetScreenDailyTime::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_screen_daily_time); +} + +command_t *create_block_unrated_content(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(block_unrated), NULL); + return esp_matter::command::create(cluster, BlockUnratedContent::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_block_unrated_content); +} + +command_t *create_unblock_unrated_content(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(block_unrated), NULL); + return esp_matter::command::create(cluster, UnblockUnratedContent::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_unblock_unrated_content); +} + +command_t *create_set_on_demand_rating_threshold(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(on_demand_content_rating), NULL); + return esp_matter::command::create(cluster, SetOnDemandRatingThreshold::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_on_demand_rating_threshold); +} + +command_t *create_set_scheduled_content_rating_threshold(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(scheduled_content_rating), NULL); + return esp_matter::command::create(cluster, SetScheduledContentRatingThreshold::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_scheduled_content_rating_threshold); +} + +command_t *create_add_block_channels(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(block_channels), NULL); + return esp_matter::command::create(cluster, AddBlockChannels::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_add_block_channels); +} + +command_t *create_remove_block_channels(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(block_channels), NULL); + return esp_matter::command::create(cluster, RemoveBlockChannels::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_remove_block_channels); +} + +command_t *create_add_block_applications(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(block_applications), NULL); + return esp_matter::command::create(cluster, AddBlockApplications::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_add_block_applications); +} + +command_t *create_remove_block_applications(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(block_applications), NULL); + return esp_matter::command::create(cluster, RemoveBlockApplications::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_remove_block_applications); +} + +command_t *create_set_block_content_time_window(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(block_content_time_window), NULL); + return esp_matter::command::create(cluster, SetBlockContentTimeWindow::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_block_content_time_window); +} + +command_t *create_remove_block_content_time_window(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(block_content_time_window), NULL); + return esp_matter::command::create(cluster, RemoveBlockContentTimeWindow::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_remove_block_content_time_window); +} + +} /* command */ + +namespace event { +event_t *create_remaining_screen_time_expired(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(screen_time), NULL); + return esp_matter::event::create(cluster, RemainingScreenTimeExpired::Id); +} + +event_t *create_entering_block_content_time_window(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(block_content_time_window), NULL); + return esp_matter::event::create(cluster, EnteringBlockContentTimeWindow::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, content_control::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, content_control::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ContentControlDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterContentControlPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_enabled(cluster, config->enabled); + command::create_enable(cluster); + command::create_disable(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* content_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/content_control/content_control.h b/components/esp_matter/data_model/generated/clusters/content_control/content_control.h new file mode 100644 index 000000000..6d52237a2 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/content_control/content_control.h @@ -0,0 +1,135 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace content_control { + +const uint8_t k_max_on_demand_rating_threshold_length = 8u; +const uint8_t k_max_scheduled_content_rating_threshold_length = 8u; +namespace feature { +namespace screen_time { +typedef struct config { + uint32_t screen_daily_time; + uint32_t remaining_screen_time; + config() : screen_daily_time(0), remaining_screen_time(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* screen_time */ + +namespace pin_management { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* pin_management */ + +namespace block_unrated { +typedef struct config { + bool block_unrated; + config() : block_unrated(false) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* block_unrated */ + +namespace on_demand_content_rating { +typedef struct config { + char on_demand_rating_threshold[k_max_on_demand_rating_threshold_length + 1]; + config() {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* on_demand_content_rating */ + +namespace scheduled_content_rating { +typedef struct config { + char scheduled_content_rating_threshold[k_max_scheduled_content_rating_threshold_length + 1]; + config() {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* scheduled_content_rating */ + +namespace block_channels { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* block_channels */ + +namespace block_applications { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* block_applications */ + +namespace block_content_time_window { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* block_content_time_window */ + +} /* feature */ + +namespace attribute { +attribute_t *create_enabled(cluster_t *cluster, bool value); +attribute_t *create_on_demand_ratings(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_on_demand_rating_threshold(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_scheduled_content_ratings(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_scheduled_content_rating_threshold(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_screen_daily_time(cluster_t *cluster, uint32_t value); +attribute_t *create_remaining_screen_time(cluster_t *cluster, uint32_t value); +attribute_t *create_block_unrated(cluster_t *cluster, bool value); +attribute_t *create_block_channel_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_block_application_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_block_content_time_window(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_update_pin(cluster_t *cluster); +command_t *create_reset_pin(cluster_t *cluster); +command_t *create_reset_pin_response(cluster_t *cluster); +command_t *create_enable(cluster_t *cluster); +command_t *create_disable(cluster_t *cluster); +command_t *create_add_bonus_time(cluster_t *cluster); +command_t *create_set_screen_daily_time(cluster_t *cluster); +command_t *create_block_unrated_content(cluster_t *cluster); +command_t *create_unblock_unrated_content(cluster_t *cluster); +command_t *create_set_on_demand_rating_threshold(cluster_t *cluster); +command_t *create_set_scheduled_content_rating_threshold(cluster_t *cluster); +command_t *create_add_block_channels(cluster_t *cluster); +command_t *create_remove_block_channels(cluster_t *cluster); +command_t *create_add_block_applications(cluster_t *cluster); +command_t *create_remove_block_applications(cluster_t *cluster); +command_t *create_set_block_content_time_window(cluster_t *cluster); +command_t *create_remove_block_content_time_window(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_remaining_screen_time_expired(cluster_t *cluster); +event_t *create_entering_block_content_time_window(cluster_t *cluster); +} /* event */ + +typedef struct config { + bool enabled; + void *delegate; + config() : enabled(false), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* content_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/content_control/content_control_ids.h b/components/esp_matter/data_model/generated/clusters/content_control/content_control_ids.h new file mode 100644 index 000000000..396852e28 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/content_control/content_control_ids.h @@ -0,0 +1,154 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace content_control { + +inline constexpr uint32_t Id = 0x050F; + +namespace feature { +namespace ScreenTime { +inline constexpr uint32_t Id = 0x1; +} /* ScreenTime */ +namespace PINManagement { +inline constexpr uint32_t Id = 0x2; +} /* PINManagement */ +namespace BlockUnrated { +inline constexpr uint32_t Id = 0x4; +} /* BlockUnrated */ +namespace OnDemandContentRating { +inline constexpr uint32_t Id = 0x8; +} /* OnDemandContentRating */ +namespace ScheduledContentRating { +inline constexpr uint32_t Id = 0x10; +} /* ScheduledContentRating */ +namespace BlockChannels { +inline constexpr uint32_t Id = 0x20; +} /* BlockChannels */ +namespace BlockApplications { +inline constexpr uint32_t Id = 0x40; +} /* BlockApplications */ +namespace BlockContentTimeWindow { +inline constexpr uint32_t Id = 0x80; +} /* BlockContentTimeWindow */ +} /* feature */ + +namespace attribute { +namespace Enabled { +inline constexpr uint32_t Id = 0x0000; +} /* Enabled */ +namespace OnDemandRatings { +inline constexpr uint32_t Id = 0x0001; +} /* OnDemandRatings */ +namespace OnDemandRatingThreshold { +inline constexpr uint32_t Id = 0x0002; +} /* OnDemandRatingThreshold */ +namespace ScheduledContentRatings { +inline constexpr uint32_t Id = 0x0003; +} /* ScheduledContentRatings */ +namespace ScheduledContentRatingThreshold { +inline constexpr uint32_t Id = 0x0004; +} /* ScheduledContentRatingThreshold */ +namespace ScreenDailyTime { +inline constexpr uint32_t Id = 0x0005; +} /* ScreenDailyTime */ +namespace RemainingScreenTime { +inline constexpr uint32_t Id = 0x0006; +} /* RemainingScreenTime */ +namespace BlockUnrated { +inline constexpr uint32_t Id = 0x0007; +} /* BlockUnrated */ +namespace BlockChannelList { +inline constexpr uint32_t Id = 0x0008; +} /* BlockChannelList */ +namespace BlockApplicationList { +inline constexpr uint32_t Id = 0x0009; +} /* BlockApplicationList */ +namespace BlockContentTimeWindow { +inline constexpr uint32_t Id = 0x000A; +} /* BlockContentTimeWindow */ +} /* attribute */ + +namespace command { +namespace UpdatePIN { +inline constexpr uint32_t Id = 0x00; +} /* UpdatePIN */ +namespace ResetPIN { +inline constexpr uint32_t Id = 0x01; +} /* ResetPIN */ +namespace ResetPINResponse { +inline constexpr uint32_t Id = 0x02; +} /* ResetPINResponse */ +namespace Enable { +inline constexpr uint32_t Id = 0x03; +} /* Enable */ +namespace Disable { +inline constexpr uint32_t Id = 0x04; +} /* Disable */ +namespace AddBonusTime { +inline constexpr uint32_t Id = 0x05; +} /* AddBonusTime */ +namespace SetScreenDailyTime { +inline constexpr uint32_t Id = 0x06; +} /* SetScreenDailyTime */ +namespace BlockUnratedContent { +inline constexpr uint32_t Id = 0x07; +} /* BlockUnratedContent */ +namespace UnblockUnratedContent { +inline constexpr uint32_t Id = 0x08; +} /* UnblockUnratedContent */ +namespace SetOnDemandRatingThreshold { +inline constexpr uint32_t Id = 0x09; +} /* SetOnDemandRatingThreshold */ +namespace SetScheduledContentRatingThreshold { +inline constexpr uint32_t Id = 0x0A; +} /* SetScheduledContentRatingThreshold */ +namespace AddBlockChannels { +inline constexpr uint32_t Id = 0x0B; +} /* AddBlockChannels */ +namespace RemoveBlockChannels { +inline constexpr uint32_t Id = 0x0C; +} /* RemoveBlockChannels */ +namespace AddBlockApplications { +inline constexpr uint32_t Id = 0x0D; +} /* AddBlockApplications */ +namespace RemoveBlockApplications { +inline constexpr uint32_t Id = 0x0E; +} /* RemoveBlockApplications */ +namespace SetBlockContentTimeWindow { +inline constexpr uint32_t Id = 0x0F; +} /* SetBlockContentTimeWindow */ +namespace RemoveBlockContentTimeWindow { +inline constexpr uint32_t Id = 0x10; +} /* RemoveBlockContentTimeWindow */ +} /* command */ + +namespace event { +namespace RemainingScreenTimeExpired { +inline constexpr uint32_t Id = 0x00; +} /* RemainingScreenTimeExpired */ +namespace EnteringBlockContentTimeWindow { +inline constexpr uint32_t Id = 0x01; +} /* EnteringBlockContentTimeWindow */ +} /* event */ + +} /* content_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/content_launcher/content_launcher.cpp b/components/esp_matter/data_model/generated/clusters/content_launcher/content_launcher.cpp new file mode 100644 index 000000000..04540f236 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/content_launcher/content_launcher.cpp @@ -0,0 +1,229 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "content_launcher_cluster"; +constexpr uint16_t cluster_revision = 2; + +static esp_err_t esp_matter_command_callback_launch_content(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentLauncherClusterLaunchContentCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_launch_url(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ContentLauncher::Commands::LaunchURL::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfContentLauncherClusterLaunchURLCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace content_launcher { + +namespace feature { +namespace content_search { +uint32_t get_id() +{ + return ContentSearch::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_launch_content(cluster); + command::create_launcher_response(cluster); + + return ESP_OK; +} +} /* content_search */ + +namespace url_playback { +uint32_t get_id() +{ + return URLPlayback::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_supported_streaming_protocols(cluster, config->supported_streaming_protocols); + attribute::create_accept_header(cluster, NULL, 0, 0); + command::create_launch_url(cluster); + command::create_launcher_response(cluster); + + return ESP_OK; +} +} /* url_playback */ + +namespace advanced_seek { +uint32_t get_id() +{ + return AdvancedSeek::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* advanced_seek */ + +namespace text_tracks { +uint32_t get_id() +{ + return TextTracks::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* text_tracks */ + +namespace audio_tracks { +uint32_t get_id() +{ + return AudioTracks::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* audio_tracks */ + +} /* feature */ + +namespace attribute { +attribute_t *create_accept_header(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(url_playback), NULL); + return esp_matter::attribute::create(cluster, AcceptHeader::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_supported_streaming_protocols(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(url_playback), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, SupportedStreamingProtocols::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(3)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_launch_content(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(content_search), NULL); + return esp_matter::command::create(cluster, LaunchContent::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_launch_content); +} + +command_t *create_launch_url(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(url_playback), NULL); + return esp_matter::command::create(cluster, LaunchURL::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_launch_url); +} + +command_t *create_launcher_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(content_search)) || (has_feature(url_playback))), NULL); + return esp_matter::command::create(cluster, LauncherResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, content_launcher::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, content_launcher::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterContentLauncherPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* content_launcher */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/content_launcher/content_launcher.h b/components/esp_matter/data_model/generated/clusters/content_launcher/content_launcher.h new file mode 100644 index 000000000..5e8ed7936 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/content_launcher/content_launcher.h @@ -0,0 +1,75 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace content_launcher { + +namespace feature { +namespace content_search { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* content_search */ + +namespace url_playback { +typedef struct config { + uint8_t supported_streaming_protocols; + config() : supported_streaming_protocols(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* url_playback */ + +namespace advanced_seek { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* advanced_seek */ + +namespace text_tracks { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* text_tracks */ + +namespace audio_tracks { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* audio_tracks */ + +} /* feature */ + +namespace attribute { +attribute_t *create_accept_header(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_supported_streaming_protocols(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_launch_content(cluster_t *cluster); +command_t *create_launch_url(cluster_t *cluster); +command_t *create_launcher_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* content_launcher */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/content_launcher/content_launcher_ids.h b/components/esp_matter/data_model/generated/clusters/content_launcher/content_launcher_ids.h new file mode 100644 index 000000000..03e6f6093 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/content_launcher/content_launcher_ids.h @@ -0,0 +1,67 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace content_launcher { + +inline constexpr uint32_t Id = 0x050A; + +namespace feature { +namespace ContentSearch { +inline constexpr uint32_t Id = 0x1; +} /* ContentSearch */ +namespace URLPlayback { +inline constexpr uint32_t Id = 0x2; +} /* URLPlayback */ +namespace AdvancedSeek { +inline constexpr uint32_t Id = 0x4; +} /* AdvancedSeek */ +namespace TextTracks { +inline constexpr uint32_t Id = 0x8; +} /* TextTracks */ +namespace AudioTracks { +inline constexpr uint32_t Id = 0x10; +} /* AudioTracks */ +} /* feature */ + +namespace attribute { +namespace AcceptHeader { +inline constexpr uint32_t Id = 0x0000; +} /* AcceptHeader */ +namespace SupportedStreamingProtocols { +inline constexpr uint32_t Id = 0x0001; +} /* SupportedStreamingProtocols */ +} /* attribute */ + +namespace command { +namespace LaunchContent { +inline constexpr uint32_t Id = 0x00; +} /* LaunchContent */ +namespace LaunchURL { +inline constexpr uint32_t Id = 0x01; +} /* LaunchURL */ +namespace LauncherResponse { +inline constexpr uint32_t Id = 0x02; +} /* LauncherResponse */ +} /* command */ + +} /* content_launcher */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/descriptor/descriptor.cpp b/components/esp_matter/data_model/generated/clusters/descriptor/descriptor.cpp new file mode 100644 index 000000000..0aa58ef26 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/descriptor/descriptor.cpp @@ -0,0 +1,136 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "descriptor_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace descriptor { + +namespace feature { +namespace tag_list { +uint32_t get_id() +{ + return TagList::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_tag_list(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* tag_list */ + +} /* feature */ + +namespace attribute { +attribute_t *create_device_type_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, DeviceTypeList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_server_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ServerList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_client_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ClientList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_parts_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, PartsList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_tag_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(tag_list), NULL); + return esp_matter::attribute::create(cluster, TagList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +#if CHIP_CONFIG_USE_ENDPOINT_UNIQUE_ID +attribute_t *create_endpoint_unique_id(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_endpoint_unique_id_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, EndpointUniqueID::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_endpoint_unique_id_length + 1); +} +#endif // CHIP_CONFIG_USE_ENDPOINT_UNIQUE_ID + +} /* attribute */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, descriptor::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, descriptor::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterDescriptorPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_device_type_list(cluster, NULL, 0, 0); + attribute::create_server_list(cluster, NULL, 0, 0); + attribute::create_client_list(cluster, NULL, 0, 0); + attribute::create_parts_list(cluster, NULL, 0, 0); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterDescriptorClusterServerInitCallback, + ESPMatterDescriptorClusterServerShutdownCallback); + } + + return cluster; +} + +} /* descriptor */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/descriptor/descriptor.h b/components/esp_matter/data_model/generated/clusters/descriptor/descriptor.h new file mode 100644 index 000000000..8b7e921b3 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/descriptor/descriptor.h @@ -0,0 +1,52 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace descriptor { + +const uint8_t k_max_endpoint_unique_id_length = 32u; +namespace feature { +namespace tag_list { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* tag_list */ + +} /* feature */ + +namespace attribute { +attribute_t *create_device_type_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_server_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_client_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_parts_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_tag_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +#if CHIP_CONFIG_USE_ENDPOINT_UNIQUE_ID +attribute_t *create_endpoint_unique_id(cluster_t *cluster, char * value, uint16_t length); +#endif // CHIP_CONFIG_USE_ENDPOINT_UNIQUE_ID +} /* attribute */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* descriptor */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/descriptor/descriptor_ids.h b/components/esp_matter/data_model/generated/clusters/descriptor/descriptor_ids.h new file mode 100644 index 000000000..57cfe5f79 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/descriptor/descriptor_ids.h @@ -0,0 +1,55 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace descriptor { + +inline constexpr uint32_t Id = 0x001D; + +namespace feature { +namespace TagList { +inline constexpr uint32_t Id = 0x1; +} /* TagList */ +} /* feature */ + +namespace attribute { +namespace DeviceTypeList { +inline constexpr uint32_t Id = 0x0000; +} /* DeviceTypeList */ +namespace ServerList { +inline constexpr uint32_t Id = 0x0001; +} /* ServerList */ +namespace ClientList { +inline constexpr uint32_t Id = 0x0002; +} /* ClientList */ +namespace PartsList { +inline constexpr uint32_t Id = 0x0003; +} /* PartsList */ +namespace TagList { +inline constexpr uint32_t Id = 0x0004; +} /* TagList */ +namespace EndpointUniqueID { +inline constexpr uint32_t Id = 0x0005; +} /* EndpointUniqueID */ +} /* attribute */ + +} /* descriptor */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/device_energy_management/device_energy_management.cpp b/components/esp_matter/data_model/generated/clusters/device_energy_management/device_energy_management.cpp new file mode 100644 index 000000000..3ee17c11c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/device_energy_management/device_energy_management.cpp @@ -0,0 +1,405 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "device_energy_management_cluster"; +constexpr uint16_t cluster_revision = 4; + +namespace esp_matter { +namespace cluster { +namespace device_energy_management { + +namespace feature { +namespace power_adjustment { +uint32_t get_id() +{ + return PowerAdjustment::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_opt_out_state(cluster, config->opt_out_state); + attribute::create_power_adjustment_capability(cluster, NULL, 0, 0); + command::create_power_adjust_request(cluster); + command::create_cancel_power_adjust_request(cluster); + event::create_power_adjust_start(cluster); + event::create_power_adjust_end(cluster); + + return ESP_OK; +} +} /* power_adjustment */ + +namespace power_forecast_reporting { +uint32_t get_id() +{ + return PowerForecastReporting::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_forecast(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* power_forecast_reporting */ + +namespace state_forecast_reporting { +uint32_t get_id() +{ + return StateForecastReporting::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(!(has_feature(power_adjustment)), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_forecast(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* state_forecast_reporting */ + +namespace start_time_adjustment { +uint32_t get_id() +{ + return StartTimeAdjustment::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_opt_out_state(cluster, config->opt_out_state); + command::create_start_time_adjust_request(cluster); + command::create_cancel_request(cluster); + + return ESP_OK; +} +} /* start_time_adjustment */ + +namespace pausable { +uint32_t get_id() +{ + return Pausable::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_opt_out_state(cluster, config->opt_out_state); + command::create_pause_request(cluster); + command::create_resume_request(cluster); + event::create_paused(cluster); + event::create_resumed(cluster); + + return ESP_OK; +} +} /* pausable */ + +namespace forecast_adjustment { +uint32_t get_id() +{ + return ForecastAdjustment::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_opt_out_state(cluster, config->opt_out_state); + command::create_modify_forecast_request(cluster); + command::create_cancel_request(cluster); + + return ESP_OK; +} +} /* forecast_adjustment */ + +namespace constraint_based_adjustment { +uint32_t get_id() +{ + return ConstraintBasedAdjustment::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_opt_out_state(cluster, config->opt_out_state); + command::create_request_constraint_based_forecast(cluster); + command::create_cancel_request(cluster); + + return ESP_OK; +} +} /* constraint_based_adjustment */ + +} /* feature */ + +namespace attribute { +attribute_t *create_esa_type(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ESAType::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(14)); + return attribute; +} + +attribute_t *create_esa_can_generate(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, ESACanGenerate::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_esa_state(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ESAState::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(4)); + return attribute; +} + +attribute_t *create_abs_min_power(cluster_t *cluster, int64_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, AbsMinPower::Id, ATTRIBUTE_FLAG_NONE, esp_matter_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int64(-2147483648), esp_matter_int64(2147483646)); + return attribute; +} + +attribute_t *create_abs_max_power(cluster_t *cluster, int64_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, AbsMaxPower::Id, ATTRIBUTE_FLAG_NONE, esp_matter_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int64(-2147483648), esp_matter_int64(2147483646)); + return attribute; +} + +attribute_t *create_power_adjustment_capability(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(power_adjustment), NULL); + return esp_matter::attribute::create(cluster, PowerAdjustmentCapability::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_forecast(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(power_forecast_reporting)) || (has_feature(state_forecast_reporting))), NULL); + return esp_matter::attribute::create(cluster, Forecast::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_opt_out_state(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(power_adjustment)) || (has_feature(start_time_adjustment)) || (has_feature(pausable)) || (has_feature(forecast_adjustment)) || (has_feature(constraint_based_adjustment))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, OptOutState::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(3)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_power_adjust_request(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(power_adjustment), NULL); + return esp_matter::command::create(cluster, PowerAdjustRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_cancel_power_adjust_request(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(power_adjustment), NULL); + return esp_matter::command::create(cluster, CancelPowerAdjustRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_start_time_adjust_request(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(start_time_adjustment), NULL); + return esp_matter::command::create(cluster, StartTimeAdjustRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_pause_request(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(pausable), NULL); + return esp_matter::command::create(cluster, PauseRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_resume_request(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(pausable), NULL); + return esp_matter::command::create(cluster, ResumeRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_modify_forecast_request(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(forecast_adjustment), NULL); + return esp_matter::command::create(cluster, ModifyForecastRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_request_constraint_based_forecast(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(constraint_based_adjustment), NULL); + return esp_matter::command::create(cluster, RequestConstraintBasedForecast::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_cancel_request(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(start_time_adjustment)) || (has_feature(forecast_adjustment)) || (has_feature(constraint_based_adjustment))), NULL); + return esp_matter::command::create(cluster, CancelRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_power_adjust_start(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(power_adjustment), NULL); + return esp_matter::event::create(cluster, PowerAdjustStart::Id); +} + +event_t *create_power_adjust_end(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(power_adjustment), NULL); + return esp_matter::event::create(cluster, PowerAdjustEnd::Id); +} + +event_t *create_paused(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(pausable), NULL); + return esp_matter::event::create(cluster, Paused::Id); +} + +event_t *create_resumed(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(pausable), NULL); + return esp_matter::event::create(cluster, Resumed::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, device_energy_management::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, device_energy_management::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = DeviceEnergyManagementDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterDeviceEnergyManagementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_esa_type(cluster, config->esa_type); + attribute::create_esa_can_generate(cluster, config->esa_can_generate); + attribute::create_esa_state(cluster, config->esa_state); + attribute::create_abs_min_power(cluster, config->abs_min_power); + attribute::create_abs_max_power(cluster, config->abs_max_power); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_EXACT_ONE("PowerForecastReporting,StateForecastReporting", + feature::power_forecast_reporting::get_id(), feature::state_forecast_reporting::get_id()); + if (feature_map & feature::power_forecast_reporting::get_id()) { + VerifyOrReturnValue(feature::power_forecast_reporting::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::state_forecast_reporting::get_id()) { + VerifyOrReturnValue(feature::state_forecast_reporting::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::power_adjustment::get_id()) { + VerifyOrReturnValue(feature::power_adjustment::add(cluster, &(config->features.power_adjustment)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::start_time_adjustment::get_id()) { + VerifyOrReturnValue(feature::start_time_adjustment::add(cluster, &(config->features.start_time_adjustment)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::pausable::get_id()) { + VerifyOrReturnValue(feature::pausable::add(cluster, &(config->features.pausable)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::forecast_adjustment::get_id()) { + VerifyOrReturnValue(feature::forecast_adjustment::add(cluster, &(config->features.forecast_adjustment)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::constraint_based_adjustment::get_id()) { + VerifyOrReturnValue(feature::constraint_based_adjustment::add(cluster, &(config->features.constraint_based_adjustment)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterDeviceEnergyManagementClusterServerInitCallback, + ESPMatterDeviceEnergyManagementClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* device_energy_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/device_energy_management/device_energy_management.h b/components/esp_matter/data_model/generated/clusters/device_energy_management/device_energy_management.h new file mode 100644 index 000000000..b33aba232 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/device_energy_management/device_energy_management.h @@ -0,0 +1,133 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace device_energy_management { + +namespace feature { +namespace power_adjustment { +typedef struct config { + uint8_t opt_out_state; + config() : opt_out_state(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* power_adjustment */ + +namespace power_forecast_reporting { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_forecast_reporting */ + +namespace state_forecast_reporting { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* state_forecast_reporting */ + +namespace start_time_adjustment { +typedef struct config { + uint8_t opt_out_state; + config() : opt_out_state(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* start_time_adjustment */ + +namespace pausable { +typedef struct config { + uint8_t opt_out_state; + config() : opt_out_state(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* pausable */ + +namespace forecast_adjustment { +typedef struct config { + uint8_t opt_out_state; + config() : opt_out_state(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* forecast_adjustment */ + +namespace constraint_based_adjustment { +typedef struct config { + uint8_t opt_out_state; + config() : opt_out_state(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* constraint_based_adjustment */ + +} /* feature */ + +namespace attribute { +attribute_t *create_esa_type(cluster_t *cluster, uint8_t value); +attribute_t *create_esa_can_generate(cluster_t *cluster, bool value); +attribute_t *create_esa_state(cluster_t *cluster, uint8_t value); +attribute_t *create_abs_min_power(cluster_t *cluster, int64_t value); +attribute_t *create_abs_max_power(cluster_t *cluster, int64_t value); +attribute_t *create_power_adjustment_capability(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_forecast(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_opt_out_state(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_power_adjust_request(cluster_t *cluster); +command_t *create_cancel_power_adjust_request(cluster_t *cluster); +command_t *create_start_time_adjust_request(cluster_t *cluster); +command_t *create_pause_request(cluster_t *cluster); +command_t *create_resume_request(cluster_t *cluster); +command_t *create_modify_forecast_request(cluster_t *cluster); +command_t *create_request_constraint_based_forecast(cluster_t *cluster); +command_t *create_cancel_request(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_power_adjust_start(cluster_t *cluster); +event_t *create_power_adjust_end(cluster_t *cluster); +event_t *create_paused(cluster_t *cluster); +event_t *create_resumed(cluster_t *cluster); +} /* event */ + +typedef struct config { + uint8_t esa_type; + bool esa_can_generate; + uint8_t esa_state; + int64_t abs_min_power; + int64_t abs_max_power; + void *delegate; + struct { + feature::power_adjustment::config_t power_adjustment; + feature::start_time_adjustment::config_t start_time_adjustment; + feature::pausable::config_t pausable; + feature::forecast_adjustment::config_t forecast_adjustment; + feature::constraint_based_adjustment::config_t constraint_based_adjustment; + } features; + uint32_t feature_flags; + config() : esa_type(0), esa_can_generate(false), esa_state(0), abs_min_power(0), abs_max_power(0), delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* device_energy_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/device_energy_management/device_energy_management_ids.h b/components/esp_matter/data_model/generated/clusters/device_energy_management/device_energy_management_ids.h new file mode 100644 index 000000000..2a0fed446 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/device_energy_management/device_energy_management_ids.h @@ -0,0 +1,121 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace device_energy_management { + +inline constexpr uint32_t Id = 0x0098; + +namespace feature { +namespace PowerAdjustment { +inline constexpr uint32_t Id = 0x1; +} /* PowerAdjustment */ +namespace PowerForecastReporting { +inline constexpr uint32_t Id = 0x2; +} /* PowerForecastReporting */ +namespace StateForecastReporting { +inline constexpr uint32_t Id = 0x4; +} /* StateForecastReporting */ +namespace StartTimeAdjustment { +inline constexpr uint32_t Id = 0x8; +} /* StartTimeAdjustment */ +namespace Pausable { +inline constexpr uint32_t Id = 0x10; +} /* Pausable */ +namespace ForecastAdjustment { +inline constexpr uint32_t Id = 0x20; +} /* ForecastAdjustment */ +namespace ConstraintBasedAdjustment { +inline constexpr uint32_t Id = 0x40; +} /* ConstraintBasedAdjustment */ +} /* feature */ + +namespace attribute { +namespace ESAType { +inline constexpr uint32_t Id = 0x0000; +} /* ESAType */ +namespace ESACanGenerate { +inline constexpr uint32_t Id = 0x0001; +} /* ESACanGenerate */ +namespace ESAState { +inline constexpr uint32_t Id = 0x0002; +} /* ESAState */ +namespace AbsMinPower { +inline constexpr uint32_t Id = 0x0003; +} /* AbsMinPower */ +namespace AbsMaxPower { +inline constexpr uint32_t Id = 0x0004; +} /* AbsMaxPower */ +namespace PowerAdjustmentCapability { +inline constexpr uint32_t Id = 0x0005; +} /* PowerAdjustmentCapability */ +namespace Forecast { +inline constexpr uint32_t Id = 0x0006; +} /* Forecast */ +namespace OptOutState { +inline constexpr uint32_t Id = 0x0007; +} /* OptOutState */ +} /* attribute */ + +namespace command { +namespace PowerAdjustRequest { +inline constexpr uint32_t Id = 0x00; +} /* PowerAdjustRequest */ +namespace CancelPowerAdjustRequest { +inline constexpr uint32_t Id = 0x01; +} /* CancelPowerAdjustRequest */ +namespace StartTimeAdjustRequest { +inline constexpr uint32_t Id = 0x02; +} /* StartTimeAdjustRequest */ +namespace PauseRequest { +inline constexpr uint32_t Id = 0x03; +} /* PauseRequest */ +namespace ResumeRequest { +inline constexpr uint32_t Id = 0x04; +} /* ResumeRequest */ +namespace ModifyForecastRequest { +inline constexpr uint32_t Id = 0x05; +} /* ModifyForecastRequest */ +namespace RequestConstraintBasedForecast { +inline constexpr uint32_t Id = 0x06; +} /* RequestConstraintBasedForecast */ +namespace CancelRequest { +inline constexpr uint32_t Id = 0x07; +} /* CancelRequest */ +} /* command */ + +namespace event { +namespace PowerAdjustStart { +inline constexpr uint32_t Id = 0x00; +} /* PowerAdjustStart */ +namespace PowerAdjustEnd { +inline constexpr uint32_t Id = 0x01; +} /* PowerAdjustEnd */ +namespace Paused { +inline constexpr uint32_t Id = 0x02; +} /* Paused */ +namespace Resumed { +inline constexpr uint32_t Id = 0x03; +} /* Resumed */ +} /* event */ + +} /* device_energy_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/device_energy_management_mode/device_energy_management_mode.cpp b/components/esp_matter/data_model/generated/clusters/device_energy_management_mode/device_energy_management_mode.cpp new file mode 100644 index 000000000..0500d6f35 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/device_energy_management_mode/device_energy_management_mode.cpp @@ -0,0 +1,107 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "device_energy_management_mode_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace device_energy_management_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedModes::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_change_to_mode(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToMode::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_change_to_mode_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToModeResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, device_energy_management_mode::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, device_energy_management_mode::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = DeviceEnergyManagementModeDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterDeviceEnergyManagementModePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_change_to_mode(cluster); + command::create_change_to_mode_response(cluster); + } + + return cluster; +} + +} /* device_energy_management_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/device_energy_management_mode/device_energy_management_mode.h b/components/esp_matter/data_model/generated/clusters/device_energy_management_mode/device_energy_management_mode.h new file mode 100644 index 000000000..08488b7a8 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/device_energy_management_mode/device_energy_management_mode.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace device_energy_management_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_change_to_mode(cluster_t *cluster); +command_t *create_change_to_mode_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* device_energy_management_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/device_energy_management_mode/device_energy_management_mode_ids.h b/components/esp_matter/data_model/generated/clusters/device_energy_management_mode/device_energy_management_mode_ids.h new file mode 100644 index 000000000..1227e678d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/device_energy_management_mode/device_energy_management_mode_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace device_energy_management_mode { + +inline constexpr uint32_t Id = 0x009F; + +namespace attribute { +namespace SupportedModes { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedModes */ +namespace CurrentMode { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentMode */ +} /* attribute */ + +namespace command { +namespace ChangeToMode { +inline constexpr uint32_t Id = 0x00; +} /* ChangeToMode */ +namespace ChangeToModeResponse { +inline constexpr uint32_t Id = 0x01; +} /* ChangeToModeResponse */ +} /* command */ + +} /* device_energy_management_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/diagnostic_logs/diagnostic_logs.cpp b/components/esp_matter/data_model/generated/clusters/diagnostic_logs/diagnostic_logs.cpp new file mode 100644 index 000000000..74b44d84c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/diagnostic_logs/diagnostic_logs.cpp @@ -0,0 +1,96 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "diagnostic_logs_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace diagnostic_logs { + +namespace command { +command_t *create_retrieve_logs_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RetrieveLogsRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_retrieve_logs_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RetrieveLogsResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, diagnostic_logs::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, diagnostic_logs::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = DiagnosticLogsDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterDiagnosticLogsPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_retrieve_logs_request(cluster); + command::create_retrieve_logs_response(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterDiagnosticLogsClusterServerInitCallback, + ESPMatterDiagnosticLogsClusterServerShutdownCallback); + } + + return cluster; +} + +} /* diagnostic_logs */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/diagnostic_logs/diagnostic_logs.h b/components/esp_matter/data_model/generated/clusters/diagnostic_logs/diagnostic_logs.h new file mode 100644 index 000000000..8e397bf5c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/diagnostic_logs/diagnostic_logs.h @@ -0,0 +1,38 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace diagnostic_logs { + +namespace command { +command_t *create_retrieve_logs_request(cluster_t *cluster); +command_t *create_retrieve_logs_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* diagnostic_logs */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/diagnostic_logs/diagnostic_logs_ids.h b/components/esp_matter/data_model/generated/clusters/diagnostic_logs/diagnostic_logs_ids.h new file mode 100644 index 000000000..b56a031f4 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/diagnostic_logs/diagnostic_logs_ids.h @@ -0,0 +1,37 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace diagnostic_logs { + +inline constexpr uint32_t Id = 0x0032; + +namespace command { +namespace RetrieveLogsRequest { +inline constexpr uint32_t Id = 0x00; +} /* RetrieveLogsRequest */ +namespace RetrieveLogsResponse { +inline constexpr uint32_t Id = 0x01; +} /* RetrieveLogsResponse */ +} /* command */ + +} /* diagnostic_logs */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/dish_washer_alarm/dish_washer_alarm.cpp b/components/esp_matter/data_model/generated/clusters/dish_washer_alarm/dish_washer_alarm.cpp new file mode 100644 index 000000000..cd4f3c6e7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/dish_washer_alarm/dish_washer_alarm.cpp @@ -0,0 +1,158 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "dish_washer_alarm_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace dish_washer_alarm { + +namespace feature { +namespace reset { +uint32_t get_id() +{ + return Reset::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_latch(cluster, config->latch); + command::create_reset(cluster); + + return ESP_OK; +} +} /* reset */ + +} /* feature */ + +namespace attribute { +attribute_t *create_mask(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Mask::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(4294967295)); + return attribute; +} + +attribute_t *create_latch(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(reset), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, Latch::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(4294967295)); + return attribute; +} + +attribute_t *create_state(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, State::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(4294967295)); + return attribute; +} + +attribute_t *create_supported(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Supported::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(4294967295)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_reset(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(reset), NULL); + return esp_matter::command::create(cluster, Reset::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_modify_enabled_alarms(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ModifyEnabledAlarms::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_notify(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, Notify::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, dish_washer_alarm::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, dish_washer_alarm::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = DishwasherAlarmDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterDishwasherAlarmPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_mask(cluster, config->mask); + attribute::create_state(cluster, config->state); + attribute::create_supported(cluster, config->supported); + /* Events */ + event::create_notify(cluster); + } + + return cluster; +} + +} /* dish_washer_alarm */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/dish_washer_alarm/dish_washer_alarm.h b/components/esp_matter/data_model/generated/clusters/dish_washer_alarm/dish_washer_alarm.h new file mode 100644 index 000000000..a2a34793b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/dish_washer_alarm/dish_washer_alarm.h @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace dish_washer_alarm { + +namespace feature { +namespace reset { +typedef struct config { + uint32_t latch; + config() : latch(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* reset */ + +} /* feature */ + +namespace attribute { +attribute_t *create_mask(cluster_t *cluster, uint32_t value); +attribute_t *create_latch(cluster_t *cluster, uint32_t value); +attribute_t *create_state(cluster_t *cluster, uint32_t value); +attribute_t *create_supported(cluster_t *cluster, uint32_t value); +} /* attribute */ + +namespace command { +command_t *create_reset(cluster_t *cluster); +command_t *create_modify_enabled_alarms(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_notify(cluster_t *cluster); +} /* event */ + +typedef struct config { + uint32_t mask; + uint32_t state; + uint32_t supported; + void *delegate; + config() : mask(0), state(0), supported(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* dish_washer_alarm */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/dish_washer_alarm/dish_washer_alarm_ids.h b/components/esp_matter/data_model/generated/clusters/dish_washer_alarm/dish_washer_alarm_ids.h new file mode 100644 index 000000000..07f0a4703 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/dish_washer_alarm/dish_washer_alarm_ids.h @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace dish_washer_alarm { + +inline constexpr uint32_t Id = 0x005D; + +namespace feature { +namespace Reset { +inline constexpr uint32_t Id = 0x1; +} /* Reset */ +} /* feature */ + +namespace attribute { +namespace Mask { +inline constexpr uint32_t Id = 0x0000; +} /* Mask */ +namespace Latch { +inline constexpr uint32_t Id = 0x0001; +} /* Latch */ +namespace State { +inline constexpr uint32_t Id = 0x0002; +} /* State */ +namespace Supported { +inline constexpr uint32_t Id = 0x0003; +} /* Supported */ +} /* attribute */ + +namespace command { +namespace Reset { +inline constexpr uint32_t Id = 0x00; +} /* Reset */ +namespace ModifyEnabledAlarms { +inline constexpr uint32_t Id = 0x01; +} /* ModifyEnabledAlarms */ +} /* command */ + +namespace event { +namespace Notify { +inline constexpr uint32_t Id = 0x00; +} /* Notify */ +} /* event */ + +} /* dish_washer_alarm */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/dish_washer_mode/dish_washer_mode.cpp b/components/esp_matter/data_model/generated/clusters/dish_washer_mode/dish_washer_mode.cpp new file mode 100644 index 000000000..97a83fb7b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/dish_washer_mode/dish_washer_mode.cpp @@ -0,0 +1,109 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "dish_washer_mode_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace dish_washer_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedModes::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_change_to_mode(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToMode::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_change_to_mode_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToModeResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, dish_washer_mode::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, dish_washer_mode::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = DishwasherModeDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterDishwasherModePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_current_mode(cluster, config->current_mode); + attribute::create_supported_modes(cluster, NULL, 0, 0); + command::create_change_to_mode(cluster); + command::create_change_to_mode_response(cluster); + } + + return cluster; +} + +} /* dish_washer_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/dish_washer_mode/dish_washer_mode.h b/components/esp_matter/data_model/generated/clusters/dish_washer_mode/dish_washer_mode.h new file mode 100644 index 000000000..03a4ae669 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/dish_washer_mode/dish_washer_mode.h @@ -0,0 +1,44 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace dish_washer_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_change_to_mode(cluster_t *cluster); +command_t *create_change_to_mode_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t current_mode; + void *delegate; + config() : current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* dish_washer_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/dish_washer_mode/dish_washer_mode_ids.h b/components/esp_matter/data_model/generated/clusters/dish_washer_mode/dish_washer_mode_ids.h new file mode 100644 index 000000000..8dd0ed5ad --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/dish_washer_mode/dish_washer_mode_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace dish_washer_mode { + +inline constexpr uint32_t Id = 0x0059; + +namespace attribute { +namespace SupportedModes { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedModes */ +namespace CurrentMode { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentMode */ +} /* attribute */ + +namespace command { +namespace ChangeToMode { +inline constexpr uint32_t Id = 0x00; +} /* ChangeToMode */ +namespace ChangeToModeResponse { +inline constexpr uint32_t Id = 0x01; +} /* ChangeToModeResponse */ +} /* command */ + +} /* dish_washer_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/door_lock/door_lock.cpp b/components/esp_matter/data_model/generated/clusters/door_lock/door_lock.cpp new file mode 100644 index 000000000..d990a8fbc --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/door_lock/door_lock.cpp @@ -0,0 +1,1118 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "door_lock_cluster"; +constexpr uint16_t cluster_revision = 9; + +static esp_err_t esp_matter_command_callback_lock_door(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::LockDoor::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterLockDoorCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_unlock_door(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::UnlockDoor::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterUnlockDoorCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_unlock_with_timeout(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterUnlockWithTimeoutCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_set_week_day_schedule(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterSetWeekDayScheduleCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_get_week_day_schedule(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterGetWeekDayScheduleCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_clear_week_day_schedule(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterClearWeekDayScheduleCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_set_year_day_schedule(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterSetYearDayScheduleCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_get_year_day_schedule(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterGetYearDayScheduleCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_clear_year_day_schedule(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterClearYearDayScheduleCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_set_holiday_schedule(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterSetHolidayScheduleCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_get_holiday_schedule(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterGetHolidayScheduleCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_clear_holiday_schedule(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::ClearHolidaySchedule::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterClearHolidayScheduleCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_set_user(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::SetUser::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterSetUserCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_get_user(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::GetUser::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterGetUserCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_clear_user(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::ClearUser::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterClearUserCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_set_credential(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::SetCredential::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterSetCredentialCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_get_credential_status(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterGetCredentialStatusCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_clear_credential(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::ClearCredential::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterClearCredentialCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_unbolt_door(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::UnboltDoor::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterUnboltDoorCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_set_aliro_reader_config(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::SetAliroReaderConfig::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterSetAliroReaderConfigCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_clear_aliro_reader_config(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::DoorLock::Commands::ClearAliroReaderConfig::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfDoorLockClusterClearAliroReaderConfigCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace door_lock { + +namespace feature { +namespace pin_credential { +uint32_t get_id() +{ + return PINCredential::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_number_of_pin_users_supported(cluster, config->number_of_pin_users_supported); + attribute::create_max_pin_code_length(cluster, config->max_pin_code_length); + attribute::create_min_pin_code_length(cluster, config->min_pin_code_length); + attribute::create_wrong_code_entry_limit(cluster, config->wrong_code_entry_limit); + attribute::create_user_code_temporary_disable_time(cluster, config->user_code_temporary_disable_time); + attribute::create_require_pin_for_remote_operation(cluster, config->require_pin_for_remote_operation); + + return ESP_OK; +} +} /* pin_credential */ + +namespace rfid_credential { +uint32_t get_id() +{ + return RFIDCredential::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_number_of_rfid_users_supported(cluster, config->number_of_rfid_users_supported); + attribute::create_max_rfid_code_length(cluster, config->max_rfid_code_length); + attribute::create_min_rfid_code_length(cluster, config->min_rfid_code_length); + attribute::create_wrong_code_entry_limit(cluster, config->wrong_code_entry_limit); + attribute::create_user_code_temporary_disable_time(cluster, config->user_code_temporary_disable_time); + + return ESP_OK; +} +} /* rfid_credential */ + +namespace weekday_access_schedules { +uint32_t get_id() +{ + return WeekdayAccessSchedules::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_number_of_week_day_schedules_supported_per_user(cluster, config->number_of_week_day_schedules_supported_per_user); + command::create_set_week_day_schedule(cluster); + command::create_get_week_day_schedule(cluster); + command::create_get_week_day_schedule_response(cluster); + command::create_clear_week_day_schedule(cluster); + + return ESP_OK; +} +} /* weekday_access_schedules */ + +namespace door_position_sensor { +uint32_t get_id() +{ + return DoorPositionSensor::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_door_state(cluster, config->door_state); + event::create_door_state_change(cluster); + + return ESP_OK; +} +} /* door_position_sensor */ + +namespace credential_over_the_air_access { +uint32_t get_id() +{ + return CredentialOverTheAirAccess::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_require_pin_for_remote_operation(cluster, config->require_pin_for_remote_operation); + + return ESP_OK; +} +} /* credential_over_the_air_access */ + +namespace user { +uint32_t get_id() +{ + return User::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError((has_feature(aliro_provisioning) || ((has_feature(pin_credential)) || (has_feature(rfid_credential)))), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_number_of_total_users_supported(cluster, config->number_of_total_users_supported); + attribute::create_credential_rules_support(cluster, config->credential_rules_support); + attribute::create_number_of_credentials_supported_per_user(cluster, config->number_of_credentials_supported_per_user); + command::create_set_user(cluster); + command::create_get_user(cluster); + command::create_get_user_response(cluster); + command::create_clear_user(cluster); + command::create_set_credential(cluster); + command::create_set_credential_response(cluster); + command::create_get_credential_status(cluster); + command::create_get_credential_status_response(cluster); + command::create_clear_credential(cluster); + event::create_lock_user_change(cluster); + + return ESP_OK; +} +} /* user */ + +namespace year_day_access_schedules { +uint32_t get_id() +{ + return YearDayAccessSchedules::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_number_of_year_day_schedules_supported_per_user(cluster, config->number_of_year_day_schedules_supported_per_user); + command::create_set_year_day_schedule(cluster); + command::create_get_year_day_schedule(cluster); + command::create_get_year_day_schedule_response(cluster); + command::create_clear_year_day_schedule(cluster); + + return ESP_OK; +} +} /* year_day_access_schedules */ + +namespace holiday_schedules { +uint32_t get_id() +{ + return HolidaySchedules::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_number_of_holiday_schedules_supported(cluster, config->number_of_holiday_schedules_supported); + command::create_set_holiday_schedule(cluster); + command::create_get_holiday_schedule(cluster); + command::create_get_holiday_schedule_response(cluster); + command::create_clear_holiday_schedule(cluster); + + return ESP_OK; +} +} /* holiday_schedules */ + +namespace unbolting { +uint32_t get_id() +{ + return Unbolting::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_unbolt_door(cluster); + + return ESP_OK; +} +} /* unbolting */ + +namespace aliro_provisioning { +uint32_t get_id() +{ + return AliroProvisioning::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_aliro_reader_verification_key(cluster, NULL, 0); + attribute::create_aliro_reader_group_identifier(cluster, NULL, 0); + attribute::create_aliro_reader_group_sub_identifier(cluster, NULL, 0); + attribute::create_aliro_expedited_transaction_supported_protocol_versions(cluster, NULL, 0, 0); + attribute::create_number_of_aliro_credential_issuer_keys_supported(cluster, 0); + attribute::create_number_of_aliro_endpoint_keys_supported(cluster, 0); + command::create_set_aliro_reader_config(cluster); + command::create_clear_aliro_reader_config(cluster); + + return ESP_OK; +} +} /* aliro_provisioning */ + +namespace aliro_bleuwb { +uint32_t get_id() +{ + return AliroBLEUWB::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(aliro_provisioning), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_aliro_group_resolving_key(cluster, NULL, 0); + attribute::create_aliro_supported_bleuwb_protocol_versions(cluster, NULL, 0, 0); + attribute::create_aliro_ble_advertising_version(cluster, 0); + + return ESP_OK; +} +} /* aliro_bleuwb */ + +} /* feature */ + +namespace attribute { +attribute_t *create_lock_state(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LockState::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_enum8(0), esp_matter_nullable_enum8(3)); + return attribute; +} + +attribute_t *create_lock_type(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LockType::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(11)); + return attribute; +} + +attribute_t *create_actuator_enabled(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, ActuatorEnabled::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_door_state(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(door_position_sensor), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, DoorState::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_enum8(0), esp_matter_nullable_enum8(5)); + return attribute; +} + +attribute_t *create_door_open_events(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, DoorOpenEvents::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +attribute_t *create_door_closed_events(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, DoorClosedEvents::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +attribute_t *create_open_period(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, OpenPeriod::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_number_of_total_users_supported(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfTotalUsersSupported::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_number_of_pin_users_supported(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(pin_credential), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfPINUsersSupported::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_number_of_rfid_users_supported(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(rfid_credential), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfRFIDUsersSupported::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_number_of_week_day_schedules_supported_per_user(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(weekday_access_schedules), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfWeekDaySchedulesSupportedPerUser::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(253)); + return attribute; +} + +attribute_t *create_number_of_year_day_schedules_supported_per_user(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(year_day_access_schedules), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfYearDaySchedulesSupportedPerUser::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(253)); + return attribute; +} + +attribute_t *create_number_of_holiday_schedules_supported(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(holiday_schedules), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfHolidaySchedulesSupported::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(253)); + return attribute; +} + +attribute_t *create_max_pin_code_length(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(pin_credential), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxPINCodeLength::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_min_pin_code_length(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(pin_credential), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MinPINCodeLength::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_max_rfid_code_length(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(rfid_credential), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxRFIDCodeLength::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_min_rfid_code_length(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(rfid_credential), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MinRFIDCodeLength::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_credential_rules_support(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CredentialRulesSupport::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(7)); + return attribute; +} + +attribute_t *create_number_of_credentials_supported_per_user(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfCredentialsSupportedPerUser::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_language(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_language_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, Language::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_char_str(value, length), k_max_language_length + 1); +} + +attribute_t *create_led_settings(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LEDSettings::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_auto_relock_time(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, AutoRelockTime::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +attribute_t *create_sound_volume(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SoundVolume::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(3)); + return attribute; +} + +attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, OperatingMode::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(4)); + return attribute; +} + +attribute_t *create_supported_operating_modes(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SupportedOperatingModes::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap16(0), esp_matter_bitmap16(65535)); + return attribute; +} + +attribute_t *create_default_configuration_register(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, DefaultConfigurationRegister::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap16(0), esp_matter_bitmap16(65535)); + return attribute; +} + +attribute_t *create_enable_local_programming(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, EnableLocalProgramming::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value)); +} + +attribute_t *create_enable_one_touch_locking(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, EnableOneTouchLocking::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value)); +} + +attribute_t *create_enable_inside_status_led(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, EnableInsideStatusLED::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value)); +} + +attribute_t *create_enable_privacy_mode_button(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, EnablePrivacyModeButton::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value)); +} + +attribute_t *create_local_programming_features(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LocalProgrammingFeatures::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(15)); + return attribute; +} + +attribute_t *create_wrong_code_entry_limit(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(pin_credential)) || (has_feature(rfid_credential))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, WrongCodeEntryLimit::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(255)); + return attribute; +} + +attribute_t *create_user_code_temporary_disable_time(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(pin_credential)) || (has_feature(rfid_credential))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, UserCodeTemporaryDisableTime::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(255)); + return attribute; +} + +attribute_t *create_send_pin_over_the_air(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, SendPINOverTheAir::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value)); +} + +attribute_t *create_require_pin_for_remote_operation(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(credential_over_the_air_access)) && (has_feature(pin_credential))), NULL); + return esp_matter::attribute::create(cluster, RequirePINforRemoteOperation::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value)); +} + +attribute_t *create_expiring_user_timeout(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ExpiringUserTimeout::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(1), esp_matter_uint16(2880)); + return attribute; +} + +attribute_t *create_aliro_reader_verification_key(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(aliro_provisioning), NULL); + return esp_matter::attribute::create(cluster, AliroReaderVerificationKey::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_octet_str(value, length)); +} + +attribute_t *create_aliro_reader_group_identifier(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(aliro_provisioning), NULL); + return esp_matter::attribute::create(cluster, AliroReaderGroupIdentifier::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_octet_str(value, length)); +} + +attribute_t *create_aliro_reader_group_sub_identifier(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(aliro_provisioning), NULL); + return esp_matter::attribute::create(cluster, AliroReaderGroupSubIdentifier::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_octet_str(value, length)); +} + +attribute_t *create_aliro_expedited_transaction_supported_protocol_versions(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(aliro_provisioning), NULL); + return esp_matter::attribute::create(cluster, AliroExpeditedTransactionSupportedProtocolVersions::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_aliro_group_resolving_key(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(aliro_bleuwb), NULL); + return esp_matter::attribute::create(cluster, AliroGroupResolvingKey::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_octet_str(value, length)); +} + +attribute_t *create_aliro_supported_bleuwb_protocol_versions(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(aliro_bleuwb), NULL); + return esp_matter::attribute::create(cluster, AliroSupportedBLEUWBProtocolVersions::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_aliro_ble_advertising_version(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(aliro_bleuwb), NULL); + return esp_matter::attribute::create(cluster, AliroBLEAdvertisingVersion::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_number_of_aliro_credential_issuer_keys_supported(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(aliro_provisioning), NULL); + return esp_matter::attribute::create(cluster, NumberOfAliroCredentialIssuerKeysSupported::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_number_of_aliro_endpoint_keys_supported(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(aliro_provisioning), NULL); + return esp_matter::attribute::create(cluster, NumberOfAliroEndpointKeysSupported::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +} /* attribute */ +namespace command { +command_t *create_lock_door(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, LockDoor::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_lock_door); +} + +command_t *create_unlock_door(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, UnlockDoor::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_unlock_door); +} + +command_t *create_unlock_with_timeout(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, UnlockWithTimeout::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_unlock_with_timeout); +} + +command_t *create_set_week_day_schedule(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(weekday_access_schedules), NULL); + return esp_matter::command::create(cluster, SetWeekDaySchedule::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_week_day_schedule); +} + +command_t *create_get_week_day_schedule(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(weekday_access_schedules), NULL); + return esp_matter::command::create(cluster, GetWeekDaySchedule::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_get_week_day_schedule); +} + +command_t *create_get_week_day_schedule_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(weekday_access_schedules), NULL); + return esp_matter::command::create(cluster, GetWeekDayScheduleResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_clear_week_day_schedule(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(weekday_access_schedules), NULL); + return esp_matter::command::create(cluster, ClearWeekDaySchedule::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_clear_week_day_schedule); +} + +command_t *create_set_year_day_schedule(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(year_day_access_schedules), NULL); + return esp_matter::command::create(cluster, SetYearDaySchedule::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_year_day_schedule); +} + +command_t *create_get_year_day_schedule(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(year_day_access_schedules), NULL); + return esp_matter::command::create(cluster, GetYearDaySchedule::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_get_year_day_schedule); +} + +command_t *create_get_year_day_schedule_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(year_day_access_schedules), NULL); + return esp_matter::command::create(cluster, GetYearDayScheduleResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_clear_year_day_schedule(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(year_day_access_schedules), NULL); + return esp_matter::command::create(cluster, ClearYearDaySchedule::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_clear_year_day_schedule); +} + +command_t *create_set_holiday_schedule(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(holiday_schedules), NULL); + return esp_matter::command::create(cluster, SetHolidaySchedule::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_holiday_schedule); +} + +command_t *create_get_holiday_schedule(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(holiday_schedules), NULL); + return esp_matter::command::create(cluster, GetHolidaySchedule::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_get_holiday_schedule); +} + +command_t *create_get_holiday_schedule_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(holiday_schedules), NULL); + return esp_matter::command::create(cluster, GetHolidayScheduleResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_clear_holiday_schedule(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(holiday_schedules), NULL); + return esp_matter::command::create(cluster, ClearHolidaySchedule::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_clear_holiday_schedule); +} + +command_t *create_set_user(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user), NULL); + return esp_matter::command::create(cluster, SetUser::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_user); +} + +command_t *create_get_user(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user), NULL); + return esp_matter::command::create(cluster, GetUser::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_get_user); +} + +command_t *create_get_user_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user), NULL); + return esp_matter::command::create(cluster, GetUserResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_clear_user(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user), NULL); + return esp_matter::command::create(cluster, ClearUser::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_clear_user); +} + +command_t *create_set_credential(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user), NULL); + return esp_matter::command::create(cluster, SetCredential::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_credential); +} + +command_t *create_set_credential_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user), NULL); + return esp_matter::command::create(cluster, SetCredentialResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_get_credential_status(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user), NULL); + return esp_matter::command::create(cluster, GetCredentialStatus::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_get_credential_status); +} + +command_t *create_get_credential_status_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user), NULL); + return esp_matter::command::create(cluster, GetCredentialStatusResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_clear_credential(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user), NULL); + return esp_matter::command::create(cluster, ClearCredential::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_clear_credential); +} + +command_t *create_unbolt_door(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(unbolting), NULL); + return esp_matter::command::create(cluster, UnboltDoor::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_unbolt_door); +} + +command_t *create_set_aliro_reader_config(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(aliro_provisioning), NULL); + return esp_matter::command::create(cluster, SetAliroReaderConfig::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_aliro_reader_config); +} + +command_t *create_clear_aliro_reader_config(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(aliro_provisioning), NULL); + return esp_matter::command::create(cluster, ClearAliroReaderConfig::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_clear_aliro_reader_config); +} + +} /* command */ + +namespace event { +event_t *create_door_lock_alarm(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, DoorLockAlarm::Id); +} + +event_t *create_door_state_change(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(door_position_sensor), NULL); + return esp_matter::event::create(cluster, DoorStateChange::Id); +} + +event_t *create_lock_operation(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, LockOperation::Id); +} + +event_t *create_lock_operation_error(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, LockOperationError::Id); +} + +event_t *create_lock_user_change(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user), NULL); + return esp_matter::event::create(cluster, LockUserChange::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t function_list[] = { + (function_generic_t)MatterDoorLockClusterServerAttributeChangedCallback, + (function_generic_t)MatterDoorLockClusterServerShutdownCallback, + (function_generic_t)MatterDoorLockClusterServerPreAttributeChangedCallback, +}; + +const int function_flags = CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION | CLUSTER_FLAG_SHUTDOWN_FUNCTION | CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, door_lock::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, door_lock::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = DoorLockDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterDoorLockPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_lock_state(cluster, config->lock_state); + attribute::create_lock_type(cluster, config->lock_type); + attribute::create_actuator_enabled(cluster, config->actuator_enabled); + attribute::create_operating_mode(cluster, config->operating_mode); + attribute::create_supported_operating_modes(cluster, config->supported_operating_modes); + command::create_lock_door(cluster); + command::create_unlock_door(cluster); + /* Events */ + event::create_door_lock_alarm(cluster); + event::create_lock_operation(cluster); + event::create_lock_operation_error(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* door_lock */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/door_lock/door_lock.h b/components/esp_matter/data_model/generated/clusters/door_lock/door_lock.h new file mode 100644 index 000000000..80efeadff --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/door_lock/door_lock.h @@ -0,0 +1,226 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace door_lock { + +const uint8_t k_max_language_length = 3u; +namespace feature { +namespace pin_credential { +typedef struct config { + uint16_t number_of_pin_users_supported; + uint8_t max_pin_code_length; + uint8_t min_pin_code_length; + uint8_t wrong_code_entry_limit; + uint8_t user_code_temporary_disable_time; + bool require_pin_for_remote_operation; + config() : number_of_pin_users_supported(0), max_pin_code_length(0), min_pin_code_length(0), wrong_code_entry_limit(0), user_code_temporary_disable_time(0), require_pin_for_remote_operation(false) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* pin_credential */ + +namespace rfid_credential { +typedef struct config { + uint16_t number_of_rfid_users_supported; + uint8_t max_rfid_code_length; + uint8_t min_rfid_code_length; + uint8_t wrong_code_entry_limit; + uint8_t user_code_temporary_disable_time; + config() : number_of_rfid_users_supported(0), max_rfid_code_length(0), min_rfid_code_length(0), wrong_code_entry_limit(0), user_code_temporary_disable_time(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* rfid_credential */ + +namespace weekday_access_schedules { +typedef struct config { + uint8_t number_of_week_day_schedules_supported_per_user; + config() : number_of_week_day_schedules_supported_per_user(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* weekday_access_schedules */ + +namespace door_position_sensor { +typedef struct config { + nullable door_state; + config() : door_state(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* door_position_sensor */ + +namespace credential_over_the_air_access { +typedef struct config { + bool require_pin_for_remote_operation; + config() : require_pin_for_remote_operation(false) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* credential_over_the_air_access */ + +namespace user { +typedef struct config { + uint16_t number_of_total_users_supported; + uint8_t credential_rules_support; + uint8_t number_of_credentials_supported_per_user; + config() : number_of_total_users_supported(0), credential_rules_support(0), number_of_credentials_supported_per_user(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* user */ + +namespace year_day_access_schedules { +typedef struct config { + uint8_t number_of_year_day_schedules_supported_per_user; + config() : number_of_year_day_schedules_supported_per_user(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* year_day_access_schedules */ + +namespace holiday_schedules { +typedef struct config { + uint8_t number_of_holiday_schedules_supported; + config() : number_of_holiday_schedules_supported(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* holiday_schedules */ + +namespace unbolting { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* unbolting */ + +namespace aliro_provisioning { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* aliro_provisioning */ + +namespace aliro_bleuwb { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* aliro_bleuwb */ + +} /* feature */ + +namespace attribute { +attribute_t *create_lock_state(cluster_t *cluster, nullable value); +attribute_t *create_lock_type(cluster_t *cluster, uint8_t value); +attribute_t *create_actuator_enabled(cluster_t *cluster, bool value); +attribute_t *create_door_state(cluster_t *cluster, nullable value); +attribute_t *create_door_open_events(cluster_t *cluster, uint32_t value); +attribute_t *create_door_closed_events(cluster_t *cluster, uint32_t value); +attribute_t *create_open_period(cluster_t *cluster, uint16_t value); +attribute_t *create_number_of_total_users_supported(cluster_t *cluster, uint16_t value); +attribute_t *create_number_of_pin_users_supported(cluster_t *cluster, uint16_t value); +attribute_t *create_number_of_rfid_users_supported(cluster_t *cluster, uint16_t value); +attribute_t *create_number_of_week_day_schedules_supported_per_user(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_year_day_schedules_supported_per_user(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_holiday_schedules_supported(cluster_t *cluster, uint8_t value); +attribute_t *create_max_pin_code_length(cluster_t *cluster, uint8_t value); +attribute_t *create_min_pin_code_length(cluster_t *cluster, uint8_t value); +attribute_t *create_max_rfid_code_length(cluster_t *cluster, uint8_t value); +attribute_t *create_min_rfid_code_length(cluster_t *cluster, uint8_t value); +attribute_t *create_credential_rules_support(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_credentials_supported_per_user(cluster_t *cluster, uint8_t value); +attribute_t *create_language(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_led_settings(cluster_t *cluster, uint8_t value); +attribute_t *create_auto_relock_time(cluster_t *cluster, uint32_t value); +attribute_t *create_sound_volume(cluster_t *cluster, uint8_t value); +attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_supported_operating_modes(cluster_t *cluster, uint16_t value); +attribute_t *create_default_configuration_register(cluster_t *cluster, uint16_t value); +attribute_t *create_enable_local_programming(cluster_t *cluster, bool value); +attribute_t *create_enable_one_touch_locking(cluster_t *cluster, bool value); +attribute_t *create_enable_inside_status_led(cluster_t *cluster, bool value); +attribute_t *create_enable_privacy_mode_button(cluster_t *cluster, bool value); +attribute_t *create_local_programming_features(cluster_t *cluster, uint8_t value); +attribute_t *create_wrong_code_entry_limit(cluster_t *cluster, uint8_t value); +attribute_t *create_user_code_temporary_disable_time(cluster_t *cluster, uint8_t value); +attribute_t *create_send_pin_over_the_air(cluster_t *cluster, bool value); +attribute_t *create_require_pin_for_remote_operation(cluster_t *cluster, bool value); +attribute_t *create_expiring_user_timeout(cluster_t *cluster, uint16_t value); +attribute_t *create_aliro_reader_verification_key(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_aliro_reader_group_identifier(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_aliro_reader_group_sub_identifier(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_aliro_expedited_transaction_supported_protocol_versions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_aliro_group_resolving_key(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_aliro_supported_bleuwb_protocol_versions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_aliro_ble_advertising_version(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_aliro_credential_issuer_keys_supported(cluster_t *cluster, uint16_t value); +attribute_t *create_number_of_aliro_endpoint_keys_supported(cluster_t *cluster, uint16_t value); +} /* attribute */ + +namespace command { +command_t *create_lock_door(cluster_t *cluster); +command_t *create_unlock_door(cluster_t *cluster); +command_t *create_unlock_with_timeout(cluster_t *cluster); +command_t *create_set_week_day_schedule(cluster_t *cluster); +command_t *create_get_week_day_schedule(cluster_t *cluster); +command_t *create_get_week_day_schedule_response(cluster_t *cluster); +command_t *create_clear_week_day_schedule(cluster_t *cluster); +command_t *create_set_year_day_schedule(cluster_t *cluster); +command_t *create_get_year_day_schedule(cluster_t *cluster); +command_t *create_get_year_day_schedule_response(cluster_t *cluster); +command_t *create_clear_year_day_schedule(cluster_t *cluster); +command_t *create_set_holiday_schedule(cluster_t *cluster); +command_t *create_get_holiday_schedule(cluster_t *cluster); +command_t *create_get_holiday_schedule_response(cluster_t *cluster); +command_t *create_clear_holiday_schedule(cluster_t *cluster); +command_t *create_set_user(cluster_t *cluster); +command_t *create_get_user(cluster_t *cluster); +command_t *create_get_user_response(cluster_t *cluster); +command_t *create_clear_user(cluster_t *cluster); +command_t *create_set_credential(cluster_t *cluster); +command_t *create_set_credential_response(cluster_t *cluster); +command_t *create_get_credential_status(cluster_t *cluster); +command_t *create_get_credential_status_response(cluster_t *cluster); +command_t *create_clear_credential(cluster_t *cluster); +command_t *create_unbolt_door(cluster_t *cluster); +command_t *create_set_aliro_reader_config(cluster_t *cluster); +command_t *create_clear_aliro_reader_config(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_door_lock_alarm(cluster_t *cluster); +event_t *create_door_state_change(cluster_t *cluster); +event_t *create_lock_operation(cluster_t *cluster); +event_t *create_lock_operation_error(cluster_t *cluster); +event_t *create_lock_user_change(cluster_t *cluster); +} /* event */ + +typedef struct config { + nullable lock_state; + uint8_t lock_type; + bool actuator_enabled; + uint8_t operating_mode; + uint16_t supported_operating_modes; + void *delegate; + config() : lock_state(0), lock_type(0), actuator_enabled(false), operating_mode(0), supported_operating_modes(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* door_lock */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/door_lock/door_lock_ids.h b/components/esp_matter/data_model/generated/clusters/door_lock/door_lock_ids.h new file mode 100644 index 000000000..63635987f --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/door_lock/door_lock_ids.h @@ -0,0 +1,304 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace door_lock { + +inline constexpr uint32_t Id = 0x0101; + +namespace feature { +namespace PINCredential { +inline constexpr uint32_t Id = 0x1; +} /* PINCredential */ +namespace RFIDCredential { +inline constexpr uint32_t Id = 0x2; +} /* RFIDCredential */ +namespace WeekdayAccessSchedules { +inline constexpr uint32_t Id = 0x10; +} /* WeekdayAccessSchedules */ +namespace DoorPositionSensor { +inline constexpr uint32_t Id = 0x20; +} /* DoorPositionSensor */ +namespace CredentialOverTheAirAccess { +inline constexpr uint32_t Id = 0x80; +} /* CredentialOverTheAirAccess */ +namespace User { +inline constexpr uint32_t Id = 0x100; +} /* User */ +namespace YearDayAccessSchedules { +inline constexpr uint32_t Id = 0x400; +} /* YearDayAccessSchedules */ +namespace HolidaySchedules { +inline constexpr uint32_t Id = 0x800; +} /* HolidaySchedules */ +namespace Unbolting { +inline constexpr uint32_t Id = 0x1000; +} /* Unbolting */ +namespace AliroProvisioning { +inline constexpr uint32_t Id = 0x2000; +} /* AliroProvisioning */ +namespace AliroBLEUWB { +inline constexpr uint32_t Id = 0x4000; +} /* AliroBLEUWB */ +} /* feature */ + +namespace attribute { +namespace LockState { +inline constexpr uint32_t Id = 0x0000; +} /* LockState */ +namespace LockType { +inline constexpr uint32_t Id = 0x0001; +} /* LockType */ +namespace ActuatorEnabled { +inline constexpr uint32_t Id = 0x0002; +} /* ActuatorEnabled */ +namespace DoorState { +inline constexpr uint32_t Id = 0x0003; +} /* DoorState */ +namespace DoorOpenEvents { +inline constexpr uint32_t Id = 0x0004; +} /* DoorOpenEvents */ +namespace DoorClosedEvents { +inline constexpr uint32_t Id = 0x0005; +} /* DoorClosedEvents */ +namespace OpenPeriod { +inline constexpr uint32_t Id = 0x0006; +} /* OpenPeriod */ +namespace NumberOfTotalUsersSupported { +inline constexpr uint32_t Id = 0x0011; +} /* NumberOfTotalUsersSupported */ +namespace NumberOfPINUsersSupported { +inline constexpr uint32_t Id = 0x0012; +} /* NumberOfPINUsersSupported */ +namespace NumberOfRFIDUsersSupported { +inline constexpr uint32_t Id = 0x0013; +} /* NumberOfRFIDUsersSupported */ +namespace NumberOfWeekDaySchedulesSupportedPerUser { +inline constexpr uint32_t Id = 0x0014; +} /* NumberOfWeekDaySchedulesSupportedPerUser */ +namespace NumberOfYearDaySchedulesSupportedPerUser { +inline constexpr uint32_t Id = 0x0015; +} /* NumberOfYearDaySchedulesSupportedPerUser */ +namespace NumberOfHolidaySchedulesSupported { +inline constexpr uint32_t Id = 0x0016; +} /* NumberOfHolidaySchedulesSupported */ +namespace MaxPINCodeLength { +inline constexpr uint32_t Id = 0x0017; +} /* MaxPINCodeLength */ +namespace MinPINCodeLength { +inline constexpr uint32_t Id = 0x0018; +} /* MinPINCodeLength */ +namespace MaxRFIDCodeLength { +inline constexpr uint32_t Id = 0x0019; +} /* MaxRFIDCodeLength */ +namespace MinRFIDCodeLength { +inline constexpr uint32_t Id = 0x001A; +} /* MinRFIDCodeLength */ +namespace CredentialRulesSupport { +inline constexpr uint32_t Id = 0x001B; +} /* CredentialRulesSupport */ +namespace NumberOfCredentialsSupportedPerUser { +inline constexpr uint32_t Id = 0x001C; +} /* NumberOfCredentialsSupportedPerUser */ +namespace Language { +inline constexpr uint32_t Id = 0x0021; +} /* Language */ +namespace LEDSettings { +inline constexpr uint32_t Id = 0x0022; +} /* LEDSettings */ +namespace AutoRelockTime { +inline constexpr uint32_t Id = 0x0023; +} /* AutoRelockTime */ +namespace SoundVolume { +inline constexpr uint32_t Id = 0x0024; +} /* SoundVolume */ +namespace OperatingMode { +inline constexpr uint32_t Id = 0x0025; +} /* OperatingMode */ +namespace SupportedOperatingModes { +inline constexpr uint32_t Id = 0x0026; +} /* SupportedOperatingModes */ +namespace DefaultConfigurationRegister { +inline constexpr uint32_t Id = 0x0027; +} /* DefaultConfigurationRegister */ +namespace EnableLocalProgramming { +inline constexpr uint32_t Id = 0x0028; +} /* EnableLocalProgramming */ +namespace EnableOneTouchLocking { +inline constexpr uint32_t Id = 0x0029; +} /* EnableOneTouchLocking */ +namespace EnableInsideStatusLED { +inline constexpr uint32_t Id = 0x002A; +} /* EnableInsideStatusLED */ +namespace EnablePrivacyModeButton { +inline constexpr uint32_t Id = 0x002B; +} /* EnablePrivacyModeButton */ +namespace LocalProgrammingFeatures { +inline constexpr uint32_t Id = 0x002C; +} /* LocalProgrammingFeatures */ +namespace WrongCodeEntryLimit { +inline constexpr uint32_t Id = 0x0030; +} /* WrongCodeEntryLimit */ +namespace UserCodeTemporaryDisableTime { +inline constexpr uint32_t Id = 0x0031; +} /* UserCodeTemporaryDisableTime */ +namespace SendPINOverTheAir { +inline constexpr uint32_t Id = 0x0032; +} /* SendPINOverTheAir */ +namespace RequirePINforRemoteOperation { +inline constexpr uint32_t Id = 0x0033; +} /* RequirePINforRemoteOperation */ +namespace ExpiringUserTimeout { +inline constexpr uint32_t Id = 0x0035; +} /* ExpiringUserTimeout */ +namespace AliroReaderVerificationKey { +inline constexpr uint32_t Id = 0x0080; +} /* AliroReaderVerificationKey */ +namespace AliroReaderGroupIdentifier { +inline constexpr uint32_t Id = 0x0081; +} /* AliroReaderGroupIdentifier */ +namespace AliroReaderGroupSubIdentifier { +inline constexpr uint32_t Id = 0x0082; +} /* AliroReaderGroupSubIdentifier */ +namespace AliroExpeditedTransactionSupportedProtocolVersions { +inline constexpr uint32_t Id = 0x0083; +} /* AliroExpeditedTransactionSupportedProtocolVersions */ +namespace AliroGroupResolvingKey { +inline constexpr uint32_t Id = 0x0084; +} /* AliroGroupResolvingKey */ +namespace AliroSupportedBLEUWBProtocolVersions { +inline constexpr uint32_t Id = 0x0085; +} /* AliroSupportedBLEUWBProtocolVersions */ +namespace AliroBLEAdvertisingVersion { +inline constexpr uint32_t Id = 0x0086; +} /* AliroBLEAdvertisingVersion */ +namespace NumberOfAliroCredentialIssuerKeysSupported { +inline constexpr uint32_t Id = 0x0087; +} /* NumberOfAliroCredentialIssuerKeysSupported */ +namespace NumberOfAliroEndpointKeysSupported { +inline constexpr uint32_t Id = 0x0088; +} /* NumberOfAliroEndpointKeysSupported */ +} /* attribute */ + +namespace command { +namespace LockDoor { +inline constexpr uint32_t Id = 0x00; +} /* LockDoor */ +namespace UnlockDoor { +inline constexpr uint32_t Id = 0x01; +} /* UnlockDoor */ +namespace UnlockWithTimeout { +inline constexpr uint32_t Id = 0x03; +} /* UnlockWithTimeout */ +namespace SetWeekDaySchedule { +inline constexpr uint32_t Id = 0x0B; +} /* SetWeekDaySchedule */ +namespace GetWeekDaySchedule { +inline constexpr uint32_t Id = 0x0C; +} /* GetWeekDaySchedule */ +namespace GetWeekDayScheduleResponse { +inline constexpr uint32_t Id = 0x0C; +} /* GetWeekDayScheduleResponse */ +namespace ClearWeekDaySchedule { +inline constexpr uint32_t Id = 0x0D; +} /* ClearWeekDaySchedule */ +namespace SetYearDaySchedule { +inline constexpr uint32_t Id = 0x0E; +} /* SetYearDaySchedule */ +namespace GetYearDaySchedule { +inline constexpr uint32_t Id = 0x0F; +} /* GetYearDaySchedule */ +namespace GetYearDayScheduleResponse { +inline constexpr uint32_t Id = 0x0F; +} /* GetYearDayScheduleResponse */ +namespace ClearYearDaySchedule { +inline constexpr uint32_t Id = 0x10; +} /* ClearYearDaySchedule */ +namespace SetHolidaySchedule { +inline constexpr uint32_t Id = 0x11; +} /* SetHolidaySchedule */ +namespace GetHolidaySchedule { +inline constexpr uint32_t Id = 0x12; +} /* GetHolidaySchedule */ +namespace GetHolidayScheduleResponse { +inline constexpr uint32_t Id = 0x12; +} /* GetHolidayScheduleResponse */ +namespace ClearHolidaySchedule { +inline constexpr uint32_t Id = 0x13; +} /* ClearHolidaySchedule */ +namespace SetUser { +inline constexpr uint32_t Id = 0x1A; +} /* SetUser */ +namespace GetUser { +inline constexpr uint32_t Id = 0x1B; +} /* GetUser */ +namespace GetUserResponse { +inline constexpr uint32_t Id = 0x1C; +} /* GetUserResponse */ +namespace ClearUser { +inline constexpr uint32_t Id = 0x1D; +} /* ClearUser */ +namespace SetCredential { +inline constexpr uint32_t Id = 0x22; +} /* SetCredential */ +namespace SetCredentialResponse { +inline constexpr uint32_t Id = 0x23; +} /* SetCredentialResponse */ +namespace GetCredentialStatus { +inline constexpr uint32_t Id = 0x24; +} /* GetCredentialStatus */ +namespace GetCredentialStatusResponse { +inline constexpr uint32_t Id = 0x25; +} /* GetCredentialStatusResponse */ +namespace ClearCredential { +inline constexpr uint32_t Id = 0x26; +} /* ClearCredential */ +namespace UnboltDoor { +inline constexpr uint32_t Id = 0x27; +} /* UnboltDoor */ +namespace SetAliroReaderConfig { +inline constexpr uint32_t Id = 0x28; +} /* SetAliroReaderConfig */ +namespace ClearAliroReaderConfig { +inline constexpr uint32_t Id = 0x29; +} /* ClearAliroReaderConfig */ +} /* command */ + +namespace event { +namespace DoorLockAlarm { +inline constexpr uint32_t Id = 0x00; +} /* DoorLockAlarm */ +namespace DoorStateChange { +inline constexpr uint32_t Id = 0x01; +} /* DoorStateChange */ +namespace LockOperation { +inline constexpr uint32_t Id = 0x02; +} /* LockOperation */ +namespace LockOperationError { +inline constexpr uint32_t Id = 0x03; +} /* LockOperationError */ +namespace LockUserChange { +inline constexpr uint32_t Id = 0x04; +} /* LockUserChange */ +} /* event */ + +} /* door_lock */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ecosystem_information/ecosystem_information.cpp b/components/esp_matter/data_model/generated/clusters/ecosystem_information/ecosystem_information.cpp new file mode 100644 index 000000000..c026e0f7d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ecosystem_information/ecosystem_information.cpp @@ -0,0 +1,86 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "ecosystem_information_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace ecosystem_information { + +namespace attribute { +attribute_t *create_device_directory(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, DeviceDirectory::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_location_directory(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, LocationDirectory::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, ecosystem_information::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, ecosystem_information::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterEcosystemInformationPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_device_directory(cluster, NULL, 0, 0); + attribute::create_location_directory(cluster, NULL, 0, 0); + } + + return cluster; +} + +} /* ecosystem_information */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ecosystem_information/ecosystem_information.h b/components/esp_matter/data_model/generated/clusters/ecosystem_information/ecosystem_information.h new file mode 100644 index 000000000..11e79418b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ecosystem_information/ecosystem_information.h @@ -0,0 +1,37 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace ecosystem_information { + +namespace attribute { +attribute_t *create_device_directory(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_location_directory(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* ecosystem_information */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ecosystem_information/ecosystem_information_ids.h b/components/esp_matter/data_model/generated/clusters/ecosystem_information/ecosystem_information_ids.h new file mode 100644 index 000000000..1eb64ccfe --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ecosystem_information/ecosystem_information_ids.h @@ -0,0 +1,37 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace ecosystem_information { + +inline constexpr uint32_t Id = 0x0750; + +namespace attribute { +namespace DeviceDirectory { +inline constexpr uint32_t Id = 0x0000; +} /* DeviceDirectory */ +namespace LocationDirectory { +inline constexpr uint32_t Id = 0x0001; +} /* LocationDirectory */ +} /* attribute */ + +} /* ecosystem_information */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/electrical_energy_measurement/electrical_energy_measurement.cpp b/components/esp_matter/data_model/generated/clusters/electrical_energy_measurement/electrical_energy_measurement.cpp new file mode 100644 index 000000000..fb216a319 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/electrical_energy_measurement/electrical_energy_measurement.cpp @@ -0,0 +1,234 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "electrical_energy_measurement_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace electrical_energy_measurement { + +namespace feature { +namespace imported_energy { +uint32_t get_id() +{ + return ImportedEnergy::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_cumulative_energy_imported(cluster, NULL, 0, 0); + attribute::create_periodic_energy_imported(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* imported_energy */ + +namespace exported_energy { +uint32_t get_id() +{ + return ExportedEnergy::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_cumulative_energy_exported(cluster, NULL, 0, 0); + attribute::create_periodic_energy_exported(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* exported_energy */ + +namespace cumulative_energy { +uint32_t get_id() +{ + return CumulativeEnergy::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_cumulative_energy_imported(cluster, NULL, 0, 0); + attribute::create_cumulative_energy_exported(cluster, NULL, 0, 0); + event::create_cumulative_energy_measured(cluster); + + return ESP_OK; +} +} /* cumulative_energy */ + +namespace periodic_energy { +uint32_t get_id() +{ + return PeriodicEnergy::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_periodic_energy_imported(cluster, NULL, 0, 0); + attribute::create_periodic_energy_exported(cluster, NULL, 0, 0); + event::create_periodic_energy_measured(cluster); + + return ESP_OK; +} +} /* periodic_energy */ + +} /* feature */ + +namespace attribute { +attribute_t *create_accuracy(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Accuracy::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_cumulative_energy_imported(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(imported_energy)) && (has_feature(cumulative_energy))), NULL); + return esp_matter::attribute::create(cluster, CumulativeEnergyImported::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_cumulative_energy_exported(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(exported_energy)) && (has_feature(cumulative_energy))), NULL); + return esp_matter::attribute::create(cluster, CumulativeEnergyExported::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_periodic_energy_imported(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(imported_energy)) && (has_feature(periodic_energy))), NULL); + return esp_matter::attribute::create(cluster, PeriodicEnergyImported::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_periodic_energy_exported(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(exported_energy)) && (has_feature(periodic_energy))), NULL); + return esp_matter::attribute::create(cluster, PeriodicEnergyExported::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_cumulative_energy_reset(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CumulativeEnergyReset::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +namespace event { +event_t *create_cumulative_energy_measured(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(cumulative_energy), NULL); + return esp_matter::event::create(cluster, CumulativeEnergyMeasured::Id); +} + +event_t *create_periodic_energy_measured(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(periodic_energy), NULL); + return esp_matter::event::create(cluster, PeriodicEnergyMeasured::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, electrical_energy_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, electrical_energy_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterElectricalEnergyMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_accuracy(cluster, NULL, 0, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("ImportedEnergy,ExportedEnergy", + feature::imported_energy::get_id(), feature::exported_energy::get_id()); + if (feature_map & feature::imported_energy::get_id()) { + VerifyOrReturnValue(feature::imported_energy::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::exported_energy::get_id()) { + VerifyOrReturnValue(feature::exported_energy::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + VALIDATE_FEATURES_AT_LEAST_ONE("CumulativeEnergy,PeriodicEnergy", + feature::cumulative_energy::get_id(), feature::periodic_energy::get_id()); + if (feature_map & feature::cumulative_energy::get_id()) { + VerifyOrReturnValue(feature::cumulative_energy::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::periodic_energy::get_id()) { + VerifyOrReturnValue(feature::periodic_energy::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterElectricalEnergyMeasurementClusterServerInitCallback, + ESPMatterElectricalEnergyMeasurementClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* electrical_energy_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/electrical_energy_measurement/electrical_energy_measurement.h b/components/esp_matter/data_model/generated/clusters/electrical_energy_measurement/electrical_energy_measurement.h new file mode 100644 index 000000000..c4308d809 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/electrical_energy_measurement/electrical_energy_measurement.h @@ -0,0 +1,70 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace electrical_energy_measurement { + +namespace feature { +namespace imported_energy { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* imported_energy */ + +namespace exported_energy { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* exported_energy */ + +namespace cumulative_energy { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* cumulative_energy */ + +namespace periodic_energy { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* periodic_energy */ + +} /* feature */ + +namespace attribute { +attribute_t *create_accuracy(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_cumulative_energy_imported(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_cumulative_energy_exported(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_periodic_energy_imported(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_periodic_energy_exported(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_cumulative_energy_reset(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace event { +event_t *create_cumulative_energy_measured(cluster_t *cluster); +event_t *create_periodic_energy_measured(cluster_t *cluster); +} /* event */ + +typedef struct config { + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* electrical_energy_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/electrical_energy_measurement/electrical_energy_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/electrical_energy_measurement/electrical_energy_measurement_ids.h new file mode 100644 index 000000000..1c1bb2103 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/electrical_energy_measurement/electrical_energy_measurement_ids.h @@ -0,0 +1,73 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace electrical_energy_measurement { + +inline constexpr uint32_t Id = 0x0091; + +namespace feature { +namespace ImportedEnergy { +inline constexpr uint32_t Id = 0x1; +} /* ImportedEnergy */ +namespace ExportedEnergy { +inline constexpr uint32_t Id = 0x2; +} /* ExportedEnergy */ +namespace CumulativeEnergy { +inline constexpr uint32_t Id = 0x4; +} /* CumulativeEnergy */ +namespace PeriodicEnergy { +inline constexpr uint32_t Id = 0x8; +} /* PeriodicEnergy */ +} /* feature */ + +namespace attribute { +namespace Accuracy { +inline constexpr uint32_t Id = 0x0000; +} /* Accuracy */ +namespace CumulativeEnergyImported { +inline constexpr uint32_t Id = 0x0001; +} /* CumulativeEnergyImported */ +namespace CumulativeEnergyExported { +inline constexpr uint32_t Id = 0x0002; +} /* CumulativeEnergyExported */ +namespace PeriodicEnergyImported { +inline constexpr uint32_t Id = 0x0003; +} /* PeriodicEnergyImported */ +namespace PeriodicEnergyExported { +inline constexpr uint32_t Id = 0x0004; +} /* PeriodicEnergyExported */ +namespace CumulativeEnergyReset { +inline constexpr uint32_t Id = 0x0005; +} /* CumulativeEnergyReset */ +} /* attribute */ + +namespace event { +namespace CumulativeEnergyMeasured { +inline constexpr uint32_t Id = 0x00; +} /* CumulativeEnergyMeasured */ +namespace PeriodicEnergyMeasured { +inline constexpr uint32_t Id = 0x01; +} /* PeriodicEnergyMeasured */ +} /* event */ + +} /* electrical_energy_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/electrical_grid_conditions/electrical_grid_conditions.cpp b/components/esp_matter/data_model/generated/clusters/electrical_grid_conditions/electrical_grid_conditions.cpp new file mode 100644 index 000000000..7449e2cb0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/electrical_grid_conditions/electrical_grid_conditions.cpp @@ -0,0 +1,135 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "electrical_grid_conditions_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace electrical_grid_conditions { + +namespace feature { +namespace forecasting { +uint32_t get_id() +{ + return Forecasting::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_forecast_conditions(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* forecasting */ + +} /* feature */ + +namespace attribute { +attribute_t *create_local_generation_available(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, LocalGenerationAvailable::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_bool(value)); +} + +attribute_t *create_current_conditions(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CurrentConditions::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_forecast_conditions(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(forecasting), NULL); + return esp_matter::attribute::create(cluster, ForecastConditions::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +namespace event { +event_t *create_current_conditions_changed(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, CurrentConditionsChanged::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, electrical_grid_conditions::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, electrical_grid_conditions::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ElectricalGridConditionsDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterElectricalGridConditionsPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_local_generation_available(cluster, false); + attribute::create_current_conditions(cluster, NULL, 0, 0); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* electrical_grid_conditions */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/electrical_grid_conditions/electrical_grid_conditions.h b/components/esp_matter/data_model/generated/clusters/electrical_grid_conditions/electrical_grid_conditions.h new file mode 100644 index 000000000..76c43fe9f --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/electrical_grid_conditions/electrical_grid_conditions.h @@ -0,0 +1,51 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace electrical_grid_conditions { + +namespace feature { +namespace forecasting { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* forecasting */ + +} /* feature */ + +namespace attribute { +attribute_t *create_local_generation_available(cluster_t *cluster, nullable value); +attribute_t *create_current_conditions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_forecast_conditions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace event { +event_t *create_current_conditions_changed(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* electrical_grid_conditions */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/electrical_grid_conditions/electrical_grid_conditions_ids.h b/components/esp_matter/data_model/generated/clusters/electrical_grid_conditions/electrical_grid_conditions_ids.h new file mode 100644 index 000000000..9b135d7fa --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/electrical_grid_conditions/electrical_grid_conditions_ids.h @@ -0,0 +1,52 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace electrical_grid_conditions { + +inline constexpr uint32_t Id = 0x00A0; + +namespace feature { +namespace Forecasting { +inline constexpr uint32_t Id = 0x1; +} /* Forecasting */ +} /* feature */ + +namespace attribute { +namespace LocalGenerationAvailable { +inline constexpr uint32_t Id = 0x0000; +} /* LocalGenerationAvailable */ +namespace CurrentConditions { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentConditions */ +namespace ForecastConditions { +inline constexpr uint32_t Id = 0x0002; +} /* ForecastConditions */ +} /* attribute */ + +namespace event { +namespace CurrentConditionsChanged { +inline constexpr uint32_t Id = 0x00; +} /* CurrentConditionsChanged */ +} /* event */ + +} /* electrical_grid_conditions */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/electrical_power_measurement/electrical_power_measurement.cpp b/components/esp_matter/data_model/generated/clusters/electrical_power_measurement/electrical_power_measurement.cpp new file mode 100644 index 000000000..2fba248b0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/electrical_power_measurement/electrical_power_measurement.cpp @@ -0,0 +1,340 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "electrical_power_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace electrical_power_measurement { + +namespace feature { +namespace direct_current { +uint32_t get_id() +{ + return DirectCurrent::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* direct_current */ + +namespace alternating_current { +uint32_t get_id() +{ + return AlternatingCurrent::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* alternating_current */ + +namespace polyphase_power { +uint32_t get_id() +{ + return PolyphasePower::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(alternating_current), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* polyphase_power */ + +namespace harmonics { +uint32_t get_id() +{ + return Harmonics::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(alternating_current), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_harmonic_currents(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* harmonics */ + +namespace power_quality { +uint32_t get_id() +{ + return PowerQuality::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(alternating_current), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_harmonic_phases(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* power_quality */ + +} /* feature */ + +namespace attribute { +attribute_t *create_power_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PowerMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_number_of_measurement_types(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfMeasurementTypes::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(32)); + return attribute; +} + +attribute_t *create_accuracy(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Accuracy::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_ranges(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Ranges::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_voltage(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Voltage::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int64(-4611686018427387904), esp_matter_nullable_int64(4611686018427387904)); + return attribute; +} + +attribute_t *create_active_current(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ActiveCurrent::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int64(-4611686018427387904), esp_matter_nullable_int64(4611686018427387904)); + return attribute; +} + +attribute_t *create_reactive_current(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ReactiveCurrent::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int64(-4611686018427387904), esp_matter_nullable_int64(4611686018427387904)); + return attribute; +} + +attribute_t *create_apparent_current(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ApparentCurrent::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int64(-4611686018427387904), esp_matter_nullable_int64(4611686018427387904)); + return attribute; +} + +attribute_t *create_active_power(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ActivePower::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int64(-4611686018427387904), esp_matter_nullable_int64(4611686018427387904)); + return attribute; +} + +attribute_t *create_reactive_power(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ReactivePower::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int64(-4611686018427387904), esp_matter_nullable_int64(4611686018427387904)); + return attribute; +} + +attribute_t *create_apparent_power(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ApparentPower::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int64(-4611686018427387904), esp_matter_nullable_int64(4611686018427387904)); + return attribute; +} + +attribute_t *create_rms_voltage(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, RMSVoltage::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int64(-4611686018427387904), esp_matter_nullable_int64(4611686018427387904)); + return attribute; +} + +attribute_t *create_rms_current(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, RMSCurrent::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int64(-4611686018427387904), esp_matter_nullable_int64(4611686018427387904)); + return attribute; +} + +attribute_t *create_rms_power(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, RMSPower::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int64(-4611686018427387904), esp_matter_nullable_int64(4611686018427387904)); + return attribute; +} + +attribute_t *create_frequency(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Frequency::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int64(0), esp_matter_nullable_int64(1000000)); + return attribute; +} + +attribute_t *create_harmonic_currents(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(harmonics), NULL); + return esp_matter::attribute::create(cluster, HarmonicCurrents::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_harmonic_phases(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(power_quality), NULL); + return esp_matter::attribute::create(cluster, HarmonicPhases::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_power_factor(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PowerFactor::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int64(-10000), esp_matter_nullable_int64(10000)); + return attribute; +} + +attribute_t *create_neutral_current(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, NeutralCurrent::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int64(-4611686018427387904), esp_matter_nullable_int64(4611686018427387904)); + return attribute; +} + +} /* attribute */ + +namespace event { +event_t *create_measurement_period_ranges(cluster_t *cluster) +{ + VerifyOrReturnValue(has_attribute(Ranges), NULL); + return esp_matter::event::create(cluster, MeasurementPeriodRanges::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, electrical_power_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, electrical_power_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ElectricalPowerMeasurementDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterElectricalPowerMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_power_mode(cluster, config->power_mode); + attribute::create_number_of_measurement_types(cluster, config->number_of_measurement_types); + attribute::create_active_power(cluster, config->active_power); + attribute::create_accuracy(cluster, NULL, 0, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("DirectCurrent,AlternatingCurrent", + feature::direct_current::get_id(), feature::alternating_current::get_id()); + if (feature_map & feature::direct_current::get_id()) { + VerifyOrReturnValue(feature::direct_current::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::alternating_current::get_id()) { + VerifyOrReturnValue(feature::alternating_current::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::polyphase_power::get_id()) { + VerifyOrReturnValue(feature::polyphase_power::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::harmonics::get_id()) { + VerifyOrReturnValue(feature::harmonics::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::power_quality::get_id()) { + VerifyOrReturnValue(feature::power_quality::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterElectricalPowerMeasurementClusterServerInitCallback, + ESPMatterElectricalPowerMeasurementClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* electrical_power_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/electrical_power_measurement/electrical_power_measurement.h b/components/esp_matter/data_model/generated/clusters/electrical_power_measurement/electrical_power_measurement.h new file mode 100644 index 000000000..99016df48 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/electrical_power_measurement/electrical_power_measurement.h @@ -0,0 +1,91 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace electrical_power_measurement { + +namespace feature { +namespace direct_current { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* direct_current */ + +namespace alternating_current { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* alternating_current */ + +namespace polyphase_power { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* polyphase_power */ + +namespace harmonics { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* harmonics */ + +namespace power_quality { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_quality */ + +} /* feature */ + +namespace attribute { +attribute_t *create_power_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_measurement_types(cluster_t *cluster, uint8_t value); +attribute_t *create_accuracy(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_ranges(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_voltage(cluster_t *cluster, nullable value); +attribute_t *create_active_current(cluster_t *cluster, nullable value); +attribute_t *create_reactive_current(cluster_t *cluster, nullable value); +attribute_t *create_apparent_current(cluster_t *cluster, nullable value); +attribute_t *create_active_power(cluster_t *cluster, nullable value); +attribute_t *create_reactive_power(cluster_t *cluster, nullable value); +attribute_t *create_apparent_power(cluster_t *cluster, nullable value); +attribute_t *create_rms_voltage(cluster_t *cluster, nullable value); +attribute_t *create_rms_current(cluster_t *cluster, nullable value); +attribute_t *create_rms_power(cluster_t *cluster, nullable value); +attribute_t *create_frequency(cluster_t *cluster, nullable value); +attribute_t *create_harmonic_currents(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_harmonic_phases(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_power_factor(cluster_t *cluster, nullable value); +attribute_t *create_neutral_current(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace event { +event_t *create_measurement_period_ranges(cluster_t *cluster); +} /* event */ + +typedef struct config { + uint8_t power_mode; + uint8_t number_of_measurement_types; + nullable active_power; + void *delegate; + uint32_t feature_flags; + config() : power_mode(0), number_of_measurement_types(0), active_power(0), delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* electrical_power_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/electrical_power_measurement/electrical_power_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/electrical_power_measurement/electrical_power_measurement_ids.h new file mode 100644 index 000000000..1537bc3ea --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/electrical_power_measurement/electrical_power_measurement_ids.h @@ -0,0 +1,112 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace electrical_power_measurement { + +inline constexpr uint32_t Id = 0x0090; + +namespace feature { +namespace DirectCurrent { +inline constexpr uint32_t Id = 0x1; +} /* DirectCurrent */ +namespace AlternatingCurrent { +inline constexpr uint32_t Id = 0x2; +} /* AlternatingCurrent */ +namespace PolyphasePower { +inline constexpr uint32_t Id = 0x4; +} /* PolyphasePower */ +namespace Harmonics { +inline constexpr uint32_t Id = 0x8; +} /* Harmonics */ +namespace PowerQuality { +inline constexpr uint32_t Id = 0x10; +} /* PowerQuality */ +} /* feature */ + +namespace attribute { +namespace PowerMode { +inline constexpr uint32_t Id = 0x0000; +} /* PowerMode */ +namespace NumberOfMeasurementTypes { +inline constexpr uint32_t Id = 0x0001; +} /* NumberOfMeasurementTypes */ +namespace Accuracy { +inline constexpr uint32_t Id = 0x0002; +} /* Accuracy */ +namespace Ranges { +inline constexpr uint32_t Id = 0x0003; +} /* Ranges */ +namespace Voltage { +inline constexpr uint32_t Id = 0x0004; +} /* Voltage */ +namespace ActiveCurrent { +inline constexpr uint32_t Id = 0x0005; +} /* ActiveCurrent */ +namespace ReactiveCurrent { +inline constexpr uint32_t Id = 0x0006; +} /* ReactiveCurrent */ +namespace ApparentCurrent { +inline constexpr uint32_t Id = 0x0007; +} /* ApparentCurrent */ +namespace ActivePower { +inline constexpr uint32_t Id = 0x0008; +} /* ActivePower */ +namespace ReactivePower { +inline constexpr uint32_t Id = 0x0009; +} /* ReactivePower */ +namespace ApparentPower { +inline constexpr uint32_t Id = 0x000A; +} /* ApparentPower */ +namespace RMSVoltage { +inline constexpr uint32_t Id = 0x000B; +} /* RMSVoltage */ +namespace RMSCurrent { +inline constexpr uint32_t Id = 0x000C; +} /* RMSCurrent */ +namespace RMSPower { +inline constexpr uint32_t Id = 0x000D; +} /* RMSPower */ +namespace Frequency { +inline constexpr uint32_t Id = 0x000E; +} /* Frequency */ +namespace HarmonicCurrents { +inline constexpr uint32_t Id = 0x000F; +} /* HarmonicCurrents */ +namespace HarmonicPhases { +inline constexpr uint32_t Id = 0x0010; +} /* HarmonicPhases */ +namespace PowerFactor { +inline constexpr uint32_t Id = 0x0011; +} /* PowerFactor */ +namespace NeutralCurrent { +inline constexpr uint32_t Id = 0x0012; +} /* NeutralCurrent */ +} /* attribute */ + +namespace event { +namespace MeasurementPeriodRanges { +inline constexpr uint32_t Id = 0x00; +} /* MeasurementPeriodRanges */ +} /* event */ + +} /* electrical_power_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/energy_evse/energy_evse.cpp b/components/esp_matter/data_model/generated/clusters/energy_evse/energy_evse.cpp new file mode 100644 index 000000000..dc910efc7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/energy_evse/energy_evse.cpp @@ -0,0 +1,420 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "energy_evse_cluster"; +constexpr uint16_t cluster_revision = 4; + +namespace esp_matter { +namespace cluster { +namespace energy_evse { + +namespace feature { +namespace charging_preferences { +uint32_t get_id() +{ + return ChargingPreferences::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_next_charge_start_time(cluster, 0); + attribute::create_next_charge_target_time(cluster, 0); + attribute::create_next_charge_required_energy(cluster, 0); + attribute::create_next_charge_target_soc(cluster, 0); + command::create_get_targets_response(cluster); + command::create_set_targets(cluster); + command::create_get_targets(cluster); + command::create_clear_targets(cluster); + + return ESP_OK; +} +} /* charging_preferences */ + +namespace so_c_reporting { +uint32_t get_id() +{ + return SoCReporting::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_state_of_charge(cluster, 0); + attribute::create_battery_capacity(cluster, 0); + + return ESP_OK; +} +} /* so_c_reporting */ + +namespace plug_and_charge { +uint32_t get_id() +{ + return PlugAndCharge::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_vehicle_id(cluster, NULL, 0); + + return ESP_OK; +} +} /* plug_and_charge */ + +namespace rfid { +uint32_t get_id() +{ + return RFID::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* rfid */ + +namespace v_2_x { +uint32_t get_id() +{ + return V2X::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_discharging_enabled_until(cluster, 0); + attribute::create_maximum_discharge_current(cluster, 0); + attribute::create_session_energy_discharged(cluster, 0); + command::create_enable_discharging(cluster); + + return ESP_OK; +} +} /* v_2_x */ + +} /* feature */ + +namespace attribute { +attribute_t *create_state(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, State::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); +} + +attribute_t *create_supply_state(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, SupplyState::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_fault_state(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, FaultState::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_charging_enabled_until(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, ChargingEnabledUntil::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_discharging_enabled_until(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(v_2_x), NULL); + return esp_matter::attribute::create(cluster, DischargingEnabledUntil::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_circuit_capacity(cluster_t *cluster, int64_t value) +{ + return esp_matter::attribute::create(cluster, CircuitCapacity::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int64(value)); +} + +attribute_t *create_minimum_charge_current(cluster_t *cluster, int64_t value) +{ + return esp_matter::attribute::create(cluster, MinimumChargeCurrent::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int64(value)); +} + +attribute_t *create_maximum_charge_current(cluster_t *cluster, int64_t value) +{ + return esp_matter::attribute::create(cluster, MaximumChargeCurrent::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int64(value)); +} + +attribute_t *create_maximum_discharge_current(cluster_t *cluster, int64_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(v_2_x), NULL); + return esp_matter::attribute::create(cluster, MaximumDischargeCurrent::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int64(value)); +} + +attribute_t *create_user_maximum_charge_current(cluster_t *cluster, int64_t value) +{ + return esp_matter::attribute::create(cluster, UserMaximumChargeCurrent::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int64(value)); +} + +attribute_t *create_randomization_delay_window(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RandomizationDelayWindow::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint32(value)); +} + +attribute_t *create_next_charge_start_time(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(charging_preferences), NULL); + return esp_matter::attribute::create(cluster, NextChargeStartTime::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_next_charge_target_time(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(charging_preferences), NULL); + return esp_matter::attribute::create(cluster, NextChargeTargetTime::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_next_charge_required_energy(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(charging_preferences), NULL); + return esp_matter::attribute::create(cluster, NextChargeRequiredEnergy::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); +} + +attribute_t *create_next_charge_target_soc(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(charging_preferences), NULL); + return esp_matter::attribute::create(cluster, NextChargeTargetSoC::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); +} + +attribute_t *create_approximate_ev_efficiency(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, ApproximateEVEfficiency::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint16(value)); +} + +attribute_t *create_state_of_charge(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(so_c_reporting), NULL); + return esp_matter::attribute::create(cluster, StateOfCharge::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); +} + +attribute_t *create_battery_capacity(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(so_c_reporting), NULL); + return esp_matter::attribute::create(cluster, BatteryCapacity::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int64(value)); +} + +attribute_t *create_vehicle_id(cluster_t *cluster, char *value, uint16_t length) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(plug_and_charge), NULL); + return esp_matter::attribute::create(cluster, VehicleID::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_char_str(value, length)); +} + +attribute_t *create_session_id(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, SessionID::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_session_duration(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, SessionDuration::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_session_energy_charged(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, SessionEnergyCharged::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_int64(value)); +} + +attribute_t *create_session_energy_discharged(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(v_2_x), NULL); + return esp_matter::attribute::create(cluster, SessionEnergyDischarged::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_int64(value)); +} + +} /* attribute */ +namespace command { +command_t *create_get_targets_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(charging_preferences), NULL); + return esp_matter::command::create(cluster, GetTargetsResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_disable(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Disable::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_enable_charging(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, EnableCharging::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_enable_discharging(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(v_2_x), NULL); + return esp_matter::command::create(cluster, EnableDischarging::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_start_diagnostics(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, StartDiagnostics::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_set_targets(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(charging_preferences), NULL); + return esp_matter::command::create(cluster, SetTargets::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_get_targets(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(charging_preferences), NULL); + return esp_matter::command::create(cluster, GetTargets::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_clear_targets(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(charging_preferences), NULL); + return esp_matter::command::create(cluster, ClearTargets::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_ev_connected(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, EVConnected::Id); +} + +event_t *create_ev_not_detected(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, EVNotDetected::Id); +} + +event_t *create_energy_transfer_started(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, EnergyTransferStarted::Id); +} + +event_t *create_energy_transfer_stopped(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, EnergyTransferStopped::Id); +} + +event_t *create_fault(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, Fault::Id); +} + +event_t *create_rfid(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, RFID::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, energy_evse::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, energy_evse::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = EnergyEvseDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterEnergyEvsePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_state(cluster, 0); + attribute::create_supply_state(cluster, 0); + attribute::create_fault_state(cluster, 0); + attribute::create_charging_enabled_until(cluster, 0); + attribute::create_circuit_capacity(cluster, 0); + attribute::create_minimum_charge_current(cluster, 0); + attribute::create_maximum_charge_current(cluster, 0); + attribute::create_session_id(cluster, 0); + attribute::create_session_duration(cluster, 0); + attribute::create_session_energy_charged(cluster, 0); + command::create_disable(cluster); + command::create_enable_charging(cluster); + /* Events */ + event::create_ev_connected(cluster); + event::create_ev_not_detected(cluster); + event::create_energy_transfer_started(cluster); + event::create_energy_transfer_stopped(cluster); + event::create_fault(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* energy_evse */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/energy_evse/energy_evse.h b/components/esp_matter/data_model/generated/clusters/energy_evse/energy_evse.h new file mode 100644 index 000000000..fcb46e2bc --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/energy_evse/energy_evse.h @@ -0,0 +1,107 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace energy_evse { + +namespace feature { +namespace charging_preferences { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* charging_preferences */ + +namespace so_c_reporting { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* so_c_reporting */ + +namespace plug_and_charge { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* plug_and_charge */ + +namespace rfid { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* rfid */ + +namespace v_2_x { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* v_2_x */ + +} /* feature */ + +namespace attribute { +attribute_t *create_state(cluster_t *cluster, nullable value); +attribute_t *create_supply_state(cluster_t *cluster, uint8_t value); +attribute_t *create_fault_state(cluster_t *cluster, uint8_t value); +attribute_t *create_charging_enabled_until(cluster_t *cluster, nullable value); +attribute_t *create_discharging_enabled_until(cluster_t *cluster, nullable value); +attribute_t *create_circuit_capacity(cluster_t *cluster, int64_t value); +attribute_t *create_minimum_charge_current(cluster_t *cluster, int64_t value); +attribute_t *create_maximum_charge_current(cluster_t *cluster, int64_t value); +attribute_t *create_maximum_discharge_current(cluster_t *cluster, int64_t value); +attribute_t *create_user_maximum_charge_current(cluster_t *cluster, int64_t value); +attribute_t *create_randomization_delay_window(cluster_t *cluster, uint32_t value); +attribute_t *create_next_charge_start_time(cluster_t *cluster, nullable value); +attribute_t *create_next_charge_target_time(cluster_t *cluster, nullable value); +attribute_t *create_next_charge_required_energy(cluster_t *cluster, nullable value); +attribute_t *create_next_charge_target_soc(cluster_t *cluster, nullable value); +attribute_t *create_approximate_ev_efficiency(cluster_t *cluster, nullable value); +attribute_t *create_state_of_charge(cluster_t *cluster, nullable value); +attribute_t *create_battery_capacity(cluster_t *cluster, nullable value); +attribute_t *create_vehicle_id(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_session_id(cluster_t *cluster, nullable value); +attribute_t *create_session_duration(cluster_t *cluster, nullable value); +attribute_t *create_session_energy_charged(cluster_t *cluster, nullable value); +attribute_t *create_session_energy_discharged(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_get_targets_response(cluster_t *cluster); +command_t *create_disable(cluster_t *cluster); +command_t *create_enable_charging(cluster_t *cluster); +command_t *create_enable_discharging(cluster_t *cluster); +command_t *create_start_diagnostics(cluster_t *cluster); +command_t *create_set_targets(cluster_t *cluster); +command_t *create_get_targets(cluster_t *cluster); +command_t *create_clear_targets(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_ev_connected(cluster_t *cluster); +event_t *create_ev_not_detected(cluster_t *cluster); +event_t *create_energy_transfer_started(cluster_t *cluster); +event_t *create_energy_transfer_stopped(cluster_t *cluster); +event_t *create_fault(cluster_t *cluster); +event_t *create_rfid(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* energy_evse */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/energy_evse/energy_evse_ids.h b/components/esp_matter/data_model/generated/clusters/energy_evse/energy_evse_ids.h new file mode 100644 index 000000000..9a138dcf2 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/energy_evse/energy_evse_ids.h @@ -0,0 +1,166 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace energy_evse { + +inline constexpr uint32_t Id = 0x0099; + +namespace feature { +namespace ChargingPreferences { +inline constexpr uint32_t Id = 0x1; +} /* ChargingPreferences */ +namespace SoCReporting { +inline constexpr uint32_t Id = 0x2; +} /* SoCReporting */ +namespace PlugAndCharge { +inline constexpr uint32_t Id = 0x4; +} /* PlugAndCharge */ +namespace RFID { +inline constexpr uint32_t Id = 0x8; +} /* RFID */ +namespace V2X { +inline constexpr uint32_t Id = 0x10; +} /* V2X */ +} /* feature */ + +namespace attribute { +namespace State { +inline constexpr uint32_t Id = 0x0000; +} /* State */ +namespace SupplyState { +inline constexpr uint32_t Id = 0x0001; +} /* SupplyState */ +namespace FaultState { +inline constexpr uint32_t Id = 0x0002; +} /* FaultState */ +namespace ChargingEnabledUntil { +inline constexpr uint32_t Id = 0x0003; +} /* ChargingEnabledUntil */ +namespace DischargingEnabledUntil { +inline constexpr uint32_t Id = 0x0004; +} /* DischargingEnabledUntil */ +namespace CircuitCapacity { +inline constexpr uint32_t Id = 0x0005; +} /* CircuitCapacity */ +namespace MinimumChargeCurrent { +inline constexpr uint32_t Id = 0x0006; +} /* MinimumChargeCurrent */ +namespace MaximumChargeCurrent { +inline constexpr uint32_t Id = 0x0007; +} /* MaximumChargeCurrent */ +namespace MaximumDischargeCurrent { +inline constexpr uint32_t Id = 0x0008; +} /* MaximumDischargeCurrent */ +namespace UserMaximumChargeCurrent { +inline constexpr uint32_t Id = 0x0009; +} /* UserMaximumChargeCurrent */ +namespace RandomizationDelayWindow { +inline constexpr uint32_t Id = 0x000A; +} /* RandomizationDelayWindow */ +namespace NextChargeStartTime { +inline constexpr uint32_t Id = 0x0023; +} /* NextChargeStartTime */ +namespace NextChargeTargetTime { +inline constexpr uint32_t Id = 0x0024; +} /* NextChargeTargetTime */ +namespace NextChargeRequiredEnergy { +inline constexpr uint32_t Id = 0x0025; +} /* NextChargeRequiredEnergy */ +namespace NextChargeTargetSoC { +inline constexpr uint32_t Id = 0x0026; +} /* NextChargeTargetSoC */ +namespace ApproximateEVEfficiency { +inline constexpr uint32_t Id = 0x0027; +} /* ApproximateEVEfficiency */ +namespace StateOfCharge { +inline constexpr uint32_t Id = 0x0030; +} /* StateOfCharge */ +namespace BatteryCapacity { +inline constexpr uint32_t Id = 0x0031; +} /* BatteryCapacity */ +namespace VehicleID { +inline constexpr uint32_t Id = 0x0032; +} /* VehicleID */ +namespace SessionID { +inline constexpr uint32_t Id = 0x0040; +} /* SessionID */ +namespace SessionDuration { +inline constexpr uint32_t Id = 0x0041; +} /* SessionDuration */ +namespace SessionEnergyCharged { +inline constexpr uint32_t Id = 0x0042; +} /* SessionEnergyCharged */ +namespace SessionEnergyDischarged { +inline constexpr uint32_t Id = 0x0043; +} /* SessionEnergyDischarged */ +} /* attribute */ + +namespace command { +namespace GetTargetsResponse { +inline constexpr uint32_t Id = 0x00; +} /* GetTargetsResponse */ +namespace Disable { +inline constexpr uint32_t Id = 0x01; +} /* Disable */ +namespace EnableCharging { +inline constexpr uint32_t Id = 0x02; +} /* EnableCharging */ +namespace EnableDischarging { +inline constexpr uint32_t Id = 0x03; +} /* EnableDischarging */ +namespace StartDiagnostics { +inline constexpr uint32_t Id = 0x04; +} /* StartDiagnostics */ +namespace SetTargets { +inline constexpr uint32_t Id = 0x05; +} /* SetTargets */ +namespace GetTargets { +inline constexpr uint32_t Id = 0x06; +} /* GetTargets */ +namespace ClearTargets { +inline constexpr uint32_t Id = 0x07; +} /* ClearTargets */ +} /* command */ + +namespace event { +namespace EVConnected { +inline constexpr uint32_t Id = 0x00; +} /* EVConnected */ +namespace EVNotDetected { +inline constexpr uint32_t Id = 0x01; +} /* EVNotDetected */ +namespace EnergyTransferStarted { +inline constexpr uint32_t Id = 0x02; +} /* EnergyTransferStarted */ +namespace EnergyTransferStopped { +inline constexpr uint32_t Id = 0x03; +} /* EnergyTransferStopped */ +namespace Fault { +inline constexpr uint32_t Id = 0x04; +} /* Fault */ +namespace RFID { +inline constexpr uint32_t Id = 0x05; +} /* RFID */ +} /* event */ + +} /* energy_evse */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/energy_evse_mode/energy_evse_mode.cpp b/components/esp_matter/data_model/generated/clusters/energy_evse_mode/energy_evse_mode.cpp new file mode 100644 index 000000000..f9d1b119a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/energy_evse_mode/energy_evse_mode.cpp @@ -0,0 +1,107 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "energy_evse_mode_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace energy_evse_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedModes::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_change_to_mode(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToMode::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_change_to_mode_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToModeResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, energy_evse_mode::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, energy_evse_mode::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = EnergyEvseModeDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterEnergyEvseModePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_change_to_mode(cluster); + command::create_change_to_mode_response(cluster); + } + + return cluster; +} + +} /* energy_evse_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/energy_evse_mode/energy_evse_mode.h b/components/esp_matter/data_model/generated/clusters/energy_evse_mode/energy_evse_mode.h new file mode 100644 index 000000000..6b1a13bf0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/energy_evse_mode/energy_evse_mode.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace energy_evse_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_change_to_mode(cluster_t *cluster); +command_t *create_change_to_mode_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* energy_evse_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/energy_evse_mode/energy_evse_mode_ids.h b/components/esp_matter/data_model/generated/clusters/energy_evse_mode/energy_evse_mode_ids.h new file mode 100644 index 000000000..3dd173294 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/energy_evse_mode/energy_evse_mode_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace energy_evse_mode { + +inline constexpr uint32_t Id = 0x009D; + +namespace attribute { +namespace SupportedModes { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedModes */ +namespace CurrentMode { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentMode */ +} /* attribute */ + +namespace command { +namespace ChangeToMode { +inline constexpr uint32_t Id = 0x00; +} /* ChangeToMode */ +namespace ChangeToModeResponse { +inline constexpr uint32_t Id = 0x01; +} /* ChangeToModeResponse */ +} /* command */ + +} /* energy_evse_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/energy_preference/energy_preference.cpp b/components/esp_matter/data_model/generated/clusters/energy_preference/energy_preference.cpp new file mode 100644 index 000000000..70d001d0d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/energy_preference/energy_preference.cpp @@ -0,0 +1,179 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "energy_preference_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace energy_preference { + +namespace feature { +namespace energy_balance { +uint32_t get_id() +{ + return EnergyBalance::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_current_energy_balance(cluster, config->current_energy_balance); + attribute::create_energy_balances(cluster, NULL, 0, 0); + attribute::create_energy_priorities(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* energy_balance */ + +namespace low_power_mode_sensitivity { +uint32_t get_id() +{ + return LowPowerModeSensitivity::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_current_low_power_mode_sensitivity(cluster, config->current_low_power_mode_sensitivity); + attribute::create_low_power_mode_sensitivities(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* low_power_mode_sensitivity */ + +} /* feature */ + +namespace attribute { +attribute_t *create_energy_balances(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(energy_balance), NULL); + return esp_matter::attribute::create(cluster, EnergyBalances::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_energy_balance(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(energy_balance), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentEnergyBalance::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_energy_priorities(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(energy_balance), NULL); + return esp_matter::attribute::create(cluster, EnergyPriorities::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_low_power_mode_sensitivities(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(low_power_mode_sensitivity), NULL); + return esp_matter::attribute::create(cluster, LowPowerModeSensitivities::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_low_power_mode_sensitivity(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(low_power_mode_sensitivity), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentLowPowerModeSensitivity::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t function_list[] = { + (function_generic_t)MatterEnergyPreferenceClusterServerPreAttributeChangedCallback, +}; + +const int function_flags = CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, energy_preference::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, energy_preference::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = EnergyPreferenceDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterEnergyPreferencePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("EnergyBalance,LowPowerModeSensitivity", + feature::energy_balance::get_id(), feature::low_power_mode_sensitivity::get_id()); + if (feature_map & feature::energy_balance::get_id()) { + VerifyOrReturnValue(feature::energy_balance::add(cluster, &(config->features.energy_balance)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::low_power_mode_sensitivity::get_id()) { + VerifyOrReturnValue(feature::low_power_mode_sensitivity::add(cluster, &(config->features.low_power_mode_sensitivity)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* energy_preference */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/energy_preference/energy_preference.h b/components/esp_matter/data_model/generated/clusters/energy_preference/energy_preference.h new file mode 100644 index 000000000..dd9342204 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/energy_preference/energy_preference.h @@ -0,0 +1,67 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace energy_preference { + +namespace feature { +namespace energy_balance { +typedef struct config { + uint8_t current_energy_balance; + config() : current_energy_balance(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* energy_balance */ + +namespace low_power_mode_sensitivity { +typedef struct config { + uint8_t current_low_power_mode_sensitivity; + config() : current_low_power_mode_sensitivity(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* low_power_mode_sensitivity */ + +} /* feature */ + +namespace attribute { +attribute_t *create_energy_balances(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_energy_balance(cluster_t *cluster, uint8_t value); +attribute_t *create_energy_priorities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_low_power_mode_sensitivities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_low_power_mode_sensitivity(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + void *delegate; + struct { + feature::energy_balance::config_t energy_balance; + feature::low_power_mode_sensitivity::config_t low_power_mode_sensitivity; + } features; + uint32_t feature_flags; + config() : delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* energy_preference */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/energy_preference/energy_preference_ids.h b/components/esp_matter/data_model/generated/clusters/energy_preference/energy_preference_ids.h new file mode 100644 index 000000000..ee4d2930c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/energy_preference/energy_preference_ids.h @@ -0,0 +1,55 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace energy_preference { + +inline constexpr uint32_t Id = 0x009B; + +namespace feature { +namespace EnergyBalance { +inline constexpr uint32_t Id = 0x1; +} /* EnergyBalance */ +namespace LowPowerModeSensitivity { +inline constexpr uint32_t Id = 0x2; +} /* LowPowerModeSensitivity */ +} /* feature */ + +namespace attribute { +namespace EnergyBalances { +inline constexpr uint32_t Id = 0x0000; +} /* EnergyBalances */ +namespace CurrentEnergyBalance { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentEnergyBalance */ +namespace EnergyPriorities { +inline constexpr uint32_t Id = 0x0002; +} /* EnergyPriorities */ +namespace LowPowerModeSensitivities { +inline constexpr uint32_t Id = 0x0003; +} /* LowPowerModeSensitivities */ +namespace CurrentLowPowerModeSensitivity { +inline constexpr uint32_t Id = 0x0004; +} /* CurrentLowPowerModeSensitivity */ +} /* attribute */ + +} /* energy_preference */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ethernet_network_diagnostics/ethernet_network_diagnostics.cpp b/components/esp_matter/data_model/generated/clusters/ethernet_network_diagnostics/ethernet_network_diagnostics.cpp new file mode 100644 index 000000000..82389a105 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ethernet_network_diagnostics/ethernet_network_diagnostics.cpp @@ -0,0 +1,197 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "ethernet_network_diagnostics_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace ethernet_network_diagnostics { + +namespace feature { +namespace packet_counts { +uint32_t get_id() +{ + return PacketCounts::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_packet_rx_count(cluster, config->packet_rx_count); + attribute::create_packet_tx_count(cluster, config->packet_tx_count); + command::create_reset_counts(cluster); + + return ESP_OK; +} +} /* packet_counts */ + +namespace error_counts { +uint32_t get_id() +{ + return ErrorCounts::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_tx_err_count(cluster, config->tx_err_count); + attribute::create_collision_count(cluster, config->collision_count); + attribute::create_overrun_count(cluster, config->overrun_count); + command::create_reset_counts(cluster); + + return ESP_OK; +} +} /* error_counts */ + +} /* feature */ + +namespace attribute { +attribute_t *create_phy_rate(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PHYRate::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_enum8(0), esp_matter_nullable_enum8(9)); + return attribute; +} + +attribute_t *create_full_duplex(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, FullDuplex::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_bool(value)); +} + +attribute_t *create_packet_rx_count(cluster_t *cluster, uint64_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(packet_counts), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, PacketRxCount::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint64(0), esp_matter_uint64(4294967294)); + return attribute; +} + +attribute_t *create_packet_tx_count(cluster_t *cluster, uint64_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(packet_counts), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, PacketTxCount::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint64(0), esp_matter_uint64(4294967294)); + return attribute; +} + +attribute_t *create_tx_err_count(cluster_t *cluster, uint64_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(error_counts), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, TxErrCount::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint64(0), esp_matter_uint64(4294967294)); + return attribute; +} + +attribute_t *create_collision_count(cluster_t *cluster, uint64_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(error_counts), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CollisionCount::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint64(0), esp_matter_uint64(4294967294)); + return attribute; +} + +attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(error_counts), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, OverrunCount::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint64(0), esp_matter_uint64(4294967294)); + return attribute; +} + +attribute_t *create_carrier_detect(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CarrierDetect::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_bool(value)); +} + +attribute_t *create_time_since_reset(cluster_t *cluster, uint64_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, TimeSinceReset::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint64(0), esp_matter_uint64(4294967294)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_reset_counts(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(packet_counts)) || (has_feature(error_counts))), NULL); + return esp_matter::command::create(cluster, ResetCounts::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, ethernet_network_diagnostics::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, ethernet_network_diagnostics::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterEthernetNetworkDiagnosticsPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterEthernetNetworkDiagnosticsClusterServerInitCallback, + ESPMatterEthernetNetworkDiagnosticsClusterServerShutdownCallback); + } + + return cluster; +} + +} /* ethernet_network_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ethernet_network_diagnostics/ethernet_network_diagnostics.h b/components/esp_matter/data_model/generated/clusters/ethernet_network_diagnostics/ethernet_network_diagnostics.h new file mode 100644 index 000000000..34a9b26a8 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ethernet_network_diagnostics/ethernet_network_diagnostics.h @@ -0,0 +1,72 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace ethernet_network_diagnostics { + +namespace feature { +namespace packet_counts { +typedef struct config { + uint64_t packet_rx_count; + uint64_t packet_tx_count; + config() : packet_rx_count(0), packet_tx_count(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* packet_counts */ + +namespace error_counts { +typedef struct config { + uint64_t tx_err_count; + uint64_t collision_count; + uint64_t overrun_count; + config() : tx_err_count(0), collision_count(0), overrun_count(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* error_counts */ + +} /* feature */ + +namespace attribute { +attribute_t *create_phy_rate(cluster_t *cluster, nullable value); +attribute_t *create_full_duplex(cluster_t *cluster, nullable value); +attribute_t *create_packet_rx_count(cluster_t *cluster, uint64_t value); +attribute_t *create_packet_tx_count(cluster_t *cluster, uint64_t value); +attribute_t *create_tx_err_count(cluster_t *cluster, uint64_t value); +attribute_t *create_collision_count(cluster_t *cluster, uint64_t value); +attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value); +attribute_t *create_carrier_detect(cluster_t *cluster, nullable value); +attribute_t *create_time_since_reset(cluster_t *cluster, uint64_t value); +} /* attribute */ + +namespace command { +command_t *create_reset_counts(cluster_t *cluster); +} /* command */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* ethernet_network_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ethernet_network_diagnostics/ethernet_network_diagnostics_ids.h b/components/esp_matter/data_model/generated/clusters/ethernet_network_diagnostics/ethernet_network_diagnostics_ids.h new file mode 100644 index 000000000..8b1a5b9bb --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ethernet_network_diagnostics/ethernet_network_diagnostics_ids.h @@ -0,0 +1,73 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace ethernet_network_diagnostics { + +inline constexpr uint32_t Id = 0x0037; + +namespace feature { +namespace PacketCounts { +inline constexpr uint32_t Id = 0x1; +} /* PacketCounts */ +namespace ErrorCounts { +inline constexpr uint32_t Id = 0x2; +} /* ErrorCounts */ +} /* feature */ + +namespace attribute { +namespace PHYRate { +inline constexpr uint32_t Id = 0x0000; +} /* PHYRate */ +namespace FullDuplex { +inline constexpr uint32_t Id = 0x0001; +} /* FullDuplex */ +namespace PacketRxCount { +inline constexpr uint32_t Id = 0x0002; +} /* PacketRxCount */ +namespace PacketTxCount { +inline constexpr uint32_t Id = 0x0003; +} /* PacketTxCount */ +namespace TxErrCount { +inline constexpr uint32_t Id = 0x0004; +} /* TxErrCount */ +namespace CollisionCount { +inline constexpr uint32_t Id = 0x0005; +} /* CollisionCount */ +namespace OverrunCount { +inline constexpr uint32_t Id = 0x0006; +} /* OverrunCount */ +namespace CarrierDetect { +inline constexpr uint32_t Id = 0x0007; +} /* CarrierDetect */ +namespace TimeSinceReset { +inline constexpr uint32_t Id = 0x0008; +} /* TimeSinceReset */ +} /* attribute */ + +namespace command { +namespace ResetCounts { +inline constexpr uint32_t Id = 0x00; +} /* ResetCounts */ +} /* command */ + +} /* ethernet_network_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/fan_control/fan_control.cpp b/components/esp_matter/data_model/generated/clusters/fan_control/fan_control.cpp new file mode 100644 index 000000000..26837702d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/fan_control/fan_control.cpp @@ -0,0 +1,322 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "fan_control_cluster"; +constexpr uint16_t cluster_revision = 5; + +static esp_err_t esp_matter_command_callback_step(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::FanControl::Commands::Step::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfFanControlClusterStepCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace fan_control { + +namespace feature { +namespace multi_speed { +uint32_t get_id() +{ + return MultiSpeed::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_speed_max(cluster, config->speed_max); + attribute::create_speed_setting(cluster, config->speed_setting); + attribute::create_speed_current(cluster, config->speed_current); + + return ESP_OK; +} +} /* multi_speed */ + +namespace fan_auto { +uint32_t get_id() +{ + return FanAuto::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* fan_auto */ + +namespace rocking { +uint32_t get_id() +{ + return Rocking::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_rock_support(cluster, config->rock_support); + attribute::create_rock_setting(cluster, config->rock_setting); + + return ESP_OK; +} +} /* rocking */ + +namespace wind { +uint32_t get_id() +{ + return Wind::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_wind_support(cluster, config->wind_support); + attribute::create_wind_setting(cluster, config->wind_setting); + + return ESP_OK; +} +} /* wind */ + +namespace step { +uint32_t get_id() +{ + return Step::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_step(cluster); + + return ESP_OK; +} +} /* step */ + +namespace airflow_direction { +uint32_t get_id() +{ + return AirflowDirection::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_airflow_direction(cluster, config->airflow_direction); + + return ESP_OK; +} +} /* airflow_direction */ + +} /* feature */ + +namespace attribute { +attribute_t *create_fan_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, FanMode::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(6)); + return attribute; +} + +attribute_t *create_fan_mode_sequence(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, FanModeSequence::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(5)); + return attribute; +} + +attribute_t *create_percent_setting(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PercentSetting::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(100)); + return attribute; +} + +attribute_t *create_percent_current(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PercentCurrent::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(100)); + return attribute; +} + +attribute_t *create_speed_max(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(multi_speed), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, SpeedMax::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(100)); + return attribute; +} + +attribute_t *create_speed_setting(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(multi_speed), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, SpeedSetting::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_speed_current(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(multi_speed), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, SpeedCurrent::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_rock_support(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(rocking), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, RockSupport::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(7)); + return attribute; +} + +attribute_t *create_rock_setting(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(rocking), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, RockSetting::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(7)); + return attribute; +} + +attribute_t *create_wind_support(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(wind), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, WindSupport::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(3)); + return attribute; +} + +attribute_t *create_wind_setting(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(wind), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, WindSetting::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(3)); + return attribute; +} + +attribute_t *create_airflow_direction(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(airflow_direction), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, AirflowDirection::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(1)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_step(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(step), NULL); + return esp_matter::command::create(cluster, Step::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_step); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t function_list[] = { + (function_generic_t)MatterFanControlClusterServerAttributeChangedCallback, + (function_generic_t)MatterFanControlClusterServerPreAttributeChangedCallback, +}; + +const int function_flags = CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION | CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, fan_control::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, fan_control::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = FanControlDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterFanControlPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_fan_mode(cluster, config->fan_mode); + attribute::create_fan_mode_sequence(cluster, config->fan_mode_sequence); + attribute::create_percent_setting(cluster, config->percent_setting); + attribute::create_percent_current(cluster, config->percent_current); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* fan_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/fan_control/fan_control.h b/components/esp_matter/data_model/generated/clusters/fan_control/fan_control.h new file mode 100644 index 000000000..7a3cfa34a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/fan_control/fan_control.h @@ -0,0 +1,109 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace fan_control { + +namespace feature { +namespace multi_speed { +typedef struct config { + uint8_t speed_max; + nullable speed_setting; + uint8_t speed_current; + config() : speed_max(0), speed_setting(0), speed_current(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* multi_speed */ + +namespace fan_auto { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* fan_auto */ + +namespace rocking { +typedef struct config { + uint8_t rock_support; + uint8_t rock_setting; + config() : rock_support(0), rock_setting(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* rocking */ + +namespace wind { +typedef struct config { + uint8_t wind_support; + uint8_t wind_setting; + config() : wind_support(0), wind_setting(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* wind */ + +namespace step { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* step */ + +namespace airflow_direction { +typedef struct config { + uint8_t airflow_direction; + config() : airflow_direction(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* airflow_direction */ + +} /* feature */ + +namespace attribute { +attribute_t *create_fan_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_fan_mode_sequence(cluster_t *cluster, uint8_t value); +attribute_t *create_percent_setting(cluster_t *cluster, nullable value); +attribute_t *create_percent_current(cluster_t *cluster, uint8_t value); +attribute_t *create_speed_max(cluster_t *cluster, uint8_t value); +attribute_t *create_speed_setting(cluster_t *cluster, nullable value); +attribute_t *create_speed_current(cluster_t *cluster, uint8_t value); +attribute_t *create_rock_support(cluster_t *cluster, uint8_t value); +attribute_t *create_rock_setting(cluster_t *cluster, uint8_t value); +attribute_t *create_wind_support(cluster_t *cluster, uint8_t value); +attribute_t *create_wind_setting(cluster_t *cluster, uint8_t value); +attribute_t *create_airflow_direction(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_step(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t fan_mode; + uint8_t fan_mode_sequence; + nullable percent_setting; + uint8_t percent_current; + void *delegate; + config() : fan_mode(0), fan_mode_sequence(0), percent_setting(0), percent_current(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* fan_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/fan_control/fan_control_ids.h b/components/esp_matter/data_model/generated/clusters/fan_control/fan_control_ids.h new file mode 100644 index 000000000..be72c0408 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/fan_control/fan_control_ids.h @@ -0,0 +1,94 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace fan_control { + +inline constexpr uint32_t Id = 0x0202; + +namespace feature { +namespace MultiSpeed { +inline constexpr uint32_t Id = 0x1; +} /* MultiSpeed */ +namespace FanAuto { +inline constexpr uint32_t Id = 0x2; +} /* FanAuto */ +namespace Rocking { +inline constexpr uint32_t Id = 0x4; +} /* Rocking */ +namespace Wind { +inline constexpr uint32_t Id = 0x8; +} /* Wind */ +namespace Step { +inline constexpr uint32_t Id = 0x10; +} /* Step */ +namespace AirflowDirection { +inline constexpr uint32_t Id = 0x20; +} /* AirflowDirection */ +} /* feature */ + +namespace attribute { +namespace FanMode { +inline constexpr uint32_t Id = 0x0000; +} /* FanMode */ +namespace FanModeSequence { +inline constexpr uint32_t Id = 0x0001; +} /* FanModeSequence */ +namespace PercentSetting { +inline constexpr uint32_t Id = 0x0002; +} /* PercentSetting */ +namespace PercentCurrent { +inline constexpr uint32_t Id = 0x0003; +} /* PercentCurrent */ +namespace SpeedMax { +inline constexpr uint32_t Id = 0x0004; +} /* SpeedMax */ +namespace SpeedSetting { +inline constexpr uint32_t Id = 0x0005; +} /* SpeedSetting */ +namespace SpeedCurrent { +inline constexpr uint32_t Id = 0x0006; +} /* SpeedCurrent */ +namespace RockSupport { +inline constexpr uint32_t Id = 0x0007; +} /* RockSupport */ +namespace RockSetting { +inline constexpr uint32_t Id = 0x0008; +} /* RockSetting */ +namespace WindSupport { +inline constexpr uint32_t Id = 0x0009; +} /* WindSupport */ +namespace WindSetting { +inline constexpr uint32_t Id = 0x000A; +} /* WindSetting */ +namespace AirflowDirection { +inline constexpr uint32_t Id = 0x000B; +} /* AirflowDirection */ +} /* attribute */ + +namespace command { +namespace Step { +inline constexpr uint32_t Id = 0x00; +} /* Step */ +} /* command */ + +} /* fan_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/fixed_label/fixed_label.cpp b/components/esp_matter/data_model/generated/clusters/fixed_label/fixed_label.cpp new file mode 100644 index 000000000..73edb682e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/fixed_label/fixed_label.cpp @@ -0,0 +1,84 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "fixed_label_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace fixed_label { + +namespace attribute { +attribute_t *create_label_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, LabelList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, fixed_label::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, fixed_label::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterFixedLabelPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_label_list(cluster, NULL, 0, 0); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterFixedLabelClusterServerInitCallback, + ESPMatterFixedLabelClusterServerShutdownCallback); + } + + return cluster; +} + +} /* fixed_label */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/fixed_label/fixed_label.h b/components/esp_matter/data_model/generated/clusters/fixed_label/fixed_label.h new file mode 100644 index 000000000..278bf6505 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/fixed_label/fixed_label.h @@ -0,0 +1,36 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace fixed_label { + +namespace attribute { +attribute_t *create_label_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* fixed_label */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/fixed_label/fixed_label_ids.h b/components/esp_matter/data_model/generated/clusters/fixed_label/fixed_label_ids.h new file mode 100644 index 000000000..23c723c2c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/fixed_label/fixed_label_ids.h @@ -0,0 +1,34 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace fixed_label { + +inline constexpr uint32_t Id = 0x0040; + +namespace attribute { +namespace LabelList { +inline constexpr uint32_t Id = 0x0000; +} /* LabelList */ +} /* attribute */ + +} /* fixed_label */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/flow_measurement/flow_measurement.cpp b/components/esp_matter/data_model/generated/clusters/flow_measurement/flow_measurement.cpp new file mode 100644 index 000000000..af94b616c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/flow_measurement/flow_measurement.cpp @@ -0,0 +1,114 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "flow_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace flow_measurement { + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65533)); + return attribute; +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Tolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(2048)); + return attribute; +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, flow_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, flow_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterFlowMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measured_value(cluster, config->measured_value); + attribute::create_min_measured_value(cluster, config->min_measured_value); + attribute::create_max_measured_value(cluster, config->max_measured_value); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* flow_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/flow_measurement/flow_measurement.h b/components/esp_matter/data_model/generated/clusters/flow_measurement/flow_measurement.h new file mode 100644 index 000000000..ac79c71a7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/flow_measurement/flow_measurement.h @@ -0,0 +1,42 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace flow_measurement { + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value); +} /* attribute */ + +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + config() : measured_value(0), min_measured_value(0), max_measured_value(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* flow_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/flow_measurement/flow_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/flow_measurement/flow_measurement_ids.h new file mode 100644 index 000000000..a84b049e1 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/flow_measurement/flow_measurement_ids.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace flow_measurement { + +inline constexpr uint32_t Id = 0x0404; + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace Tolerance { +inline constexpr uint32_t Id = 0x0003; +} /* Tolerance */ +} /* attribute */ + +} /* flow_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/formaldehyde_concentration_measurement/formaldehyde_concentration_measurement.cpp b/components/esp_matter/data_model/generated/clusters/formaldehyde_concentration_measurement/formaldehyde_concentration_measurement.cpp new file mode 100644 index 000000000..e2b586ec8 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/formaldehyde_concentration_measurement/formaldehyde_concentration_measurement.cpp @@ -0,0 +1,289 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "formaldehyde_concentration_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace formaldehyde_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id() +{ + return NumericMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_measured_value(cluster, 0); + attribute::create_min_measured_value(cluster, 0); + attribute::create_max_measured_value(cluster, 0); + attribute::create_measurement_unit(cluster, 0); + + return ESP_OK; +} +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id() +{ + return LevelIndication::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_level_value(cluster, 0); + + return ESP_OK; +} +} /* level_indication */ + +namespace medium_level { +uint32_t get_id() +{ + return MediumLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* medium_level */ + +namespace critical_level { +uint32_t get_id() +{ + return CriticalLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id() +{ + return PeakMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_peak_measured_value(cluster, 0); + attribute::create_peak_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id() +{ + return AverageMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_average_measured_value(cluster, 0); + attribute::create_average_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_uncertainty(cluster_t *cluster, float value) +{ + return esp_matter::attribute::create(cluster, Uncertainty::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_float(value)); +} + +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasurementUnit::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, MeasurementMedium::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_level_value(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(level_indication), NULL); + return esp_matter::attribute::create(cluster, LevelValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, formaldehyde_concentration_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, formaldehyde_concentration_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterFormaldehydeConcentrationMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measurement_medium(cluster, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("NumericMeasurement,LevelIndication", + feature::numeric_measurement::get_id(), feature::level_indication::get_id()); + if (feature_map & feature::numeric_measurement::get_id()) { + VerifyOrReturnValue(feature::numeric_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::level_indication::get_id()) { + VerifyOrReturnValue(feature::level_indication::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::medium_level::get_id()) { + VerifyOrReturnValue(feature::medium_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::critical_level::get_id()) { + VerifyOrReturnValue(feature::critical_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::peak_measurement::get_id()) { + VerifyOrReturnValue(feature::peak_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::average_measurement::get_id()) { + VerifyOrReturnValue(feature::average_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* formaldehyde_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/formaldehyde_concentration_measurement/formaldehyde_concentration_measurement.h b/components/esp_matter/data_model/generated/clusters/formaldehyde_concentration_measurement/formaldehyde_concentration_measurement.h new file mode 100644 index 000000000..d6fda700b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/formaldehyde_concentration_measurement/formaldehyde_concentration_measurement.h @@ -0,0 +1,80 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace formaldehyde_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* level_indication */ + +namespace medium_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* medium_level */ + +namespace critical_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_uncertainty(cluster_t *cluster, float value); +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value); +attribute_t *create_level_value(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* formaldehyde_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/formaldehyde_concentration_measurement/formaldehyde_concentration_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/formaldehyde_concentration_measurement/formaldehyde_concentration_measurement_ids.h new file mode 100644 index 000000000..0dff8d649 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/formaldehyde_concentration_measurement/formaldehyde_concentration_measurement_ids.h @@ -0,0 +1,85 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace formaldehyde_concentration_measurement { + +inline constexpr uint32_t Id = 0x042B; + +namespace feature { +namespace NumericMeasurement { +inline constexpr uint32_t Id = 0x1; +} /* NumericMeasurement */ +namespace LevelIndication { +inline constexpr uint32_t Id = 0x2; +} /* LevelIndication */ +namespace MediumLevel { +inline constexpr uint32_t Id = 0x4; +} /* MediumLevel */ +namespace CriticalLevel { +inline constexpr uint32_t Id = 0x8; +} /* CriticalLevel */ +namespace PeakMeasurement { +inline constexpr uint32_t Id = 0x10; +} /* PeakMeasurement */ +namespace AverageMeasurement { +inline constexpr uint32_t Id = 0x20; +} /* AverageMeasurement */ +} /* feature */ + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace PeakMeasuredValue { +inline constexpr uint32_t Id = 0x0003; +} /* PeakMeasuredValue */ +namespace PeakMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0004; +} /* PeakMeasuredValueWindow */ +namespace AverageMeasuredValue { +inline constexpr uint32_t Id = 0x0005; +} /* AverageMeasuredValue */ +namespace AverageMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0006; +} /* AverageMeasuredValueWindow */ +namespace Uncertainty { +inline constexpr uint32_t Id = 0x0007; +} /* Uncertainty */ +namespace MeasurementUnit { +inline constexpr uint32_t Id = 0x0008; +} /* MeasurementUnit */ +namespace MeasurementMedium { +inline constexpr uint32_t Id = 0x0009; +} /* MeasurementMedium */ +namespace LevelValue { +inline constexpr uint32_t Id = 0x000A; +} /* LevelValue */ +} /* attribute */ + +} /* formaldehyde_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/general_commissioning/general_commissioning.cpp b/components/esp_matter/data_model/generated/clusters/general_commissioning/general_commissioning.cpp new file mode 100644 index 000000000..6ae015850 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/general_commissioning/general_commissioning.cpp @@ -0,0 +1,233 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "general_commissioning_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace general_commissioning { + +namespace feature { +namespace terms_and_conditions { +uint32_t get_id() +{ + return TermsAndConditions::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_tc_accepted_version(cluster, config->tc_accepted_version); + attribute::create_tc_min_required_version(cluster, config->tc_min_required_version); + attribute::create_tc_acknowledgements(cluster, config->tc_acknowledgements); + attribute::create_tc_acknowledgements_required(cluster, config->tc_acknowledgements_required); + attribute::create_tc_update_deadline(cluster, config->tc_update_deadline); + command::create_set_tc_acknowledgements(cluster); + command::create_set_tc_acknowledgements_response(cluster); + + return ESP_OK; +} +} /* terms_and_conditions */ + +} /* feature */ + +namespace attribute { +attribute_t *create_breadcrumb(cluster_t *cluster, uint64_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Breadcrumb::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint64(0), esp_matter_uint64(4294967294)); + return attribute; +} + +attribute_t *create_basic_commissioning_info(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, BasicCommissioningInfo::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_regulatory_config(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, RegulatoryConfig::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_location_capability(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LocationCapability::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_supports_concurrent_connection(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, SupportsConcurrentConnection::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_tc_accepted_version(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(terms_and_conditions), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, TCAcceptedVersion::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_tc_min_required_version(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(terms_and_conditions), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, TCMinRequiredVersion::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_tc_acknowledgements(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(terms_and_conditions), NULL); + return esp_matter::attribute::create(cluster, TCAcknowledgements::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bitmap16(value)); +} + +attribute_t *create_tc_acknowledgements_required(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(terms_and_conditions), NULL); + return esp_matter::attribute::create(cluster, TCAcknowledgementsRequired::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_tc_update_deadline(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(terms_and_conditions), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, TCUpdateDeadline::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_arm_fail_safe(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ArmFailSafe::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_arm_fail_safe_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ArmFailSafeResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_set_regulatory_config(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SetRegulatoryConfig::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_set_regulatory_config_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SetRegulatoryConfigResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_commissioning_complete(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CommissioningComplete::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_commissioning_complete_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CommissioningCompleteResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_set_tc_acknowledgements(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(terms_and_conditions), NULL); + return esp_matter::command::create(cluster, SetTCAcknowledgements::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_set_tc_acknowledgements_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(terms_and_conditions), NULL); + return esp_matter::command::create(cluster, SetTCAcknowledgementsResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, general_commissioning::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, general_commissioning::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterGeneralCommissioningPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_breadcrumb(cluster, config->breadcrumb); + attribute::create_regulatory_config(cluster, config->regulatory_config); + attribute::create_location_capability(cluster, config->location_capability); + attribute::create_supports_concurrent_connection(cluster, config->supports_concurrent_connection); + attribute::create_basic_commissioning_info(cluster, NULL, 0, 0); + command::create_arm_fail_safe(cluster); + command::create_arm_fail_safe_response(cluster); + command::create_set_regulatory_config(cluster); + command::create_set_regulatory_config_response(cluster); + command::create_commissioning_complete(cluster); + command::create_commissioning_complete_response(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterGeneralCommissioningClusterServerInitCallback, + ESPMatterGeneralCommissioningClusterServerShutdownCallback); + } + + return cluster; +} + +} /* general_commissioning */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/general_commissioning/general_commissioning.h b/components/esp_matter/data_model/generated/clusters/general_commissioning/general_commissioning.h new file mode 100644 index 000000000..cef0d1af2 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/general_commissioning/general_commissioning.h @@ -0,0 +1,76 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace general_commissioning { + +namespace feature { +namespace terms_and_conditions { +typedef struct config { + uint16_t tc_accepted_version; + uint16_t tc_min_required_version; + uint16_t tc_acknowledgements; + bool tc_acknowledgements_required; + nullable tc_update_deadline; + config() : tc_accepted_version(0), tc_min_required_version(0), tc_acknowledgements(0), tc_acknowledgements_required(true), tc_update_deadline(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* terms_and_conditions */ + +} /* feature */ + +namespace attribute { +attribute_t *create_breadcrumb(cluster_t *cluster, uint64_t value); +attribute_t *create_basic_commissioning_info(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_regulatory_config(cluster_t *cluster, uint8_t value); +attribute_t *create_location_capability(cluster_t *cluster, uint8_t value); +attribute_t *create_supports_concurrent_connection(cluster_t *cluster, bool value); +attribute_t *create_tc_accepted_version(cluster_t *cluster, uint16_t value); +attribute_t *create_tc_min_required_version(cluster_t *cluster, uint16_t value); +attribute_t *create_tc_acknowledgements(cluster_t *cluster, uint16_t value); +attribute_t *create_tc_acknowledgements_required(cluster_t *cluster, bool value); +attribute_t *create_tc_update_deadline(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_arm_fail_safe(cluster_t *cluster); +command_t *create_arm_fail_safe_response(cluster_t *cluster); +command_t *create_set_regulatory_config(cluster_t *cluster); +command_t *create_set_regulatory_config_response(cluster_t *cluster); +command_t *create_commissioning_complete(cluster_t *cluster); +command_t *create_commissioning_complete_response(cluster_t *cluster); +command_t *create_set_tc_acknowledgements(cluster_t *cluster); +command_t *create_set_tc_acknowledgements_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint64_t breadcrumb; + uint8_t regulatory_config; + uint8_t location_capability; + bool supports_concurrent_connection; + config() : breadcrumb(0), regulatory_config(0), location_capability(0), supports_concurrent_connection(true) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* general_commissioning */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/general_commissioning/general_commissioning_ids.h b/components/esp_matter/data_model/generated/clusters/general_commissioning/general_commissioning_ids.h new file mode 100644 index 000000000..a964c9753 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/general_commissioning/general_commissioning_ids.h @@ -0,0 +1,94 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace general_commissioning { + +inline constexpr uint32_t Id = 0x0030; + +namespace feature { +namespace TermsAndConditions { +inline constexpr uint32_t Id = 0x1; +} /* TermsAndConditions */ +} /* feature */ + +namespace attribute { +namespace Breadcrumb { +inline constexpr uint32_t Id = 0x0000; +} /* Breadcrumb */ +namespace BasicCommissioningInfo { +inline constexpr uint32_t Id = 0x0001; +} /* BasicCommissioningInfo */ +namespace RegulatoryConfig { +inline constexpr uint32_t Id = 0x0002; +} /* RegulatoryConfig */ +namespace LocationCapability { +inline constexpr uint32_t Id = 0x0003; +} /* LocationCapability */ +namespace SupportsConcurrentConnection { +inline constexpr uint32_t Id = 0x0004; +} /* SupportsConcurrentConnection */ +namespace TCAcceptedVersion { +inline constexpr uint32_t Id = 0x0005; +} /* TCAcceptedVersion */ +namespace TCMinRequiredVersion { +inline constexpr uint32_t Id = 0x0006; +} /* TCMinRequiredVersion */ +namespace TCAcknowledgements { +inline constexpr uint32_t Id = 0x0007; +} /* TCAcknowledgements */ +namespace TCAcknowledgementsRequired { +inline constexpr uint32_t Id = 0x0008; +} /* TCAcknowledgementsRequired */ +namespace TCUpdateDeadline { +inline constexpr uint32_t Id = 0x0009; +} /* TCUpdateDeadline */ +} /* attribute */ + +namespace command { +namespace ArmFailSafe { +inline constexpr uint32_t Id = 0x00; +} /* ArmFailSafe */ +namespace ArmFailSafeResponse { +inline constexpr uint32_t Id = 0x01; +} /* ArmFailSafeResponse */ +namespace SetRegulatoryConfig { +inline constexpr uint32_t Id = 0x02; +} /* SetRegulatoryConfig */ +namespace SetRegulatoryConfigResponse { +inline constexpr uint32_t Id = 0x03; +} /* SetRegulatoryConfigResponse */ +namespace CommissioningComplete { +inline constexpr uint32_t Id = 0x04; +} /* CommissioningComplete */ +namespace CommissioningCompleteResponse { +inline constexpr uint32_t Id = 0x05; +} /* CommissioningCompleteResponse */ +namespace SetTCAcknowledgements { +inline constexpr uint32_t Id = 0x06; +} /* SetTCAcknowledgements */ +namespace SetTCAcknowledgementsResponse { +inline constexpr uint32_t Id = 0x07; +} /* SetTCAcknowledgementsResponse */ +} /* command */ + +} /* general_commissioning */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/general_diagnostics/general_diagnostics.cpp b/components/esp_matter/data_model/generated/clusters/general_diagnostics/general_diagnostics.cpp new file mode 100644 index 000000000..6e178d27d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/general_diagnostics/general_diagnostics.cpp @@ -0,0 +1,214 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "general_diagnostics_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace general_diagnostics { + +namespace feature { +namespace data_model_test { +uint32_t get_id() +{ + return DataModelTest::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_payload_test_request(cluster); + command::create_payload_test_response(cluster); + + return ESP_OK; +} +} /* data_model_test */ + +} /* feature */ + +namespace attribute { +attribute_t *create_network_interfaces(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, NetworkInterfaces::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_reboot_count(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, RebootCount::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_up_time(cluster_t *cluster, uint64_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, UpTime::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint64(0), esp_matter_uint64(4294967294)); + return attribute; +} + +attribute_t *create_total_operational_hours(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, TotalOperationalHours::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +attribute_t *create_boot_reason(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, BootReason::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(6)); + return attribute; +} + +attribute_t *create_active_hardware_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ActiveHardwareFaults::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_active_radio_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ActiveRadioFaults::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_active_network_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ActiveNetworkFaults::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_test_event_triggers_enabled(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, TestEventTriggersEnabled::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +} /* attribute */ +namespace command { +command_t *create_test_event_trigger(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, TestEventTrigger::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_time_snapshot(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, TimeSnapshot::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_time_snapshot_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, TimeSnapshotResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_payload_test_request(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(data_model_test), NULL); + return esp_matter::command::create(cluster, PayloadTestRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_payload_test_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(data_model_test), NULL); + return esp_matter::command::create(cluster, PayloadTestResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_hardware_fault_change(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, HardwareFaultChange::Id); +} + +event_t *create_radio_fault_change(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, RadioFaultChange::Id); +} + +event_t *create_network_fault_change(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, NetworkFaultChange::Id); +} + +event_t *create_boot_reason(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, BootReason::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, general_diagnostics::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, general_diagnostics::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterGeneralDiagnosticsPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_reboot_count(cluster, config->reboot_count); + attribute::create_up_time(cluster, config->up_time); + attribute::create_test_event_triggers_enabled(cluster, config->test_event_triggers_enabled); + attribute::create_network_interfaces(cluster, NULL, 0, 0); + command::create_test_event_trigger(cluster); + command::create_time_snapshot(cluster); + command::create_time_snapshot_response(cluster); + /* Events */ + event::create_boot_reason(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterGeneralDiagnosticsClusterServerInitCallback, + ESPMatterGeneralDiagnosticsClusterServerShutdownCallback); + } + + return cluster; +} + +} /* general_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/general_diagnostics/general_diagnostics.h b/components/esp_matter/data_model/generated/clusters/general_diagnostics/general_diagnostics.h new file mode 100644 index 000000000..3aa88a3ca --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/general_diagnostics/general_diagnostics.h @@ -0,0 +1,70 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace general_diagnostics { + +namespace feature { +namespace data_model_test { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* data_model_test */ + +} /* feature */ + +namespace attribute { +attribute_t *create_network_interfaces(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_reboot_count(cluster_t *cluster, uint16_t value); +attribute_t *create_up_time(cluster_t *cluster, uint64_t value); +attribute_t *create_total_operational_hours(cluster_t *cluster, uint32_t value); +attribute_t *create_boot_reason(cluster_t *cluster, uint8_t value); +attribute_t *create_active_hardware_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_active_radio_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_active_network_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_test_event_triggers_enabled(cluster_t *cluster, bool value); +} /* attribute */ + +namespace command { +command_t *create_test_event_trigger(cluster_t *cluster); +command_t *create_time_snapshot(cluster_t *cluster); +command_t *create_time_snapshot_response(cluster_t *cluster); +command_t *create_payload_test_request(cluster_t *cluster); +command_t *create_payload_test_response(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_hardware_fault_change(cluster_t *cluster); +event_t *create_radio_fault_change(cluster_t *cluster); +event_t *create_network_fault_change(cluster_t *cluster); +event_t *create_boot_reason(cluster_t *cluster); +} /* event */ + +typedef struct config { + uint16_t reboot_count; + uint64_t up_time; + bool test_event_triggers_enabled; + config() : reboot_count(0), up_time(0), test_event_triggers_enabled(false) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* general_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/general_diagnostics/general_diagnostics_ids.h b/components/esp_matter/data_model/generated/clusters/general_diagnostics/general_diagnostics_ids.h new file mode 100644 index 000000000..6674b3502 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/general_diagnostics/general_diagnostics_ids.h @@ -0,0 +1,97 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace general_diagnostics { + +inline constexpr uint32_t Id = 0x0033; + +namespace feature { +namespace DataModelTest { +inline constexpr uint32_t Id = 0x1; +} /* DataModelTest */ +} /* feature */ + +namespace attribute { +namespace NetworkInterfaces { +inline constexpr uint32_t Id = 0x0000; +} /* NetworkInterfaces */ +namespace RebootCount { +inline constexpr uint32_t Id = 0x0001; +} /* RebootCount */ +namespace UpTime { +inline constexpr uint32_t Id = 0x0002; +} /* UpTime */ +namespace TotalOperationalHours { +inline constexpr uint32_t Id = 0x0003; +} /* TotalOperationalHours */ +namespace BootReason { +inline constexpr uint32_t Id = 0x0004; +} /* BootReason */ +namespace ActiveHardwareFaults { +inline constexpr uint32_t Id = 0x0005; +} /* ActiveHardwareFaults */ +namespace ActiveRadioFaults { +inline constexpr uint32_t Id = 0x0006; +} /* ActiveRadioFaults */ +namespace ActiveNetworkFaults { +inline constexpr uint32_t Id = 0x0007; +} /* ActiveNetworkFaults */ +namespace TestEventTriggersEnabled { +inline constexpr uint32_t Id = 0x0008; +} /* TestEventTriggersEnabled */ +} /* attribute */ + +namespace command { +namespace TestEventTrigger { +inline constexpr uint32_t Id = 0x00; +} /* TestEventTrigger */ +namespace TimeSnapshot { +inline constexpr uint32_t Id = 0x01; +} /* TimeSnapshot */ +namespace TimeSnapshotResponse { +inline constexpr uint32_t Id = 0x02; +} /* TimeSnapshotResponse */ +namespace PayloadTestRequest { +inline constexpr uint32_t Id = 0x03; +} /* PayloadTestRequest */ +namespace PayloadTestResponse { +inline constexpr uint32_t Id = 0x04; +} /* PayloadTestResponse */ +} /* command */ + +namespace event { +namespace HardwareFaultChange { +inline constexpr uint32_t Id = 0x00; +} /* HardwareFaultChange */ +namespace RadioFaultChange { +inline constexpr uint32_t Id = 0x01; +} /* RadioFaultChange */ +namespace NetworkFaultChange { +inline constexpr uint32_t Id = 0x02; +} /* NetworkFaultChange */ +namespace BootReason { +inline constexpr uint32_t Id = 0x03; +} /* BootReason */ +} /* event */ + +} /* general_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/group_key_management/group_key_management.cpp b/components/esp_matter/data_model/generated/clusters/group_key_management/group_key_management.cpp new file mode 100644 index 000000000..34575bb43 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/group_key_management/group_key_management.cpp @@ -0,0 +1,144 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "group_key_management_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace group_key_management { + +namespace attribute { +attribute_t *create_group_key_map(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, GroupKeyMap::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_group_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, GroupTable::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_max_groups_per_fabric(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxGroupsPerFabric::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_max_group_keys_per_fabric(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxGroupKeysPerFabric::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(1), esp_matter_uint16(65535)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_key_set_write(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, KeySetWrite::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_key_set_read(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, KeySetRead::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_key_set_read_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, KeySetReadResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_key_set_remove(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, KeySetRemove::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_key_set_read_all_indices(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, KeySetReadAllIndices::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_key_set_read_all_indices_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, KeySetReadAllIndicesResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, group_key_management::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, group_key_management::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterGroupKeyManagementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_max_groups_per_fabric(cluster, config->max_groups_per_fabric); + attribute::create_max_group_keys_per_fabric(cluster, config->max_group_keys_per_fabric); + attribute::create_group_key_map(cluster, NULL, 0, 0); + attribute::create_group_table(cluster, NULL, 0, 0); + command::create_key_set_write(cluster); + command::create_key_set_read(cluster); + command::create_key_set_read_response(cluster); + command::create_key_set_remove(cluster); + command::create_key_set_read_all_indices(cluster); + command::create_key_set_read_all_indices_response(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterGroupKeyManagementClusterServerInitCallback, + ESPMatterGroupKeyManagementClusterServerShutdownCallback); + } + + return cluster; +} + +} /* group_key_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/group_key_management/group_key_management.h b/components/esp_matter/data_model/generated/clusters/group_key_management/group_key_management.h new file mode 100644 index 000000000..ba703f795 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/group_key_management/group_key_management.h @@ -0,0 +1,50 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace group_key_management { + +namespace attribute { +attribute_t *create_group_key_map(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_group_table(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_max_groups_per_fabric(cluster_t *cluster, uint16_t value); +attribute_t *create_max_group_keys_per_fabric(cluster_t *cluster, uint16_t value); +} /* attribute */ + +namespace command { +command_t *create_key_set_write(cluster_t *cluster); +command_t *create_key_set_read(cluster_t *cluster); +command_t *create_key_set_read_response(cluster_t *cluster); +command_t *create_key_set_remove(cluster_t *cluster); +command_t *create_key_set_read_all_indices(cluster_t *cluster); +command_t *create_key_set_read_all_indices_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint16_t max_groups_per_fabric; + uint16_t max_group_keys_per_fabric; + config() : max_groups_per_fabric(0), max_group_keys_per_fabric(1) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* group_key_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/group_key_management/group_key_management_ids.h b/components/esp_matter/data_model/generated/clusters/group_key_management/group_key_management_ids.h new file mode 100644 index 000000000..0e1122b4f --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/group_key_management/group_key_management_ids.h @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace group_key_management { + +inline constexpr uint32_t Id = 0x003F; + +namespace attribute { +namespace GroupKeyMap { +inline constexpr uint32_t Id = 0x0000; +} /* GroupKeyMap */ +namespace GroupTable { +inline constexpr uint32_t Id = 0x0001; +} /* GroupTable */ +namespace MaxGroupsPerFabric { +inline constexpr uint32_t Id = 0x0002; +} /* MaxGroupsPerFabric */ +namespace MaxGroupKeysPerFabric { +inline constexpr uint32_t Id = 0x0003; +} /* MaxGroupKeysPerFabric */ +} /* attribute */ + +namespace command { +namespace KeySetWrite { +inline constexpr uint32_t Id = 0x00; +} /* KeySetWrite */ +namespace KeySetRead { +inline constexpr uint32_t Id = 0x01; +} /* KeySetRead */ +namespace KeySetReadResponse { +inline constexpr uint32_t Id = 0x02; +} /* KeySetReadResponse */ +namespace KeySetRemove { +inline constexpr uint32_t Id = 0x03; +} /* KeySetRemove */ +namespace KeySetReadAllIndices { +inline constexpr uint32_t Id = 0x04; +} /* KeySetReadAllIndices */ +namespace KeySetReadAllIndicesResponse { +inline constexpr uint32_t Id = 0x05; +} /* KeySetReadAllIndicesResponse */ +} /* command */ + +} /* group_key_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/groups/groups.cpp b/components/esp_matter/data_model/generated/clusters/groups/groups.cpp new file mode 100644 index 000000000..179631f30 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/groups/groups.cpp @@ -0,0 +1,236 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "groups_cluster"; +constexpr uint16_t cluster_revision = 4; + +static esp_err_t esp_matter_command_callback_add_group(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Groups::Commands::AddGroup::DecodableType command_data; + chip::app::CommandHandler *command_obj = (chip::app::CommandHandler *)opaque_ptr; + CHIP_ERROR error = command_data.Decode(tlv_data, command_obj->GetAccessingFabricIndex()); + if (error == CHIP_NO_ERROR) { + emberAfGroupsClusterAddGroupCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_view_group(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Groups::Commands::ViewGroup::DecodableType command_data; + chip::app::CommandHandler *command_obj = (chip::app::CommandHandler *)opaque_ptr; + CHIP_ERROR error = command_data.Decode(tlv_data, command_obj->GetAccessingFabricIndex()); + if (error == CHIP_NO_ERROR) { + emberAfGroupsClusterViewGroupCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_get_group_membership(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Groups::Commands::GetGroupMembership::DecodableType command_data; + chip::app::CommandHandler *command_obj = (chip::app::CommandHandler *)opaque_ptr; + CHIP_ERROR error = command_data.Decode(tlv_data, command_obj->GetAccessingFabricIndex()); + if (error == CHIP_NO_ERROR) { + emberAfGroupsClusterGetGroupMembershipCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_remove_group(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Groups::Commands::RemoveGroup::DecodableType command_data; + chip::app::CommandHandler *command_obj = (chip::app::CommandHandler *)opaque_ptr; + CHIP_ERROR error = command_data.Decode(tlv_data, command_obj->GetAccessingFabricIndex()); + if (error == CHIP_NO_ERROR) { + emberAfGroupsClusterRemoveGroupCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_remove_all_groups(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Groups::Commands::RemoveAllGroups::DecodableType command_data; + chip::app::CommandHandler *command_obj = (chip::app::CommandHandler *)opaque_ptr; + CHIP_ERROR error = command_data.Decode(tlv_data, command_obj->GetAccessingFabricIndex()); + if (error == CHIP_NO_ERROR) { + emberAfGroupsClusterRemoveAllGroupsCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_add_group_if_identifying(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Groups::Commands::AddGroupIfIdentifying::DecodableType command_data; + chip::app::CommandHandler *command_obj = (chip::app::CommandHandler *)opaque_ptr; + CHIP_ERROR error = command_data.Decode(tlv_data, command_obj->GetAccessingFabricIndex()); + if (error == CHIP_NO_ERROR) { + emberAfGroupsClusterAddGroupIfIdentifyingCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace groups { + +namespace feature { +namespace group_names { +uint32_t get_id() +{ + return GroupNames::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* group_names */ + +} /* feature */ + +namespace attribute { +attribute_t *create_name_support(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, NameSupport::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(1)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_add_group(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AddGroup::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_add_group); +} + +command_t *create_add_group_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AddGroupResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_view_group(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ViewGroup::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_view_group); +} + +command_t *create_view_group_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ViewGroupResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_get_group_membership(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetGroupMembership::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_get_group_membership); +} + +command_t *create_get_group_membership_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetGroupMembershipResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_remove_group(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RemoveGroup::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_remove_group); +} + +command_t *create_remove_group_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RemoveGroupResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_remove_all_groups(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RemoveAllGroups::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_remove_all_groups); +} + +command_t *create_add_group_if_identifying(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AddGroupIfIdentifying::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_add_group_if_identifying); +} + +} /* command */ + +const function_generic_t function_list[] = { + (function_generic_t)emberAfGroupsClusterServerInitCallback, +}; + +const int function_flags = CLUSTER_FLAG_INIT_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, groups::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, groups::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterGroupsPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_name_support(cluster, config->name_support); + command::create_add_group(cluster); + command::create_add_group_response(cluster); + command::create_view_group(cluster); + command::create_view_group_response(cluster); + command::create_get_group_membership(cluster); + command::create_get_group_membership_response(cluster); + command::create_remove_group(cluster); + command::create_remove_group_response(cluster); + command::create_remove_all_groups(cluster); + command::create_add_group_if_identifying(cluster); + } + + return cluster; +} + +} /* groups */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/groups/groups.h b/components/esp_matter/data_model/generated/clusters/groups/groups.h new file mode 100644 index 000000000..e22ba2650 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/groups/groups.h @@ -0,0 +1,58 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace groups { + +namespace feature { +namespace group_names { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* group_names */ + +} /* feature */ + +namespace attribute { +attribute_t *create_name_support(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_add_group(cluster_t *cluster); +command_t *create_add_group_response(cluster_t *cluster); +command_t *create_view_group(cluster_t *cluster); +command_t *create_view_group_response(cluster_t *cluster); +command_t *create_get_group_membership(cluster_t *cluster); +command_t *create_get_group_membership_response(cluster_t *cluster); +command_t *create_remove_group(cluster_t *cluster); +command_t *create_remove_group_response(cluster_t *cluster); +command_t *create_remove_all_groups(cluster_t *cluster); +command_t *create_add_group_if_identifying(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t name_support; + config() : name_support(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* groups */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/groups/groups_ids.h b/components/esp_matter/data_model/generated/clusters/groups/groups_ids.h new file mode 100644 index 000000000..41c7ed675 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/groups/groups_ids.h @@ -0,0 +1,73 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace groups { + +inline constexpr uint32_t Id = 0x0004; + +namespace feature { +namespace GroupNames { +inline constexpr uint32_t Id = 0x1; +} /* GroupNames */ +} /* feature */ + +namespace attribute { +namespace NameSupport { +inline constexpr uint32_t Id = 0x0000; +} /* NameSupport */ +} /* attribute */ + +namespace command { +namespace AddGroup { +inline constexpr uint32_t Id = 0x00; +} /* AddGroup */ +namespace AddGroupResponse { +inline constexpr uint32_t Id = 0x00; +} /* AddGroupResponse */ +namespace ViewGroup { +inline constexpr uint32_t Id = 0x01; +} /* ViewGroup */ +namespace ViewGroupResponse { +inline constexpr uint32_t Id = 0x01; +} /* ViewGroupResponse */ +namespace GetGroupMembership { +inline constexpr uint32_t Id = 0x02; +} /* GetGroupMembership */ +namespace GetGroupMembershipResponse { +inline constexpr uint32_t Id = 0x02; +} /* GetGroupMembershipResponse */ +namespace RemoveGroup { +inline constexpr uint32_t Id = 0x03; +} /* RemoveGroup */ +namespace RemoveGroupResponse { +inline constexpr uint32_t Id = 0x03; +} /* RemoveGroupResponse */ +namespace RemoveAllGroups { +inline constexpr uint32_t Id = 0x04; +} /* RemoveAllGroups */ +namespace AddGroupIfIdentifying { +inline constexpr uint32_t Id = 0x05; +} /* AddGroupIfIdentifying */ +} /* command */ + +} /* groups */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/hepa_filter_monitoring/hepa_filter_monitoring.cpp b/components/esp_matter/data_model/generated/clusters/hepa_filter_monitoring/hepa_filter_monitoring.cpp new file mode 100644 index 000000000..e793bda2d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/hepa_filter_monitoring/hepa_filter_monitoring.cpp @@ -0,0 +1,191 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "hepa_filter_monitoring_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace hepa_filter_monitoring { + +namespace feature { +namespace condition { +uint32_t get_id() +{ + return Condition::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_condition(cluster, config->condition); + attribute::create_degradation_direction(cluster, config->degradation_direction); + + return ESP_OK; +} +} /* condition */ + +namespace warning { +uint32_t get_id() +{ + return Warning::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* warning */ + +namespace replacement_product_list { +uint32_t get_id() +{ + return ReplacementProductList::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_replacement_product_list(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* replacement_product_list */ + +} /* feature */ + +namespace attribute { +attribute_t *create_condition(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(condition), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, Condition::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_degradation_direction(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(condition), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, DegradationDirection::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(1)); + return attribute; +} + +attribute_t *create_change_indication(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ChangeIndication::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_in_place_indicator(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, InPlaceIndicator::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_last_changed_time(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LastChangedTime::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_replacement_product_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(replacement_product_list), NULL); + return esp_matter::attribute::create(cluster, ReplacementProductList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_reset_condition(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ResetCondition::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, hepa_filter_monitoring::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, hepa_filter_monitoring::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterHepaFilterMonitoringPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_change_indication(cluster, config->change_indication); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterHepaFilterMonitoringClusterServerInitCallback, + ESPMatterHepaFilterMonitoringClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* hepa_filter_monitoring */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/hepa_filter_monitoring/hepa_filter_monitoring.h b/components/esp_matter/data_model/generated/clusters/hepa_filter_monitoring/hepa_filter_monitoring.h new file mode 100644 index 000000000..256933b86 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/hepa_filter_monitoring/hepa_filter_monitoring.h @@ -0,0 +1,69 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace hepa_filter_monitoring { + +namespace feature { +namespace condition { +typedef struct config { + uint8_t condition; + uint8_t degradation_direction; + config() : condition(0), degradation_direction(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* condition */ + +namespace warning { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* warning */ + +namespace replacement_product_list { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* replacement_product_list */ + +} /* feature */ + +namespace attribute { +attribute_t *create_condition(cluster_t *cluster, uint8_t value); +attribute_t *create_degradation_direction(cluster_t *cluster, uint8_t value); +attribute_t *create_change_indication(cluster_t *cluster, uint8_t value); +attribute_t *create_in_place_indicator(cluster_t *cluster, bool value); +attribute_t *create_last_changed_time(cluster_t *cluster, nullable value); +attribute_t *create_replacement_product_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_reset_condition(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t change_indication; + config() : change_indication(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* hepa_filter_monitoring */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/hepa_filter_monitoring/hepa_filter_monitoring_ids.h b/components/esp_matter/data_model/generated/clusters/hepa_filter_monitoring/hepa_filter_monitoring_ids.h new file mode 100644 index 000000000..33ae2c487 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/hepa_filter_monitoring/hepa_filter_monitoring_ids.h @@ -0,0 +1,67 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace hepa_filter_monitoring { + +inline constexpr uint32_t Id = 0x0071; + +namespace feature { +namespace Condition { +inline constexpr uint32_t Id = 0x1; +} /* Condition */ +namespace Warning { +inline constexpr uint32_t Id = 0x2; +} /* Warning */ +namespace ReplacementProductList { +inline constexpr uint32_t Id = 0x4; +} /* ReplacementProductList */ +} /* feature */ + +namespace attribute { +namespace Condition { +inline constexpr uint32_t Id = 0x0000; +} /* Condition */ +namespace DegradationDirection { +inline constexpr uint32_t Id = 0x0001; +} /* DegradationDirection */ +namespace ChangeIndication { +inline constexpr uint32_t Id = 0x0002; +} /* ChangeIndication */ +namespace InPlaceIndicator { +inline constexpr uint32_t Id = 0x0003; +} /* InPlaceIndicator */ +namespace LastChangedTime { +inline constexpr uint32_t Id = 0x0004; +} /* LastChangedTime */ +namespace ReplacementProductList { +inline constexpr uint32_t Id = 0x0005; +} /* ReplacementProductList */ +} /* attribute */ + +namespace command { +namespace ResetCondition { +inline constexpr uint32_t Id = 0x00; +} /* ResetCondition */ +} /* command */ + +} /* hepa_filter_monitoring */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/icd_management/icd_management.cpp b/components/esp_matter/data_model/generated/clusters/icd_management/icd_management.cpp new file mode 100644 index 000000000..7011fd7c2 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/icd_management/icd_management.cpp @@ -0,0 +1,272 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "icd_management_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace icd_management { + +namespace feature { +namespace check_in_protocol_support { +uint32_t get_id() +{ + return CheckInProtocolSupport::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_icd_counter(cluster, config->icd_counter); + attribute::create_clients_supported_per_fabric(cluster, config->clients_supported_per_fabric); + attribute::create_maximum_check_in_backoff(cluster, config->maximum_check_in_backoff); + attribute::create_registered_clients(cluster, NULL, 0, 0); + command::create_register_client(cluster); + command::create_register_client_response(cluster); + command::create_unregister_client(cluster); + + return ESP_OK; +} +} /* check_in_protocol_support */ + +namespace user_active_mode_trigger { +uint32_t get_id() +{ + return UserActiveModeTrigger::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_user_active_mode_trigger_hint(cluster, config->user_active_mode_trigger_hint); + + return ESP_OK; +} +} /* user_active_mode_trigger */ + +namespace long_idle_time_support { +uint32_t get_id() +{ + return LongIdleTimeSupport::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_operating_mode(cluster, config->operating_mode); + command::create_stay_active_request(cluster); + command::create_stay_active_response(cluster); + + return ESP_OK; +} +} /* long_idle_time_support */ + +namespace dynamic_sit_lit_support { +uint32_t get_id() +{ + return DynamicSitLitSupport::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(long_idle_time_support), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* dynamic_sit_lit_support */ + +} /* feature */ + +namespace attribute { +attribute_t *create_idle_mode_duration(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, IdleModeDuration::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(1), esp_matter_uint32(64800)); + return attribute; +} + +attribute_t *create_active_mode_duration(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ActiveModeDuration::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +attribute_t *create_active_mode_threshold(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ActiveModeThreshold::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_registered_clients(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(check_in_protocol_support), NULL); + return esp_matter::attribute::create(cluster, RegisteredClients::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_icd_counter(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(check_in_protocol_support), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ICDCounter::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +attribute_t *create_clients_supported_per_fabric(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(check_in_protocol_support), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ClientsSupportedPerFabric::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(1), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_user_active_mode_trigger_hint(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user_active_mode_trigger), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, UserActiveModeTriggerHint::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(131071)); + return attribute; +} + +attribute_t *create_user_active_mode_trigger_instruction(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_user_active_mode_trigger_instruction_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, UserActiveModeTriggerInstruction::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_user_active_mode_trigger_instruction_length + 1); +} + +attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(long_idle_time_support), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, OperatingMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(1)); + return attribute; +} + +attribute_t *create_maximum_check_in_backoff(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(check_in_protocol_support), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MaximumCheckInBackoff::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(64800)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_register_client(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(check_in_protocol_support), NULL); + return esp_matter::command::create(cluster, RegisterClient::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_register_client_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(check_in_protocol_support), NULL); + return esp_matter::command::create(cluster, RegisterClientResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_unregister_client(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(check_in_protocol_support), NULL); + return esp_matter::command::create(cluster, UnregisterClient::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_stay_active_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, StayActiveRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_stay_active_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, StayActiveResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, icd_management::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, icd_management::Id)); +#if CHIP_CONFIG_ENABLE_ICD_SERVER + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_idle_mode_duration(cluster, config->idle_mode_duration); + attribute::create_active_mode_duration(cluster, config->active_mode_duration); + attribute::create_active_mode_threshold(cluster, config->active_mode_threshold); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterIcdManagementClusterServerInitCallback, + ESPMatterIcdManagementClusterServerShutdownCallback); + } +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER + + return cluster; +} + +} /* icd_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/icd_management/icd_management.h b/components/esp_matter/data_model/generated/clusters/icd_management/icd_management.h new file mode 100644 index 000000000..9a1e8c99b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/icd_management/icd_management.h @@ -0,0 +1,94 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace icd_management { + +const uint8_t k_max_user_active_mode_trigger_instruction_length = 128u; +namespace feature { +namespace check_in_protocol_support { +typedef struct config { + uint32_t icd_counter; + uint16_t clients_supported_per_fabric; + uint32_t maximum_check_in_backoff; + config() : icd_counter(0), clients_supported_per_fabric(1), maximum_check_in_backoff(1) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* check_in_protocol_support */ + +namespace user_active_mode_trigger { +typedef struct config { + uint32_t user_active_mode_trigger_hint; + config() : user_active_mode_trigger_hint(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* user_active_mode_trigger */ + +namespace long_idle_time_support { +typedef struct config { + uint8_t operating_mode; + config() : operating_mode(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* long_idle_time_support */ + +namespace dynamic_sit_lit_support { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* dynamic_sit_lit_support */ + +} /* feature */ + +namespace attribute { +attribute_t *create_idle_mode_duration(cluster_t *cluster, uint32_t value); +attribute_t *create_active_mode_duration(cluster_t *cluster, uint32_t value); +attribute_t *create_active_mode_threshold(cluster_t *cluster, uint16_t value); +attribute_t *create_registered_clients(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_icd_counter(cluster_t *cluster, uint32_t value); +attribute_t *create_clients_supported_per_fabric(cluster_t *cluster, uint16_t value); +attribute_t *create_user_active_mode_trigger_hint(cluster_t *cluster, uint32_t value); +attribute_t *create_user_active_mode_trigger_instruction(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_maximum_check_in_backoff(cluster_t *cluster, uint32_t value); +} /* attribute */ + +namespace command { +command_t *create_register_client(cluster_t *cluster); +command_t *create_register_client_response(cluster_t *cluster); +command_t *create_unregister_client(cluster_t *cluster); +command_t *create_stay_active_request(cluster_t *cluster); +command_t *create_stay_active_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint32_t idle_mode_duration; + uint32_t active_mode_duration; + uint16_t active_mode_threshold; + config() : idle_mode_duration(1), active_mode_duration(300), active_mode_threshold(300) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* icd_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/icd_management/icd_management_ids.h b/components/esp_matter/data_model/generated/clusters/icd_management/icd_management_ids.h new file mode 100644 index 000000000..5269f3031 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/icd_management/icd_management_ids.h @@ -0,0 +1,94 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace icd_management { + +inline constexpr uint32_t Id = 0x0046; + +namespace feature { +namespace CheckInProtocolSupport { +inline constexpr uint32_t Id = 0x1; +} /* CheckInProtocolSupport */ +namespace UserActiveModeTrigger { +inline constexpr uint32_t Id = 0x2; +} /* UserActiveModeTrigger */ +namespace LongIdleTimeSupport { +inline constexpr uint32_t Id = 0x4; +} /* LongIdleTimeSupport */ +namespace DynamicSitLitSupport { +inline constexpr uint32_t Id = 0x8; +} /* DynamicSitLitSupport */ +} /* feature */ + +namespace attribute { +namespace IdleModeDuration { +inline constexpr uint32_t Id = 0x0000; +} /* IdleModeDuration */ +namespace ActiveModeDuration { +inline constexpr uint32_t Id = 0x0001; +} /* ActiveModeDuration */ +namespace ActiveModeThreshold { +inline constexpr uint32_t Id = 0x0002; +} /* ActiveModeThreshold */ +namespace RegisteredClients { +inline constexpr uint32_t Id = 0x0003; +} /* RegisteredClients */ +namespace ICDCounter { +inline constexpr uint32_t Id = 0x0004; +} /* ICDCounter */ +namespace ClientsSupportedPerFabric { +inline constexpr uint32_t Id = 0x0005; +} /* ClientsSupportedPerFabric */ +namespace UserActiveModeTriggerHint { +inline constexpr uint32_t Id = 0x0006; +} /* UserActiveModeTriggerHint */ +namespace UserActiveModeTriggerInstruction { +inline constexpr uint32_t Id = 0x0007; +} /* UserActiveModeTriggerInstruction */ +namespace OperatingMode { +inline constexpr uint32_t Id = 0x0008; +} /* OperatingMode */ +namespace MaximumCheckInBackoff { +inline constexpr uint32_t Id = 0x0009; +} /* MaximumCheckInBackoff */ +} /* attribute */ + +namespace command { +namespace RegisterClient { +inline constexpr uint32_t Id = 0x00; +} /* RegisterClient */ +namespace RegisterClientResponse { +inline constexpr uint32_t Id = 0x01; +} /* RegisterClientResponse */ +namespace UnregisterClient { +inline constexpr uint32_t Id = 0x02; +} /* UnregisterClient */ +namespace StayActiveRequest { +inline constexpr uint32_t Id = 0x03; +} /* StayActiveRequest */ +namespace StayActiveResponse { +inline constexpr uint32_t Id = 0x04; +} /* StayActiveResponse */ +} /* command */ + +} /* icd_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/identify/identify.cpp b/components/esp_matter/data_model/generated/clusters/identify/identify.cpp new file mode 100644 index 000000000..dcd2e2878 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/identify/identify.cpp @@ -0,0 +1,107 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "identify_cluster"; +constexpr uint16_t cluster_revision = 6; + +namespace esp_matter { +namespace cluster { +namespace identify { + +namespace attribute { +attribute_t *create_identify_time(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, IdentifyTime::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_identify_type(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, IdentifyType::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(5)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_identify(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Identify::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_trigger_effect(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, TriggerEffect::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, identify::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, identify::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterIdentifyPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_identify_time(cluster, config->identify_time); + attribute::create_identify_type(cluster, config->identify_type); + command::create_identify(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterIdentifyClusterServerInitCallback, + ESPMatterIdentifyClusterServerShutdownCallback); + } + + return cluster; +} + +} /* identify */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/identify/identify.h b/components/esp_matter/data_model/generated/clusters/identify/identify.h new file mode 100644 index 000000000..b3baca656 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/identify/identify.h @@ -0,0 +1,44 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace identify { + +namespace attribute { +attribute_t *create_identify_time(cluster_t *cluster, uint16_t value); +attribute_t *create_identify_type(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_identify(cluster_t *cluster); +command_t *create_trigger_effect(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint16_t identify_time; + uint8_t identify_type; + config() : identify_time(0), identify_type(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* identify */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/identify/identify_ids.h b/components/esp_matter/data_model/generated/clusters/identify/identify_ids.h new file mode 100644 index 000000000..b331ca4f0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/identify/identify_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace identify { + +inline constexpr uint32_t Id = 0x0003; + +namespace attribute { +namespace IdentifyTime { +inline constexpr uint32_t Id = 0x0000; +} /* IdentifyTime */ +namespace IdentifyType { +inline constexpr uint32_t Id = 0x0001; +} /* IdentifyType */ +} /* attribute */ + +namespace command { +namespace Identify { +inline constexpr uint32_t Id = 0x00; +} /* Identify */ +namespace TriggerEffect { +inline constexpr uint32_t Id = 0x40; +} /* TriggerEffect */ +} /* command */ + +} /* identify */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/illuminance_measurement/illuminance_measurement.cpp b/components/esp_matter/data_model/generated/clusters/illuminance_measurement/illuminance_measurement.cpp new file mode 100644 index 000000000..e21f4c05a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/illuminance_measurement/illuminance_measurement.cpp @@ -0,0 +1,121 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "illuminance_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace illuminance_measurement { + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(1), esp_matter_nullable_uint16(65533)); + return attribute; +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Tolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(2048)); + return attribute; +} + +attribute_t *create_light_sensor_type(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LightSensorType::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_enum8(0), esp_matter_nullable_enum8(1)); + return attribute; +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, illuminance_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, illuminance_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterIlluminanceMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measured_value(cluster, config->measured_value); + attribute::create_min_measured_value(cluster, config->min_measured_value); + attribute::create_max_measured_value(cluster, config->max_measured_value); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* illuminance_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/illuminance_measurement/illuminance_measurement.h b/components/esp_matter/data_model/generated/clusters/illuminance_measurement/illuminance_measurement.h new file mode 100644 index 000000000..fbc35f7cd --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/illuminance_measurement/illuminance_measurement.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace illuminance_measurement { + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value); +attribute_t *create_light_sensor_type(cluster_t *cluster, nullable value); +} /* attribute */ + +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + config() : measured_value(0), min_measured_value(0), max_measured_value(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* illuminance_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/illuminance_measurement/illuminance_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/illuminance_measurement/illuminance_measurement_ids.h new file mode 100644 index 000000000..133dc822f --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/illuminance_measurement/illuminance_measurement_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace illuminance_measurement { + +inline constexpr uint32_t Id = 0x0400; + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace Tolerance { +inline constexpr uint32_t Id = 0x0003; +} /* Tolerance */ +namespace LightSensorType { +inline constexpr uint32_t Id = 0x0004; +} /* LightSensorType */ +} /* attribute */ + +} /* illuminance_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/joint_fabric_administrator/joint_fabric_administrator.cpp b/components/esp_matter/data_model/generated/clusters/joint_fabric_administrator/joint_fabric_administrator.cpp new file mode 100644 index 000000000..37da84f7a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/joint_fabric_administrator/joint_fabric_administrator.cpp @@ -0,0 +1,71 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "joint_fabric_administrator_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace joint_fabric_administrator { + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, joint_fabric_administrator::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, joint_fabric_administrator::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterJointFabricAdministratorPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + } + + return cluster; +} + +} /* joint_fabric_administrator */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/joint_fabric_administrator/joint_fabric_administrator.h b/components/esp_matter/data_model/generated/clusters/joint_fabric_administrator/joint_fabric_administrator.h new file mode 100644 index 000000000..9c893f56b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/joint_fabric_administrator/joint_fabric_administrator.h @@ -0,0 +1,32 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace joint_fabric_administrator { + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* joint_fabric_administrator */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/joint_fabric_administrator/joint_fabric_administrator_ids.h b/components/esp_matter/data_model/generated/clusters/joint_fabric_administrator/joint_fabric_administrator_ids.h new file mode 100644 index 000000000..68060e0e9 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/joint_fabric_administrator/joint_fabric_administrator_ids.h @@ -0,0 +1,28 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace joint_fabric_administrator { + +inline constexpr uint32_t Id = 0x0753; + +} /* joint_fabric_administrator */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/joint_fabric_datastore/joint_fabric_datastore.cpp b/components/esp_matter/data_model/generated/clusters/joint_fabric_datastore/joint_fabric_datastore.cpp new file mode 100644 index 000000000..f66e2e583 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/joint_fabric_datastore/joint_fabric_datastore.cpp @@ -0,0 +1,71 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "joint_fabric_datastore_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace joint_fabric_datastore { + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, joint_fabric_datastore::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, joint_fabric_datastore::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterJointFabricDatastorePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + } + + return cluster; +} + +} /* joint_fabric_datastore */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/joint_fabric_datastore/joint_fabric_datastore.h b/components/esp_matter/data_model/generated/clusters/joint_fabric_datastore/joint_fabric_datastore.h new file mode 100644 index 000000000..a090b104e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/joint_fabric_datastore/joint_fabric_datastore.h @@ -0,0 +1,32 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace joint_fabric_datastore { + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* joint_fabric_datastore */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/joint_fabric_datastore/joint_fabric_datastore_ids.h b/components/esp_matter/data_model/generated/clusters/joint_fabric_datastore/joint_fabric_datastore_ids.h new file mode 100644 index 000000000..e7ca8bdbd --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/joint_fabric_datastore/joint_fabric_datastore_ids.h @@ -0,0 +1,28 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace joint_fabric_datastore { + +inline constexpr uint32_t Id = 0x0752; + +} /* joint_fabric_datastore */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/keypad_input/keypad_input.cpp b/components/esp_matter/data_model/generated/clusters/keypad_input/keypad_input.cpp new file mode 100644 index 000000000..4e8e03f1f --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/keypad_input/keypad_input.cpp @@ -0,0 +1,160 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "keypad_input_cluster"; +constexpr uint16_t cluster_revision = 1; + +static esp_err_t esp_matter_command_callback_send_key(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::KeypadInput::Commands::SendKey::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfKeypadInputClusterSendKeyCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace keypad_input { + +namespace feature { +namespace navigation_key_codes { +uint32_t get_id() +{ + return NavigationKeyCodes::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* navigation_key_codes */ + +namespace location_keys { +uint32_t get_id() +{ + return LocationKeys::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* location_keys */ + +namespace number_keys { +uint32_t get_id() +{ + return NumberKeys::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* number_keys */ + +} /* feature */ + +namespace command { +command_t *create_send_key(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SendKey::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_send_key); +} + +command_t *create_send_key_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SendKeyResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, keypad_input::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, keypad_input::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = KeypadInputDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterKeypadInputPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_send_key(cluster); + command::create_send_key_response(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* keypad_input */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/keypad_input/keypad_input.h b/components/esp_matter/data_model/generated/clusters/keypad_input/keypad_input.h new file mode 100644 index 000000000..ce8e779f7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/keypad_input/keypad_input.h @@ -0,0 +1,56 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace keypad_input { + +namespace feature { +namespace navigation_key_codes { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* navigation_key_codes */ + +namespace location_keys { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* location_keys */ + +namespace number_keys { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* number_keys */ + +} /* feature */ + +namespace command { +command_t *create_send_key(cluster_t *cluster); +command_t *create_send_key_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* keypad_input */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/keypad_input/keypad_input_ids.h b/components/esp_matter/data_model/generated/clusters/keypad_input/keypad_input_ids.h new file mode 100644 index 000000000..d427f8b41 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/keypad_input/keypad_input_ids.h @@ -0,0 +1,49 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace keypad_input { + +inline constexpr uint32_t Id = 0x0509; + +namespace feature { +namespace NavigationKeyCodes { +inline constexpr uint32_t Id = 0x1; +} /* NavigationKeyCodes */ +namespace LocationKeys { +inline constexpr uint32_t Id = 0x2; +} /* LocationKeys */ +namespace NumberKeys { +inline constexpr uint32_t Id = 0x4; +} /* NumberKeys */ +} /* feature */ + +namespace command { +namespace SendKey { +inline constexpr uint32_t Id = 0x00; +} /* SendKey */ +namespace SendKeyResponse { +inline constexpr uint32_t Id = 0x01; +} /* SendKeyResponse */ +} /* command */ + +} /* keypad_input */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/label/label.cpp b/components/esp_matter/data_model/generated/clusters/label/label.cpp new file mode 100644 index 000000000..1a70c548e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/label/label.cpp @@ -0,0 +1,54 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "label_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace label { + +namespace attribute { +attribute_t *create_label_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, LabelList::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +} /* label */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/label/label.h b/components/esp_matter/data_model/generated/clusters/label/label.h new file mode 100644 index 000000000..51be138d8 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/label/label.h @@ -0,0 +1,30 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace label { + +namespace attribute { +attribute_t *create_label_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +} /* label */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/label/label_ids.h b/components/esp_matter/data_model/generated/clusters/label/label_ids.h new file mode 100644 index 000000000..52f08b105 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/label/label_ids.h @@ -0,0 +1,34 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace label { + +inline constexpr uint32_t Id = 0xffff; + +namespace attribute { +namespace LabelList { +inline constexpr uint32_t Id = 0x0000; +} /* LabelList */ +} /* attribute */ + +} /* label */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/laundry_dryer_controls/laundry_dryer_controls.cpp b/components/esp_matter/data_model/generated/clusters/laundry_dryer_controls/laundry_dryer_controls.cpp new file mode 100644 index 000000000..e72499f6b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/laundry_dryer_controls/laundry_dryer_controls.cpp @@ -0,0 +1,105 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "laundry_dryer_controls_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace laundry_dryer_controls { + +namespace attribute { +attribute_t *create_supported_dryness_levels(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedDrynessLevels::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_selected_dryness_level(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SelectedDrynessLevel::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_enum8(0), esp_matter_nullable_enum8(3)); + return attribute; +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t function_list[] = { + (function_generic_t)MatterLaundryDryerControlsClusterServerPreAttributeChangedCallback, +}; + +const int function_flags = CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, laundry_dryer_controls::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, laundry_dryer_controls::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = LaundryDryerControlsDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterLaundryDryerControlsPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_selected_dryness_level(cluster, config->selected_dryness_level); + attribute::create_supported_dryness_levels(cluster, NULL, 0, 0); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* laundry_dryer_controls */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/laundry_dryer_controls/laundry_dryer_controls.h b/components/esp_matter/data_model/generated/clusters/laundry_dryer_controls/laundry_dryer_controls.h new file mode 100644 index 000000000..749761da7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/laundry_dryer_controls/laundry_dryer_controls.h @@ -0,0 +1,39 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace laundry_dryer_controls { + +namespace attribute { +attribute_t *create_supported_dryness_levels(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_selected_dryness_level(cluster_t *cluster, nullable value); +} /* attribute */ + +typedef struct config { + nullable selected_dryness_level; + void *delegate; + config() : selected_dryness_level(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* laundry_dryer_controls */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/laundry_dryer_controls/laundry_dryer_controls_ids.h b/components/esp_matter/data_model/generated/clusters/laundry_dryer_controls/laundry_dryer_controls_ids.h new file mode 100644 index 000000000..d0a3cfef9 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/laundry_dryer_controls/laundry_dryer_controls_ids.h @@ -0,0 +1,37 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace laundry_dryer_controls { + +inline constexpr uint32_t Id = 0x004A; + +namespace attribute { +namespace SupportedDrynessLevels { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedDrynessLevels */ +namespace SelectedDrynessLevel { +inline constexpr uint32_t Id = 0x0001; +} /* SelectedDrynessLevel */ +} /* attribute */ + +} /* laundry_dryer_controls */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/laundry_washer_controls/laundry_washer_controls.cpp b/components/esp_matter/data_model/generated/clusters/laundry_washer_controls/laundry_washer_controls.cpp new file mode 100644 index 000000000..888c55a6d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/laundry_washer_controls/laundry_washer_controls.cpp @@ -0,0 +1,171 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "laundry_washer_controls_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace laundry_washer_controls { + +namespace feature { +namespace spin { +uint32_t get_id() +{ + return Spin::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_spin_speed_current(cluster, config->spin_speed_current); + attribute::create_spin_speeds(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* spin */ + +namespace rinse { +uint32_t get_id() +{ + return Rinse::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_number_of_rinses(cluster, config->number_of_rinses); + attribute::create_supported_rinses(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* rinse */ + +} /* feature */ + +namespace attribute { +attribute_t *create_spin_speeds(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(spin), NULL); + return esp_matter::attribute::create(cluster, SpinSpeeds::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_spin_speed_current(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(spin), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, SpinSpeedCurrent::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(15)); + return attribute; +} + +attribute_t *create_number_of_rinses(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(rinse), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfRinses::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(3)); + return attribute; +} + +attribute_t *create_supported_rinses(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(rinse), NULL); + return esp_matter::attribute::create(cluster, SupportedRinses::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t function_list[] = { + (function_generic_t)MatterLaundryWasherControlsClusterServerPreAttributeChangedCallback, +}; + +const int function_flags = CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, laundry_washer_controls::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, laundry_washer_controls::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = LaundryWasherControlsDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterLaundryWasherControlsPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("Spin,Rinse", + feature::spin::get_id(), feature::rinse::get_id()); + if (feature_map & feature::spin::get_id()) { + VerifyOrReturnValue(feature::spin::add(cluster, &(config->features.spin)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::rinse::get_id()) { + VerifyOrReturnValue(feature::rinse::add(cluster, &(config->features.rinse)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* laundry_washer_controls */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/laundry_washer_controls/laundry_washer_controls.h b/components/esp_matter/data_model/generated/clusters/laundry_washer_controls/laundry_washer_controls.h new file mode 100644 index 000000000..a466112e7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/laundry_washer_controls/laundry_washer_controls.h @@ -0,0 +1,66 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace laundry_washer_controls { + +namespace feature { +namespace spin { +typedef struct config { + nullable spin_speed_current; + config() : spin_speed_current(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* spin */ + +namespace rinse { +typedef struct config { + uint8_t number_of_rinses; + config() : number_of_rinses(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* rinse */ + +} /* feature */ + +namespace attribute { +attribute_t *create_spin_speeds(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_spin_speed_current(cluster_t *cluster, nullable value); +attribute_t *create_number_of_rinses(cluster_t *cluster, uint8_t value); +attribute_t *create_supported_rinses(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +typedef struct config { + void *delegate; + struct { + feature::spin::config_t spin; + feature::rinse::config_t rinse; + } features; + uint32_t feature_flags; + config() : delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* laundry_washer_controls */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/laundry_washer_controls/laundry_washer_controls_ids.h b/components/esp_matter/data_model/generated/clusters/laundry_washer_controls/laundry_washer_controls_ids.h new file mode 100644 index 000000000..79a99da2e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/laundry_washer_controls/laundry_washer_controls_ids.h @@ -0,0 +1,52 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace laundry_washer_controls { + +inline constexpr uint32_t Id = 0x0053; + +namespace feature { +namespace Spin { +inline constexpr uint32_t Id = 0x1; +} /* Spin */ +namespace Rinse { +inline constexpr uint32_t Id = 0x2; +} /* Rinse */ +} /* feature */ + +namespace attribute { +namespace SpinSpeeds { +inline constexpr uint32_t Id = 0x0000; +} /* SpinSpeeds */ +namespace SpinSpeedCurrent { +inline constexpr uint32_t Id = 0x0001; +} /* SpinSpeedCurrent */ +namespace NumberOfRinses { +inline constexpr uint32_t Id = 0x0002; +} /* NumberOfRinses */ +namespace SupportedRinses { +inline constexpr uint32_t Id = 0x0003; +} /* SupportedRinses */ +} /* attribute */ + +} /* laundry_washer_controls */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/laundry_washer_mode/laundry_washer_mode.cpp b/components/esp_matter/data_model/generated/clusters/laundry_washer_mode/laundry_washer_mode.cpp new file mode 100644 index 000000000..872f2f77c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/laundry_washer_mode/laundry_washer_mode.cpp @@ -0,0 +1,109 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "laundry_washer_mode_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace laundry_washer_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedModes::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_change_to_mode(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToMode::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_change_to_mode_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToModeResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, laundry_washer_mode::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, laundry_washer_mode::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = LaundryWasherModeDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterLaundryWasherModePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_current_mode(cluster, config->current_mode); + attribute::create_supported_modes(cluster, NULL, 0, 0); + command::create_change_to_mode(cluster); + command::create_change_to_mode_response(cluster); + } + + return cluster; +} + +} /* laundry_washer_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/laundry_washer_mode/laundry_washer_mode.h b/components/esp_matter/data_model/generated/clusters/laundry_washer_mode/laundry_washer_mode.h new file mode 100644 index 000000000..726e31019 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/laundry_washer_mode/laundry_washer_mode.h @@ -0,0 +1,44 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace laundry_washer_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_change_to_mode(cluster_t *cluster); +command_t *create_change_to_mode_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t current_mode; + void *delegate; + config() : current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* laundry_washer_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/laundry_washer_mode/laundry_washer_mode_ids.h b/components/esp_matter/data_model/generated/clusters/laundry_washer_mode/laundry_washer_mode_ids.h new file mode 100644 index 000000000..b9bab6cc0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/laundry_washer_mode/laundry_washer_mode_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace laundry_washer_mode { + +inline constexpr uint32_t Id = 0x0051; + +namespace attribute { +namespace SupportedModes { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedModes */ +namespace CurrentMode { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentMode */ +} /* attribute */ + +namespace command { +namespace ChangeToMode { +inline constexpr uint32_t Id = 0x00; +} /* ChangeToMode */ +namespace ChangeToModeResponse { +inline constexpr uint32_t Id = 0x01; +} /* ChangeToModeResponse */ +} /* command */ + +} /* laundry_washer_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/level_control/level_control.cpp b/components/esp_matter/data_model/generated/clusters/level_control/level_control.cpp new file mode 100644 index 000000000..380e8687e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/level_control/level_control.cpp @@ -0,0 +1,344 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "level_control_cluster"; +constexpr uint16_t cluster_revision = 6; + +static esp_err_t esp_matter_command_callback_move_to_level(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::LevelControl::Commands::MoveToLevel::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfLevelControlClusterMoveToLevelCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_move(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::LevelControl::Commands::Move::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfLevelControlClusterMoveCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_step(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::LevelControl::Commands::Step::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfLevelControlClusterStepCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_stop(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::LevelControl::Commands::Stop::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfLevelControlClusterStopCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_move_to_level_with_on_off(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::LevelControl::Commands::MoveToLevelWithOnOff::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfLevelControlClusterMoveToLevelWithOnOffCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_move_with_on_off(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::LevelControl::Commands::MoveWithOnOff::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfLevelControlClusterMoveWithOnOffCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_step_with_on_off(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::LevelControl::Commands::StepWithOnOff::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfLevelControlClusterStepWithOnOffCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_stop_with_on_off(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::LevelControl::Commands::StopWithOnOff::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfLevelControlClusterStopWithOnOffCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace level_control { + +namespace feature { +namespace on_off { +uint32_t get_id() +{ + return OnOff::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* on_off */ + +namespace lighting { +uint32_t get_id() +{ + return Lighting::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_remaining_time(cluster, config->remaining_time); + attribute::create_start_up_current_level(cluster, config->start_up_current_level); + + return ESP_OK; +} +} /* lighting */ + +} /* feature */ + +namespace attribute { +attribute_t *create_current_level(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentLevel::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(lighting), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, RemainingTime::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_min_level(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MinLevel::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_max_level(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxLevel::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_options(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Options::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(3)); + return attribute; +} + +attribute_t *create_on_off_transition_time(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, OnOffTransitionTime::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_on_level(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, OnLevel::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_on_transition_time(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, OnTransitionTime::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_off_transition_time(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, OffTransitionTime::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_default_move_rate(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, DefaultMoveRate::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(1), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_start_up_current_level(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(lighting), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, StartUpCurrentLevel::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_move_to_level(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, MoveToLevel::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_to_level); +} + +command_t *create_move(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Move::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move); +} + +command_t *create_step(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Step::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_step); +} + +command_t *create_stop(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Stop::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_stop); +} + +command_t *create_move_to_level_with_on_off(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, MoveToLevelWithOnOff::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_to_level_with_on_off); +} + +command_t *create_move_with_on_off(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, MoveWithOnOff::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_with_on_off); +} + +command_t *create_step_with_on_off(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, StepWithOnOff::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_step_with_on_off); +} + +command_t *create_stop_with_on_off(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, StopWithOnOff::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_stop_with_on_off); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t function_list[] = { + (function_generic_t)emberAfLevelControlClusterServerInitCallback, + (function_generic_t)MatterLevelControlClusterServerShutdownCallback, +}; + +const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_SHUTDOWN_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, level_control::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, level_control::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterLevelControlPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_current_level(cluster, config->current_level); + attribute::create_options(cluster, config->options); + attribute::create_on_level(cluster, config->on_level); + command::create_move_to_level(cluster); + command::create_move(cluster); + command::create_step(cluster); + command::create_stop(cluster); + command::create_move_to_level_with_on_off(cluster); + command::create_move_with_on_off(cluster); + command::create_step_with_on_off(cluster); + command::create_stop_with_on_off(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* level_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/level_control/level_control.h b/components/esp_matter/data_model/generated/clusters/level_control/level_control.h new file mode 100644 index 000000000..f243354cc --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/level_control/level_control.h @@ -0,0 +1,78 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace level_control { + +namespace feature { +namespace on_off { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* on_off */ + +namespace lighting { +typedef struct config { + uint16_t remaining_time; + nullable start_up_current_level; + config() : remaining_time(0), start_up_current_level(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* lighting */ + +} /* feature */ + +namespace attribute { +attribute_t *create_current_level(cluster_t *cluster, nullable value); +attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value); +attribute_t *create_min_level(cluster_t *cluster, uint8_t value); +attribute_t *create_max_level(cluster_t *cluster, uint8_t value); +attribute_t *create_options(cluster_t *cluster, uint8_t value); +attribute_t *create_on_off_transition_time(cluster_t *cluster, uint16_t value); +attribute_t *create_on_level(cluster_t *cluster, nullable value); +attribute_t *create_on_transition_time(cluster_t *cluster, nullable value); +attribute_t *create_off_transition_time(cluster_t *cluster, nullable value); +attribute_t *create_default_move_rate(cluster_t *cluster, nullable value); +attribute_t *create_start_up_current_level(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_move_to_level(cluster_t *cluster); +command_t *create_move(cluster_t *cluster); +command_t *create_step(cluster_t *cluster); +command_t *create_stop(cluster_t *cluster); +command_t *create_move_to_level_with_on_off(cluster_t *cluster); +command_t *create_move_with_on_off(cluster_t *cluster); +command_t *create_step_with_on_off(cluster_t *cluster); +command_t *create_stop_with_on_off(cluster_t *cluster); +} /* command */ + +typedef struct config { + nullable current_level; + uint8_t options; + nullable on_level; + config() : current_level(0), options(0), on_level(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* level_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/level_control/level_control_ids.h b/components/esp_matter/data_model/generated/clusters/level_control/level_control_ids.h new file mode 100644 index 000000000..607cf49d9 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/level_control/level_control_ids.h @@ -0,0 +1,100 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace level_control { + +inline constexpr uint32_t Id = 0x0008; + +namespace feature { +namespace OnOff { +inline constexpr uint32_t Id = 0x1; +} /* OnOff */ +namespace Lighting { +inline constexpr uint32_t Id = 0x2; +} /* Lighting */ +} /* feature */ + +namespace attribute { +namespace CurrentLevel { +inline constexpr uint32_t Id = 0x0000; +} /* CurrentLevel */ +namespace RemainingTime { +inline constexpr uint32_t Id = 0x0001; +} /* RemainingTime */ +namespace MinLevel { +inline constexpr uint32_t Id = 0x0002; +} /* MinLevel */ +namespace MaxLevel { +inline constexpr uint32_t Id = 0x0003; +} /* MaxLevel */ +namespace Options { +inline constexpr uint32_t Id = 0x000F; +} /* Options */ +namespace OnOffTransitionTime { +inline constexpr uint32_t Id = 0x0010; +} /* OnOffTransitionTime */ +namespace OnLevel { +inline constexpr uint32_t Id = 0x0011; +} /* OnLevel */ +namespace OnTransitionTime { +inline constexpr uint32_t Id = 0x0012; +} /* OnTransitionTime */ +namespace OffTransitionTime { +inline constexpr uint32_t Id = 0x0013; +} /* OffTransitionTime */ +namespace DefaultMoveRate { +inline constexpr uint32_t Id = 0x0014; +} /* DefaultMoveRate */ +namespace StartUpCurrentLevel { +inline constexpr uint32_t Id = 0x4000; +} /* StartUpCurrentLevel */ +} /* attribute */ + +namespace command { +namespace MoveToLevel { +inline constexpr uint32_t Id = 0x00; +} /* MoveToLevel */ +namespace Move { +inline constexpr uint32_t Id = 0x01; +} /* Move */ +namespace Step { +inline constexpr uint32_t Id = 0x02; +} /* Step */ +namespace Stop { +inline constexpr uint32_t Id = 0x03; +} /* Stop */ +namespace MoveToLevelWithOnOff { +inline constexpr uint32_t Id = 0x04; +} /* MoveToLevelWithOnOff */ +namespace MoveWithOnOff { +inline constexpr uint32_t Id = 0x05; +} /* MoveWithOnOff */ +namespace StepWithOnOff { +inline constexpr uint32_t Id = 0x06; +} /* StepWithOnOff */ +namespace StopWithOnOff { +inline constexpr uint32_t Id = 0x07; +} /* StopWithOnOff */ +} /* command */ + +} /* level_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/localization_configuration/localization_configuration.cpp b/components/esp_matter/data_model/generated/clusters/localization_configuration/localization_configuration.cpp new file mode 100644 index 000000000..e113162a4 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/localization_configuration/localization_configuration.cpp @@ -0,0 +1,91 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "localization_configuration_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace localization_configuration { + +namespace attribute { +attribute_t *create_active_locale(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_active_locale_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, ActiveLocale::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_char_str(value, length), k_max_active_locale_length + 1); +} + +attribute_t *create_supported_locales(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedLocales::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, localization_configuration::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, localization_configuration::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterLocalizationConfigurationPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_active_locale(cluster, config->active_locale, sizeof(config->active_locale)); + attribute::create_supported_locales(cluster, NULL, 0, 0); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterLocalizationConfigurationClusterServerInitCallback, + ESPMatterLocalizationConfigurationClusterServerShutdownCallback); + } + + return cluster; +} + +} /* localization_configuration */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/localization_configuration/localization_configuration.h b/components/esp_matter/data_model/generated/clusters/localization_configuration/localization_configuration.h new file mode 100644 index 000000000..58aab58a7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/localization_configuration/localization_configuration.h @@ -0,0 +1,39 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace localization_configuration { + +const uint8_t k_max_active_locale_length = 35u; +namespace attribute { +attribute_t *create_active_locale(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_supported_locales(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +typedef struct config { + char active_locale[k_max_active_locale_length + 1]; + config() : active_locale{0} {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* localization_configuration */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/localization_configuration/localization_configuration_ids.h b/components/esp_matter/data_model/generated/clusters/localization_configuration/localization_configuration_ids.h new file mode 100644 index 000000000..df33d942a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/localization_configuration/localization_configuration_ids.h @@ -0,0 +1,37 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace localization_configuration { + +inline constexpr uint32_t Id = 0x002B; + +namespace attribute { +namespace ActiveLocale { +inline constexpr uint32_t Id = 0x0000; +} /* ActiveLocale */ +namespace SupportedLocales { +inline constexpr uint32_t Id = 0x0001; +} /* SupportedLocales */ +} /* attribute */ + +} /* localization_configuration */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/low_power/low_power.cpp b/components/esp_matter/data_model/generated/clusters/low_power/low_power.cpp new file mode 100644 index 000000000..8cb00cae0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/low_power/low_power.cpp @@ -0,0 +1,106 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "low_power_cluster"; +constexpr uint16_t cluster_revision = 1; + +static esp_err_t esp_matter_command_callback_sleep(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::LowPower::Commands::Sleep::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfLowPowerClusterSleepCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace low_power { + +namespace command { +command_t *create_sleep(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Sleep::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_sleep); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, low_power::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, low_power::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = LowPowerDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterLowPowerPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_sleep(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* low_power */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/low_power/low_power.h b/components/esp_matter/data_model/generated/clusters/low_power/low_power.h new file mode 100644 index 000000000..759e0d5f5 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/low_power/low_power.h @@ -0,0 +1,37 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace low_power { + +namespace command { +command_t *create_sleep(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* low_power */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/low_power/low_power_ids.h b/components/esp_matter/data_model/generated/clusters/low_power/low_power_ids.h new file mode 100644 index 000000000..f677302ad --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/low_power/low_power_ids.h @@ -0,0 +1,34 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace low_power { + +inline constexpr uint32_t Id = 0x0508; + +namespace command { +namespace Sleep { +inline constexpr uint32_t Id = 0x00; +} /* Sleep */ +} /* command */ + +} /* low_power */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/media_input/media_input.cpp b/components/esp_matter/data_model/generated/clusters/media_input/media_input.cpp new file mode 100644 index 000000000..b56061be0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/media_input/media_input.cpp @@ -0,0 +1,191 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "media_input_cluster"; +constexpr uint16_t cluster_revision = 1; + +static esp_err_t esp_matter_command_callback_select_input(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaInput::Commands::SelectInput::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaInputClusterSelectInputCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_show_input_status(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaInput::Commands::ShowInputStatus::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaInputClusterShowInputStatusCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_hide_input_status(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaInput::Commands::HideInputStatus::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaInputClusterHideInputStatusCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_rename_input(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaInput::Commands::RenameInput::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaInputClusterRenameInputCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace media_input { + +namespace feature { +namespace name_updates { +uint32_t get_id() +{ + return NameUpdates::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_rename_input(cluster); + + return ESP_OK; +} +} /* name_updates */ + +} /* feature */ + +namespace attribute { +attribute_t *create_input_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, InputList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_input(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, CurrentInput::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +} /* attribute */ +namespace command { +command_t *create_select_input(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SelectInput::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_select_input); +} + +command_t *create_show_input_status(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ShowInputStatus::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_show_input_status); +} + +command_t *create_hide_input_status(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, HideInputStatus::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_hide_input_status); +} + +command_t *create_rename_input(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(name_updates), NULL); + return esp_matter::command::create(cluster, RenameInput::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_rename_input); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, media_input::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, media_input::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = MediaInputDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterMediaInputPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_input_list(cluster, NULL, 0, 0); + attribute::create_current_input(cluster, 0); + command::create_select_input(cluster); + command::create_show_input_status(cluster); + command::create_hide_input_status(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* media_input */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/media_input/media_input.h b/components/esp_matter/data_model/generated/clusters/media_input/media_input.h new file mode 100644 index 000000000..83811ca99 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/media_input/media_input.h @@ -0,0 +1,53 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace media_input { + +namespace feature { +namespace name_updates { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* name_updates */ + +} /* feature */ + +namespace attribute { +attribute_t *create_input_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_input(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_select_input(cluster_t *cluster); +command_t *create_show_input_status(cluster_t *cluster); +command_t *create_hide_input_status(cluster_t *cluster); +command_t *create_rename_input(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* media_input */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/media_input/media_input_ids.h b/components/esp_matter/data_model/generated/clusters/media_input/media_input_ids.h new file mode 100644 index 000000000..c5f08252d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/media_input/media_input_ids.h @@ -0,0 +1,58 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace media_input { + +inline constexpr uint32_t Id = 0x0507; + +namespace feature { +namespace NameUpdates { +inline constexpr uint32_t Id = 0x1; +} /* NameUpdates */ +} /* feature */ + +namespace attribute { +namespace InputList { +inline constexpr uint32_t Id = 0x0000; +} /* InputList */ +namespace CurrentInput { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentInput */ +} /* attribute */ + +namespace command { +namespace SelectInput { +inline constexpr uint32_t Id = 0x00; +} /* SelectInput */ +namespace ShowInputStatus { +inline constexpr uint32_t Id = 0x01; +} /* ShowInputStatus */ +namespace HideInputStatus { +inline constexpr uint32_t Id = 0x02; +} /* HideInputStatus */ +namespace RenameInput { +inline constexpr uint32_t Id = 0x03; +} /* RenameInput */ +} /* command */ + +} /* media_input */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/media_playback/media_playback.cpp b/components/esp_matter/data_model/generated/clusters/media_playback/media_playback.cpp new file mode 100644 index 000000000..4bffaad41 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/media_playback/media_playback.cpp @@ -0,0 +1,514 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "media_playback_cluster"; +constexpr uint16_t cluster_revision = 2; + +static esp_err_t esp_matter_command_callback_play(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::Play::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterPlayCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_pause(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::Pause::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterPauseCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_stop(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::Stop::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterStopCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_start_over(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::StartOver::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterStartOverCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_previous(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::Previous::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterPreviousCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_next(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::Next::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterNextCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_rewind(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::Rewind::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterRewindCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_fast_forward(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::FastForward::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterFastForwardCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_skip_forward(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::SkipForward::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterSkipForwardCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_skip_backward(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::SkipBackward::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterSkipBackwardCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_seek(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::Seek::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterSeekCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_activate_audio_track(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::ActivateAudioTrack::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterActivateAudioTrackCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_activate_text_track(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::ActivateTextTrack::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterActivateTextTrackCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_deactivate_text_track(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::MediaPlayback::Commands::DeactivateTextTrack::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfMediaPlaybackClusterDeactivateTextTrackCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace media_playback { + +namespace feature { +namespace advanced_seek { +uint32_t get_id() +{ + return AdvancedSeek::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_start_time(cluster, 0); + attribute::create_duration(cluster, 0); + attribute::create_sampled_position(cluster, NULL, 0, 0); + attribute::create_playback_speed(cluster, 0); + attribute::create_seek_range_end(cluster, 0); + attribute::create_seek_range_start(cluster, 0); + command::create_seek(cluster); + + return ESP_OK; +} +} /* advanced_seek */ + +namespace variable_speed { +uint32_t get_id() +{ + return VariableSpeed::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_rewind(cluster); + command::create_fast_forward(cluster); + + return ESP_OK; +} +} /* variable_speed */ + +namespace text_tracks { +uint32_t get_id() +{ + return TextTracks::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_active_text_track(cluster, NULL, 0, 0); + attribute::create_available_text_tracks(cluster, NULL, 0, 0); + command::create_activate_text_track(cluster); + command::create_deactivate_text_track(cluster); + + return ESP_OK; +} +} /* text_tracks */ + +namespace audio_tracks { +uint32_t get_id() +{ + return AudioTracks::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_active_audio_track(cluster, NULL, 0, 0); + attribute::create_available_audio_tracks(cluster, NULL, 0, 0); + command::create_activate_audio_track(cluster); + + return ESP_OK; +} +} /* audio_tracks */ + +namespace audio_advance { +uint32_t get_id() +{ + return AudioAdvance::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* audio_advance */ + +} /* feature */ + +namespace attribute { +attribute_t *create_current_state(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, CurrentState::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_start_time(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(advanced_seek), NULL); + return esp_matter::attribute::create(cluster, StartTime::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value)); +} + +attribute_t *create_duration(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(advanced_seek), NULL); + return esp_matter::attribute::create(cluster, Duration::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value)); +} + +attribute_t *create_sampled_position(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(advanced_seek), NULL); + return esp_matter::attribute::create(cluster, SampledPosition::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_playback_speed(cluster_t *cluster, float value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(advanced_seek), NULL); + return esp_matter::attribute::create(cluster, PlaybackSpeed::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_float(value)); +} + +attribute_t *create_seek_range_end(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(advanced_seek), NULL); + return esp_matter::attribute::create(cluster, SeekRangeEnd::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value)); +} + +attribute_t *create_seek_range_start(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(advanced_seek), NULL); + return esp_matter::attribute::create(cluster, SeekRangeStart::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value)); +} + +attribute_t *create_active_audio_track(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(audio_tracks), NULL); + return esp_matter::attribute::create(cluster, ActiveAudioTrack::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_available_audio_tracks(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(audio_tracks), NULL); + return esp_matter::attribute::create(cluster, AvailableAudioTracks::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_active_text_track(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(text_tracks), NULL); + return esp_matter::attribute::create(cluster, ActiveTextTrack::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_available_text_tracks(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(text_tracks), NULL); + return esp_matter::attribute::create(cluster, AvailableTextTracks::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_play(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Play::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_play); +} + +command_t *create_pause(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Pause::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_pause); +} + +command_t *create_stop(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Stop::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_stop); +} + +command_t *create_start_over(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, StartOver::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_start_over); +} + +command_t *create_previous(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Previous::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_previous); +} + +command_t *create_next(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Next::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_next); +} + +command_t *create_rewind(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(variable_speed), NULL); + return esp_matter::command::create(cluster, Rewind::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_rewind); +} + +command_t *create_fast_forward(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(variable_speed), NULL); + return esp_matter::command::create(cluster, FastForward::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_fast_forward); +} + +command_t *create_skip_forward(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SkipForward::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_skip_forward); +} + +command_t *create_skip_backward(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SkipBackward::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_skip_backward); +} + +command_t *create_playback_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, PlaybackResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_seek(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(advanced_seek), NULL); + return esp_matter::command::create(cluster, Seek::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_seek); +} + +command_t *create_activate_audio_track(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(audio_tracks), NULL); + return esp_matter::command::create(cluster, ActivateAudioTrack::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_activate_audio_track); +} + +command_t *create_activate_text_track(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(text_tracks), NULL); + return esp_matter::command::create(cluster, ActivateTextTrack::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_activate_text_track); +} + +command_t *create_deactivate_text_track(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(text_tracks), NULL); + return esp_matter::command::create(cluster, DeactivateTextTrack::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_deactivate_text_track); +} + +} /* command */ + +namespace event { +event_t *create_state_changed(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, StateChanged::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, media_playback::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, media_playback::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = MediaPlaybackDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterMediaPlaybackPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_current_state(cluster, 0); + command::create_play(cluster); + command::create_pause(cluster); + command::create_stop(cluster); + command::create_playback_response(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* media_playback */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/media_playback/media_playback.h b/components/esp_matter/data_model/generated/clusters/media_playback/media_playback.h new file mode 100644 index 000000000..917e86ed0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/media_playback/media_playback.h @@ -0,0 +1,97 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace media_playback { + +namespace feature { +namespace advanced_seek { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* advanced_seek */ + +namespace variable_speed { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* variable_speed */ + +namespace text_tracks { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* text_tracks */ + +namespace audio_tracks { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* audio_tracks */ + +namespace audio_advance { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* audio_advance */ + +} /* feature */ + +namespace attribute { +attribute_t *create_current_state(cluster_t *cluster, uint8_t value); +attribute_t *create_start_time(cluster_t *cluster, nullable value); +attribute_t *create_duration(cluster_t *cluster, nullable value); +attribute_t *create_sampled_position(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_playback_speed(cluster_t *cluster, float value); +attribute_t *create_seek_range_end(cluster_t *cluster, nullable value); +attribute_t *create_seek_range_start(cluster_t *cluster, nullable value); +attribute_t *create_active_audio_track(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_available_audio_tracks(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_active_text_track(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_available_text_tracks(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_play(cluster_t *cluster); +command_t *create_pause(cluster_t *cluster); +command_t *create_stop(cluster_t *cluster); +command_t *create_start_over(cluster_t *cluster); +command_t *create_previous(cluster_t *cluster); +command_t *create_next(cluster_t *cluster); +command_t *create_rewind(cluster_t *cluster); +command_t *create_fast_forward(cluster_t *cluster); +command_t *create_skip_forward(cluster_t *cluster); +command_t *create_skip_backward(cluster_t *cluster); +command_t *create_playback_response(cluster_t *cluster); +command_t *create_seek(cluster_t *cluster); +command_t *create_activate_audio_track(cluster_t *cluster); +command_t *create_activate_text_track(cluster_t *cluster); +command_t *create_deactivate_text_track(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_state_changed(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* media_playback */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/media_playback/media_playback_ids.h b/components/esp_matter/data_model/generated/clusters/media_playback/media_playback_ids.h new file mode 100644 index 000000000..90b3457fe --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/media_playback/media_playback_ids.h @@ -0,0 +1,136 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace media_playback { + +inline constexpr uint32_t Id = 0x0506; + +namespace feature { +namespace AdvancedSeek { +inline constexpr uint32_t Id = 0x1; +} /* AdvancedSeek */ +namespace VariableSpeed { +inline constexpr uint32_t Id = 0x2; +} /* VariableSpeed */ +namespace TextTracks { +inline constexpr uint32_t Id = 0x4; +} /* TextTracks */ +namespace AudioTracks { +inline constexpr uint32_t Id = 0x8; +} /* AudioTracks */ +namespace AudioAdvance { +inline constexpr uint32_t Id = 0x10; +} /* AudioAdvance */ +} /* feature */ + +namespace attribute { +namespace CurrentState { +inline constexpr uint32_t Id = 0x0000; +} /* CurrentState */ +namespace StartTime { +inline constexpr uint32_t Id = 0x0001; +} /* StartTime */ +namespace Duration { +inline constexpr uint32_t Id = 0x0002; +} /* Duration */ +namespace SampledPosition { +inline constexpr uint32_t Id = 0x0003; +} /* SampledPosition */ +namespace PlaybackSpeed { +inline constexpr uint32_t Id = 0x0004; +} /* PlaybackSpeed */ +namespace SeekRangeEnd { +inline constexpr uint32_t Id = 0x0005; +} /* SeekRangeEnd */ +namespace SeekRangeStart { +inline constexpr uint32_t Id = 0x0006; +} /* SeekRangeStart */ +namespace ActiveAudioTrack { +inline constexpr uint32_t Id = 0x0007; +} /* ActiveAudioTrack */ +namespace AvailableAudioTracks { +inline constexpr uint32_t Id = 0x0008; +} /* AvailableAudioTracks */ +namespace ActiveTextTrack { +inline constexpr uint32_t Id = 0x0009; +} /* ActiveTextTrack */ +namespace AvailableTextTracks { +inline constexpr uint32_t Id = 0x000A; +} /* AvailableTextTracks */ +} /* attribute */ + +namespace command { +namespace Play { +inline constexpr uint32_t Id = 0x00; +} /* Play */ +namespace Pause { +inline constexpr uint32_t Id = 0x01; +} /* Pause */ +namespace Stop { +inline constexpr uint32_t Id = 0x02; +} /* Stop */ +namespace StartOver { +inline constexpr uint32_t Id = 0x03; +} /* StartOver */ +namespace Previous { +inline constexpr uint32_t Id = 0x04; +} /* Previous */ +namespace Next { +inline constexpr uint32_t Id = 0x05; +} /* Next */ +namespace Rewind { +inline constexpr uint32_t Id = 0x06; +} /* Rewind */ +namespace FastForward { +inline constexpr uint32_t Id = 0x07; +} /* FastForward */ +namespace SkipForward { +inline constexpr uint32_t Id = 0x08; +} /* SkipForward */ +namespace SkipBackward { +inline constexpr uint32_t Id = 0x09; +} /* SkipBackward */ +namespace PlaybackResponse { +inline constexpr uint32_t Id = 0x0A; +} /* PlaybackResponse */ +namespace Seek { +inline constexpr uint32_t Id = 0x0B; +} /* Seek */ +namespace ActivateAudioTrack { +inline constexpr uint32_t Id = 0x0C; +} /* ActivateAudioTrack */ +namespace ActivateTextTrack { +inline constexpr uint32_t Id = 0x0D; +} /* ActivateTextTrack */ +namespace DeactivateTextTrack { +inline constexpr uint32_t Id = 0x0E; +} /* DeactivateTextTrack */ +} /* command */ + +namespace event { +namespace StateChanged { +inline constexpr uint32_t Id = 0x00; +} /* StateChanged */ +} /* event */ + +} /* media_playback */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/messages/messages.cpp b/components/esp_matter/data_model/generated/clusters/messages/messages.cpp new file mode 100644 index 000000000..6869dcc8e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/messages/messages.cpp @@ -0,0 +1,228 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "messages_cluster"; +constexpr uint16_t cluster_revision = 3; + +static esp_err_t esp_matter_command_callback_present_messages_request(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Messages::Commands::PresentMessagesRequest::DecodableType command_data; + chip::app::CommandHandler *command_obj = (chip::app::CommandHandler *)opaque_ptr; + CHIP_ERROR error = command_data.Decode(tlv_data, command_obj->GetAccessingFabricIndex()); + if (error == CHIP_NO_ERROR) { + emberAfMessagesClusterPresentMessagesRequestCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_cancel_messages_request(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Messages::Commands::CancelMessagesRequest::DecodableType command_data; + chip::app::CommandHandler *command_obj = (chip::app::CommandHandler *)opaque_ptr; + CHIP_ERROR error = command_data.Decode(tlv_data, command_obj->GetAccessingFabricIndex()); + if (error == CHIP_NO_ERROR) { + emberAfMessagesClusterCancelMessagesRequestCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace messages { + +namespace feature { +namespace received_confirmation { +uint32_t get_id() +{ + return ReceivedConfirmation::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* received_confirmation */ + +namespace confirmation_response { +uint32_t get_id() +{ + return ConfirmationResponse::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(received_confirmation), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* confirmation_response */ + +namespace confirmation_reply { +uint32_t get_id() +{ + return ConfirmationReply::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(received_confirmation), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* confirmation_reply */ + +namespace protected_messages { +uint32_t get_id() +{ + return ProtectedMessages::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* protected_messages */ + +} /* feature */ + +namespace attribute { +attribute_t *create_messages(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Messages::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_active_message_i_ds(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ActiveMessageIDs::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_present_messages_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, PresentMessagesRequest::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_present_messages_request); +} + +command_t *create_cancel_messages_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CancelMessagesRequest::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_cancel_messages_request); +} + +} /* command */ + +namespace event { +event_t *create_message_queued(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, MessageQueued::Id); +} + +event_t *create_message_presented(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, MessagePresented::Id); +} + +event_t *create_message_complete(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, MessageComplete::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, messages::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, messages::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = MessagesDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterMessagesPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_messages(cluster, NULL, 0, 0); + attribute::create_active_message_i_ds(cluster, NULL, 0, 0); + command::create_present_messages_request(cluster); + command::create_cancel_messages_request(cluster); + /* Events */ + event::create_message_queued(cluster); + event::create_message_presented(cluster); + event::create_message_complete(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* messages */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/messages/messages.h b/components/esp_matter/data_model/generated/clusters/messages/messages.h new file mode 100644 index 000000000..b984f0602 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/messages/messages.h @@ -0,0 +1,72 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace messages { + +namespace feature { +namespace received_confirmation { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* received_confirmation */ + +namespace confirmation_response { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* confirmation_response */ + +namespace confirmation_reply { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* confirmation_reply */ + +namespace protected_messages { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* protected_messages */ + +} /* feature */ + +namespace attribute { +attribute_t *create_messages(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_active_message_i_ds(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_present_messages_request(cluster_t *cluster); +command_t *create_cancel_messages_request(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_message_queued(cluster_t *cluster); +event_t *create_message_presented(cluster_t *cluster); +event_t *create_message_complete(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* messages */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/messages/messages_ids.h b/components/esp_matter/data_model/generated/clusters/messages/messages_ids.h new file mode 100644 index 000000000..efa60e672 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/messages/messages_ids.h @@ -0,0 +1,73 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace messages { + +inline constexpr uint32_t Id = 0x0097; + +namespace feature { +namespace ReceivedConfirmation { +inline constexpr uint32_t Id = 0x1; +} /* ReceivedConfirmation */ +namespace ConfirmationResponse { +inline constexpr uint32_t Id = 0x2; +} /* ConfirmationResponse */ +namespace ConfirmationReply { +inline constexpr uint32_t Id = 0x4; +} /* ConfirmationReply */ +namespace ProtectedMessages { +inline constexpr uint32_t Id = 0x8; +} /* ProtectedMessages */ +} /* feature */ + +namespace attribute { +namespace Messages { +inline constexpr uint32_t Id = 0x0000; +} /* Messages */ +namespace ActiveMessageIDs { +inline constexpr uint32_t Id = 0x0001; +} /* ActiveMessageIDs */ +} /* attribute */ + +namespace command { +namespace PresentMessagesRequest { +inline constexpr uint32_t Id = 0x00; +} /* PresentMessagesRequest */ +namespace CancelMessagesRequest { +inline constexpr uint32_t Id = 0x01; +} /* CancelMessagesRequest */ +} /* command */ + +namespace event { +namespace MessageQueued { +inline constexpr uint32_t Id = 0x00; +} /* MessageQueued */ +namespace MessagePresented { +inline constexpr uint32_t Id = 0x01; +} /* MessagePresented */ +namespace MessageComplete { +inline constexpr uint32_t Id = 0x02; +} /* MessageComplete */ +} /* event */ + +} /* messages */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/meter_identification/meter_identification.cpp b/components/esp_matter/data_model/generated/clusters/meter_identification/meter_identification.cpp new file mode 100644 index 000000000..6f74f4225 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/meter_identification/meter_identification.cpp @@ -0,0 +1,132 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "meter_identification_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace meter_identification { + +namespace feature { +namespace power_threshold { +uint32_t get_id() +{ + return PowerThreshold::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_power_threshold(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* power_threshold */ + +} /* feature */ + +namespace attribute { +attribute_t *create_meter_type(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, MeterType::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); +} + +attribute_t *create_point_of_delivery(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, PointOfDelivery::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_char_str(value, length)); +} + +attribute_t *create_meter_serial_number(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, MeterSerialNumber::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_char_str(value, length)); +} + +attribute_t *create_protocol_version(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, ProtocolVersion::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_char_str(value, length)); +} + +attribute_t *create_power_threshold(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(power_threshold), NULL); + return esp_matter::attribute::create(cluster, PowerThreshold::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, meter_identification::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, meter_identification::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterMeterIdentificationPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_meter_type(cluster, 0); + attribute::create_point_of_delivery(cluster, NULL, 0); + attribute::create_meter_serial_number(cluster, NULL, 0); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* meter_identification */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/meter_identification/meter_identification.h b/components/esp_matter/data_model/generated/clusters/meter_identification/meter_identification.h new file mode 100644 index 000000000..09bdb3820 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/meter_identification/meter_identification.h @@ -0,0 +1,48 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace meter_identification { + +namespace feature { +namespace power_threshold { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_threshold */ + +} /* feature */ + +namespace attribute { +attribute_t *create_meter_type(cluster_t *cluster, nullable value); +attribute_t *create_point_of_delivery(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_meter_serial_number(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_protocol_version(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_power_threshold(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* meter_identification */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/meter_identification/meter_identification_ids.h b/components/esp_matter/data_model/generated/clusters/meter_identification/meter_identification_ids.h new file mode 100644 index 000000000..a82bf69c1 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/meter_identification/meter_identification_ids.h @@ -0,0 +1,52 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace meter_identification { + +inline constexpr uint32_t Id = 0x0B06; + +namespace feature { +namespace PowerThreshold { +inline constexpr uint32_t Id = 0x1; +} /* PowerThreshold */ +} /* feature */ + +namespace attribute { +namespace MeterType { +inline constexpr uint32_t Id = 0x0000; +} /* MeterType */ +namespace PointOfDelivery { +inline constexpr uint32_t Id = 0x0001; +} /* PointOfDelivery */ +namespace MeterSerialNumber { +inline constexpr uint32_t Id = 0x0002; +} /* MeterSerialNumber */ +namespace ProtocolVersion { +inline constexpr uint32_t Id = 0x0003; +} /* ProtocolVersion */ +namespace PowerThreshold { +inline constexpr uint32_t Id = 0x0004; +} /* PowerThreshold */ +} /* attribute */ + +} /* meter_identification */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/microwave_oven_control/microwave_oven_control.cpp b/components/esp_matter/data_model/generated/clusters/microwave_oven_control/microwave_oven_control.cpp new file mode 100644 index 000000000..b706b2ce1 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/microwave_oven_control/microwave_oven_control.cpp @@ -0,0 +1,196 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "microwave_oven_control_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace microwave_oven_control { + +namespace feature { +namespace power_as_number { +uint32_t get_id() +{ + return PowerAsNumber::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_power_setting(cluster, 0); + + return ESP_OK; +} +} /* power_as_number */ + +namespace power_number_limits { +uint32_t get_id() +{ + return PowerNumberLimits::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(power_as_number), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_min_power(cluster, 0); + attribute::create_max_power(cluster, 0); + attribute::create_power_step(cluster, 0); + + return ESP_OK; +} +} /* power_number_limits */ + +} /* feature */ + +namespace attribute { +attribute_t *create_cook_time(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, CookTime::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_max_cook_time(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, MaxCookTime::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_power_setting(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(power_as_number), NULL); + return esp_matter::attribute::create(cluster, PowerSetting::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_min_power(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(power_number_limits), NULL); + return esp_matter::attribute::create(cluster, MinPower::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_max_power(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(power_number_limits), NULL); + return esp_matter::attribute::create(cluster, MaxPower::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_power_step(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(power_number_limits), NULL); + return esp_matter::attribute::create(cluster, PowerStep::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_watt_rating(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, WattRating::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +} /* attribute */ +namespace command { +command_t *create_set_cooking_parameters(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SetCookingParameters::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_add_more_time(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AddMoreTime::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, microwave_oven_control::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, microwave_oven_control::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = MicrowaveOvenControlDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterMicrowaveOvenControlPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_cook_time(cluster, 0); + attribute::create_max_cook_time(cluster, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_EXACT_ONE("PowerAsNumber", + feature::power_as_number::get_id()); + if (feature_map & feature::power_as_number::get_id()) { + VerifyOrReturnValue(feature::power_as_number::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::power_number_limits::get_id()) { + VerifyOrReturnValue(feature::power_number_limits::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + command::create_set_cooking_parameters(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* microwave_oven_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/microwave_oven_control/microwave_oven_control.h b/components/esp_matter/data_model/generated/clusters/microwave_oven_control/microwave_oven_control.h new file mode 100644 index 000000000..5d5a7026c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/microwave_oven_control/microwave_oven_control.h @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace microwave_oven_control { + +namespace feature { +namespace power_as_number { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_as_number */ + +namespace power_number_limits { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_number_limits */ + +} /* feature */ + +namespace attribute { +attribute_t *create_cook_time(cluster_t *cluster, uint32_t value); +attribute_t *create_max_cook_time(cluster_t *cluster, uint32_t value); +attribute_t *create_power_setting(cluster_t *cluster, uint8_t value); +attribute_t *create_min_power(cluster_t *cluster, uint8_t value); +attribute_t *create_max_power(cluster_t *cluster, uint8_t value); +attribute_t *create_power_step(cluster_t *cluster, uint8_t value); +attribute_t *create_watt_rating(cluster_t *cluster, uint16_t value); +} /* attribute */ + +namespace command { +command_t *create_set_cooking_parameters(cluster_t *cluster); +command_t *create_add_more_time(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + uint32_t feature_flags; + config() : delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* microwave_oven_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/microwave_oven_control/microwave_oven_control_ids.h b/components/esp_matter/data_model/generated/clusters/microwave_oven_control/microwave_oven_control_ids.h new file mode 100644 index 000000000..46d490f77 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/microwave_oven_control/microwave_oven_control_ids.h @@ -0,0 +1,70 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace microwave_oven_control { + +inline constexpr uint32_t Id = 0x005F; + +namespace feature { +namespace PowerAsNumber { +inline constexpr uint32_t Id = 0x1; +} /* PowerAsNumber */ +namespace PowerNumberLimits { +inline constexpr uint32_t Id = 0x4; +} /* PowerNumberLimits */ +} /* feature */ + +namespace attribute { +namespace CookTime { +inline constexpr uint32_t Id = 0x0000; +} /* CookTime */ +namespace MaxCookTime { +inline constexpr uint32_t Id = 0x0001; +} /* MaxCookTime */ +namespace PowerSetting { +inline constexpr uint32_t Id = 0x0002; +} /* PowerSetting */ +namespace MinPower { +inline constexpr uint32_t Id = 0x0003; +} /* MinPower */ +namespace MaxPower { +inline constexpr uint32_t Id = 0x0004; +} /* MaxPower */ +namespace PowerStep { +inline constexpr uint32_t Id = 0x0005; +} /* PowerStep */ +namespace WattRating { +inline constexpr uint32_t Id = 0x0008; +} /* WattRating */ +} /* attribute */ + +namespace command { +namespace SetCookingParameters { +inline constexpr uint32_t Id = 0x00; +} /* SetCookingParameters */ +namespace AddMoreTime { +inline constexpr uint32_t Id = 0x01; +} /* AddMoreTime */ +} /* command */ + +} /* microwave_oven_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/microwave_oven_mode/microwave_oven_mode.cpp b/components/esp_matter/data_model/generated/clusters/microwave_oven_mode/microwave_oven_mode.cpp new file mode 100644 index 000000000..638931f1e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/microwave_oven_mode/microwave_oven_mode.cpp @@ -0,0 +1,93 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "microwave_oven_mode_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace microwave_oven_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedModes::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, microwave_oven_mode::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, microwave_oven_mode::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = MicrowaveOvenModeDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterMicrowaveOvenModePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + } + + return cluster; +} + +} /* microwave_oven_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/microwave_oven_mode/microwave_oven_mode.h b/components/esp_matter/data_model/generated/clusters/microwave_oven_mode/microwave_oven_mode.h new file mode 100644 index 000000000..3ab1123cf --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/microwave_oven_mode/microwave_oven_mode.h @@ -0,0 +1,38 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace microwave_oven_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* microwave_oven_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/microwave_oven_mode/microwave_oven_mode_ids.h b/components/esp_matter/data_model/generated/clusters/microwave_oven_mode/microwave_oven_mode_ids.h new file mode 100644 index 000000000..f55cbdebd --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/microwave_oven_mode/microwave_oven_mode_ids.h @@ -0,0 +1,37 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace microwave_oven_mode { + +inline constexpr uint32_t Id = 0x005E; + +namespace attribute { +namespace SupportedModes { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedModes */ +namespace CurrentMode { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentMode */ +} /* attribute */ + +} /* microwave_oven_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/mode_base/mode_base.cpp b/components/esp_matter/data_model/generated/clusters/mode_base/mode_base.cpp new file mode 100644 index 000000000..536ade9ea --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/mode_base/mode_base.cpp @@ -0,0 +1,105 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "mode_base_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace mode_base { + +namespace feature { +namespace on_off { +uint32_t get_id() +{ + return OnOff::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_on_mode(cluster, 0); + + return ESP_OK; +} +} /* on_off */ + +} /* feature */ + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedModes::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, CurrentMode::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); +} + +attribute_t *create_start_up_mode(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, StartUpMode::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint8(value)); +} + +attribute_t *create_on_mode(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(on_off), NULL); + return esp_matter::attribute::create(cluster, OnMode::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint8(value)); +} + +} /* attribute */ +namespace command { +command_t *create_change_to_mode(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToMode::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_change_to_mode_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToModeResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +} /* mode_base */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/mode_base/mode_base.h b/components/esp_matter/data_model/generated/clusters/mode_base/mode_base.h new file mode 100644 index 000000000..624e73a14 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/mode_base/mode_base.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace mode_base { + +namespace feature { +namespace on_off { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* on_off */ + +} /* feature */ + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_start_up_mode(cluster_t *cluster, nullable value); +attribute_t *create_on_mode(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_change_to_mode(cluster_t *cluster); +command_t *create_change_to_mode_response(cluster_t *cluster); +} /* command */ + +} /* mode_base */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/mode_base/mode_base_ids.h b/components/esp_matter/data_model/generated/clusters/mode_base/mode_base_ids.h new file mode 100644 index 000000000..65990f1d4 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/mode_base/mode_base_ids.h @@ -0,0 +1,58 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace mode_base { + +inline constexpr uint32_t Id = 0xffff; + +namespace feature { +namespace OnOff { +inline constexpr uint32_t Id = 0x1; +} /* OnOff */ +} /* feature */ + +namespace attribute { +namespace SupportedModes { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedModes */ +namespace CurrentMode { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentMode */ +namespace StartUpMode { +inline constexpr uint32_t Id = 0x0002; +} /* StartUpMode */ +namespace OnMode { +inline constexpr uint32_t Id = 0x0003; +} /* OnMode */ +} /* attribute */ + +namespace command { +namespace ChangeToMode { +inline constexpr uint32_t Id = 0x00; +} /* ChangeToMode */ +namespace ChangeToModeResponse { +inline constexpr uint32_t Id = 0x01; +} /* ChangeToModeResponse */ +} /* command */ + +} /* mode_base */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/mode_select/mode_select.cpp b/components/esp_matter/data_model/generated/clusters/mode_select/mode_select.cpp new file mode 100644 index 000000000..e4a109bf7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/mode_select/mode_select.cpp @@ -0,0 +1,175 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "mode_select_cluster"; +constexpr uint16_t cluster_revision = 2; + +static esp_err_t esp_matter_command_callback_change_to_mode(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ModeSelect::Commands::ChangeToMode::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfModeSelectClusterChangeToModeCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace mode_select { + +namespace feature { +namespace on_off { +uint32_t get_id() +{ + return OnOff::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_on_mode(cluster, config->on_mode); + + return ESP_OK; +} +} /* on_off */ + +} /* feature */ + +namespace attribute { +attribute_t *create_description(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_description_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, Description::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_description_length + 1); +} + +attribute_t *create_standard_namespace(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, StandardNamespace::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum16(value)); +} + +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedModes::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentMode::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_start_up_mode(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, StartUpMode::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_on_mode(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(on_off), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, OnMode::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_change_to_mode(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToMode::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_change_to_mode); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t function_list[] = { + (function_generic_t)emberAfModeSelectClusterServerInitCallback, + (function_generic_t)MatterModeSelectClusterServerPreAttributeChangedCallback, +}; + +const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, mode_select::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, mode_select::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ModeSelectDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterModeSelectPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_description(cluster, config->description, sizeof(config->description)); + attribute::create_standard_namespace(cluster, config->standard_namespace); + attribute::create_current_mode(cluster, config->current_mode); + attribute::create_supported_modes(cluster, NULL, 0, 0); + command::create_change_to_mode(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* mode_select */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/mode_select/mode_select.h b/components/esp_matter/data_model/generated/clusters/mode_select/mode_select.h new file mode 100644 index 000000000..535b036b2 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/mode_select/mode_select.h @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace mode_select { + +const uint8_t k_max_description_length = 64u; +namespace feature { +namespace on_off { +typedef struct config { + nullable on_mode; + config() : on_mode(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* on_off */ + +} /* feature */ + +namespace attribute { +attribute_t *create_description(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_standard_namespace(cluster_t *cluster, nullable value); +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_start_up_mode(cluster_t *cluster, nullable value); +attribute_t *create_on_mode(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_change_to_mode(cluster_t *cluster); +} /* command */ + +typedef struct config { + char description[k_max_description_length + 1]; + nullable standard_namespace; + uint8_t current_mode; + void *delegate; + config() : description{0}, standard_namespace(0), current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* mode_select */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/mode_select/mode_select_ids.h b/components/esp_matter/data_model/generated/clusters/mode_select/mode_select_ids.h new file mode 100644 index 000000000..49d6fed36 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/mode_select/mode_select_ids.h @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace mode_select { + +inline constexpr uint32_t Id = 0x0050; + +namespace feature { +namespace OnOff { +inline constexpr uint32_t Id = 0x1; +} /* OnOff */ +} /* feature */ + +namespace attribute { +namespace Description { +inline constexpr uint32_t Id = 0x0000; +} /* Description */ +namespace StandardNamespace { +inline constexpr uint32_t Id = 0x0001; +} /* StandardNamespace */ +namespace SupportedModes { +inline constexpr uint32_t Id = 0x0002; +} /* SupportedModes */ +namespace CurrentMode { +inline constexpr uint32_t Id = 0x0003; +} /* CurrentMode */ +namespace StartUpMode { +inline constexpr uint32_t Id = 0x0004; +} /* StartUpMode */ +namespace OnMode { +inline constexpr uint32_t Id = 0x0005; +} /* OnMode */ +} /* attribute */ + +namespace command { +namespace ChangeToMode { +inline constexpr uint32_t Id = 0x00; +} /* ChangeToMode */ +} /* command */ + +} /* mode_select */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/network_commissioning/network_commissioning.cpp b/components/esp_matter/data_model/generated/clusters/network_commissioning/network_commissioning.cpp new file mode 100644 index 000000000..9ce10ff59 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/network_commissioning/network_commissioning.cpp @@ -0,0 +1,314 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "network_commissioning_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace network_commissioning { + +namespace feature { +namespace wi_fi_network_interface { +uint32_t get_id() +{ + return WiFiNetworkInterface::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_scan_max_time_seconds(cluster, config->scan_max_time_seconds); + attribute::create_connect_max_time_seconds(cluster, config->connect_max_time_seconds); + attribute::create_supported_wi_fi_bands(cluster, NULL, 0, 0); + command::create_scan_networks(cluster); + command::create_scan_networks_response(cluster); + command::create_add_or_update_wi_fi_network(cluster); + command::create_remove_network(cluster); + command::create_network_config_response(cluster); + command::create_connect_network(cluster); + command::create_connect_network_response(cluster); + command::create_reorder_network(cluster); + + return ESP_OK; +} +} /* wi_fi_network_interface */ + +namespace thread_network_interface { +uint32_t get_id() +{ + return ThreadNetworkInterface::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_scan_max_time_seconds(cluster, config->scan_max_time_seconds); + attribute::create_connect_max_time_seconds(cluster, config->connect_max_time_seconds); + attribute::create_supported_thread_features(cluster, config->supported_thread_features); + attribute::create_thread_version(cluster, config->thread_version); + command::create_scan_networks(cluster); + command::create_scan_networks_response(cluster); + command::create_add_or_update_thread_network(cluster); + command::create_remove_network(cluster); + command::create_network_config_response(cluster); + command::create_connect_network(cluster); + command::create_connect_network_response(cluster); + command::create_reorder_network(cluster); + + return ESP_OK; +} +} /* thread_network_interface */ + +namespace ethernet_network_interface { +uint32_t get_id() +{ + return EthernetNetworkInterface::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* ethernet_network_interface */ + +} /* feature */ + +namespace attribute { +attribute_t *create_max_networks(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxNetworks::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_networks(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Networks::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_scan_max_time_seconds(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(wi_fi_network_interface)) || (has_feature(thread_network_interface))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ScanMaxTimeSeconds::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_connect_max_time_seconds(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(wi_fi_network_interface)) || (has_feature(thread_network_interface))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ConnectMaxTimeSeconds::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_interface_enabled(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, InterfaceEnabled::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_last_networking_status(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LastNetworkingStatus::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_enum8(0), esp_matter_nullable_enum8(12)); + return attribute; +} + +attribute_t *create_last_network_id(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, LastNetworkID::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_octet_str(value, length)); +} + +attribute_t *create_last_connect_error_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LastConnectErrorValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int32(-2147483648), esp_matter_nullable_int32(2147483646)); + return attribute; +} + +attribute_t *create_supported_wi_fi_bands(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(wi_fi_network_interface), NULL); + return esp_matter::attribute::create(cluster, SupportedWiFiBands::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_supported_thread_features(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(thread_network_interface), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, SupportedThreadFeatures::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap16(0), esp_matter_bitmap16(65535)); + return attribute; +} + +attribute_t *create_thread_version(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(thread_network_interface), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ThreadVersion::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_scan_networks(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(wi_fi_network_interface)) || (has_feature(thread_network_interface))), NULL); + return esp_matter::command::create(cluster, ScanNetworks::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_scan_networks_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(wi_fi_network_interface)) || (has_feature(thread_network_interface))), NULL); + return esp_matter::command::create(cluster, ScanNetworksResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_add_or_update_wi_fi_network(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(wi_fi_network_interface), NULL); + return esp_matter::command::create(cluster, AddOrUpdateWiFiNetwork::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_add_or_update_thread_network(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(thread_network_interface), NULL); + return esp_matter::command::create(cluster, AddOrUpdateThreadNetwork::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_remove_network(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(wi_fi_network_interface)) || (has_feature(thread_network_interface))), NULL); + return esp_matter::command::create(cluster, RemoveNetwork::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_network_config_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(wi_fi_network_interface)) || (has_feature(thread_network_interface))), NULL); + return esp_matter::command::create(cluster, NetworkConfigResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_connect_network(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(wi_fi_network_interface)) || (has_feature(thread_network_interface))), NULL); + return esp_matter::command::create(cluster, ConnectNetwork::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_connect_network_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(wi_fi_network_interface)) || (has_feature(thread_network_interface))), NULL); + return esp_matter::command::create(cluster, ConnectNetworkResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_reorder_network(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(wi_fi_network_interface)) || (has_feature(thread_network_interface))), NULL); + return esp_matter::command::create(cluster, ReorderNetwork::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, network_commissioning::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, network_commissioning::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterNetworkCommissioningPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_max_networks(cluster, config->max_networks); + attribute::create_interface_enabled(cluster, config->interface_enabled); + attribute::create_last_networking_status(cluster, config->last_networking_status); + attribute::create_last_network_id(cluster, config->last_network_id, sizeof(config->last_network_id)); + attribute::create_last_connect_error_value(cluster, config->last_connect_error_value); + attribute::create_networks(cluster, NULL, 0, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_EXACT_ONE("WiFiNetworkInterface,ThreadNetworkInterface,EthernetNetworkInterface", + feature::wi_fi_network_interface::get_id(), feature::thread_network_interface::get_id(), feature::ethernet_network_interface::get_id()); + if (feature_map & feature::wi_fi_network_interface::get_id()) { + VerifyOrReturnValue(feature::wi_fi_network_interface::add(cluster, &(config->features.wi_fi_network_interface)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::thread_network_interface::get_id()) { + VerifyOrReturnValue(feature::thread_network_interface::add(cluster, &(config->features.thread_network_interface)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::ethernet_network_interface::get_id()) { + VerifyOrReturnValue(feature::ethernet_network_interface::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterNetworkCommissioningClusterServerInitCallback, + ESPMatterNetworkCommissioningClusterServerShutdownCallback); + } + + return cluster; +} + +} /* network_commissioning */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/network_commissioning/network_commissioning.h b/components/esp_matter/data_model/generated/clusters/network_commissioning/network_commissioning.h new file mode 100644 index 000000000..17058de84 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/network_commissioning/network_commissioning.h @@ -0,0 +1,99 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace network_commissioning { + +const uint8_t k_max_last_network_id_length = 32u; +namespace feature { +namespace wi_fi_network_interface { +typedef struct config { + uint8_t scan_max_time_seconds; + uint8_t connect_max_time_seconds; + config() : scan_max_time_seconds(0), connect_max_time_seconds(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* wi_fi_network_interface */ + +namespace thread_network_interface { +typedef struct config { + uint8_t scan_max_time_seconds; + uint8_t connect_max_time_seconds; + uint16_t supported_thread_features; + uint16_t thread_version; + config() : scan_max_time_seconds(0), connect_max_time_seconds(0), supported_thread_features(0), thread_version(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* thread_network_interface */ + +namespace ethernet_network_interface { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* ethernet_network_interface */ + +} /* feature */ + +namespace attribute { +attribute_t *create_max_networks(cluster_t *cluster, uint8_t value); +attribute_t *create_networks(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_scan_max_time_seconds(cluster_t *cluster, uint8_t value); +attribute_t *create_connect_max_time_seconds(cluster_t *cluster, uint8_t value); +attribute_t *create_interface_enabled(cluster_t *cluster, bool value); +attribute_t *create_last_networking_status(cluster_t *cluster, nullable value); +attribute_t *create_last_network_id(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_last_connect_error_value(cluster_t *cluster, nullable value); +attribute_t *create_supported_wi_fi_bands(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_supported_thread_features(cluster_t *cluster, uint16_t value); +attribute_t *create_thread_version(cluster_t *cluster, uint16_t value); +} /* attribute */ + +namespace command { +command_t *create_scan_networks(cluster_t *cluster); +command_t *create_scan_networks_response(cluster_t *cluster); +command_t *create_add_or_update_wi_fi_network(cluster_t *cluster); +command_t *create_add_or_update_thread_network(cluster_t *cluster); +command_t *create_remove_network(cluster_t *cluster); +command_t *create_network_config_response(cluster_t *cluster); +command_t *create_connect_network(cluster_t *cluster); +command_t *create_connect_network_response(cluster_t *cluster); +command_t *create_reorder_network(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t max_networks; + bool interface_enabled; + nullable last_networking_status; + uint8_t last_network_id[k_max_last_network_id_length]; + nullable last_connect_error_value; + struct { + feature::wi_fi_network_interface::config_t wi_fi_network_interface; + feature::thread_network_interface::config_t thread_network_interface; + } features; + uint32_t feature_flags; + config() : max_networks(0), interface_enabled(true), last_networking_status(0), last_network_id{0}, last_connect_error_value(0), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* network_commissioning */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/network_commissioning/network_commissioning_ids.h b/components/esp_matter/data_model/generated/clusters/network_commissioning/network_commissioning_ids.h new file mode 100644 index 000000000..7779491e0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/network_commissioning/network_commissioning_ids.h @@ -0,0 +1,106 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace network_commissioning { + +inline constexpr uint32_t Id = 0x0031; + +namespace feature { +namespace WiFiNetworkInterface { +inline constexpr uint32_t Id = 0x1; +} /* WiFiNetworkInterface */ +namespace ThreadNetworkInterface { +inline constexpr uint32_t Id = 0x2; +} /* ThreadNetworkInterface */ +namespace EthernetNetworkInterface { +inline constexpr uint32_t Id = 0x4; +} /* EthernetNetworkInterface */ +} /* feature */ + +namespace attribute { +namespace MaxNetworks { +inline constexpr uint32_t Id = 0x0000; +} /* MaxNetworks */ +namespace Networks { +inline constexpr uint32_t Id = 0x0001; +} /* Networks */ +namespace ScanMaxTimeSeconds { +inline constexpr uint32_t Id = 0x0002; +} /* ScanMaxTimeSeconds */ +namespace ConnectMaxTimeSeconds { +inline constexpr uint32_t Id = 0x0003; +} /* ConnectMaxTimeSeconds */ +namespace InterfaceEnabled { +inline constexpr uint32_t Id = 0x0004; +} /* InterfaceEnabled */ +namespace LastNetworkingStatus { +inline constexpr uint32_t Id = 0x0005; +} /* LastNetworkingStatus */ +namespace LastNetworkID { +inline constexpr uint32_t Id = 0x0006; +} /* LastNetworkID */ +namespace LastConnectErrorValue { +inline constexpr uint32_t Id = 0x0007; +} /* LastConnectErrorValue */ +namespace SupportedWiFiBands { +inline constexpr uint32_t Id = 0x0008; +} /* SupportedWiFiBands */ +namespace SupportedThreadFeatures { +inline constexpr uint32_t Id = 0x0009; +} /* SupportedThreadFeatures */ +namespace ThreadVersion { +inline constexpr uint32_t Id = 0x000A; +} /* ThreadVersion */ +} /* attribute */ + +namespace command { +namespace ScanNetworks { +inline constexpr uint32_t Id = 0x00; +} /* ScanNetworks */ +namespace ScanNetworksResponse { +inline constexpr uint32_t Id = 0x01; +} /* ScanNetworksResponse */ +namespace AddOrUpdateWiFiNetwork { +inline constexpr uint32_t Id = 0x02; +} /* AddOrUpdateWiFiNetwork */ +namespace AddOrUpdateThreadNetwork { +inline constexpr uint32_t Id = 0x03; +} /* AddOrUpdateThreadNetwork */ +namespace RemoveNetwork { +inline constexpr uint32_t Id = 0x04; +} /* RemoveNetwork */ +namespace NetworkConfigResponse { +inline constexpr uint32_t Id = 0x05; +} /* NetworkConfigResponse */ +namespace ConnectNetwork { +inline constexpr uint32_t Id = 0x06; +} /* ConnectNetwork */ +namespace ConnectNetworkResponse { +inline constexpr uint32_t Id = 0x07; +} /* ConnectNetworkResponse */ +namespace ReorderNetwork { +inline constexpr uint32_t Id = 0x08; +} /* ReorderNetwork */ +} /* command */ + +} /* network_commissioning */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/nitrogen_dioxide_concentration_measurement/nitrogen_dioxide_concentration_measurement.cpp b/components/esp_matter/data_model/generated/clusters/nitrogen_dioxide_concentration_measurement/nitrogen_dioxide_concentration_measurement.cpp new file mode 100644 index 000000000..4852c7fbd --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/nitrogen_dioxide_concentration_measurement/nitrogen_dioxide_concentration_measurement.cpp @@ -0,0 +1,289 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "nitrogen_dioxide_concentration_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace nitrogen_dioxide_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id() +{ + return NumericMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_measured_value(cluster, 0); + attribute::create_min_measured_value(cluster, 0); + attribute::create_max_measured_value(cluster, 0); + attribute::create_measurement_unit(cluster, 0); + + return ESP_OK; +} +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id() +{ + return LevelIndication::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_level_value(cluster, 0); + + return ESP_OK; +} +} /* level_indication */ + +namespace medium_level { +uint32_t get_id() +{ + return MediumLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* medium_level */ + +namespace critical_level { +uint32_t get_id() +{ + return CriticalLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id() +{ + return PeakMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_peak_measured_value(cluster, 0); + attribute::create_peak_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id() +{ + return AverageMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_average_measured_value(cluster, 0); + attribute::create_average_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_uncertainty(cluster_t *cluster, float value) +{ + return esp_matter::attribute::create(cluster, Uncertainty::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_float(value)); +} + +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasurementUnit::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, MeasurementMedium::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_level_value(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(level_indication), NULL); + return esp_matter::attribute::create(cluster, LevelValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, nitrogen_dioxide_concentration_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, nitrogen_dioxide_concentration_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterNitrogenDioxideConcentrationMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measurement_medium(cluster, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("NumericMeasurement,LevelIndication", + feature::numeric_measurement::get_id(), feature::level_indication::get_id()); + if (feature_map & feature::numeric_measurement::get_id()) { + VerifyOrReturnValue(feature::numeric_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::level_indication::get_id()) { + VerifyOrReturnValue(feature::level_indication::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::medium_level::get_id()) { + VerifyOrReturnValue(feature::medium_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::critical_level::get_id()) { + VerifyOrReturnValue(feature::critical_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::peak_measurement::get_id()) { + VerifyOrReturnValue(feature::peak_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::average_measurement::get_id()) { + VerifyOrReturnValue(feature::average_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* nitrogen_dioxide_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/nitrogen_dioxide_concentration_measurement/nitrogen_dioxide_concentration_measurement.h b/components/esp_matter/data_model/generated/clusters/nitrogen_dioxide_concentration_measurement/nitrogen_dioxide_concentration_measurement.h new file mode 100644 index 000000000..ff8287293 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/nitrogen_dioxide_concentration_measurement/nitrogen_dioxide_concentration_measurement.h @@ -0,0 +1,80 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace nitrogen_dioxide_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* level_indication */ + +namespace medium_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* medium_level */ + +namespace critical_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_uncertainty(cluster_t *cluster, float value); +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value); +attribute_t *create_level_value(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* nitrogen_dioxide_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/nitrogen_dioxide_concentration_measurement/nitrogen_dioxide_concentration_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/nitrogen_dioxide_concentration_measurement/nitrogen_dioxide_concentration_measurement_ids.h new file mode 100644 index 000000000..602489b97 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/nitrogen_dioxide_concentration_measurement/nitrogen_dioxide_concentration_measurement_ids.h @@ -0,0 +1,85 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace nitrogen_dioxide_concentration_measurement { + +inline constexpr uint32_t Id = 0x0413; + +namespace feature { +namespace NumericMeasurement { +inline constexpr uint32_t Id = 0x1; +} /* NumericMeasurement */ +namespace LevelIndication { +inline constexpr uint32_t Id = 0x2; +} /* LevelIndication */ +namespace MediumLevel { +inline constexpr uint32_t Id = 0x4; +} /* MediumLevel */ +namespace CriticalLevel { +inline constexpr uint32_t Id = 0x8; +} /* CriticalLevel */ +namespace PeakMeasurement { +inline constexpr uint32_t Id = 0x10; +} /* PeakMeasurement */ +namespace AverageMeasurement { +inline constexpr uint32_t Id = 0x20; +} /* AverageMeasurement */ +} /* feature */ + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace PeakMeasuredValue { +inline constexpr uint32_t Id = 0x0003; +} /* PeakMeasuredValue */ +namespace PeakMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0004; +} /* PeakMeasuredValueWindow */ +namespace AverageMeasuredValue { +inline constexpr uint32_t Id = 0x0005; +} /* AverageMeasuredValue */ +namespace AverageMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0006; +} /* AverageMeasuredValueWindow */ +namespace Uncertainty { +inline constexpr uint32_t Id = 0x0007; +} /* Uncertainty */ +namespace MeasurementUnit { +inline constexpr uint32_t Id = 0x0008; +} /* MeasurementUnit */ +namespace MeasurementMedium { +inline constexpr uint32_t Id = 0x0009; +} /* MeasurementMedium */ +namespace LevelValue { +inline constexpr uint32_t Id = 0x000A; +} /* LevelValue */ +} /* attribute */ + +} /* nitrogen_dioxide_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/occupancy_sensing/occupancy_sensing.cpp b/components/esp_matter/data_model/generated/clusters/occupancy_sensing/occupancy_sensing.cpp new file mode 100644 index 000000000..fe49a82e1 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/occupancy_sensing/occupancy_sensing.cpp @@ -0,0 +1,355 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "occupancy_sensing_cluster"; +constexpr uint16_t cluster_revision = 5; + +namespace esp_matter { +namespace cluster { +namespace occupancy_sensing { + +namespace feature { +namespace other { +uint32_t get_id() +{ + return Other::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* other */ + +namespace passive_infrared { +uint32_t get_id() +{ + return PassiveInfrared::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_pir_unoccupied_to_occupied_delay(cluster, config->pir_unoccupied_to_occupied_delay); + attribute::create_pir_unoccupied_to_occupied_threshold(cluster, config->pir_unoccupied_to_occupied_threshold); + + return ESP_OK; +} +} /* passive_infrared */ + +namespace ultrasonic { +uint32_t get_id() +{ + return Ultrasonic::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_ultrasonic_unoccupied_to_occupied_delay(cluster, config->ultrasonic_unoccupied_to_occupied_delay); + attribute::create_ultrasonic_unoccupied_to_occupied_threshold(cluster, config->ultrasonic_unoccupied_to_occupied_threshold); + + return ESP_OK; +} +} /* ultrasonic */ + +namespace physical_contact { +uint32_t get_id() +{ + return PhysicalContact::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_physical_contact_unoccupied_to_occupied_delay(cluster, config->physical_contact_unoccupied_to_occupied_delay); + attribute::create_physical_contact_unoccupied_to_occupied_threshold(cluster, config->physical_contact_unoccupied_to_occupied_threshold); + + return ESP_OK; +} +} /* physical_contact */ + +namespace active_infrared { +uint32_t get_id() +{ + return ActiveInfrared::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* active_infrared */ + +namespace radar { +uint32_t get_id() +{ + return Radar::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* radar */ + +namespace rf_sensing { +uint32_t get_id() +{ + return RFSensing::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* rf_sensing */ + +namespace vision { +uint32_t get_id() +{ + return Vision::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* vision */ + +} /* feature */ + +namespace attribute { +attribute_t *create_occupancy(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Occupancy::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(1)); + return attribute; +} + +attribute_t *create_occupancy_sensor_type(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, OccupancySensorType::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(3)); + return attribute; +} + +attribute_t *create_occupancy_sensor_type_bitmap(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, OccupancySensorTypeBitmap::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(7)); + return attribute; +} + +attribute_t *create_hold_time(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, HoldTime::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_hold_time_limits(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + VerifyOrReturnValue(has_attribute(HoldTime), NULL); + return esp_matter::attribute::create(cluster, HoldTimeLimits::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_pir_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PIROccupiedToUnoccupiedDelay::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_pir_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PIRUnoccupiedToOccupiedDelay::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_pir_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PIRUnoccupiedToOccupiedThreshold::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_ultrasonic_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, UltrasonicOccupiedToUnoccupiedDelay::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_ultrasonic_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, UltrasonicUnoccupiedToOccupiedDelay::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_ultrasonic_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, UltrasonicUnoccupiedToOccupiedThreshold::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_physical_contact_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PhysicalContactOccupiedToUnoccupiedDelay::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_physical_contact_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PhysicalContactUnoccupiedToOccupiedDelay::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_physical_contact_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PhysicalContactUnoccupiedToOccupiedThreshold::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ + +namespace event { +event_t *create_occupancy_changed(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, OccupancyChanged::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, occupancy_sensing::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, occupancy_sensing::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterOccupancySensingPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_occupancy(cluster, config->occupancy); + attribute::create_occupancy_sensor_type(cluster, config->occupancy_sensor_type); + attribute::create_occupancy_sensor_type_bitmap(cluster, config->occupancy_sensor_type_bitmap); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("Other,ActiveInfrared,PassiveInfrared,Radar,Ultrasonic,RFSensing,PhysicalContact,Vision", + feature::other::get_id(), feature::active_infrared::get_id(), feature::passive_infrared::get_id(), feature::radar::get_id(), feature::ultrasonic::get_id(), feature::rf_sensing::get_id(), feature::physical_contact::get_id(), feature::vision::get_id()); + if (feature_map & feature::other::get_id()) { + VerifyOrReturnValue(feature::other::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::active_infrared::get_id()) { + VerifyOrReturnValue(feature::active_infrared::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::passive_infrared::get_id()) { + VerifyOrReturnValue(feature::passive_infrared::add(cluster, &(config->features.passive_infrared)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::radar::get_id()) { + VerifyOrReturnValue(feature::radar::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::ultrasonic::get_id()) { + VerifyOrReturnValue(feature::ultrasonic::add(cluster, &(config->features.ultrasonic)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::rf_sensing::get_id()) { + VerifyOrReturnValue(feature::rf_sensing::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::physical_contact::get_id()) { + VerifyOrReturnValue(feature::physical_contact::add(cluster, &(config->features.physical_contact)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::vision::get_id()) { + VerifyOrReturnValue(feature::vision::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterOccupancySensingClusterServerInitCallback, + ESPMatterOccupancySensingClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* occupancy_sensing */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/occupancy_sensing/occupancy_sensing.h b/components/esp_matter/data_model/generated/clusters/occupancy_sensing/occupancy_sensing.h new file mode 100644 index 000000000..480ee11e5 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/occupancy_sensing/occupancy_sensing.h @@ -0,0 +1,120 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace occupancy_sensing { + +namespace feature { +namespace other { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* other */ + +namespace passive_infrared { +typedef struct config { + uint16_t pir_unoccupied_to_occupied_delay; + uint8_t pir_unoccupied_to_occupied_threshold; + config() : pir_unoccupied_to_occupied_delay(0), pir_unoccupied_to_occupied_threshold(1) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* passive_infrared */ + +namespace ultrasonic { +typedef struct config { + uint16_t ultrasonic_unoccupied_to_occupied_delay; + uint8_t ultrasonic_unoccupied_to_occupied_threshold; + config() : ultrasonic_unoccupied_to_occupied_delay(0), ultrasonic_unoccupied_to_occupied_threshold(1) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* ultrasonic */ + +namespace physical_contact { +typedef struct config { + uint16_t physical_contact_unoccupied_to_occupied_delay; + uint8_t physical_contact_unoccupied_to_occupied_threshold; + config() : physical_contact_unoccupied_to_occupied_delay(0), physical_contact_unoccupied_to_occupied_threshold(1) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* physical_contact */ + +namespace active_infrared { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* active_infrared */ + +namespace radar { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* radar */ + +namespace rf_sensing { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* rf_sensing */ + +namespace vision { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* vision */ + +} /* feature */ + +namespace attribute { +attribute_t *create_occupancy(cluster_t *cluster, uint8_t value); +attribute_t *create_occupancy_sensor_type(cluster_t *cluster, uint8_t value); +attribute_t *create_occupancy_sensor_type_bitmap(cluster_t *cluster, uint8_t value); +attribute_t *create_hold_time(cluster_t *cluster, uint16_t value); +attribute_t *create_hold_time_limits(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_pir_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value); +attribute_t *create_pir_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value); +attribute_t *create_pir_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value); +attribute_t *create_ultrasonic_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value); +attribute_t *create_ultrasonic_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value); +attribute_t *create_ultrasonic_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value); +attribute_t *create_physical_contact_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value); +attribute_t *create_physical_contact_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value); +attribute_t *create_physical_contact_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace event { +event_t *create_occupancy_changed(cluster_t *cluster); +} /* event */ + +typedef struct config { + uint8_t occupancy; + uint8_t occupancy_sensor_type; + uint8_t occupancy_sensor_type_bitmap; + struct { + feature::passive_infrared::config_t passive_infrared; + feature::ultrasonic::config_t ultrasonic; + feature::physical_contact::config_t physical_contact; + } features; + uint32_t feature_flags; + config() : occupancy(0), occupancy_sensor_type(0), occupancy_sensor_type_bitmap(0), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* occupancy_sensing */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/occupancy_sensing/occupancy_sensing_ids.h b/components/esp_matter/data_model/generated/clusters/occupancy_sensing/occupancy_sensing_ids.h new file mode 100644 index 000000000..b2bb493df --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/occupancy_sensing/occupancy_sensing_ids.h @@ -0,0 +1,106 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace occupancy_sensing { + +inline constexpr uint32_t Id = 0x0406; + +namespace feature { +namespace Other { +inline constexpr uint32_t Id = 0x1; +} /* Other */ +namespace PassiveInfrared { +inline constexpr uint32_t Id = 0x2; +} /* PassiveInfrared */ +namespace Ultrasonic { +inline constexpr uint32_t Id = 0x4; +} /* Ultrasonic */ +namespace PhysicalContact { +inline constexpr uint32_t Id = 0x8; +} /* PhysicalContact */ +namespace ActiveInfrared { +inline constexpr uint32_t Id = 0x10; +} /* ActiveInfrared */ +namespace Radar { +inline constexpr uint32_t Id = 0x20; +} /* Radar */ +namespace RFSensing { +inline constexpr uint32_t Id = 0x40; +} /* RFSensing */ +namespace Vision { +inline constexpr uint32_t Id = 0x80; +} /* Vision */ +} /* feature */ + +namespace attribute { +namespace Occupancy { +inline constexpr uint32_t Id = 0x0000; +} /* Occupancy */ +namespace OccupancySensorType { +inline constexpr uint32_t Id = 0x0001; +} /* OccupancySensorType */ +namespace OccupancySensorTypeBitmap { +inline constexpr uint32_t Id = 0x0002; +} /* OccupancySensorTypeBitmap */ +namespace HoldTime { +inline constexpr uint32_t Id = 0x0003; +} /* HoldTime */ +namespace HoldTimeLimits { +inline constexpr uint32_t Id = 0x0004; +} /* HoldTimeLimits */ +namespace PIROccupiedToUnoccupiedDelay { +inline constexpr uint32_t Id = 0x0010; +} /* PIROccupiedToUnoccupiedDelay */ +namespace PIRUnoccupiedToOccupiedDelay { +inline constexpr uint32_t Id = 0x0011; +} /* PIRUnoccupiedToOccupiedDelay */ +namespace PIRUnoccupiedToOccupiedThreshold { +inline constexpr uint32_t Id = 0x0012; +} /* PIRUnoccupiedToOccupiedThreshold */ +namespace UltrasonicOccupiedToUnoccupiedDelay { +inline constexpr uint32_t Id = 0x0020; +} /* UltrasonicOccupiedToUnoccupiedDelay */ +namespace UltrasonicUnoccupiedToOccupiedDelay { +inline constexpr uint32_t Id = 0x0021; +} /* UltrasonicUnoccupiedToOccupiedDelay */ +namespace UltrasonicUnoccupiedToOccupiedThreshold { +inline constexpr uint32_t Id = 0x0022; +} /* UltrasonicUnoccupiedToOccupiedThreshold */ +namespace PhysicalContactOccupiedToUnoccupiedDelay { +inline constexpr uint32_t Id = 0x0030; +} /* PhysicalContactOccupiedToUnoccupiedDelay */ +namespace PhysicalContactUnoccupiedToOccupiedDelay { +inline constexpr uint32_t Id = 0x0031; +} /* PhysicalContactUnoccupiedToOccupiedDelay */ +namespace PhysicalContactUnoccupiedToOccupiedThreshold { +inline constexpr uint32_t Id = 0x0032; +} /* PhysicalContactUnoccupiedToOccupiedThreshold */ +} /* attribute */ + +namespace event { +namespace OccupancyChanged { +inline constexpr uint32_t Id = 0x00; +} /* OccupancyChanged */ +} /* event */ + +} /* occupancy_sensing */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/on_off/on_off.cpp b/components/esp_matter/data_model/generated/clusters/on_off/on_off.cpp new file mode 100644 index 000000000..22977a740 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/on_off/on_off.cpp @@ -0,0 +1,307 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "on_off_cluster"; +constexpr uint16_t cluster_revision = 6; + +static esp_err_t esp_matter_command_callback_off(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::OnOff::Commands::Off::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfOnOffClusterOffCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_on(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::OnOff::Commands::On::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfOnOffClusterOnCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_toggle(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::OnOff::Commands::Toggle::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfOnOffClusterToggleCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_off_with_effect(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::OnOff::Commands::OffWithEffect::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfOnOffClusterOffWithEffectCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_on_with_recall_global_scene(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::OnOff::Commands::OnWithRecallGlobalScene::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfOnOffClusterOnWithRecallGlobalSceneCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_on_with_timed_off(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::OnOff::Commands::OnWithTimedOff::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfOnOffClusterOnWithTimedOffCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace on_off { + +namespace feature { +namespace lighting { +uint32_t get_id() +{ + return Lighting::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(!(has_feature(off_only)), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_global_scene_control(cluster, config->global_scene_control); + attribute::create_on_time(cluster, config->on_time); + attribute::create_off_wait_time(cluster, config->off_wait_time); + attribute::create_start_up_on_off(cluster, config->start_up_on_off); + command::create_off_with_effect(cluster); + command::create_on_with_recall_global_scene(cluster); + command::create_on_with_timed_off(cluster); + + return ESP_OK; +} +} /* lighting */ + +namespace dead_front_behavior { +uint32_t get_id() +{ + return DeadFrontBehavior::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(!(has_feature(off_only)), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* dead_front_behavior */ + +namespace off_only { +uint32_t get_id() +{ + return OffOnly::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(!(((has_feature(lighting)) || (has_feature(dead_front_behavior)))), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command_t *on = esp_matter::command::get(cluster, command::On::Id, COMMAND_FLAG_ACCEPTED); + if (on) { + esp_matter::command::destroy(cluster, on); + } + command_t *toggle = esp_matter::command::get(cluster, command::Toggle::Id, COMMAND_FLAG_ACCEPTED); + if (toggle) { + esp_matter::command::destroy(cluster, toggle); + } + + return ESP_OK; +} +} /* off_only */ + +} /* feature */ + +namespace attribute { +attribute_t *create_on_off(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, OnOff::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_global_scene_control(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(lighting), NULL); + return esp_matter::attribute::create(cluster, GlobalSceneControl::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_on_time(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(lighting), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, OnTime::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_off_wait_time(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(lighting), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, OffWaitTime::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_start_up_on_off(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(lighting), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, StartUpOnOff::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_enum8(0), esp_matter_nullable_enum8(2)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_off(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Off::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_off); +} + +command_t *create_on(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(!(has_feature(off_only)), NULL); + return esp_matter::command::create(cluster, On::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_on); +} + +command_t *create_toggle(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(!(has_feature(off_only)), NULL); + return esp_matter::command::create(cluster, Toggle::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_toggle); +} + +command_t *create_off_with_effect(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(lighting), NULL); + return esp_matter::command::create(cluster, OffWithEffect::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_off_with_effect); +} + +command_t *create_on_with_recall_global_scene(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(lighting), NULL); + return esp_matter::command::create(cluster, OnWithRecallGlobalScene::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_on_with_recall_global_scene); +} + +command_t *create_on_with_timed_off(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(lighting), NULL); + return esp_matter::command::create(cluster, OnWithTimedOff::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_on_with_timed_off); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t function_list[] = { + (function_generic_t)emberAfOnOffClusterServerInitCallback, + (function_generic_t)MatterOnOffClusterServerShutdownCallback, +}; + +const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_SHUTDOWN_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, on_off::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, on_off::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterOnOffPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_on_off(cluster, config->on_off); + command::create_off(cluster); + command::create_on(cluster); + command::create_toggle(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* on_off */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/on_off/on_off.h b/components/esp_matter/data_model/generated/clusters/on_off/on_off.h new file mode 100644 index 000000000..4f26a8f6d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/on_off/on_off.h @@ -0,0 +1,75 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace on_off { + +namespace feature { +namespace lighting { +typedef struct config { + bool global_scene_control; + uint16_t on_time; + uint16_t off_wait_time; + nullable start_up_on_off; + config() : global_scene_control(false), on_time(0), off_wait_time(0), start_up_on_off(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* lighting */ + +namespace dead_front_behavior { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* dead_front_behavior */ + +namespace off_only { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* off_only */ + +} /* feature */ + +namespace attribute { +attribute_t *create_on_off(cluster_t *cluster, bool value); +attribute_t *create_global_scene_control(cluster_t *cluster, bool value); +attribute_t *create_on_time(cluster_t *cluster, uint16_t value); +attribute_t *create_off_wait_time(cluster_t *cluster, uint16_t value); +attribute_t *create_start_up_on_off(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_off(cluster_t *cluster); +command_t *create_on(cluster_t *cluster); +command_t *create_toggle(cluster_t *cluster); +command_t *create_off_with_effect(cluster_t *cluster); +command_t *create_on_with_recall_global_scene(cluster_t *cluster); +command_t *create_on_with_timed_off(cluster_t *cluster); +} /* command */ + +typedef struct config { + bool on_off; + config() : on_off(false) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* on_off */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/on_off/on_off_ids.h b/components/esp_matter/data_model/generated/clusters/on_off/on_off_ids.h new file mode 100644 index 000000000..a6b3a9171 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/on_off/on_off_ids.h @@ -0,0 +1,79 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace on_off { + +inline constexpr uint32_t Id = 0x0006; + +namespace feature { +namespace Lighting { +inline constexpr uint32_t Id = 0x1; +} /* Lighting */ +namespace DeadFrontBehavior { +inline constexpr uint32_t Id = 0x2; +} /* DeadFrontBehavior */ +namespace OffOnly { +inline constexpr uint32_t Id = 0x4; +} /* OffOnly */ +} /* feature */ + +namespace attribute { +namespace OnOff { +inline constexpr uint32_t Id = 0x0000; +} /* OnOff */ +namespace GlobalSceneControl { +inline constexpr uint32_t Id = 0x4000; +} /* GlobalSceneControl */ +namespace OnTime { +inline constexpr uint32_t Id = 0x4001; +} /* OnTime */ +namespace OffWaitTime { +inline constexpr uint32_t Id = 0x4002; +} /* OffWaitTime */ +namespace StartUpOnOff { +inline constexpr uint32_t Id = 0x4003; +} /* StartUpOnOff */ +} /* attribute */ + +namespace command { +namespace Off { +inline constexpr uint32_t Id = 0x00; +} /* Off */ +namespace On { +inline constexpr uint32_t Id = 0x01; +} /* On */ +namespace Toggle { +inline constexpr uint32_t Id = 0x02; +} /* Toggle */ +namespace OffWithEffect { +inline constexpr uint32_t Id = 0x40; +} /* OffWithEffect */ +namespace OnWithRecallGlobalScene { +inline constexpr uint32_t Id = 0x41; +} /* OnWithRecallGlobalScene */ +namespace OnWithTimedOff { +inline constexpr uint32_t Id = 0x42; +} /* OnWithTimedOff */ +} /* command */ + +} /* on_off */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/operational_credentials/operational_credentials.cpp b/components/esp_matter/data_model/generated/clusters/operational_credentials/operational_credentials.cpp new file mode 100644 index 000000000..5e9595613 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/operational_credentials/operational_credentials.cpp @@ -0,0 +1,212 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "operational_credentials_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace operational_credentials { + +namespace attribute { +attribute_t *create_no_cs(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, NOCs::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_fabrics(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Fabrics::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_supported_fabrics(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SupportedFabrics::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(5), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_commissioned_fabrics(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CommissionedFabrics::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_trusted_root_certificates(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, TrustedRootCertificates::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_fabric_index(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentFabricIndex::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_attestation_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AttestationRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_attestation_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AttestationResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_certificate_chain_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CertificateChainRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_certificate_chain_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CertificateChainResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_csr_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CSRRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_csr_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CSRResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_add_noc(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AddNOC::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_update_noc(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, UpdateNOC::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_noc_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, NOCResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_update_fabric_label(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, UpdateFabricLabel::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_remove_fabric(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RemoveFabric::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_add_trusted_root_certificate(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AddTrustedRootCertificate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_set_vid_verification_statement(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SetVIDVerificationStatement::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_sign_vid_verification_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SignVIDVerificationRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_sign_vid_verification_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SignVIDVerificationResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, operational_credentials::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, operational_credentials::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterOperationalCredentialsPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_supported_fabrics(cluster, config->supported_fabrics); + attribute::create_commissioned_fabrics(cluster, config->commissioned_fabrics); + attribute::create_current_fabric_index(cluster, config->current_fabric_index); + attribute::create_no_cs(cluster, NULL, 0, 0); + attribute::create_fabrics(cluster, NULL, 0, 0); + attribute::create_trusted_root_certificates(cluster, NULL, 0, 0); + command::create_attestation_request(cluster); + command::create_attestation_response(cluster); + command::create_certificate_chain_request(cluster); + command::create_certificate_chain_response(cluster); + command::create_csr_request(cluster); + command::create_csr_response(cluster); + command::create_add_noc(cluster); + command::create_update_noc(cluster); + command::create_noc_response(cluster); + command::create_update_fabric_label(cluster); + command::create_remove_fabric(cluster); + command::create_add_trusted_root_certificate(cluster); + command::create_set_vid_verification_statement(cluster); + command::create_sign_vid_verification_request(cluster); + command::create_sign_vid_verification_response(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterOperationalCredentialsClusterServerInitCallback, + ESPMatterOperationalCredentialsClusterServerShutdownCallback); + } + + return cluster; +} + +} /* operational_credentials */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/operational_credentials/operational_credentials.h b/components/esp_matter/data_model/generated/clusters/operational_credentials/operational_credentials.h new file mode 100644 index 000000000..2b99bc679 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/operational_credentials/operational_credentials.h @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace operational_credentials { + +namespace attribute { +attribute_t *create_no_cs(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_fabrics(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_supported_fabrics(cluster_t *cluster, uint8_t value); +attribute_t *create_commissioned_fabrics(cluster_t *cluster, uint8_t value); +attribute_t *create_trusted_root_certificates(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_fabric_index(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_attestation_request(cluster_t *cluster); +command_t *create_attestation_response(cluster_t *cluster); +command_t *create_certificate_chain_request(cluster_t *cluster); +command_t *create_certificate_chain_response(cluster_t *cluster); +command_t *create_csr_request(cluster_t *cluster); +command_t *create_csr_response(cluster_t *cluster); +command_t *create_add_noc(cluster_t *cluster); +command_t *create_update_noc(cluster_t *cluster); +command_t *create_noc_response(cluster_t *cluster); +command_t *create_update_fabric_label(cluster_t *cluster); +command_t *create_remove_fabric(cluster_t *cluster); +command_t *create_add_trusted_root_certificate(cluster_t *cluster); +command_t *create_set_vid_verification_statement(cluster_t *cluster); +command_t *create_sign_vid_verification_request(cluster_t *cluster); +command_t *create_sign_vid_verification_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t supported_fabrics; + uint8_t commissioned_fabrics; + uint8_t current_fabric_index; + config() : supported_fabrics(0), commissioned_fabrics(0), current_fabric_index(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* operational_credentials */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/operational_credentials/operational_credentials_ids.h b/components/esp_matter/data_model/generated/clusters/operational_credentials/operational_credentials_ids.h new file mode 100644 index 000000000..1a50ec02f --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/operational_credentials/operational_credentials_ids.h @@ -0,0 +1,97 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace operational_credentials { + +inline constexpr uint32_t Id = 0x003E; + +namespace attribute { +namespace NOCs { +inline constexpr uint32_t Id = 0x0000; +} /* NOCs */ +namespace Fabrics { +inline constexpr uint32_t Id = 0x0001; +} /* Fabrics */ +namespace SupportedFabrics { +inline constexpr uint32_t Id = 0x0002; +} /* SupportedFabrics */ +namespace CommissionedFabrics { +inline constexpr uint32_t Id = 0x0003; +} /* CommissionedFabrics */ +namespace TrustedRootCertificates { +inline constexpr uint32_t Id = 0x0004; +} /* TrustedRootCertificates */ +namespace CurrentFabricIndex { +inline constexpr uint32_t Id = 0x0005; +} /* CurrentFabricIndex */ +} /* attribute */ + +namespace command { +namespace AttestationRequest { +inline constexpr uint32_t Id = 0x00; +} /* AttestationRequest */ +namespace AttestationResponse { +inline constexpr uint32_t Id = 0x01; +} /* AttestationResponse */ +namespace CertificateChainRequest { +inline constexpr uint32_t Id = 0x02; +} /* CertificateChainRequest */ +namespace CertificateChainResponse { +inline constexpr uint32_t Id = 0x03; +} /* CertificateChainResponse */ +namespace CSRRequest { +inline constexpr uint32_t Id = 0x04; +} /* CSRRequest */ +namespace CSRResponse { +inline constexpr uint32_t Id = 0x05; +} /* CSRResponse */ +namespace AddNOC { +inline constexpr uint32_t Id = 0x06; +} /* AddNOC */ +namespace UpdateNOC { +inline constexpr uint32_t Id = 0x07; +} /* UpdateNOC */ +namespace NOCResponse { +inline constexpr uint32_t Id = 0x08; +} /* NOCResponse */ +namespace UpdateFabricLabel { +inline constexpr uint32_t Id = 0x09; +} /* UpdateFabricLabel */ +namespace RemoveFabric { +inline constexpr uint32_t Id = 0x0A; +} /* RemoveFabric */ +namespace AddTrustedRootCertificate { +inline constexpr uint32_t Id = 0x0B; +} /* AddTrustedRootCertificate */ +namespace SetVIDVerificationStatement { +inline constexpr uint32_t Id = 0x0C; +} /* SetVIDVerificationStatement */ +namespace SignVIDVerificationRequest { +inline constexpr uint32_t Id = 0x0D; +} /* SignVIDVerificationRequest */ +namespace SignVIDVerificationResponse { +inline constexpr uint32_t Id = 0x0E; +} /* SignVIDVerificationResponse */ +} /* command */ + +} /* operational_credentials */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/operational_state/operational_state.cpp b/components/esp_matter/data_model/generated/clusters/operational_state/operational_state.cpp new file mode 100644 index 000000000..ea2c76ba9 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/operational_state/operational_state.cpp @@ -0,0 +1,167 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "operational_state_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace operational_state { + +namespace attribute { +attribute_t *create_phase_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, PhaseList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_phase(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CurrentPhase::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); +} + +attribute_t *create_countdown_time(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CountdownTime::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_operational_state_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, OperationalStateList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_operational_state(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, OperationalState::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_operational_error(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, OperationalError::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_pause(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Pause::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_stop(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Stop::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_start(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Start::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_resume(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Resume::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_operational_command_response(cluster_t *cluster) +{ + VerifyOrReturnValue(((has_command(Pause, COMMAND_FLAG_ACCEPTED)) || (has_command(Stop, COMMAND_FLAG_ACCEPTED)) || (has_command(Start, COMMAND_FLAG_ACCEPTED)) || (has_command(Resume, COMMAND_FLAG_ACCEPTED))), NULL); + return esp_matter::command::create(cluster, OperationalCommandResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_operational_error(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, OperationalError::Id); +} + +event_t *create_operation_completion(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, OperationCompletion::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, operational_state::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, operational_state::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = OperationalStateDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterOperationalStatePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_phase_list(cluster, NULL, 0, 0); + attribute::create_current_phase(cluster, 0); + attribute::create_operational_state_list(cluster, NULL, 0, 0); + attribute::create_operational_state(cluster, 0); + attribute::create_operational_error(cluster, NULL, 0, 0); + /* Events */ + event::create_operational_error(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* operational_state */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/operational_state/operational_state.h b/components/esp_matter/data_model/generated/clusters/operational_state/operational_state.h new file mode 100644 index 000000000..dc7330d47 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/operational_state/operational_state.h @@ -0,0 +1,55 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace operational_state { + +namespace attribute { +attribute_t *create_phase_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_phase(cluster_t *cluster, nullable value); +attribute_t *create_countdown_time(cluster_t *cluster, nullable value); +attribute_t *create_operational_state_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_operational_state(cluster_t *cluster, uint8_t value); +attribute_t *create_operational_error(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_pause(cluster_t *cluster); +command_t *create_stop(cluster_t *cluster); +command_t *create_start(cluster_t *cluster); +command_t *create_resume(cluster_t *cluster); +command_t *create_operational_command_response(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_operational_error(cluster_t *cluster); +event_t *create_operation_completion(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* operational_state */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/operational_state/operational_state_ids.h b/components/esp_matter/data_model/generated/clusters/operational_state/operational_state_ids.h new file mode 100644 index 000000000..77e21f2d2 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/operational_state/operational_state_ids.h @@ -0,0 +1,76 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace operational_state { + +inline constexpr uint32_t Id = 0x0060; + +namespace attribute { +namespace PhaseList { +inline constexpr uint32_t Id = 0x0000; +} /* PhaseList */ +namespace CurrentPhase { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentPhase */ +namespace CountdownTime { +inline constexpr uint32_t Id = 0x0002; +} /* CountdownTime */ +namespace OperationalStateList { +inline constexpr uint32_t Id = 0x0003; +} /* OperationalStateList */ +namespace OperationalState { +inline constexpr uint32_t Id = 0x0004; +} /* OperationalState */ +namespace OperationalError { +inline constexpr uint32_t Id = 0x0005; +} /* OperationalError */ +} /* attribute */ + +namespace command { +namespace Pause { +inline constexpr uint32_t Id = 0x00; +} /* Pause */ +namespace Stop { +inline constexpr uint32_t Id = 0x01; +} /* Stop */ +namespace Start { +inline constexpr uint32_t Id = 0x02; +} /* Start */ +namespace Resume { +inline constexpr uint32_t Id = 0x03; +} /* Resume */ +namespace OperationalCommandResponse { +inline constexpr uint32_t Id = 0x04; +} /* OperationalCommandResponse */ +} /* command */ + +namespace event { +namespace OperationalError { +inline constexpr uint32_t Id = 0x00; +} /* OperationalError */ +namespace OperationCompletion { +inline constexpr uint32_t Id = 0x01; +} /* OperationCompletion */ +} /* event */ + +} /* operational_state */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ota_software_update_provider/ota_software_update_provider.cpp b/components/esp_matter/data_model/generated/clusters/ota_software_update_provider/ota_software_update_provider.cpp new file mode 100644 index 000000000..c8d8f8d27 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ota_software_update_provider/ota_software_update_provider.cpp @@ -0,0 +1,114 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "ota_software_update_provider_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace ota_software_update_provider { + +namespace command { +command_t *create_query_image(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, QueryImage::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_query_image_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, QueryImageResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_apply_update_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ApplyUpdateRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_apply_update_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ApplyUpdateResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_notify_update_applied(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, NotifyUpdateApplied::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, ota_software_update_provider::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, ota_software_update_provider::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = OtaSoftwareUpdateProviderDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterOtaSoftwareUpdateProviderPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_query_image(cluster); + command::create_query_image_response(cluster); + command::create_apply_update_request(cluster); + command::create_apply_update_response(cluster); + command::create_notify_update_applied(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterOtaSoftwareUpdateProviderClusterServerInitCallback, + ESPMatterOtaSoftwareUpdateProviderClusterServerShutdownCallback); + } + + return cluster; +} + +} /* ota_software_update_provider */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ota_software_update_provider/ota_software_update_provider.h b/components/esp_matter/data_model/generated/clusters/ota_software_update_provider/ota_software_update_provider.h new file mode 100644 index 000000000..9f26967b1 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ota_software_update_provider/ota_software_update_provider.h @@ -0,0 +1,41 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace ota_software_update_provider { + +namespace command { +command_t *create_query_image(cluster_t *cluster); +command_t *create_query_image_response(cluster_t *cluster); +command_t *create_apply_update_request(cluster_t *cluster); +command_t *create_apply_update_response(cluster_t *cluster); +command_t *create_notify_update_applied(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* ota_software_update_provider */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ota_software_update_provider/ota_software_update_provider_ids.h b/components/esp_matter/data_model/generated/clusters/ota_software_update_provider/ota_software_update_provider_ids.h new file mode 100644 index 000000000..4724b3ea3 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ota_software_update_provider/ota_software_update_provider_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace ota_software_update_provider { + +inline constexpr uint32_t Id = 0x0029; + +namespace command { +namespace QueryImage { +inline constexpr uint32_t Id = 0x00; +} /* QueryImage */ +namespace QueryImageResponse { +inline constexpr uint32_t Id = 0x01; +} /* QueryImageResponse */ +namespace ApplyUpdateRequest { +inline constexpr uint32_t Id = 0x02; +} /* ApplyUpdateRequest */ +namespace ApplyUpdateResponse { +inline constexpr uint32_t Id = 0x03; +} /* ApplyUpdateResponse */ +namespace NotifyUpdateApplied { +inline constexpr uint32_t Id = 0x04; +} /* NotifyUpdateApplied */ +} /* command */ + +} /* ota_software_update_provider */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ota_software_update_requestor/ota_software_update_requestor.cpp b/components/esp_matter/data_model/generated/clusters/ota_software_update_requestor/ota_software_update_requestor.cpp new file mode 100644 index 000000000..b00662367 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ota_software_update_requestor/ota_software_update_requestor.cpp @@ -0,0 +1,142 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "ota_software_update_requestor_cluster"; +constexpr uint16_t cluster_revision = 1; + +static esp_err_t esp_matter_command_callback_announce_ota_provider(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::OtaSoftwareUpdateRequestor::Commands::AnnounceOTAProvider::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfOtaSoftwareUpdateRequestorClusterAnnounceOTAProviderCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace ota_software_update_requestor { + +namespace attribute { +attribute_t *create_default_ota_providers(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, DefaultOTAProviders::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_update_possible(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, UpdatePossible::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_update_state(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, UpdateState::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(8)); + return attribute; +} + +attribute_t *create_update_state_progress(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, UpdateStateProgress::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(100)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_announce_ota_provider(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AnnounceOTAProvider::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_announce_ota_provider); +} + +} /* command */ + +namespace event { +event_t *create_state_transition(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, StateTransition::Id); +} + +event_t *create_version_applied(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, VersionApplied::Id); +} + +event_t *create_download_error(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, DownloadError::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, ota_software_update_requestor::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, ota_software_update_requestor::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterOtaSoftwareUpdateRequestorPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_update_possible(cluster, config->update_possible); + attribute::create_update_state(cluster, config->update_state); + attribute::create_update_state_progress(cluster, config->update_state_progress); + attribute::create_default_ota_providers(cluster, NULL, 0, 0); + /* Events */ + event::create_state_transition(cluster); + event::create_version_applied(cluster); + event::create_download_error(cluster); + } + + return cluster; +} + +} /* ota_software_update_requestor */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ota_software_update_requestor/ota_software_update_requestor.h b/components/esp_matter/data_model/generated/clusters/ota_software_update_requestor/ota_software_update_requestor.h new file mode 100644 index 000000000..6d46f9888 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ota_software_update_requestor/ota_software_update_requestor.h @@ -0,0 +1,52 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace ota_software_update_requestor { + +namespace attribute { +attribute_t *create_default_ota_providers(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_update_possible(cluster_t *cluster, bool value); +attribute_t *create_update_state(cluster_t *cluster, uint8_t value); +attribute_t *create_update_state_progress(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_announce_ota_provider(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_state_transition(cluster_t *cluster); +event_t *create_version_applied(cluster_t *cluster); +event_t *create_download_error(cluster_t *cluster); +} /* event */ + +typedef struct config { + bool update_possible; + uint8_t update_state; + nullable update_state_progress; + config() : update_possible(true), update_state(0), update_state_progress(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* ota_software_update_requestor */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ota_software_update_requestor/ota_software_update_requestor_ids.h b/components/esp_matter/data_model/generated/clusters/ota_software_update_requestor/ota_software_update_requestor_ids.h new file mode 100644 index 000000000..ae4930db0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ota_software_update_requestor/ota_software_update_requestor_ids.h @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace ota_software_update_requestor { + +inline constexpr uint32_t Id = 0x002A; + +namespace attribute { +namespace DefaultOTAProviders { +inline constexpr uint32_t Id = 0x0000; +} /* DefaultOTAProviders */ +namespace UpdatePossible { +inline constexpr uint32_t Id = 0x0001; +} /* UpdatePossible */ +namespace UpdateState { +inline constexpr uint32_t Id = 0x0002; +} /* UpdateState */ +namespace UpdateStateProgress { +inline constexpr uint32_t Id = 0x0003; +} /* UpdateStateProgress */ +} /* attribute */ + +namespace command { +namespace AnnounceOTAProvider { +inline constexpr uint32_t Id = 0x00; +} /* AnnounceOTAProvider */ +} /* command */ + +namespace event { +namespace StateTransition { +inline constexpr uint32_t Id = 0x00; +} /* StateTransition */ +namespace VersionApplied { +inline constexpr uint32_t Id = 0x01; +} /* VersionApplied */ +namespace DownloadError { +inline constexpr uint32_t Id = 0x02; +} /* DownloadError */ +} /* event */ + +} /* ota_software_update_requestor */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/oven_cavity_operational_state/oven_cavity_operational_state.cpp b/components/esp_matter/data_model/generated/clusters/oven_cavity_operational_state/oven_cavity_operational_state.cpp new file mode 100644 index 000000000..7e6bc08ed --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/oven_cavity_operational_state/oven_cavity_operational_state.cpp @@ -0,0 +1,147 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "oven_cavity_operational_state_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace oven_cavity_operational_state { + +namespace attribute { +attribute_t *create_phase_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, PhaseList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_phase(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CurrentPhase::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); +} + +attribute_t *create_countdown_time(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CountdownTime::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_operational_state_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, OperationalStateList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_operational_state(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, OperationalState::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_operational_error(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, OperationalError::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_stop(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Stop::Id, COMMAND_FLAG_NONE, NULL); +} + +command_t *create_start(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Start::Id, COMMAND_FLAG_NONE, NULL); +} + +command_t *create_operational_command_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, OperationalCommandResponse::Id, COMMAND_FLAG_NONE, NULL); +} + +} /* command */ + +namespace event { +event_t *create_operational_error(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, OperationalError::Id); +} + +event_t *create_operation_completion(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, OperationCompletion::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, oven_cavity_operational_state::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, oven_cavity_operational_state::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = OvenCavityOperationalStateDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterOvenCavityOperationalStatePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_phase_list(cluster, NULL, 0, 0); + attribute::create_current_phase(cluster, 0); + attribute::create_operational_state_list(cluster, NULL, 0, 0); + attribute::create_operational_state(cluster, 0); + attribute::create_operational_error(cluster, NULL, 0, 0); + /* Events */ + event::create_operational_error(cluster); + } + + return cluster; +} + +} /* oven_cavity_operational_state */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/oven_cavity_operational_state/oven_cavity_operational_state.h b/components/esp_matter/data_model/generated/clusters/oven_cavity_operational_state/oven_cavity_operational_state.h new file mode 100644 index 000000000..57775c71e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/oven_cavity_operational_state/oven_cavity_operational_state.h @@ -0,0 +1,53 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace oven_cavity_operational_state { + +namespace attribute { +attribute_t *create_phase_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_phase(cluster_t *cluster, nullable value); +attribute_t *create_countdown_time(cluster_t *cluster, nullable value); +attribute_t *create_operational_state_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_operational_state(cluster_t *cluster, uint8_t value); +attribute_t *create_operational_error(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_stop(cluster_t *cluster); +command_t *create_start(cluster_t *cluster); +command_t *create_operational_command_response(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_operational_error(cluster_t *cluster); +event_t *create_operation_completion(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* oven_cavity_operational_state */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/oven_cavity_operational_state/oven_cavity_operational_state_ids.h b/components/esp_matter/data_model/generated/clusters/oven_cavity_operational_state/oven_cavity_operational_state_ids.h new file mode 100644 index 000000000..aa523f36d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/oven_cavity_operational_state/oven_cavity_operational_state_ids.h @@ -0,0 +1,70 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace oven_cavity_operational_state { + +inline constexpr uint32_t Id = 0x0048; + +namespace attribute { +namespace PhaseList { +inline constexpr uint32_t Id = 0x0000; +} /* PhaseList */ +namespace CurrentPhase { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentPhase */ +namespace CountdownTime { +inline constexpr uint32_t Id = 0x0002; +} /* CountdownTime */ +namespace OperationalStateList { +inline constexpr uint32_t Id = 0x0003; +} /* OperationalStateList */ +namespace OperationalState { +inline constexpr uint32_t Id = 0x0004; +} /* OperationalState */ +namespace OperationalError { +inline constexpr uint32_t Id = 0x0005; +} /* OperationalError */ +} /* attribute */ + +namespace command { +namespace Stop { +inline constexpr uint32_t Id = 0x01; +} /* Stop */ +namespace Start { +inline constexpr uint32_t Id = 0x02; +} /* Start */ +namespace OperationalCommandResponse { +inline constexpr uint32_t Id = 0x04; +} /* OperationalCommandResponse */ +} /* command */ + +namespace event { +namespace OperationalError { +inline constexpr uint32_t Id = 0x00; +} /* OperationalError */ +namespace OperationCompletion { +inline constexpr uint32_t Id = 0x01; +} /* OperationCompletion */ +} /* event */ + +} /* oven_cavity_operational_state */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/oven_mode/oven_mode.cpp b/components/esp_matter/data_model/generated/clusters/oven_mode/oven_mode.cpp new file mode 100644 index 000000000..2a98b1c92 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/oven_mode/oven_mode.cpp @@ -0,0 +1,107 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "oven_mode_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace oven_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedModes::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_change_to_mode(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToMode::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_change_to_mode_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToModeResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, oven_mode::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, oven_mode::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = OvenModeDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterOvenModePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_change_to_mode(cluster); + command::create_change_to_mode_response(cluster); + } + + return cluster; +} + +} /* oven_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/oven_mode/oven_mode.h b/components/esp_matter/data_model/generated/clusters/oven_mode/oven_mode.h new file mode 100644 index 000000000..693348484 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/oven_mode/oven_mode.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace oven_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_change_to_mode(cluster_t *cluster); +command_t *create_change_to_mode_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* oven_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/oven_mode/oven_mode_ids.h b/components/esp_matter/data_model/generated/clusters/oven_mode/oven_mode_ids.h new file mode 100644 index 000000000..80cdc2938 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/oven_mode/oven_mode_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace oven_mode { + +inline constexpr uint32_t Id = 0x0049; + +namespace attribute { +namespace SupportedModes { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedModes */ +namespace CurrentMode { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentMode */ +} /* attribute */ + +namespace command { +namespace ChangeToMode { +inline constexpr uint32_t Id = 0x00; +} /* ChangeToMode */ +namespace ChangeToModeResponse { +inline constexpr uint32_t Id = 0x01; +} /* ChangeToModeResponse */ +} /* command */ + +} /* oven_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ozone_concentration_measurement/ozone_concentration_measurement.cpp b/components/esp_matter/data_model/generated/clusters/ozone_concentration_measurement/ozone_concentration_measurement.cpp new file mode 100644 index 000000000..6342e728c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ozone_concentration_measurement/ozone_concentration_measurement.cpp @@ -0,0 +1,289 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "ozone_concentration_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace ozone_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id() +{ + return NumericMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_measured_value(cluster, 0); + attribute::create_min_measured_value(cluster, 0); + attribute::create_max_measured_value(cluster, 0); + attribute::create_measurement_unit(cluster, 0); + + return ESP_OK; +} +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id() +{ + return LevelIndication::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_level_value(cluster, 0); + + return ESP_OK; +} +} /* level_indication */ + +namespace medium_level { +uint32_t get_id() +{ + return MediumLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* medium_level */ + +namespace critical_level { +uint32_t get_id() +{ + return CriticalLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id() +{ + return PeakMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_peak_measured_value(cluster, 0); + attribute::create_peak_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id() +{ + return AverageMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_average_measured_value(cluster, 0); + attribute::create_average_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_uncertainty(cluster_t *cluster, float value) +{ + return esp_matter::attribute::create(cluster, Uncertainty::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_float(value)); +} + +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasurementUnit::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, MeasurementMedium::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_level_value(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(level_indication), NULL); + return esp_matter::attribute::create(cluster, LevelValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, ozone_concentration_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, ozone_concentration_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterOzoneConcentrationMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measurement_medium(cluster, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("NumericMeasurement,LevelIndication", + feature::numeric_measurement::get_id(), feature::level_indication::get_id()); + if (feature_map & feature::numeric_measurement::get_id()) { + VerifyOrReturnValue(feature::numeric_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::level_indication::get_id()) { + VerifyOrReturnValue(feature::level_indication::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::medium_level::get_id()) { + VerifyOrReturnValue(feature::medium_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::critical_level::get_id()) { + VerifyOrReturnValue(feature::critical_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::peak_measurement::get_id()) { + VerifyOrReturnValue(feature::peak_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::average_measurement::get_id()) { + VerifyOrReturnValue(feature::average_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* ozone_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ozone_concentration_measurement/ozone_concentration_measurement.h b/components/esp_matter/data_model/generated/clusters/ozone_concentration_measurement/ozone_concentration_measurement.h new file mode 100644 index 000000000..79b21655c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ozone_concentration_measurement/ozone_concentration_measurement.h @@ -0,0 +1,80 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace ozone_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* level_indication */ + +namespace medium_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* medium_level */ + +namespace critical_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_uncertainty(cluster_t *cluster, float value); +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value); +attribute_t *create_level_value(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* ozone_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/ozone_concentration_measurement/ozone_concentration_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/ozone_concentration_measurement/ozone_concentration_measurement_ids.h new file mode 100644 index 000000000..21d2c2f13 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/ozone_concentration_measurement/ozone_concentration_measurement_ids.h @@ -0,0 +1,85 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace ozone_concentration_measurement { + +inline constexpr uint32_t Id = 0x0415; + +namespace feature { +namespace NumericMeasurement { +inline constexpr uint32_t Id = 0x1; +} /* NumericMeasurement */ +namespace LevelIndication { +inline constexpr uint32_t Id = 0x2; +} /* LevelIndication */ +namespace MediumLevel { +inline constexpr uint32_t Id = 0x4; +} /* MediumLevel */ +namespace CriticalLevel { +inline constexpr uint32_t Id = 0x8; +} /* CriticalLevel */ +namespace PeakMeasurement { +inline constexpr uint32_t Id = 0x10; +} /* PeakMeasurement */ +namespace AverageMeasurement { +inline constexpr uint32_t Id = 0x20; +} /* AverageMeasurement */ +} /* feature */ + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace PeakMeasuredValue { +inline constexpr uint32_t Id = 0x0003; +} /* PeakMeasuredValue */ +namespace PeakMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0004; +} /* PeakMeasuredValueWindow */ +namespace AverageMeasuredValue { +inline constexpr uint32_t Id = 0x0005; +} /* AverageMeasuredValue */ +namespace AverageMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0006; +} /* AverageMeasuredValueWindow */ +namespace Uncertainty { +inline constexpr uint32_t Id = 0x0007; +} /* Uncertainty */ +namespace MeasurementUnit { +inline constexpr uint32_t Id = 0x0008; +} /* MeasurementUnit */ +namespace MeasurementMedium { +inline constexpr uint32_t Id = 0x0009; +} /* MeasurementMedium */ +namespace LevelValue { +inline constexpr uint32_t Id = 0x000A; +} /* LevelValue */ +} /* attribute */ + +} /* ozone_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pm10_concentration_measurement/pm10_concentration_measurement.cpp b/components/esp_matter/data_model/generated/clusters/pm10_concentration_measurement/pm10_concentration_measurement.cpp new file mode 100644 index 000000000..577e5d964 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pm10_concentration_measurement/pm10_concentration_measurement.cpp @@ -0,0 +1,301 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "pm10_concentration_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace pm10_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id() +{ + return NumericMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_measured_value(cluster, config->measured_value); + attribute::create_min_measured_value(cluster, config->min_measured_value); + attribute::create_max_measured_value(cluster, config->max_measured_value); + attribute::create_measurement_unit(cluster, config->measurement_unit); + + return ESP_OK; +} +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id() +{ + return LevelIndication::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_level_value(cluster, config->level_value); + + return ESP_OK; +} +} /* level_indication */ + +namespace medium_level { +uint32_t get_id() +{ + return MediumLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* medium_level */ + +namespace critical_level { +uint32_t get_id() +{ + return CriticalLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id() +{ + return PeakMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_peak_measured_value(cluster, config->peak_measured_value); + attribute::create_peak_measured_value_window(cluster, config->peak_measured_value_window); + + return ESP_OK; +} +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id() +{ + return AverageMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_average_measured_value(cluster, config->average_measured_value); + attribute::create_average_measured_value_window(cluster, config->average_measured_value_window); + + return ESP_OK; +} +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, PeakMeasuredValueWindow::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(604800)); + return attribute; +} + +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, AverageMeasuredValueWindow::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(604800)); + return attribute; +} + +attribute_t *create_uncertainty(cluster_t *cluster, float value) +{ + return esp_matter::attribute::create(cluster, Uncertainty::Id, ATTRIBUTE_FLAG_NONE, esp_matter_float(value)); +} + +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MeasurementUnit::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(7)); + return attribute; +} + +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MeasurementMedium::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_level_value(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(level_indication), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, LevelValue::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(4)); + return attribute; +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, pm10_concentration_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, pm10_concentration_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measurement_medium(cluster, config->measurement_medium); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("NumericMeasurement,LevelIndication", + feature::numeric_measurement::get_id(), feature::level_indication::get_id()); + if (feature_map & feature::numeric_measurement::get_id()) { + VerifyOrReturnValue(feature::numeric_measurement::add(cluster, &(config->features.numeric_measurement)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::level_indication::get_id()) { + VerifyOrReturnValue(feature::level_indication::add(cluster, &(config->features.level_indication)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::medium_level::get_id()) { + VerifyOrReturnValue(feature::medium_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::critical_level::get_id()) { + VerifyOrReturnValue(feature::critical_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::peak_measurement::get_id()) { + VerifyOrReturnValue(feature::peak_measurement::add(cluster, &(config->features.peak_measurement)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::average_measurement::get_id()) { + VerifyOrReturnValue(feature::average_measurement::add(cluster, &(config->features.average_measurement)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* pm10_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pm10_concentration_measurement/pm10_concentration_measurement.h b/components/esp_matter/data_model/generated/clusters/pm10_concentration_measurement/pm10_concentration_measurement.h new file mode 100644 index 000000000..5b96fc84d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pm10_concentration_measurement/pm10_concentration_measurement.h @@ -0,0 +1,108 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace pm10_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + uint8_t measurement_unit; + config() : measured_value(0), min_measured_value(0), max_measured_value(0), measurement_unit(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* numeric_measurement */ + +namespace level_indication { +typedef struct config { + uint8_t level_value; + config() : level_value(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* level_indication */ + +namespace medium_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* medium_level */ + +namespace critical_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* critical_level */ + +namespace peak_measurement { +typedef struct config { + nullable peak_measured_value; + uint32_t peak_measured_value_window; + config() : peak_measured_value(0), peak_measured_value_window(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* peak_measurement */ + +namespace average_measurement { +typedef struct config { + nullable average_measured_value; + uint32_t average_measured_value_window; + config() : average_measured_value(0), average_measured_value_window(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_uncertainty(cluster_t *cluster, float value); +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value); +attribute_t *create_level_value(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + uint8_t measurement_medium; + struct { + feature::numeric_measurement::config_t numeric_measurement; + feature::level_indication::config_t level_indication; + feature::peak_measurement::config_t peak_measurement; + feature::average_measurement::config_t average_measurement; + } features; + uint32_t feature_flags; + config() : measurement_medium(0), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* pm10_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pm10_concentration_measurement/pm10_concentration_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/pm10_concentration_measurement/pm10_concentration_measurement_ids.h new file mode 100644 index 000000000..389d1d028 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pm10_concentration_measurement/pm10_concentration_measurement_ids.h @@ -0,0 +1,85 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace pm10_concentration_measurement { + +inline constexpr uint32_t Id = 0x042D; + +namespace feature { +namespace NumericMeasurement { +inline constexpr uint32_t Id = 0x1; +} /* NumericMeasurement */ +namespace LevelIndication { +inline constexpr uint32_t Id = 0x2; +} /* LevelIndication */ +namespace MediumLevel { +inline constexpr uint32_t Id = 0x4; +} /* MediumLevel */ +namespace CriticalLevel { +inline constexpr uint32_t Id = 0x8; +} /* CriticalLevel */ +namespace PeakMeasurement { +inline constexpr uint32_t Id = 0x10; +} /* PeakMeasurement */ +namespace AverageMeasurement { +inline constexpr uint32_t Id = 0x20; +} /* AverageMeasurement */ +} /* feature */ + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace PeakMeasuredValue { +inline constexpr uint32_t Id = 0x0003; +} /* PeakMeasuredValue */ +namespace PeakMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0004; +} /* PeakMeasuredValueWindow */ +namespace AverageMeasuredValue { +inline constexpr uint32_t Id = 0x0005; +} /* AverageMeasuredValue */ +namespace AverageMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0006; +} /* AverageMeasuredValueWindow */ +namespace Uncertainty { +inline constexpr uint32_t Id = 0x0007; +} /* Uncertainty */ +namespace MeasurementUnit { +inline constexpr uint32_t Id = 0x0008; +} /* MeasurementUnit */ +namespace MeasurementMedium { +inline constexpr uint32_t Id = 0x0009; +} /* MeasurementMedium */ +namespace LevelValue { +inline constexpr uint32_t Id = 0x000A; +} /* LevelValue */ +} /* attribute */ + +} /* pm10_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pm1_concentration_measurement/pm1_concentration_measurement.cpp b/components/esp_matter/data_model/generated/clusters/pm1_concentration_measurement/pm1_concentration_measurement.cpp new file mode 100644 index 000000000..7bbdcc53e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pm1_concentration_measurement/pm1_concentration_measurement.cpp @@ -0,0 +1,301 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "pm1_concentration_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace pm1_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id() +{ + return NumericMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_measured_value(cluster, config->measured_value); + attribute::create_min_measured_value(cluster, config->min_measured_value); + attribute::create_max_measured_value(cluster, config->max_measured_value); + attribute::create_measurement_unit(cluster, config->measurement_unit); + + return ESP_OK; +} +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id() +{ + return LevelIndication::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_level_value(cluster, config->level_value); + + return ESP_OK; +} +} /* level_indication */ + +namespace medium_level { +uint32_t get_id() +{ + return MediumLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* medium_level */ + +namespace critical_level { +uint32_t get_id() +{ + return CriticalLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id() +{ + return PeakMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_peak_measured_value(cluster, config->peak_measured_value); + attribute::create_peak_measured_value_window(cluster, config->peak_measured_value_window); + + return ESP_OK; +} +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id() +{ + return AverageMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_average_measured_value(cluster, config->average_measured_value); + attribute::create_average_measured_value_window(cluster, config->average_measured_value_window); + + return ESP_OK; +} +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, PeakMeasuredValueWindow::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(604800)); + return attribute; +} + +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, AverageMeasuredValueWindow::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(604800)); + return attribute; +} + +attribute_t *create_uncertainty(cluster_t *cluster, float value) +{ + return esp_matter::attribute::create(cluster, Uncertainty::Id, ATTRIBUTE_FLAG_NONE, esp_matter_float(value)); +} + +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MeasurementUnit::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(7)); + return attribute; +} + +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MeasurementMedium::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_level_value(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(level_indication), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, LevelValue::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(4)); + return attribute; +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, pm1_concentration_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, pm1_concentration_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measurement_medium(cluster, config->measurement_medium); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("NumericMeasurement,LevelIndication", + feature::numeric_measurement::get_id(), feature::level_indication::get_id()); + if (feature_map & feature::numeric_measurement::get_id()) { + VerifyOrReturnValue(feature::numeric_measurement::add(cluster, &(config->features.numeric_measurement)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::level_indication::get_id()) { + VerifyOrReturnValue(feature::level_indication::add(cluster, &(config->features.level_indication)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::medium_level::get_id()) { + VerifyOrReturnValue(feature::medium_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::critical_level::get_id()) { + VerifyOrReturnValue(feature::critical_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::peak_measurement::get_id()) { + VerifyOrReturnValue(feature::peak_measurement::add(cluster, &(config->features.peak_measurement)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::average_measurement::get_id()) { + VerifyOrReturnValue(feature::average_measurement::add(cluster, &(config->features.average_measurement)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* pm1_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pm1_concentration_measurement/pm1_concentration_measurement.h b/components/esp_matter/data_model/generated/clusters/pm1_concentration_measurement/pm1_concentration_measurement.h new file mode 100644 index 000000000..4bd8ea2b4 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pm1_concentration_measurement/pm1_concentration_measurement.h @@ -0,0 +1,108 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace pm1_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + uint8_t measurement_unit; + config() : measured_value(0), min_measured_value(0), max_measured_value(0), measurement_unit(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* numeric_measurement */ + +namespace level_indication { +typedef struct config { + uint8_t level_value; + config() : level_value(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* level_indication */ + +namespace medium_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* medium_level */ + +namespace critical_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* critical_level */ + +namespace peak_measurement { +typedef struct config { + nullable peak_measured_value; + uint32_t peak_measured_value_window; + config() : peak_measured_value(0), peak_measured_value_window(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* peak_measurement */ + +namespace average_measurement { +typedef struct config { + nullable average_measured_value; + uint32_t average_measured_value_window; + config() : average_measured_value(0), average_measured_value_window(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_uncertainty(cluster_t *cluster, float value); +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value); +attribute_t *create_level_value(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + uint8_t measurement_medium; + struct { + feature::numeric_measurement::config_t numeric_measurement; + feature::level_indication::config_t level_indication; + feature::peak_measurement::config_t peak_measurement; + feature::average_measurement::config_t average_measurement; + } features; + uint32_t feature_flags; + config() : measurement_medium(0), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* pm1_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pm1_concentration_measurement/pm1_concentration_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/pm1_concentration_measurement/pm1_concentration_measurement_ids.h new file mode 100644 index 000000000..41464e50d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pm1_concentration_measurement/pm1_concentration_measurement_ids.h @@ -0,0 +1,85 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace pm1_concentration_measurement { + +inline constexpr uint32_t Id = 0x042C; + +namespace feature { +namespace NumericMeasurement { +inline constexpr uint32_t Id = 0x1; +} /* NumericMeasurement */ +namespace LevelIndication { +inline constexpr uint32_t Id = 0x2; +} /* LevelIndication */ +namespace MediumLevel { +inline constexpr uint32_t Id = 0x4; +} /* MediumLevel */ +namespace CriticalLevel { +inline constexpr uint32_t Id = 0x8; +} /* CriticalLevel */ +namespace PeakMeasurement { +inline constexpr uint32_t Id = 0x10; +} /* PeakMeasurement */ +namespace AverageMeasurement { +inline constexpr uint32_t Id = 0x20; +} /* AverageMeasurement */ +} /* feature */ + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace PeakMeasuredValue { +inline constexpr uint32_t Id = 0x0003; +} /* PeakMeasuredValue */ +namespace PeakMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0004; +} /* PeakMeasuredValueWindow */ +namespace AverageMeasuredValue { +inline constexpr uint32_t Id = 0x0005; +} /* AverageMeasuredValue */ +namespace AverageMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0006; +} /* AverageMeasuredValueWindow */ +namespace Uncertainty { +inline constexpr uint32_t Id = 0x0007; +} /* Uncertainty */ +namespace MeasurementUnit { +inline constexpr uint32_t Id = 0x0008; +} /* MeasurementUnit */ +namespace MeasurementMedium { +inline constexpr uint32_t Id = 0x0009; +} /* MeasurementMedium */ +namespace LevelValue { +inline constexpr uint32_t Id = 0x000A; +} /* LevelValue */ +} /* attribute */ + +} /* pm1_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pm2_5_concentration_measurement/pm2_5_concentration_measurement.cpp b/components/esp_matter/data_model/generated/clusters/pm2_5_concentration_measurement/pm2_5_concentration_measurement.cpp new file mode 100644 index 000000000..cbccc43c8 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pm2_5_concentration_measurement/pm2_5_concentration_measurement.cpp @@ -0,0 +1,301 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "pm2_5_concentration_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace pm2_5_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id() +{ + return NumericMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_measured_value(cluster, config->measured_value); + attribute::create_min_measured_value(cluster, config->min_measured_value); + attribute::create_max_measured_value(cluster, config->max_measured_value); + attribute::create_measurement_unit(cluster, config->measurement_unit); + + return ESP_OK; +} +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id() +{ + return LevelIndication::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_level_value(cluster, config->level_value); + + return ESP_OK; +} +} /* level_indication */ + +namespace medium_level { +uint32_t get_id() +{ + return MediumLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* medium_level */ + +namespace critical_level { +uint32_t get_id() +{ + return CriticalLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id() +{ + return PeakMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_peak_measured_value(cluster, config->peak_measured_value); + attribute::create_peak_measured_value_window(cluster, config->peak_measured_value_window); + + return ESP_OK; +} +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id() +{ + return AverageMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_average_measured_value(cluster, config->average_measured_value); + attribute::create_average_measured_value_window(cluster, config->average_measured_value_window); + + return ESP_OK; +} +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, PeakMeasuredValueWindow::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(604800)); + return attribute; +} + +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, AverageMeasuredValueWindow::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(604800)); + return attribute; +} + +attribute_t *create_uncertainty(cluster_t *cluster, float value) +{ + return esp_matter::attribute::create(cluster, Uncertainty::Id, ATTRIBUTE_FLAG_NONE, esp_matter_float(value)); +} + +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MeasurementUnit::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(7)); + return attribute; +} + +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MeasurementMedium::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_level_value(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(level_indication), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, LevelValue::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(4)); + return attribute; +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, pm2_5_concentration_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, pm2_5_concentration_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measurement_medium(cluster, config->measurement_medium); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("NumericMeasurement,LevelIndication", + feature::numeric_measurement::get_id(), feature::level_indication::get_id()); + if (feature_map & feature::numeric_measurement::get_id()) { + VerifyOrReturnValue(feature::numeric_measurement::add(cluster, &(config->features.numeric_measurement)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::level_indication::get_id()) { + VerifyOrReturnValue(feature::level_indication::add(cluster, &(config->features.level_indication)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::medium_level::get_id()) { + VerifyOrReturnValue(feature::medium_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::critical_level::get_id()) { + VerifyOrReturnValue(feature::critical_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::peak_measurement::get_id()) { + VerifyOrReturnValue(feature::peak_measurement::add(cluster, &(config->features.peak_measurement)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::average_measurement::get_id()) { + VerifyOrReturnValue(feature::average_measurement::add(cluster, &(config->features.average_measurement)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* pm2_5_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pm2_5_concentration_measurement/pm2_5_concentration_measurement.h b/components/esp_matter/data_model/generated/clusters/pm2_5_concentration_measurement/pm2_5_concentration_measurement.h new file mode 100644 index 000000000..8e8083332 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pm2_5_concentration_measurement/pm2_5_concentration_measurement.h @@ -0,0 +1,108 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace pm2_5_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + uint8_t measurement_unit; + config() : measured_value(0), min_measured_value(0), max_measured_value(0), measurement_unit(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* numeric_measurement */ + +namespace level_indication { +typedef struct config { + uint8_t level_value; + config() : level_value(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* level_indication */ + +namespace medium_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* medium_level */ + +namespace critical_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* critical_level */ + +namespace peak_measurement { +typedef struct config { + nullable peak_measured_value; + uint32_t peak_measured_value_window; + config() : peak_measured_value(0), peak_measured_value_window(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* peak_measurement */ + +namespace average_measurement { +typedef struct config { + nullable average_measured_value; + uint32_t average_measured_value_window; + config() : average_measured_value(0), average_measured_value_window(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_uncertainty(cluster_t *cluster, float value); +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value); +attribute_t *create_level_value(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + uint8_t measurement_medium; + struct { + feature::numeric_measurement::config_t numeric_measurement; + feature::level_indication::config_t level_indication; + feature::peak_measurement::config_t peak_measurement; + feature::average_measurement::config_t average_measurement; + } features; + uint32_t feature_flags; + config() : measurement_medium(0), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* pm2_5_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pm2_5_concentration_measurement/pm2_5_concentration_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/pm2_5_concentration_measurement/pm2_5_concentration_measurement_ids.h new file mode 100644 index 000000000..0e8331d38 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pm2_5_concentration_measurement/pm2_5_concentration_measurement_ids.h @@ -0,0 +1,85 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace pm2_5_concentration_measurement { + +inline constexpr uint32_t Id = 0x042A; + +namespace feature { +namespace NumericMeasurement { +inline constexpr uint32_t Id = 0x1; +} /* NumericMeasurement */ +namespace LevelIndication { +inline constexpr uint32_t Id = 0x2; +} /* LevelIndication */ +namespace MediumLevel { +inline constexpr uint32_t Id = 0x4; +} /* MediumLevel */ +namespace CriticalLevel { +inline constexpr uint32_t Id = 0x8; +} /* CriticalLevel */ +namespace PeakMeasurement { +inline constexpr uint32_t Id = 0x10; +} /* PeakMeasurement */ +namespace AverageMeasurement { +inline constexpr uint32_t Id = 0x20; +} /* AverageMeasurement */ +} /* feature */ + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace PeakMeasuredValue { +inline constexpr uint32_t Id = 0x0003; +} /* PeakMeasuredValue */ +namespace PeakMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0004; +} /* PeakMeasuredValueWindow */ +namespace AverageMeasuredValue { +inline constexpr uint32_t Id = 0x0005; +} /* AverageMeasuredValue */ +namespace AverageMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0006; +} /* AverageMeasuredValueWindow */ +namespace Uncertainty { +inline constexpr uint32_t Id = 0x0007; +} /* Uncertainty */ +namespace MeasurementUnit { +inline constexpr uint32_t Id = 0x0008; +} /* MeasurementUnit */ +namespace MeasurementMedium { +inline constexpr uint32_t Id = 0x0009; +} /* MeasurementMedium */ +namespace LevelValue { +inline constexpr uint32_t Id = 0x000A; +} /* LevelValue */ +} /* attribute */ + +} /* pm2_5_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/power_source/power_source.cpp b/components/esp_matter/data_model/generated/clusters/power_source/power_source.cpp new file mode 100644 index 000000000..b5d6f5ab1 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/power_source/power_source.cpp @@ -0,0 +1,411 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "power_source_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace power_source { + +namespace feature { +namespace wired { +uint32_t get_id() +{ + return Wired::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_wired_current_type(cluster, config->wired_current_type); + + return ESP_OK; +} +} /* wired */ + +namespace battery { +uint32_t get_id() +{ + return Battery::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_bat_charge_level(cluster, config->bat_charge_level); + attribute::create_bat_replacement_needed(cluster, config->bat_replacement_needed); + attribute::create_bat_replaceability(cluster, config->bat_replaceability); + + return ESP_OK; +} +} /* battery */ + +namespace rechargeable { +uint32_t get_id() +{ + return Rechargeable::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(battery), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_bat_charge_state(cluster, config->bat_charge_state); + attribute::create_bat_functional_while_charging(cluster, config->bat_functional_while_charging); + + return ESP_OK; +} +} /* rechargeable */ + +namespace replaceable { +uint32_t get_id() +{ + return Replaceable::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(battery), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_bat_replacement_description(cluster, config->bat_replacement_description, sizeof(config->bat_replacement_description)); + attribute::create_bat_quantity(cluster, config->bat_quantity); + + return ESP_OK; +} +} /* replaceable */ + +} /* feature */ + +namespace attribute { +attribute_t *create_status(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Status::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(3)); + return attribute; +} + +attribute_t *create_order(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Order::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_description(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_description_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, Description::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_description_length + 1); +} + +attribute_t *create_wired_assessed_input_voltage(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, WiredAssessedInputVoltage::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_wired_assessed_input_frequency(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, WiredAssessedInputFrequency::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_wired_current_type(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(wired), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, WiredCurrentType::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(1)); + return attribute; +} + +attribute_t *create_wired_assessed_current(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, WiredAssessedCurrent::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_wired_nominal_voltage(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, WiredNominalVoltage::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +attribute_t *create_wired_maximum_current(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, WiredMaximumCurrent::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +attribute_t *create_wired_present(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, WiredPresent::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_active_wired_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ActiveWiredFaults::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_bat_voltage(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, BatVoltage::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_bat_percent_remaining(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, BatPercentRemaining::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(200)); + return attribute; +} + +attribute_t *create_bat_time_remaining(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, BatTimeRemaining::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_bat_charge_level(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(battery), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, BatChargeLevel::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_bat_replacement_needed(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(battery), NULL); + return esp_matter::attribute::create(cluster, BatReplacementNeeded::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_bat_replaceability(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(battery), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, BatReplaceability::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(3)); + return attribute; +} + +attribute_t *create_bat_present(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, BatPresent::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_active_bat_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ActiveBatFaults::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_bat_replacement_description(cluster_t *cluster, char *value, uint16_t length) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(replaceable), NULL); + VerifyOrReturnValue(length <= k_max_bat_replacement_description_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, BatReplacementDescription::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_bat_replacement_description_length + 1); +} + +attribute_t *create_bat_common_designation(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, BatCommonDesignation::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(80)); + return attribute; +} + +attribute_t *create_bat_ansi_designation(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_bat_ansi_designation_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, BatANSIDesignation::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_bat_ansi_designation_length + 1); +} + +attribute_t *create_bat_iec_designation(cluster_t *cluster, char *value, uint16_t length) +{ + VerifyOrReturnValue(length <= k_max_bat_iec_designation_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, BatIECDesignation::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length), k_max_bat_iec_designation_length + 1); +} + +attribute_t *create_bat_approved_chemistry(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, BatApprovedChemistry::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(32)); + return attribute; +} + +attribute_t *create_bat_capacity(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, BatCapacity::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +attribute_t *create_bat_quantity(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(replaceable), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, BatQuantity::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_bat_charge_state(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(rechargeable), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, BatChargeState::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(3)); + return attribute; +} + +attribute_t *create_bat_time_to_full_charge(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, BatTimeToFullCharge::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_bat_functional_while_charging(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(rechargeable), NULL); + return esp_matter::attribute::create(cluster, BatFunctionalWhileCharging::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_bat_charging_current(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, BatChargingCurrent::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_active_bat_charge_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ActiveBatChargeFaults::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_endpoint_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, EndpointList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +namespace event { +event_t *create_wired_fault_change(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, WiredFaultChange::Id); +} + +event_t *create_bat_fault_change(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, BatFaultChange::Id); +} + +event_t *create_bat_charge_fault_change(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, BatChargeFaultChange::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, power_source::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, power_source::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterPowerSourcePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_status(cluster, config->status); + attribute::create_order(cluster, config->order); + attribute::create_description(cluster, config->description, sizeof(config->description)); + attribute::create_endpoint_list(cluster, NULL, 0, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_EXACT_ONE("Wired,Battery", + feature::wired::get_id(), feature::battery::get_id()); + if (feature_map & feature::wired::get_id()) { + VerifyOrReturnValue(feature::wired::add(cluster, &(config->features.wired)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::battery::get_id()) { + VerifyOrReturnValue(feature::battery::add(cluster, &(config->features.battery)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::rechargeable::get_id()) { + VerifyOrReturnValue(feature::rechargeable::add(cluster, &(config->features.rechargeable)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::replaceable::get_id()) { + VerifyOrReturnValue(feature::replaceable::add(cluster, &(config->features.replaceable)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + return cluster; +} + +} /* power_source */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/power_source/power_source.h b/components/esp_matter/data_model/generated/clusters/power_source/power_source.h new file mode 100644 index 000000000..85afe30c5 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/power_source/power_source.h @@ -0,0 +1,130 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace power_source { + +const uint8_t k_max_description_length = 60u; +const uint8_t k_max_bat_replacement_description_length = 60u; +const uint8_t k_max_bat_ansi_designation_length = 20u; +const uint8_t k_max_bat_iec_designation_length = 20u; +namespace feature { +namespace wired { +typedef struct config { + uint8_t wired_current_type; + config() : wired_current_type(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* wired */ + +namespace battery { +typedef struct config { + uint8_t bat_charge_level; + bool bat_replacement_needed; + uint8_t bat_replaceability; + config() : bat_charge_level(0), bat_replacement_needed(false), bat_replaceability(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* battery */ + +namespace rechargeable { +typedef struct config { + uint8_t bat_charge_state; + bool bat_functional_while_charging; + config() : bat_charge_state(0), bat_functional_while_charging(false) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* rechargeable */ + +namespace replaceable { +typedef struct config { + char bat_replacement_description[k_max_bat_replacement_description_length + 1]; + uint8_t bat_quantity; + config() : bat_quantity(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* replaceable */ + +} /* feature */ + +namespace attribute { +attribute_t *create_status(cluster_t *cluster, uint8_t value); +attribute_t *create_order(cluster_t *cluster, uint8_t value); +attribute_t *create_description(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_wired_assessed_input_voltage(cluster_t *cluster, nullable value); +attribute_t *create_wired_assessed_input_frequency(cluster_t *cluster, nullable value); +attribute_t *create_wired_current_type(cluster_t *cluster, uint8_t value); +attribute_t *create_wired_assessed_current(cluster_t *cluster, nullable value); +attribute_t *create_wired_nominal_voltage(cluster_t *cluster, uint32_t value); +attribute_t *create_wired_maximum_current(cluster_t *cluster, uint32_t value); +attribute_t *create_wired_present(cluster_t *cluster, bool value); +attribute_t *create_active_wired_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_bat_voltage(cluster_t *cluster, nullable value); +attribute_t *create_bat_percent_remaining(cluster_t *cluster, nullable value); +attribute_t *create_bat_time_remaining(cluster_t *cluster, nullable value); +attribute_t *create_bat_charge_level(cluster_t *cluster, uint8_t value); +attribute_t *create_bat_replacement_needed(cluster_t *cluster, bool value); +attribute_t *create_bat_replaceability(cluster_t *cluster, uint8_t value); +attribute_t *create_bat_present(cluster_t *cluster, bool value); +attribute_t *create_active_bat_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_bat_replacement_description(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_bat_common_designation(cluster_t *cluster, uint8_t value); +attribute_t *create_bat_ansi_designation(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_bat_iec_designation(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_bat_approved_chemistry(cluster_t *cluster, uint8_t value); +attribute_t *create_bat_capacity(cluster_t *cluster, uint32_t value); +attribute_t *create_bat_quantity(cluster_t *cluster, uint8_t value); +attribute_t *create_bat_charge_state(cluster_t *cluster, uint8_t value); +attribute_t *create_bat_time_to_full_charge(cluster_t *cluster, nullable value); +attribute_t *create_bat_functional_while_charging(cluster_t *cluster, bool value); +attribute_t *create_bat_charging_current(cluster_t *cluster, nullable value); +attribute_t *create_active_bat_charge_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_endpoint_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace event { +event_t *create_wired_fault_change(cluster_t *cluster); +event_t *create_bat_fault_change(cluster_t *cluster); +event_t *create_bat_charge_fault_change(cluster_t *cluster); +} /* event */ + +typedef struct config { + uint8_t status; + uint8_t order; + char description[k_max_description_length + 1]; + struct { + feature::wired::config_t wired; + feature::battery::config_t battery; + feature::rechargeable::config_t rechargeable; + feature::replaceable::config_t replaceable; + } features; + uint32_t feature_flags; + config() : status(0), order(0), description{0}, feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* power_source */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/power_source/power_source_ids.h b/components/esp_matter/data_model/generated/clusters/power_source/power_source_ids.h new file mode 100644 index 000000000..b3b61be02 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/power_source/power_source_ids.h @@ -0,0 +1,154 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace power_source { + +inline constexpr uint32_t Id = 0x002F; + +namespace feature { +namespace Wired { +inline constexpr uint32_t Id = 0x1; +} /* Wired */ +namespace Battery { +inline constexpr uint32_t Id = 0x2; +} /* Battery */ +namespace Rechargeable { +inline constexpr uint32_t Id = 0x4; +} /* Rechargeable */ +namespace Replaceable { +inline constexpr uint32_t Id = 0x8; +} /* Replaceable */ +} /* feature */ + +namespace attribute { +namespace Status { +inline constexpr uint32_t Id = 0x0000; +} /* Status */ +namespace Order { +inline constexpr uint32_t Id = 0x0001; +} /* Order */ +namespace Description { +inline constexpr uint32_t Id = 0x0002; +} /* Description */ +namespace WiredAssessedInputVoltage { +inline constexpr uint32_t Id = 0x0003; +} /* WiredAssessedInputVoltage */ +namespace WiredAssessedInputFrequency { +inline constexpr uint32_t Id = 0x0004; +} /* WiredAssessedInputFrequency */ +namespace WiredCurrentType { +inline constexpr uint32_t Id = 0x0005; +} /* WiredCurrentType */ +namespace WiredAssessedCurrent { +inline constexpr uint32_t Id = 0x0006; +} /* WiredAssessedCurrent */ +namespace WiredNominalVoltage { +inline constexpr uint32_t Id = 0x0007; +} /* WiredNominalVoltage */ +namespace WiredMaximumCurrent { +inline constexpr uint32_t Id = 0x0008; +} /* WiredMaximumCurrent */ +namespace WiredPresent { +inline constexpr uint32_t Id = 0x0009; +} /* WiredPresent */ +namespace ActiveWiredFaults { +inline constexpr uint32_t Id = 0x000A; +} /* ActiveWiredFaults */ +namespace BatVoltage { +inline constexpr uint32_t Id = 0x000B; +} /* BatVoltage */ +namespace BatPercentRemaining { +inline constexpr uint32_t Id = 0x000C; +} /* BatPercentRemaining */ +namespace BatTimeRemaining { +inline constexpr uint32_t Id = 0x000D; +} /* BatTimeRemaining */ +namespace BatChargeLevel { +inline constexpr uint32_t Id = 0x000E; +} /* BatChargeLevel */ +namespace BatReplacementNeeded { +inline constexpr uint32_t Id = 0x000F; +} /* BatReplacementNeeded */ +namespace BatReplaceability { +inline constexpr uint32_t Id = 0x0010; +} /* BatReplaceability */ +namespace BatPresent { +inline constexpr uint32_t Id = 0x0011; +} /* BatPresent */ +namespace ActiveBatFaults { +inline constexpr uint32_t Id = 0x0012; +} /* ActiveBatFaults */ +namespace BatReplacementDescription { +inline constexpr uint32_t Id = 0x0013; +} /* BatReplacementDescription */ +namespace BatCommonDesignation { +inline constexpr uint32_t Id = 0x0014; +} /* BatCommonDesignation */ +namespace BatANSIDesignation { +inline constexpr uint32_t Id = 0x0015; +} /* BatANSIDesignation */ +namespace BatIECDesignation { +inline constexpr uint32_t Id = 0x0016; +} /* BatIECDesignation */ +namespace BatApprovedChemistry { +inline constexpr uint32_t Id = 0x0017; +} /* BatApprovedChemistry */ +namespace BatCapacity { +inline constexpr uint32_t Id = 0x0018; +} /* BatCapacity */ +namespace BatQuantity { +inline constexpr uint32_t Id = 0x0019; +} /* BatQuantity */ +namespace BatChargeState { +inline constexpr uint32_t Id = 0x001A; +} /* BatChargeState */ +namespace BatTimeToFullCharge { +inline constexpr uint32_t Id = 0x001B; +} /* BatTimeToFullCharge */ +namespace BatFunctionalWhileCharging { +inline constexpr uint32_t Id = 0x001C; +} /* BatFunctionalWhileCharging */ +namespace BatChargingCurrent { +inline constexpr uint32_t Id = 0x001D; +} /* BatChargingCurrent */ +namespace ActiveBatChargeFaults { +inline constexpr uint32_t Id = 0x001E; +} /* ActiveBatChargeFaults */ +namespace EndpointList { +inline constexpr uint32_t Id = 0x001F; +} /* EndpointList */ +} /* attribute */ + +namespace event { +namespace WiredFaultChange { +inline constexpr uint32_t Id = 0x00; +} /* WiredFaultChange */ +namespace BatFaultChange { +inline constexpr uint32_t Id = 0x01; +} /* BatFaultChange */ +namespace BatChargeFaultChange { +inline constexpr uint32_t Id = 0x02; +} /* BatChargeFaultChange */ +} /* event */ + +} /* power_source */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/power_source_configuration/power_source_configuration.cpp b/components/esp_matter/data_model/generated/clusters/power_source_configuration/power_source_configuration.cpp new file mode 100644 index 000000000..d19a8353b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/power_source_configuration/power_source_configuration.cpp @@ -0,0 +1,80 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "power_source_configuration_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace power_source_configuration { + +namespace attribute { +attribute_t *create_sources(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Sources::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, power_source_configuration::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, power_source_configuration::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterPowerSourceConfigurationPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_sources(cluster, NULL, 0, 0); + } + + return cluster; +} + +} /* power_source_configuration */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/power_source_configuration/power_source_configuration.h b/components/esp_matter/data_model/generated/clusters/power_source_configuration/power_source_configuration.h new file mode 100644 index 000000000..b1f05f4c2 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/power_source_configuration/power_source_configuration.h @@ -0,0 +1,36 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace power_source_configuration { + +namespace attribute { +attribute_t *create_sources(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* power_source_configuration */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/power_source_configuration/power_source_configuration_ids.h b/components/esp_matter/data_model/generated/clusters/power_source_configuration/power_source_configuration_ids.h new file mode 100644 index 000000000..1398174d6 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/power_source_configuration/power_source_configuration_ids.h @@ -0,0 +1,34 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace power_source_configuration { + +inline constexpr uint32_t Id = 0x002E; + +namespace attribute { +namespace Sources { +inline constexpr uint32_t Id = 0x0000; +} /* Sources */ +} /* attribute */ + +} /* power_source_configuration */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/power_topology/power_topology.cpp b/components/esp_matter/data_model/generated/clusters/power_topology/power_topology.cpp new file mode 100644 index 000000000..0df424a1f --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/power_topology/power_topology.cpp @@ -0,0 +1,189 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "power_topology_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace power_topology { + +namespace feature { +namespace node_topology { +uint32_t get_id() +{ + return NodeTopology::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* node_topology */ + +namespace tree_topology { +uint32_t get_id() +{ + return TreeTopology::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* tree_topology */ + +namespace set_topology { +uint32_t get_id() +{ + return SetTopology::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_available_endpoints(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* set_topology */ + +namespace dynamic_power_flow { +uint32_t get_id() +{ + return DynamicPowerFlow::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(set_topology), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_active_endpoints(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* dynamic_power_flow */ + +} /* feature */ + +namespace attribute { +attribute_t *create_available_endpoints(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(set_topology), NULL); + return esp_matter::attribute::create(cluster, AvailableEndpoints::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_active_endpoints(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(dynamic_power_flow), NULL); + return esp_matter::attribute::create(cluster, ActiveEndpoints::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, power_topology::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, power_topology::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = PowerTopologyDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterPowerTopologyPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_EXACT_ONE("NodeTopology,TreeTopology,SetTopology", + feature::node_topology::get_id(), feature::tree_topology::get_id(), feature::set_topology::get_id()); + if (feature_map & feature::node_topology::get_id()) { + VerifyOrReturnValue(feature::node_topology::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::tree_topology::get_id()) { + VerifyOrReturnValue(feature::tree_topology::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::set_topology::get_id()) { + VerifyOrReturnValue(feature::set_topology::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::dynamic_power_flow::get_id()) { + VerifyOrReturnValue(feature::dynamic_power_flow::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterPowerTopologyClusterServerInitCallback, + ESPMatterPowerTopologyClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* power_topology */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/power_topology/power_topology.h b/components/esp_matter/data_model/generated/clusters/power_topology/power_topology.h new file mode 100644 index 000000000..a4e485e74 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/power_topology/power_topology.h @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace power_topology { + +namespace feature { +namespace node_topology { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* node_topology */ + +namespace tree_topology { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* tree_topology */ + +namespace set_topology { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* set_topology */ + +namespace dynamic_power_flow { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* dynamic_power_flow */ + +} /* feature */ + +namespace attribute { +attribute_t *create_available_endpoints(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_active_endpoints(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +typedef struct config { + void *delegate; + uint32_t feature_flags; + config() : delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* power_topology */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/power_topology/power_topology_ids.h b/components/esp_matter/data_model/generated/clusters/power_topology/power_topology_ids.h new file mode 100644 index 000000000..1ef2ba845 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/power_topology/power_topology_ids.h @@ -0,0 +1,52 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace power_topology { + +inline constexpr uint32_t Id = 0x009C; + +namespace feature { +namespace NodeTopology { +inline constexpr uint32_t Id = 0x1; +} /* NodeTopology */ +namespace TreeTopology { +inline constexpr uint32_t Id = 0x2; +} /* TreeTopology */ +namespace SetTopology { +inline constexpr uint32_t Id = 0x4; +} /* SetTopology */ +namespace DynamicPowerFlow { +inline constexpr uint32_t Id = 0x8; +} /* DynamicPowerFlow */ +} /* feature */ + +namespace attribute { +namespace AvailableEndpoints { +inline constexpr uint32_t Id = 0x0000; +} /* AvailableEndpoints */ +namespace ActiveEndpoints { +inline constexpr uint32_t Id = 0x0001; +} /* ActiveEndpoints */ +} /* attribute */ + +} /* power_topology */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pressure_measurement/pressure_measurement.cpp b/components/esp_matter/data_model/generated/clusters/pressure_measurement/pressure_measurement.cpp new file mode 100644 index 000000000..85f220202 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pressure_measurement/pressure_measurement.cpp @@ -0,0 +1,180 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "pressure_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace pressure_measurement { + +namespace feature { +namespace extended { +uint32_t get_id() +{ + return Extended::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_scaled_value(cluster, config->scaled_value); + attribute::create_min_scaled_value(cluster, config->min_scaled_value); + attribute::create_max_scaled_value(cluster, config->max_scaled_value); + attribute::create_scale(cluster, config->scale); + + return ESP_OK; +} +} /* extended */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32767)); + return attribute; +} + +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Tolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(2048)); + return attribute; +} + +attribute_t *create_scaled_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(extended), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ScaledValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_min_scaled_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(extended), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MinScaledValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_max_scaled_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(extended), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxScaledValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32767)); + return attribute; +} + +attribute_t *create_scaled_tolerance(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ScaledTolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(2048)); + return attribute; +} + +attribute_t *create_scale(cluster_t *cluster, int8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(extended), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, Scale::Id, ATTRIBUTE_FLAG_NONE, esp_matter_int8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int8(-127), esp_matter_int8(126)); + return attribute; +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, pressure_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, pressure_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterPressureMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measured_value(cluster, config->measured_value); + attribute::create_min_measured_value(cluster, config->min_measured_value); + attribute::create_max_measured_value(cluster, config->max_measured_value); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* pressure_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pressure_measurement/pressure_measurement.h b/components/esp_matter/data_model/generated/clusters/pressure_measurement/pressure_measurement.h new file mode 100644 index 000000000..57164ff3b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pressure_measurement/pressure_measurement.h @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace pressure_measurement { + +namespace feature { +namespace extended { +typedef struct config { + nullable scaled_value; + nullable min_scaled_value; + nullable max_scaled_value; + int8_t scale; + config() : scaled_value(0), min_scaled_value(0), max_scaled_value(0), scale(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* extended */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value); +attribute_t *create_scaled_value(cluster_t *cluster, nullable value); +attribute_t *create_min_scaled_value(cluster_t *cluster, nullable value); +attribute_t *create_max_scaled_value(cluster_t *cluster, nullable value); +attribute_t *create_scaled_tolerance(cluster_t *cluster, uint16_t value); +attribute_t *create_scale(cluster_t *cluster, int8_t value); +} /* attribute */ + +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + config() : measured_value(0), min_measured_value(0), max_measured_value(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* pressure_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pressure_measurement/pressure_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/pressure_measurement/pressure_measurement_ids.h new file mode 100644 index 000000000..2f7836ebf --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pressure_measurement/pressure_measurement_ids.h @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace pressure_measurement { + +inline constexpr uint32_t Id = 0x0403; + +namespace feature { +namespace Extended { +inline constexpr uint32_t Id = 0x1; +} /* Extended */ +} /* feature */ + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace Tolerance { +inline constexpr uint32_t Id = 0x0003; +} /* Tolerance */ +namespace ScaledValue { +inline constexpr uint32_t Id = 0x0010; +} /* ScaledValue */ +namespace MinScaledValue { +inline constexpr uint32_t Id = 0x0011; +} /* MinScaledValue */ +namespace MaxScaledValue { +inline constexpr uint32_t Id = 0x0012; +} /* MaxScaledValue */ +namespace ScaledTolerance { +inline constexpr uint32_t Id = 0x0013; +} /* ScaledTolerance */ +namespace Scale { +inline constexpr uint32_t Id = 0x0014; +} /* Scale */ +} /* attribute */ + +} /* pressure_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pump_configuration_and_control/pump_configuration_and_control.cpp b/components/esp_matter/data_model/generated/clusters/pump_configuration_and_control/pump_configuration_and_control.cpp new file mode 100644 index 000000000..8fe3ce3a2 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pump_configuration_and_control/pump_configuration_and_control.cpp @@ -0,0 +1,502 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "pump_configuration_and_control_cluster"; +constexpr uint16_t cluster_revision = 4; + +namespace esp_matter { +namespace cluster { +namespace pump_configuration_and_control { + +namespace feature { +namespace constant_pressure { +uint32_t get_id() +{ + return ConstantPressure::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_min_const_pressure(cluster, config->min_const_pressure); + attribute::create_max_const_pressure(cluster, config->max_const_pressure); + + return ESP_OK; +} +} /* constant_pressure */ + +namespace compensated_pressure { +uint32_t get_id() +{ + return CompensatedPressure::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_min_comp_pressure(cluster, config->min_comp_pressure); + attribute::create_max_comp_pressure(cluster, config->max_comp_pressure); + + return ESP_OK; +} +} /* compensated_pressure */ + +namespace constant_flow { +uint32_t get_id() +{ + return ConstantFlow::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_min_const_flow(cluster, config->min_const_flow); + attribute::create_max_const_flow(cluster, config->max_const_flow); + + return ESP_OK; +} +} /* constant_flow */ + +namespace constant_speed { +uint32_t get_id() +{ + return ConstantSpeed::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_min_const_speed(cluster, config->min_const_speed); + attribute::create_max_const_speed(cluster, config->max_const_speed); + + return ESP_OK; +} +} /* constant_speed */ + +namespace constant_temperature { +uint32_t get_id() +{ + return ConstantTemperature::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_min_const_temp(cluster, config->min_const_temp); + attribute::create_max_const_temp(cluster, config->max_const_temp); + + return ESP_OK; +} +} /* constant_temperature */ + +namespace automatic { +uint32_t get_id() +{ + return Automatic::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_min_const_pressure(cluster, config->min_const_pressure); + attribute::create_max_const_pressure(cluster, config->max_const_pressure); + attribute::create_min_comp_pressure(cluster, config->min_comp_pressure); + attribute::create_max_comp_pressure(cluster, config->max_comp_pressure); + attribute::create_min_const_speed(cluster, config->min_const_speed); + attribute::create_max_const_speed(cluster, config->max_const_speed); + attribute::create_min_const_flow(cluster, config->min_const_flow); + attribute::create_max_const_flow(cluster, config->max_const_flow); + attribute::create_min_const_temp(cluster, config->min_const_temp); + attribute::create_max_const_temp(cluster, config->max_const_temp); + + return ESP_OK; +} +} /* automatic */ + +namespace local_operation { +uint32_t get_id() +{ + return LocalOperation::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* local_operation */ + +} /* feature */ + +namespace attribute { +attribute_t *create_max_pressure(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxPressure::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_max_speed(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxSpeed::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_max_flow(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxFlow::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_min_const_pressure(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MinConstPressure::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_max_const_pressure(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxConstPressure::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_min_comp_pressure(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MinCompPressure::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_max_comp_pressure(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxCompPressure::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_min_const_speed(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MinConstSpeed::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_max_const_speed(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxConstSpeed::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_min_const_flow(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MinConstFlow::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_max_const_flow(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxConstFlow::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_min_const_temp(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MinConstTemp::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-27315), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_max_const_temp(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxConstTemp::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-27315), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_pump_status(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PumpStatus::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap16(0), esp_matter_bitmap16(511)); + return attribute; +} + +attribute_t *create_effective_operation_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, EffectiveOperationMode::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(3)); + return attribute; +} + +attribute_t *create_effective_control_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, EffectiveControlMode::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(5)); + return attribute; +} + +attribute_t *create_capacity(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Capacity::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_speed(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Speed::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_lifetime_running_hours(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LifetimeRunningHours::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_power(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Power::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_lifetime_energy_consumed(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LifetimeEnergyConsumed::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_operation_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, OperationMode::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(3)); + return attribute; +} + +attribute_t *create_control_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ControlMode::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(5)); + return attribute; +} + +} /* attribute */ + +namespace event { +event_t *create_supply_voltage_low(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, SupplyVoltageLow::Id); +} + +event_t *create_supply_voltage_high(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, SupplyVoltageHigh::Id); +} + +event_t *create_power_missing_phase(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, PowerMissingPhase::Id); +} + +event_t *create_system_pressure_low(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, SystemPressureLow::Id); +} + +event_t *create_system_pressure_high(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, SystemPressureHigh::Id); +} + +event_t *create_dry_running(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, DryRunning::Id); +} + +event_t *create_motor_temperature_high(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, MotorTemperatureHigh::Id); +} + +event_t *create_pump_motor_fatal_failure(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, PumpMotorFatalFailure::Id); +} + +event_t *create_electronic_temperature_high(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, ElectronicTemperatureHigh::Id); +} + +event_t *create_pump_blocked(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, PumpBlocked::Id); +} + +event_t *create_sensor_failure(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, SensorFailure::Id); +} + +event_t *create_electronic_non_fatal_failure(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, ElectronicNonFatalFailure::Id); +} + +event_t *create_electronic_fatal_failure(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, ElectronicFatalFailure::Id); +} + +event_t *create_general_fault(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, GeneralFault::Id); +} + +event_t *create_leakage(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, Leakage::Id); +} + +event_t *create_air_detection(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, AirDetection::Id); +} + +event_t *create_turbine_operation(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, TurbineOperation::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t function_list[] = { + (function_generic_t)emberAfPumpConfigurationAndControlClusterServerInitCallback, + (function_generic_t)MatterPumpConfigurationAndControlClusterServerAttributeChangedCallback, + (function_generic_t)MatterPumpConfigurationAndControlClusterServerPreAttributeChangedCallback, +}; + +const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION | CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, pump_configuration_and_control::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, pump_configuration_and_control::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterPumpConfigurationAndControlPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_max_pressure(cluster, config->max_pressure); + attribute::create_max_speed(cluster, config->max_speed); + attribute::create_max_flow(cluster, config->max_flow); + attribute::create_effective_operation_mode(cluster, config->effective_operation_mode); + attribute::create_effective_control_mode(cluster, config->effective_control_mode); + attribute::create_capacity(cluster, config->capacity); + attribute::create_operation_mode(cluster, config->operation_mode); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("ConstantPressure,ConstantTemperature,CompensatedPressure,ConstantFlow,ConstantSpeed", + feature::constant_pressure::get_id(), feature::constant_temperature::get_id(), feature::compensated_pressure::get_id(), feature::constant_flow::get_id(), feature::constant_speed::get_id()); + if (feature_map & feature::constant_pressure::get_id()) { + VerifyOrReturnValue(feature::constant_pressure::add(cluster, &(config->features.constant_pressure)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::constant_temperature::get_id()) { + VerifyOrReturnValue(feature::constant_temperature::add(cluster, &(config->features.constant_temperature)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::compensated_pressure::get_id()) { + VerifyOrReturnValue(feature::compensated_pressure::add(cluster, &(config->features.compensated_pressure)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::constant_flow::get_id()) { + VerifyOrReturnValue(feature::constant_flow::add(cluster, &(config->features.constant_flow)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::constant_speed::get_id()) { + VerifyOrReturnValue(feature::constant_speed::add(cluster, &(config->features.constant_speed)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::automatic::get_id()) { + VerifyOrReturnValue(feature::automatic::add(cluster, &(config->features.automatic)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::local_operation::get_id()) { + VerifyOrReturnValue(feature::local_operation::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* pump_configuration_and_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pump_configuration_and_control/pump_configuration_and_control.h b/components/esp_matter/data_model/generated/clusters/pump_configuration_and_control/pump_configuration_and_control.h new file mode 100644 index 000000000..a511ed0cd --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pump_configuration_and_control/pump_configuration_and_control.h @@ -0,0 +1,170 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace pump_configuration_and_control { + +namespace feature { +namespace constant_pressure { +typedef struct config { + nullable min_const_pressure; + nullable max_const_pressure; + config() : min_const_pressure(0), max_const_pressure(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* constant_pressure */ + +namespace compensated_pressure { +typedef struct config { + nullable min_comp_pressure; + nullable max_comp_pressure; + config() : min_comp_pressure(0), max_comp_pressure(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* compensated_pressure */ + +namespace constant_flow { +typedef struct config { + nullable min_const_flow; + nullable max_const_flow; + config() : min_const_flow(0), max_const_flow(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* constant_flow */ + +namespace constant_speed { +typedef struct config { + nullable min_const_speed; + nullable max_const_speed; + config() : min_const_speed(0), max_const_speed(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* constant_speed */ + +namespace constant_temperature { +typedef struct config { + nullable min_const_temp; + nullable max_const_temp; + config() : min_const_temp(0), max_const_temp(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* constant_temperature */ + +namespace automatic { +typedef struct config { + nullable min_const_pressure; + nullable max_const_pressure; + nullable min_comp_pressure; + nullable max_comp_pressure; + nullable min_const_speed; + nullable max_const_speed; + nullable min_const_flow; + nullable max_const_flow; + nullable min_const_temp; + nullable max_const_temp; + config() : min_const_pressure(0), max_const_pressure(0), min_comp_pressure(0), max_comp_pressure(0), min_const_speed(0), max_const_speed(0), min_const_flow(0), max_const_flow(0), min_const_temp(0), max_const_temp(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* automatic */ + +namespace local_operation { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* local_operation */ + +} /* feature */ + +namespace attribute { +attribute_t *create_max_pressure(cluster_t *cluster, nullable value); +attribute_t *create_max_speed(cluster_t *cluster, nullable value); +attribute_t *create_max_flow(cluster_t *cluster, nullable value); +attribute_t *create_min_const_pressure(cluster_t *cluster, nullable value); +attribute_t *create_max_const_pressure(cluster_t *cluster, nullable value); +attribute_t *create_min_comp_pressure(cluster_t *cluster, nullable value); +attribute_t *create_max_comp_pressure(cluster_t *cluster, nullable value); +attribute_t *create_min_const_speed(cluster_t *cluster, nullable value); +attribute_t *create_max_const_speed(cluster_t *cluster, nullable value); +attribute_t *create_min_const_flow(cluster_t *cluster, nullable value); +attribute_t *create_max_const_flow(cluster_t *cluster, nullable value); +attribute_t *create_min_const_temp(cluster_t *cluster, nullable value); +attribute_t *create_max_const_temp(cluster_t *cluster, nullable value); +attribute_t *create_pump_status(cluster_t *cluster, uint16_t value); +attribute_t *create_effective_operation_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_effective_control_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_capacity(cluster_t *cluster, nullable value); +attribute_t *create_speed(cluster_t *cluster, nullable value); +attribute_t *create_lifetime_running_hours(cluster_t *cluster, nullable value); +attribute_t *create_power(cluster_t *cluster, nullable value); +attribute_t *create_lifetime_energy_consumed(cluster_t *cluster, nullable value); +attribute_t *create_operation_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_control_mode(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace event { +event_t *create_supply_voltage_low(cluster_t *cluster); +event_t *create_supply_voltage_high(cluster_t *cluster); +event_t *create_power_missing_phase(cluster_t *cluster); +event_t *create_system_pressure_low(cluster_t *cluster); +event_t *create_system_pressure_high(cluster_t *cluster); +event_t *create_dry_running(cluster_t *cluster); +event_t *create_motor_temperature_high(cluster_t *cluster); +event_t *create_pump_motor_fatal_failure(cluster_t *cluster); +event_t *create_electronic_temperature_high(cluster_t *cluster); +event_t *create_pump_blocked(cluster_t *cluster); +event_t *create_sensor_failure(cluster_t *cluster); +event_t *create_electronic_non_fatal_failure(cluster_t *cluster); +event_t *create_electronic_fatal_failure(cluster_t *cluster); +event_t *create_general_fault(cluster_t *cluster); +event_t *create_leakage(cluster_t *cluster); +event_t *create_air_detection(cluster_t *cluster); +event_t *create_turbine_operation(cluster_t *cluster); +} /* event */ + +typedef struct config { + nullable max_pressure; + nullable max_speed; + nullable max_flow; + uint8_t effective_operation_mode; + uint8_t effective_control_mode; + nullable capacity; + uint8_t operation_mode; + struct { + feature::constant_pressure::config_t constant_pressure; + feature::compensated_pressure::config_t compensated_pressure; + feature::constant_flow::config_t constant_flow; + feature::constant_speed::config_t constant_speed; + feature::constant_temperature::config_t constant_temperature; + feature::automatic::config_t automatic; + } features; + uint32_t feature_flags; + config() : max_pressure(0), max_speed(0), max_flow(0), effective_operation_mode(0), effective_control_mode(0), capacity(0), operation_mode(0), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* pump_configuration_and_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/pump_configuration_and_control/pump_configuration_and_control_ids.h b/components/esp_matter/data_model/generated/clusters/pump_configuration_and_control/pump_configuration_and_control_ids.h new file mode 100644 index 000000000..4f577bbfe --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/pump_configuration_and_control/pump_configuration_and_control_ids.h @@ -0,0 +1,178 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace pump_configuration_and_control { + +inline constexpr uint32_t Id = 0x0200; + +namespace feature { +namespace ConstantPressure { +inline constexpr uint32_t Id = 0x1; +} /* ConstantPressure */ +namespace CompensatedPressure { +inline constexpr uint32_t Id = 0x2; +} /* CompensatedPressure */ +namespace ConstantFlow { +inline constexpr uint32_t Id = 0x4; +} /* ConstantFlow */ +namespace ConstantSpeed { +inline constexpr uint32_t Id = 0x8; +} /* ConstantSpeed */ +namespace ConstantTemperature { +inline constexpr uint32_t Id = 0x10; +} /* ConstantTemperature */ +namespace Automatic { +inline constexpr uint32_t Id = 0x20; +} /* Automatic */ +namespace LocalOperation { +inline constexpr uint32_t Id = 0x40; +} /* LocalOperation */ +} /* feature */ + +namespace attribute { +namespace MaxPressure { +inline constexpr uint32_t Id = 0x0000; +} /* MaxPressure */ +namespace MaxSpeed { +inline constexpr uint32_t Id = 0x0001; +} /* MaxSpeed */ +namespace MaxFlow { +inline constexpr uint32_t Id = 0x0002; +} /* MaxFlow */ +namespace MinConstPressure { +inline constexpr uint32_t Id = 0x0003; +} /* MinConstPressure */ +namespace MaxConstPressure { +inline constexpr uint32_t Id = 0x0004; +} /* MaxConstPressure */ +namespace MinCompPressure { +inline constexpr uint32_t Id = 0x0005; +} /* MinCompPressure */ +namespace MaxCompPressure { +inline constexpr uint32_t Id = 0x0006; +} /* MaxCompPressure */ +namespace MinConstSpeed { +inline constexpr uint32_t Id = 0x0007; +} /* MinConstSpeed */ +namespace MaxConstSpeed { +inline constexpr uint32_t Id = 0x0008; +} /* MaxConstSpeed */ +namespace MinConstFlow { +inline constexpr uint32_t Id = 0x0009; +} /* MinConstFlow */ +namespace MaxConstFlow { +inline constexpr uint32_t Id = 0x000A; +} /* MaxConstFlow */ +namespace MinConstTemp { +inline constexpr uint32_t Id = 0x000B; +} /* MinConstTemp */ +namespace MaxConstTemp { +inline constexpr uint32_t Id = 0x000C; +} /* MaxConstTemp */ +namespace PumpStatus { +inline constexpr uint32_t Id = 0x0010; +} /* PumpStatus */ +namespace EffectiveOperationMode { +inline constexpr uint32_t Id = 0x0011; +} /* EffectiveOperationMode */ +namespace EffectiveControlMode { +inline constexpr uint32_t Id = 0x0012; +} /* EffectiveControlMode */ +namespace Capacity { +inline constexpr uint32_t Id = 0x0013; +} /* Capacity */ +namespace Speed { +inline constexpr uint32_t Id = 0x0014; +} /* Speed */ +namespace LifetimeRunningHours { +inline constexpr uint32_t Id = 0x0015; +} /* LifetimeRunningHours */ +namespace Power { +inline constexpr uint32_t Id = 0x0016; +} /* Power */ +namespace LifetimeEnergyConsumed { +inline constexpr uint32_t Id = 0x0017; +} /* LifetimeEnergyConsumed */ +namespace OperationMode { +inline constexpr uint32_t Id = 0x0020; +} /* OperationMode */ +namespace ControlMode { +inline constexpr uint32_t Id = 0x0021; +} /* ControlMode */ +} /* attribute */ + +namespace event { +namespace SupplyVoltageLow { +inline constexpr uint32_t Id = 0x00; +} /* SupplyVoltageLow */ +namespace SupplyVoltageHigh { +inline constexpr uint32_t Id = 0x01; +} /* SupplyVoltageHigh */ +namespace PowerMissingPhase { +inline constexpr uint32_t Id = 0x02; +} /* PowerMissingPhase */ +namespace SystemPressureLow { +inline constexpr uint32_t Id = 0x03; +} /* SystemPressureLow */ +namespace SystemPressureHigh { +inline constexpr uint32_t Id = 0x04; +} /* SystemPressureHigh */ +namespace DryRunning { +inline constexpr uint32_t Id = 0x05; +} /* DryRunning */ +namespace MotorTemperatureHigh { +inline constexpr uint32_t Id = 0x06; +} /* MotorTemperatureHigh */ +namespace PumpMotorFatalFailure { +inline constexpr uint32_t Id = 0x07; +} /* PumpMotorFatalFailure */ +namespace ElectronicTemperatureHigh { +inline constexpr uint32_t Id = 0x08; +} /* ElectronicTemperatureHigh */ +namespace PumpBlocked { +inline constexpr uint32_t Id = 0x09; +} /* PumpBlocked */ +namespace SensorFailure { +inline constexpr uint32_t Id = 0x0A; +} /* SensorFailure */ +namespace ElectronicNonFatalFailure { +inline constexpr uint32_t Id = 0x0B; +} /* ElectronicNonFatalFailure */ +namespace ElectronicFatalFailure { +inline constexpr uint32_t Id = 0x0C; +} /* ElectronicFatalFailure */ +namespace GeneralFault { +inline constexpr uint32_t Id = 0x0D; +} /* GeneralFault */ +namespace Leakage { +inline constexpr uint32_t Id = 0x0E; +} /* Leakage */ +namespace AirDetection { +inline constexpr uint32_t Id = 0x0F; +} /* AirDetection */ +namespace TurbineOperation { +inline constexpr uint32_t Id = 0x10; +} /* TurbineOperation */ +} /* event */ + +} /* pump_configuration_and_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/push_av_stream_transport/push_av_stream_transport.cpp b/components/esp_matter/data_model/generated/clusters/push_av_stream_transport/push_av_stream_transport.cpp new file mode 100644 index 000000000..2f1907db7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/push_av_stream_transport/push_av_stream_transport.cpp @@ -0,0 +1,189 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "push_av_stream_transport_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace push_av_stream_transport { + +namespace feature { +namespace per_zone_sensitivity { +uint32_t get_id() +{ + return PerZoneSensitivity::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* per_zone_sensitivity */ + +} /* feature */ + +namespace attribute { +attribute_t *create_supported_formats(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedFormats::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_connections(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CurrentConnections::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_allocate_push_transport(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AllocatePushTransport::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_allocate_push_transport_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AllocatePushTransportResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_deallocate_push_transport(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, DeallocatePushTransport::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_modify_push_transport(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ModifyPushTransport::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_set_transport_status(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SetTransportStatus::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_manually_trigger_transport(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ManuallyTriggerTransport::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_find_transport(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, FindTransport::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_find_transport_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, FindTransportResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_push_transport_begin(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, PushTransportBegin::Id); +} + +event_t *create_push_transport_end(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, PushTransportEnd::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, push_av_stream_transport::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, push_av_stream_transport::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = PushAvStreamTransportDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterPushAvStreamTransportPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_supported_formats(cluster, NULL, 0, 0); + attribute::create_current_connections(cluster, NULL, 0, 0); + command::create_allocate_push_transport(cluster); + command::create_allocate_push_transport_response(cluster); + command::create_deallocate_push_transport(cluster); + command::create_modify_push_transport(cluster); + command::create_set_transport_status(cluster); + command::create_manually_trigger_transport(cluster); + command::create_find_transport(cluster); + command::create_find_transport_response(cluster); + /* Events */ + event::create_push_transport_begin(cluster); + event::create_push_transport_end(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterPushAvStreamTransportClusterServerInitCallback, + ESPMatterPushAvStreamTransportClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* push_av_stream_transport */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/push_av_stream_transport/push_av_stream_transport.h b/components/esp_matter/data_model/generated/clusters/push_av_stream_transport/push_av_stream_transport.h new file mode 100644 index 000000000..3c4b6c96f --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/push_av_stream_transport/push_av_stream_transport.h @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace push_av_stream_transport { + +namespace feature { +namespace per_zone_sensitivity { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* per_zone_sensitivity */ + +} /* feature */ + +namespace attribute { +attribute_t *create_supported_formats(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_connections(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_allocate_push_transport(cluster_t *cluster); +command_t *create_allocate_push_transport_response(cluster_t *cluster); +command_t *create_deallocate_push_transport(cluster_t *cluster); +command_t *create_modify_push_transport(cluster_t *cluster); +command_t *create_set_transport_status(cluster_t *cluster); +command_t *create_manually_trigger_transport(cluster_t *cluster); +command_t *create_find_transport(cluster_t *cluster); +command_t *create_find_transport_response(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_push_transport_begin(cluster_t *cluster); +event_t *create_push_transport_end(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* push_av_stream_transport */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/push_av_stream_transport/push_av_stream_transport_ids.h b/components/esp_matter/data_model/generated/clusters/push_av_stream_transport/push_av_stream_transport_ids.h new file mode 100644 index 000000000..6ad660e3c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/push_av_stream_transport/push_av_stream_transport_ids.h @@ -0,0 +1,79 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace push_av_stream_transport { + +inline constexpr uint32_t Id = 0x0555; + +namespace feature { +namespace PerZoneSensitivity { +inline constexpr uint32_t Id = 0x1; +} /* PerZoneSensitivity */ +} /* feature */ + +namespace attribute { +namespace SupportedFormats { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedFormats */ +namespace CurrentConnections { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentConnections */ +} /* attribute */ + +namespace command { +namespace AllocatePushTransport { +inline constexpr uint32_t Id = 0x00; +} /* AllocatePushTransport */ +namespace AllocatePushTransportResponse { +inline constexpr uint32_t Id = 0x01; +} /* AllocatePushTransportResponse */ +namespace DeallocatePushTransport { +inline constexpr uint32_t Id = 0x02; +} /* DeallocatePushTransport */ +namespace ModifyPushTransport { +inline constexpr uint32_t Id = 0x03; +} /* ModifyPushTransport */ +namespace SetTransportStatus { +inline constexpr uint32_t Id = 0x04; +} /* SetTransportStatus */ +namespace ManuallyTriggerTransport { +inline constexpr uint32_t Id = 0x05; +} /* ManuallyTriggerTransport */ +namespace FindTransport { +inline constexpr uint32_t Id = 0x06; +} /* FindTransport */ +namespace FindTransportResponse { +inline constexpr uint32_t Id = 0x07; +} /* FindTransportResponse */ +} /* command */ + +namespace event { +namespace PushTransportBegin { +inline constexpr uint32_t Id = 0x00; +} /* PushTransportBegin */ +namespace PushTransportEnd { +inline constexpr uint32_t Id = 0x01; +} /* PushTransportEnd */ +} /* event */ + +} /* push_av_stream_transport */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/radon_concentration_measurement/radon_concentration_measurement.cpp b/components/esp_matter/data_model/generated/clusters/radon_concentration_measurement/radon_concentration_measurement.cpp new file mode 100644 index 000000000..4db8aba3d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/radon_concentration_measurement/radon_concentration_measurement.cpp @@ -0,0 +1,289 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "radon_concentration_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace radon_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id() +{ + return NumericMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_measured_value(cluster, 0); + attribute::create_min_measured_value(cluster, 0); + attribute::create_max_measured_value(cluster, 0); + attribute::create_measurement_unit(cluster, 0); + + return ESP_OK; +} +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id() +{ + return LevelIndication::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_level_value(cluster, 0); + + return ESP_OK; +} +} /* level_indication */ + +namespace medium_level { +uint32_t get_id() +{ + return MediumLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* medium_level */ + +namespace critical_level { +uint32_t get_id() +{ + return CriticalLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id() +{ + return PeakMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_peak_measured_value(cluster, 0); + attribute::create_peak_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id() +{ + return AverageMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_average_measured_value(cluster, 0); + attribute::create_average_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_uncertainty(cluster_t *cluster, float value) +{ + return esp_matter::attribute::create(cluster, Uncertainty::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_float(value)); +} + +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasurementUnit::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, MeasurementMedium::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_level_value(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(level_indication), NULL); + return esp_matter::attribute::create(cluster, LevelValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, radon_concentration_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, radon_concentration_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterRadonConcentrationMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measurement_medium(cluster, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("NumericMeasurement,LevelIndication", + feature::numeric_measurement::get_id(), feature::level_indication::get_id()); + if (feature_map & feature::numeric_measurement::get_id()) { + VerifyOrReturnValue(feature::numeric_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::level_indication::get_id()) { + VerifyOrReturnValue(feature::level_indication::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::medium_level::get_id()) { + VerifyOrReturnValue(feature::medium_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::critical_level::get_id()) { + VerifyOrReturnValue(feature::critical_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::peak_measurement::get_id()) { + VerifyOrReturnValue(feature::peak_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::average_measurement::get_id()) { + VerifyOrReturnValue(feature::average_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* radon_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/radon_concentration_measurement/radon_concentration_measurement.h b/components/esp_matter/data_model/generated/clusters/radon_concentration_measurement/radon_concentration_measurement.h new file mode 100644 index 000000000..020f3560e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/radon_concentration_measurement/radon_concentration_measurement.h @@ -0,0 +1,80 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace radon_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* level_indication */ + +namespace medium_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* medium_level */ + +namespace critical_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_uncertainty(cluster_t *cluster, float value); +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value); +attribute_t *create_level_value(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* radon_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/radon_concentration_measurement/radon_concentration_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/radon_concentration_measurement/radon_concentration_measurement_ids.h new file mode 100644 index 000000000..da27ace52 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/radon_concentration_measurement/radon_concentration_measurement_ids.h @@ -0,0 +1,85 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace radon_concentration_measurement { + +inline constexpr uint32_t Id = 0x042F; + +namespace feature { +namespace NumericMeasurement { +inline constexpr uint32_t Id = 0x1; +} /* NumericMeasurement */ +namespace LevelIndication { +inline constexpr uint32_t Id = 0x2; +} /* LevelIndication */ +namespace MediumLevel { +inline constexpr uint32_t Id = 0x4; +} /* MediumLevel */ +namespace CriticalLevel { +inline constexpr uint32_t Id = 0x8; +} /* CriticalLevel */ +namespace PeakMeasurement { +inline constexpr uint32_t Id = 0x10; +} /* PeakMeasurement */ +namespace AverageMeasurement { +inline constexpr uint32_t Id = 0x20; +} /* AverageMeasurement */ +} /* feature */ + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace PeakMeasuredValue { +inline constexpr uint32_t Id = 0x0003; +} /* PeakMeasuredValue */ +namespace PeakMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0004; +} /* PeakMeasuredValueWindow */ +namespace AverageMeasuredValue { +inline constexpr uint32_t Id = 0x0005; +} /* AverageMeasuredValue */ +namespace AverageMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0006; +} /* AverageMeasuredValueWindow */ +namespace Uncertainty { +inline constexpr uint32_t Id = 0x0007; +} /* Uncertainty */ +namespace MeasurementUnit { +inline constexpr uint32_t Id = 0x0008; +} /* MeasurementUnit */ +namespace MeasurementMedium { +inline constexpr uint32_t Id = 0x0009; +} /* MeasurementMedium */ +namespace LevelValue { +inline constexpr uint32_t Id = 0x000A; +} /* LevelValue */ +} /* attribute */ + +} /* radon_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/refrigerator_alarm/refrigerator_alarm.cpp b/components/esp_matter/data_model/generated/clusters/refrigerator_alarm/refrigerator_alarm.cpp new file mode 100644 index 000000000..1f74a4d14 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/refrigerator_alarm/refrigerator_alarm.cpp @@ -0,0 +1,108 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "refrigerator_alarm_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace refrigerator_alarm { + +namespace attribute { +attribute_t *create_mask(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Mask::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(4294967295)); + return attribute; +} + +attribute_t *create_state(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, State::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(4294967295)); + return attribute; +} + +attribute_t *create_supported(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Supported::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(4294967295)); + return attribute; +} + +} /* attribute */ + +namespace event { +event_t *create_notify(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, Notify::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, refrigerator_alarm::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, refrigerator_alarm::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterRefrigeratorAlarmPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_mask(cluster, config->mask); + attribute::create_state(cluster, config->state); + attribute::create_supported(cluster, config->supported); + /* Events */ + event::create_notify(cluster); + } + + return cluster; +} + +} /* refrigerator_alarm */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/refrigerator_alarm/refrigerator_alarm.h b/components/esp_matter/data_model/generated/clusters/refrigerator_alarm/refrigerator_alarm.h new file mode 100644 index 000000000..bac7830c8 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/refrigerator_alarm/refrigerator_alarm.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace refrigerator_alarm { + +namespace attribute { +attribute_t *create_mask(cluster_t *cluster, uint32_t value); +attribute_t *create_state(cluster_t *cluster, uint32_t value); +attribute_t *create_supported(cluster_t *cluster, uint32_t value); +} /* attribute */ + +namespace event { +event_t *create_notify(cluster_t *cluster); +} /* event */ + +typedef struct config { + uint32_t mask; + uint32_t state; + uint32_t supported; + config() : mask(0), state(0), supported(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* refrigerator_alarm */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/refrigerator_alarm/refrigerator_alarm_ids.h b/components/esp_matter/data_model/generated/clusters/refrigerator_alarm/refrigerator_alarm_ids.h new file mode 100644 index 000000000..8fc4a5220 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/refrigerator_alarm/refrigerator_alarm_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace refrigerator_alarm { + +inline constexpr uint32_t Id = 0x0057; + +namespace attribute { +namespace Mask { +inline constexpr uint32_t Id = 0x0000; +} /* Mask */ +namespace State { +inline constexpr uint32_t Id = 0x0002; +} /* State */ +namespace Supported { +inline constexpr uint32_t Id = 0x0003; +} /* Supported */ +} /* attribute */ + +namespace event { +namespace Notify { +inline constexpr uint32_t Id = 0x00; +} /* Notify */ +} /* event */ + +} /* refrigerator_alarm */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/refrigerator_and_temperature_controlled_cabinet_mode/refrigerator_and_temperature_controlled_cabinet_mode.cpp b/components/esp_matter/data_model/generated/clusters/refrigerator_and_temperature_controlled_cabinet_mode/refrigerator_and_temperature_controlled_cabinet_mode.cpp new file mode 100644 index 000000000..4e4c6d9ee --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/refrigerator_and_temperature_controlled_cabinet_mode/refrigerator_and_temperature_controlled_cabinet_mode.cpp @@ -0,0 +1,109 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "refrigerator_and_temperature_controlled_cabinet_mode_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace refrigerator_and_temperature_controlled_cabinet_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedModes::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_change_to_mode(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToMode::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_change_to_mode_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToModeResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, refrigerator_and_temperature_controlled_cabinet_mode::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, refrigerator_and_temperature_controlled_cabinet_mode::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = RefrigeratorAndTemperatureControlledCabinetModeDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterRefrigeratorAndTemperatureControlledCabinetModePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_current_mode(cluster, config->current_mode); + attribute::create_supported_modes(cluster, NULL, 0, 0); + command::create_change_to_mode(cluster); + command::create_change_to_mode_response(cluster); + } + + return cluster; +} + +} /* refrigerator_and_temperature_controlled_cabinet_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/refrigerator_and_temperature_controlled_cabinet_mode/refrigerator_and_temperature_controlled_cabinet_mode.h b/components/esp_matter/data_model/generated/clusters/refrigerator_and_temperature_controlled_cabinet_mode/refrigerator_and_temperature_controlled_cabinet_mode.h new file mode 100644 index 000000000..fc175f318 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/refrigerator_and_temperature_controlled_cabinet_mode/refrigerator_and_temperature_controlled_cabinet_mode.h @@ -0,0 +1,44 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace refrigerator_and_temperature_controlled_cabinet_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_change_to_mode(cluster_t *cluster); +command_t *create_change_to_mode_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t current_mode; + void *delegate; + config() : current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* refrigerator_and_temperature_controlled_cabinet_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/refrigerator_and_temperature_controlled_cabinet_mode/refrigerator_and_temperature_controlled_cabinet_mode_ids.h b/components/esp_matter/data_model/generated/clusters/refrigerator_and_temperature_controlled_cabinet_mode/refrigerator_and_temperature_controlled_cabinet_mode_ids.h new file mode 100644 index 000000000..19e1b14ba --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/refrigerator_and_temperature_controlled_cabinet_mode/refrigerator_and_temperature_controlled_cabinet_mode_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace refrigerator_and_temperature_controlled_cabinet_mode { + +inline constexpr uint32_t Id = 0x0052; + +namespace attribute { +namespace SupportedModes { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedModes */ +namespace CurrentMode { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentMode */ +} /* attribute */ + +namespace command { +namespace ChangeToMode { +inline constexpr uint32_t Id = 0x00; +} /* ChangeToMode */ +namespace ChangeToModeResponse { +inline constexpr uint32_t Id = 0x01; +} /* ChangeToModeResponse */ +} /* command */ + +} /* refrigerator_and_temperature_controlled_cabinet_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/relative_humidity_measurement/relative_humidity_measurement.cpp b/components/esp_matter/data_model/generated/clusters/relative_humidity_measurement/relative_humidity_measurement.cpp new file mode 100644 index 000000000..e4217cbc1 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/relative_humidity_measurement/relative_humidity_measurement.cpp @@ -0,0 +1,114 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "relative_humidity_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace relative_humidity_measurement { + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(9999)); + return attribute; +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(10000)); + return attribute; +} + +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Tolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(2048)); + return attribute; +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, relative_humidity_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, relative_humidity_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterRelativeHumidityMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measured_value(cluster, config->measured_value); + attribute::create_min_measured_value(cluster, config->min_measured_value); + attribute::create_max_measured_value(cluster, config->max_measured_value); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* relative_humidity_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/relative_humidity_measurement/relative_humidity_measurement.h b/components/esp_matter/data_model/generated/clusters/relative_humidity_measurement/relative_humidity_measurement.h new file mode 100644 index 000000000..dfbaf9d97 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/relative_humidity_measurement/relative_humidity_measurement.h @@ -0,0 +1,42 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace relative_humidity_measurement { + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value); +} /* attribute */ + +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + config() : measured_value(0), min_measured_value(0), max_measured_value(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* relative_humidity_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/relative_humidity_measurement/relative_humidity_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/relative_humidity_measurement/relative_humidity_measurement_ids.h new file mode 100644 index 000000000..ccf220610 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/relative_humidity_measurement/relative_humidity_measurement_ids.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace relative_humidity_measurement { + +inline constexpr uint32_t Id = 0x0405; + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace Tolerance { +inline constexpr uint32_t Id = 0x0003; +} /* Tolerance */ +} /* attribute */ + +} /* relative_humidity_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/rvc_clean_mode/rvc_clean_mode.cpp b/components/esp_matter/data_model/generated/clusters/rvc_clean_mode/rvc_clean_mode.cpp new file mode 100644 index 000000000..6947ffbaa --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/rvc_clean_mode/rvc_clean_mode.cpp @@ -0,0 +1,125 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "rvc_clean_mode_cluster"; +constexpr uint16_t cluster_revision = 5; + +namespace esp_matter { +namespace cluster { +namespace rvc_clean_mode { + +namespace feature { +namespace direct_mode_change { +uint32_t get_id() +{ + return DirectModeChange::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* direct_mode_change */ + +} /* feature */ + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedModes::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_change_to_mode(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToMode::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_change_to_mode_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToModeResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, rvc_clean_mode::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, rvc_clean_mode::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = RvcCleanModeDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterRvcCleanModePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_change_to_mode(cluster); + command::create_change_to_mode_response(cluster); + } + + return cluster; +} + +} /* rvc_clean_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/rvc_clean_mode/rvc_clean_mode.h b/components/esp_matter/data_model/generated/clusters/rvc_clean_mode/rvc_clean_mode.h new file mode 100644 index 000000000..51db71a2a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/rvc_clean_mode/rvc_clean_mode.h @@ -0,0 +1,51 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace rvc_clean_mode { + +namespace feature { +namespace direct_mode_change { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* direct_mode_change */ + +} /* feature */ + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_change_to_mode(cluster_t *cluster); +command_t *create_change_to_mode_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* rvc_clean_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/rvc_clean_mode/rvc_clean_mode_ids.h b/components/esp_matter/data_model/generated/clusters/rvc_clean_mode/rvc_clean_mode_ids.h new file mode 100644 index 000000000..3b0c0d2e7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/rvc_clean_mode/rvc_clean_mode_ids.h @@ -0,0 +1,52 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace rvc_clean_mode { + +inline constexpr uint32_t Id = 0x0055; + +namespace feature { +namespace DirectModeChange { +inline constexpr uint32_t Id = 0x100000; +} /* DirectModeChange */ +} /* feature */ + +namespace attribute { +namespace SupportedModes { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedModes */ +namespace CurrentMode { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentMode */ +} /* attribute */ + +namespace command { +namespace ChangeToMode { +inline constexpr uint32_t Id = 0x00; +} /* ChangeToMode */ +namespace ChangeToModeResponse { +inline constexpr uint32_t Id = 0x01; +} /* ChangeToModeResponse */ +} /* command */ + +} /* rvc_clean_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/rvc_operational_state/rvc_operational_state.cpp b/components/esp_matter/data_model/generated/clusters/rvc_operational_state/rvc_operational_state.cpp new file mode 100644 index 000000000..54bd7341d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/rvc_operational_state/rvc_operational_state.cpp @@ -0,0 +1,152 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "rvc_operational_state_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace rvc_operational_state { + +namespace attribute { +attribute_t *create_phase_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, PhaseList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_phase(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CurrentPhase::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); +} + +attribute_t *create_countdown_time(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CountdownTime::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_operational_state_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, OperationalStateList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_operational_state(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, OperationalState::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_operational_error(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, OperationalError::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_pause(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Pause::Id, COMMAND_FLAG_NONE, NULL); +} + +command_t *create_resume(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Resume::Id, COMMAND_FLAG_NONE, NULL); +} + +command_t *create_operational_command_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, OperationalCommandResponse::Id, COMMAND_FLAG_NONE, NULL); +} + +command_t *create_go_home(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GoHome::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_operational_error(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, OperationalError::Id); +} + +event_t *create_operation_completion(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, OperationCompletion::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, rvc_operational_state::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, rvc_operational_state::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = RvcOperationalStateDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterRvcOperationalStatePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_phase_list(cluster, NULL, 0, 0); + attribute::create_current_phase(cluster, 0); + attribute::create_operational_state_list(cluster, NULL, 0, 0); + attribute::create_operational_state(cluster, 0); + attribute::create_operational_error(cluster, NULL, 0, 0); + /* Events */ + event::create_operational_error(cluster); + } + + return cluster; +} + +} /* rvc_operational_state */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/rvc_operational_state/rvc_operational_state.h b/components/esp_matter/data_model/generated/clusters/rvc_operational_state/rvc_operational_state.h new file mode 100644 index 000000000..f8d8779ce --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/rvc_operational_state/rvc_operational_state.h @@ -0,0 +1,54 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace rvc_operational_state { + +namespace attribute { +attribute_t *create_phase_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_phase(cluster_t *cluster, nullable value); +attribute_t *create_countdown_time(cluster_t *cluster, nullable value); +attribute_t *create_operational_state_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_operational_state(cluster_t *cluster, uint8_t value); +attribute_t *create_operational_error(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_pause(cluster_t *cluster); +command_t *create_resume(cluster_t *cluster); +command_t *create_operational_command_response(cluster_t *cluster); +command_t *create_go_home(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_operational_error(cluster_t *cluster); +event_t *create_operation_completion(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* rvc_operational_state */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/rvc_operational_state/rvc_operational_state_ids.h b/components/esp_matter/data_model/generated/clusters/rvc_operational_state/rvc_operational_state_ids.h new file mode 100644 index 000000000..6fd8c411a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/rvc_operational_state/rvc_operational_state_ids.h @@ -0,0 +1,73 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace rvc_operational_state { + +inline constexpr uint32_t Id = 0x0061; + +namespace attribute { +namespace PhaseList { +inline constexpr uint32_t Id = 0x0000; +} /* PhaseList */ +namespace CurrentPhase { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentPhase */ +namespace CountdownTime { +inline constexpr uint32_t Id = 0x0002; +} /* CountdownTime */ +namespace OperationalStateList { +inline constexpr uint32_t Id = 0x0003; +} /* OperationalStateList */ +namespace OperationalState { +inline constexpr uint32_t Id = 0x0004; +} /* OperationalState */ +namespace OperationalError { +inline constexpr uint32_t Id = 0x0005; +} /* OperationalError */ +} /* attribute */ + +namespace command { +namespace Pause { +inline constexpr uint32_t Id = 0x00; +} /* Pause */ +namespace Resume { +inline constexpr uint32_t Id = 0x03; +} /* Resume */ +namespace OperationalCommandResponse { +inline constexpr uint32_t Id = 0x04; +} /* OperationalCommandResponse */ +namespace GoHome { +inline constexpr uint32_t Id = 0x80; +} /* GoHome */ +} /* command */ + +namespace event { +namespace OperationalError { +inline constexpr uint32_t Id = 0x00; +} /* OperationalError */ +namespace OperationCompletion { +inline constexpr uint32_t Id = 0x01; +} /* OperationCompletion */ +} /* event */ + +} /* rvc_operational_state */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/rvc_run_mode/rvc_run_mode.cpp b/components/esp_matter/data_model/generated/clusters/rvc_run_mode/rvc_run_mode.cpp new file mode 100644 index 000000000..707c57742 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/rvc_run_mode/rvc_run_mode.cpp @@ -0,0 +1,125 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "rvc_run_mode_cluster"; +constexpr uint16_t cluster_revision = 4; + +namespace esp_matter { +namespace cluster { +namespace rvc_run_mode { + +namespace feature { +namespace direct_mode_change { +uint32_t get_id() +{ + return DirectModeChange::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* direct_mode_change */ + +} /* feature */ + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedModes::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_change_to_mode(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToMode::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_change_to_mode_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToModeResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, rvc_run_mode::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, rvc_run_mode::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = RvcRunModeDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterRvcRunModePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_change_to_mode(cluster); + command::create_change_to_mode_response(cluster); + } + + return cluster; +} + +} /* rvc_run_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/rvc_run_mode/rvc_run_mode.h b/components/esp_matter/data_model/generated/clusters/rvc_run_mode/rvc_run_mode.h new file mode 100644 index 000000000..9f7dc11ac --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/rvc_run_mode/rvc_run_mode.h @@ -0,0 +1,51 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace rvc_run_mode { + +namespace feature { +namespace direct_mode_change { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* direct_mode_change */ + +} /* feature */ + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_change_to_mode(cluster_t *cluster); +command_t *create_change_to_mode_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* rvc_run_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/rvc_run_mode/rvc_run_mode_ids.h b/components/esp_matter/data_model/generated/clusters/rvc_run_mode/rvc_run_mode_ids.h new file mode 100644 index 000000000..55b4093cf --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/rvc_run_mode/rvc_run_mode_ids.h @@ -0,0 +1,52 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace rvc_run_mode { + +inline constexpr uint32_t Id = 0x0054; + +namespace feature { +namespace DirectModeChange { +inline constexpr uint32_t Id = 0x100000; +} /* DirectModeChange */ +} /* feature */ + +namespace attribute { +namespace SupportedModes { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedModes */ +namespace CurrentMode { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentMode */ +} /* attribute */ + +namespace command { +namespace ChangeToMode { +inline constexpr uint32_t Id = 0x00; +} /* ChangeToMode */ +namespace ChangeToModeResponse { +inline constexpr uint32_t Id = 0x01; +} /* ChangeToModeResponse */ +} /* command */ + +} /* rvc_run_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/scenes_management/scenes_management.cpp b/components/esp_matter/data_model/generated/clusters/scenes_management/scenes_management.cpp new file mode 100644 index 000000000..c779588b9 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/scenes_management/scenes_management.cpp @@ -0,0 +1,210 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "scenes_management_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace scenes_management { + +namespace feature { +namespace scene_names { +uint32_t get_id() +{ + return SceneNames::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* scene_names */ + +} /* feature */ + +namespace attribute { +attribute_t *create_scene_table_size(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SceneTableSize::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_fabric_scene_info(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, FabricSceneInfo::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_add_scene(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AddScene::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_add_scene_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AddSceneResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_view_scene(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ViewScene::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_view_scene_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ViewSceneResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_remove_scene(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RemoveScene::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_remove_scene_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RemoveSceneResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_remove_all_scenes(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RemoveAllScenes::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_remove_all_scenes_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RemoveAllScenesResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_store_scene(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, StoreScene::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_store_scene_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, StoreSceneResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_recall_scene(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RecallScene::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_get_scene_membership(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetSceneMembership::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_get_scene_membership_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetSceneMembershipResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_copy_scene(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CopyScene::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_copy_scene_response(cluster_t *cluster) +{ + VerifyOrReturnValue(has_command(CopyScene, COMMAND_FLAG_ACCEPTED), NULL); + return esp_matter::command::create(cluster, CopySceneResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, scenes_management::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, scenes_management::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterScenesManagementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_scene_table_size(cluster, config->scene_table_size); + attribute::create_fabric_scene_info(cluster, NULL, 0, 0); + command::create_add_scene(cluster); + command::create_add_scene_response(cluster); + command::create_view_scene(cluster); + command::create_view_scene_response(cluster); + command::create_remove_scene(cluster); + command::create_remove_scene_response(cluster); + command::create_remove_all_scenes(cluster); + command::create_remove_all_scenes_response(cluster); + command::create_store_scene(cluster); + command::create_store_scene_response(cluster); + command::create_recall_scene(cluster); + command::create_get_scene_membership(cluster); + command::create_get_scene_membership_response(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterScenesManagementClusterServerInitCallback, + ESPMatterScenesManagementClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* scenes_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/scenes_management/scenes_management.h b/components/esp_matter/data_model/generated/clusters/scenes_management/scenes_management.h new file mode 100644 index 000000000..454dcc568 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/scenes_management/scenes_management.h @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace scenes_management { + +namespace feature { +namespace scene_names { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* scene_names */ + +} /* feature */ + +namespace attribute { +attribute_t *create_scene_table_size(cluster_t *cluster, uint16_t value); +attribute_t *create_fabric_scene_info(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_add_scene(cluster_t *cluster); +command_t *create_add_scene_response(cluster_t *cluster); +command_t *create_view_scene(cluster_t *cluster); +command_t *create_view_scene_response(cluster_t *cluster); +command_t *create_remove_scene(cluster_t *cluster); +command_t *create_remove_scene_response(cluster_t *cluster); +command_t *create_remove_all_scenes(cluster_t *cluster); +command_t *create_remove_all_scenes_response(cluster_t *cluster); +command_t *create_store_scene(cluster_t *cluster); +command_t *create_store_scene_response(cluster_t *cluster); +command_t *create_recall_scene(cluster_t *cluster); +command_t *create_get_scene_membership(cluster_t *cluster); +command_t *create_get_scene_membership_response(cluster_t *cluster); +command_t *create_copy_scene(cluster_t *cluster); +command_t *create_copy_scene_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint16_t scene_table_size; + config() : scene_table_size(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* scenes_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/scenes_management/scenes_management_ids.h b/components/esp_matter/data_model/generated/clusters/scenes_management/scenes_management_ids.h new file mode 100644 index 000000000..1c299e6d4 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/scenes_management/scenes_management_ids.h @@ -0,0 +1,91 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace scenes_management { + +inline constexpr uint32_t Id = 0x0062; + +namespace feature { +namespace SceneNames { +inline constexpr uint32_t Id = 0x1; +} /* SceneNames */ +} /* feature */ + +namespace attribute { +namespace SceneTableSize { +inline constexpr uint32_t Id = 0x0001; +} /* SceneTableSize */ +namespace FabricSceneInfo { +inline constexpr uint32_t Id = 0x0002; +} /* FabricSceneInfo */ +} /* attribute */ + +namespace command { +namespace AddScene { +inline constexpr uint32_t Id = 0x00; +} /* AddScene */ +namespace AddSceneResponse { +inline constexpr uint32_t Id = 0x00; +} /* AddSceneResponse */ +namespace ViewScene { +inline constexpr uint32_t Id = 0x01; +} /* ViewScene */ +namespace ViewSceneResponse { +inline constexpr uint32_t Id = 0x01; +} /* ViewSceneResponse */ +namespace RemoveScene { +inline constexpr uint32_t Id = 0x02; +} /* RemoveScene */ +namespace RemoveSceneResponse { +inline constexpr uint32_t Id = 0x02; +} /* RemoveSceneResponse */ +namespace RemoveAllScenes { +inline constexpr uint32_t Id = 0x03; +} /* RemoveAllScenes */ +namespace RemoveAllScenesResponse { +inline constexpr uint32_t Id = 0x03; +} /* RemoveAllScenesResponse */ +namespace StoreScene { +inline constexpr uint32_t Id = 0x04; +} /* StoreScene */ +namespace StoreSceneResponse { +inline constexpr uint32_t Id = 0x04; +} /* StoreSceneResponse */ +namespace RecallScene { +inline constexpr uint32_t Id = 0x05; +} /* RecallScene */ +namespace GetSceneMembership { +inline constexpr uint32_t Id = 0x06; +} /* GetSceneMembership */ +namespace GetSceneMembershipResponse { +inline constexpr uint32_t Id = 0x06; +} /* GetSceneMembershipResponse */ +namespace CopyScene { +inline constexpr uint32_t Id = 0x40; +} /* CopyScene */ +namespace CopySceneResponse { +inline constexpr uint32_t Id = 0x40; +} /* CopySceneResponse */ +} /* command */ + +} /* scenes_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/service_area/service_area.cpp b/components/esp_matter/data_model/generated/clusters/service_area/service_area.cpp new file mode 100644 index 000000000..1162895b0 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/service_area/service_area.cpp @@ -0,0 +1,200 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "service_area_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace service_area { + +namespace feature { +namespace select_while_running { +uint32_t get_id() +{ + return SelectWhileRunning::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* select_while_running */ + +namespace progress_reporting { +uint32_t get_id() +{ + return ProgressReporting::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_progress(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* progress_reporting */ + +namespace maps { +uint32_t get_id() +{ + return Maps::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_supported_maps(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* maps */ + +} /* feature */ + +namespace attribute { +attribute_t *create_supported_areas(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedAreas::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_supported_maps(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(maps), NULL); + return esp_matter::attribute::create(cluster, SupportedMaps::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_selected_areas(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SelectedAreas::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_area(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CurrentArea::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_estimated_end_time(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, EstimatedEndTime::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_progress(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(progress_reporting), NULL); + return esp_matter::attribute::create(cluster, Progress::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_select_areas(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SelectAreas::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_select_areas_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SelectAreasResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_skip_area(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SkipArea::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_skip_area_response(cluster_t *cluster) +{ + VerifyOrReturnValue(has_command(SkipArea, COMMAND_FLAG_ACCEPTED), NULL); + return esp_matter::command::create(cluster, SkipAreaResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, service_area::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, service_area::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ServiceAreaDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterServiceAreaPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_supported_areas(cluster, NULL, 0, 0); + attribute::create_selected_areas(cluster, NULL, 0, 0); + command::create_select_areas(cluster); + command::create_select_areas_response(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* service_area */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/service_area/service_area.h b/components/esp_matter/data_model/generated/clusters/service_area/service_area.h new file mode 100644 index 000000000..c1659c2ae --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/service_area/service_area.h @@ -0,0 +1,67 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace service_area { + +namespace feature { +namespace select_while_running { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* select_while_running */ + +namespace progress_reporting { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* progress_reporting */ + +namespace maps { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* maps */ + +} /* feature */ + +namespace attribute { +attribute_t *create_supported_areas(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_supported_maps(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_selected_areas(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_area(cluster_t *cluster, nullable value); +attribute_t *create_estimated_end_time(cluster_t *cluster, nullable value); +attribute_t *create_progress(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_select_areas(cluster_t *cluster); +command_t *create_select_areas_response(cluster_t *cluster); +command_t *create_skip_area(cluster_t *cluster); +command_t *create_skip_area_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* service_area */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/service_area/service_area_ids.h b/components/esp_matter/data_model/generated/clusters/service_area/service_area_ids.h new file mode 100644 index 000000000..00b59d1ad --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/service_area/service_area_ids.h @@ -0,0 +1,76 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace service_area { + +inline constexpr uint32_t Id = 0x0150; + +namespace feature { +namespace SelectWhileRunning { +inline constexpr uint32_t Id = 0x1; +} /* SelectWhileRunning */ +namespace ProgressReporting { +inline constexpr uint32_t Id = 0x2; +} /* ProgressReporting */ +namespace Maps { +inline constexpr uint32_t Id = 0x4; +} /* Maps */ +} /* feature */ + +namespace attribute { +namespace SupportedAreas { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedAreas */ +namespace SupportedMaps { +inline constexpr uint32_t Id = 0x0001; +} /* SupportedMaps */ +namespace SelectedAreas { +inline constexpr uint32_t Id = 0x0002; +} /* SelectedAreas */ +namespace CurrentArea { +inline constexpr uint32_t Id = 0x0003; +} /* CurrentArea */ +namespace EstimatedEndTime { +inline constexpr uint32_t Id = 0x0004; +} /* EstimatedEndTime */ +namespace Progress { +inline constexpr uint32_t Id = 0x0005; +} /* Progress */ +} /* attribute */ + +namespace command { +namespace SelectAreas { +inline constexpr uint32_t Id = 0x00; +} /* SelectAreas */ +namespace SelectAreasResponse { +inline constexpr uint32_t Id = 0x01; +} /* SelectAreasResponse */ +namespace SkipArea { +inline constexpr uint32_t Id = 0x02; +} /* SkipArea */ +namespace SkipAreaResponse { +inline constexpr uint32_t Id = 0x03; +} /* SkipAreaResponse */ +} /* command */ + +} /* service_area */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/smoke_co_alarm/smoke_co_alarm.cpp b/components/esp_matter/data_model/generated/clusters/smoke_co_alarm/smoke_co_alarm.cpp new file mode 100644 index 000000000..e2e47161c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/smoke_co_alarm/smoke_co_alarm.cpp @@ -0,0 +1,314 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "smoke_co_alarm_cluster"; +constexpr uint16_t cluster_revision = 1; + +static esp_err_t esp_matter_command_callback_self_test_request(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::SmokeCoAlarm::Commands::SelfTestRequest::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfSmokeCoAlarmClusterSelfTestRequestCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace smoke_co_alarm { + +namespace feature { +namespace smoke_alarm { +uint32_t get_id() +{ + return SmokeAlarm::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_smoke_state(cluster, config->smoke_state); + event::create_smoke_alarm(cluster); + + return ESP_OK; +} +} /* smoke_alarm */ + +namespace co_alarm { +uint32_t get_id() +{ + return COAlarm::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_co_state(cluster, config->co_state); + event::create_co_alarm(cluster); + + return ESP_OK; +} +} /* co_alarm */ + +} /* feature */ + +namespace attribute { +attribute_t *create_expressed_state(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ExpressedState::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(8)); + return attribute; +} + +attribute_t *create_smoke_state(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(smoke_alarm), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, SmokeState::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_co_state(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(co_alarm), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, COState::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_battery_alert(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, BatteryAlert::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_device_muted(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, DeviceMuted::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(1)); + return attribute; +} + +attribute_t *create_test_in_progress(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, TestInProgress::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_hardware_fault_alert(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, HardwareFaultAlert::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_end_of_service_alert(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, EndOfServiceAlert::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(1)); + return attribute; +} + +attribute_t *create_interconnect_smoke_alarm(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, InterconnectSmokeAlarm::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_interconnect_co_alarm(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, InterconnectCOAlarm::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_contamination_state(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ContaminationState::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(3)); + return attribute; +} + +attribute_t *create_smoke_sensitivity_level(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SmokeSensitivityLevel::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_expiry_date(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ExpiryDate::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_self_test_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SelfTestRequest::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_self_test_request); +} + +} /* command */ + +namespace event { +event_t *create_smoke_alarm(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(smoke_alarm), NULL); + return esp_matter::event::create(cluster, SmokeAlarm::Id); +} + +event_t *create_co_alarm(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(co_alarm), NULL); + return esp_matter::event::create(cluster, COAlarm::Id); +} + +event_t *create_low_battery(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, LowBattery::Id); +} + +event_t *create_hardware_fault(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, HardwareFault::Id); +} + +event_t *create_end_of_service(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, EndOfService::Id); +} + +event_t *create_self_test_complete(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, SelfTestComplete::Id); +} + +event_t *create_alarm_muted(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, AlarmMuted::Id); +} + +event_t *create_mute_ended(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, MuteEnded::Id); +} + +event_t *create_interconnect_smoke_alarm(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, InterconnectSmokeAlarm::Id); +} + +event_t *create_interconnect_co_alarm(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, InterconnectCOAlarm::Id); +} + +event_t *create_all_clear(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, AllClear::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, smoke_co_alarm::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, smoke_co_alarm::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterSmokeCoAlarmPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_expressed_state(cluster, config->expressed_state); + attribute::create_battery_alert(cluster, config->battery_alert); + attribute::create_test_in_progress(cluster, config->test_in_progress); + attribute::create_hardware_fault_alert(cluster, config->hardware_fault_alert); + attribute::create_end_of_service_alert(cluster, config->end_of_service_alert); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("SmokeAlarm,COAlarm", + feature::smoke_alarm::get_id(), feature::co_alarm::get_id()); + if (feature_map & feature::smoke_alarm::get_id()) { + VerifyOrReturnValue(feature::smoke_alarm::add(cluster, &(config->features.smoke_alarm)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::co_alarm::get_id()) { + VerifyOrReturnValue(feature::co_alarm::add(cluster, &(config->features.co_alarm)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + /* Events */ + event::create_low_battery(cluster); + event::create_hardware_fault(cluster); + event::create_end_of_service(cluster); + event::create_self_test_complete(cluster); + event::create_all_clear(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* smoke_co_alarm */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/smoke_co_alarm/smoke_co_alarm.h b/components/esp_matter/data_model/generated/clusters/smoke_co_alarm/smoke_co_alarm.h new file mode 100644 index 000000000..06eb6683c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/smoke_co_alarm/smoke_co_alarm.h @@ -0,0 +1,97 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace smoke_co_alarm { + +namespace feature { +namespace smoke_alarm { +typedef struct config { + uint8_t smoke_state; + config() : smoke_state(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* smoke_alarm */ + +namespace co_alarm { +typedef struct config { + uint8_t co_state; + config() : co_state(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* co_alarm */ + +} /* feature */ + +namespace attribute { +attribute_t *create_expressed_state(cluster_t *cluster, uint8_t value); +attribute_t *create_smoke_state(cluster_t *cluster, uint8_t value); +attribute_t *create_co_state(cluster_t *cluster, uint8_t value); +attribute_t *create_battery_alert(cluster_t *cluster, uint8_t value); +attribute_t *create_device_muted(cluster_t *cluster, uint8_t value); +attribute_t *create_test_in_progress(cluster_t *cluster, bool value); +attribute_t *create_hardware_fault_alert(cluster_t *cluster, bool value); +attribute_t *create_end_of_service_alert(cluster_t *cluster, uint8_t value); +attribute_t *create_interconnect_smoke_alarm(cluster_t *cluster, uint8_t value); +attribute_t *create_interconnect_co_alarm(cluster_t *cluster, uint8_t value); +attribute_t *create_contamination_state(cluster_t *cluster, uint8_t value); +attribute_t *create_smoke_sensitivity_level(cluster_t *cluster, uint8_t value); +attribute_t *create_expiry_date(cluster_t *cluster, uint32_t value); +} /* attribute */ + +namespace command { +command_t *create_self_test_request(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_smoke_alarm(cluster_t *cluster); +event_t *create_co_alarm(cluster_t *cluster); +event_t *create_low_battery(cluster_t *cluster); +event_t *create_hardware_fault(cluster_t *cluster); +event_t *create_end_of_service(cluster_t *cluster); +event_t *create_self_test_complete(cluster_t *cluster); +event_t *create_alarm_muted(cluster_t *cluster); +event_t *create_mute_ended(cluster_t *cluster); +event_t *create_interconnect_smoke_alarm(cluster_t *cluster); +event_t *create_interconnect_co_alarm(cluster_t *cluster); +event_t *create_all_clear(cluster_t *cluster); +} /* event */ + +typedef struct config { + uint8_t expressed_state; + uint8_t battery_alert; + bool test_in_progress; + bool hardware_fault_alert; + uint8_t end_of_service_alert; + struct { + feature::smoke_alarm::config_t smoke_alarm; + feature::co_alarm::config_t co_alarm; + } features; + uint32_t feature_flags; + config() : expressed_state(0), battery_alert(0), test_in_progress(false), hardware_fault_alert(false), end_of_service_alert(0), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* smoke_co_alarm */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/smoke_co_alarm/smoke_co_alarm_ids.h b/components/esp_matter/data_model/generated/clusters/smoke_co_alarm/smoke_co_alarm_ids.h new file mode 100644 index 000000000..0d9d81fa6 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/smoke_co_alarm/smoke_co_alarm_ids.h @@ -0,0 +1,121 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace smoke_co_alarm { + +inline constexpr uint32_t Id = 0x005C; + +namespace feature { +namespace SmokeAlarm { +inline constexpr uint32_t Id = 0x1; +} /* SmokeAlarm */ +namespace COAlarm { +inline constexpr uint32_t Id = 0x2; +} /* COAlarm */ +} /* feature */ + +namespace attribute { +namespace ExpressedState { +inline constexpr uint32_t Id = 0x0000; +} /* ExpressedState */ +namespace SmokeState { +inline constexpr uint32_t Id = 0x0001; +} /* SmokeState */ +namespace COState { +inline constexpr uint32_t Id = 0x0002; +} /* COState */ +namespace BatteryAlert { +inline constexpr uint32_t Id = 0x0003; +} /* BatteryAlert */ +namespace DeviceMuted { +inline constexpr uint32_t Id = 0x0004; +} /* DeviceMuted */ +namespace TestInProgress { +inline constexpr uint32_t Id = 0x0005; +} /* TestInProgress */ +namespace HardwareFaultAlert { +inline constexpr uint32_t Id = 0x0006; +} /* HardwareFaultAlert */ +namespace EndOfServiceAlert { +inline constexpr uint32_t Id = 0x0007; +} /* EndOfServiceAlert */ +namespace InterconnectSmokeAlarm { +inline constexpr uint32_t Id = 0x0008; +} /* InterconnectSmokeAlarm */ +namespace InterconnectCOAlarm { +inline constexpr uint32_t Id = 0x0009; +} /* InterconnectCOAlarm */ +namespace ContaminationState { +inline constexpr uint32_t Id = 0x000A; +} /* ContaminationState */ +namespace SmokeSensitivityLevel { +inline constexpr uint32_t Id = 0x000B; +} /* SmokeSensitivityLevel */ +namespace ExpiryDate { +inline constexpr uint32_t Id = 0x000C; +} /* ExpiryDate */ +} /* attribute */ + +namespace command { +namespace SelfTestRequest { +inline constexpr uint32_t Id = 0x00; +} /* SelfTestRequest */ +} /* command */ + +namespace event { +namespace SmokeAlarm { +inline constexpr uint32_t Id = 0x00; +} /* SmokeAlarm */ +namespace COAlarm { +inline constexpr uint32_t Id = 0x01; +} /* COAlarm */ +namespace LowBattery { +inline constexpr uint32_t Id = 0x02; +} /* LowBattery */ +namespace HardwareFault { +inline constexpr uint32_t Id = 0x03; +} /* HardwareFault */ +namespace EndOfService { +inline constexpr uint32_t Id = 0x04; +} /* EndOfService */ +namespace SelfTestComplete { +inline constexpr uint32_t Id = 0x05; +} /* SelfTestComplete */ +namespace AlarmMuted { +inline constexpr uint32_t Id = 0x06; +} /* AlarmMuted */ +namespace MuteEnded { +inline constexpr uint32_t Id = 0x07; +} /* MuteEnded */ +namespace InterconnectSmokeAlarm { +inline constexpr uint32_t Id = 0x08; +} /* InterconnectSmokeAlarm */ +namespace InterconnectCOAlarm { +inline constexpr uint32_t Id = 0x09; +} /* InterconnectCOAlarm */ +namespace AllClear { +inline constexpr uint32_t Id = 0x0A; +} /* AllClear */ +} /* event */ + +} /* smoke_co_alarm */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/software_diagnostics/software_diagnostics.cpp b/components/esp_matter/data_model/generated/clusters/software_diagnostics/software_diagnostics.cpp new file mode 100644 index 000000000..a3be2af7a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/software_diagnostics/software_diagnostics.cpp @@ -0,0 +1,143 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "software_diagnostics_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace software_diagnostics { + +namespace feature { +namespace watermarks { +uint32_t get_id() +{ + return Watermarks::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_current_heap_high_watermark(cluster, config->current_heap_high_watermark); + command::create_reset_watermarks(cluster); + + return ESP_OK; +} +} /* watermarks */ + +} /* feature */ + +namespace attribute { +attribute_t *create_thread_metrics(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ThreadMetrics::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_heap_free(cluster_t *cluster, uint64_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentHeapFree::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint64(0), esp_matter_uint64(4294967294)); + return attribute; +} + +attribute_t *create_current_heap_used(cluster_t *cluster, uint64_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentHeapUsed::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint64(0), esp_matter_uint64(4294967294)); + return attribute; +} + +attribute_t *create_current_heap_high_watermark(cluster_t *cluster, uint64_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(watermarks), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentHeapHighWatermark::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint64(0), esp_matter_uint64(4294967294)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_reset_watermarks(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(watermarks), NULL); + return esp_matter::command::create(cluster, ResetWatermarks::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_software_fault(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, SoftwareFault::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, software_diagnostics::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, software_diagnostics::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterSoftwareDiagnosticsPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterSoftwareDiagnosticsClusterServerInitCallback, + ESPMatterSoftwareDiagnosticsClusterServerShutdownCallback); + } + + return cluster; +} + +} /* software_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/software_diagnostics/software_diagnostics.h b/components/esp_matter/data_model/generated/clusters/software_diagnostics/software_diagnostics.h new file mode 100644 index 000000000..cc8f71929 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/software_diagnostics/software_diagnostics.h @@ -0,0 +1,59 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace software_diagnostics { + +namespace feature { +namespace watermarks { +typedef struct config { + uint64_t current_heap_high_watermark; + config() : current_heap_high_watermark(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* watermarks */ + +} /* feature */ + +namespace attribute { +attribute_t *create_thread_metrics(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_heap_free(cluster_t *cluster, uint64_t value); +attribute_t *create_current_heap_used(cluster_t *cluster, uint64_t value); +attribute_t *create_current_heap_high_watermark(cluster_t *cluster, uint64_t value); +} /* attribute */ + +namespace command { +command_t *create_reset_watermarks(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_software_fault(cluster_t *cluster); +} /* event */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* software_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/software_diagnostics/software_diagnostics_ids.h b/components/esp_matter/data_model/generated/clusters/software_diagnostics/software_diagnostics_ids.h new file mode 100644 index 000000000..e546b3224 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/software_diagnostics/software_diagnostics_ids.h @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace software_diagnostics { + +inline constexpr uint32_t Id = 0x0034; + +namespace feature { +namespace Watermarks { +inline constexpr uint32_t Id = 0x1; +} /* Watermarks */ +} /* feature */ + +namespace attribute { +namespace ThreadMetrics { +inline constexpr uint32_t Id = 0x0000; +} /* ThreadMetrics */ +namespace CurrentHeapFree { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentHeapFree */ +namespace CurrentHeapUsed { +inline constexpr uint32_t Id = 0x0002; +} /* CurrentHeapUsed */ +namespace CurrentHeapHighWatermark { +inline constexpr uint32_t Id = 0x0003; +} /* CurrentHeapHighWatermark */ +} /* attribute */ + +namespace command { +namespace ResetWatermarks { +inline constexpr uint32_t Id = 0x00; +} /* ResetWatermarks */ +} /* command */ + +namespace event { +namespace SoftwareFault { +inline constexpr uint32_t Id = 0x00; +} /* SoftwareFault */ +} /* event */ + +} /* software_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/soil_measurement/soil_measurement.cpp b/components/esp_matter/data_model/generated/clusters/soil_measurement/soil_measurement.cpp new file mode 100644 index 000000000..95d9aa54c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/soil_measurement/soil_measurement.cpp @@ -0,0 +1,101 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "soil_measurement_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace soil_measurement { + +namespace attribute { +attribute_t *create_soil_moisture_measurement_limits(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SoilMoistureMeasurementLimits::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_soil_moisture_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SoilMoistureMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, soil_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, soil_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterSoilMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_soil_moisture_measured_value(cluster, config->soil_moisture_measured_value); + attribute::create_soil_moisture_measurement_limits(cluster, NULL, 0, 0); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterSoilMeasurementClusterServerInitCallback, + ESPMatterSoilMeasurementClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* soil_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/soil_measurement/soil_measurement.h b/components/esp_matter/data_model/generated/clusters/soil_measurement/soil_measurement.h new file mode 100644 index 000000000..883528ab5 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/soil_measurement/soil_measurement.h @@ -0,0 +1,38 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace soil_measurement { + +namespace attribute { +attribute_t *create_soil_moisture_measurement_limits(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_soil_moisture_measured_value(cluster_t *cluster, nullable value); +} /* attribute */ + +typedef struct config { + nullable soil_moisture_measured_value; + config() : soil_moisture_measured_value(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* soil_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/soil_measurement/soil_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/soil_measurement/soil_measurement_ids.h new file mode 100644 index 000000000..4f019bdb7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/soil_measurement/soil_measurement_ids.h @@ -0,0 +1,37 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace soil_measurement { + +inline constexpr uint32_t Id = 0x0430; + +namespace attribute { +namespace SoilMoistureMeasurementLimits { +inline constexpr uint32_t Id = 0x0000; +} /* SoilMoistureMeasurementLimits */ +namespace SoilMoistureMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* SoilMoistureMeasuredValue */ +} /* attribute */ + +} /* soil_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/switch_cluster/switch_cluster.cpp b/components/esp_matter/data_model/generated/clusters/switch_cluster/switch_cluster.cpp new file mode 100644 index 000000000..b1a64c1c2 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/switch_cluster/switch_cluster.cpp @@ -0,0 +1,342 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using chip::EndpointId; +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "switch_cluster_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace switch_cluster { + +namespace feature { +namespace latching_switch { +uint32_t get_id() +{ + return LatchingSwitch::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + event::create_switch_latched(cluster); + + return ESP_OK; +} +} /* latching_switch */ + +namespace momentary_switch { +uint32_t get_id() +{ + return MomentarySwitch::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + event::create_initial_press(cluster); + + return ESP_OK; +} +} /* momentary_switch */ + +namespace momentary_switch_release { +uint32_t get_id() +{ + return MomentarySwitchRelease::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(((has_feature(momentary_switch)) && (!(has_feature(action_switch)))), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + event::create_short_release(cluster); + + return ESP_OK; +} +} /* momentary_switch_release */ + +namespace momentary_switch_long_press { +uint32_t get_id() +{ + return MomentarySwitchLongPress::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(((has_feature(momentary_switch)) && (((has_feature(momentary_switch_release)) || (has_feature(action_switch))))), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + event::create_long_press(cluster); + event::create_long_release(cluster); + + return ESP_OK; +} +} /* momentary_switch_long_press */ + +namespace momentary_switch_multi_press { +uint32_t get_id() +{ + return MomentarySwitchMultiPress::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError((has_feature(action_switch) || ((has_feature(momentary_switch)) && (has_feature(momentary_switch_release)))), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_multi_press_max(cluster, config->multi_press_max); + event::create_multi_press_ongoing(cluster); + event::create_multi_press_complete(cluster); + + return ESP_OK; +} +} /* momentary_switch_multi_press */ + +namespace action_switch { +uint32_t get_id() +{ + return ActionSwitch::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(momentary_switch), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + event_t *multi_press_ongoing = esp_matter::event::get(cluster, event::MultiPressOngoing::Id); + if (multi_press_ongoing) { + esp_matter::event::destroy(cluster, multi_press_ongoing); + } + + return ESP_OK; +} +} /* action_switch */ + +} /* feature */ + +namespace attribute { +attribute_t *create_number_of_positions(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfPositions::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(2), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_current_position(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentPosition::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_multi_press_max(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(momentary_switch_multi_press), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MultiPressMax::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(2), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ + +namespace event { +event_t *create_switch_latched(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(latching_switch), NULL); + return esp_matter::event::create(cluster, SwitchLatched::Id); +} + +event_t *create_initial_press(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(momentary_switch), NULL); + return esp_matter::event::create(cluster, InitialPress::Id); +} + +event_t *create_long_press(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(momentary_switch_long_press), NULL); + return esp_matter::event::create(cluster, LongPress::Id); +} + +event_t *create_short_release(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(momentary_switch_release), NULL); + return esp_matter::event::create(cluster, ShortRelease::Id); +} + +event_t *create_long_release(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(momentary_switch_long_press), NULL); + return esp_matter::event::create(cluster, LongRelease::Id); +} + +event_t *create_multi_press_ongoing(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(momentary_switch_multi_press)) && (!(has_feature(action_switch)))), NULL); + return esp_matter::event::create(cluster, MultiPressOngoing::Id); +} + +event_t *create_multi_press_complete(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(momentary_switch_multi_press), NULL); + return esp_matter::event::create(cluster, MultiPressComplete::Id); +} + +esp_err_t send_switch_latched(EndpointId endpoint, uint8_t new_position) +{ + SwitchServer::Instance().OnSwitchLatch(endpoint, new_position); + return ESP_OK; +} + +esp_err_t send_initial_press(EndpointId endpoint, uint8_t new_position) +{ + SwitchServer::Instance().OnInitialPress(endpoint, new_position); + return ESP_OK; +} + +esp_err_t send_long_press(EndpointId endpoint, uint8_t new_position) +{ + SwitchServer::Instance().OnLongPress(endpoint, new_position); + return ESP_OK; +} + +esp_err_t send_short_release(EndpointId endpoint, uint8_t previous_position) +{ + SwitchServer::Instance().OnShortRelease(endpoint, previous_position); + return ESP_OK; +} + +esp_err_t send_long_release(EndpointId endpoint, uint8_t previous_position) +{ + SwitchServer::Instance().OnLongRelease(endpoint, previous_position); + return ESP_OK; +} + +esp_err_t send_multi_press_ongoing(EndpointId endpoint, uint8_t new_position, uint8_t count) +{ + SwitchServer::Instance().OnMultiPressOngoing(endpoint, new_position, count); + return ESP_OK; +} + +esp_err_t send_multi_press_complete(EndpointId endpoint, uint8_t new_position, uint8_t count) +{ + SwitchServer::Instance().OnMultiPressComplete(endpoint, new_position, count); + return ESP_OK; +} +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, switch_cluster::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, switch_cluster::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_number_of_positions(cluster, config->number_of_positions); + attribute::create_current_position(cluster, config->current_position); + + uint32_t feature_map = config->feature_flags; + if (feature_map & feature::action_switch::get_id()) { + VerifyOrReturnValue(feature::action_switch::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + VerifyOrReturnValue(feature::momentary_switch_multi_press::add(cluster, &(config->features.momentary_switch_multi_press)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } else { + if (feature_map & feature::momentary_switch_multi_press::get_id()) { + VerifyOrReturnValue(feature::momentary_switch_multi_press::add(cluster, &(config->features.momentary_switch_multi_press)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + VALIDATE_FEATURES_EXACT_ONE("LatchingSwitch,MomentarySwitch", + feature::latching_switch::get_id(), feature::momentary_switch::get_id()); + if (feature_map & feature::latching_switch::get_id()) { + VerifyOrReturnValue(feature::latching_switch::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::momentary_switch::get_id()) { + VerifyOrReturnValue(feature::momentary_switch::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::momentary_switch_release::get_id()) { + VerifyOrReturnValue(feature::momentary_switch_release::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::momentary_switch_long_press::get_id()) { + VerifyOrReturnValue(feature::momentary_switch_long_press::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + /* Events */ + event::create_multi_press_ongoing(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* switch_cluster */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/switch_cluster/switch_cluster.h b/components/esp_matter/data_model/generated/clusters/switch_cluster/switch_cluster.h new file mode 100644 index 000000000..d228d8878 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/switch_cluster/switch_cluster.h @@ -0,0 +1,98 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace switch_cluster { + +namespace feature { +namespace latching_switch { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* latching_switch */ + +namespace momentary_switch { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* momentary_switch */ + +namespace momentary_switch_release { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* momentary_switch_release */ + +namespace momentary_switch_long_press { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* momentary_switch_long_press */ + +namespace momentary_switch_multi_press { +typedef struct config { + uint8_t multi_press_max; + config() : multi_press_max(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* momentary_switch_multi_press */ + +namespace action_switch { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* action_switch */ + +} /* feature */ + +namespace attribute { +attribute_t *create_number_of_positions(cluster_t *cluster, uint8_t value); +attribute_t *create_current_position(cluster_t *cluster, uint8_t value); +attribute_t *create_multi_press_max(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace event { +event_t *create_switch_latched(cluster_t *cluster); +event_t *create_initial_press(cluster_t *cluster); +event_t *create_long_press(cluster_t *cluster); +event_t *create_short_release(cluster_t *cluster); +event_t *create_long_release(cluster_t *cluster); +event_t *create_multi_press_ongoing(cluster_t *cluster); +event_t *create_multi_press_complete(cluster_t *cluster); +esp_err_t send_switch_latched(chip::EndpointId endpoint, uint8_t new_position); +esp_err_t send_initial_press(chip::EndpointId endpoint, uint8_t new_position); +esp_err_t send_long_press(chip::EndpointId endpoint, uint8_t new_position); +esp_err_t send_short_release(chip::EndpointId endpoint, uint8_t previous_position); +esp_err_t send_long_release(chip::EndpointId endpoint, uint8_t previous_position); +esp_err_t send_multi_press_ongoing(chip::EndpointId endpoint, uint8_t new_position, uint8_t count); +esp_err_t send_multi_press_complete(chip::EndpointId endpoint, uint8_t new_position, uint8_t count); +} /* event */ + +typedef struct config { + uint8_t number_of_positions; + uint8_t current_position; + struct { + feature::momentary_switch_multi_press::config_t momentary_switch_multi_press; + } features; + uint32_t feature_flags; + config() : number_of_positions(0), current_position(0), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* switch_cluster */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/switch_cluster/switch_cluster_ids.h b/components/esp_matter/data_model/generated/clusters/switch_cluster/switch_cluster_ids.h new file mode 100644 index 000000000..7824a60ec --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/switch_cluster/switch_cluster_ids.h @@ -0,0 +1,85 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace switch_cluster { + +inline constexpr uint32_t Id = 0x003B; + +namespace feature { +namespace LatchingSwitch { +inline constexpr uint32_t Id = 0x1; +} /* LatchingSwitch */ +namespace MomentarySwitch { +inline constexpr uint32_t Id = 0x2; +} /* MomentarySwitch */ +namespace MomentarySwitchRelease { +inline constexpr uint32_t Id = 0x4; +} /* MomentarySwitchRelease */ +namespace MomentarySwitchLongPress { +inline constexpr uint32_t Id = 0x8; +} /* MomentarySwitchLongPress */ +namespace MomentarySwitchMultiPress { +inline constexpr uint32_t Id = 0x10; +} /* MomentarySwitchMultiPress */ +namespace ActionSwitch { +inline constexpr uint32_t Id = 0x20; +} /* ActionSwitch */ +} /* feature */ + +namespace attribute { +namespace NumberOfPositions { +inline constexpr uint32_t Id = 0x0000; +} /* NumberOfPositions */ +namespace CurrentPosition { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentPosition */ +namespace MultiPressMax { +inline constexpr uint32_t Id = 0x0002; +} /* MultiPressMax */ +} /* attribute */ + +namespace event { +namespace SwitchLatched { +inline constexpr uint32_t Id = 0x00; +} /* SwitchLatched */ +namespace InitialPress { +inline constexpr uint32_t Id = 0x01; +} /* InitialPress */ +namespace LongPress { +inline constexpr uint32_t Id = 0x02; +} /* LongPress */ +namespace ShortRelease { +inline constexpr uint32_t Id = 0x03; +} /* ShortRelease */ +namespace LongRelease { +inline constexpr uint32_t Id = 0x04; +} /* LongRelease */ +namespace MultiPressOngoing { +inline constexpr uint32_t Id = 0x05; +} /* MultiPressOngoing */ +namespace MultiPressComplete { +inline constexpr uint32_t Id = 0x06; +} /* MultiPressComplete */ +} /* event */ + +} /* switch_cluster */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/target_navigator/target_navigator.cpp b/components/esp_matter/data_model/generated/clusters/target_navigator/target_navigator.cpp new file mode 100644 index 000000000..d9fc00985 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/target_navigator/target_navigator.cpp @@ -0,0 +1,133 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "target_navigator_cluster"; +constexpr uint16_t cluster_revision = 2; + +static esp_err_t esp_matter_command_callback_navigate_target(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::TargetNavigator::Commands::NavigateTarget::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfTargetNavigatorClusterNavigateTargetCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace target_navigator { + +namespace attribute { +attribute_t *create_target_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, TargetList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_target(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, CurrentTarget::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +} /* attribute */ +namespace command { +command_t *create_navigate_target(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, NavigateTarget::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_navigate_target); +} + +command_t *create_navigate_target_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, NavigateTargetResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_target_updated(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, TargetUpdated::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, target_navigator::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, target_navigator::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = TargetNavigatorDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterTargetNavigatorPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_target_list(cluster, NULL, 0, 0); + command::create_navigate_target(cluster); + command::create_navigate_target_response(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* target_navigator */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/target_navigator/target_navigator.h b/components/esp_matter/data_model/generated/clusters/target_navigator/target_navigator.h new file mode 100644 index 000000000..efad39066 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/target_navigator/target_navigator.h @@ -0,0 +1,47 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace target_navigator { + +namespace attribute { +attribute_t *create_target_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_target(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_navigate_target(cluster_t *cluster); +command_t *create_navigate_target_response(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_target_updated(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* target_navigator */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/target_navigator/target_navigator_ids.h b/components/esp_matter/data_model/generated/clusters/target_navigator/target_navigator_ids.h new file mode 100644 index 000000000..f4d605c3d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/target_navigator/target_navigator_ids.h @@ -0,0 +1,52 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace target_navigator { + +inline constexpr uint32_t Id = 0x0505; + +namespace attribute { +namespace TargetList { +inline constexpr uint32_t Id = 0x0000; +} /* TargetList */ +namespace CurrentTarget { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentTarget */ +} /* attribute */ + +namespace command { +namespace NavigateTarget { +inline constexpr uint32_t Id = 0x00; +} /* NavigateTarget */ +namespace NavigateTargetResponse { +inline constexpr uint32_t Id = 0x01; +} /* NavigateTargetResponse */ +} /* command */ + +namespace event { +namespace TargetUpdated { +inline constexpr uint32_t Id = 0x00; +} /* TargetUpdated */ +} /* event */ + +} /* target_navigator */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/temperature_control/temperature_control.cpp b/components/esp_matter/data_model/generated/clusters/temperature_control/temperature_control.cpp new file mode 100644 index 000000000..be27dc023 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/temperature_control/temperature_control.cpp @@ -0,0 +1,225 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "temperature_control_cluster"; +constexpr uint16_t cluster_revision = 1; + +static esp_err_t esp_matter_command_callback_set_temperature(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::TemperatureControl::Commands::SetTemperature::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfTemperatureControlClusterSetTemperatureCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace temperature_control { + +namespace feature { +namespace temperature_number { +uint32_t get_id() +{ + return TemperatureNumber::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_temperature_setpoint(cluster, config->temperature_setpoint); + attribute::create_min_temperature(cluster, config->min_temperature); + attribute::create_max_temperature(cluster, config->max_temperature); + + return ESP_OK; +} +} /* temperature_number */ + +namespace temperature_level { +uint32_t get_id() +{ + return TemperatureLevel::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_selected_temperature_level(cluster, config->selected_temperature_level); + attribute::create_supported_temperature_levels(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* temperature_level */ + +namespace temperature_step { +uint32_t get_id() +{ + return TemperatureStep::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(temperature_number), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_step(cluster, config->step); + + return ESP_OK; +} +} /* temperature_step */ + +} /* feature */ + +namespace attribute { +attribute_t *create_temperature_setpoint(cluster_t *cluster, int16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(temperature_number), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, TemperatureSetpoint::Id, ATTRIBUTE_FLAG_NONE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_min_temperature(cluster_t *cluster, int16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(temperature_number), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MinTemperature::Id, ATTRIBUTE_FLAG_NONE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_max_temperature(cluster_t *cluster, int16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(temperature_number), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxTemperature::Id, ATTRIBUTE_FLAG_NONE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_step(cluster_t *cluster, int16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(temperature_step), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, Step::Id, ATTRIBUTE_FLAG_NONE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(1), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_selected_temperature_level(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(temperature_level), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, SelectedTemperatureLevel::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(31)); + return attribute; +} + +attribute_t *create_supported_temperature_levels(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(temperature_level), NULL); + return esp_matter::attribute::create(cluster, SupportedTemperatureLevels::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_set_temperature(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SetTemperature::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_temperature); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, temperature_control::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, temperature_control::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterTemperatureControlPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_EXACT_ONE("TemperatureNumber,TemperatureLevel", + feature::temperature_number::get_id(), feature::temperature_level::get_id()); + if (feature_map & feature::temperature_number::get_id()) { + VerifyOrReturnValue(feature::temperature_number::add(cluster, &(config->features.temperature_number)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::temperature_level::get_id()) { + VerifyOrReturnValue(feature::temperature_level::add(cluster, &(config->features.temperature_level)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::temperature_step::get_id()) { + VerifyOrReturnValue(feature::temperature_step::add(cluster, &(config->features.temperature_step)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + command::create_set_temperature(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* temperature_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/temperature_control/temperature_control.h b/components/esp_matter/data_model/generated/clusters/temperature_control/temperature_control.h new file mode 100644 index 000000000..e4f4bb938 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/temperature_control/temperature_control.h @@ -0,0 +1,83 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace temperature_control { + +namespace feature { +namespace temperature_number { +typedef struct config { + int16_t temperature_setpoint; + int16_t min_temperature; + int16_t max_temperature; + config() : temperature_setpoint(0), min_temperature(0), max_temperature(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* temperature_number */ + +namespace temperature_level { +typedef struct config { + uint8_t selected_temperature_level; + config() : selected_temperature_level(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* temperature_level */ + +namespace temperature_step { +typedef struct config { + int16_t step; + config() : step(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* temperature_step */ + +} /* feature */ + +namespace attribute { +attribute_t *create_temperature_setpoint(cluster_t *cluster, int16_t value); +attribute_t *create_min_temperature(cluster_t *cluster, int16_t value); +attribute_t *create_max_temperature(cluster_t *cluster, int16_t value); +attribute_t *create_step(cluster_t *cluster, int16_t value); +attribute_t *create_selected_temperature_level(cluster_t *cluster, uint8_t value); +attribute_t *create_supported_temperature_levels(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_set_temperature(cluster_t *cluster); +} /* command */ + +typedef struct config { + struct { + feature::temperature_number::config_t temperature_number; + feature::temperature_level::config_t temperature_level; + feature::temperature_step::config_t temperature_step; + } features; + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* temperature_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/temperature_control/temperature_control_ids.h b/components/esp_matter/data_model/generated/clusters/temperature_control/temperature_control_ids.h new file mode 100644 index 000000000..600f684dd --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/temperature_control/temperature_control_ids.h @@ -0,0 +1,67 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace temperature_control { + +inline constexpr uint32_t Id = 0x0056; + +namespace feature { +namespace TemperatureNumber { +inline constexpr uint32_t Id = 0x1; +} /* TemperatureNumber */ +namespace TemperatureLevel { +inline constexpr uint32_t Id = 0x2; +} /* TemperatureLevel */ +namespace TemperatureStep { +inline constexpr uint32_t Id = 0x4; +} /* TemperatureStep */ +} /* feature */ + +namespace attribute { +namespace TemperatureSetpoint { +inline constexpr uint32_t Id = 0x0000; +} /* TemperatureSetpoint */ +namespace MinTemperature { +inline constexpr uint32_t Id = 0x0001; +} /* MinTemperature */ +namespace MaxTemperature { +inline constexpr uint32_t Id = 0x0002; +} /* MaxTemperature */ +namespace Step { +inline constexpr uint32_t Id = 0x0003; +} /* Step */ +namespace SelectedTemperatureLevel { +inline constexpr uint32_t Id = 0x0004; +} /* SelectedTemperatureLevel */ +namespace SupportedTemperatureLevels { +inline constexpr uint32_t Id = 0x0005; +} /* SupportedTemperatureLevels */ +} /* attribute */ + +namespace command { +namespace SetTemperature { +inline constexpr uint32_t Id = 0x00; +} /* SetTemperature */ +} /* command */ + +} /* temperature_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/temperature_measurement/temperature_measurement.cpp b/components/esp_matter/data_model/generated/clusters/temperature_measurement/temperature_measurement.cpp new file mode 100644 index 000000000..920a88297 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/temperature_measurement/temperature_measurement.cpp @@ -0,0 +1,114 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "temperature_measurement_cluster"; +constexpr uint16_t cluster_revision = 4; + +namespace esp_matter { +namespace cluster { +namespace temperature_measurement { + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-27315), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Tolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(2048)); + return attribute; +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, temperature_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, temperature_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterTemperatureMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measured_value(cluster, config->measured_value); + attribute::create_min_measured_value(cluster, config->min_measured_value); + attribute::create_max_measured_value(cluster, config->max_measured_value); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* temperature_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/temperature_measurement/temperature_measurement.h b/components/esp_matter/data_model/generated/clusters/temperature_measurement/temperature_measurement.h new file mode 100644 index 000000000..5e3a2dbfe --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/temperature_measurement/temperature_measurement.h @@ -0,0 +1,42 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace temperature_measurement { + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value); +} /* attribute */ + +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + config() : measured_value(0), min_measured_value(0), max_measured_value(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* temperature_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/temperature_measurement/temperature_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/temperature_measurement/temperature_measurement_ids.h new file mode 100644 index 000000000..eb48f90d4 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/temperature_measurement/temperature_measurement_ids.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace temperature_measurement { + +inline constexpr uint32_t Id = 0x0402; + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace Tolerance { +inline constexpr uint32_t Id = 0x0003; +} /* Tolerance */ +} /* attribute */ + +} /* temperature_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thermostat/thermostat.cpp b/components/esp_matter/data_model/generated/clusters/thermostat/thermostat.cpp new file mode 100644 index 000000000..8da84a771 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thermostat/thermostat.cpp @@ -0,0 +1,764 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "thermostat_cluster"; +constexpr uint16_t cluster_revision = 9; + +static esp_err_t esp_matter_command_callback_setpoint_raise_lower(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Thermostat::Commands::SetpointRaiseLower::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfThermostatClusterSetpointRaiseLowerCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_set_active_schedule_request(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Thermostat::Commands::SetActiveScheduleRequest::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfThermostatClusterSetActiveScheduleRequestCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_set_active_preset_request(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::Thermostat::Commands::SetActivePresetRequest::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfThermostatClusterSetActivePresetRequestCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace thermostat { + +namespace feature { +namespace heating { +uint32_t get_id() +{ + return Heating::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_occupied_heating_setpoint(cluster, config->occupied_heating_setpoint); + attribute::create_unoccupied_heating_setpoint(cluster, config->unoccupied_heating_setpoint); + + return ESP_OK; +} +} /* heating */ + +namespace cooling { +uint32_t get_id() +{ + return Cooling::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_occupied_cooling_setpoint(cluster, config->occupied_cooling_setpoint); + attribute::create_unoccupied_cooling_setpoint(cluster, config->unoccupied_cooling_setpoint); + + return ESP_OK; +} +} /* cooling */ + +namespace occupancy { +uint32_t get_id() +{ + return Occupancy::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_occupancy(cluster, config->occupancy); + attribute::create_unoccupied_cooling_setpoint(cluster, config->unoccupied_cooling_setpoint); + attribute::create_unoccupied_heating_setpoint(cluster, config->unoccupied_heating_setpoint); + attribute::create_unoccupied_setback(cluster, config->unoccupied_setback); + attribute::create_unoccupied_setback_min(cluster, config->unoccupied_setback_min); + attribute::create_unoccupied_setback_max(cluster, config->unoccupied_setback_max); + + return ESP_OK; +} +} /* occupancy */ + +namespace setback { +uint32_t get_id() +{ + return Setback::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_occupied_setback(cluster, config->occupied_setback); + attribute::create_occupied_setback_min(cluster, config->occupied_setback_min); + attribute::create_occupied_setback_max(cluster, config->occupied_setback_max); + attribute::create_unoccupied_setback(cluster, config->unoccupied_setback); + attribute::create_unoccupied_setback_min(cluster, config->unoccupied_setback_min); + attribute::create_unoccupied_setback_max(cluster, config->unoccupied_setback_max); + + return ESP_OK; +} +} /* setback */ + +namespace auto_mode { +uint32_t get_id() +{ + return AutoMode::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_min_setpoint_dead_band(cluster, config->min_setpoint_dead_band); + + return ESP_OK; +} +} /* auto_mode */ + +namespace local_temperature_not_exposed { +uint32_t get_id() +{ + return LocalTemperatureNotExposed::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* local_temperature_not_exposed */ + +namespace matter_schedule_configuration { +uint32_t get_id() +{ + return MatterScheduleConfiguration::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_number_of_schedules(cluster, config->number_of_schedules); + attribute::create_number_of_schedule_transitions(cluster, config->number_of_schedule_transitions); + attribute::create_number_of_schedule_transition_per_day(cluster, config->number_of_schedule_transition_per_day); + attribute::create_active_schedule_handle(cluster, config->active_schedule_handle, sizeof(config->active_schedule_handle)); + attribute::create_schedule_types(cluster, NULL, 0, 0); + attribute::create_schedules(cluster, NULL, 0, 0); + command::create_set_active_schedule_request(cluster); + + return ESP_OK; +} +} /* matter_schedule_configuration */ + +namespace presets { +uint32_t get_id() +{ + return Presets::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_preset_types(cluster, NULL, 0, 0); + attribute::create_number_of_presets(cluster, 0); + attribute::create_active_preset_handle(cluster, NULL, 0); + attribute::create_presets(cluster, NULL, 0, 0); + command::create_set_active_preset_request(cluster); + + return ESP_OK; +} +} /* presets */ + +} /* feature */ + +namespace attribute { +attribute_t *create_local_temperature(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LocalTemperature::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_outdoor_temperature(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, OutdoorTemperature::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_occupancy(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(occupancy), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, Occupancy::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(1)); + return attribute; +} + +attribute_t *create_abs_min_heat_setpoint_limit(cluster_t *cluster, int16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, AbsMinHeatSetpointLimit::Id, ATTRIBUTE_FLAG_NONE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_abs_max_heat_setpoint_limit(cluster_t *cluster, int16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, AbsMaxHeatSetpointLimit::Id, ATTRIBUTE_FLAG_NONE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_abs_min_cool_setpoint_limit(cluster_t *cluster, int16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, AbsMinCoolSetpointLimit::Id, ATTRIBUTE_FLAG_NONE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_abs_max_cool_setpoint_limit(cluster_t *cluster, int16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, AbsMaxCoolSetpointLimit::Id, ATTRIBUTE_FLAG_NONE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_pi_cooling_demand(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PICoolingDemand::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(100)); + return attribute; +} + +attribute_t *create_pi_heating_demand(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, PIHeatingDemand::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(100)); + return attribute; +} + +attribute_t *create_local_temperature_calibration(cluster_t *cluster, int8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LocalTemperatureCalibration::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int8(-128), esp_matter_int8(126)); + return attribute; +} + +attribute_t *create_occupied_cooling_setpoint(cluster_t *cluster, int16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(cooling), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, OccupiedCoolingSetpoint::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_occupied_heating_setpoint(cluster_t *cluster, int16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(heating), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, OccupiedHeatingSetpoint::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_unoccupied_cooling_setpoint(cluster_t *cluster, int16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(cooling)) && (has_feature(occupancy))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, UnoccupiedCoolingSetpoint::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_unoccupied_heating_setpoint(cluster_t *cluster, int16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(heating)) && (has_feature(occupancy))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, UnoccupiedHeatingSetpoint::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_min_heat_setpoint_limit(cluster_t *cluster, int16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MinHeatSetpointLimit::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_max_heat_setpoint_limit(cluster_t *cluster, int16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxHeatSetpointLimit::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_min_cool_setpoint_limit(cluster_t *cluster, int16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MinCoolSetpointLimit::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_max_cool_setpoint_limit(cluster_t *cluster, int16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, MaxCoolSetpointLimit::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int16(-32768), esp_matter_int16(32766)); + return attribute; +} + +attribute_t *create_min_setpoint_dead_band(cluster_t *cluster, int8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(auto_mode), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, MinSetpointDeadBand::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_int8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_int8(0), esp_matter_int8(127)); + return attribute; +} + +attribute_t *create_remote_sensing(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, RemoteSensing::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(7)); + return attribute; +} + +attribute_t *create_control_sequence_of_operation(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ControlSequenceOfOperation::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(5)); + return attribute; +} + +attribute_t *create_system_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SystemMode::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(8)); + return attribute; +} + +attribute_t *create_thermostat_running_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ThermostatRunningMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_temperature_setpoint_hold(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, TemperatureSetpointHold::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(1)); + return attribute; +} + +attribute_t *create_temperature_setpoint_hold_duration(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, TemperatureSetpointHoldDuration::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(1440)); + return attribute; +} + +attribute_t *create_thermostat_programming_operation_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ThermostatProgrammingOperationMode::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(7)); + return attribute; +} + +attribute_t *create_thermostat_running_state(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ThermostatRunningState::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap16(0), esp_matter_bitmap16(65535)); + return attribute; +} + +attribute_t *create_setpoint_change_source(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SetpointChangeSource::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_setpoint_change_amount(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SetpointChangeAmount::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_setpoint_change_source_timestamp(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SetpointChangeSourceTimestamp::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(0), esp_matter_uint32(4294967294)); + return attribute; +} + +attribute_t *create_occupied_setback(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(setback), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, OccupiedSetback::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_occupied_setback_min(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(setback), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, OccupiedSetbackMin::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_occupied_setback_max(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(setback), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, OccupiedSetbackMax::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_unoccupied_setback(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(setback)) && (has_feature(occupancy))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, UnoccupiedSetback::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_unoccupied_setback_min(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(setback)) && (has_feature(occupancy))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, UnoccupiedSetbackMin::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_unoccupied_setback_max(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(setback)) && (has_feature(occupancy))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, UnoccupiedSetbackMax::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_emergency_heat_delta(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, EmergencyHeatDelta::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_ac_type(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ACType::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(4)); + return attribute; +} + +attribute_t *create_ac_capacity(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ACCapacity::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_ac_refrigerant_type(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ACRefrigerantType::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(3)); + return attribute; +} + +attribute_t *create_ac_compressor_type(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ACCompressorType::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(3)); + return attribute; +} + +attribute_t *create_ac_error_code(cluster_t *cluster, uint32_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ACErrorCode::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap32(0), esp_matter_bitmap32(4294967295)); + return attribute; +} + +attribute_t *create_ac_louver_position(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ACLouverPosition::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(4)); + return attribute; +} + +attribute_t *create_ac_coil_temperature(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ACCoilTemperature::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int16(-32768), esp_matter_nullable_int16(32766)); + return attribute; +} + +attribute_t *create_ac_capacity_format(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ACCapacityFormat::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(0)); + return attribute; +} + +attribute_t *create_preset_types(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(presets), NULL); + return esp_matter::attribute::create(cluster, PresetTypes::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_schedule_types(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(matter_schedule_configuration), NULL); + return esp_matter::attribute::create(cluster, ScheduleTypes::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_number_of_presets(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(presets), NULL); + return esp_matter::attribute::create(cluster, NumberOfPresets::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_number_of_schedules(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(matter_schedule_configuration), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfSchedules::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_number_of_schedule_transitions(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(matter_schedule_configuration), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfScheduleTransitions::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_number_of_schedule_transition_per_day(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(matter_schedule_configuration), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfScheduleTransitionPerDay::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(1), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_active_preset_handle(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(presets), NULL); + return esp_matter::attribute::create(cluster, ActivePresetHandle::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_octet_str(value, length)); +} + +attribute_t *create_active_schedule_handle(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(matter_schedule_configuration), NULL); + VerifyOrReturnValue(length <= k_max_active_schedule_handle_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, ActiveScheduleHandle::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_octet_str(value, length)); +} + +attribute_t *create_presets(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(presets), NULL); + return esp_matter::attribute::create(cluster, Presets::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_schedules(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(matter_schedule_configuration), NULL); + return esp_matter::attribute::create(cluster, Schedules::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_setpoint_hold_expiry_timestamp(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SetpointHoldExpiryTimestamp::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_setpoint_raise_lower(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SetpointRaiseLower::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_setpoint_raise_lower); +} + +command_t *create_set_active_schedule_request(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(matter_schedule_configuration), NULL); + return esp_matter::command::create(cluster, SetActiveScheduleRequest::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_active_schedule_request); +} + +command_t *create_set_active_preset_request(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(presets), NULL); + return esp_matter::command::create(cluster, SetActivePresetRequest::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_active_preset_request); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t function_list[] = { + (function_generic_t)emberAfThermostatClusterServerInitCallback, + (function_generic_t)MatterThermostatClusterServerAttributeChangedCallback, + (function_generic_t)MatterThermostatClusterServerShutdownCallback, + (function_generic_t)MatterThermostatClusterServerPreAttributeChangedCallback, +}; + +const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION | CLUSTER_FLAG_SHUTDOWN_FUNCTION | CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, thermostat::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, thermostat::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ThermostatDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterThermostatPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_local_temperature(cluster, config->local_temperature); + attribute::create_control_sequence_of_operation(cluster, config->control_sequence_of_operation); + attribute::create_system_mode(cluster, config->system_mode); + + uint32_t feature_map = config->feature_flags; + if (feature_map & feature::auto_mode::get_id()) { + VerifyOrReturnValue(feature::auto_mode::add(cluster, &(config->features.auto_mode)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + VerifyOrReturnValue(feature::heating::add(cluster, &(config->features.heating)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + VerifyOrReturnValue(feature::cooling::add(cluster, &(config->features.cooling)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } else { + VALIDATE_FEATURES_AT_LEAST_ONE("Heating,Cooling", + feature::heating::get_id(), feature::cooling::get_id()); + if (feature_map & feature::heating::get_id()) { + VerifyOrReturnValue(feature::heating::add(cluster, &(config->features.heating)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::cooling::get_id()) { + VerifyOrReturnValue(feature::cooling::add(cluster, &(config->features.cooling)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + if (feature_map & feature::occupancy::get_id()) { + VerifyOrReturnValue(feature::occupancy::add(cluster, &(config->features.occupancy)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::setback::get_id()) { + VerifyOrReturnValue(feature::setback::add(cluster, &(config->features.setback)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::local_temperature_not_exposed::get_id()) { + VerifyOrReturnValue(feature::local_temperature_not_exposed::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::matter_schedule_configuration::get_id()) { + VerifyOrReturnValue(feature::matter_schedule_configuration::add(cluster, &(config->features.matter_schedule_configuration)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::presets::get_id()) { + VerifyOrReturnValue(feature::presets::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + command::create_setpoint_raise_lower(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* thermostat */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thermostat/thermostat.h b/components/esp_matter/data_model/generated/clusters/thermostat/thermostat.h new file mode 100644 index 000000000..25ec620f6 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thermostat/thermostat.h @@ -0,0 +1,193 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace thermostat { + +const uint8_t k_max_active_schedule_handle_length = 16u; +namespace feature { +namespace heating { +typedef struct config { + int16_t occupied_heating_setpoint; + int16_t unoccupied_heating_setpoint; + config() : occupied_heating_setpoint(2000), unoccupied_heating_setpoint(2000) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* heating */ + +namespace cooling { +typedef struct config { + int16_t occupied_cooling_setpoint; + int16_t unoccupied_cooling_setpoint; + config() : occupied_cooling_setpoint(2600), unoccupied_cooling_setpoint(2600) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* cooling */ + +namespace occupancy { +typedef struct config { + uint8_t occupancy; + int16_t unoccupied_cooling_setpoint; + int16_t unoccupied_heating_setpoint; + nullable unoccupied_setback; + nullable unoccupied_setback_min; + nullable unoccupied_setback_max; + config() : occupancy(0), unoccupied_cooling_setpoint(2600), unoccupied_heating_setpoint(2000), unoccupied_setback(0), unoccupied_setback_min(0), unoccupied_setback_max(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* occupancy */ + +namespace setback { +typedef struct config { + nullable occupied_setback; + nullable occupied_setback_min; + nullable occupied_setback_max; + nullable unoccupied_setback; + nullable unoccupied_setback_min; + nullable unoccupied_setback_max; + config() : occupied_setback(0), occupied_setback_min(0), occupied_setback_max(0), unoccupied_setback(0), unoccupied_setback_min(0), unoccupied_setback_max(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* setback */ + +namespace auto_mode { +typedef struct config { + int8_t min_setpoint_dead_band; + config() : min_setpoint_dead_band(20) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* auto_mode */ + +namespace local_temperature_not_exposed { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* local_temperature_not_exposed */ + +namespace matter_schedule_configuration { +typedef struct config { + uint8_t number_of_schedules; + uint8_t number_of_schedule_transitions; + nullable number_of_schedule_transition_per_day; + uint8_t active_schedule_handle[k_max_active_schedule_handle_length]; + config() : number_of_schedules(0), number_of_schedule_transitions(0), number_of_schedule_transition_per_day(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* matter_schedule_configuration */ + +namespace presets { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* presets */ + +} /* feature */ + +namespace attribute { +attribute_t *create_local_temperature(cluster_t *cluster, nullable value); +attribute_t *create_outdoor_temperature(cluster_t *cluster, nullable value); +attribute_t *create_occupancy(cluster_t *cluster, uint8_t value); +attribute_t *create_abs_min_heat_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_abs_max_heat_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_abs_min_cool_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_abs_max_cool_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_pi_cooling_demand(cluster_t *cluster, uint8_t value); +attribute_t *create_pi_heating_demand(cluster_t *cluster, uint8_t value); +attribute_t *create_local_temperature_calibration(cluster_t *cluster, int8_t value); +attribute_t *create_occupied_cooling_setpoint(cluster_t *cluster, int16_t value); +attribute_t *create_occupied_heating_setpoint(cluster_t *cluster, int16_t value); +attribute_t *create_unoccupied_cooling_setpoint(cluster_t *cluster, int16_t value); +attribute_t *create_unoccupied_heating_setpoint(cluster_t *cluster, int16_t value); +attribute_t *create_min_heat_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_max_heat_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_min_cool_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_max_cool_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_min_setpoint_dead_band(cluster_t *cluster, int8_t value); +attribute_t *create_remote_sensing(cluster_t *cluster, uint8_t value); +attribute_t *create_control_sequence_of_operation(cluster_t *cluster, uint8_t value); +attribute_t *create_system_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_thermostat_running_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_temperature_setpoint_hold(cluster_t *cluster, uint8_t value); +attribute_t *create_temperature_setpoint_hold_duration(cluster_t *cluster, nullable value); +attribute_t *create_thermostat_programming_operation_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_thermostat_running_state(cluster_t *cluster, uint16_t value); +attribute_t *create_setpoint_change_source(cluster_t *cluster, uint8_t value); +attribute_t *create_setpoint_change_amount(cluster_t *cluster, nullable value); +attribute_t *create_setpoint_change_source_timestamp(cluster_t *cluster, uint32_t value); +attribute_t *create_occupied_setback(cluster_t *cluster, nullable value); +attribute_t *create_occupied_setback_min(cluster_t *cluster, nullable value); +attribute_t *create_occupied_setback_max(cluster_t *cluster, nullable value); +attribute_t *create_unoccupied_setback(cluster_t *cluster, nullable value); +attribute_t *create_unoccupied_setback_min(cluster_t *cluster, nullable value); +attribute_t *create_unoccupied_setback_max(cluster_t *cluster, nullable value); +attribute_t *create_emergency_heat_delta(cluster_t *cluster, uint8_t value); +attribute_t *create_ac_type(cluster_t *cluster, uint8_t value); +attribute_t *create_ac_capacity(cluster_t *cluster, uint16_t value); +attribute_t *create_ac_refrigerant_type(cluster_t *cluster, uint8_t value); +attribute_t *create_ac_compressor_type(cluster_t *cluster, uint8_t value); +attribute_t *create_ac_error_code(cluster_t *cluster, uint32_t value); +attribute_t *create_ac_louver_position(cluster_t *cluster, uint8_t value); +attribute_t *create_ac_coil_temperature(cluster_t *cluster, nullable value); +attribute_t *create_ac_capacity_format(cluster_t *cluster, uint8_t value); +attribute_t *create_preset_types(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_schedule_types(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_number_of_presets(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_schedules(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_schedule_transitions(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_schedule_transition_per_day(cluster_t *cluster, nullable value); +attribute_t *create_active_preset_handle(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_active_schedule_handle(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_presets(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_schedules(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_setpoint_hold_expiry_timestamp(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_setpoint_raise_lower(cluster_t *cluster); +command_t *create_set_active_schedule_request(cluster_t *cluster); +command_t *create_set_active_preset_request(cluster_t *cluster); +} /* command */ + +typedef struct config { + nullable local_temperature; + uint8_t control_sequence_of_operation; + uint8_t system_mode; + void *delegate; + struct { + feature::heating::config_t heating; + feature::cooling::config_t cooling; + feature::occupancy::config_t occupancy; + feature::setback::config_t setback; + feature::auto_mode::config_t auto_mode; + feature::matter_schedule_configuration::config_t matter_schedule_configuration; + } features; + uint32_t feature_flags; + config() : local_temperature(0), control_sequence_of_operation(0), system_mode(0), delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* thermostat */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thermostat/thermostat_ids.h b/components/esp_matter/data_model/generated/clusters/thermostat/thermostat_ids.h new file mode 100644 index 000000000..50f0051ca --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thermostat/thermostat_ids.h @@ -0,0 +1,238 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace thermostat { + +inline constexpr uint32_t Id = 0x0201; + +namespace feature { +namespace Heating { +inline constexpr uint32_t Id = 0x1; +} /* Heating */ +namespace Cooling { +inline constexpr uint32_t Id = 0x2; +} /* Cooling */ +namespace Occupancy { +inline constexpr uint32_t Id = 0x4; +} /* Occupancy */ +namespace Setback { +inline constexpr uint32_t Id = 0x10; +} /* Setback */ +namespace AutoMode { +inline constexpr uint32_t Id = 0x20; +} /* AutoMode */ +namespace LocalTemperatureNotExposed { +inline constexpr uint32_t Id = 0x40; +} /* LocalTemperatureNotExposed */ +namespace MatterScheduleConfiguration { +inline constexpr uint32_t Id = 0x80; +} /* MatterScheduleConfiguration */ +namespace Presets { +inline constexpr uint32_t Id = 0x100; +} /* Presets */ +} /* feature */ + +namespace attribute { +namespace LocalTemperature { +inline constexpr uint32_t Id = 0x0000; +} /* LocalTemperature */ +namespace OutdoorTemperature { +inline constexpr uint32_t Id = 0x0001; +} /* OutdoorTemperature */ +namespace Occupancy { +inline constexpr uint32_t Id = 0x0002; +} /* Occupancy */ +namespace AbsMinHeatSetpointLimit { +inline constexpr uint32_t Id = 0x0003; +} /* AbsMinHeatSetpointLimit */ +namespace AbsMaxHeatSetpointLimit { +inline constexpr uint32_t Id = 0x0004; +} /* AbsMaxHeatSetpointLimit */ +namespace AbsMinCoolSetpointLimit { +inline constexpr uint32_t Id = 0x0005; +} /* AbsMinCoolSetpointLimit */ +namespace AbsMaxCoolSetpointLimit { +inline constexpr uint32_t Id = 0x0006; +} /* AbsMaxCoolSetpointLimit */ +namespace PICoolingDemand { +inline constexpr uint32_t Id = 0x0007; +} /* PICoolingDemand */ +namespace PIHeatingDemand { +inline constexpr uint32_t Id = 0x0008; +} /* PIHeatingDemand */ +namespace LocalTemperatureCalibration { +inline constexpr uint32_t Id = 0x0010; +} /* LocalTemperatureCalibration */ +namespace OccupiedCoolingSetpoint { +inline constexpr uint32_t Id = 0x0011; +} /* OccupiedCoolingSetpoint */ +namespace OccupiedHeatingSetpoint { +inline constexpr uint32_t Id = 0x0012; +} /* OccupiedHeatingSetpoint */ +namespace UnoccupiedCoolingSetpoint { +inline constexpr uint32_t Id = 0x0013; +} /* UnoccupiedCoolingSetpoint */ +namespace UnoccupiedHeatingSetpoint { +inline constexpr uint32_t Id = 0x0014; +} /* UnoccupiedHeatingSetpoint */ +namespace MinHeatSetpointLimit { +inline constexpr uint32_t Id = 0x0015; +} /* MinHeatSetpointLimit */ +namespace MaxHeatSetpointLimit { +inline constexpr uint32_t Id = 0x0016; +} /* MaxHeatSetpointLimit */ +namespace MinCoolSetpointLimit { +inline constexpr uint32_t Id = 0x0017; +} /* MinCoolSetpointLimit */ +namespace MaxCoolSetpointLimit { +inline constexpr uint32_t Id = 0x0018; +} /* MaxCoolSetpointLimit */ +namespace MinSetpointDeadBand { +inline constexpr uint32_t Id = 0x0019; +} /* MinSetpointDeadBand */ +namespace RemoteSensing { +inline constexpr uint32_t Id = 0x001A; +} /* RemoteSensing */ +namespace ControlSequenceOfOperation { +inline constexpr uint32_t Id = 0x001B; +} /* ControlSequenceOfOperation */ +namespace SystemMode { +inline constexpr uint32_t Id = 0x001C; +} /* SystemMode */ +namespace ThermostatRunningMode { +inline constexpr uint32_t Id = 0x001E; +} /* ThermostatRunningMode */ +namespace TemperatureSetpointHold { +inline constexpr uint32_t Id = 0x0023; +} /* TemperatureSetpointHold */ +namespace TemperatureSetpointHoldDuration { +inline constexpr uint32_t Id = 0x0024; +} /* TemperatureSetpointHoldDuration */ +namespace ThermostatProgrammingOperationMode { +inline constexpr uint32_t Id = 0x0025; +} /* ThermostatProgrammingOperationMode */ +namespace ThermostatRunningState { +inline constexpr uint32_t Id = 0x0029; +} /* ThermostatRunningState */ +namespace SetpointChangeSource { +inline constexpr uint32_t Id = 0x0030; +} /* SetpointChangeSource */ +namespace SetpointChangeAmount { +inline constexpr uint32_t Id = 0x0031; +} /* SetpointChangeAmount */ +namespace SetpointChangeSourceTimestamp { +inline constexpr uint32_t Id = 0x0032; +} /* SetpointChangeSourceTimestamp */ +namespace OccupiedSetback { +inline constexpr uint32_t Id = 0x0034; +} /* OccupiedSetback */ +namespace OccupiedSetbackMin { +inline constexpr uint32_t Id = 0x0035; +} /* OccupiedSetbackMin */ +namespace OccupiedSetbackMax { +inline constexpr uint32_t Id = 0x0036; +} /* OccupiedSetbackMax */ +namespace UnoccupiedSetback { +inline constexpr uint32_t Id = 0x0037; +} /* UnoccupiedSetback */ +namespace UnoccupiedSetbackMin { +inline constexpr uint32_t Id = 0x0038; +} /* UnoccupiedSetbackMin */ +namespace UnoccupiedSetbackMax { +inline constexpr uint32_t Id = 0x0039; +} /* UnoccupiedSetbackMax */ +namespace EmergencyHeatDelta { +inline constexpr uint32_t Id = 0x003A; +} /* EmergencyHeatDelta */ +namespace ACType { +inline constexpr uint32_t Id = 0x0040; +} /* ACType */ +namespace ACCapacity { +inline constexpr uint32_t Id = 0x0041; +} /* ACCapacity */ +namespace ACRefrigerantType { +inline constexpr uint32_t Id = 0x0042; +} /* ACRefrigerantType */ +namespace ACCompressorType { +inline constexpr uint32_t Id = 0x0043; +} /* ACCompressorType */ +namespace ACErrorCode { +inline constexpr uint32_t Id = 0x0044; +} /* ACErrorCode */ +namespace ACLouverPosition { +inline constexpr uint32_t Id = 0x0045; +} /* ACLouverPosition */ +namespace ACCoilTemperature { +inline constexpr uint32_t Id = 0x0046; +} /* ACCoilTemperature */ +namespace ACCapacityFormat { +inline constexpr uint32_t Id = 0x0047; +} /* ACCapacityFormat */ +namespace PresetTypes { +inline constexpr uint32_t Id = 0x0048; +} /* PresetTypes */ +namespace ScheduleTypes { +inline constexpr uint32_t Id = 0x0049; +} /* ScheduleTypes */ +namespace NumberOfPresets { +inline constexpr uint32_t Id = 0x004A; +} /* NumberOfPresets */ +namespace NumberOfSchedules { +inline constexpr uint32_t Id = 0x004B; +} /* NumberOfSchedules */ +namespace NumberOfScheduleTransitions { +inline constexpr uint32_t Id = 0x004C; +} /* NumberOfScheduleTransitions */ +namespace NumberOfScheduleTransitionPerDay { +inline constexpr uint32_t Id = 0x004D; +} /* NumberOfScheduleTransitionPerDay */ +namespace ActivePresetHandle { +inline constexpr uint32_t Id = 0x004E; +} /* ActivePresetHandle */ +namespace ActiveScheduleHandle { +inline constexpr uint32_t Id = 0x004F; +} /* ActiveScheduleHandle */ +namespace Presets { +inline constexpr uint32_t Id = 0x0050; +} /* Presets */ +namespace Schedules { +inline constexpr uint32_t Id = 0x0051; +} /* Schedules */ +namespace SetpointHoldExpiryTimestamp { +inline constexpr uint32_t Id = 0x0052; +} /* SetpointHoldExpiryTimestamp */ +} /* attribute */ + +namespace command { +namespace SetpointRaiseLower { +inline constexpr uint32_t Id = 0x00; +} /* SetpointRaiseLower */ +namespace SetActiveScheduleRequest { +inline constexpr uint32_t Id = 0x05; +} /* SetActiveScheduleRequest */ +namespace SetActivePresetRequest { +inline constexpr uint32_t Id = 0x06; +} /* SetActivePresetRequest */ +} /* command */ + +} /* thermostat */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thermostat_user_interface_configuration/thermostat_user_interface_configuration.cpp b/components/esp_matter/data_model/generated/clusters/thermostat_user_interface_configuration/thermostat_user_interface_configuration.cpp new file mode 100644 index 000000000..d16ef9201 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thermostat_user_interface_configuration/thermostat_user_interface_configuration.cpp @@ -0,0 +1,108 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "thermostat_user_interface_configuration_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace thermostat_user_interface_configuration { + +namespace attribute { +attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, TemperatureDisplayMode::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(1)); + return attribute; +} + +attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, KeypadLockout::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(5)); + return attribute; +} + +attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ScheduleProgrammingVisibility::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(1)); + return attribute; +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t function_list[] = { + (function_generic_t)MatterThermostatUserInterfaceConfigurationClusterServerPreAttributeChangedCallback, +}; + +const int function_flags = CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, thermostat_user_interface_configuration::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, thermostat_user_interface_configuration::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterThermostatUserInterfaceConfigurationPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_temperature_display_mode(cluster, config->temperature_display_mode); + attribute::create_keypad_lockout(cluster, config->keypad_lockout); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* thermostat_user_interface_configuration */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thermostat_user_interface_configuration/thermostat_user_interface_configuration.h b/components/esp_matter/data_model/generated/clusters/thermostat_user_interface_configuration/thermostat_user_interface_configuration.h new file mode 100644 index 000000000..cc3d1a2bf --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thermostat_user_interface_configuration/thermostat_user_interface_configuration.h @@ -0,0 +1,40 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace thermostat_user_interface_configuration { + +namespace attribute { +attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value); +attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + uint8_t temperature_display_mode; + uint8_t keypad_lockout; + config() : temperature_display_mode(0), keypad_lockout(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* thermostat_user_interface_configuration */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thermostat_user_interface_configuration/thermostat_user_interface_configuration_ids.h b/components/esp_matter/data_model/generated/clusters/thermostat_user_interface_configuration/thermostat_user_interface_configuration_ids.h new file mode 100644 index 000000000..5c615266b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thermostat_user_interface_configuration/thermostat_user_interface_configuration_ids.h @@ -0,0 +1,40 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace thermostat_user_interface_configuration { + +inline constexpr uint32_t Id = 0x0204; + +namespace attribute { +namespace TemperatureDisplayMode { +inline constexpr uint32_t Id = 0x0000; +} /* TemperatureDisplayMode */ +namespace KeypadLockout { +inline constexpr uint32_t Id = 0x0001; +} /* KeypadLockout */ +namespace ScheduleProgrammingVisibility { +inline constexpr uint32_t Id = 0x0002; +} /* ScheduleProgrammingVisibility */ +} /* attribute */ + +} /* thermostat_user_interface_configuration */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thread_border_router_management/thread_border_router_management.cpp b/components/esp_matter/data_model/generated/clusters/thread_border_router_management/thread_border_router_management.cpp new file mode 100644 index 000000000..249b788d7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thread_border_router_management/thread_border_router_management.cpp @@ -0,0 +1,177 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "thread_border_router_management_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace thread_border_router_management { + +namespace feature { +namespace pan_change { +uint32_t get_id() +{ + return PANChange::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + command::create_set_pending_dataset_request(cluster); + + return ESP_OK; +} +} /* pan_change */ + +} /* feature */ + +namespace attribute { +attribute_t *create_border_router_name(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, BorderRouterName::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_char_str(value, length)); +} + +attribute_t *create_border_agent_id(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, BorderAgentID::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_octet_str(value, length)); +} + +attribute_t *create_thread_version(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, ThreadVersion::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_interface_enabled(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, InterfaceEnabled::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_active_dataset_timestamp(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, ActiveDatasetTimestamp::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint64(value)); +} + +attribute_t *create_pending_dataset_timestamp(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, PendingDatasetTimestamp::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint64(value)); +} + +} /* attribute */ +namespace command { +command_t *create_get_active_dataset_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetActiveDatasetRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_get_pending_dataset_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetPendingDatasetRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_dataset_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, DatasetResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_set_active_dataset_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SetActiveDatasetRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_set_pending_dataset_request(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(pan_change), NULL); + return esp_matter::command::create(cluster, SetPendingDatasetRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, thread_border_router_management::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, thread_border_router_management::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ThreadBorderRouterManagementDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterThreadBorderRouterManagementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_border_router_name(cluster, NULL, 0); + attribute::create_border_agent_id(cluster, NULL, 0); + attribute::create_thread_version(cluster, 0); + attribute::create_interface_enabled(cluster, false); + attribute::create_active_dataset_timestamp(cluster, 0); + attribute::create_pending_dataset_timestamp(cluster, 0); + command::create_get_active_dataset_request(cluster); + command::create_get_pending_dataset_request(cluster); + command::create_dataset_response(cluster); + command::create_set_active_dataset_request(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* thread_border_router_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thread_border_router_management/thread_border_router_management.h b/components/esp_matter/data_model/generated/clusters/thread_border_router_management/thread_border_router_management.h new file mode 100644 index 000000000..aaf32ecd1 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thread_border_router_management/thread_border_router_management.h @@ -0,0 +1,58 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace thread_border_router_management { + +namespace feature { +namespace pan_change { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* pan_change */ + +} /* feature */ + +namespace attribute { +attribute_t *create_border_router_name(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_border_agent_id(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_thread_version(cluster_t *cluster, uint16_t value); +attribute_t *create_interface_enabled(cluster_t *cluster, bool value); +attribute_t *create_active_dataset_timestamp(cluster_t *cluster, nullable value); +attribute_t *create_pending_dataset_timestamp(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_get_active_dataset_request(cluster_t *cluster); +command_t *create_get_pending_dataset_request(cluster_t *cluster); +command_t *create_dataset_response(cluster_t *cluster); +command_t *create_set_active_dataset_request(cluster_t *cluster); +command_t *create_set_pending_dataset_request(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* thread_border_router_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thread_border_router_management/thread_border_router_management_ids.h b/components/esp_matter/data_model/generated/clusters/thread_border_router_management/thread_border_router_management_ids.h new file mode 100644 index 000000000..074c7feab --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thread_border_router_management/thread_border_router_management_ids.h @@ -0,0 +1,73 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace thread_border_router_management { + +inline constexpr uint32_t Id = 0x0452; + +namespace feature { +namespace PANChange { +inline constexpr uint32_t Id = 0x1; +} /* PANChange */ +} /* feature */ + +namespace attribute { +namespace BorderRouterName { +inline constexpr uint32_t Id = 0x0000; +} /* BorderRouterName */ +namespace BorderAgentID { +inline constexpr uint32_t Id = 0x0001; +} /* BorderAgentID */ +namespace ThreadVersion { +inline constexpr uint32_t Id = 0x0002; +} /* ThreadVersion */ +namespace InterfaceEnabled { +inline constexpr uint32_t Id = 0x0003; +} /* InterfaceEnabled */ +namespace ActiveDatasetTimestamp { +inline constexpr uint32_t Id = 0x0004; +} /* ActiveDatasetTimestamp */ +namespace PendingDatasetTimestamp { +inline constexpr uint32_t Id = 0x0005; +} /* PendingDatasetTimestamp */ +} /* attribute */ + +namespace command { +namespace GetActiveDatasetRequest { +inline constexpr uint32_t Id = 0x00; +} /* GetActiveDatasetRequest */ +namespace GetPendingDatasetRequest { +inline constexpr uint32_t Id = 0x01; +} /* GetPendingDatasetRequest */ +namespace DatasetResponse { +inline constexpr uint32_t Id = 0x02; +} /* DatasetResponse */ +namespace SetActiveDatasetRequest { +inline constexpr uint32_t Id = 0x03; +} /* SetActiveDatasetRequest */ +namespace SetPendingDatasetRequest { +inline constexpr uint32_t Id = 0x04; +} /* SetPendingDatasetRequest */ +} /* command */ + +} /* thread_border_router_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thread_network_diagnostics/thread_network_diagnostics.cpp b/components/esp_matter/data_model/generated/clusters/thread_network_diagnostics/thread_network_diagnostics.cpp new file mode 100644 index 000000000..eb520e095 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thread_network_diagnostics/thread_network_diagnostics.cpp @@ -0,0 +1,506 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "thread_network_diagnostics_cluster"; +constexpr uint16_t cluster_revision = 3; + +static esp_err_t esp_matter_command_callback_reset_counts(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ThreadNetworkDiagnostics::Commands::ResetCounts::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfThreadNetworkDiagnosticsClusterResetCountsCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace thread_network_diagnostics { + +namespace feature { +namespace packet_counts { +uint32_t get_id() +{ + return PacketCounts::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* packet_counts */ + +namespace error_counts { +uint32_t get_id() +{ + return ErrorCounts::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_overrun_count(cluster, 0); + command::create_reset_counts(cluster); + + return ESP_OK; +} +} /* error_counts */ + +namespace mle_counts { +uint32_t get_id() +{ + return MLECounts::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* mle_counts */ + +namespace mac_counts { +uint32_t get_id() +{ + return MACCounts::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* mac_counts */ + +} /* feature */ + +namespace attribute { +attribute_t *create_channel(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, Channel::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); +} + +attribute_t *create_routing_role(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, RoutingRole::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); +} + +attribute_t *create_network_name(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, NetworkName::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_char_str(value, length)); +} + +attribute_t *create_pan_id(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, PanId::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); +} + +attribute_t *create_extended_pan_id(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, ExtendedPanId::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value)); +} + +attribute_t *create_mesh_local_prefix(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, MeshLocalPrefix::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_octet_str(value, length)); +} + +attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(error_counts), NULL); + return esp_matter::attribute::create(cluster, OverrunCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value)); +} + +attribute_t *create_neighbor_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, NeighborTable::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_route_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, RouteTable::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_partition_id(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, PartitionId::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_weighting(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, Weighting::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); +} + +attribute_t *create_data_version(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, DataVersion::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); +} + +attribute_t *create_stable_data_version(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, StableDataVersion::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); +} + +attribute_t *create_leader_router_id(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, LeaderRouterId::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); +} + +attribute_t *create_detached_role_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, DetachedRoleCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_child_role_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, ChildRoleCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_router_role_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, RouterRoleCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_leader_role_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, LeaderRoleCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_attach_attempt_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, AttachAttemptCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_partition_id_change_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, PartitionIdChangeCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_better_partition_attach_attempt_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, BetterPartitionAttachAttemptCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_parent_change_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, ParentChangeCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_tx_total_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxTotalCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_unicast_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxUnicastCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_broadcast_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxBroadcastCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_ack_requested_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxAckRequestedCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_acked_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxAckedCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_no_ack_requested_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxNoAckRequestedCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_data_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxDataCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_data_poll_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxDataPollCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_beacon_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxBeaconCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_beacon_request_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxBeaconRequestCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_other_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxOtherCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_retry_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxRetryCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_direct_max_retry_expiry_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxDirectMaxRetryExpiryCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_indirect_max_retry_expiry_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxIndirectMaxRetryExpiryCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_err_cca_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxErrCcaCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_err_abort_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxErrAbortCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_err_busy_channel_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, TxErrBusyChannelCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_total_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxTotalCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_unicast_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxUnicastCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_broadcast_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxBroadcastCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_data_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxDataCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_data_poll_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxDataPollCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_beacon_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxBeaconCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_beacon_request_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxBeaconRequestCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_other_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxOtherCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_address_filtered_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxAddressFilteredCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_dest_addr_filtered_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxDestAddrFilteredCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_duplicated_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxDuplicatedCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_err_no_frame_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxErrNoFrameCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_err_unknown_neighbor_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxErrUnknownNeighborCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_err_invalid_src_addr_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxErrInvalidSrcAddrCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_err_sec_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxErrSecCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_err_fcs_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxErrFcsCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_err_other_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, RxErrOtherCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_active_timestamp(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, ActiveTimestamp::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value)); +} + +attribute_t *create_pending_timestamp(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, PendingTimestamp::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value)); +} + +attribute_t *create_delay(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, Delay::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_security_policy(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SecurityPolicy::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_channel_page_0_mask(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, ChannelPage0Mask::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_octet_str(value, length)); +} + +attribute_t *create_operational_dataset_components(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, OperationalDatasetComponents::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_active_network_faults_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ActiveNetworkFaultsList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_reset_counts(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(error_counts), NULL); + return esp_matter::command::create(cluster, ResetCounts::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_reset_counts); +} + +} /* command */ + +namespace event { +event_t *create_connection_status(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, ConnectionStatus::Id); +} + +event_t *create_network_fault_change(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, NetworkFaultChange::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, thread_network_diagnostics::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, thread_network_diagnostics::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterThreadNetworkDiagnosticsPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_channel(cluster, 0); + attribute::create_routing_role(cluster, 0); + attribute::create_network_name(cluster, NULL, 0); + attribute::create_pan_id(cluster, 0); + attribute::create_extended_pan_id(cluster, 0); + attribute::create_mesh_local_prefix(cluster, NULL, 0); + attribute::create_neighbor_table(cluster, NULL, 0, 0); + attribute::create_route_table(cluster, NULL, 0, 0); + attribute::create_partition_id(cluster, 0); + attribute::create_weighting(cluster, 0); + attribute::create_data_version(cluster, 0); + attribute::create_stable_data_version(cluster, 0); + attribute::create_leader_router_id(cluster, 0); + attribute::create_security_policy(cluster, NULL, 0, 0); + attribute::create_channel_page_0_mask(cluster, NULL, 0); + attribute::create_operational_dataset_components(cluster, NULL, 0, 0); + attribute::create_active_network_faults_list(cluster, NULL, 0, 0); + } + + return cluster; +} + +} /* thread_network_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thread_network_diagnostics/thread_network_diagnostics.h b/components/esp_matter/data_model/generated/clusters/thread_network_diagnostics/thread_network_diagnostics.h new file mode 100644 index 000000000..e4d33de1f --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thread_network_diagnostics/thread_network_diagnostics.h @@ -0,0 +1,130 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace thread_network_diagnostics { + +namespace feature { +namespace packet_counts { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* packet_counts */ + +namespace error_counts { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* error_counts */ + +namespace mle_counts { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* mle_counts */ + +namespace mac_counts { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* mac_counts */ + +} /* feature */ + +namespace attribute { +attribute_t *create_channel(cluster_t *cluster, nullable value); +attribute_t *create_routing_role(cluster_t *cluster, nullable value); +attribute_t *create_network_name(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_pan_id(cluster_t *cluster, nullable value); +attribute_t *create_extended_pan_id(cluster_t *cluster, nullable value); +attribute_t *create_mesh_local_prefix(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value); +attribute_t *create_neighbor_table(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_route_table(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_partition_id(cluster_t *cluster, nullable value); +attribute_t *create_weighting(cluster_t *cluster, nullable value); +attribute_t *create_data_version(cluster_t *cluster, nullable value); +attribute_t *create_stable_data_version(cluster_t *cluster, nullable value); +attribute_t *create_leader_router_id(cluster_t *cluster, nullable value); +attribute_t *create_detached_role_count(cluster_t *cluster, uint16_t value); +attribute_t *create_child_role_count(cluster_t *cluster, uint16_t value); +attribute_t *create_router_role_count(cluster_t *cluster, uint16_t value); +attribute_t *create_leader_role_count(cluster_t *cluster, uint16_t value); +attribute_t *create_attach_attempt_count(cluster_t *cluster, uint16_t value); +attribute_t *create_partition_id_change_count(cluster_t *cluster, uint16_t value); +attribute_t *create_better_partition_attach_attempt_count(cluster_t *cluster, uint16_t value); +attribute_t *create_parent_change_count(cluster_t *cluster, uint16_t value); +attribute_t *create_tx_total_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_unicast_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_broadcast_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_ack_requested_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_acked_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_no_ack_requested_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_data_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_data_poll_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_beacon_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_beacon_request_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_other_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_retry_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_direct_max_retry_expiry_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_indirect_max_retry_expiry_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_err_cca_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_err_abort_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_err_busy_channel_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_total_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_unicast_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_broadcast_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_data_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_data_poll_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_beacon_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_beacon_request_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_other_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_address_filtered_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_dest_addr_filtered_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_duplicated_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_no_frame_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_unknown_neighbor_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_invalid_src_addr_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_sec_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_fcs_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_other_count(cluster_t *cluster, uint32_t value); +attribute_t *create_active_timestamp(cluster_t *cluster, nullable value); +attribute_t *create_pending_timestamp(cluster_t *cluster, nullable value); +attribute_t *create_delay(cluster_t *cluster, nullable value); +attribute_t *create_security_policy(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_channel_page_0_mask(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_operational_dataset_components(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_active_network_faults_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_reset_counts(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_connection_status(cluster_t *cluster); +event_t *create_network_fault_change(cluster_t *cluster); +} /* event */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* thread_network_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thread_network_diagnostics/thread_network_diagnostics_ids.h b/components/esp_matter/data_model/generated/clusters/thread_network_diagnostics/thread_network_diagnostics_ids.h new file mode 100644 index 000000000..8120eb9f7 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thread_network_diagnostics/thread_network_diagnostics_ids.h @@ -0,0 +1,250 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace thread_network_diagnostics { + +inline constexpr uint32_t Id = 0x0035; + +namespace feature { +namespace PacketCounts { +inline constexpr uint32_t Id = 0x1; +} /* PacketCounts */ +namespace ErrorCounts { +inline constexpr uint32_t Id = 0x2; +} /* ErrorCounts */ +namespace MLECounts { +inline constexpr uint32_t Id = 0x4; +} /* MLECounts */ +namespace MACCounts { +inline constexpr uint32_t Id = 0x8; +} /* MACCounts */ +} /* feature */ + +namespace attribute { +namespace Channel { +inline constexpr uint32_t Id = 0x0000; +} /* Channel */ +namespace RoutingRole { +inline constexpr uint32_t Id = 0x0001; +} /* RoutingRole */ +namespace NetworkName { +inline constexpr uint32_t Id = 0x0002; +} /* NetworkName */ +namespace PanId { +inline constexpr uint32_t Id = 0x0003; +} /* PanId */ +namespace ExtendedPanId { +inline constexpr uint32_t Id = 0x0004; +} /* ExtendedPanId */ +namespace MeshLocalPrefix { +inline constexpr uint32_t Id = 0x0005; +} /* MeshLocalPrefix */ +namespace OverrunCount { +inline constexpr uint32_t Id = 0x0006; +} /* OverrunCount */ +namespace NeighborTable { +inline constexpr uint32_t Id = 0x0007; +} /* NeighborTable */ +namespace RouteTable { +inline constexpr uint32_t Id = 0x0008; +} /* RouteTable */ +namespace PartitionId { +inline constexpr uint32_t Id = 0x0009; +} /* PartitionId */ +namespace Weighting { +inline constexpr uint32_t Id = 0x000A; +} /* Weighting */ +namespace DataVersion { +inline constexpr uint32_t Id = 0x000B; +} /* DataVersion */ +namespace StableDataVersion { +inline constexpr uint32_t Id = 0x000C; +} /* StableDataVersion */ +namespace LeaderRouterId { +inline constexpr uint32_t Id = 0x000D; +} /* LeaderRouterId */ +namespace DetachedRoleCount { +inline constexpr uint32_t Id = 0x000E; +} /* DetachedRoleCount */ +namespace ChildRoleCount { +inline constexpr uint32_t Id = 0x000F; +} /* ChildRoleCount */ +namespace RouterRoleCount { +inline constexpr uint32_t Id = 0x0010; +} /* RouterRoleCount */ +namespace LeaderRoleCount { +inline constexpr uint32_t Id = 0x0011; +} /* LeaderRoleCount */ +namespace AttachAttemptCount { +inline constexpr uint32_t Id = 0x0012; +} /* AttachAttemptCount */ +namespace PartitionIdChangeCount { +inline constexpr uint32_t Id = 0x0013; +} /* PartitionIdChangeCount */ +namespace BetterPartitionAttachAttemptCount { +inline constexpr uint32_t Id = 0x0014; +} /* BetterPartitionAttachAttemptCount */ +namespace ParentChangeCount { +inline constexpr uint32_t Id = 0x0015; +} /* ParentChangeCount */ +namespace TxTotalCount { +inline constexpr uint32_t Id = 0x0016; +} /* TxTotalCount */ +namespace TxUnicastCount { +inline constexpr uint32_t Id = 0x0017; +} /* TxUnicastCount */ +namespace TxBroadcastCount { +inline constexpr uint32_t Id = 0x0018; +} /* TxBroadcastCount */ +namespace TxAckRequestedCount { +inline constexpr uint32_t Id = 0x0019; +} /* TxAckRequestedCount */ +namespace TxAckedCount { +inline constexpr uint32_t Id = 0x001A; +} /* TxAckedCount */ +namespace TxNoAckRequestedCount { +inline constexpr uint32_t Id = 0x001B; +} /* TxNoAckRequestedCount */ +namespace TxDataCount { +inline constexpr uint32_t Id = 0x001C; +} /* TxDataCount */ +namespace TxDataPollCount { +inline constexpr uint32_t Id = 0x001D; +} /* TxDataPollCount */ +namespace TxBeaconCount { +inline constexpr uint32_t Id = 0x001E; +} /* TxBeaconCount */ +namespace TxBeaconRequestCount { +inline constexpr uint32_t Id = 0x001F; +} /* TxBeaconRequestCount */ +namespace TxOtherCount { +inline constexpr uint32_t Id = 0x0020; +} /* TxOtherCount */ +namespace TxRetryCount { +inline constexpr uint32_t Id = 0x0021; +} /* TxRetryCount */ +namespace TxDirectMaxRetryExpiryCount { +inline constexpr uint32_t Id = 0x0022; +} /* TxDirectMaxRetryExpiryCount */ +namespace TxIndirectMaxRetryExpiryCount { +inline constexpr uint32_t Id = 0x0023; +} /* TxIndirectMaxRetryExpiryCount */ +namespace TxErrCcaCount { +inline constexpr uint32_t Id = 0x0024; +} /* TxErrCcaCount */ +namespace TxErrAbortCount { +inline constexpr uint32_t Id = 0x0025; +} /* TxErrAbortCount */ +namespace TxErrBusyChannelCount { +inline constexpr uint32_t Id = 0x0026; +} /* TxErrBusyChannelCount */ +namespace RxTotalCount { +inline constexpr uint32_t Id = 0x0027; +} /* RxTotalCount */ +namespace RxUnicastCount { +inline constexpr uint32_t Id = 0x0028; +} /* RxUnicastCount */ +namespace RxBroadcastCount { +inline constexpr uint32_t Id = 0x0029; +} /* RxBroadcastCount */ +namespace RxDataCount { +inline constexpr uint32_t Id = 0x002A; +} /* RxDataCount */ +namespace RxDataPollCount { +inline constexpr uint32_t Id = 0x002B; +} /* RxDataPollCount */ +namespace RxBeaconCount { +inline constexpr uint32_t Id = 0x002C; +} /* RxBeaconCount */ +namespace RxBeaconRequestCount { +inline constexpr uint32_t Id = 0x002D; +} /* RxBeaconRequestCount */ +namespace RxOtherCount { +inline constexpr uint32_t Id = 0x002E; +} /* RxOtherCount */ +namespace RxAddressFilteredCount { +inline constexpr uint32_t Id = 0x002F; +} /* RxAddressFilteredCount */ +namespace RxDestAddrFilteredCount { +inline constexpr uint32_t Id = 0x0030; +} /* RxDestAddrFilteredCount */ +namespace RxDuplicatedCount { +inline constexpr uint32_t Id = 0x0031; +} /* RxDuplicatedCount */ +namespace RxErrNoFrameCount { +inline constexpr uint32_t Id = 0x0032; +} /* RxErrNoFrameCount */ +namespace RxErrUnknownNeighborCount { +inline constexpr uint32_t Id = 0x0033; +} /* RxErrUnknownNeighborCount */ +namespace RxErrInvalidSrcAddrCount { +inline constexpr uint32_t Id = 0x0034; +} /* RxErrInvalidSrcAddrCount */ +namespace RxErrSecCount { +inline constexpr uint32_t Id = 0x0035; +} /* RxErrSecCount */ +namespace RxErrFcsCount { +inline constexpr uint32_t Id = 0x0036; +} /* RxErrFcsCount */ +namespace RxErrOtherCount { +inline constexpr uint32_t Id = 0x0037; +} /* RxErrOtherCount */ +namespace ActiveTimestamp { +inline constexpr uint32_t Id = 0x0038; +} /* ActiveTimestamp */ +namespace PendingTimestamp { +inline constexpr uint32_t Id = 0x0039; +} /* PendingTimestamp */ +namespace Delay { +inline constexpr uint32_t Id = 0x003A; +} /* Delay */ +namespace SecurityPolicy { +inline constexpr uint32_t Id = 0x003B; +} /* SecurityPolicy */ +namespace ChannelPage0Mask { +inline constexpr uint32_t Id = 0x003C; +} /* ChannelPage0Mask */ +namespace OperationalDatasetComponents { +inline constexpr uint32_t Id = 0x003D; +} /* OperationalDatasetComponents */ +namespace ActiveNetworkFaultsList { +inline constexpr uint32_t Id = 0x003E; +} /* ActiveNetworkFaultsList */ +} /* attribute */ + +namespace command { +namespace ResetCounts { +inline constexpr uint32_t Id = 0x00; +} /* ResetCounts */ +} /* command */ + +namespace event { +namespace ConnectionStatus { +inline constexpr uint32_t Id = 0x00; +} /* ConnectionStatus */ +namespace NetworkFaultChange { +inline constexpr uint32_t Id = 0x01; +} /* NetworkFaultChange */ +} /* event */ + +} /* thread_network_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thread_network_directory/thread_network_directory.cpp b/components/esp_matter/data_model/generated/clusters/thread_network_directory/thread_network_directory.cpp new file mode 100644 index 000000000..c5a5fb263 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thread_network_directory/thread_network_directory.cpp @@ -0,0 +1,127 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "thread_network_directory_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace thread_network_directory { + +namespace attribute { +attribute_t *create_preferred_extended_pan_id(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, PreferredExtendedPanID::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_octet_str(value, length)); +} + +attribute_t *create_thread_networks(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ThreadNetworks::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_thread_network_table_size(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkTableSize::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +} /* attribute */ +namespace command { +command_t *create_add_network(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AddNetwork::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_remove_network(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RemoveNetwork::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_get_operational_dataset(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GetOperationalDataset::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_operational_dataset_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, OperationalDatasetResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, thread_network_directory::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, thread_network_directory::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterThreadNetworkDirectoryPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_preferred_extended_pan_id(cluster, NULL, 0); + attribute::create_thread_networks(cluster, NULL, 0, 0); + attribute::create_thread_network_table_size(cluster, 0); + command::create_add_network(cluster); + command::create_remove_network(cluster); + command::create_get_operational_dataset(cluster); + command::create_operational_dataset_response(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* thread_network_directory */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thread_network_directory/thread_network_directory.h b/components/esp_matter/data_model/generated/clusters/thread_network_directory/thread_network_directory.h new file mode 100644 index 000000000..e7d537174 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thread_network_directory/thread_network_directory.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace thread_network_directory { + +namespace attribute { +attribute_t *create_preferred_extended_pan_id(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_thread_networks(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_thread_network_table_size(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_add_network(cluster_t *cluster); +command_t *create_remove_network(cluster_t *cluster); +command_t *create_get_operational_dataset(cluster_t *cluster); +command_t *create_operational_dataset_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* thread_network_directory */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/thread_network_directory/thread_network_directory_ids.h b/components/esp_matter/data_model/generated/clusters/thread_network_directory/thread_network_directory_ids.h new file mode 100644 index 000000000..a6e332a32 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/thread_network_directory/thread_network_directory_ids.h @@ -0,0 +1,55 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace thread_network_directory { + +inline constexpr uint32_t Id = 0x0453; + +namespace attribute { +namespace PreferredExtendedPanID { +inline constexpr uint32_t Id = 0x0000; +} /* PreferredExtendedPanID */ +namespace ThreadNetworks { +inline constexpr uint32_t Id = 0x0001; +} /* ThreadNetworks */ +namespace ThreadNetworkTableSize { +inline constexpr uint32_t Id = 0x0002; +} /* ThreadNetworkTableSize */ +} /* attribute */ + +namespace command { +namespace AddNetwork { +inline constexpr uint32_t Id = 0x00; +} /* AddNetwork */ +namespace RemoveNetwork { +inline constexpr uint32_t Id = 0x01; +} /* RemoveNetwork */ +namespace GetOperationalDataset { +inline constexpr uint32_t Id = 0x02; +} /* GetOperationalDataset */ +namespace OperationalDatasetResponse { +inline constexpr uint32_t Id = 0x03; +} /* OperationalDatasetResponse */ +} /* command */ + +} /* thread_network_directory */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/time_format_localization/time_format_localization.cpp b/components/esp_matter/data_model/generated/clusters/time_format_localization/time_format_localization.cpp new file mode 100644 index 000000000..1c468e0d9 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/time_format_localization/time_format_localization.cpp @@ -0,0 +1,123 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "time_format_localization_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace time_format_localization { + +namespace feature { +namespace calendar_format { +uint32_t get_id() +{ + return CalendarFormat::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_active_calendar_type(cluster, config->active_calendar_type); + attribute::create_supported_calendar_types(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* calendar_format */ + +} /* feature */ + +namespace attribute { +attribute_t *create_hour_format(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, HourFormat::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_active_calendar_type(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(calendar_format), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, ActiveCalendarType::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(12)); + return attribute; +} + +attribute_t *create_supported_calendar_types(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(calendar_format), NULL); + return esp_matter::attribute::create(cluster, SupportedCalendarTypes::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, time_format_localization::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, time_format_localization::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterTimeFormatLocalizationPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_hour_format(cluster, config->hour_format); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterTimeFormatLocalizationClusterServerInitCallback, + ESPMatterTimeFormatLocalizationClusterServerShutdownCallback); + } + + return cluster; +} + +} /* time_format_localization */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/time_format_localization/time_format_localization.h b/components/esp_matter/data_model/generated/clusters/time_format_localization/time_format_localization.h new file mode 100644 index 000000000..89673996a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/time_format_localization/time_format_localization.h @@ -0,0 +1,51 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace time_format_localization { + +namespace feature { +namespace calendar_format { +typedef struct config { + uint8_t active_calendar_type; + config() : active_calendar_type(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* calendar_format */ + +} /* feature */ + +namespace attribute { +attribute_t *create_hour_format(cluster_t *cluster, uint8_t value); +attribute_t *create_active_calendar_type(cluster_t *cluster, uint8_t value); +attribute_t *create_supported_calendar_types(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +typedef struct config { + uint8_t hour_format; + config() : hour_format(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* time_format_localization */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/time_format_localization/time_format_localization_ids.h b/components/esp_matter/data_model/generated/clusters/time_format_localization/time_format_localization_ids.h new file mode 100644 index 000000000..dbbec6272 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/time_format_localization/time_format_localization_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace time_format_localization { + +inline constexpr uint32_t Id = 0x002C; + +namespace feature { +namespace CalendarFormat { +inline constexpr uint32_t Id = 0x1; +} /* CalendarFormat */ +} /* feature */ + +namespace attribute { +namespace HourFormat { +inline constexpr uint32_t Id = 0x0000; +} /* HourFormat */ +namespace ActiveCalendarType { +inline constexpr uint32_t Id = 0x0001; +} /* ActiveCalendarType */ +namespace SupportedCalendarTypes { +inline constexpr uint32_t Id = 0x0002; +} /* SupportedCalendarTypes */ +} /* attribute */ + +} /* time_format_localization */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/time_synchronization/time_synchronization.cpp b/components/esp_matter/data_model/generated/clusters/time_synchronization/time_synchronization.cpp new file mode 100644 index 000000000..8073cc5b2 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/time_synchronization/time_synchronization.cpp @@ -0,0 +1,352 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "time_synchronization_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace time_synchronization { + +namespace feature { +namespace time_zone { +uint32_t get_id() +{ + return TimeZone::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_local_time(cluster, config->local_time); + attribute::create_time_zone_database(cluster, config->time_zone_database); + attribute::create_time_zone_list_max_size(cluster, config->time_zone_list_max_size); + attribute::create_dst_offset_list_max_size(cluster, config->dst_offset_list_max_size); + attribute::create_time_zone(cluster, NULL, 0, 0); + attribute::create_dst_offset(cluster, NULL, 0, 0); + command::create_set_time_zone(cluster); + command::create_set_time_zone_response(cluster); + command::create_set_dst_offset(cluster); + event::create_dst_table_empty(cluster); + event::create_dst_status(cluster); + event::create_time_zone_status(cluster); + + return ESP_OK; +} +} /* time_zone */ + +namespace ntp_client { +uint32_t get_id() +{ + return NTPClient::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_default_ntp(cluster, config->default_ntp, sizeof(config->default_ntp)); + attribute::create_supports_dns_resolve(cluster, config->supports_dns_resolve); + command::create_set_default_ntp(cluster); + + return ESP_OK; +} +} /* ntp_client */ + +namespace ntp_server { +uint32_t get_id() +{ + return NTPServer::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_ntp_server_available(cluster, config->ntp_server_available); + + return ESP_OK; +} +} /* ntp_server */ + +namespace time_sync_client { +uint32_t get_id() +{ + return TimeSyncClient::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_trusted_time_source(cluster, NULL, 0, 0); + command::create_set_trusted_time_source(cluster); + event::create_missing_trusted_time_source(cluster); + + return ESP_OK; +} +} /* time_sync_client */ + +} /* feature */ + +namespace attribute { +attribute_t *create_utc_time(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, UTCTime::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint64(0), esp_matter_nullable_uint64(4294967294)); + return attribute; +} + +attribute_t *create_granularity(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Granularity::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(4)); + return attribute; +} + +attribute_t *create_time_source(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, TimeSource::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(16)); + return attribute; +} + +attribute_t *create_trusted_time_source(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_sync_client), NULL); + return esp_matter::attribute::create(cluster, TrustedTimeSource::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_default_ntp(cluster_t *cluster, char *value, uint16_t length) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(ntp_client), NULL); + VerifyOrReturnValue(length <= k_max_default_ntp_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + return esp_matter::attribute::create(cluster, DefaultNTP::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_char_str(value, length), k_max_default_ntp_length + 1); +} + +attribute_t *create_time_zone(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_zone), NULL); + return esp_matter::attribute::create(cluster, TimeZone::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_dst_offset(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_zone), NULL); + return esp_matter::attribute::create(cluster, DSTOffset::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_local_time(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_zone), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, LocalTime::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint64(0), esp_matter_nullable_uint64(4294967294)); + return attribute; +} + +attribute_t *create_time_zone_database(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_zone), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, TimeZoneDatabase::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_ntp_server_available(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(ntp_server), NULL); + return esp_matter::attribute::create(cluster, NTPServerAvailable::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_time_zone_list_max_size(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_zone), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, TimeZoneListMaxSize::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(2)); + return attribute; +} + +attribute_t *create_dst_offset_list_max_size(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_zone), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, DSTOffsetListMaxSize::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_supports_dns_resolve(cluster_t *cluster, bool value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(ntp_client), NULL); + return esp_matter::attribute::create(cluster, SupportsDNSResolve::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +} /* attribute */ +namespace command { +command_t *create_set_utc_time(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SetUTCTime::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_set_trusted_time_source(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_sync_client), NULL); + return esp_matter::command::create(cluster, SetTrustedTimeSource::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_set_time_zone(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_zone), NULL); + return esp_matter::command::create(cluster, SetTimeZone::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_set_time_zone_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_zone), NULL); + return esp_matter::command::create(cluster, SetTimeZoneResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_set_dst_offset(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_zone), NULL); + return esp_matter::command::create(cluster, SetDSTOffset::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_set_default_ntp(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(ntp_client), NULL); + return esp_matter::command::create(cluster, SetDefaultNTP::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_dst_table_empty(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_zone), NULL); + return esp_matter::event::create(cluster, DSTTableEmpty::Id); +} + +event_t *create_dst_status(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_zone), NULL); + return esp_matter::event::create(cluster, DSTStatus::Id); +} + +event_t *create_time_zone_status(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_zone), NULL); + return esp_matter::event::create(cluster, TimeZoneStatus::Id); +} + +event_t *create_time_failure(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, TimeFailure::Id); +} + +event_t *create_missing_trusted_time_source(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_sync_client), NULL); + return esp_matter::event::create(cluster, MissingTrustedTimeSource::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, time_synchronization::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, time_synchronization::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = TimeSynchronizationDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterTimeSynchronizationPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_utc_time(cluster, config->utc_time); + attribute::create_granularity(cluster, config->granularity); + command::create_set_utc_time(cluster); + /* Events */ + event::create_time_failure(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterTimeSynchronizationClusterServerInitCallback, + ESPMatterTimeSynchronizationClusterServerShutdownCallback); + } + + return cluster; +} + +} /* time_synchronization */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/time_synchronization/time_synchronization.h b/components/esp_matter/data_model/generated/clusters/time_synchronization/time_synchronization.h new file mode 100644 index 000000000..4e5831b06 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/time_synchronization/time_synchronization.h @@ -0,0 +1,108 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace time_synchronization { + +const uint8_t k_max_default_ntp_length = 128u; +namespace feature { +namespace time_zone { +typedef struct config { + nullable local_time; + uint8_t time_zone_database; + uint8_t time_zone_list_max_size; + uint8_t dst_offset_list_max_size; + config() : local_time(0), time_zone_database(0), time_zone_list_max_size(0), dst_offset_list_max_size(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* time_zone */ + +namespace ntp_client { +typedef struct config { + char default_ntp[k_max_default_ntp_length + 1]; + bool supports_dns_resolve; + config() : supports_dns_resolve(false) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* ntp_client */ + +namespace ntp_server { +typedef struct config { + bool ntp_server_available; + config() : ntp_server_available(false) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* ntp_server */ + +namespace time_sync_client { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* time_sync_client */ + +} /* feature */ + +namespace attribute { +attribute_t *create_utc_time(cluster_t *cluster, nullable value); +attribute_t *create_granularity(cluster_t *cluster, uint8_t value); +attribute_t *create_time_source(cluster_t *cluster, uint8_t value); +attribute_t *create_trusted_time_source(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_default_ntp(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_time_zone(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_dst_offset(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_local_time(cluster_t *cluster, nullable value); +attribute_t *create_time_zone_database(cluster_t *cluster, uint8_t value); +attribute_t *create_ntp_server_available(cluster_t *cluster, bool value); +attribute_t *create_time_zone_list_max_size(cluster_t *cluster, uint8_t value); +attribute_t *create_dst_offset_list_max_size(cluster_t *cluster, uint8_t value); +attribute_t *create_supports_dns_resolve(cluster_t *cluster, bool value); +} /* attribute */ + +namespace command { +command_t *create_set_utc_time(cluster_t *cluster); +command_t *create_set_trusted_time_source(cluster_t *cluster); +command_t *create_set_time_zone(cluster_t *cluster); +command_t *create_set_time_zone_response(cluster_t *cluster); +command_t *create_set_dst_offset(cluster_t *cluster); +command_t *create_set_default_ntp(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_dst_table_empty(cluster_t *cluster); +event_t *create_dst_status(cluster_t *cluster); +event_t *create_time_zone_status(cluster_t *cluster); +event_t *create_time_failure(cluster_t *cluster); +event_t *create_missing_trusted_time_source(cluster_t *cluster); +} /* event */ + +typedef struct config { + nullable utc_time; + uint8_t granularity; + void *delegate; + config() : utc_time(0), granularity(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* time_synchronization */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/time_synchronization/time_synchronization_ids.h b/components/esp_matter/data_model/generated/clusters/time_synchronization/time_synchronization_ids.h new file mode 100644 index 000000000..fe6fe5e9d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/time_synchronization/time_synchronization_ids.h @@ -0,0 +1,124 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace time_synchronization { + +inline constexpr uint32_t Id = 0x0038; + +namespace feature { +namespace TimeZone { +inline constexpr uint32_t Id = 0x1; +} /* TimeZone */ +namespace NTPClient { +inline constexpr uint32_t Id = 0x2; +} /* NTPClient */ +namespace NTPServer { +inline constexpr uint32_t Id = 0x4; +} /* NTPServer */ +namespace TimeSyncClient { +inline constexpr uint32_t Id = 0x8; +} /* TimeSyncClient */ +} /* feature */ + +namespace attribute { +namespace UTCTime { +inline constexpr uint32_t Id = 0x0000; +} /* UTCTime */ +namespace Granularity { +inline constexpr uint32_t Id = 0x0001; +} /* Granularity */ +namespace TimeSource { +inline constexpr uint32_t Id = 0x0002; +} /* TimeSource */ +namespace TrustedTimeSource { +inline constexpr uint32_t Id = 0x0003; +} /* TrustedTimeSource */ +namespace DefaultNTP { +inline constexpr uint32_t Id = 0x0004; +} /* DefaultNTP */ +namespace TimeZone { +inline constexpr uint32_t Id = 0x0005; +} /* TimeZone */ +namespace DSTOffset { +inline constexpr uint32_t Id = 0x0006; +} /* DSTOffset */ +namespace LocalTime { +inline constexpr uint32_t Id = 0x0007; +} /* LocalTime */ +namespace TimeZoneDatabase { +inline constexpr uint32_t Id = 0x0008; +} /* TimeZoneDatabase */ +namespace NTPServerAvailable { +inline constexpr uint32_t Id = 0x0009; +} /* NTPServerAvailable */ +namespace TimeZoneListMaxSize { +inline constexpr uint32_t Id = 0x000A; +} /* TimeZoneListMaxSize */ +namespace DSTOffsetListMaxSize { +inline constexpr uint32_t Id = 0x000B; +} /* DSTOffsetListMaxSize */ +namespace SupportsDNSResolve { +inline constexpr uint32_t Id = 0x000C; +} /* SupportsDNSResolve */ +} /* attribute */ + +namespace command { +namespace SetUTCTime { +inline constexpr uint32_t Id = 0x00; +} /* SetUTCTime */ +namespace SetTrustedTimeSource { +inline constexpr uint32_t Id = 0x01; +} /* SetTrustedTimeSource */ +namespace SetTimeZone { +inline constexpr uint32_t Id = 0x02; +} /* SetTimeZone */ +namespace SetTimeZoneResponse { +inline constexpr uint32_t Id = 0x03; +} /* SetTimeZoneResponse */ +namespace SetDSTOffset { +inline constexpr uint32_t Id = 0x04; +} /* SetDSTOffset */ +namespace SetDefaultNTP { +inline constexpr uint32_t Id = 0x05; +} /* SetDefaultNTP */ +} /* command */ + +namespace event { +namespace DSTTableEmpty { +inline constexpr uint32_t Id = 0x00; +} /* DSTTableEmpty */ +namespace DSTStatus { +inline constexpr uint32_t Id = 0x01; +} /* DSTStatus */ +namespace TimeZoneStatus { +inline constexpr uint32_t Id = 0x02; +} /* TimeZoneStatus */ +namespace TimeFailure { +inline constexpr uint32_t Id = 0x03; +} /* TimeFailure */ +namespace MissingTrustedTimeSource { +inline constexpr uint32_t Id = 0x04; +} /* MissingTrustedTimeSource */ +} /* event */ + +} /* time_synchronization */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/tls_certificate_management/tls_certificate_management.cpp b/components/esp_matter/data_model/generated/clusters/tls_certificate_management/tls_certificate_management.cpp new file mode 100644 index 000000000..2bdc89d1e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/tls_certificate_management/tls_certificate_management.cpp @@ -0,0 +1,190 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "tls_certificate_management_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace tls_certificate_management { + +namespace attribute { +attribute_t *create_max_root_certificates(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, MaxRootCertificates::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_provisioned_root_certificates(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ProvisionedRootCertificates::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_max_client_certificates(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, MaxClientCertificates::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_provisioned_client_certificates(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ProvisionedClientCertificates::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_provision_root_certificate(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ProvisionRootCertificate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_provision_root_certificate_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ProvisionRootCertificateResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_find_root_certificate(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, FindRootCertificate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_find_root_certificate_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, FindRootCertificateResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_lookup_root_certificate(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, LookupRootCertificate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_lookup_root_certificate_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, LookupRootCertificateResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_remove_root_certificate(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RemoveRootCertificate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_client_csr(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ClientCSR::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_client_csr_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ClientCSRResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_provision_client_certificate(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ProvisionClientCertificate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_find_client_certificate(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, FindClientCertificate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_find_client_certificate_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, FindClientCertificateResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_lookup_client_certificate(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, LookupClientCertificate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_lookup_client_certificate_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, LookupClientCertificateResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_remove_client_certificate(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RemoveClientCertificate::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, tls_certificate_management::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, tls_certificate_management::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterTlsCertificateManagementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_max_root_certificates(cluster, 0); + attribute::create_provisioned_root_certificates(cluster, NULL, 0, 0); + attribute::create_max_client_certificates(cluster, 0); + attribute::create_provisioned_client_certificates(cluster, NULL, 0, 0); + command::create_provision_root_certificate(cluster); + command::create_provision_root_certificate_response(cluster); + command::create_find_root_certificate(cluster); + command::create_find_root_certificate_response(cluster); + command::create_lookup_root_certificate(cluster); + command::create_lookup_root_certificate_response(cluster); + command::create_remove_root_certificate(cluster); + command::create_client_csr(cluster); + command::create_client_csr_response(cluster); + command::create_provision_client_certificate(cluster); + command::create_find_client_certificate(cluster); + command::create_find_client_certificate_response(cluster); + command::create_lookup_client_certificate(cluster); + command::create_lookup_client_certificate_response(cluster); + command::create_remove_client_certificate(cluster); + } + + return cluster; +} + +} /* tls_certificate_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/tls_certificate_management/tls_certificate_management.h b/components/esp_matter/data_model/generated/clusters/tls_certificate_management/tls_certificate_management.h new file mode 100644 index 000000000..62f2afe6e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/tls_certificate_management/tls_certificate_management.h @@ -0,0 +1,57 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace tls_certificate_management { + +namespace attribute { +attribute_t *create_max_root_certificates(cluster_t *cluster, uint8_t value); +attribute_t *create_provisioned_root_certificates(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_max_client_certificates(cluster_t *cluster, uint8_t value); +attribute_t *create_provisioned_client_certificates(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_provision_root_certificate(cluster_t *cluster); +command_t *create_provision_root_certificate_response(cluster_t *cluster); +command_t *create_find_root_certificate(cluster_t *cluster); +command_t *create_find_root_certificate_response(cluster_t *cluster); +command_t *create_lookup_root_certificate(cluster_t *cluster); +command_t *create_lookup_root_certificate_response(cluster_t *cluster); +command_t *create_remove_root_certificate(cluster_t *cluster); +command_t *create_client_csr(cluster_t *cluster); +command_t *create_client_csr_response(cluster_t *cluster); +command_t *create_provision_client_certificate(cluster_t *cluster); +command_t *create_find_client_certificate(cluster_t *cluster); +command_t *create_find_client_certificate_response(cluster_t *cluster); +command_t *create_lookup_client_certificate(cluster_t *cluster); +command_t *create_lookup_client_certificate_response(cluster_t *cluster); +command_t *create_remove_client_certificate(cluster_t *cluster); +} /* command */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* tls_certificate_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/tls_certificate_management/tls_certificate_management_ids.h b/components/esp_matter/data_model/generated/clusters/tls_certificate_management/tls_certificate_management_ids.h new file mode 100644 index 000000000..cecd53eca --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/tls_certificate_management/tls_certificate_management_ids.h @@ -0,0 +1,91 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace tls_certificate_management { + +inline constexpr uint32_t Id = 0x0801; + +namespace attribute { +namespace MaxRootCertificates { +inline constexpr uint32_t Id = 0x0000; +} /* MaxRootCertificates */ +namespace ProvisionedRootCertificates { +inline constexpr uint32_t Id = 0x0001; +} /* ProvisionedRootCertificates */ +namespace MaxClientCertificates { +inline constexpr uint32_t Id = 0x0002; +} /* MaxClientCertificates */ +namespace ProvisionedClientCertificates { +inline constexpr uint32_t Id = 0x0003; +} /* ProvisionedClientCertificates */ +} /* attribute */ + +namespace command { +namespace ProvisionRootCertificate { +inline constexpr uint32_t Id = 0x00; +} /* ProvisionRootCertificate */ +namespace ProvisionRootCertificateResponse { +inline constexpr uint32_t Id = 0x01; +} /* ProvisionRootCertificateResponse */ +namespace FindRootCertificate { +inline constexpr uint32_t Id = 0x02; +} /* FindRootCertificate */ +namespace FindRootCertificateResponse { +inline constexpr uint32_t Id = 0x03; +} /* FindRootCertificateResponse */ +namespace LookupRootCertificate { +inline constexpr uint32_t Id = 0x04; +} /* LookupRootCertificate */ +namespace LookupRootCertificateResponse { +inline constexpr uint32_t Id = 0x05; +} /* LookupRootCertificateResponse */ +namespace RemoveRootCertificate { +inline constexpr uint32_t Id = 0x06; +} /* RemoveRootCertificate */ +namespace ClientCSR { +inline constexpr uint32_t Id = 0x07; +} /* ClientCSR */ +namespace ClientCSRResponse { +inline constexpr uint32_t Id = 0x08; +} /* ClientCSRResponse */ +namespace ProvisionClientCertificate { +inline constexpr uint32_t Id = 0x09; +} /* ProvisionClientCertificate */ +namespace FindClientCertificate { +inline constexpr uint32_t Id = 0x0A; +} /* FindClientCertificate */ +namespace FindClientCertificateResponse { +inline constexpr uint32_t Id = 0x0B; +} /* FindClientCertificateResponse */ +namespace LookupClientCertificate { +inline constexpr uint32_t Id = 0x0C; +} /* LookupClientCertificate */ +namespace LookupClientCertificateResponse { +inline constexpr uint32_t Id = 0x0D; +} /* LookupClientCertificateResponse */ +namespace RemoveClientCertificate { +inline constexpr uint32_t Id = 0x0E; +} /* RemoveClientCertificate */ +} /* command */ + +} /* tls_certificate_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/tls_client_management/tls_client_management.cpp b/components/esp_matter/data_model/generated/clusters/tls_client_management/tls_client_management.cpp new file mode 100644 index 000000000..7b46112fc --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/tls_client_management/tls_client_management.cpp @@ -0,0 +1,118 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "tls_client_management_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace tls_client_management { + +namespace attribute { +attribute_t *create_max_provisioned(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, MaxProvisioned::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_provisioned_endpoints(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, ProvisionedEndpoints::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_provision_endpoint(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ProvisionEndpoint::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_provision_endpoint_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ProvisionEndpointResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_find_endpoint(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, FindEndpoint::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_find_endpoint_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, FindEndpointResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_remove_endpoint(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RemoveEndpoint::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, tls_client_management::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, tls_client_management::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterTlsClientManagementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_max_provisioned(cluster, 0); + attribute::create_provisioned_endpoints(cluster, NULL, 0, 0); + command::create_provision_endpoint(cluster); + command::create_provision_endpoint_response(cluster); + command::create_find_endpoint(cluster); + command::create_find_endpoint_response(cluster); + command::create_remove_endpoint(cluster); + } + + return cluster; +} + +} /* tls_client_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/tls_client_management/tls_client_management.h b/components/esp_matter/data_model/generated/clusters/tls_client_management/tls_client_management.h new file mode 100644 index 000000000..109650e35 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/tls_client_management/tls_client_management.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace tls_client_management { + +namespace attribute { +attribute_t *create_max_provisioned(cluster_t *cluster, uint8_t value); +attribute_t *create_provisioned_endpoints(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_provision_endpoint(cluster_t *cluster); +command_t *create_provision_endpoint_response(cluster_t *cluster); +command_t *create_find_endpoint(cluster_t *cluster); +command_t *create_find_endpoint_response(cluster_t *cluster); +command_t *create_remove_endpoint(cluster_t *cluster); +} /* command */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* tls_client_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/tls_client_management/tls_client_management_ids.h b/components/esp_matter/data_model/generated/clusters/tls_client_management/tls_client_management_ids.h new file mode 100644 index 000000000..5cc5e2cd2 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/tls_client_management/tls_client_management_ids.h @@ -0,0 +1,55 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace tls_client_management { + +inline constexpr uint32_t Id = 0x0802; + +namespace attribute { +namespace MaxProvisioned { +inline constexpr uint32_t Id = 0x0000; +} /* MaxProvisioned */ +namespace ProvisionedEndpoints { +inline constexpr uint32_t Id = 0x0001; +} /* ProvisionedEndpoints */ +} /* attribute */ + +namespace command { +namespace ProvisionEndpoint { +inline constexpr uint32_t Id = 0x00; +} /* ProvisionEndpoint */ +namespace ProvisionEndpointResponse { +inline constexpr uint32_t Id = 0x01; +} /* ProvisionEndpointResponse */ +namespace FindEndpoint { +inline constexpr uint32_t Id = 0x02; +} /* FindEndpoint */ +namespace FindEndpointResponse { +inline constexpr uint32_t Id = 0x03; +} /* FindEndpointResponse */ +namespace RemoveEndpoint { +inline constexpr uint32_t Id = 0x04; +} /* RemoveEndpoint */ +} /* command */ + +} /* tls_client_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/total_volatile_organic_compounds_concentration_measurement/total_volatile_organic_compounds_concentration_measurement.cpp b/components/esp_matter/data_model/generated/clusters/total_volatile_organic_compounds_concentration_measurement/total_volatile_organic_compounds_concentration_measurement.cpp new file mode 100644 index 000000000..a3d4458ad --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/total_volatile_organic_compounds_concentration_measurement/total_volatile_organic_compounds_concentration_measurement.cpp @@ -0,0 +1,289 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "total_volatile_organic_compounds_concentration_measurement_cluster"; +constexpr uint16_t cluster_revision = 3; + +namespace esp_matter { +namespace cluster { +namespace total_volatile_organic_compounds_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id() +{ + return NumericMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_measured_value(cluster, 0); + attribute::create_min_measured_value(cluster, 0); + attribute::create_max_measured_value(cluster, 0); + attribute::create_measurement_unit(cluster, 0); + + return ESP_OK; +} +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id() +{ + return LevelIndication::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_level_value(cluster, 0); + + return ESP_OK; +} +} /* level_indication */ + +namespace medium_level { +uint32_t get_id() +{ + return MediumLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* medium_level */ + +namespace critical_level { +uint32_t get_id() +{ + return CriticalLevel::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(level_indication), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id() +{ + return PeakMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_peak_measured_value(cluster, 0); + attribute::create_peak_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id() +{ + return AverageMeasurement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(numeric_measurement), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_average_measured_value(cluster, 0); + attribute::create_average_measured_value_window(cluster, 0); + + return ESP_OK; +} +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MinMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MaxMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(peak_measurement), NULL); + return esp_matter::attribute::create(cluster, PeakMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); +} + +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(average_measurement), NULL); + return esp_matter::attribute::create(cluster, AverageMeasuredValueWindow::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_uncertainty(cluster_t *cluster, float value) +{ + return esp_matter::attribute::create(cluster, Uncertainty::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_float(value)); +} + +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(numeric_measurement), NULL); + return esp_matter::attribute::create(cluster, MeasurementUnit::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, MeasurementMedium::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +attribute_t *create_level_value(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(level_indication), NULL); + return esp_matter::attribute::create(cluster, LevelValue::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, total_volatile_organic_compounds_concentration_measurement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, total_volatile_organic_compounds_concentration_measurement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterTotalVolatileOrganicCompoundsConcentrationMeasurementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_measurement_medium(cluster, 0); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("NumericMeasurement,LevelIndication", + feature::numeric_measurement::get_id(), feature::level_indication::get_id()); + if (feature_map & feature::numeric_measurement::get_id()) { + VerifyOrReturnValue(feature::numeric_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::level_indication::get_id()) { + VerifyOrReturnValue(feature::level_indication::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::medium_level::get_id()) { + VerifyOrReturnValue(feature::medium_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::critical_level::get_id()) { + VerifyOrReturnValue(feature::critical_level::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::peak_measurement::get_id()) { + VerifyOrReturnValue(feature::peak_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::average_measurement::get_id()) { + VerifyOrReturnValue(feature::average_measurement::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* total_volatile_organic_compounds_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/total_volatile_organic_compounds_concentration_measurement/total_volatile_organic_compounds_concentration_measurement.h b/components/esp_matter/data_model/generated/clusters/total_volatile_organic_compounds_concentration_measurement/total_volatile_organic_compounds_concentration_measurement.h new file mode 100644 index 000000000..58b25d2dc --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/total_volatile_organic_compounds_concentration_measurement/total_volatile_organic_compounds_concentration_measurement.h @@ -0,0 +1,80 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace total_volatile_organic_compounds_concentration_measurement { + +namespace feature { +namespace numeric_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* numeric_measurement */ + +namespace level_indication { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* level_indication */ + +namespace medium_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* medium_level */ + +namespace critical_level { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* critical_level */ + +namespace peak_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* peak_measurement */ + +namespace average_measurement { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* average_measurement */ + +} /* feature */ + +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_uncertainty(cluster_t *cluster, float value); +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value); +attribute_t *create_level_value(cluster_t *cluster, uint8_t value); +} /* attribute */ + +typedef struct config { + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* total_volatile_organic_compounds_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/total_volatile_organic_compounds_concentration_measurement/total_volatile_organic_compounds_concentration_measurement_ids.h b/components/esp_matter/data_model/generated/clusters/total_volatile_organic_compounds_concentration_measurement/total_volatile_organic_compounds_concentration_measurement_ids.h new file mode 100644 index 000000000..e067ba03c --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/total_volatile_organic_compounds_concentration_measurement/total_volatile_organic_compounds_concentration_measurement_ids.h @@ -0,0 +1,85 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace total_volatile_organic_compounds_concentration_measurement { + +inline constexpr uint32_t Id = 0x042E; + +namespace feature { +namespace NumericMeasurement { +inline constexpr uint32_t Id = 0x1; +} /* NumericMeasurement */ +namespace LevelIndication { +inline constexpr uint32_t Id = 0x2; +} /* LevelIndication */ +namespace MediumLevel { +inline constexpr uint32_t Id = 0x4; +} /* MediumLevel */ +namespace CriticalLevel { +inline constexpr uint32_t Id = 0x8; +} /* CriticalLevel */ +namespace PeakMeasurement { +inline constexpr uint32_t Id = 0x10; +} /* PeakMeasurement */ +namespace AverageMeasurement { +inline constexpr uint32_t Id = 0x20; +} /* AverageMeasurement */ +} /* feature */ + +namespace attribute { +namespace MeasuredValue { +inline constexpr uint32_t Id = 0x0000; +} /* MeasuredValue */ +namespace MinMeasuredValue { +inline constexpr uint32_t Id = 0x0001; +} /* MinMeasuredValue */ +namespace MaxMeasuredValue { +inline constexpr uint32_t Id = 0x0002; +} /* MaxMeasuredValue */ +namespace PeakMeasuredValue { +inline constexpr uint32_t Id = 0x0003; +} /* PeakMeasuredValue */ +namespace PeakMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0004; +} /* PeakMeasuredValueWindow */ +namespace AverageMeasuredValue { +inline constexpr uint32_t Id = 0x0005; +} /* AverageMeasuredValue */ +namespace AverageMeasuredValueWindow { +inline constexpr uint32_t Id = 0x0006; +} /* AverageMeasuredValueWindow */ +namespace Uncertainty { +inline constexpr uint32_t Id = 0x0007; +} /* Uncertainty */ +namespace MeasurementUnit { +inline constexpr uint32_t Id = 0x0008; +} /* MeasurementUnit */ +namespace MeasurementMedium { +inline constexpr uint32_t Id = 0x0009; +} /* MeasurementMedium */ +namespace LevelValue { +inline constexpr uint32_t Id = 0x000A; +} /* LevelValue */ +} /* attribute */ + +} /* total_volatile_organic_compounds_concentration_measurement */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/unit_localization/unit_localization.cpp b/components/esp_matter/data_model/generated/clusters/unit_localization/unit_localization.cpp new file mode 100644 index 000000000..e95ba6a85 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/unit_localization/unit_localization.cpp @@ -0,0 +1,114 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "unit_localization_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace unit_localization { + +namespace feature { +namespace temperature_unit { +uint32_t get_id() +{ + return TemperatureUnit::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_temperature_unit(cluster, config->temperature_unit); + attribute::create_supported_temperature_units(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* temperature_unit */ + +} /* feature */ + +namespace attribute { +attribute_t *create_temperature_unit(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(temperature_unit), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, TemperatureUnit::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_supported_temperature_units(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(temperature_unit), NULL); + return esp_matter::attribute::create(cluster, SupportedTemperatureUnits::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, unit_localization::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, unit_localization::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterUnitLocalizationPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterUnitLocalizationClusterServerInitCallback, + ESPMatterUnitLocalizationClusterServerShutdownCallback); + } + + return cluster; +} + +} /* unit_localization */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/unit_localization/unit_localization.h b/components/esp_matter/data_model/generated/clusters/unit_localization/unit_localization.h new file mode 100644 index 000000000..cb9ab2bd3 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/unit_localization/unit_localization.h @@ -0,0 +1,49 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace unit_localization { + +namespace feature { +namespace temperature_unit { +typedef struct config { + uint8_t temperature_unit; + config() : temperature_unit(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* temperature_unit */ + +} /* feature */ + +namespace attribute { +attribute_t *create_temperature_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_supported_temperature_units(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* unit_localization */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/unit_localization/unit_localization_ids.h b/components/esp_matter/data_model/generated/clusters/unit_localization/unit_localization_ids.h new file mode 100644 index 000000000..5373c4852 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/unit_localization/unit_localization_ids.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace unit_localization { + +inline constexpr uint32_t Id = 0x002D; + +namespace feature { +namespace TemperatureUnit { +inline constexpr uint32_t Id = 0x1; +} /* TemperatureUnit */ +} /* feature */ + +namespace attribute { +namespace TemperatureUnit { +inline constexpr uint32_t Id = 0x0000; +} /* TemperatureUnit */ +namespace SupportedTemperatureUnits { +inline constexpr uint32_t Id = 0x0001; +} /* SupportedTemperatureUnits */ +} /* attribute */ + +} /* unit_localization */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/user_label/user_label.cpp b/components/esp_matter/data_model/generated/clusters/user_label/user_label.cpp new file mode 100644 index 000000000..7dc1cb7f8 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/user_label/user_label.cpp @@ -0,0 +1,84 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "user_label_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace user_label { + +namespace attribute { +attribute_t *create_label_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, LabelList::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, user_label::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, user_label::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterUserLabelPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_label_list(cluster, NULL, 0, 0); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterUserLabelClusterServerInitCallback, + ESPMatterUserLabelClusterServerShutdownCallback); + } + + return cluster; +} + +} /* user_label */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/user_label/user_label.h b/components/esp_matter/data_model/generated/clusters/user_label/user_label.h new file mode 100644 index 000000000..2d04643b9 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/user_label/user_label.h @@ -0,0 +1,36 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace user_label { + +namespace attribute { +attribute_t *create_label_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* user_label */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/user_label/user_label_ids.h b/components/esp_matter/data_model/generated/clusters/user_label/user_label_ids.h new file mode 100644 index 000000000..c7eef9387 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/user_label/user_label_ids.h @@ -0,0 +1,34 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace user_label { + +inline constexpr uint32_t Id = 0x0041; + +namespace attribute { +namespace LabelList { +inline constexpr uint32_t Id = 0x0000; +} /* LabelList */ +} /* attribute */ + +} /* user_label */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/valve_configuration_and_control/valve_configuration_and_control.cpp b/components/esp_matter/data_model/generated/clusters/valve_configuration_and_control/valve_configuration_and_control.cpp new file mode 100644 index 000000000..d3f8edc3e --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/valve_configuration_and_control/valve_configuration_and_control.cpp @@ -0,0 +1,262 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "valve_configuration_and_control_cluster"; +constexpr uint16_t cluster_revision = 1; + +static esp_err_t esp_matter_command_callback_open(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ValveConfigurationAndControl::Commands::Open::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfValveConfigurationAndControlClusterOpenCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_close(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::ValveConfigurationAndControl::Commands::Close::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfValveConfigurationAndControlClusterCloseCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace valve_configuration_and_control { + +namespace feature { +namespace time_sync { +uint32_t get_id() +{ + return TimeSync::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_auto_close_time(cluster, config->auto_close_time); + + return ESP_OK; +} +} /* time_sync */ + +namespace level { +uint32_t get_id() +{ + return Level::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_current_level(cluster, config->current_level); + attribute::create_target_level(cluster, config->target_level); + + return ESP_OK; +} +} /* level */ + +} /* feature */ + +namespace attribute { +attribute_t *create_open_duration(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, OpenDuration::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(1), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_default_open_duration(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, DefaultOpenDuration::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(1), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_auto_close_time(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(time_sync), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, AutoCloseTime::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint64(0), esp_matter_nullable_uint64(4294967294)); + return attribute; +} + +attribute_t *create_remaining_duration(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, RemainingDuration::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_current_state(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentState::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_enum8(0), esp_matter_nullable_enum8(2)); + return attribute; +} + +attribute_t *create_target_state(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, TargetState::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_enum8(0), esp_matter_nullable_enum8(2)); + return attribute; +} + +attribute_t *create_current_level(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(level), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentLevel::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_target_level(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(level), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, TargetLevel::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_default_open_level(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, DefaultOpenLevel::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(100)); + return attribute; +} + +attribute_t *create_valve_fault(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ValveFault::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap16(0), esp_matter_bitmap16(65535)); + return attribute; +} + +attribute_t *create_level_step(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LevelStep::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(50)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_open(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Open::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_open); +} + +command_t *create_close(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Close::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_close); +} + +} /* command */ + +namespace event { +event_t *create_valve_state_changed(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, ValveStateChanged::Id); +} + +event_t *create_valve_fault(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, ValveFault::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, valve_configuration_and_control::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, valve_configuration_and_control::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = ValveConfigurationAndControlDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterValveConfigurationAndControlPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_open_duration(cluster, config->open_duration); + attribute::create_default_open_duration(cluster, config->default_open_duration); + attribute::create_current_state(cluster, config->current_state); + attribute::create_target_state(cluster, config->target_state); + attribute::create_remaining_duration(cluster, 0); + command::create_open(cluster); + command::create_close(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* valve_configuration_and_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/valve_configuration_and_control/valve_configuration_and_control.h b/components/esp_matter/data_model/generated/clusters/valve_configuration_and_control/valve_configuration_and_control.h new file mode 100644 index 000000000..ca56196d4 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/valve_configuration_and_control/valve_configuration_and_control.h @@ -0,0 +1,83 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace valve_configuration_and_control { + +namespace feature { +namespace time_sync { +typedef struct config { + nullable auto_close_time; + config() : auto_close_time(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* time_sync */ + +namespace level { +typedef struct config { + nullable current_level; + nullable target_level; + config() : current_level(0), target_level(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* level */ + +} /* feature */ + +namespace attribute { +attribute_t *create_open_duration(cluster_t *cluster, nullable value); +attribute_t *create_default_open_duration(cluster_t *cluster, nullable value); +attribute_t *create_auto_close_time(cluster_t *cluster, nullable value); +attribute_t *create_remaining_duration(cluster_t *cluster, nullable value); +attribute_t *create_current_state(cluster_t *cluster, nullable value); +attribute_t *create_target_state(cluster_t *cluster, nullable value); +attribute_t *create_current_level(cluster_t *cluster, nullable value); +attribute_t *create_target_level(cluster_t *cluster, nullable value); +attribute_t *create_default_open_level(cluster_t *cluster, uint8_t value); +attribute_t *create_valve_fault(cluster_t *cluster, uint16_t value); +attribute_t *create_level_step(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_open(cluster_t *cluster); +command_t *create_close(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_valve_state_changed(cluster_t *cluster); +event_t *create_valve_fault(cluster_t *cluster); +} /* event */ + +typedef struct config { + nullable open_duration; + nullable default_open_duration; + nullable current_state; + nullable target_state; + void *delegate; + config() : open_duration(0), default_open_duration(0), current_state(0), target_state(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* valve_configuration_and_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/valve_configuration_and_control/valve_configuration_and_control_ids.h b/components/esp_matter/data_model/generated/clusters/valve_configuration_and_control/valve_configuration_and_control_ids.h new file mode 100644 index 000000000..bb32d0f66 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/valve_configuration_and_control/valve_configuration_and_control_ids.h @@ -0,0 +1,91 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace valve_configuration_and_control { + +inline constexpr uint32_t Id = 0x0081; + +namespace feature { +namespace TimeSync { +inline constexpr uint32_t Id = 0x1; +} /* TimeSync */ +namespace Level { +inline constexpr uint32_t Id = 0x2; +} /* Level */ +} /* feature */ + +namespace attribute { +namespace OpenDuration { +inline constexpr uint32_t Id = 0x0000; +} /* OpenDuration */ +namespace DefaultOpenDuration { +inline constexpr uint32_t Id = 0x0001; +} /* DefaultOpenDuration */ +namespace AutoCloseTime { +inline constexpr uint32_t Id = 0x0002; +} /* AutoCloseTime */ +namespace RemainingDuration { +inline constexpr uint32_t Id = 0x0003; +} /* RemainingDuration */ +namespace CurrentState { +inline constexpr uint32_t Id = 0x0004; +} /* CurrentState */ +namespace TargetState { +inline constexpr uint32_t Id = 0x0005; +} /* TargetState */ +namespace CurrentLevel { +inline constexpr uint32_t Id = 0x0006; +} /* CurrentLevel */ +namespace TargetLevel { +inline constexpr uint32_t Id = 0x0007; +} /* TargetLevel */ +namespace DefaultOpenLevel { +inline constexpr uint32_t Id = 0x0008; +} /* DefaultOpenLevel */ +namespace ValveFault { +inline constexpr uint32_t Id = 0x0009; +} /* ValveFault */ +namespace LevelStep { +inline constexpr uint32_t Id = 0x000A; +} /* LevelStep */ +} /* attribute */ + +namespace command { +namespace Open { +inline constexpr uint32_t Id = 0x00; +} /* Open */ +namespace Close { +inline constexpr uint32_t Id = 0x01; +} /* Close */ +} /* command */ + +namespace event { +namespace ValveStateChanged { +inline constexpr uint32_t Id = 0x00; +} /* ValveStateChanged */ +namespace ValveFault { +inline constexpr uint32_t Id = 0x01; +} /* ValveFault */ +} /* event */ + +} /* valve_configuration_and_control */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/wake_on_lan/wake_on_lan.cpp b/components/esp_matter/data_model/generated/clusters/wake_on_lan/wake_on_lan.cpp new file mode 100644 index 000000000..5402b55fb --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/wake_on_lan/wake_on_lan.cpp @@ -0,0 +1,99 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "wake_on_lan_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace wake_on_lan { + +namespace attribute { +attribute_t *create_mac_address(cluster_t *cluster, char *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, MACAddress::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_char_str(value, length)); +} + +attribute_t *create_link_local_address(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, LinkLocalAddress::Id, ATTRIBUTE_FLAG_NONE, esp_matter_octet_str(value, length)); +} + +} /* attribute */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, wake_on_lan::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, wake_on_lan::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = WakeOnLanDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterWakeOnLanPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* wake_on_lan */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/wake_on_lan/wake_on_lan.h b/components/esp_matter/data_model/generated/clusters/wake_on_lan/wake_on_lan.h new file mode 100644 index 000000000..8ed098d27 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/wake_on_lan/wake_on_lan.h @@ -0,0 +1,39 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace wake_on_lan { + +const uint8_t k_max_link_local_address_length = 0u; +namespace attribute { +attribute_t *create_mac_address(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_link_local_address(cluster_t *cluster, uint8_t * value, uint16_t length); +} /* attribute */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* wake_on_lan */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/wake_on_lan/wake_on_lan_ids.h b/components/esp_matter/data_model/generated/clusters/wake_on_lan/wake_on_lan_ids.h new file mode 100644 index 000000000..c8e65eded --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/wake_on_lan/wake_on_lan_ids.h @@ -0,0 +1,37 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace wake_on_lan { + +inline constexpr uint32_t Id = 0x0503; + +namespace attribute { +namespace MACAddress { +inline constexpr uint32_t Id = 0x0000; +} /* MACAddress */ +namespace LinkLocalAddress { +inline constexpr uint32_t Id = 0x0001; +} /* LinkLocalAddress */ +} /* attribute */ + +} /* wake_on_lan */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/water_heater_management/water_heater_management.cpp b/components/esp_matter/data_model/generated/clusters/water_heater_management/water_heater_management.cpp new file mode 100644 index 000000000..0311b33c6 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/water_heater_management/water_heater_management.cpp @@ -0,0 +1,194 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "water_heater_management_cluster"; +constexpr uint16_t cluster_revision = 2; + +namespace esp_matter { +namespace cluster { +namespace water_heater_management { + +namespace feature { +namespace energy_management { +uint32_t get_id() +{ + return EnergyManagement::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_tank_volume(cluster, 0); + attribute::create_estimated_heat_required(cluster, 0); + + return ESP_OK; +} +} /* energy_management */ + +namespace tank_percent { +uint32_t get_id() +{ + return TankPercent::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_tank_percentage(cluster, 0); + + return ESP_OK; +} +} /* tank_percent */ + +} /* feature */ + +namespace attribute { +attribute_t *create_heater_types(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, HeaterTypes::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_bitmap8(value)); +} + +attribute_t *create_heat_demand(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, HeatDemand::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_bitmap8(value)); +} + +attribute_t *create_tank_volume(cluster_t *cluster, uint16_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(energy_management), NULL); + return esp_matter::attribute::create(cluster, TankVolume::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_estimated_heat_required(cluster_t *cluster, int64_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(energy_management), NULL); + return esp_matter::attribute::create(cluster, EstimatedHeatRequired::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_int64(value)); +} + +attribute_t *create_tank_percentage(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(tank_percent), NULL); + return esp_matter::attribute::create(cluster, TankPercentage::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_boost_state(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, BoostState::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +} /* attribute */ +namespace command { +command_t *create_boost(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Boost::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_cancel_boost(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CancelBoost::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_boost_started(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, BoostStarted::Id); +} + +event_t *create_boost_ended(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, BoostEnded::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, water_heater_management::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, water_heater_management::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = WaterHeaterManagementDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterWaterHeaterManagementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_heater_types(cluster, 0); + attribute::create_heat_demand(cluster, 0); + attribute::create_boost_state(cluster, 0); + command::create_boost(cluster); + command::create_cancel_boost(cluster); + /* Events */ + event::create_boost_started(cluster); + event::create_boost_ended(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* water_heater_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/water_heater_management/water_heater_management.h b/components/esp_matter/data_model/generated/clusters/water_heater_management/water_heater_management.h new file mode 100644 index 000000000..d332e9901 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/water_heater_management/water_heater_management.h @@ -0,0 +1,65 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace water_heater_management { + +namespace feature { +namespace energy_management { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* energy_management */ + +namespace tank_percent { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* tank_percent */ + +} /* feature */ + +namespace attribute { +attribute_t *create_heater_types(cluster_t *cluster, uint8_t value); +attribute_t *create_heat_demand(cluster_t *cluster, uint8_t value); +attribute_t *create_tank_volume(cluster_t *cluster, uint16_t value); +attribute_t *create_estimated_heat_required(cluster_t *cluster, int64_t value); +attribute_t *create_tank_percentage(cluster_t *cluster, uint8_t value); +attribute_t *create_boost_state(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_boost(cluster_t *cluster); +command_t *create_cancel_boost(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_boost_started(cluster_t *cluster); +event_t *create_boost_ended(cluster_t *cluster); +} /* event */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* water_heater_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/water_heater_management/water_heater_management_ids.h b/components/esp_matter/data_model/generated/clusters/water_heater_management/water_heater_management_ids.h new file mode 100644 index 000000000..0999bd1f1 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/water_heater_management/water_heater_management_ids.h @@ -0,0 +1,76 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace water_heater_management { + +inline constexpr uint32_t Id = 0x0094; + +namespace feature { +namespace EnergyManagement { +inline constexpr uint32_t Id = 0x1; +} /* EnergyManagement */ +namespace TankPercent { +inline constexpr uint32_t Id = 0x2; +} /* TankPercent */ +} /* feature */ + +namespace attribute { +namespace HeaterTypes { +inline constexpr uint32_t Id = 0x0000; +} /* HeaterTypes */ +namespace HeatDemand { +inline constexpr uint32_t Id = 0x0001; +} /* HeatDemand */ +namespace TankVolume { +inline constexpr uint32_t Id = 0x0002; +} /* TankVolume */ +namespace EstimatedHeatRequired { +inline constexpr uint32_t Id = 0x0003; +} /* EstimatedHeatRequired */ +namespace TankPercentage { +inline constexpr uint32_t Id = 0x0004; +} /* TankPercentage */ +namespace BoostState { +inline constexpr uint32_t Id = 0x0005; +} /* BoostState */ +} /* attribute */ + +namespace command { +namespace Boost { +inline constexpr uint32_t Id = 0x00; +} /* Boost */ +namespace CancelBoost { +inline constexpr uint32_t Id = 0x01; +} /* CancelBoost */ +} /* command */ + +namespace event { +namespace BoostStarted { +inline constexpr uint32_t Id = 0x00; +} /* BoostStarted */ +namespace BoostEnded { +inline constexpr uint32_t Id = 0x01; +} /* BoostEnded */ +} /* event */ + +} /* water_heater_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/water_heater_mode/water_heater_mode.cpp b/components/esp_matter/data_model/generated/clusters/water_heater_mode/water_heater_mode.cpp new file mode 100644 index 000000000..c63b03ade --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/water_heater_mode/water_heater_mode.cpp @@ -0,0 +1,107 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "water_heater_mode_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace water_heater_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SupportedModes::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_change_to_mode(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToMode::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_change_to_mode_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ChangeToModeResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, water_heater_mode::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, water_heater_mode::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = WaterHeaterModeDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterWaterHeaterModePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_change_to_mode(cluster); + command::create_change_to_mode_response(cluster); + } + + return cluster; +} + +} /* water_heater_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/water_heater_mode/water_heater_mode.h b/components/esp_matter/data_model/generated/clusters/water_heater_mode/water_heater_mode.h new file mode 100644 index 000000000..3073cbedd --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/water_heater_mode/water_heater_mode.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace water_heater_mode { + +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +} /* attribute */ + +namespace command { +command_t *create_change_to_mode(cluster_t *cluster); +command_t *create_change_to_mode_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* water_heater_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/water_heater_mode/water_heater_mode_ids.h b/components/esp_matter/data_model/generated/clusters/water_heater_mode/water_heater_mode_ids.h new file mode 100644 index 000000000..eff37dfb4 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/water_heater_mode/water_heater_mode_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace water_heater_mode { + +inline constexpr uint32_t Id = 0x009E; + +namespace attribute { +namespace SupportedModes { +inline constexpr uint32_t Id = 0x0000; +} /* SupportedModes */ +namespace CurrentMode { +inline constexpr uint32_t Id = 0x0001; +} /* CurrentMode */ +} /* attribute */ + +namespace command { +namespace ChangeToMode { +inline constexpr uint32_t Id = 0x00; +} /* ChangeToMode */ +namespace ChangeToModeResponse { +inline constexpr uint32_t Id = 0x01; +} /* ChangeToModeResponse */ +} /* command */ + +} /* water_heater_mode */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/water_tank_level_monitoring/water_tank_level_monitoring.cpp b/components/esp_matter/data_model/generated/clusters/water_tank_level_monitoring/water_tank_level_monitoring.cpp new file mode 100644 index 000000000..cd17ff175 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/water_tank_level_monitoring/water_tank_level_monitoring.cpp @@ -0,0 +1,187 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "water_tank_level_monitoring_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace water_tank_level_monitoring { + +namespace feature { +namespace condition { +uint32_t get_id() +{ + return Condition::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_condition(cluster, config->condition); + attribute::create_degradation_direction(cluster, config->degradation_direction); + + return ESP_OK; +} +} /* condition */ + +namespace warning { +uint32_t get_id() +{ + return Warning::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* warning */ + +namespace replacement_product_list { +uint32_t get_id() +{ + return ReplacementProductList::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_replacement_product_list(cluster, NULL, 0, 0); + + return ESP_OK; +} +} /* replacement_product_list */ + +} /* feature */ + +namespace attribute { +attribute_t *create_condition(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(condition), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, Condition::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(0), esp_matter_uint8(254)); + return attribute; +} + +attribute_t *create_degradation_direction(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(condition), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, DegradationDirection::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(1)); + return attribute; +} + +attribute_t *create_change_indication(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ChangeIndication::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(2)); + return attribute; +} + +attribute_t *create_in_place_indicator(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, InPlaceIndicator::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); +} + +attribute_t *create_last_changed_time(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, LastChangedTime::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_replacement_product_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(replacement_product_list), NULL); + return esp_matter::attribute::create(cluster, ReplacementProductList::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_reset_condition(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ResetCondition::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, water_tank_level_monitoring::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, water_tank_level_monitoring::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterWaterTankLevelMonitoringPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_change_indication(cluster, config->change_indication); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* water_tank_level_monitoring */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/water_tank_level_monitoring/water_tank_level_monitoring.h b/components/esp_matter/data_model/generated/clusters/water_tank_level_monitoring/water_tank_level_monitoring.h new file mode 100644 index 000000000..c99fe7ccc --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/water_tank_level_monitoring/water_tank_level_monitoring.h @@ -0,0 +1,69 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace water_tank_level_monitoring { + +namespace feature { +namespace condition { +typedef struct config { + uint8_t condition; + uint8_t degradation_direction; + config() : condition(0), degradation_direction(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* condition */ + +namespace warning { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* warning */ + +namespace replacement_product_list { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* replacement_product_list */ + +} /* feature */ + +namespace attribute { +attribute_t *create_condition(cluster_t *cluster, uint8_t value); +attribute_t *create_degradation_direction(cluster_t *cluster, uint8_t value); +attribute_t *create_change_indication(cluster_t *cluster, uint8_t value); +attribute_t *create_in_place_indicator(cluster_t *cluster, bool value); +attribute_t *create_last_changed_time(cluster_t *cluster, nullable value); +attribute_t *create_replacement_product_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_reset_condition(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t change_indication; + config() : change_indication(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* water_tank_level_monitoring */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/water_tank_level_monitoring/water_tank_level_monitoring_ids.h b/components/esp_matter/data_model/generated/clusters/water_tank_level_monitoring/water_tank_level_monitoring_ids.h new file mode 100644 index 000000000..c6da47ca9 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/water_tank_level_monitoring/water_tank_level_monitoring_ids.h @@ -0,0 +1,67 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace water_tank_level_monitoring { + +inline constexpr uint32_t Id = 0x0079; + +namespace feature { +namespace Condition { +inline constexpr uint32_t Id = 0x1; +} /* Condition */ +namespace Warning { +inline constexpr uint32_t Id = 0x2; +} /* Warning */ +namespace ReplacementProductList { +inline constexpr uint32_t Id = 0x4; +} /* ReplacementProductList */ +} /* feature */ + +namespace attribute { +namespace Condition { +inline constexpr uint32_t Id = 0x0000; +} /* Condition */ +namespace DegradationDirection { +inline constexpr uint32_t Id = 0x0001; +} /* DegradationDirection */ +namespace ChangeIndication { +inline constexpr uint32_t Id = 0x0002; +} /* ChangeIndication */ +namespace InPlaceIndicator { +inline constexpr uint32_t Id = 0x0003; +} /* InPlaceIndicator */ +namespace LastChangedTime { +inline constexpr uint32_t Id = 0x0004; +} /* LastChangedTime */ +namespace ReplacementProductList { +inline constexpr uint32_t Id = 0x0005; +} /* ReplacementProductList */ +} /* attribute */ + +namespace command { +namespace ResetCondition { +inline constexpr uint32_t Id = 0x00; +} /* ResetCondition */ +} /* command */ + +} /* water_tank_level_monitoring */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/webrtc_transport_provider/webrtc_transport_provider.cpp b/components/esp_matter/data_model/generated/clusters/webrtc_transport_provider/webrtc_transport_provider.cpp new file mode 100644 index 000000000..05d83d606 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/webrtc_transport_provider/webrtc_transport_provider.cpp @@ -0,0 +1,135 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "webrtc_transport_provider_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace webrtc_transport_provider { + +namespace attribute { +attribute_t *create_current_sessions(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CurrentSessions::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_solicit_offer(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SolicitOffer::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_solicit_offer_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, SolicitOfferResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_provide_offer(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ProvideOffer::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_provide_offer_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ProvideOfferResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_provide_answer(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ProvideAnswer::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_provide_ice_candidates(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ProvideICECandidates::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_end_session(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, EndSession::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, webrtc_transport_provider::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, webrtc_transport_provider::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_current_sessions(cluster, NULL, 0, 0); + command::create_solicit_offer(cluster); + command::create_solicit_offer_response(cluster); + command::create_provide_offer(cluster); + command::create_provide_offer_response(cluster); + command::create_provide_answer(cluster); + command::create_provide_ice_candidates(cluster); + command::create_end_session(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterWebRTCTransportProviderClusterServerInitCallback, + ESPMatterWebRTCTransportProviderClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* webrtc_transport_provider */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/webrtc_transport_provider/webrtc_transport_provider.h b/components/esp_matter/data_model/generated/clusters/webrtc_transport_provider/webrtc_transport_provider.h new file mode 100644 index 000000000..44dcb7cae --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/webrtc_transport_provider/webrtc_transport_provider.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace webrtc_transport_provider { + +namespace attribute { +attribute_t *create_current_sessions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_solicit_offer(cluster_t *cluster); +command_t *create_solicit_offer_response(cluster_t *cluster); +command_t *create_provide_offer(cluster_t *cluster); +command_t *create_provide_offer_response(cluster_t *cluster); +command_t *create_provide_answer(cluster_t *cluster); +command_t *create_provide_ice_candidates(cluster_t *cluster); +command_t *create_end_session(cluster_t *cluster); +} /* command */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* webrtc_transport_provider */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/webrtc_transport_provider/webrtc_transport_provider_ids.h b/components/esp_matter/data_model/generated/clusters/webrtc_transport_provider/webrtc_transport_provider_ids.h new file mode 100644 index 000000000..c1c4163e3 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/webrtc_transport_provider/webrtc_transport_provider_ids.h @@ -0,0 +1,58 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace webrtc_transport_provider { + +inline constexpr uint32_t Id = 0x0553; + +namespace attribute { +namespace CurrentSessions { +inline constexpr uint32_t Id = 0x0000; +} /* CurrentSessions */ +} /* attribute */ + +namespace command { +namespace SolicitOffer { +inline constexpr uint32_t Id = 0x00; +} /* SolicitOffer */ +namespace SolicitOfferResponse { +inline constexpr uint32_t Id = 0x01; +} /* SolicitOfferResponse */ +namespace ProvideOffer { +inline constexpr uint32_t Id = 0x02; +} /* ProvideOffer */ +namespace ProvideOfferResponse { +inline constexpr uint32_t Id = 0x03; +} /* ProvideOfferResponse */ +namespace ProvideAnswer { +inline constexpr uint32_t Id = 0x04; +} /* ProvideAnswer */ +namespace ProvideICECandidates { +inline constexpr uint32_t Id = 0x05; +} /* ProvideICECandidates */ +namespace EndSession { +inline constexpr uint32_t Id = 0x06; +} /* EndSession */ +} /* command */ + +} /* webrtc_transport_provider */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/webrtc_transport_requestor/webrtc_transport_requestor.cpp b/components/esp_matter/data_model/generated/clusters/webrtc_transport_requestor/webrtc_transport_requestor.cpp new file mode 100644 index 000000000..9bc111487 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/webrtc_transport_requestor/webrtc_transport_requestor.cpp @@ -0,0 +1,117 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "webrtc_transport_requestor_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace webrtc_transport_requestor { + +namespace attribute { +attribute_t *create_current_sessions(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CurrentSessions::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_offer(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Offer::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_answer(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Answer::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_ice_candidates(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, ICECandidates::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_end(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, End::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, webrtc_transport_requestor::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, webrtc_transport_requestor::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_current_sessions(cluster, NULL, 0, 0); + command::create_offer(cluster); + command::create_answer(cluster); + command::create_ice_candidates(cluster); + command::create_end(cluster); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterWebRTCTransportRequestorClusterServerInitCallback, + ESPMatterWebRTCTransportRequestorClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* webrtc_transport_requestor */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/webrtc_transport_requestor/webrtc_transport_requestor.h b/components/esp_matter/data_model/generated/clusters/webrtc_transport_requestor/webrtc_transport_requestor.h new file mode 100644 index 000000000..c4d014f87 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/webrtc_transport_requestor/webrtc_transport_requestor.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace webrtc_transport_requestor { + +namespace attribute { +attribute_t *create_current_sessions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_offer(cluster_t *cluster); +command_t *create_answer(cluster_t *cluster); +command_t *create_ice_candidates(cluster_t *cluster); +command_t *create_end(cluster_t *cluster); +} /* command */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* webrtc_transport_requestor */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/webrtc_transport_requestor/webrtc_transport_requestor_ids.h b/components/esp_matter/data_model/generated/clusters/webrtc_transport_requestor/webrtc_transport_requestor_ids.h new file mode 100644 index 000000000..125daf21d --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/webrtc_transport_requestor/webrtc_transport_requestor_ids.h @@ -0,0 +1,49 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace webrtc_transport_requestor { + +inline constexpr uint32_t Id = 0x0554; + +namespace attribute { +namespace CurrentSessions { +inline constexpr uint32_t Id = 0x0000; +} /* CurrentSessions */ +} /* attribute */ + +namespace command { +namespace Offer { +inline constexpr uint32_t Id = 0x00; +} /* Offer */ +namespace Answer { +inline constexpr uint32_t Id = 0x01; +} /* Answer */ +namespace ICECandidates { +inline constexpr uint32_t Id = 0x02; +} /* ICECandidates */ +namespace End { +inline constexpr uint32_t Id = 0x03; +} /* End */ +} /* command */ + +} /* webrtc_transport_requestor */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/wi_fi_network_diagnostics/wi_fi_network_diagnostics.cpp b/components/esp_matter/data_model/generated/clusters/wi_fi_network_diagnostics/wi_fi_network_diagnostics.cpp new file mode 100644 index 000000000..91070c803 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/wi_fi_network_diagnostics/wi_fi_network_diagnostics.cpp @@ -0,0 +1,256 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "wi_fi_network_diagnostics_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace wi_fi_network_diagnostics { + +namespace feature { +namespace packet_counts { +uint32_t get_id() +{ + return PacketCounts::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_beacon_rx_count(cluster, config->beacon_rx_count); + attribute::create_packet_multicast_rx_count(cluster, config->packet_multicast_rx_count); + attribute::create_packet_multicast_tx_count(cluster, config->packet_multicast_tx_count); + attribute::create_packet_unicast_rx_count(cluster, config->packet_unicast_rx_count); + attribute::create_packet_unicast_tx_count(cluster, config->packet_unicast_tx_count); + + return ESP_OK; +} +} /* packet_counts */ + +namespace error_counts { +uint32_t get_id() +{ + return ErrorCounts::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_beacon_lost_count(cluster, config->beacon_lost_count); + attribute::create_overrun_count(cluster, config->overrun_count); + command::create_reset_counts(cluster); + + return ESP_OK; +} +} /* error_counts */ + +} /* feature */ + +namespace attribute { +attribute_t *create_bssid(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, BSSID::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_octet_str(value, length)); +} + +attribute_t *create_security_type(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SecurityType::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_enum8(0), esp_matter_nullable_enum8(5)); + return attribute; +} + +attribute_t *create_wi_fi_version(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, WiFiVersion::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_enum8(0), esp_matter_nullable_enum8(6)); + return attribute; +} + +attribute_t *create_channel_number(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ChannelNumber::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_rssi(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, RSSI::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_int8(-120), esp_matter_nullable_int8(0)); + return attribute; +} + +attribute_t *create_beacon_lost_count(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(error_counts), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, BeaconLostCount::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_beacon_rx_count(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(packet_counts), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, BeaconRxCount::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_packet_multicast_rx_count(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(packet_counts), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, PacketMulticastRxCount::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_packet_multicast_tx_count(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(packet_counts), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, PacketMulticastTxCount::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_packet_unicast_rx_count(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(packet_counts), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, PacketUnicastRxCount::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_packet_unicast_tx_count(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(packet_counts), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, PacketUnicastTxCount::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(0), esp_matter_nullable_uint32(4294967294)); + return attribute; +} + +attribute_t *create_current_max_rate(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentMaxRate::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint64(0), esp_matter_nullable_uint64(4294967294)); + return attribute; +} + +attribute_t *create_overrun_count(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(error_counts), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, OverrunCount::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint64(0), esp_matter_nullable_uint64(4294967294)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_reset_counts(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(error_counts), NULL); + return esp_matter::command::create(cluster, ResetCounts::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_disconnection(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, Disconnection::Id); +} + +event_t *create_association_failure(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, AssociationFailure::Id); +} + +event_t *create_connection_status(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, ConnectionStatus::Id); +} + +} /* event */ + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, wi_fi_network_diagnostics::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, wi_fi_network_diagnostics::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterWiFiNetworkDiagnosticsPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_bssid(cluster, config->bssid, sizeof(config->bssid)); + attribute::create_security_type(cluster, config->security_type); + attribute::create_wi_fi_version(cluster, config->wi_fi_version); + attribute::create_channel_number(cluster, config->channel_number); + attribute::create_rssi(cluster, config->rssi); + + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterWiFiNetworkDiagnosticsClusterServerInitCallback, + ESPMatterWiFiNetworkDiagnosticsClusterServerShutdownCallback); + } + + return cluster; +} + +} /* wi_fi_network_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/wi_fi_network_diagnostics/wi_fi_network_diagnostics.h b/components/esp_matter/data_model/generated/clusters/wi_fi_network_diagnostics/wi_fi_network_diagnostics.h new file mode 100644 index 000000000..b8263fb4b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/wi_fi_network_diagnostics/wi_fi_network_diagnostics.h @@ -0,0 +1,90 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace wi_fi_network_diagnostics { + +const uint8_t k_max_bssid_length = 6u; +namespace feature { +namespace packet_counts { +typedef struct config { + nullable beacon_rx_count; + nullable packet_multicast_rx_count; + nullable packet_multicast_tx_count; + nullable packet_unicast_rx_count; + nullable packet_unicast_tx_count; + config() : beacon_rx_count(0), packet_multicast_rx_count(0), packet_multicast_tx_count(0), packet_unicast_rx_count(0), packet_unicast_tx_count(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* packet_counts */ + +namespace error_counts { +typedef struct config { + nullable beacon_lost_count; + nullable overrun_count; + config() : beacon_lost_count(0), overrun_count(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* error_counts */ + +} /* feature */ + +namespace attribute { +attribute_t *create_bssid(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_security_type(cluster_t *cluster, nullable value); +attribute_t *create_wi_fi_version(cluster_t *cluster, nullable value); +attribute_t *create_channel_number(cluster_t *cluster, nullable value); +attribute_t *create_rssi(cluster_t *cluster, nullable value); +attribute_t *create_beacon_lost_count(cluster_t *cluster, nullable value); +attribute_t *create_beacon_rx_count(cluster_t *cluster, nullable value); +attribute_t *create_packet_multicast_rx_count(cluster_t *cluster, nullable value); +attribute_t *create_packet_multicast_tx_count(cluster_t *cluster, nullable value); +attribute_t *create_packet_unicast_rx_count(cluster_t *cluster, nullable value); +attribute_t *create_packet_unicast_tx_count(cluster_t *cluster, nullable value); +attribute_t *create_current_max_rate(cluster_t *cluster, nullable value); +attribute_t *create_overrun_count(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_reset_counts(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_disconnection(cluster_t *cluster); +event_t *create_association_failure(cluster_t *cluster); +event_t *create_connection_status(cluster_t *cluster); +} /* event */ + +typedef struct config { + uint8_t bssid[k_max_bssid_length]; + nullable security_type; + nullable wi_fi_version; + nullable channel_number; + nullable rssi; + config() : bssid{0}, security_type(0), wi_fi_version(0), channel_number(0), rssi(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* wi_fi_network_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/wi_fi_network_diagnostics/wi_fi_network_diagnostics_ids.h b/components/esp_matter/data_model/generated/clusters/wi_fi_network_diagnostics/wi_fi_network_diagnostics_ids.h new file mode 100644 index 000000000..e730f9b9b --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/wi_fi_network_diagnostics/wi_fi_network_diagnostics_ids.h @@ -0,0 +1,97 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace wi_fi_network_diagnostics { + +inline constexpr uint32_t Id = 0x0036; + +namespace feature { +namespace PacketCounts { +inline constexpr uint32_t Id = 0x1; +} /* PacketCounts */ +namespace ErrorCounts { +inline constexpr uint32_t Id = 0x2; +} /* ErrorCounts */ +} /* feature */ + +namespace attribute { +namespace BSSID { +inline constexpr uint32_t Id = 0x0000; +} /* BSSID */ +namespace SecurityType { +inline constexpr uint32_t Id = 0x0001; +} /* SecurityType */ +namespace WiFiVersion { +inline constexpr uint32_t Id = 0x0002; +} /* WiFiVersion */ +namespace ChannelNumber { +inline constexpr uint32_t Id = 0x0003; +} /* ChannelNumber */ +namespace RSSI { +inline constexpr uint32_t Id = 0x0004; +} /* RSSI */ +namespace BeaconLostCount { +inline constexpr uint32_t Id = 0x0005; +} /* BeaconLostCount */ +namespace BeaconRxCount { +inline constexpr uint32_t Id = 0x0006; +} /* BeaconRxCount */ +namespace PacketMulticastRxCount { +inline constexpr uint32_t Id = 0x0007; +} /* PacketMulticastRxCount */ +namespace PacketMulticastTxCount { +inline constexpr uint32_t Id = 0x0008; +} /* PacketMulticastTxCount */ +namespace PacketUnicastRxCount { +inline constexpr uint32_t Id = 0x0009; +} /* PacketUnicastRxCount */ +namespace PacketUnicastTxCount { +inline constexpr uint32_t Id = 0x000A; +} /* PacketUnicastTxCount */ +namespace CurrentMaxRate { +inline constexpr uint32_t Id = 0x000B; +} /* CurrentMaxRate */ +namespace OverrunCount { +inline constexpr uint32_t Id = 0x000C; +} /* OverrunCount */ +} /* attribute */ + +namespace command { +namespace ResetCounts { +inline constexpr uint32_t Id = 0x00; +} /* ResetCounts */ +} /* command */ + +namespace event { +namespace Disconnection { +inline constexpr uint32_t Id = 0x00; +} /* Disconnection */ +namespace AssociationFailure { +inline constexpr uint32_t Id = 0x01; +} /* AssociationFailure */ +namespace ConnectionStatus { +inline constexpr uint32_t Id = 0x02; +} /* ConnectionStatus */ +} /* event */ + +} /* wi_fi_network_diagnostics */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/wi_fi_network_management/wi_fi_network_management.cpp b/components/esp_matter/data_model/generated/clusters/wi_fi_network_management/wi_fi_network_management.cpp new file mode 100644 index 000000000..260ed3e14 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/wi_fi_network_management/wi_fi_network_management.cpp @@ -0,0 +1,109 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "wi_fi_network_management_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace wi_fi_network_management { + +namespace attribute { +attribute_t *create_ssid(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + return esp_matter::attribute::create(cluster, SSID::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_octet_str(value, length)); +} + +attribute_t *create_passphrase_surrogate(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, PassphraseSurrogate::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint64(value)); +} + +} /* attribute */ +namespace command { +command_t *create_network_passphrase_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, NetworkPassphraseRequest::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_network_passphrase_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, NetworkPassphraseResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, wi_fi_network_management::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, wi_fi_network_management::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterWiFiNetworkManagementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_ssid(cluster, NULL, 0); + attribute::create_passphrase_surrogate(cluster, 0); + command::create_network_passphrase_request(cluster); + command::create_network_passphrase_response(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* wi_fi_network_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/wi_fi_network_management/wi_fi_network_management.h b/components/esp_matter/data_model/generated/clusters/wi_fi_network_management/wi_fi_network_management.h new file mode 100644 index 000000000..8b437a160 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/wi_fi_network_management/wi_fi_network_management.h @@ -0,0 +1,42 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace wi_fi_network_management { + +namespace attribute { +attribute_t *create_ssid(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_passphrase_surrogate(cluster_t *cluster, nullable value); +} /* attribute */ + +namespace command { +command_t *create_network_passphrase_request(cluster_t *cluster); +command_t *create_network_passphrase_response(cluster_t *cluster); +} /* command */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* wi_fi_network_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/wi_fi_network_management/wi_fi_network_management_ids.h b/components/esp_matter/data_model/generated/clusters/wi_fi_network_management/wi_fi_network_management_ids.h new file mode 100644 index 000000000..2575a3c12 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/wi_fi_network_management/wi_fi_network_management_ids.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace wi_fi_network_management { + +inline constexpr uint32_t Id = 0x0451; + +namespace attribute { +namespace SSID { +inline constexpr uint32_t Id = 0x0000; +} /* SSID */ +namespace PassphraseSurrogate { +inline constexpr uint32_t Id = 0x0001; +} /* PassphraseSurrogate */ +} /* attribute */ + +namespace command { +namespace NetworkPassphraseRequest { +inline constexpr uint32_t Id = 0x00; +} /* NetworkPassphraseRequest */ +namespace NetworkPassphraseResponse { +inline constexpr uint32_t Id = 0x01; +} /* NetworkPassphraseResponse */ +} /* command */ + +} /* wi_fi_network_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/window_covering/window_covering.cpp b/components/esp_matter/data_model/generated/clusters/window_covering/window_covering.cpp new file mode 100644 index 000000000..eb1c77b41 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/window_covering/window_covering.cpp @@ -0,0 +1,386 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::cluster::delegate_cb; + +static const char *TAG = "window_covering_cluster"; +constexpr uint16_t cluster_revision = 7; + +static esp_err_t esp_matter_command_callback_up_or_open(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::WindowCovering::Commands::UpOrOpen::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfWindowCoveringClusterUpOrOpenCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_down_or_close(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::WindowCovering::Commands::DownOrClose::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfWindowCoveringClusterDownOrCloseCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_stop_motion(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::WindowCovering::Commands::StopMotion::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfWindowCoveringClusterStopMotionCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_go_to_lift_percentage(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfWindowCoveringClusterGoToLiftPercentageCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_go_to_tilt_percentage(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfWindowCoveringClusterGoToTiltPercentageCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +namespace esp_matter { +namespace cluster { +namespace window_covering { + +namespace feature { +namespace lift { +uint32_t get_id() +{ + return Lift::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_target_position_lift_percent_100ths(cluster, config->target_position_lift_percent_100ths); + attribute::create_current_position_lift_percent_100ths(cluster, config->current_position_lift_percent_100ths); + command::create_go_to_lift_percentage(cluster); + + return ESP_OK; +} +} /* lift */ + +namespace tilt { +uint32_t get_id() +{ + return Tilt::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_target_position_tilt_percent_100ths(cluster, config->target_position_tilt_percent_100ths); + attribute::create_current_position_tilt_percent_100ths(cluster, config->current_position_tilt_percent_100ths); + command::create_go_to_tilt_percentage(cluster); + + return ESP_OK; +} +} /* tilt */ + +namespace position_aware_lift { +uint32_t get_id() +{ + return PositionAwareLift::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(lift), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_target_position_lift_percent_100ths(cluster, config->target_position_lift_percent_100ths); + attribute::create_current_position_lift_percent_100ths(cluster, config->current_position_lift_percent_100ths); + command::create_go_to_lift_percentage(cluster); + + return ESP_OK; +} +} /* position_aware_lift */ + +namespace position_aware_tilt { +uint32_t get_id() +{ + return PositionAwareTilt::Id; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(tilt), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_target_position_tilt_percent_100ths(cluster, config->target_position_tilt_percent_100ths); + attribute::create_current_position_tilt_percent_100ths(cluster, config->current_position_tilt_percent_100ths); + command::create_go_to_tilt_percentage(cluster); + + return ESP_OK; +} +} /* position_aware_tilt */ + +} /* feature */ + +namespace attribute { +attribute_t *create_type(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Type::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(10)); + return attribute; +} + +attribute_t *create_number_of_actuations_lift(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfActuationsLift::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_number_of_actuations_tilt(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, NumberOfActuationsTilt::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(0), esp_matter_uint16(65534)); + return attribute; +} + +attribute_t *create_config_status(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, ConfigStatus::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(127)); + return attribute; +} + +attribute_t *create_current_position_lift_percentage(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentPositionLiftPercentage::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_current_position_tilt_percentage(cluster_t *cluster, nullable value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentPositionTiltPercentage::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(0), esp_matter_nullable_uint8(254)); + return attribute; +} + +attribute_t *create_operational_status(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, OperationalStatus::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(7)); + return attribute; +} + +attribute_t *create_target_position_lift_percent_100ths(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(lift)) && (has_feature(position_aware_lift))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, TargetPositionLiftPercent100ths::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_target_position_tilt_percent_100ths(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(tilt)) && (has_feature(position_aware_tilt))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, TargetPositionTiltPercent100ths::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(65534)); + return attribute; +} + +attribute_t *create_end_product_type(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, EndProductType::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(0), esp_matter_enum8(24)); + return attribute; +} + +attribute_t *create_current_position_lift_percent_100ths(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(lift)) && (has_feature(position_aware_lift))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentPositionLiftPercent100ths::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(10000)); + return attribute; +} + +attribute_t *create_current_position_tilt_percent_100ths(cluster_t *cluster, nullable value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(tilt)) && (has_feature(position_aware_tilt))), NULL); + attribute_t *attribute = esp_matter::attribute::create(cluster, CurrentPositionTiltPercent100ths::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(0), esp_matter_nullable_uint16(10000)); + return attribute; +} + +attribute_t *create_mode(cluster_t *cluster, uint8_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, Mode::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bitmap8(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap8(0), esp_matter_bitmap8(15)); + return attribute; +} + +attribute_t *create_safety_status(cluster_t *cluster, uint16_t value) +{ + attribute_t *attribute = esp_matter::attribute::create(cluster, SafetyStatus::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap16(value)); + esp_matter::attribute::add_bounds(attribute, esp_matter_bitmap16(0), esp_matter_bitmap16(4095)); + return attribute; +} + +} /* attribute */ +namespace command { +command_t *create_up_or_open(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, UpOrOpen::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_up_or_open); +} + +command_t *create_down_or_close(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, DownOrClose::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_down_or_close); +} + +command_t *create_stop_motion(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, StopMotion::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_stop_motion); +} + +command_t *create_go_to_lift_percentage(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GoToLiftPercentage::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_go_to_lift_percentage); +} + +command_t *create_go_to_tilt_percentage(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GoToTiltPercentage::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_go_to_tilt_percentage); +} + +} /* command */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t function_list[] = { + (function_generic_t)MatterWindowCoveringClusterServerAttributeChangedCallback, +}; + +const int function_flags = CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, window_covering::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, window_covering::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + if (config->delegate != nullptr) { + static const auto delegate_init_cb = WindowCoveringDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterWindowCoveringPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_type(cluster, config->type); + attribute::create_config_status(cluster, config->config_status); + attribute::create_operational_status(cluster, config->operational_status); + attribute::create_end_product_type(cluster, config->end_product_type); + attribute::create_mode(cluster, config->mode); + + uint32_t feature_map = config->feature_flags; + VALIDATE_FEATURES_AT_LEAST_ONE("Lift,Tilt", + feature::lift::get_id(), feature::tilt::get_id()); + if (feature_map & feature::lift::get_id()) { + VerifyOrReturnValue(feature::lift::add(cluster, &(config->features.lift)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::tilt::get_id()) { + VerifyOrReturnValue(feature::tilt::add(cluster, &(config->features.tilt)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::position_aware_lift::get_id()) { + VerifyOrReturnValue(feature::position_aware_lift::add(cluster, &(config->features.position_aware_lift)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (feature_map & feature::position_aware_tilt::get_id()) { + VerifyOrReturnValue(feature::position_aware_tilt::add(cluster, &(config->features.position_aware_tilt)) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + command::create_up_or_open(cluster); + command::create_down_or_close(cluster); + command::create_stop_motion(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* window_covering */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/window_covering/window_covering.h b/components/esp_matter/data_model/generated/clusters/window_covering/window_covering.h new file mode 100644 index 000000000..e52fb8e3f --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/window_covering/window_covering.h @@ -0,0 +1,113 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace window_covering { + +namespace feature { +namespace lift { +typedef struct config { + nullable target_position_lift_percent_100ths; + nullable current_position_lift_percent_100ths; + config() : target_position_lift_percent_100ths(0), current_position_lift_percent_100ths(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* lift */ + +namespace tilt { +typedef struct config { + nullable target_position_tilt_percent_100ths; + nullable current_position_tilt_percent_100ths; + config() : target_position_tilt_percent_100ths(0), current_position_tilt_percent_100ths(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* tilt */ + +namespace position_aware_lift { +typedef struct config { + nullable target_position_lift_percent_100ths; + nullable current_position_lift_percent_100ths; + config() : target_position_lift_percent_100ths(0), current_position_lift_percent_100ths(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* position_aware_lift */ + +namespace position_aware_tilt { +typedef struct config { + nullable target_position_tilt_percent_100ths; + nullable current_position_tilt_percent_100ths; + config() : target_position_tilt_percent_100ths(0), current_position_tilt_percent_100ths(0) {} +} config_t; +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* position_aware_tilt */ + +} /* feature */ + +namespace attribute { +attribute_t *create_type(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_actuations_lift(cluster_t *cluster, uint16_t value); +attribute_t *create_number_of_actuations_tilt(cluster_t *cluster, uint16_t value); +attribute_t *create_config_status(cluster_t *cluster, uint8_t value); +attribute_t *create_current_position_lift_percentage(cluster_t *cluster, nullable value); +attribute_t *create_current_position_tilt_percentage(cluster_t *cluster, nullable value); +attribute_t *create_operational_status(cluster_t *cluster, uint8_t value); +attribute_t *create_target_position_lift_percent_100ths(cluster_t *cluster, nullable value); +attribute_t *create_target_position_tilt_percent_100ths(cluster_t *cluster, nullable value); +attribute_t *create_end_product_type(cluster_t *cluster, uint8_t value); +attribute_t *create_current_position_lift_percent_100ths(cluster_t *cluster, nullable value); +attribute_t *create_current_position_tilt_percent_100ths(cluster_t *cluster, nullable value); +attribute_t *create_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_safety_status(cluster_t *cluster, uint16_t value); +} /* attribute */ + +namespace command { +command_t *create_up_or_open(cluster_t *cluster); +command_t *create_down_or_close(cluster_t *cluster); +command_t *create_stop_motion(cluster_t *cluster); +command_t *create_go_to_lift_percentage(cluster_t *cluster); +command_t *create_go_to_tilt_percentage(cluster_t *cluster); +} /* command */ + +typedef struct config { + uint8_t type; + uint8_t config_status; + uint8_t operational_status; + uint8_t end_product_type; + uint8_t mode; + void *delegate; + struct { + feature::lift::config_t lift; + feature::tilt::config_t tilt; + feature::position_aware_lift::config_t position_aware_lift; + feature::position_aware_tilt::config_t position_aware_tilt; + } features; + uint32_t feature_flags; + config() : type(0), config_status(0), operational_status(0), end_product_type(0), mode(0), delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* window_covering */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/window_covering/window_covering_ids.h b/components/esp_matter/data_model/generated/clusters/window_covering/window_covering_ids.h new file mode 100644 index 000000000..2a8fd63eb --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/window_covering/window_covering_ids.h @@ -0,0 +1,106 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace window_covering { + +inline constexpr uint32_t Id = 0x0102; + +namespace feature { +namespace Lift { +inline constexpr uint32_t Id = 0x1; +} /* Lift */ +namespace Tilt { +inline constexpr uint32_t Id = 0x2; +} /* Tilt */ +namespace PositionAwareLift { +inline constexpr uint32_t Id = 0x4; +} /* PositionAwareLift */ +namespace PositionAwareTilt { +inline constexpr uint32_t Id = 0x10; +} /* PositionAwareTilt */ +} /* feature */ + +namespace attribute { +namespace Type { +inline constexpr uint32_t Id = 0x0000; +} /* Type */ +namespace NumberOfActuationsLift { +inline constexpr uint32_t Id = 0x0005; +} /* NumberOfActuationsLift */ +namespace NumberOfActuationsTilt { +inline constexpr uint32_t Id = 0x0006; +} /* NumberOfActuationsTilt */ +namespace ConfigStatus { +inline constexpr uint32_t Id = 0x0007; +} /* ConfigStatus */ +namespace CurrentPositionLiftPercentage { +inline constexpr uint32_t Id = 0x0008; +} /* CurrentPositionLiftPercentage */ +namespace CurrentPositionTiltPercentage { +inline constexpr uint32_t Id = 0x0009; +} /* CurrentPositionTiltPercentage */ +namespace OperationalStatus { +inline constexpr uint32_t Id = 0x000A; +} /* OperationalStatus */ +namespace TargetPositionLiftPercent100ths { +inline constexpr uint32_t Id = 0x000B; +} /* TargetPositionLiftPercent100ths */ +namespace TargetPositionTiltPercent100ths { +inline constexpr uint32_t Id = 0x000C; +} /* TargetPositionTiltPercent100ths */ +namespace EndProductType { +inline constexpr uint32_t Id = 0x000D; +} /* EndProductType */ +namespace CurrentPositionLiftPercent100ths { +inline constexpr uint32_t Id = 0x000E; +} /* CurrentPositionLiftPercent100ths */ +namespace CurrentPositionTiltPercent100ths { +inline constexpr uint32_t Id = 0x000F; +} /* CurrentPositionTiltPercent100ths */ +namespace Mode { +inline constexpr uint32_t Id = 0x0017; +} /* Mode */ +namespace SafetyStatus { +inline constexpr uint32_t Id = 0x001A; +} /* SafetyStatus */ +} /* attribute */ + +namespace command { +namespace UpOrOpen { +inline constexpr uint32_t Id = 0x00; +} /* UpOrOpen */ +namespace DownOrClose { +inline constexpr uint32_t Id = 0x01; +} /* DownOrClose */ +namespace StopMotion { +inline constexpr uint32_t Id = 0x02; +} /* StopMotion */ +namespace GoToLiftPercentage { +inline constexpr uint32_t Id = 0x05; +} /* GoToLiftPercentage */ +namespace GoToTiltPercentage { +inline constexpr uint32_t Id = 0x08; +} /* GoToTiltPercentage */ +} /* command */ + +} /* window_covering */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/zone_management/zone_management.cpp b/components/esp_matter/data_model/generated/clusters/zone_management/zone_management.cpp new file mode 100644 index 000000000..02116b13a --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/zone_management/zone_management.cpp @@ -0,0 +1,270 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; + +static const char *TAG = "zone_management_cluster"; +constexpr uint16_t cluster_revision = 1; + +namespace esp_matter { +namespace cluster { +namespace zone_management { + +namespace feature { +namespace two_dimensional_cartesian_zone { +uint32_t get_id() +{ + return TwoDimensionalCartesianZone::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_two_d_cartesian_max(cluster, NULL, 0, 0); + command::create_create_two_d_cartesian_zone(cluster); + command::create_create_two_d_cartesian_zone_response(cluster); + command::create_update_two_d_cartesian_zone(cluster); + + return ESP_OK; +} +} /* two_dimensional_cartesian_zone */ + +namespace per_zone_sensitivity { +uint32_t get_id() +{ + return PerZoneSensitivity::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(two_dimensional_cartesian_zone), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute_t *sensitivity = + esp_matter::attribute::get(cluster, attribute::Sensitivity::Id); + if (sensitivity) { + esp_matter::attribute::destroy(cluster, sensitivity); + } + + return ESP_OK; +} +} /* per_zone_sensitivity */ + +namespace user_defined { +uint32_t get_id() +{ + return UserDefined::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(two_dimensional_cartesian_zone), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + attribute::create_max_user_defined_zones(cluster, 0); + command::create_create_two_d_cartesian_zone(cluster); + command::create_create_two_d_cartesian_zone_response(cluster); + command::create_update_two_d_cartesian_zone(cluster); + command::create_remove_zone(cluster); + + return ESP_OK; +} +} /* user_defined */ + +namespace focus_zones { +uint32_t get_id() +{ + return FocusZones::Id; +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnError(has_feature(user_defined), ESP_ERR_INVALID_ARG); + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* focus_zones */ + +} /* feature */ + +namespace attribute { +attribute_t *create_max_user_defined_zones(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user_defined), NULL); + return esp_matter::attribute::create(cluster, MaxUserDefinedZones::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_max_zones(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, MaxZones::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_zones(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Zones::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_triggers(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Triggers::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +attribute_t *create_sensitivity_max(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, SensitivityMax::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_sensitivity(cluster_t *cluster, uint8_t value) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(!(has_feature(per_zone_sensitivity)), NULL); + return esp_matter::attribute::create(cluster, Sensitivity::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); +} + +attribute_t *create_two_d_cartesian_max(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(two_dimensional_cartesian_zone), NULL); + return esp_matter::attribute::create(cluster, TwoDCartesianMax::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +} /* attribute */ +namespace command { +command_t *create_create_two_d_cartesian_zone(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(two_dimensional_cartesian_zone)) && (has_feature(user_defined))), NULL); + return esp_matter::command::create(cluster, CreateTwoDCartesianZone::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_create_two_d_cartesian_zone_response(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(two_dimensional_cartesian_zone)) && (has_feature(user_defined))), NULL); + return esp_matter::command::create(cluster, CreateTwoDCartesianZoneResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_update_two_d_cartesian_zone(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(((has_feature(two_dimensional_cartesian_zone)) && (has_feature(user_defined))), NULL); + return esp_matter::command::create(cluster, UpdateTwoDCartesianZone::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_remove_zone(cluster_t *cluster) +{ + uint32_t feature_map = get_feature_map_value(cluster); + VerifyOrReturnValue(has_feature(user_defined), NULL); + return esp_matter::command::create(cluster, RemoveZone::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_create_or_update_trigger(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CreateOrUpdateTrigger::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_remove_trigger(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, RemoveTrigger::Id, COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ + +namespace event { +event_t *create_zone_triggered(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, ZoneTriggered::Id); +} + +event_t *create_zone_stopped(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, ZoneStopped::Id); +} + +} /* event */ + +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, zone_management::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, zone_management::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + static const auto plugin_server_init_cb = CALL_ONCE(MatterZoneManagementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + attribute::create_max_zones(cluster, 0); + attribute::create_zones(cluster, NULL, 0, 0); + attribute::create_triggers(cluster, NULL, 0, 0); + attribute::create_sensitivity_max(cluster, 0); + attribute::create_sensitivity(cluster, 0); + command::create_create_or_update_trigger(cluster); + command::create_remove_trigger(cluster); + /* Events */ + event::create_zone_triggered(cluster); + event::create_zone_stopped(cluster); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* zone_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/zone_management/zone_management.h b/components/esp_matter/data_model/generated/clusters/zone_management/zone_management.h new file mode 100644 index 000000000..4907e1538 --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/zone_management/zone_management.h @@ -0,0 +1,79 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace zone_management { + +namespace feature { +namespace two_dimensional_cartesian_zone { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* two_dimensional_cartesian_zone */ + +namespace per_zone_sensitivity { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* per_zone_sensitivity */ + +namespace user_defined { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* user_defined */ + +namespace focus_zones { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* focus_zones */ + +} /* feature */ + +namespace attribute { +attribute_t *create_max_user_defined_zones(cluster_t *cluster, uint8_t value); +attribute_t *create_max_zones(cluster_t *cluster, uint8_t value); +attribute_t *create_zones(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_triggers(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_sensitivity_max(cluster_t *cluster, uint8_t value); +attribute_t *create_sensitivity(cluster_t *cluster, uint8_t value); +attribute_t *create_two_d_cartesian_max(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ + +namespace command { +command_t *create_create_two_d_cartesian_zone(cluster_t *cluster); +command_t *create_create_two_d_cartesian_zone_response(cluster_t *cluster); +command_t *create_update_two_d_cartesian_zone(cluster_t *cluster); +command_t *create_remove_zone(cluster_t *cluster); +command_t *create_create_or_update_trigger(cluster_t *cluster); +command_t *create_remove_trigger(cluster_t *cluster); +} /* command */ + +namespace event { +event_t *create_zone_triggered(cluster_t *cluster); +event_t *create_zone_stopped(cluster_t *cluster); +} /* event */ + +typedef struct config { + config() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); + +} /* zone_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/clusters/zone_management/zone_management_ids.h b/components/esp_matter/data_model/generated/clusters/zone_management/zone_management_ids.h new file mode 100644 index 000000000..941f295ef --- /dev/null +++ b/components/esp_matter/data_model/generated/clusters/zone_management/zone_management_ids.h @@ -0,0 +1,97 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace zone_management { + +inline constexpr uint32_t Id = 0x0550; + +namespace feature { +namespace TwoDimensionalCartesianZone { +inline constexpr uint32_t Id = 0x1; +} /* TwoDimensionalCartesianZone */ +namespace PerZoneSensitivity { +inline constexpr uint32_t Id = 0x2; +} /* PerZoneSensitivity */ +namespace UserDefined { +inline constexpr uint32_t Id = 0x4; +} /* UserDefined */ +namespace FocusZones { +inline constexpr uint32_t Id = 0x8; +} /* FocusZones */ +} /* feature */ + +namespace attribute { +namespace MaxUserDefinedZones { +inline constexpr uint32_t Id = 0x0000; +} /* MaxUserDefinedZones */ +namespace MaxZones { +inline constexpr uint32_t Id = 0x0001; +} /* MaxZones */ +namespace Zones { +inline constexpr uint32_t Id = 0x0002; +} /* Zones */ +namespace Triggers { +inline constexpr uint32_t Id = 0x0003; +} /* Triggers */ +namespace SensitivityMax { +inline constexpr uint32_t Id = 0x0004; +} /* SensitivityMax */ +namespace Sensitivity { +inline constexpr uint32_t Id = 0x0005; +} /* Sensitivity */ +namespace TwoDCartesianMax { +inline constexpr uint32_t Id = 0x0006; +} /* TwoDCartesianMax */ +} /* attribute */ + +namespace command { +namespace CreateTwoDCartesianZone { +inline constexpr uint32_t Id = 0x00; +} /* CreateTwoDCartesianZone */ +namespace CreateTwoDCartesianZoneResponse { +inline constexpr uint32_t Id = 0x01; +} /* CreateTwoDCartesianZoneResponse */ +namespace UpdateTwoDCartesianZone { +inline constexpr uint32_t Id = 0x02; +} /* UpdateTwoDCartesianZone */ +namespace RemoveZone { +inline constexpr uint32_t Id = 0x03; +} /* RemoveZone */ +namespace CreateOrUpdateTrigger { +inline constexpr uint32_t Id = 0x04; +} /* CreateOrUpdateTrigger */ +namespace RemoveTrigger { +inline constexpr uint32_t Id = 0x05; +} /* RemoveTrigger */ +} /* command */ + +namespace event { +namespace ZoneTriggered { +inline constexpr uint32_t Id = 0x00; +} /* ZoneTriggered */ +namespace ZoneStopped { +inline constexpr uint32_t Id = 0x01; +} /* ZoneStopped */ +} /* event */ + +} /* zone_management */ +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/aggregator_device/aggregator_device.cpp b/components/esp_matter/data_model/generated/device_types/aggregator_device/aggregator_device.cpp new file mode 100644 index 000000000..35fad13e9 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/aggregator_device/aggregator_device.cpp @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace aggregator { +uint32_t get_device_type_id() +{ + return ESP_MATTER_AGGREGATOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_AGGREGATOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("aggregator", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("aggregator", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("aggregator", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + return ESP_OK; +} + +} /* aggregator */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/aggregator_device/aggregator_device.h b/components/esp_matter/data_model/generated/device_types/aggregator_device/aggregator_device.h new file mode 100644 index 000000000..b06f09d5c --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/aggregator_device/aggregator_device.h @@ -0,0 +1,41 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include + +#include + +#define ESP_MATTER_AGGREGATOR_DEVICE_TYPE_ID 0x000E +#define ESP_MATTER_AGGREGATOR_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace aggregator { + +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* aggregator */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/air_purifier_device/air_purifier_device.cpp b/components/esp_matter/data_model/generated/device_types/air_purifier_device/air_purifier_device.cpp new file mode 100644 index 000000000..6d37592ee --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/air_purifier_device/air_purifier_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace air_purifier { +uint32_t get_device_type_id() +{ + return ESP_MATTER_AIR_PURIFIER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_AIR_PURIFIER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("air_purifier", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("air_purifier", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("air_purifier", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::fan_control::create(endpoint, &(config->fan_control), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* air_purifier */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/air_purifier_device/air_purifier_device.h b/components/esp_matter/data_model/generated/device_types/air_purifier_device/air_purifier_device.h new file mode 100644 index 000000000..c161ce241 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/air_purifier_device/air_purifier_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_AIR_PURIFIER_DEVICE_TYPE_ID 0x002D +#define ESP_MATTER_AIR_PURIFIER_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace air_purifier { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::fan_control::config_t fan_control; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* air_purifier */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/air_quality_sensor_device/air_quality_sensor_device.cpp b/components/esp_matter/data_model/generated/device_types/air_quality_sensor_device/air_quality_sensor_device.cpp new file mode 100644 index 000000000..d32964973 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/air_quality_sensor_device/air_quality_sensor_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace air_quality_sensor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_AIR_QUALITY_SENSOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_AIR_QUALITY_SENSOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("air_quality_sensor", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("air_quality_sensor", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("air_quality_sensor", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::air_quality::create(endpoint, &(config->air_quality), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* air_quality_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/air_quality_sensor_device/air_quality_sensor_device.h b/components/esp_matter/data_model/generated/device_types/air_quality_sensor_device/air_quality_sensor_device.h new file mode 100644 index 000000000..8fcf933cb --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/air_quality_sensor_device/air_quality_sensor_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_AIR_QUALITY_SENSOR_DEVICE_TYPE_ID 0x002C +#define ESP_MATTER_AIR_QUALITY_SENSOR_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace air_quality_sensor { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::air_quality::config_t air_quality; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* air_quality_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/all_device_types.h b/components/esp_matter/data_model/generated/device_types/all_device_types.h new file mode 100644 index 000000000..2fc7b7cae --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/all_device_types.h @@ -0,0 +1,108 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include "aggregator_device.h" +#include "air_purifier_device.h" +#include "air_quality_sensor_device.h" +#include "audio_doorbell_device.h" +#include "basic_video_player_device.h" +#include "battery_storage_device.h" +#include "bridged_node_device.h" +#include "camera_controller_device.h" +#include "camera_device.h" +#include "casting_video_client_device.h" +#include "casting_video_player_device.h" +#include "chime_device.h" +#include "closure_controller_device.h" +#include "closure_device.h" +#include "closure_panel_device.h" +#include "color_dimmer_switch_device.h" +#include "color_temperature_light_device.h" +#include "contact_sensor_device.h" +#include "content_app_device.h" +#include "control_bridge_device.h" +#include "cook_surface_device.h" +#include "cooktop_device.h" +#include "device_energy_management_device.h" +#include "dimmable_light_device.h" +#include "dimmable_plug_in_unit_device.h" +#include "dimmer_switch_device.h" +#include "dish_washer_device.h" +#include "door_lock_controller_device.h" +#include "door_lock_device.h" +#include "doorbell_device.h" +#include "electrical_energy_tariff_device.h" +#include "electrical_meter_device.h" +#include "electrical_sensor_device.h" +#include "electrical_utility_meter_device.h" +#include "energy_evse_device.h" +#include "extended_color_light_device.h" +#include "extractor_hood_device.h" +#include "fan_device.h" +#include "floodlight_camera_device.h" +#include "flow_sensor_device.h" +#include "generic_switch_device.h" +#include "heat_pump_device.h" +#include "humidity_sensor_device.h" +#include "intercom_device.h" +#include "irrigation_system_device.h" +#include "joint_fabric_administrator_device.h" +#include "laundry_dryer_device.h" +#include "laundry_washer_device.h" +#include "light_sensor_device.h" +#include "meter_reference_point_device.h" +#include "microwave_oven_device.h" +#include "mode_select_device.h" +#include "mounted_dimmable_load_control_device.h" +#include "mounted_on_off_control_device.h" +#include "network_infrastructure_manager_device.h" +#include "occupancy_sensor_device.h" +#include "on_off_light_device.h" +#include "on_off_light_switch_device.h" +#include "on_off_plug_in_unit_device.h" +#include "on_off_sensor_device.h" +#include "ota_provider_device.h" +#include "ota_requestor_device.h" +#include "oven_device.h" +#include "power_source_device.h" +#include "pressure_sensor_device.h" +#include "pump_controller_device.h" +#include "pump_device.h" +#include "rain_sensor_device.h" +#include "refrigerator_device.h" +#include "robotic_vacuum_cleaner_device.h" +#include "room_air_conditioner_device.h" +#include "root_node_device.h" +#include "secondary_network_interface_device.h" +#include "smoke_co_alarm_device.h" +#include "snapshot_camera_device.h" +#include "soil_sensor_device.h" +#include "solar_power_device.h" +#include "speaker_device.h" +#include "temperature_controlled_cabinet_device.h" +#include "temperature_sensor_device.h" +#include "thermostat_controller_device.h" +#include "thermostat_device.h" +#include "thread_border_router_device.h" +#include "video_doorbell_device.h" +#include "video_remote_control_device.h" +#include "water_freeze_detector_device.h" +#include "water_heater_device.h" +#include "water_leak_detector_device.h" +#include "water_valve_device.h" +#include "window_covering_controller_device.h" +#include "window_covering_device.h" diff --git a/components/esp_matter/data_model/generated/device_types/audio_doorbell_device/audio_doorbell_device.cpp b/components/esp_matter/data_model/generated/device_types/audio_doorbell_device/audio_doorbell_device.cpp new file mode 100644 index 000000000..c439fde38 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/audio_doorbell_device/audio_doorbell_device.cpp @@ -0,0 +1,70 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace audio_doorbell { +uint32_t get_device_type_id() +{ + return ESP_MATTER_AUDIO_DOORBELL_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_AUDIO_DOORBELL_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("audio_doorbell", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("audio_doorbell", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("audio_doorbell", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::switch_cluster::create(endpoint, &(config->switch_cluster), CLUSTER_FLAG_SERVER); + config->camera_av_stream_management.feature_flags |= cluster::camera_av_stream_management::feature::audio::get_id(); + cluster::camera_av_stream_management::create(endpoint, &(config->camera_av_stream_management), CLUSTER_FLAG_SERVER); + cluster::webrtc_transport_provider::create(endpoint, &(config->webrtc_transport_provider), CLUSTER_FLAG_SERVER); + cluster::webrtc_transport_requestor::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::chime::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* audio_doorbell */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/audio_doorbell_device/audio_doorbell_device.h b/components/esp_matter/data_model/generated/device_types/audio_doorbell_device/audio_doorbell_device.h new file mode 100644 index 000000000..2eaceceb5 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/audio_doorbell_device/audio_doorbell_device.h @@ -0,0 +1,52 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_AUDIO_DOORBELL_DEVICE_TYPE_ID 0x0141 +#define ESP_MATTER_AUDIO_DOORBELL_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace audio_doorbell { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; + cluster::identify::config_t identify; + cluster::switch_cluster::config_t switch_cluster; + cluster::camera_av_stream_management::config_t camera_av_stream_management; + cluster::webrtc_transport_provider::config_t webrtc_transport_provider; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* audio_doorbell */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/basic_video_player_device/basic_video_player_device.cpp b/components/esp_matter/data_model/generated/device_types/basic_video_player_device/basic_video_player_device.cpp new file mode 100644 index 000000000..20c05fc66 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/basic_video_player_device/basic_video_player_device.cpp @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace basic_video_player { +uint32_t get_device_type_id() +{ + return ESP_MATTER_BASIC_VIDEO_PLAYER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_BASIC_VIDEO_PLAYER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("basic_video_player", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("basic_video_player", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("basic_video_player", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + cluster::media_playback::create(endpoint, &(config->media_playback), CLUSTER_FLAG_SERVER); + cluster::keypad_input::create(endpoint, &(config->keypad_input), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* basic_video_player */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/basic_video_player_device/basic_video_player_device.h b/components/esp_matter/data_model/generated/device_types/basic_video_player_device/basic_video_player_device.h new file mode 100644 index 000000000..78ca12cbc --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/basic_video_player_device/basic_video_player_device.h @@ -0,0 +1,47 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include + +#include + +#define ESP_MATTER_BASIC_VIDEO_PLAYER_DEVICE_TYPE_ID 0x0028 +#define ESP_MATTER_BASIC_VIDEO_PLAYER_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace basic_video_player { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::on_off::config_t on_off; + cluster::media_playback::config_t media_playback; + cluster::keypad_input::config_t keypad_input; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* basic_video_player */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/battery_storage_device/battery_storage_device.cpp b/components/esp_matter/data_model/generated/device_types/battery_storage_device/battery_storage_device.cpp new file mode 100644 index 000000000..2f12d8b4c --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/battery_storage_device/battery_storage_device.cpp @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace battery_storage { +uint32_t get_device_type_id() +{ + return ESP_MATTER_BATTERY_STORAGE_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_BATTERY_STORAGE_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("battery_storage", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("battery_storage", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("battery_storage", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + return ESP_OK; +} + +} /* battery_storage */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/battery_storage_device/battery_storage_device.h b/components/esp_matter/data_model/generated/device_types/battery_storage_device/battery_storage_device.h new file mode 100644 index 000000000..07d5e015a --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/battery_storage_device/battery_storage_device.h @@ -0,0 +1,41 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include + +#include + +#define ESP_MATTER_BATTERY_STORAGE_DEVICE_TYPE_ID 0x0018 +#define ESP_MATTER_BATTERY_STORAGE_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace battery_storage { + +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* battery_storage */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/bridged_node_device/bridged_node_device.cpp b/components/esp_matter/data_model/generated/device_types/bridged_node_device/bridged_node_device.cpp new file mode 100644 index 000000000..9e13d4a12 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/bridged_node_device/bridged_node_device.cpp @@ -0,0 +1,74 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace bridged_node { +uint32_t get_device_type_id() +{ + return ESP_MATTER_BRIDGED_NODE_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_BRIDGED_NODE_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("bridged_node", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("bridged_node", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("bridged_node", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::bridged_device_basic_information::create(endpoint, &(config->bridged_device_basic_information), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +endpoint_t *resume(node_t *node, config_t *config, uint8_t flags, uint16_t endpoint_id, void *priv_data) +{ + esp_matter::endpoint_t *endpoint = esp_matter::endpoint::resume(node, flags | ENDPOINT_FLAG_DESTROYABLE, endpoint_id, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("bridged_node", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("bridged_node", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(ESP_OK == add(endpoint, config), NULL, ESP_LOGE("bridged_node", "Failed to add cluster")); + return endpoint; +} + +} /* bridged_node */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/bridged_node_device/bridged_node_device.h b/components/esp_matter/data_model/generated/device_types/bridged_node_device/bridged_node_device.h new file mode 100644 index 000000000..2fb215882 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/bridged_node_device/bridged_node_device.h @@ -0,0 +1,44 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_BRIDGED_NODE_DEVICE_TYPE_ID 0x0013 +#define ESP_MATTER_BRIDGED_NODE_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace bridged_node { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::bridged_device_basic_information::config_t bridged_device_basic_information; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +endpoint_t *resume(node_t *node, config_t *config, uint8_t flags, uint16_t endpoint_id, void *priv_data); +} /* bridged_node */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/camera_controller_device/camera_controller_device.cpp b/components/esp_matter/data_model/generated/device_types/camera_controller_device/camera_controller_device.cpp new file mode 100644 index 000000000..db60d41af --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/camera_controller_device/camera_controller_device.cpp @@ -0,0 +1,65 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace camera_controller { +uint32_t get_device_type_id() +{ + return ESP_MATTER_CAMERA_CONTROLLER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_CAMERA_CONTROLLER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("camera_controller", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("camera_controller", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("camera_controller", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::webrtc_transport_provider::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::webrtc_transport_requestor::create(endpoint, &(config->webrtc_transport_requestor), CLUSTER_FLAG_SERVER); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* camera_controller */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/camera_controller_device/camera_controller_device.h b/components/esp_matter/data_model/generated/device_types/camera_controller_device/camera_controller_device.h new file mode 100644 index 000000000..829d7cea5 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/camera_controller_device/camera_controller_device.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include + +#include + +#define ESP_MATTER_CAMERA_CONTROLLER_DEVICE_TYPE_ID 0x0147 +#define ESP_MATTER_CAMERA_CONTROLLER_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace camera_controller { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; + cluster::webrtc_transport_requestor::config_t webrtc_transport_requestor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* camera_controller */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/camera_device/camera_device.cpp b/components/esp_matter/data_model/generated/device_types/camera_device/camera_device.cpp new file mode 100644 index 000000000..0292bfc15 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/camera_device/camera_device.cpp @@ -0,0 +1,67 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace camera { +uint32_t get_device_type_id() +{ + return ESP_MATTER_CAMERA_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_CAMERA_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("camera", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("camera", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("camera", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + config->camera_av_stream_management.feature_flags |= cluster::camera_av_stream_management::feature::audio::get_id() | cluster::camera_av_stream_management::feature::video::get_id() | cluster::camera_av_stream_management::feature::snapshot::get_id(); + cluster::camera_av_stream_management::create(endpoint, &(config->camera_av_stream_management), CLUSTER_FLAG_SERVER); + cluster::webrtc_transport_provider::create(endpoint, &(config->webrtc_transport_provider), CLUSTER_FLAG_SERVER); + cluster::webrtc_transport_requestor::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* camera */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/camera_device/camera_device.h b/components/esp_matter/data_model/generated/device_types/camera_device/camera_device.h new file mode 100644 index 000000000..b74391f74 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/camera_device/camera_device.h @@ -0,0 +1,47 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include + +#include + +#define ESP_MATTER_CAMERA_DEVICE_TYPE_ID 0x0142 +#define ESP_MATTER_CAMERA_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace camera { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; + cluster::camera_av_stream_management::config_t camera_av_stream_management; + cluster::webrtc_transport_provider::config_t webrtc_transport_provider; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* camera */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/casting_video_client_device/casting_video_client_device.cpp b/components/esp_matter/data_model/generated/device_types/casting_video_client_device/casting_video_client_device.cpp new file mode 100644 index 000000000..05ee476e1 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/casting_video_client_device/casting_video_client_device.cpp @@ -0,0 +1,67 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace casting_video_client { +uint32_t get_device_type_id() +{ + return ESP_MATTER_CASTING_VIDEO_CLIENT_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_CASTING_VIDEO_CLIENT_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("casting_video_client", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("casting_video_client", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("casting_video_client", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::on_off::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::keypad_input::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::content_launcher::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::application_basic::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* casting_video_client */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/casting_video_client_device/casting_video_client_device.h b/components/esp_matter/data_model/generated/device_types/casting_video_client_device/casting_video_client_device.h new file mode 100644 index 000000000..3ec752773 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/casting_video_client_device/casting_video_client_device.h @@ -0,0 +1,47 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_CASTING_VIDEO_CLIENT_DEVICE_TYPE_ID 0x0029 +#define ESP_MATTER_CASTING_VIDEO_CLIENT_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace casting_video_client { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* casting_video_client */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/casting_video_player_device/casting_video_player_device.cpp b/components/esp_matter/data_model/generated/device_types/casting_video_player_device/casting_video_player_device.cpp new file mode 100644 index 000000000..2f97f691b --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/casting_video_player_device/casting_video_player_device.cpp @@ -0,0 +1,65 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace casting_video_player { +uint32_t get_device_type_id() +{ + return ESP_MATTER_CASTING_VIDEO_PLAYER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_CASTING_VIDEO_PLAYER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("casting_video_player", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("casting_video_player", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("casting_video_player", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + cluster::media_playback::create(endpoint, &(config->media_playback), CLUSTER_FLAG_SERVER); + cluster::keypad_input::create(endpoint, &(config->keypad_input), CLUSTER_FLAG_SERVER); + cluster::content_launcher::create(endpoint, &(config->content_launcher), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* casting_video_player */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/casting_video_player_device/casting_video_player_device.h b/components/esp_matter/data_model/generated/device_types/casting_video_player_device/casting_video_player_device.h new file mode 100644 index 000000000..8c489c19c --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/casting_video_player_device/casting_video_player_device.h @@ -0,0 +1,49 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_CASTING_VIDEO_PLAYER_DEVICE_TYPE_ID 0x0023 +#define ESP_MATTER_CASTING_VIDEO_PLAYER_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace casting_video_player { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::on_off::config_t on_off; + cluster::media_playback::config_t media_playback; + cluster::keypad_input::config_t keypad_input; + cluster::content_launcher::config_t content_launcher; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* casting_video_player */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/chime_device/chime_device.cpp b/components/esp_matter/data_model/generated/device_types/chime_device/chime_device.cpp new file mode 100644 index 000000000..fd790b50c --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/chime_device/chime_device.cpp @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace chime { +uint32_t get_device_type_id() +{ + return ESP_MATTER_CHIME_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_CHIME_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("chime", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("chime", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("chime", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::chime::create(endpoint, &(config->chime), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* chime */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/chime_device/chime_device.h b/components/esp_matter/data_model/generated/device_types/chime_device/chime_device.h new file mode 100644 index 000000000..b9ace443f --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/chime_device/chime_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_CHIME_DEVICE_TYPE_ID 0x0146 +#define ESP_MATTER_CHIME_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace chime { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::chime::config_t chime; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* chime */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/closure_controller_device/closure_controller_device.cpp b/components/esp_matter/data_model/generated/device_types/closure_controller_device/closure_controller_device.cpp new file mode 100644 index 000000000..a28e7b8d2 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/closure_controller_device/closure_controller_device.cpp @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace closure_controller { +uint32_t get_device_type_id() +{ + return ESP_MATTER_CLOSURE_CONTROLLER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_CLOSURE_CONTROLLER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("closure_controller", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("closure_controller", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("closure_controller", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::closure_control::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* closure_controller */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/closure_controller_device/closure_controller_device.h b/components/esp_matter/data_model/generated/device_types/closure_controller_device/closure_controller_device.h new file mode 100644 index 000000000..d4a81379f --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/closure_controller_device/closure_controller_device.h @@ -0,0 +1,44 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_CLOSURE_CONTROLLER_DEVICE_TYPE_ID 0x023E +#define ESP_MATTER_CLOSURE_CONTROLLER_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace closure_controller { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* closure_controller */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/closure_device/closure_device.cpp b/components/esp_matter/data_model/generated/device_types/closure_device/closure_device.cpp new file mode 100644 index 000000000..1496a58a7 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/closure_device/closure_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace closure { +uint32_t get_device_type_id() +{ + return ESP_MATTER_CLOSURE_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_CLOSURE_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("closure", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("closure", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("closure", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::closure_control::create(endpoint, &(config->closure_control), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* closure */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/closure_device/closure_device.h b/components/esp_matter/data_model/generated/device_types/closure_device/closure_device.h new file mode 100644 index 000000000..245b01570 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/closure_device/closure_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_CLOSURE_DEVICE_TYPE_ID 0x0230 +#define ESP_MATTER_CLOSURE_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace closure { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::closure_control::config_t closure_control; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* closure */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/closure_panel_device/closure_panel_device.cpp b/components/esp_matter/data_model/generated/device_types/closure_panel_device/closure_panel_device.cpp new file mode 100644 index 000000000..9489e3d71 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/closure_panel_device/closure_panel_device.cpp @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace closure_panel { +uint32_t get_device_type_id() +{ + return ESP_MATTER_CLOSURE_PANEL_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_CLOSURE_PANEL_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("closure_panel", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("closure_panel", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("closure_panel", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::closure_dimension::create(endpoint, &(config->closure_dimension), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* closure_panel */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/closure_panel_device/closure_panel_device.h b/components/esp_matter/data_model/generated/device_types/closure_panel_device/closure_panel_device.h new file mode 100644 index 000000000..eac3b0c95 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/closure_panel_device/closure_panel_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_CLOSURE_PANEL_DEVICE_TYPE_ID 0x0231 +#define ESP_MATTER_CLOSURE_PANEL_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace closure_panel { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::closure_dimension::config_t closure_dimension; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* closure_panel */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/color_dimmer_switch_device/color_dimmer_switch_device.cpp b/components/esp_matter/data_model/generated/device_types/color_dimmer_switch_device/color_dimmer_switch_device.cpp new file mode 100644 index 000000000..c305758a2 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/color_dimmer_switch_device/color_dimmer_switch_device.cpp @@ -0,0 +1,68 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace color_dimmer_switch { +uint32_t get_device_type_id() +{ + return ESP_MATTER_COLOR_DIMMER_SWITCH_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_COLOR_DIMMER_SWITCH_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("color_dimmer_switch", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("color_dimmer_switch", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("color_dimmer_switch", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::identify::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::on_off::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::level_control::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::color_control::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* color_dimmer_switch */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/color_dimmer_switch_device/color_dimmer_switch_device.h b/components/esp_matter/data_model/generated/device_types/color_dimmer_switch_device/color_dimmer_switch_device.h new file mode 100644 index 000000000..ed3a1f720 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/color_dimmer_switch_device/color_dimmer_switch_device.h @@ -0,0 +1,48 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_COLOR_DIMMER_SWITCH_DEVICE_TYPE_ID 0x0105 +#define ESP_MATTER_COLOR_DIMMER_SWITCH_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace color_dimmer_switch { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; + cluster::identify::config_t identify; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* color_dimmer_switch */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/color_temperature_light_device/color_temperature_light_device.cpp b/components/esp_matter/data_model/generated/device_types/color_temperature_light_device/color_temperature_light_device.cpp new file mode 100644 index 000000000..5e3f17572 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/color_temperature_light_device/color_temperature_light_device.cpp @@ -0,0 +1,79 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace color_temperature_light { +uint32_t get_device_type_id() +{ + return ESP_MATTER_COLOR_TEMPERATURE_LIGHT_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_COLOR_TEMPERATURE_LIGHT_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("color_temperature_light", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("color_temperature_light", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("color_temperature_light", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster_t *identify = cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(identify != NULL, ESP_FAIL, ESP_LOGE("color_temperature_light", "Failed to create cluster: identify")); + cluster::identify::command::create_trigger_effect(identify); + cluster::groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); + cluster_t *on_off = cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(on_off != NULL, ESP_FAIL, ESP_LOGE("color_temperature_light", "Failed to create cluster: on_off")); + cluster::on_off::feature::lighting::add(on_off, &(config->on_off_lighting)); + cluster_t *level_control = cluster::level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(level_control != NULL, ESP_FAIL, ESP_LOGE("color_temperature_light", "Failed to create cluster: level_control")); + cluster::level_control::feature::on_off::add(level_control); + cluster::level_control::feature::lighting::add(level_control, &(config->level_control_lighting)); + cluster_t *scenes_management = cluster::scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(scenes_management != NULL, ESP_FAIL, ESP_LOGE("color_temperature_light", "Failed to create cluster: scenes_management")); + cluster::scenes_management::command::create_copy_scene(scenes_management); + cluster_t *color_control = cluster::color_control::create(endpoint, &(config->color_control), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(color_control != NULL, ESP_FAIL, ESP_LOGE("color_temperature_light", "Failed to create cluster: color_control")); + cluster::color_control::attribute::create_remaining_time(color_control, config->remaining_time); + cluster::color_control::feature::color_temperature::add(color_control, &(config->color_control_color_temperature)); + return ESP_OK; +} + +} /* color_temperature_light */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/color_temperature_light_device/color_temperature_light_device.h b/components/esp_matter/data_model/generated/device_types/color_temperature_light_device/color_temperature_light_device.h new file mode 100644 index 000000000..d3e870593 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/color_temperature_light_device/color_temperature_light_device.h @@ -0,0 +1,58 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_COLOR_TEMPERATURE_LIGHT_DEVICE_TYPE_ID 0x010C +#define ESP_MATTER_COLOR_TEMPERATURE_LIGHT_DEVICE_TYPE_VERSION 4 + +namespace esp_matter { +namespace endpoint { +namespace color_temperature_light { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::groups::config_t groups; + cluster::on_off::config_t on_off; + cluster::on_off::feature::lighting::config_t on_off_lighting; + cluster::level_control::config_t level_control; + cluster::level_control::feature::lighting::config_t level_control_lighting; + cluster::scenes_management::config_t scenes_management; + cluster::color_control::config_t color_control; + uint16_t remaining_time; + cluster::color_control::feature::color_temperature::config_t color_control_color_temperature; + config() : remaining_time(0) {} +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* color_temperature_light */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/contact_sensor_device/contact_sensor_device.cpp b/components/esp_matter/data_model/generated/device_types/contact_sensor_device/contact_sensor_device.cpp new file mode 100644 index 000000000..0c81f5d34 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/contact_sensor_device/contact_sensor_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace contact_sensor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_CONTACT_SENSOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_CONTACT_SENSOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("contact_sensor", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("contact_sensor", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("contact_sensor", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::boolean_state::create(endpoint, &(config->boolean_state), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* contact_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/contact_sensor_device/contact_sensor_device.h b/components/esp_matter/data_model/generated/device_types/contact_sensor_device/contact_sensor_device.h new file mode 100644 index 000000000..b001d1264 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/contact_sensor_device/contact_sensor_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_CONTACT_SENSOR_DEVICE_TYPE_ID 0x0015 +#define ESP_MATTER_CONTACT_SENSOR_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace contact_sensor { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::boolean_state::config_t boolean_state; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* contact_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/content_app_device/content_app_device.cpp b/components/esp_matter/data_model/generated/device_types/content_app_device/content_app_device.cpp new file mode 100644 index 000000000..f5db7cd2c --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/content_app_device/content_app_device.cpp @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace content_app { +uint32_t get_device_type_id() +{ + return ESP_MATTER_CONTENT_APP_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_CONTENT_APP_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("content_app", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("content_app", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("content_app", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::keypad_input::create(endpoint, &(config->keypad_input), CLUSTER_FLAG_SERVER); + cluster::application_launcher::create(endpoint, &(config->application_launcher), CLUSTER_FLAG_SERVER); + cluster::application_basic::create(endpoint, &(config->application_basic), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* content_app */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/content_app_device/content_app_device.h b/components/esp_matter/data_model/generated/device_types/content_app_device/content_app_device.h new file mode 100644 index 000000000..b40f49bbb --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/content_app_device/content_app_device.h @@ -0,0 +1,47 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include + +#include + +#define ESP_MATTER_CONTENT_APP_DEVICE_TYPE_ID 0x0024 +#define ESP_MATTER_CONTENT_APP_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace content_app { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::keypad_input::config_t keypad_input; + cluster::application_launcher::config_t application_launcher; + cluster::application_basic::config_t application_basic; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* content_app */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/control_bridge_device/control_bridge_device.cpp b/components/esp_matter/data_model/generated/device_types/control_bridge_device/control_bridge_device.cpp new file mode 100644 index 000000000..1c3c473de --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/control_bridge_device/control_bridge_device.cpp @@ -0,0 +1,70 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace control_bridge { +uint32_t get_device_type_id() +{ + return ESP_MATTER_CONTROL_BRIDGE_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_CONTROL_BRIDGE_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("control_bridge", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("control_bridge", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("control_bridge", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::identify::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::groups::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::on_off::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::level_control::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::scenes_management::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::color_control::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* control_bridge */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/control_bridge_device/control_bridge_device.h b/components/esp_matter/data_model/generated/device_types/control_bridge_device/control_bridge_device.h new file mode 100644 index 000000000..2559f9a09 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/control_bridge_device/control_bridge_device.h @@ -0,0 +1,50 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_CONTROL_BRIDGE_DEVICE_TYPE_ID 0x0840 +#define ESP_MATTER_CONTROL_BRIDGE_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace control_bridge { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; + cluster::identify::config_t identify; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* control_bridge */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/cook_surface_device/cook_surface_device.cpp b/components/esp_matter/data_model/generated/device_types/cook_surface_device/cook_surface_device.cpp new file mode 100644 index 000000000..ea9714c21 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/cook_surface_device/cook_surface_device.cpp @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace cook_surface { +uint32_t get_device_type_id() +{ + return ESP_MATTER_COOK_SURFACE_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_COOK_SURFACE_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("cook_surface", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("cook_surface", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("cook_surface", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + return ESP_OK; +} + +} /* cook_surface */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/cook_surface_device/cook_surface_device.h b/components/esp_matter/data_model/generated/device_types/cook_surface_device/cook_surface_device.h new file mode 100644 index 000000000..86d75b221 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/cook_surface_device/cook_surface_device.h @@ -0,0 +1,41 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include + +#include + +#define ESP_MATTER_COOK_SURFACE_DEVICE_TYPE_ID 0x0077 +#define ESP_MATTER_COOK_SURFACE_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace cook_surface { + +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* cook_surface */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/cooktop_device/cooktop_device.cpp b/components/esp_matter/data_model/generated/device_types/cooktop_device/cooktop_device.cpp new file mode 100644 index 000000000..0a0f88be4 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/cooktop_device/cooktop_device.cpp @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace cooktop { +uint32_t get_device_type_id() +{ + return ESP_MATTER_COOKTOP_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_COOKTOP_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("cooktop", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("cooktop", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("cooktop", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster_t *on_off = cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(on_off != NULL, ESP_FAIL, ESP_LOGE("cooktop", "Failed to create cluster: on_off")); + cluster::on_off::feature::off_only::add(on_off); + return ESP_OK; +} + +} /* cooktop */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/cooktop_device/cooktop_device.h b/components/esp_matter/data_model/generated/device_types/cooktop_device/cooktop_device.h new file mode 100644 index 000000000..5eecddda8 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/cooktop_device/cooktop_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_COOKTOP_DEVICE_TYPE_ID 0x0078 +#define ESP_MATTER_COOKTOP_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace cooktop { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::on_off::config_t on_off; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* cooktop */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/device_energy_management_device/device_energy_management_device.cpp b/components/esp_matter/data_model/generated/device_types/device_energy_management_device/device_energy_management_device.cpp new file mode 100644 index 000000000..6ff0485bc --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/device_energy_management_device/device_energy_management_device.cpp @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace device_energy_management { +uint32_t get_device_type_id() +{ + return ESP_MATTER_DEVICE_ENERGY_MANAGEMENT_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_DEVICE_ENERGY_MANAGEMENT_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("device_energy_management", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("device_energy_management", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("device_energy_management", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::device_energy_management::create(endpoint, &(config->device_energy_management), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* device_energy_management */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/device_energy_management_device/device_energy_management_device.h b/components/esp_matter/data_model/generated/device_types/device_energy_management_device/device_energy_management_device.h new file mode 100644 index 000000000..b9dfc33b0 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/device_energy_management_device/device_energy_management_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_DEVICE_ENERGY_MANAGEMENT_DEVICE_TYPE_ID 0x050D +#define ESP_MATTER_DEVICE_ENERGY_MANAGEMENT_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace device_energy_management { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::device_energy_management::config_t device_energy_management; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* device_energy_management */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/dimmable_light_device/dimmable_light_device.cpp b/components/esp_matter/data_model/generated/device_types/dimmable_light_device/dimmable_light_device.cpp new file mode 100644 index 000000000..e6a7d6d54 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/dimmable_light_device/dimmable_light_device.cpp @@ -0,0 +1,75 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace dimmable_light { +uint32_t get_device_type_id() +{ + return ESP_MATTER_DIMMABLE_LIGHT_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_DIMMABLE_LIGHT_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("dimmable_light", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("dimmable_light", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("dimmable_light", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster_t *identify = cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(identify != NULL, ESP_FAIL, ESP_LOGE("dimmable_light", "Failed to create cluster: identify")); + cluster::identify::command::create_trigger_effect(identify); + cluster::groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); + cluster_t *on_off = cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(on_off != NULL, ESP_FAIL, ESP_LOGE("dimmable_light", "Failed to create cluster: on_off")); + cluster::on_off::feature::lighting::add(on_off, &(config->on_off_lighting)); + cluster_t *level_control = cluster::level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(level_control != NULL, ESP_FAIL, ESP_LOGE("dimmable_light", "Failed to create cluster: level_control")); + cluster::level_control::feature::on_off::add(level_control); + cluster::level_control::feature::lighting::add(level_control, &(config->level_control_lighting)); + cluster_t *scenes_management = cluster::scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(scenes_management != NULL, ESP_FAIL, ESP_LOGE("dimmable_light", "Failed to create cluster: scenes_management")); + cluster::scenes_management::command::create_copy_scene(scenes_management); + return ESP_OK; +} + +} /* dimmable_light */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/dimmable_light_device/dimmable_light_device.h b/components/esp_matter/data_model/generated/device_types/dimmable_light_device/dimmable_light_device.h new file mode 100644 index 000000000..f441b564e --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/dimmable_light_device/dimmable_light_device.h @@ -0,0 +1,53 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_DIMMABLE_LIGHT_DEVICE_TYPE_ID 0x0101 +#define ESP_MATTER_DIMMABLE_LIGHT_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace dimmable_light { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::groups::config_t groups; + cluster::on_off::config_t on_off; + cluster::on_off::feature::lighting::config_t on_off_lighting; + cluster::level_control::config_t level_control; + cluster::level_control::feature::lighting::config_t level_control_lighting; + cluster::scenes_management::config_t scenes_management; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* dimmable_light */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/dimmable_plug_in_unit_device/dimmable_plug_in_unit_device.cpp b/components/esp_matter/data_model/generated/device_types/dimmable_plug_in_unit_device/dimmable_plug_in_unit_device.cpp new file mode 100644 index 000000000..831da5449 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/dimmable_plug_in_unit_device/dimmable_plug_in_unit_device.cpp @@ -0,0 +1,75 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace dimmable_plug_in_unit { +uint32_t get_device_type_id() +{ + return ESP_MATTER_DIMMABLE_PLUG_IN_UNIT_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_DIMMABLE_PLUG_IN_UNIT_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("dimmable_plug_in_unit", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("dimmable_plug_in_unit", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("dimmable_plug_in_unit", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster_t *identify = cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(identify != NULL, ESP_FAIL, ESP_LOGE("dimmable_plug_in_unit", "Failed to create cluster: identify")); + cluster::identify::command::create_trigger_effect(identify); + cluster::groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); + cluster_t *on_off = cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(on_off != NULL, ESP_FAIL, ESP_LOGE("dimmable_plug_in_unit", "Failed to create cluster: on_off")); + cluster::on_off::feature::lighting::add(on_off, &(config->on_off_lighting)); + cluster_t *level_control = cluster::level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(level_control != NULL, ESP_FAIL, ESP_LOGE("dimmable_plug_in_unit", "Failed to create cluster: level_control")); + cluster::level_control::feature::on_off::add(level_control); + cluster::level_control::feature::lighting::add(level_control, &(config->level_control_lighting)); + cluster_t *scenes_management = cluster::scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(scenes_management != NULL, ESP_FAIL, ESP_LOGE("dimmable_plug_in_unit", "Failed to create cluster: scenes_management")); + cluster::scenes_management::command::create_copy_scene(scenes_management); + return ESP_OK; +} + +} /* dimmable_plug_in_unit */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/dimmable_plug_in_unit_device/dimmable_plug_in_unit_device.h b/components/esp_matter/data_model/generated/device_types/dimmable_plug_in_unit_device/dimmable_plug_in_unit_device.h new file mode 100644 index 000000000..fd8250668 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/dimmable_plug_in_unit_device/dimmable_plug_in_unit_device.h @@ -0,0 +1,53 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_DIMMABLE_PLUG_IN_UNIT_DEVICE_TYPE_ID 0x010B +#define ESP_MATTER_DIMMABLE_PLUG_IN_UNIT_DEVICE_TYPE_VERSION 5 + +namespace esp_matter { +namespace endpoint { +namespace dimmable_plug_in_unit { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::groups::config_t groups; + cluster::on_off::config_t on_off; + cluster::on_off::feature::lighting::config_t on_off_lighting; + cluster::level_control::config_t level_control; + cluster::level_control::feature::lighting::config_t level_control_lighting; + cluster::scenes_management::config_t scenes_management; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* dimmable_plug_in_unit */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/dimmer_switch_device/dimmer_switch_device.cpp b/components/esp_matter/data_model/generated/device_types/dimmer_switch_device/dimmer_switch_device.cpp new file mode 100644 index 000000000..6ffa842a5 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/dimmer_switch_device/dimmer_switch_device.cpp @@ -0,0 +1,67 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace dimmer_switch { +uint32_t get_device_type_id() +{ + return ESP_MATTER_DIMMER_SWITCH_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_DIMMER_SWITCH_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("dimmer_switch", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("dimmer_switch", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("dimmer_switch", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::identify::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::on_off::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::level_control::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* dimmer_switch */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/dimmer_switch_device/dimmer_switch_device.h b/components/esp_matter/data_model/generated/device_types/dimmer_switch_device/dimmer_switch_device.h new file mode 100644 index 000000000..f6accdf60 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/dimmer_switch_device/dimmer_switch_device.h @@ -0,0 +1,47 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_DIMMER_SWITCH_DEVICE_TYPE_ID 0x0104 +#define ESP_MATTER_DIMMER_SWITCH_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace dimmer_switch { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; + cluster::identify::config_t identify; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* dimmer_switch */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/dish_washer_device/dish_washer_device.cpp b/components/esp_matter/data_model/generated/device_types/dish_washer_device/dish_washer_device.cpp new file mode 100644 index 000000000..d1425aacb --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/dish_washer_device/dish_washer_device.cpp @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace dish_washer { +uint32_t get_device_type_id() +{ + return ESP_MATTER_DISH_WASHER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_DISH_WASHER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("dish_washer", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("dish_washer", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("dish_washer", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster_t *operational_state = cluster::operational_state::create(endpoint, &(config->operational_state), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(operational_state != NULL, ESP_FAIL, ESP_LOGE("dish_washer", "Failed to create cluster: operational_state")); + cluster::operational_state::event::create_operation_completion(operational_state); + return ESP_OK; +} + +} /* dish_washer */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/dish_washer_device/dish_washer_device.h b/components/esp_matter/data_model/generated/device_types/dish_washer_device/dish_washer_device.h new file mode 100644 index 000000000..4f878fad6 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/dish_washer_device/dish_washer_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_DISH_WASHER_DEVICE_TYPE_ID 0x0075 +#define ESP_MATTER_DISH_WASHER_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace dish_washer { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::operational_state::config_t operational_state; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* dish_washer */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/door_lock_controller_device/door_lock_controller_device.cpp b/components/esp_matter/data_model/generated/device_types/door_lock_controller_device/door_lock_controller_device.cpp new file mode 100644 index 000000000..ab5675a6f --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/door_lock_controller_device/door_lock_controller_device.cpp @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace door_lock_controller { +uint32_t get_device_type_id() +{ + return ESP_MATTER_DOOR_LOCK_CONTROLLER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_DOOR_LOCK_CONTROLLER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("door_lock_controller", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("door_lock_controller", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("door_lock_controller", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::door_lock::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* door_lock_controller */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/door_lock_controller_device/door_lock_controller_device.h b/components/esp_matter/data_model/generated/device_types/door_lock_controller_device/door_lock_controller_device.h new file mode 100644 index 000000000..ac0fc15fc --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/door_lock_controller_device/door_lock_controller_device.h @@ -0,0 +1,44 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_DOOR_LOCK_CONTROLLER_DEVICE_TYPE_ID 0x000B +#define ESP_MATTER_DOOR_LOCK_CONTROLLER_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace door_lock_controller { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* door_lock_controller */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/door_lock_device/door_lock_device.cpp b/components/esp_matter/data_model/generated/device_types/door_lock_device/door_lock_device.cpp new file mode 100644 index 000000000..5cc7f0b53 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/door_lock_device/door_lock_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace door_lock { +uint32_t get_device_type_id() +{ + return ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("door_lock", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("door_lock", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("door_lock", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::door_lock::create(endpoint, &(config->door_lock), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* door_lock */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/door_lock_device/door_lock_device.h b/components/esp_matter/data_model/generated/device_types/door_lock_device/door_lock_device.h new file mode 100644 index 000000000..1c5faa3a3 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/door_lock_device/door_lock_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_ID 0x000A +#define ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace door_lock { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::door_lock::config_t door_lock; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* door_lock */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/doorbell_device/doorbell_device.cpp b/components/esp_matter/data_model/generated/device_types/doorbell_device/doorbell_device.cpp new file mode 100644 index 000000000..843963f1f --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/doorbell_device/doorbell_device.cpp @@ -0,0 +1,67 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace doorbell { +uint32_t get_device_type_id() +{ + return ESP_MATTER_DOORBELL_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_DOORBELL_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("doorbell", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("doorbell", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("doorbell", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + config->switch_cluster.feature_flags |= cluster::switch_cluster::feature::momentary_switch::get_id(); + cluster::switch_cluster::create(endpoint, &(config->switch_cluster), CLUSTER_FLAG_SERVER); + cluster::chime::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* doorbell */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/doorbell_device/doorbell_device.h b/components/esp_matter/data_model/generated/device_types/doorbell_device/doorbell_device.h new file mode 100644 index 000000000..3c90c20b5 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/doorbell_device/doorbell_device.h @@ -0,0 +1,48 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_DOORBELL_DEVICE_TYPE_ID 0x0148 +#define ESP_MATTER_DOORBELL_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace doorbell { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; + cluster::identify::config_t identify; + cluster::switch_cluster::config_t switch_cluster; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* doorbell */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/electrical_energy_tariff_device/electrical_energy_tariff_device.cpp b/components/esp_matter/data_model/generated/device_types/electrical_energy_tariff_device/electrical_energy_tariff_device.cpp new file mode 100644 index 000000000..bbcd50ffc --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/electrical_energy_tariff_device/electrical_energy_tariff_device.cpp @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace electrical_energy_tariff { +uint32_t get_device_type_id() +{ + return ESP_MATTER_ELECTRICAL_ENERGY_TARIFF_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_ELECTRICAL_ENERGY_TARIFF_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("electrical_energy_tariff", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("electrical_energy_tariff", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("electrical_energy_tariff", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + return ESP_OK; +} + +} /* electrical_energy_tariff */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/electrical_energy_tariff_device/electrical_energy_tariff_device.h b/components/esp_matter/data_model/generated/device_types/electrical_energy_tariff_device/electrical_energy_tariff_device.h new file mode 100644 index 000000000..98e1b727c --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/electrical_energy_tariff_device/electrical_energy_tariff_device.h @@ -0,0 +1,41 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include + +#include + +#define ESP_MATTER_ELECTRICAL_ENERGY_TARIFF_DEVICE_TYPE_ID 0x0513 +#define ESP_MATTER_ELECTRICAL_ENERGY_TARIFF_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace electrical_energy_tariff { + +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* electrical_energy_tariff */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/electrical_meter_device/electrical_meter_device.cpp b/components/esp_matter/data_model/generated/device_types/electrical_meter_device/electrical_meter_device.cpp new file mode 100644 index 000000000..a41ca9bd6 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/electrical_meter_device/electrical_meter_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace electrical_meter { +uint32_t get_device_type_id() +{ + return ESP_MATTER_ELECTRICAL_METER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_ELECTRICAL_METER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("electrical_meter", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("electrical_meter", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("electrical_meter", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::electrical_power_measurement::create(endpoint, &(config->electrical_power_measurement), CLUSTER_FLAG_SERVER); + cluster::electrical_energy_measurement::create(endpoint, &(config->electrical_energy_measurement), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* electrical_meter */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/electrical_meter_device/electrical_meter_device.h b/components/esp_matter/data_model/generated/device_types/electrical_meter_device/electrical_meter_device.h new file mode 100644 index 000000000..b767f1fc3 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/electrical_meter_device/electrical_meter_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_ELECTRICAL_METER_DEVICE_TYPE_ID 0x0514 +#define ESP_MATTER_ELECTRICAL_METER_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace electrical_meter { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::electrical_power_measurement::config_t electrical_power_measurement; + cluster::electrical_energy_measurement::config_t electrical_energy_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* electrical_meter */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/electrical_sensor_device/electrical_sensor_device.cpp b/components/esp_matter/data_model/generated/device_types/electrical_sensor_device/electrical_sensor_device.cpp new file mode 100644 index 000000000..7c673c83b --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/electrical_sensor_device/electrical_sensor_device.cpp @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace electrical_sensor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("electrical_sensor", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("electrical_sensor", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("electrical_sensor", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::power_topology::create(endpoint, &(config->power_topology), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* electrical_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/electrical_sensor_device/electrical_sensor_device.h b/components/esp_matter/data_model/generated/device_types/electrical_sensor_device/electrical_sensor_device.h new file mode 100644 index 000000000..2e00923fa --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/electrical_sensor_device/electrical_sensor_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_ID 0x0510 +#define ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace electrical_sensor { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::power_topology::config_t power_topology; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* electrical_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/electrical_utility_meter_device/electrical_utility_meter_device.cpp b/components/esp_matter/data_model/generated/device_types/electrical_utility_meter_device/electrical_utility_meter_device.cpp new file mode 100644 index 000000000..a0a7b2ccc --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/electrical_utility_meter_device/electrical_utility_meter_device.cpp @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace electrical_utility_meter { +uint32_t get_device_type_id() +{ + return ESP_MATTER_ELECTRICAL_UTILITY_METER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_ELECTRICAL_UTILITY_METER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("electrical_utility_meter", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("electrical_utility_meter", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("electrical_utility_meter", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::meter_identification::create(endpoint, &(config->meter_identification), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* electrical_utility_meter */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/electrical_utility_meter_device/electrical_utility_meter_device.h b/components/esp_matter/data_model/generated/device_types/electrical_utility_meter_device/electrical_utility_meter_device.h new file mode 100644 index 000000000..97b554b36 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/electrical_utility_meter_device/electrical_utility_meter_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_ELECTRICAL_UTILITY_METER_DEVICE_TYPE_ID 0x0511 +#define ESP_MATTER_ELECTRICAL_UTILITY_METER_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace electrical_utility_meter { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::meter_identification::config_t meter_identification; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* electrical_utility_meter */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/energy_evse_device/energy_evse_device.cpp b/components/esp_matter/data_model/generated/device_types/energy_evse_device/energy_evse_device.cpp new file mode 100644 index 000000000..92dc154e3 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/energy_evse_device/energy_evse_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace energy_evse { +uint32_t get_device_type_id() +{ + return ESP_MATTER_ENERGY_EVSE_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_ENERGY_EVSE_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("energy_evse", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("energy_evse", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("energy_evse", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::energy_evse::create(endpoint, &(config->energy_evse), CLUSTER_FLAG_SERVER); + cluster::energy_evse_mode::create(endpoint, &(config->energy_evse_mode), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* energy_evse */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/energy_evse_device/energy_evse_device.h b/components/esp_matter/data_model/generated/device_types/energy_evse_device/energy_evse_device.h new file mode 100644 index 000000000..05108e0bc --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/energy_evse_device/energy_evse_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_ENERGY_EVSE_DEVICE_TYPE_ID 0x050C +#define ESP_MATTER_ENERGY_EVSE_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace energy_evse { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::energy_evse::config_t energy_evse; + cluster::energy_evse_mode::config_t energy_evse_mode; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* energy_evse */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/extended_color_light_device/extended_color_light_device.cpp b/components/esp_matter/data_model/generated/device_types/extended_color_light_device/extended_color_light_device.cpp new file mode 100644 index 000000000..3379ff3a0 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/extended_color_light_device/extended_color_light_device.cpp @@ -0,0 +1,80 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace extended_color_light { +uint32_t get_device_type_id() +{ + return ESP_MATTER_EXTENDED_COLOR_LIGHT_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_EXTENDED_COLOR_LIGHT_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("extended_color_light", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("extended_color_light", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("extended_color_light", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster_t *identify = cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(identify != NULL, ESP_FAIL, ESP_LOGE("extended_color_light", "Failed to create cluster: identify")); + cluster::identify::command::create_trigger_effect(identify); + cluster::groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); + cluster_t *on_off = cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(on_off != NULL, ESP_FAIL, ESP_LOGE("extended_color_light", "Failed to create cluster: on_off")); + cluster::on_off::feature::lighting::add(on_off, &(config->on_off_lighting)); + cluster_t *level_control = cluster::level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(level_control != NULL, ESP_FAIL, ESP_LOGE("extended_color_light", "Failed to create cluster: level_control")); + cluster::level_control::feature::on_off::add(level_control); + cluster::level_control::feature::lighting::add(level_control, &(config->level_control_lighting)); + cluster_t *scenes_management = cluster::scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(scenes_management != NULL, ESP_FAIL, ESP_LOGE("extended_color_light", "Failed to create cluster: scenes_management")); + cluster::scenes_management::command::create_copy_scene(scenes_management); + cluster_t *color_control = cluster::color_control::create(endpoint, &(config->color_control), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(color_control != NULL, ESP_FAIL, ESP_LOGE("extended_color_light", "Failed to create cluster: color_control")); + cluster::color_control::attribute::create_remaining_time(color_control, config->remaining_time); + cluster::color_control::feature::color_temperature::add(color_control, &(config->color_control_color_temperature)); + cluster::color_control::feature::xy::add(color_control, &(config->color_control_xy)); + return ESP_OK; +} + +} /* extended_color_light */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/extended_color_light_device/extended_color_light_device.h b/components/esp_matter/data_model/generated/device_types/extended_color_light_device/extended_color_light_device.h new file mode 100644 index 000000000..62d8b08ab --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/extended_color_light_device/extended_color_light_device.h @@ -0,0 +1,59 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_EXTENDED_COLOR_LIGHT_DEVICE_TYPE_ID 0x010D +#define ESP_MATTER_EXTENDED_COLOR_LIGHT_DEVICE_TYPE_VERSION 4 + +namespace esp_matter { +namespace endpoint { +namespace extended_color_light { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::groups::config_t groups; + cluster::on_off::config_t on_off; + cluster::on_off::feature::lighting::config_t on_off_lighting; + cluster::level_control::config_t level_control; + cluster::level_control::feature::lighting::config_t level_control_lighting; + cluster::scenes_management::config_t scenes_management; + cluster::color_control::config_t color_control; + uint16_t remaining_time; + cluster::color_control::feature::color_temperature::config_t color_control_color_temperature; + cluster::color_control::feature::xy::config_t color_control_xy; + config() : remaining_time(0) {} +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* extended_color_light */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/extractor_hood_device/extractor_hood_device.cpp b/components/esp_matter/data_model/generated/device_types/extractor_hood_device/extractor_hood_device.cpp new file mode 100644 index 000000000..f09fb3940 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/extractor_hood_device/extractor_hood_device.cpp @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace extractor_hood { +uint32_t get_device_type_id() +{ + return ESP_MATTER_EXTRACTOR_HOOD_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_EXTRACTOR_HOOD_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("extractor_hood", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("extractor_hood", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("extractor_hood", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::fan_control::create(endpoint, &(config->fan_control), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* extractor_hood */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/extractor_hood_device/extractor_hood_device.h b/components/esp_matter/data_model/generated/device_types/extractor_hood_device/extractor_hood_device.h new file mode 100644 index 000000000..af8ad0d0b --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/extractor_hood_device/extractor_hood_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_EXTRACTOR_HOOD_DEVICE_TYPE_ID 0x007A +#define ESP_MATTER_EXTRACTOR_HOOD_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace extractor_hood { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::fan_control::config_t fan_control; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* extractor_hood */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/fan_device/fan_device.cpp b/components/esp_matter/data_model/generated/device_types/fan_device/fan_device.cpp new file mode 100644 index 000000000..0b557b7bd --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/fan_device/fan_device.cpp @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace fan { +uint32_t get_device_type_id() +{ + return ESP_MATTER_FAN_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_FAN_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("fan", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("fan", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("fan", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); + cluster::fan_control::create(endpoint, &(config->fan_control), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* fan */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/fan_device/fan_device.h b/components/esp_matter/data_model/generated/device_types/fan_device/fan_device.h new file mode 100644 index 000000000..d4954d7ba --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/fan_device/fan_device.h @@ -0,0 +1,47 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include + +#include + +#define ESP_MATTER_FAN_DEVICE_TYPE_ID 0x002B +#define ESP_MATTER_FAN_DEVICE_TYPE_VERSION 4 + +namespace esp_matter { +namespace endpoint { +namespace fan { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::groups::config_t groups; + cluster::fan_control::config_t fan_control; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* fan */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/floodlight_camera_device/floodlight_camera_device.cpp b/components/esp_matter/data_model/generated/device_types/floodlight_camera_device/floodlight_camera_device.cpp new file mode 100644 index 000000000..3842769ca --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/floodlight_camera_device/floodlight_camera_device.cpp @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace floodlight_camera { +uint32_t get_device_type_id() +{ + return ESP_MATTER_FLOODLIGHT_CAMERA_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_FLOODLIGHT_CAMERA_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("floodlight_camera", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("floodlight_camera", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("floodlight_camera", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + return ESP_OK; +} + +} /* floodlight_camera */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/floodlight_camera_device/floodlight_camera_device.h b/components/esp_matter/data_model/generated/device_types/floodlight_camera_device/floodlight_camera_device.h new file mode 100644 index 000000000..02e565236 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/floodlight_camera_device/floodlight_camera_device.h @@ -0,0 +1,41 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include + +#include + +#define ESP_MATTER_FLOODLIGHT_CAMERA_DEVICE_TYPE_ID 0x0144 +#define ESP_MATTER_FLOODLIGHT_CAMERA_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace floodlight_camera { + +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* floodlight_camera */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/flow_sensor_device/flow_sensor_device.cpp b/components/esp_matter/data_model/generated/device_types/flow_sensor_device/flow_sensor_device.cpp new file mode 100644 index 000000000..05e4bed8f --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/flow_sensor_device/flow_sensor_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace flow_sensor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_FLOW_SENSOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_FLOW_SENSOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("flow_sensor", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("flow_sensor", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("flow_sensor", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::flow_measurement::create(endpoint, &(config->flow_measurement), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* flow_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/flow_sensor_device/flow_sensor_device.h b/components/esp_matter/data_model/generated/device_types/flow_sensor_device/flow_sensor_device.h new file mode 100644 index 000000000..4e6e6f341 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/flow_sensor_device/flow_sensor_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_FLOW_SENSOR_DEVICE_TYPE_ID 0x0306 +#define ESP_MATTER_FLOW_SENSOR_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace flow_sensor { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::flow_measurement::config_t flow_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* flow_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/generic_switch_device/generic_switch_device.cpp b/components/esp_matter/data_model/generated/device_types/generic_switch_device/generic_switch_device.cpp new file mode 100644 index 000000000..264a2af67 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/generic_switch_device/generic_switch_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace generic_switch { +uint32_t get_device_type_id() +{ + return ESP_MATTER_GENERIC_SWITCH_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_GENERIC_SWITCH_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("generic_switch", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("generic_switch", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("generic_switch", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::switch_cluster::create(endpoint, &(config->switch_cluster), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* generic_switch */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/generic_switch_device/generic_switch_device.h b/components/esp_matter/data_model/generated/device_types/generic_switch_device/generic_switch_device.h new file mode 100644 index 000000000..3c1391a8d --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/generic_switch_device/generic_switch_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_GENERIC_SWITCH_DEVICE_TYPE_ID 0x000F +#define ESP_MATTER_GENERIC_SWITCH_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace generic_switch { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::switch_cluster::config_t switch_cluster; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* generic_switch */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/heat_pump_device/heat_pump_device.cpp b/components/esp_matter/data_model/generated/device_types/heat_pump_device/heat_pump_device.cpp new file mode 100644 index 000000000..ae86c4751 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/heat_pump_device/heat_pump_device.cpp @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace heat_pump { +uint32_t get_device_type_id() +{ + return ESP_MATTER_HEAT_PUMP_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_HEAT_PUMP_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("heat_pump", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("heat_pump", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("heat_pump", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + return ESP_OK; +} + +} /* heat_pump */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/heat_pump_device/heat_pump_device.h b/components/esp_matter/data_model/generated/device_types/heat_pump_device/heat_pump_device.h new file mode 100644 index 000000000..18e6ea1f4 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/heat_pump_device/heat_pump_device.h @@ -0,0 +1,41 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include + +#include + +#define ESP_MATTER_HEAT_PUMP_DEVICE_TYPE_ID 0x0309 +#define ESP_MATTER_HEAT_PUMP_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace heat_pump { + +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* heat_pump */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/humidity_sensor_device/humidity_sensor_device.cpp b/components/esp_matter/data_model/generated/device_types/humidity_sensor_device/humidity_sensor_device.cpp new file mode 100644 index 000000000..d9ec79e90 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/humidity_sensor_device/humidity_sensor_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace humidity_sensor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_HUMIDITY_SENSOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_HUMIDITY_SENSOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("humidity_sensor", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("humidity_sensor", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("humidity_sensor", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::relative_humidity_measurement::create(endpoint, &(config->relative_humidity_measurement), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* humidity_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/humidity_sensor_device/humidity_sensor_device.h b/components/esp_matter/data_model/generated/device_types/humidity_sensor_device/humidity_sensor_device.h new file mode 100644 index 000000000..b368e7e4c --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/humidity_sensor_device/humidity_sensor_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_HUMIDITY_SENSOR_DEVICE_TYPE_ID 0x0307 +#define ESP_MATTER_HUMIDITY_SENSOR_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace humidity_sensor { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::relative_humidity_measurement::config_t relative_humidity_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* humidity_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/intercom_device/intercom_device.cpp b/components/esp_matter/data_model/generated/device_types/intercom_device/intercom_device.cpp new file mode 100644 index 000000000..d885c6133 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/intercom_device/intercom_device.cpp @@ -0,0 +1,69 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace intercom { +uint32_t get_device_type_id() +{ + return ESP_MATTER_INTERCOM_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_INTERCOM_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("intercom", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("intercom", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("intercom", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + config->camera_av_stream_management.feature_flags |= cluster::camera_av_stream_management::feature::audio::get_id(); + cluster::camera_av_stream_management::create(endpoint, &(config->camera_av_stream_management), CLUSTER_FLAG_SERVER); + cluster::webrtc_transport_provider::create(endpoint, &(config->webrtc_transport_provider), CLUSTER_FLAG_SERVER); + cluster::webrtc_transport_provider::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::webrtc_transport_requestor::create(endpoint, &(config->webrtc_transport_requestor), CLUSTER_FLAG_SERVER); + cluster::webrtc_transport_requestor::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* intercom */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/intercom_device/intercom_device.h b/components/esp_matter/data_model/generated/device_types/intercom_device/intercom_device.h new file mode 100644 index 000000000..76d2118c9 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/intercom_device/intercom_device.h @@ -0,0 +1,49 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_INTERCOM_DEVICE_TYPE_ID 0x0140 +#define ESP_MATTER_INTERCOM_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace intercom { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; + cluster::camera_av_stream_management::config_t camera_av_stream_management; + cluster::webrtc_transport_provider::config_t webrtc_transport_provider; + cluster::webrtc_transport_requestor::config_t webrtc_transport_requestor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* intercom */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/irrigation_system_device/irrigation_system_device.cpp b/components/esp_matter/data_model/generated/device_types/irrigation_system_device/irrigation_system_device.cpp new file mode 100644 index 000000000..0030e5afc --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/irrigation_system_device/irrigation_system_device.cpp @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace irrigation_system { +uint32_t get_device_type_id() +{ + return ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("irrigation_system", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("irrigation_system", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("irrigation_system", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + return ESP_OK; +} + +} /* irrigation_system */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/irrigation_system_device/irrigation_system_device.h b/components/esp_matter/data_model/generated/device_types/irrigation_system_device/irrigation_system_device.h new file mode 100644 index 000000000..683944342 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/irrigation_system_device/irrigation_system_device.h @@ -0,0 +1,41 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include + +#include + +#define ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_ID 0x0040 +#define ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace irrigation_system { + +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* irrigation_system */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/joint_fabric_administrator_device/joint_fabric_administrator_device.cpp b/components/esp_matter/data_model/generated/device_types/joint_fabric_administrator_device/joint_fabric_administrator_device.cpp new file mode 100644 index 000000000..319586791 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/joint_fabric_administrator_device/joint_fabric_administrator_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace joint_fabric_administrator { +uint32_t get_device_type_id() +{ + return ESP_MATTER_JOINT_FABRIC_ADMINISTRATOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_JOINT_FABRIC_ADMINISTRATOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("joint_fabric_administrator", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("joint_fabric_administrator", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("joint_fabric_administrator", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::joint_fabric_datastore::create(endpoint, &(config->joint_fabric_datastore), CLUSTER_FLAG_SERVER); + cluster::joint_fabric_administrator::create(endpoint, &(config->joint_fabric_administrator), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* joint_fabric_administrator */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/joint_fabric_administrator_device/joint_fabric_administrator_device.h b/components/esp_matter/data_model/generated/device_types/joint_fabric_administrator_device/joint_fabric_administrator_device.h new file mode 100644 index 000000000..ea3fd5dbc --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/joint_fabric_administrator_device/joint_fabric_administrator_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_JOINT_FABRIC_ADMINISTRATOR_DEVICE_TYPE_ID 0x0130 +#define ESP_MATTER_JOINT_FABRIC_ADMINISTRATOR_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace joint_fabric_administrator { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::joint_fabric_datastore::config_t joint_fabric_datastore; + cluster::joint_fabric_administrator::config_t joint_fabric_administrator; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* joint_fabric_administrator */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/laundry_dryer_device/laundry_dryer_device.cpp b/components/esp_matter/data_model/generated/device_types/laundry_dryer_device/laundry_dryer_device.cpp new file mode 100644 index 000000000..925bbabac --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/laundry_dryer_device/laundry_dryer_device.cpp @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace laundry_dryer { +uint32_t get_device_type_id() +{ + return ESP_MATTER_LAUNDRY_DRYER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_LAUNDRY_DRYER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("laundry_dryer", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("laundry_dryer", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("laundry_dryer", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster_t *operational_state = cluster::operational_state::create(endpoint, &(config->operational_state), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(operational_state != NULL, ESP_FAIL, ESP_LOGE("laundry_dryer", "Failed to create cluster: operational_state")); + cluster::operational_state::event::create_operation_completion(operational_state); + return ESP_OK; +} + +} /* laundry_dryer */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/laundry_dryer_device/laundry_dryer_device.h b/components/esp_matter/data_model/generated/device_types/laundry_dryer_device/laundry_dryer_device.h new file mode 100644 index 000000000..b1a7d0f1d --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/laundry_dryer_device/laundry_dryer_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_LAUNDRY_DRYER_DEVICE_TYPE_ID 0x007C +#define ESP_MATTER_LAUNDRY_DRYER_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace laundry_dryer { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::operational_state::config_t operational_state; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* laundry_dryer */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/laundry_washer_device/laundry_washer_device.cpp b/components/esp_matter/data_model/generated/device_types/laundry_washer_device/laundry_washer_device.cpp new file mode 100644 index 000000000..a11121be8 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/laundry_washer_device/laundry_washer_device.cpp @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace laundry_washer { +uint32_t get_device_type_id() +{ + return ESP_MATTER_LAUNDRY_WASHER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_LAUNDRY_WASHER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("laundry_washer", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("laundry_washer", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("laundry_washer", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster_t *operational_state = cluster::operational_state::create(endpoint, &(config->operational_state), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(operational_state != NULL, ESP_FAIL, ESP_LOGE("laundry_washer", "Failed to create cluster: operational_state")); + cluster::operational_state::event::create_operation_completion(operational_state); + return ESP_OK; +} + +} /* laundry_washer */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/laundry_washer_device/laundry_washer_device.h b/components/esp_matter/data_model/generated/device_types/laundry_washer_device/laundry_washer_device.h new file mode 100644 index 000000000..b26d22981 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/laundry_washer_device/laundry_washer_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_LAUNDRY_WASHER_DEVICE_TYPE_ID 0x0073 +#define ESP_MATTER_LAUNDRY_WASHER_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace laundry_washer { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::operational_state::config_t operational_state; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* laundry_washer */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/light_sensor_device/light_sensor_device.cpp b/components/esp_matter/data_model/generated/device_types/light_sensor_device/light_sensor_device.cpp new file mode 100644 index 000000000..f0a96e0f0 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/light_sensor_device/light_sensor_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace light_sensor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_LIGHT_SENSOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_LIGHT_SENSOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("light_sensor", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("light_sensor", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("light_sensor", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::illuminance_measurement::create(endpoint, &(config->illuminance_measurement), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* light_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/light_sensor_device/light_sensor_device.h b/components/esp_matter/data_model/generated/device_types/light_sensor_device/light_sensor_device.h new file mode 100644 index 000000000..7154fa60e --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/light_sensor_device/light_sensor_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_LIGHT_SENSOR_DEVICE_TYPE_ID 0x0106 +#define ESP_MATTER_LIGHT_SENSOR_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace light_sensor { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::illuminance_measurement::config_t illuminance_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* light_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/meter_reference_point_device/meter_reference_point_device.cpp b/components/esp_matter/data_model/generated/device_types/meter_reference_point_device/meter_reference_point_device.cpp new file mode 100644 index 000000000..201627d7c --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/meter_reference_point_device/meter_reference_point_device.cpp @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace meter_reference_point { +uint32_t get_device_type_id() +{ + return ESP_MATTER_METER_REFERENCE_POINT_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_METER_REFERENCE_POINT_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("meter_reference_point", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("meter_reference_point", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("meter_reference_point", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* meter_reference_point */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/meter_reference_point_device/meter_reference_point_device.h b/components/esp_matter/data_model/generated/device_types/meter_reference_point_device/meter_reference_point_device.h new file mode 100644 index 000000000..2bd86204b --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/meter_reference_point_device/meter_reference_point_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_METER_REFERENCE_POINT_DEVICE_TYPE_ID 0x0512 +#define ESP_MATTER_METER_REFERENCE_POINT_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace meter_reference_point { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* meter_reference_point */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/microwave_oven_device/microwave_oven_device.cpp b/components/esp_matter/data_model/generated/device_types/microwave_oven_device/microwave_oven_device.cpp new file mode 100644 index 000000000..95d6cfdd9 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/microwave_oven_device/microwave_oven_device.cpp @@ -0,0 +1,67 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace microwave_oven { +uint32_t get_device_type_id() +{ + return ESP_MATTER_MICROWAVE_OVEN_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_MICROWAVE_OVEN_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("microwave_oven", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("microwave_oven", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("microwave_oven", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::microwave_oven_mode::create(endpoint, &(config->microwave_oven_mode), CLUSTER_FLAG_SERVER); + cluster::microwave_oven_control::create(endpoint, &(config->microwave_oven_control), CLUSTER_FLAG_SERVER); + cluster_t *operational_state = cluster::operational_state::create(endpoint, &(config->operational_state), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(operational_state != NULL, ESP_FAIL, ESP_LOGE("microwave_oven", "Failed to create cluster: operational_state")); + cluster::operational_state::attribute::create_countdown_time(operational_state, 0); + cluster::operational_state::event::create_operation_completion(operational_state); + return ESP_OK; +} + +} /* microwave_oven */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/microwave_oven_device/microwave_oven_device.h b/components/esp_matter/data_model/generated/device_types/microwave_oven_device/microwave_oven_device.h new file mode 100644 index 000000000..225c3b8bd --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/microwave_oven_device/microwave_oven_device.h @@ -0,0 +1,47 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include + +#include + +#define ESP_MATTER_MICROWAVE_OVEN_DEVICE_TYPE_ID 0x0079 +#define ESP_MATTER_MICROWAVE_OVEN_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace microwave_oven { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::microwave_oven_mode::config_t microwave_oven_mode; + cluster::microwave_oven_control::config_t microwave_oven_control; + cluster::operational_state::config_t operational_state; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* microwave_oven */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/mode_select_device/mode_select_device.cpp b/components/esp_matter/data_model/generated/device_types/mode_select_device/mode_select_device.cpp new file mode 100644 index 000000000..141517841 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/mode_select_device/mode_select_device.cpp @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace mode_select { +uint32_t get_device_type_id() +{ + return ESP_MATTER_MODE_SELECT_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_MODE_SELECT_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("mode_select", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("mode_select", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("mode_select", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::mode_select::create(endpoint, &(config->mode_select), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* mode_select */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/mode_select_device/mode_select_device.h b/components/esp_matter/data_model/generated/device_types/mode_select_device/mode_select_device.h new file mode 100644 index 000000000..d8fa84504 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/mode_select_device/mode_select_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_MODE_SELECT_DEVICE_TYPE_ID 0x0027 +#define ESP_MATTER_MODE_SELECT_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace mode_select { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::mode_select::config_t mode_select; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* mode_select */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/mounted_dimmable_load_control_device/mounted_dimmable_load_control_device.cpp b/components/esp_matter/data_model/generated/device_types/mounted_dimmable_load_control_device/mounted_dimmable_load_control_device.cpp new file mode 100644 index 000000000..c196a6424 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/mounted_dimmable_load_control_device/mounted_dimmable_load_control_device.cpp @@ -0,0 +1,75 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace mounted_dimmable_load_control { +uint32_t get_device_type_id() +{ + return ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("mounted_dimmable_load_control", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("mounted_dimmable_load_control", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("mounted_dimmable_load_control", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster_t *identify = cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(identify != NULL, ESP_FAIL, ESP_LOGE("mounted_dimmable_load_control", "Failed to create cluster: identify")); + cluster::identify::command::create_trigger_effect(identify); + cluster::groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); + cluster_t *on_off = cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(on_off != NULL, ESP_FAIL, ESP_LOGE("mounted_dimmable_load_control", "Failed to create cluster: on_off")); + cluster::on_off::feature::lighting::add(on_off, &(config->on_off_lighting)); + cluster_t *level_control = cluster::level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(level_control != NULL, ESP_FAIL, ESP_LOGE("mounted_dimmable_load_control", "Failed to create cluster: level_control")); + cluster::level_control::feature::on_off::add(level_control); + cluster::level_control::feature::lighting::add(level_control, &(config->level_control_lighting)); + cluster_t *scenes_management = cluster::scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(scenes_management != NULL, ESP_FAIL, ESP_LOGE("mounted_dimmable_load_control", "Failed to create cluster: scenes_management")); + cluster::scenes_management::command::create_copy_scene(scenes_management); + return ESP_OK; +} + +} /* mounted_dimmable_load_control */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/mounted_dimmable_load_control_device/mounted_dimmable_load_control_device.h b/components/esp_matter/data_model/generated/device_types/mounted_dimmable_load_control_device/mounted_dimmable_load_control_device.h new file mode 100644 index 000000000..05d2be6c3 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/mounted_dimmable_load_control_device/mounted_dimmable_load_control_device.h @@ -0,0 +1,53 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_ID 0x0110 +#define ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace mounted_dimmable_load_control { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::groups::config_t groups; + cluster::on_off::config_t on_off; + cluster::on_off::feature::lighting::config_t on_off_lighting; + cluster::level_control::config_t level_control; + cluster::level_control::feature::lighting::config_t level_control_lighting; + cluster::scenes_management::config_t scenes_management; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* mounted_dimmable_load_control */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/mounted_on_off_control_device/mounted_on_off_control_device.cpp b/components/esp_matter/data_model/generated/device_types/mounted_on_off_control_device/mounted_on_off_control_device.cpp new file mode 100644 index 000000000..68c7ea5d7 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/mounted_on_off_control_device/mounted_on_off_control_device.cpp @@ -0,0 +1,71 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace mounted_on_off_control { +uint32_t get_device_type_id() +{ + return ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("mounted_on_off_control", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("mounted_on_off_control", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("mounted_on_off_control", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster_t *identify = cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(identify != NULL, ESP_FAIL, ESP_LOGE("mounted_on_off_control", "Failed to create cluster: identify")); + cluster::identify::command::create_trigger_effect(identify); + cluster::groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); + cluster_t *on_off = cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(on_off != NULL, ESP_FAIL, ESP_LOGE("mounted_on_off_control", "Failed to create cluster: on_off")); + cluster::on_off::feature::lighting::add(on_off, &(config->on_off_lighting)); + cluster_t *scenes_management = cluster::scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(scenes_management != NULL, ESP_FAIL, ESP_LOGE("mounted_on_off_control", "Failed to create cluster: scenes_management")); + cluster::scenes_management::command::create_copy_scene(scenes_management); + return ESP_OK; +} + +} /* mounted_on_off_control */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/mounted_on_off_control_device/mounted_on_off_control_device.h b/components/esp_matter/data_model/generated/device_types/mounted_on_off_control_device/mounted_on_off_control_device.h new file mode 100644 index 000000000..28cdcf3a0 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/mounted_on_off_control_device/mounted_on_off_control_device.h @@ -0,0 +1,50 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_ID 0x010F +#define ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace mounted_on_off_control { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::groups::config_t groups; + cluster::on_off::config_t on_off; + cluster::on_off::feature::lighting::config_t on_off_lighting; + cluster::scenes_management::config_t scenes_management; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* mounted_on_off_control */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/network_infrastructure_manager_device/network_infrastructure_manager_device.cpp b/components/esp_matter/data_model/generated/device_types/network_infrastructure_manager_device/network_infrastructure_manager_device.cpp new file mode 100644 index 000000000..a287d64aa --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/network_infrastructure_manager_device/network_infrastructure_manager_device.cpp @@ -0,0 +1,65 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace network_infrastructure_manager { +uint32_t get_device_type_id() +{ + return ESP_MATTER_NETWORK_INFRASTRUCTURE_MANAGER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_NETWORK_INFRASTRUCTURE_MANAGER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("network_infrastructure_manager", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("network_infrastructure_manager", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("network_infrastructure_manager", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::thread_network_diagnostics::create(endpoint, &(config->thread_network_diagnostics), CLUSTER_FLAG_SERVER); + cluster::wi_fi_network_management::create(endpoint, &(config->wi_fi_network_management), CLUSTER_FLAG_SERVER); + cluster::thread_border_router_management::create(endpoint, &(config->thread_border_router_management), CLUSTER_FLAG_SERVER); + cluster::thread_network_directory::create(endpoint, &(config->thread_network_directory), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* network_infrastructure_manager */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/network_infrastructure_manager_device/network_infrastructure_manager_device.h b/components/esp_matter/data_model/generated/device_types/network_infrastructure_manager_device/network_infrastructure_manager_device.h new file mode 100644 index 000000000..48480c23f --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/network_infrastructure_manager_device/network_infrastructure_manager_device.h @@ -0,0 +1,49 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_NETWORK_INFRASTRUCTURE_MANAGER_DEVICE_TYPE_ID 0x0090 +#define ESP_MATTER_NETWORK_INFRASTRUCTURE_MANAGER_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace network_infrastructure_manager { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::thread_network_diagnostics::config_t thread_network_diagnostics; + cluster::wi_fi_network_management::config_t wi_fi_network_management; + cluster::thread_border_router_management::config_t thread_border_router_management; + cluster::thread_network_directory::config_t thread_network_directory; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* network_infrastructure_manager */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/occupancy_sensor_device/occupancy_sensor_device.cpp b/components/esp_matter/data_model/generated/device_types/occupancy_sensor_device/occupancy_sensor_device.cpp new file mode 100644 index 000000000..fdd77bde3 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/occupancy_sensor_device/occupancy_sensor_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace occupancy_sensor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_OCCUPANCY_SENSOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_OCCUPANCY_SENSOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("occupancy_sensor", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("occupancy_sensor", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("occupancy_sensor", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::occupancy_sensing::create(endpoint, &(config->occupancy_sensing), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* occupancy_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/occupancy_sensor_device/occupancy_sensor_device.h b/components/esp_matter/data_model/generated/device_types/occupancy_sensor_device/occupancy_sensor_device.h new file mode 100644 index 000000000..cbdf80a2e --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/occupancy_sensor_device/occupancy_sensor_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_OCCUPANCY_SENSOR_DEVICE_TYPE_ID 0x0107 +#define ESP_MATTER_OCCUPANCY_SENSOR_DEVICE_TYPE_VERSION 4 + +namespace esp_matter { +namespace endpoint { +namespace occupancy_sensor { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::occupancy_sensing::config_t occupancy_sensing; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* occupancy_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/on_off_light_device/on_off_light_device.cpp b/components/esp_matter/data_model/generated/device_types/on_off_light_device/on_off_light_device.cpp new file mode 100644 index 000000000..ba6c09e42 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/on_off_light_device/on_off_light_device.cpp @@ -0,0 +1,71 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace on_off_light { +uint32_t get_device_type_id() +{ + return ESP_MATTER_ON_OFF_LIGHT_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_ON_OFF_LIGHT_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("on_off_light", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("on_off_light", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("on_off_light", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster_t *identify = cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(identify != NULL, ESP_FAIL, ESP_LOGE("on_off_light", "Failed to create cluster: identify")); + cluster::identify::command::create_trigger_effect(identify); + cluster::groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); + cluster_t *on_off = cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(on_off != NULL, ESP_FAIL, ESP_LOGE("on_off_light", "Failed to create cluster: on_off")); + cluster::on_off::feature::lighting::add(on_off, &(config->on_off_lighting)); + cluster_t *scenes_management = cluster::scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(scenes_management != NULL, ESP_FAIL, ESP_LOGE("on_off_light", "Failed to create cluster: scenes_management")); + cluster::scenes_management::command::create_copy_scene(scenes_management); + return ESP_OK; +} + +} /* on_off_light */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/on_off_light_device/on_off_light_device.h b/components/esp_matter/data_model/generated/device_types/on_off_light_device/on_off_light_device.h new file mode 100644 index 000000000..f27b157f5 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/on_off_light_device/on_off_light_device.h @@ -0,0 +1,50 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_ON_OFF_LIGHT_DEVICE_TYPE_ID 0x0100 +#define ESP_MATTER_ON_OFF_LIGHT_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace on_off_light { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::groups::config_t groups; + cluster::on_off::config_t on_off; + cluster::on_off::feature::lighting::config_t on_off_lighting; + cluster::scenes_management::config_t scenes_management; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* on_off_light */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/on_off_light_switch_device/on_off_light_switch_device.cpp b/components/esp_matter/data_model/generated/device_types/on_off_light_switch_device/on_off_light_switch_device.cpp new file mode 100644 index 000000000..536536f72 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/on_off_light_switch_device/on_off_light_switch_device.cpp @@ -0,0 +1,66 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace on_off_light_switch { +uint32_t get_device_type_id() +{ + return ESP_MATTER_ON_OFF_LIGHT_SWITCH_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_ON_OFF_LIGHT_SWITCH_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("on_off_light_switch", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("on_off_light_switch", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("on_off_light_switch", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::identify::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::on_off::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* on_off_light_switch */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/on_off_light_switch_device/on_off_light_switch_device.h b/components/esp_matter/data_model/generated/device_types/on_off_light_switch_device/on_off_light_switch_device.h new file mode 100644 index 000000000..7b5f90b23 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/on_off_light_switch_device/on_off_light_switch_device.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include + +#include + +#define ESP_MATTER_ON_OFF_LIGHT_SWITCH_DEVICE_TYPE_ID 0x0103 +#define ESP_MATTER_ON_OFF_LIGHT_SWITCH_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace on_off_light_switch { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; + cluster::identify::config_t identify; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* on_off_light_switch */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/on_off_plug_in_unit_device/on_off_plug_in_unit_device.cpp b/components/esp_matter/data_model/generated/device_types/on_off_plug_in_unit_device/on_off_plug_in_unit_device.cpp new file mode 100644 index 000000000..538f5eca1 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/on_off_plug_in_unit_device/on_off_plug_in_unit_device.cpp @@ -0,0 +1,71 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace on_off_plug_in_unit { +uint32_t get_device_type_id() +{ + return ESP_MATTER_ON_OFF_PLUG_IN_UNIT_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_ON_OFF_PLUG_IN_UNIT_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("on_off_plug_in_unit", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("on_off_plug_in_unit", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("on_off_plug_in_unit", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster_t *identify = cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(identify != NULL, ESP_FAIL, ESP_LOGE("on_off_plug_in_unit", "Failed to create cluster: identify")); + cluster::identify::command::create_trigger_effect(identify); + cluster::groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); + cluster_t *on_off = cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(on_off != NULL, ESP_FAIL, ESP_LOGE("on_off_plug_in_unit", "Failed to create cluster: on_off")); + cluster::on_off::feature::lighting::add(on_off, &(config->on_off_lighting)); + cluster_t *scenes_management = cluster::scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(scenes_management != NULL, ESP_FAIL, ESP_LOGE("on_off_plug_in_unit", "Failed to create cluster: scenes_management")); + cluster::scenes_management::command::create_copy_scene(scenes_management); + return ESP_OK; +} + +} /* on_off_plug_in_unit */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/on_off_plug_in_unit_device/on_off_plug_in_unit_device.h b/components/esp_matter/data_model/generated/device_types/on_off_plug_in_unit_device/on_off_plug_in_unit_device.h new file mode 100644 index 000000000..9a1ce2a04 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/on_off_plug_in_unit_device/on_off_plug_in_unit_device.h @@ -0,0 +1,50 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_ON_OFF_PLUG_IN_UNIT_DEVICE_TYPE_ID 0x010A +#define ESP_MATTER_ON_OFF_PLUG_IN_UNIT_DEVICE_TYPE_VERSION 4 + +namespace esp_matter { +namespace endpoint { +namespace on_off_plug_in_unit { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::groups::config_t groups; + cluster::on_off::config_t on_off; + cluster::on_off::feature::lighting::config_t on_off_lighting; + cluster::scenes_management::config_t scenes_management; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* on_off_plug_in_unit */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/on_off_sensor_device/on_off_sensor_device.cpp b/components/esp_matter/data_model/generated/device_types/on_off_sensor_device/on_off_sensor_device.cpp new file mode 100644 index 000000000..7db4effce --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/on_off_sensor_device/on_off_sensor_device.cpp @@ -0,0 +1,66 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace on_off_sensor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_ON_OFF_SENSOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_ON_OFF_SENSOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("on_off_sensor", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("on_off_sensor", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("on_off_sensor", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::identify::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::on_off::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* on_off_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/on_off_sensor_device/on_off_sensor_device.h b/components/esp_matter/data_model/generated/device_types/on_off_sensor_device/on_off_sensor_device.h new file mode 100644 index 000000000..eea65e862 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/on_off_sensor_device/on_off_sensor_device.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include + +#include + +#define ESP_MATTER_ON_OFF_SENSOR_DEVICE_TYPE_ID 0x0850 +#define ESP_MATTER_ON_OFF_SENSOR_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace on_off_sensor { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; + cluster::identify::config_t identify; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* on_off_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/ota_provider_device/ota_provider_device.cpp b/components/esp_matter/data_model/generated/device_types/ota_provider_device/ota_provider_device.cpp new file mode 100644 index 000000000..a6a1c8f50 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/ota_provider_device/ota_provider_device.cpp @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace ota_provider { +uint32_t get_device_type_id() +{ + return ESP_MATTER_OTA_PROVIDER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_OTA_PROVIDER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("ota_provider", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("ota_provider", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("ota_provider", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::ota_software_update_provider::create(endpoint, &(config->ota_software_update_provider), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* ota_provider */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/ota_provider_device/ota_provider_device.h b/components/esp_matter/data_model/generated/device_types/ota_provider_device/ota_provider_device.h new file mode 100644 index 000000000..73d74be0d --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/ota_provider_device/ota_provider_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_OTA_PROVIDER_DEVICE_TYPE_ID 0x0014 +#define ESP_MATTER_OTA_PROVIDER_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace ota_provider { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::ota_software_update_provider::config_t ota_software_update_provider; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* ota_provider */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/ota_requestor_device/ota_requestor_device.cpp b/components/esp_matter/data_model/generated/device_types/ota_requestor_device/ota_requestor_device.cpp new file mode 100644 index 000000000..903d19418 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/ota_requestor_device/ota_requestor_device.cpp @@ -0,0 +1,65 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace ota_requestor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_OTA_REQUESTOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_OTA_REQUESTOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("ota_requestor", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("ota_requestor", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("ota_requestor", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::ota_software_update_provider::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::ota_software_update_requestor::create(endpoint, &(config->ota_software_update_requestor), CLUSTER_FLAG_SERVER); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* ota_requestor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/ota_requestor_device/ota_requestor_device.h b/components/esp_matter/data_model/generated/device_types/ota_requestor_device/ota_requestor_device.h new file mode 100644 index 000000000..8c75915b1 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/ota_requestor_device/ota_requestor_device.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include + +#include + +#define ESP_MATTER_OTA_REQUESTOR_DEVICE_TYPE_ID 0x0012 +#define ESP_MATTER_OTA_REQUESTOR_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace ota_requestor { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; + cluster::ota_software_update_requestor::config_t ota_software_update_requestor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* ota_requestor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/oven_device/oven_device.cpp b/components/esp_matter/data_model/generated/device_types/oven_device/oven_device.cpp new file mode 100644 index 000000000..1a7fac9a0 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/oven_device/oven_device.cpp @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace oven { +uint32_t get_device_type_id() +{ + return ESP_MATTER_OVEN_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_OVEN_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("oven", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("oven", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("oven", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + return ESP_OK; +} + +} /* oven */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/oven_device/oven_device.h b/components/esp_matter/data_model/generated/device_types/oven_device/oven_device.h new file mode 100644 index 000000000..349996c27 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/oven_device/oven_device.h @@ -0,0 +1,41 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include + +#include + +#define ESP_MATTER_OVEN_DEVICE_TYPE_ID 0x007B +#define ESP_MATTER_OVEN_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace oven { + +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* oven */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/power_source_device/power_source_device.cpp b/components/esp_matter/data_model/generated/device_types/power_source_device/power_source_device.cpp new file mode 100644 index 000000000..8829312cc --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/power_source_device/power_source_device.cpp @@ -0,0 +1,62 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace power_source { +uint32_t get_device_type_id() +{ + return ESP_MATTER_POWER_SOURCE_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_POWER_SOURCE_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("power_source", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("power_source", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("power_source", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::power_source::create(endpoint, &(config->power_source), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* power_source */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/power_source_device/power_source_device.h b/components/esp_matter/data_model/generated/device_types/power_source_device/power_source_device.h new file mode 100644 index 000000000..47a24bcd3 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/power_source_device/power_source_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_POWER_SOURCE_DEVICE_TYPE_ID 0x0011 +#define ESP_MATTER_POWER_SOURCE_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace power_source { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::power_source::config_t power_source; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* power_source */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/pressure_sensor_device/pressure_sensor_device.cpp b/components/esp_matter/data_model/generated/device_types/pressure_sensor_device/pressure_sensor_device.cpp new file mode 100644 index 000000000..4f2535166 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/pressure_sensor_device/pressure_sensor_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace pressure_sensor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_PRESSURE_SENSOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_PRESSURE_SENSOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("pressure_sensor", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("pressure_sensor", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("pressure_sensor", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::pressure_measurement::create(endpoint, &(config->pressure_measurement), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* pressure_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/pressure_sensor_device/pressure_sensor_device.h b/components/esp_matter/data_model/generated/device_types/pressure_sensor_device/pressure_sensor_device.h new file mode 100644 index 000000000..8e344b765 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/pressure_sensor_device/pressure_sensor_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_PRESSURE_SENSOR_DEVICE_TYPE_ID 0x0305 +#define ESP_MATTER_PRESSURE_SENSOR_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace pressure_sensor { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::pressure_measurement::config_t pressure_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* pressure_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/pump_controller_device/pump_controller_device.cpp b/components/esp_matter/data_model/generated/device_types/pump_controller_device/pump_controller_device.cpp new file mode 100644 index 000000000..6fb211cc5 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/pump_controller_device/pump_controller_device.cpp @@ -0,0 +1,66 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace pump_controller { +uint32_t get_device_type_id() +{ + return ESP_MATTER_PUMP_CONTROLLER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_PUMP_CONTROLLER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("pump_controller", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("pump_controller", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("pump_controller", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::on_off::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::pump_configuration_and_control::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* pump_controller */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/pump_controller_device/pump_controller_device.h b/components/esp_matter/data_model/generated/device_types/pump_controller_device/pump_controller_device.h new file mode 100644 index 000000000..26c01536b --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/pump_controller_device/pump_controller_device.h @@ -0,0 +1,47 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_PUMP_CONTROLLER_DEVICE_TYPE_ID 0x0304 +#define ESP_MATTER_PUMP_CONTROLLER_DEVICE_TYPE_VERSION 4 + +namespace esp_matter { +namespace endpoint { +namespace pump_controller { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; + cluster::identify::config_t identify; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* pump_controller */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/pump_device/pump_device.cpp b/components/esp_matter/data_model/generated/device_types/pump_device/pump_device.cpp new file mode 100644 index 000000000..ea9969839 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/pump_device/pump_device.cpp @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace pump { +uint32_t get_device_type_id() +{ + return ESP_MATTER_PUMP_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_PUMP_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("pump", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("pump", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("pump", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + cluster::pump_configuration_and_control::create(endpoint, &(config->pump_configuration_and_control), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* pump */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/pump_device/pump_device.h b/components/esp_matter/data_model/generated/device_types/pump_device/pump_device.h new file mode 100644 index 000000000..ec90646e0 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/pump_device/pump_device.h @@ -0,0 +1,47 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include + +#include + +#define ESP_MATTER_PUMP_DEVICE_TYPE_ID 0x0303 +#define ESP_MATTER_PUMP_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace pump { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::on_off::config_t on_off; + cluster::pump_configuration_and_control::config_t pump_configuration_and_control; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* pump */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/rain_sensor_device/rain_sensor_device.cpp b/components/esp_matter/data_model/generated/device_types/rain_sensor_device/rain_sensor_device.cpp new file mode 100644 index 000000000..45825e8bb --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/rain_sensor_device/rain_sensor_device.cpp @@ -0,0 +1,65 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace rain_sensor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("rain_sensor", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("rain_sensor", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("rain_sensor", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster_t *boolean_state = cluster::boolean_state::create(endpoint, &(config->boolean_state), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(boolean_state != NULL, ESP_FAIL, ESP_LOGE("rain_sensor", "Failed to create cluster: boolean_state")); + cluster::boolean_state::event::create_state_change(boolean_state); + return ESP_OK; +} + +} /* rain_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/rain_sensor_device/rain_sensor_device.h b/components/esp_matter/data_model/generated/device_types/rain_sensor_device/rain_sensor_device.h new file mode 100644 index 000000000..d49fb3a91 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/rain_sensor_device/rain_sensor_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_ID 0x0044 +#define ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace rain_sensor { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::boolean_state::config_t boolean_state; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* rain_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/refrigerator_device/refrigerator_device.cpp b/components/esp_matter/data_model/generated/device_types/refrigerator_device/refrigerator_device.cpp new file mode 100644 index 000000000..9164ebffd --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/refrigerator_device/refrigerator_device.cpp @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace refrigerator { +uint32_t get_device_type_id() +{ + return ESP_MATTER_REFRIGERATOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_REFRIGERATOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("refrigerator", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("refrigerator", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("refrigerator", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + return ESP_OK; +} + +} /* refrigerator */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/refrigerator_device/refrigerator_device.h b/components/esp_matter/data_model/generated/device_types/refrigerator_device/refrigerator_device.h new file mode 100644 index 000000000..1723434fe --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/refrigerator_device/refrigerator_device.h @@ -0,0 +1,41 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include + +#include + +#define ESP_MATTER_REFRIGERATOR_DEVICE_TYPE_ID 0x0070 +#define ESP_MATTER_REFRIGERATOR_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace refrigerator { + +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* refrigerator */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/robotic_vacuum_cleaner_device/robotic_vacuum_cleaner_device.cpp b/components/esp_matter/data_model/generated/device_types/robotic_vacuum_cleaner_device/robotic_vacuum_cleaner_device.cpp new file mode 100644 index 000000000..6ec364308 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/robotic_vacuum_cleaner_device/robotic_vacuum_cleaner_device.cpp @@ -0,0 +1,66 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace robotic_vacuum_cleaner { +uint32_t get_device_type_id() +{ + return ESP_MATTER_ROBOTIC_VACUUM_CLEANER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_ROBOTIC_VACUUM_CLEANER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("robotic_vacuum_cleaner", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("robotic_vacuum_cleaner", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("robotic_vacuum_cleaner", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::rvc_run_mode::create(endpoint, &(config->rvc_run_mode), CLUSTER_FLAG_SERVER); + cluster_t *rvc_operational_state = cluster::rvc_operational_state::create(endpoint, &(config->rvc_operational_state), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(rvc_operational_state != NULL, ESP_FAIL, ESP_LOGE("robotic_vacuum_cleaner", "Failed to create cluster: rvc_operational_state")); + cluster::rvc_operational_state::event::create_operation_completion(rvc_operational_state); + return ESP_OK; +} + +} /* robotic_vacuum_cleaner */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/robotic_vacuum_cleaner_device/robotic_vacuum_cleaner_device.h b/components/esp_matter/data_model/generated/device_types/robotic_vacuum_cleaner_device/robotic_vacuum_cleaner_device.h new file mode 100644 index 000000000..b0e57a67d --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/robotic_vacuum_cleaner_device/robotic_vacuum_cleaner_device.h @@ -0,0 +1,47 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include + +#include + +#define ESP_MATTER_ROBOTIC_VACUUM_CLEANER_DEVICE_TYPE_ID 0x0074 +#define ESP_MATTER_ROBOTIC_VACUUM_CLEANER_DEVICE_TYPE_VERSION 4 + +namespace esp_matter { +namespace endpoint { +namespace robotic_vacuum_cleaner { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::rvc_run_mode::config_t rvc_run_mode; + cluster::rvc_operational_state::config_t rvc_operational_state; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* robotic_vacuum_cleaner */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/room_air_conditioner_device/room_air_conditioner_device.cpp b/components/esp_matter/data_model/generated/device_types/room_air_conditioner_device/room_air_conditioner_device.cpp new file mode 100644 index 000000000..541e1da8d --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/room_air_conditioner_device/room_air_conditioner_device.cpp @@ -0,0 +1,66 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace room_air_conditioner { +uint32_t get_device_type_id() +{ + return ESP_MATTER_ROOM_AIR_CONDITIONER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_ROOM_AIR_CONDITIONER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("room_air_conditioner", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("room_air_conditioner", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("room_air_conditioner", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster_t *on_off = cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(on_off != NULL, ESP_FAIL, ESP_LOGE("room_air_conditioner", "Failed to create cluster: on_off")); + cluster::on_off::feature::dead_front_behavior::add(on_off); + cluster::thermostat::create(endpoint, &(config->thermostat), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* room_air_conditioner */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/room_air_conditioner_device/room_air_conditioner_device.h b/components/esp_matter/data_model/generated/device_types/room_air_conditioner_device/room_air_conditioner_device.h new file mode 100644 index 000000000..fa1a8929e --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/room_air_conditioner_device/room_air_conditioner_device.h @@ -0,0 +1,47 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include + +#include + +#define ESP_MATTER_ROOM_AIR_CONDITIONER_DEVICE_TYPE_ID 0x0072 +#define ESP_MATTER_ROOM_AIR_CONDITIONER_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace room_air_conditioner { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::on_off::config_t on_off; + cluster::thermostat::config_t thermostat; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* room_air_conditioner */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/root_node_device/root_node_device.cpp b/components/esp_matter/data_model/generated/device_types/root_node_device/root_node_device.cpp new file mode 100644 index 000000000..32f6f9a5c --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/root_node_device/root_node_device.cpp @@ -0,0 +1,81 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace root_node { +uint32_t get_device_type_id() +{ + return ESP_MATTER_ROOT_NODE_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_ROOT_NODE_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("root_node", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("root_node", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("root_node", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::access_control::create(endpoint, &(config->access_control), CLUSTER_FLAG_SERVER); + cluster::basic_information::create(endpoint, &(config->basic_information), CLUSTER_FLAG_SERVER); + cluster::general_commissioning::create(endpoint, &(config->general_commissioning), CLUSTER_FLAG_SERVER); +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI + config->network_commissioning.feature_flags |= cluster::network_commissioning::feature::wi_fi_network_interface::get_id(); +#elif CHIP_DEVICE_CONFIG_ENABLE_THREAD + config->network_commissioning.feature_flags |= cluster::network_commissioning::feature::thread_network_interface::get_id(); +#else + config->network_commissioning.feature_flags |= cluster::network_commissioning::feature::ethernet_network_interface::get_id(); +#endif + cluster::network_commissioning::create(endpoint, &(config->network_commissioning), CLUSTER_FLAG_SERVER); +#endif // CONFIG_CUSTOM_NETWORK_CONFIG + cluster::general_diagnostics::create(endpoint, &(config->general_diagnostics), CLUSTER_FLAG_SERVER); + cluster::administrator_commissioning::create(endpoint, &(config->administrator_commissioning), CLUSTER_FLAG_SERVER); + cluster::operational_credentials::create(endpoint, &(config->operational_credentials), CLUSTER_FLAG_SERVER); + cluster::group_key_management::create(endpoint, &(config->group_key_management), CLUSTER_FLAG_SERVER); +#if CHIP_CONFIG_ENABLE_ICD_SERVER + cluster::icd_management::create(endpoint, &(config->icd_management), CLUSTER_FLAG_SERVER); +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER + return ESP_OK; +} + +} /* root_node */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/root_node_device/root_node_device.h b/components/esp_matter/data_model/generated/device_types/root_node_device/root_node_device.h new file mode 100644 index 000000000..cda311401 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/root_node_device/root_node_device.h @@ -0,0 +1,59 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_ROOT_NODE_DEVICE_TYPE_ID 0x0016 +#define ESP_MATTER_ROOT_NODE_DEVICE_TYPE_VERSION 4 + +namespace esp_matter { +namespace endpoint { +namespace root_node { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::access_control::config_t access_control; + cluster::basic_information::config_t basic_information; + cluster::general_commissioning::config_t general_commissioning; + cluster::network_commissioning::config_t network_commissioning; + cluster::general_diagnostics::config_t general_diagnostics; + cluster::administrator_commissioning::config_t administrator_commissioning; + cluster::operational_credentials::config_t operational_credentials; + cluster::group_key_management::config_t group_key_management; + cluster::icd_management::config_t icd_management; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* root_node */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/secondary_network_interface_device/secondary_network_interface_device.cpp b/components/esp_matter/data_model/generated/device_types/secondary_network_interface_device/secondary_network_interface_device.cpp new file mode 100644 index 000000000..fc0ec45ea --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/secondary_network_interface_device/secondary_network_interface_device.cpp @@ -0,0 +1,71 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace secondary_network_interface { +uint32_t get_device_type_id() +{ + return ESP_MATTER_SECONDARY_NETWORK_INTERFACE_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_SECONDARY_NETWORK_INTERFACE_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("secondary_network_interface", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("secondary_network_interface", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("secondary_network_interface", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI + config->network_commissioning.feature_flags |= cluster::network_commissioning::feature::wi_fi_network_interface::get_id(); +#elif CHIP_DEVICE_CONFIG_ENABLE_THREAD + config->network_commissioning.feature_flags |= cluster::network_commissioning::feature::thread_network_interface::get_id(); +#else + config->network_commissioning.feature_flags |= cluster::network_commissioning::feature::ethernet_network_interface::get_id(); +#endif + cluster::network_commissioning::create(endpoint, &(config->network_commissioning), CLUSTER_FLAG_SERVER); +#endif // CONFIG_CUSTOM_NETWORK_CONFIG + return ESP_OK; +} + +} /* secondary_network_interface */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/secondary_network_interface_device/secondary_network_interface_device.h b/components/esp_matter/data_model/generated/device_types/secondary_network_interface_device/secondary_network_interface_device.h new file mode 100644 index 000000000..f965d1ad9 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/secondary_network_interface_device/secondary_network_interface_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_SECONDARY_NETWORK_INTERFACE_DEVICE_TYPE_ID 0x0019 +#define ESP_MATTER_SECONDARY_NETWORK_INTERFACE_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace secondary_network_interface { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::network_commissioning::config_t network_commissioning; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* secondary_network_interface */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/smoke_co_alarm_device/smoke_co_alarm_device.cpp b/components/esp_matter/data_model/generated/device_types/smoke_co_alarm_device/smoke_co_alarm_device.cpp new file mode 100644 index 000000000..2cc037384 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/smoke_co_alarm_device/smoke_co_alarm_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace smoke_co_alarm { +uint32_t get_device_type_id() +{ + return ESP_MATTER_SMOKE_CO_ALARM_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_SMOKE_CO_ALARM_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("smoke_co_alarm", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("smoke_co_alarm", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("smoke_co_alarm", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::smoke_co_alarm::create(endpoint, &(config->smoke_co_alarm), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* smoke_co_alarm */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/smoke_co_alarm_device/smoke_co_alarm_device.h b/components/esp_matter/data_model/generated/device_types/smoke_co_alarm_device/smoke_co_alarm_device.h new file mode 100644 index 000000000..05451181c --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/smoke_co_alarm_device/smoke_co_alarm_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_SMOKE_CO_ALARM_DEVICE_TYPE_ID 0x0076 +#define ESP_MATTER_SMOKE_CO_ALARM_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace smoke_co_alarm { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::smoke_co_alarm::config_t smoke_co_alarm; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* smoke_co_alarm */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/snapshot_camera_device/snapshot_camera_device.cpp b/components/esp_matter/data_model/generated/device_types/snapshot_camera_device/snapshot_camera_device.cpp new file mode 100644 index 000000000..a8b707d21 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/snapshot_camera_device/snapshot_camera_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace snapshot_camera { +uint32_t get_device_type_id() +{ + return ESP_MATTER_SNAPSHOT_CAMERA_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_SNAPSHOT_CAMERA_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("snapshot_camera", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("snapshot_camera", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("snapshot_camera", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + config->camera_av_stream_management.feature_flags |= cluster::camera_av_stream_management::feature::snapshot::get_id(); + cluster::camera_av_stream_management::create(endpoint, &(config->camera_av_stream_management), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* snapshot_camera */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/snapshot_camera_device/snapshot_camera_device.h b/components/esp_matter/data_model/generated/device_types/snapshot_camera_device/snapshot_camera_device.h new file mode 100644 index 000000000..6571279a7 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/snapshot_camera_device/snapshot_camera_device.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_SNAPSHOT_CAMERA_DEVICE_TYPE_ID 0x0145 +#define ESP_MATTER_SNAPSHOT_CAMERA_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace snapshot_camera { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::camera_av_stream_management::config_t camera_av_stream_management; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* snapshot_camera */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/soil_sensor_device/soil_sensor_device.cpp b/components/esp_matter/data_model/generated/device_types/soil_sensor_device/soil_sensor_device.cpp new file mode 100644 index 000000000..36b4bb4ce --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/soil_sensor_device/soil_sensor_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace soil_sensor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_SOIL_SENSOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_SOIL_SENSOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("soil_sensor", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("soil_sensor", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("soil_sensor", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::soil_measurement::create(endpoint, &(config->soil_measurement), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* soil_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/soil_sensor_device/soil_sensor_device.h b/components/esp_matter/data_model/generated/device_types/soil_sensor_device/soil_sensor_device.h new file mode 100644 index 000000000..3551b112b --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/soil_sensor_device/soil_sensor_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_SOIL_SENSOR_DEVICE_TYPE_ID 0x0045 +#define ESP_MATTER_SOIL_SENSOR_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace soil_sensor { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::soil_measurement::config_t soil_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* soil_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/solar_power_device/solar_power_device.cpp b/components/esp_matter/data_model/generated/device_types/solar_power_device/solar_power_device.cpp new file mode 100644 index 000000000..6bed63dbf --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/solar_power_device/solar_power_device.cpp @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace solar_power { +uint32_t get_device_type_id() +{ + return ESP_MATTER_SOLAR_POWER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_SOLAR_POWER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("solar_power", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("solar_power", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("solar_power", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + return ESP_OK; +} + +} /* solar_power */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/solar_power_device/solar_power_device.h b/components/esp_matter/data_model/generated/device_types/solar_power_device/solar_power_device.h new file mode 100644 index 000000000..78ead6fab --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/solar_power_device/solar_power_device.h @@ -0,0 +1,41 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include + +#include + +#define ESP_MATTER_SOLAR_POWER_DEVICE_TYPE_ID 0x0017 +#define ESP_MATTER_SOLAR_POWER_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace solar_power { + +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* solar_power */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/speaker_device/speaker_device.cpp b/components/esp_matter/data_model/generated/device_types/speaker_device/speaker_device.cpp new file mode 100644 index 000000000..5416f1ad0 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/speaker_device/speaker_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace speaker { +uint32_t get_device_type_id() +{ + return ESP_MATTER_SPEAKER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_SPEAKER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("speaker", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("speaker", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("speaker", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); + cluster::level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* speaker */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/speaker_device/speaker_device.h b/components/esp_matter/data_model/generated/device_types/speaker_device/speaker_device.h new file mode 100644 index 000000000..3b9e9f07e --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/speaker_device/speaker_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_SPEAKER_DEVICE_TYPE_ID 0x0022 +#define ESP_MATTER_SPEAKER_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace speaker { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::on_off::config_t on_off; + cluster::level_control::config_t level_control; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* speaker */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/temperature_controlled_cabinet_device/temperature_controlled_cabinet_device.cpp b/components/esp_matter/data_model/generated/device_types/temperature_controlled_cabinet_device/temperature_controlled_cabinet_device.cpp new file mode 100644 index 000000000..e4068d164 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/temperature_controlled_cabinet_device/temperature_controlled_cabinet_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace temperature_controlled_cabinet { +uint32_t get_device_type_id() +{ + return ESP_MATTER_TEMPERATURE_CONTROLLED_CABINET_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_TEMPERATURE_CONTROLLED_CABINET_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("temperature_controlled_cabinet", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("temperature_controlled_cabinet", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("temperature_controlled_cabinet", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + config->temperature_control.feature_flags |= cluster::temperature_control::feature::temperature_number::get_id(); + cluster::temperature_control::create(endpoint, &(config->temperature_control), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* temperature_controlled_cabinet */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/temperature_controlled_cabinet_device/temperature_controlled_cabinet_device.h b/components/esp_matter/data_model/generated/device_types/temperature_controlled_cabinet_device/temperature_controlled_cabinet_device.h new file mode 100644 index 000000000..f311e776b --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/temperature_controlled_cabinet_device/temperature_controlled_cabinet_device.h @@ -0,0 +1,44 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include + +#include + +#define ESP_MATTER_TEMPERATURE_CONTROLLED_CABINET_DEVICE_TYPE_ID 0x0071 +#define ESP_MATTER_TEMPERATURE_CONTROLLED_CABINET_DEVICE_TYPE_VERSION 5 + +namespace esp_matter { +namespace endpoint { +namespace temperature_controlled_cabinet { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::temperature_control::config_t temperature_control; + cluster::temperature_control::feature::temperature_number::config_t temperature_control_temperature_number; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* temperature_controlled_cabinet */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/temperature_sensor_device/temperature_sensor_device.cpp b/components/esp_matter/data_model/generated/device_types/temperature_sensor_device/temperature_sensor_device.cpp new file mode 100644 index 000000000..72dec8e93 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/temperature_sensor_device/temperature_sensor_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace temperature_sensor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("temperature_sensor", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("temperature_sensor", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("temperature_sensor", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::temperature_measurement::create(endpoint, &(config->temperature_measurement), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* temperature_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/temperature_sensor_device/temperature_sensor_device.h b/components/esp_matter/data_model/generated/device_types/temperature_sensor_device/temperature_sensor_device.h new file mode 100644 index 000000000..1bde100d9 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/temperature_sensor_device/temperature_sensor_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_ID 0x0302 +#define ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_VERSION 3 + +namespace esp_matter { +namespace endpoint { +namespace temperature_sensor { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::temperature_measurement::config_t temperature_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* temperature_sensor */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/thermostat_controller_device/thermostat_controller_device.cpp b/components/esp_matter/data_model/generated/device_types/thermostat_controller_device/thermostat_controller_device.cpp new file mode 100644 index 000000000..b0267a646 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/thermostat_controller_device/thermostat_controller_device.cpp @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace thermostat_controller { +uint32_t get_device_type_id() +{ + return ESP_MATTER_THERMOSTAT_CONTROLLER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_THERMOSTAT_CONTROLLER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("thermostat_controller", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("thermostat_controller", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("thermostat_controller", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::thermostat::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* thermostat_controller */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/thermostat_controller_device/thermostat_controller_device.h b/components/esp_matter/data_model/generated/device_types/thermostat_controller_device/thermostat_controller_device.h new file mode 100644 index 000000000..40d635564 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/thermostat_controller_device/thermostat_controller_device.h @@ -0,0 +1,44 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_THERMOSTAT_CONTROLLER_DEVICE_TYPE_ID 0x030A +#define ESP_MATTER_THERMOSTAT_CONTROLLER_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace thermostat_controller { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* thermostat_controller */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/thermostat_device/thermostat_device.cpp b/components/esp_matter/data_model/generated/device_types/thermostat_device/thermostat_device.cpp new file mode 100644 index 000000000..4b4673d75 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/thermostat_device/thermostat_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace thermostat { +uint32_t get_device_type_id() +{ + return ESP_MATTER_THERMOSTAT_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_THERMOSTAT_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("thermostat", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("thermostat", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("thermostat", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::thermostat::create(endpoint, &(config->thermostat), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* thermostat */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/thermostat_device/thermostat_device.h b/components/esp_matter/data_model/generated/device_types/thermostat_device/thermostat_device.h new file mode 100644 index 000000000..67f72e485 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/thermostat_device/thermostat_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_THERMOSTAT_DEVICE_TYPE_ID 0x0301 +#define ESP_MATTER_THERMOSTAT_DEVICE_TYPE_VERSION 4 + +namespace esp_matter { +namespace endpoint { +namespace thermostat { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::thermostat::config_t thermostat; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* thermostat */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/thread_border_router_device/thread_border_router_device.cpp b/components/esp_matter/data_model/generated/device_types/thread_border_router_device/thread_border_router_device.cpp new file mode 100644 index 000000000..688f1f8ae --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/thread_border_router_device/thread_border_router_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace thread_border_router { +uint32_t get_device_type_id() +{ + return ESP_MATTER_THREAD_BORDER_ROUTER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_THREAD_BORDER_ROUTER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("thread_border_router", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("thread_border_router", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("thread_border_router", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::thread_network_diagnostics::create(endpoint, &(config->thread_network_diagnostics), CLUSTER_FLAG_SERVER); + cluster::thread_border_router_management::create(endpoint, &(config->thread_border_router_management), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* thread_border_router */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/thread_border_router_device/thread_border_router_device.h b/components/esp_matter/data_model/generated/device_types/thread_border_router_device/thread_border_router_device.h new file mode 100644 index 000000000..e19651917 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/thread_border_router_device/thread_border_router_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_THREAD_BORDER_ROUTER_DEVICE_TYPE_ID 0x0091 +#define ESP_MATTER_THREAD_BORDER_ROUTER_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace thread_border_router { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::thread_network_diagnostics::config_t thread_network_diagnostics; + cluster::thread_border_router_management::config_t thread_border_router_management; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* thread_border_router */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/video_doorbell_device/video_doorbell_device.cpp b/components/esp_matter/data_model/generated/device_types/video_doorbell_device/video_doorbell_device.cpp new file mode 100644 index 000000000..f2c3d5479 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/video_doorbell_device/video_doorbell_device.cpp @@ -0,0 +1,61 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace video_doorbell { +uint32_t get_device_type_id() +{ + return ESP_MATTER_VIDEO_DOORBELL_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_VIDEO_DOORBELL_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("video_doorbell", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("video_doorbell", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("video_doorbell", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + return ESP_OK; +} + +} /* video_doorbell */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/video_doorbell_device/video_doorbell_device.h b/components/esp_matter/data_model/generated/device_types/video_doorbell_device/video_doorbell_device.h new file mode 100644 index 000000000..2e3af1d3c --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/video_doorbell_device/video_doorbell_device.h @@ -0,0 +1,41 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include + +#include + +#define ESP_MATTER_VIDEO_DOORBELL_DEVICE_TYPE_ID 0x0143 +#define ESP_MATTER_VIDEO_DOORBELL_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace video_doorbell { + +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* video_doorbell */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/video_remote_control_device/video_remote_control_device.cpp b/components/esp_matter/data_model/generated/device_types/video_remote_control_device/video_remote_control_device.cpp new file mode 100644 index 000000000..a458a6f19 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/video_remote_control_device/video_remote_control_device.cpp @@ -0,0 +1,66 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace video_remote_control { +uint32_t get_device_type_id() +{ + return ESP_MATTER_VIDEO_REMOTE_CONTROL_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_VIDEO_REMOTE_CONTROL_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("video_remote_control", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("video_remote_control", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("video_remote_control", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::on_off::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::media_playback::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + cluster::keypad_input::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* video_remote_control */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/video_remote_control_device/video_remote_control_device.h b/components/esp_matter/data_model/generated/device_types/video_remote_control_device/video_remote_control_device.h new file mode 100644 index 000000000..75c5d0879 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/video_remote_control_device/video_remote_control_device.h @@ -0,0 +1,46 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include +#include + +#include + +#define ESP_MATTER_VIDEO_REMOTE_CONTROL_DEVICE_TYPE_ID 0x002A +#define ESP_MATTER_VIDEO_REMOTE_CONTROL_DEVICE_TYPE_VERSION 2 + +namespace esp_matter { +namespace endpoint { +namespace video_remote_control { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* video_remote_control */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/water_freeze_detector_device/water_freeze_detector_device.cpp b/components/esp_matter/data_model/generated/device_types/water_freeze_detector_device/water_freeze_detector_device.cpp new file mode 100644 index 000000000..aad4da5d3 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/water_freeze_detector_device/water_freeze_detector_device.cpp @@ -0,0 +1,65 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace water_freeze_detector { +uint32_t get_device_type_id() +{ + return ESP_MATTER_WATER_FREEZE_DETECTOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_WATER_FREEZE_DETECTOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("water_freeze_detector", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("water_freeze_detector", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("water_freeze_detector", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster_t *boolean_state = cluster::boolean_state::create(endpoint, &(config->boolean_state), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(boolean_state != NULL, ESP_FAIL, ESP_LOGE("water_freeze_detector", "Failed to create cluster: boolean_state")); + cluster::boolean_state::event::create_state_change(boolean_state); + return ESP_OK; +} + +} /* water_freeze_detector */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/water_freeze_detector_device/water_freeze_detector_device.h b/components/esp_matter/data_model/generated/device_types/water_freeze_detector_device/water_freeze_detector_device.h new file mode 100644 index 000000000..e7095b29f --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/water_freeze_detector_device/water_freeze_detector_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_WATER_FREEZE_DETECTOR_DEVICE_TYPE_ID 0x0041 +#define ESP_MATTER_WATER_FREEZE_DETECTOR_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace water_freeze_detector { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::boolean_state::config_t boolean_state; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* water_freeze_detector */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/water_heater_device/water_heater_device.cpp b/components/esp_matter/data_model/generated/device_types/water_heater_device/water_heater_device.cpp new file mode 100644 index 000000000..122dde1d2 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/water_heater_device/water_heater_device.cpp @@ -0,0 +1,65 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace water_heater { +uint32_t get_device_type_id() +{ + return ESP_MATTER_WATER_HEATER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_WATER_HEATER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("water_heater", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("water_heater", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("water_heater", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::water_heater_management::create(endpoint, &(config->water_heater_management), CLUSTER_FLAG_SERVER); + cluster::water_heater_mode::create(endpoint, &(config->water_heater_mode), CLUSTER_FLAG_SERVER); + config->thermostat.feature_flags |= cluster::thermostat::feature::heating::get_id(); + cluster::thermostat::create(endpoint, &(config->thermostat), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* water_heater */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/water_heater_device/water_heater_device.h b/components/esp_matter/data_model/generated/device_types/water_heater_device/water_heater_device.h new file mode 100644 index 000000000..98d427a1d --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/water_heater_device/water_heater_device.h @@ -0,0 +1,48 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include +#include + +#include + +#define ESP_MATTER_WATER_HEATER_DEVICE_TYPE_ID 0x050F +#define ESP_MATTER_WATER_HEATER_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace water_heater { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::water_heater_management::config_t water_heater_management; + cluster::water_heater_mode::config_t water_heater_mode; + cluster::thermostat::config_t thermostat; + cluster::thermostat::feature::heating::config_t thermostat_heating; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* water_heater */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/water_leak_detector_device/water_leak_detector_device.cpp b/components/esp_matter/data_model/generated/device_types/water_leak_detector_device/water_leak_detector_device.cpp new file mode 100644 index 000000000..8cfd050b7 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/water_leak_detector_device/water_leak_detector_device.cpp @@ -0,0 +1,65 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace water_leak_detector { +uint32_t get_device_type_id() +{ + return ESP_MATTER_WATER_LEAK_DETECTOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_WATER_LEAK_DETECTOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("water_leak_detector", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("water_leak_detector", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("water_leak_detector", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster_t *boolean_state = cluster::boolean_state::create(endpoint, &(config->boolean_state), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(boolean_state != NULL, ESP_FAIL, ESP_LOGE("water_leak_detector", "Failed to create cluster: boolean_state")); + cluster::boolean_state::event::create_state_change(boolean_state); + return ESP_OK; +} + +} /* water_leak_detector */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/water_leak_detector_device/water_leak_detector_device.h b/components/esp_matter/data_model/generated/device_types/water_leak_detector_device/water_leak_detector_device.h new file mode 100644 index 000000000..faa9b7a35 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/water_leak_detector_device/water_leak_detector_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_WATER_LEAK_DETECTOR_DEVICE_TYPE_ID 0x0043 +#define ESP_MATTER_WATER_LEAK_DETECTOR_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace water_leak_detector { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::boolean_state::config_t boolean_state; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* water_leak_detector */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/water_valve_device/water_valve_device.cpp b/components/esp_matter/data_model/generated/device_types/water_valve_device/water_valve_device.cpp new file mode 100644 index 000000000..393988c81 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/water_valve_device/water_valve_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace water_valve { +uint32_t get_device_type_id() +{ + return ESP_MATTER_WATER_VALVE_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_WATER_VALVE_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("water_valve", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("water_valve", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("water_valve", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::valve_configuration_and_control::create(endpoint, &(config->valve_configuration_and_control), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* water_valve */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/water_valve_device/water_valve_device.h b/components/esp_matter/data_model/generated/device_types/water_valve_device/water_valve_device.h new file mode 100644 index 000000000..37e849332 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/water_valve_device/water_valve_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_WATER_VALVE_DEVICE_TYPE_ID 0x0042 +#define ESP_MATTER_WATER_VALVE_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { +namespace endpoint { +namespace water_valve { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::valve_configuration_and_control::config_t valve_configuration_and_control; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* water_valve */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/window_covering_controller_device/window_covering_controller_device.cpp b/components/esp_matter/data_model/generated/device_types/window_covering_controller_device/window_covering_controller_device.cpp new file mode 100644 index 000000000..55649aeda --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/window_covering_controller_device/window_covering_controller_device.cpp @@ -0,0 +1,64 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace window_covering_controller { +uint32_t get_device_type_id() +{ + return ESP_MATTER_WINDOW_COVERING_CONTROLLER_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_WINDOW_COVERING_CONTROLLER_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("window_covering_controller", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("window_covering_controller", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("window_covering_controller", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::window_covering::create(endpoint, NULL, CLUSTER_FLAG_CLIENT); + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + + return ESP_OK; +} + +} /* window_covering_controller */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/window_covering_controller_device/window_covering_controller_device.h b/components/esp_matter/data_model/generated/device_types/window_covering_controller_device/window_covering_controller_device.h new file mode 100644 index 000000000..10c5683f5 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/window_covering_controller_device/window_covering_controller_device.h @@ -0,0 +1,44 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_WINDOW_COVERING_CONTROLLER_DEVICE_TYPE_ID 0x0203 +#define ESP_MATTER_WINDOW_COVERING_CONTROLLER_DEVICE_TYPE_VERSION 4 + +namespace esp_matter { +namespace endpoint { +namespace window_covering_controller { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::binding::config_t binding; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* window_covering_controller */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/window_covering_device/window_covering_device.cpp b/components/esp_matter/data_model/generated/device_types/window_covering_device/window_covering_device.cpp new file mode 100644 index 000000000..e6ec264a9 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/window_covering_device/window_covering_device.cpp @@ -0,0 +1,63 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace window_covering { +uint32_t get_device_type_id() +{ + return ESP_MATTER_WINDOW_COVERING_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_WINDOW_COVERING_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("window_covering", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("window_covering", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("window_covering", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster::window_covering::create(endpoint, &(config->window_covering), CLUSTER_FLAG_SERVER); + return ESP_OK; +} + +} /* window_covering */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/device_types/window_covering_device/window_covering_device.h b/components/esp_matter/data_model/generated/device_types/window_covering_device/window_covering_device.h new file mode 100644 index 000000000..f46ca3104 --- /dev/null +++ b/components/esp_matter/data_model/generated/device_types/window_covering_device/window_covering_device.h @@ -0,0 +1,45 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +#include +#include + +#include + +#define ESP_MATTER_WINDOW_COVERING_DEVICE_TYPE_ID 0x0202 +#define ESP_MATTER_WINDOW_COVERING_DEVICE_TYPE_VERSION 5 + +namespace esp_matter { +namespace endpoint { +namespace window_covering { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::window_covering::config_t window_covering; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* window_covering */ +} /* endpoint */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/generated/esp_matter_data_model_utils.cpp b/components/esp_matter/data_model/generated/esp_matter_data_model_utils.cpp new file mode 100644 index 000000000..cd5ef2740 --- /dev/null +++ b/components/esp_matter/data_model/generated/esp_matter_data_model_utils.cpp @@ -0,0 +1,168 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include + +static const char *TAG = "data_model"; + +const char feature_policy_strs[2][16] = {"Exactly one", "At least one"}; + +bool validate_features(uint32_t feature_flag, feature_policy policy, + const char *feature_name, std::initializer_list features) +{ + uint8_t count = 0; + for (uint32_t feature : features) { + if (feature & feature_flag) { + count++; + } + } + + bool result = false; + + switch (policy) { + case feature_policy::k_exact_one: + result = count == 1; + break; + case feature_policy::k_at_least_one: + result = count >= 1; + break; + } + + if (!result) { + ESP_LOGE(TAG, "%s of the feature(s) must be supported from (%s)", feature_policy_strs[static_cast(policy)], feature_name); + } + + return result; +} + +namespace esp_matter { +namespace node { + +node_t *create(config_t *config, attribute::callback_t attribute_callback, + identification::callback_t identification_callback, void* priv_data) +{ + node_t *node = create_raw(); + /* Initialize esp-matter nvs partition */ + VerifyOrReturnValue(esp_matter_nvs_init() == ESP_OK, NULL, ESP_LOGE(TAG, "Failed to init esp-matter nvs partition")); + VerifyOrReturnValue(node != nullptr, NULL, ESP_LOGE(TAG, "Could not create node")); + endpoint_t *endpoint = esp_matter::endpoint::root_node::create(node, &(config->root_node), ENDPOINT_FLAG_NONE, priv_data); + if (endpoint == nullptr) { + destroy_raw(); + return NULL; + } + attribute::set_callback(attribute_callback); + identification::set_callback(identification_callback); + return node; +} + +} /* node */ + +namespace cluster { +namespace global { +namespace attribute { +attribute_t *create_cluster_revision(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, chip::app::Clusters::Globals::Attributes::ClusterRevision::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); +} + +attribute_t *create_feature_map(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, chip::app::Clusters::Globals::Attributes::FeatureMap::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); +} +} // namespace attribute +} // namespace global + +esp_err_t update_feature_map(cluster_t *cluster, uint32_t value) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + + /* Get the attribute */ + attribute_t *attribute = attribute::get(cluster, chip::app::Clusters::Globals::Attributes::FeatureMap::Id); + + VerifyOrReturnError(attribute, ESP_ERR_INVALID_STATE, ESP_LOGE(TAG, "Feature map attribute cannot be null")); + + /* Update the value if the attribute already exists */ + esp_matter_attr_val_t val = esp_matter_invalid(NULL); + attribute::get_val(attribute, &val); + val.val.u32 |= value; + /* Here we can't call attribute::update() since the chip stack would not have started yet, since we are + still creating the data model. So, we are directly using attribute::set_val(). */ + return attribute::set_val(attribute, &val); +} + +uint32_t get_feature_map_value(cluster_t *cluster) +{ + esp_matter_attr_val_t val = esp_matter_invalid(NULL); + attribute_t *attribute = attribute::get(cluster, chip::app::Clusters::Globals::Attributes::FeatureMap::Id); + + VerifyOrReturnValue(attribute, 0, ESP_LOGE(TAG, "Feature map attribute cannot be null")); + + attribute::get_val(attribute, &val); + return val.val.u32; +} + +// simple API to abort cluster creation and return NULL +cluster_t *ABORT_CLUSTER_CREATE(cluster_t *cluster) +{ + esp_matter::cluster::destroy(cluster); + assert(false); + return NULL; +} + +} // namespace cluster + +namespace command { + +void dispatch_single_cluster_command(const ConcreteCommandPath &command_path, TLVReader &tlv_data, void *opaque_ptr) +{ + uint16_t endpoint_id = command_path.mEndpointId; + uint32_t cluster_id = command_path.mClusterId; + uint32_t command_id = command_path.mCommandId; + ESP_LOGI(TAG, "Received command 0x%08" PRIX32 " for endpoint 0x%04" PRIX16 "'s cluster 0x%08" PRIX32 "", command_id, endpoint_id, cluster_id); + + cluster_t *cluster = cluster::get(endpoint_id, cluster_id); + VerifyOrReturn(cluster); + command_t *command = get(cluster, command_id, COMMAND_FLAG_ACCEPTED); + VerifyOrReturn(command, ESP_LOGE(TAG, "Command 0x%08" PRIX32 " not found", command_id)); + esp_err_t err = ESP_OK; + TLVReader tlv_reader; + tlv_reader.Init(tlv_data); + if (command) { + callback_t callback = get_user_callback(command); + if (callback) { + err = callback(command_path, tlv_reader, opaque_ptr); + } + callback = get_callback(command); + if ((err == ESP_OK) && callback) { + err = callback(command_path, tlv_data, opaque_ptr); + } + int flags = get_flags(command); + if (flags & COMMAND_FLAG_CUSTOM) { + chip::app::CommandHandler *command_obj = (chip::app::CommandHandler *)opaque_ptr; + if (!command_obj) { + ESP_LOGE(TAG, "Command Object cannot be NULL"); + return; + } + command_obj->AddStatus(command_path, err == ESP_OK ? chip::Protocols::InteractionModel::Status::Success : + chip::Protocols::InteractionModel::Status::Failure); + } + } +} + +} /* command */ +} // namespace esp_matter diff --git a/components/esp_matter/data_model/generated/esp_matter_data_model_utils.h b/components/esp_matter/data_model/generated/esp_matter_data_model_utils.h new file mode 100644 index 000000000..ca6e08be0 --- /dev/null +++ b/components/esp_matter/data_model/generated/esp_matter_data_model_utils.h @@ -0,0 +1,101 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#pragma once +#include +#include +#include +#include +// this space is for feature validation functions + +enum class feature_policy { + k_exact_one = 0, // O.a + k_at_least_one = 1, // 0.a+ +}; + +bool validate_features(uint32_t feature_flag, feature_policy policy, const char *feature_name, + std::initializer_list features); + +namespace esp_matter { + +namespace node { +/** Standard node create + * + * This creates the node, sets the attribute and the identification callbacks and also adds the root node device type, which + * is by default added to endpoint 0 (since this is the first endpoint which is created). + */ + +typedef struct config { + esp_matter::endpoint::root_node::config_t root_node; +} config_t; + +/** + * @param[in] config Configuration of the root node, a pointer to an object of type `node::config_t`. + * @param[in] attribute_callback This callback is called for every attribute update. The callback implementation shall + * handle the desired attributes and return an appropriate error code. If the attribute + * is not of your interest, please do not return an error code and strictly return ESP_OK. + * @param[in] identify_callback This callback is invoked when clients interact with the Identify Cluster. + * In the callback implementation, an endpoint can identify itself. + * (e.g., by flashing an LED or light). + * @param[in] priv_data Private data to send to the node. This parameter is optional + * and defaults to nullptr.This private data can be accessed in the attribute callback + * for the root endpoint only. + */ +node_t *create(config_t *config, attribute::callback_t attribute_callback, + identification::callback_t identify_callback, void* priv_data = nullptr); + +} /* node */ + +namespace cluster { +namespace global { +namespace attribute { +attribute_t *create_cluster_revision(cluster_t *cluster, uint16_t value); +attribute_t *create_feature_map(cluster_t *cluster, uint32_t value); +} // namespace attribute +} // namespace global + +/** Update feature map + * + * Update the feature map for the cluster. + * + * @param[in] cluster Cluster handle. + * @param[in] value Feature map value. + * + * @return ESP_OK on success. + * @return error in case of failure. + */ +esp_err_t update_feature_map(cluster_t *cluster, uint32_t value); + +/** Get feature map value + * + * Get the feature map value for the cluster. + * + * @param[in] cluster Cluster handle. + * + * @return Feature map value on success. + * @return 0 in case of failure. + */ +uint32_t get_feature_map_value(cluster_t *cluster); + +/** Abort cluster creation + * This is primarily used in cluster::create() and if somehow we failed to create cluster then it cleans up the cluster by calling cluster::destroy() and asserts. + * + * @param[in] cluster Cluster handle. + * + * @return Cluster handle on success. + * @return NULL in case of failure. + */ +cluster_t *ABORT_CLUSTER_CREATE(cluster_t *cluster); + +} // namespace cluster +} // namespace esp_matter diff --git a/components/esp_matter/data_model/esp_matter_attribute.cpp b/components/esp_matter/data_model/legacy/esp_matter_attribute.cpp similarity index 99% rename from components/esp_matter/data_model/esp_matter_attribute.cpp rename to components/esp_matter/data_model/legacy/esp_matter_attribute.cpp index 812cbf554..a2bea0971 100644 --- a/components/esp_matter/data_model/esp_matter_attribute.cpp +++ b/components/esp_matter/data_model/legacy/esp_matter_attribute.cpp @@ -13,7 +13,7 @@ // limitations under the License. #include -#include +#include #include #include #include diff --git a/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp b/components/esp_matter/data_model/legacy/esp_matter_attribute_bounds.cpp similarity index 100% rename from components/esp_matter/data_model/esp_matter_attribute_bounds.cpp rename to components/esp_matter/data_model/legacy/esp_matter_attribute_bounds.cpp diff --git a/components/esp_matter/data_model/esp_matter_attribute_bounds.h b/components/esp_matter/data_model/legacy/esp_matter_attribute_bounds.h similarity index 100% rename from components/esp_matter/data_model/esp_matter_attribute_bounds.h rename to components/esp_matter/data_model/legacy/esp_matter_attribute_bounds.h diff --git a/components/esp_matter/data_model/legacy/esp_matter_attribute_impl.h b/components/esp_matter/data_model/legacy/esp_matter_attribute_impl.h new file mode 100644 index 000000000..e39bfcb4b --- /dev/null +++ b/components/esp_matter/data_model/legacy/esp_matter_attribute_impl.h @@ -0,0 +1,1422 @@ +// Copyright 2021 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include + +namespace esp_matter { +namespace cluster { + +/** Specific attribute create APIs + * + * If some standard attribute is not present here, it can be added. + * If a custom attribute needs to be created, the low level esp_matter::attribute::create() API can be used. + */ + +namespace global { +namespace attribute { +attribute_t *create_cluster_revision(cluster_t *cluster, uint16_t value); +attribute_t *create_feature_map(cluster_t *cluster, uint32_t value); +} /* attribute */ +} /* global */ + +namespace descriptor { +namespace attribute { +attribute_t *create_device_type_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_server_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_client_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_parts_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_tag_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_endpoint_unique_id(cluster_t *cluster, uint8_t *value, uint16_t length); +} /* attribute */ +} /* descriptor */ + +namespace actions { +namespace attribute { + +constexpr uint16_t k_max_setup_url_length = 256; + +attribute_t *create_action_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_endpoint_lists(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_setup_url(cluster_t *cluster, char *value, uint16_t length); +} /* attribute */ +} /* actions */ + +namespace access_control { +namespace attribute { +attribute_t *create_acl(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_extension(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_subjects_per_access_control_entry(cluster_t *cluster, uint16_t value); +attribute_t *create_targets_per_access_control_entry(cluster_t *cluster, uint16_t value); +attribute_t *create_access_control_entries_per_fabric(cluster_t *cluster, uint16_t value); +#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS +attribute_t *create_commissioning_arl(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_arl(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +#endif +} /* attribute */ +} /* access_control */ + +namespace basic_information { +constexpr uint8_t k_max_node_label_length = 32; + +namespace attribute { +attribute_t *create_data_model_revision(cluster_t *cluster, uint16_t value); +attribute_t *create_vendor_name(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_vendor_id(cluster_t *cluster, uint16_t value); +attribute_t *create_product_name(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_product_id(cluster_t *cluster, uint16_t value); +attribute_t *create_node_label(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_location(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_hardware_version(cluster_t *cluster, uint16_t value); +attribute_t *create_hardware_version_string(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_software_version(cluster_t *cluster, uint32_t value); +attribute_t *create_software_version_string(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_unique_id(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_capability_minima(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_specification_version(cluster_t *cluster, uint32_t value); +attribute_t *create_max_paths_per_invoke(cluster_t *cluster, uint16_t value); +attribute_t *create_configuration_version(cluster_t *cluster, uint32_t value); + +/** These attributes are optional for the cluster, but when added to this cluster, the value is maintained internally. + * If the attributes are added in some other cluster, then the value is not maintained internally. + **/ +attribute_t *create_manufacturing_date(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_part_number(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_product_url(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_product_label(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_serial_number(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_local_config_disabled(cluster_t *cluster, bool value); +attribute_t *create_reachable(cluster_t *cluster, bool value); +attribute_t *create_product_appearance(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +} /* attribute */ +} /* basic_information */ + +namespace binding { +namespace attribute { +attribute_t *create_binding(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +} /* attribute */ +} /* binding */ + +namespace ota_software_update_requestor { +namespace attribute { +attribute_t *create_default_ota_providers(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_update_possible(cluster_t *cluster, bool value); +attribute_t *create_update_state(cluster_t *cluster, uint8_t value); +attribute_t *create_update_state_progress(cluster_t *cluster, nullable value); +} /* attribute */ +} /* ota_software_update_requestor */ + +namespace general_commissioning { +namespace attribute { +attribute_t *create_breadcrumb(cluster_t *cluster, uint64_t value); +attribute_t *create_basic_commissioning_info(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_regulatory_config(cluster_t *cluster, uint8_t value); +attribute_t *create_location_capability(cluster_t *cluster, uint8_t value); +attribute_t *create_supports_concurrent_connection(cluster_t *cluster, bool value); +attribute_t *create_tc_accepted_version(cluster_t *cluster, uint16_t value); +attribute_t *create_tc_min_required_version(cluster_t *cluster, uint16_t value); +attribute_t *create_tc_acknowledgements(cluster_t *cluster, uint16_t value); +attribute_t *create_tc_acknowledgements_required(cluster_t *cluster, bool value); +attribute_t *create_tc_update_deadline(cluster_t *cluster, nullable value); +} /* attribute */ +} /* general_commissioning */ + +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG +namespace network_commissioning { +namespace attribute { +attribute_t *create_max_networks(cluster_t *cluster, uint8_t value); +attribute_t *create_networks(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_scan_max_time_seconds(cluster_t *cluster, uint8_t value); +attribute_t *create_connect_max_time_seconds(cluster_t *cluster, uint8_t value); +attribute_t *create_interface_enabled(cluster_t *cluster, bool value); +attribute_t *create_last_networking_status(cluster_t *cluster, nullable value); +attribute_t *create_last_network_id(cluster_t *cluster, uint8_t *value, uint16_t length); +attribute_t *create_last_connect_error_value(cluster_t *cluster, nullable value); +attribute_t *create_supported_wifi_bands(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_supported_thread_features(cluster_t *cluster, uint16_t value); +attribute_t *create_thread_version(cluster_t *cluster, uint16_t value); +} /* attribute */ +} /* network_commissioning */ +#endif // CONFIG_CUSTOM_NETWORK_CONFIG + +namespace general_diagnostics { +namespace attribute { +attribute_t *create_network_interfaces(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_reboot_count(cluster_t *cluster, uint16_t value); +attribute_t *create_up_time(cluster_t *cluster, uint64_t value); +attribute_t *create_total_operational_hours(cluster_t *cluster, uint32_t value); +attribute_t *create_boot_reason(cluster_t *cluster, uint8_t value); +attribute_t *create_active_hardware_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_active_radio_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_active_network_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_test_event_triggers_enabled(cluster_t *cluster, bool value); +} /* attribute */ +} /* general_diagnostics */ + +namespace software_diagnostics { +namespace attribute { +attribute_t *create_current_heap_high_watermark(cluster_t *cluster, uint64_t value); +attribute_t *create_thread_metrics(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_current_heap_free(cluster_t *cluster, uint64_t value); +attribute_t *create_current_heap_used(cluster_t *cluster, uint64_t value); +} /* attribute */ +} /* software_diagnostics */ + +namespace administrator_commissioning { +namespace attribute { +attribute_t *create_window_status(cluster_t *cluster, uint8_t value); +attribute_t *create_admin_fabric_index(cluster_t *cluster, uint16_t value); +attribute_t *create_admin_vendor_id(cluster_t *cluster, uint16_t value); +} /* attribute */ +} /* administrator_commissioning */ + +namespace operational_credentials { +namespace attribute { +attribute_t *create_nocs(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_fabrics(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_supported_fabrics(cluster_t *cluster, uint8_t value); +attribute_t *create_commissioned_fabrics(cluster_t *cluster, uint8_t value); +attribute_t *create_trusted_root_certificates(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_current_fabric_index(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* operational_credentials */ + +namespace group_key_management { +namespace attribute { +attribute_t *create_group_key_map(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_group_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_max_groups_per_fabric(cluster_t *cluster, uint16_t value); +attribute_t *create_max_group_keys_per_fabric(cluster_t *cluster, uint16_t value); +} /* attribute */ +} /* group_key_management */ + +namespace icd_management { +namespace attribute { +constexpr uint8_t k_user_active_mode_trigger_instruction_length = 128; + +attribute_t *create_idle_mode_duration(cluster_t *cluster, uint32_t value); +attribute_t *create_active_mode_duration(cluster_t *cluster, uint32_t value); +attribute_t *create_active_mode_threshold(cluster_t *cluster, uint16_t value); +attribute_t *create_registered_clients(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_icd_counter(cluster_t *cluster, uint32_t value); +attribute_t *create_clients_supported_per_fabric(cluster_t *cluster, uint16_t value); +attribute_t *create_user_active_mode_trigger_hint(cluster_t *cluster, uint32_t value); +attribute_t *create_user_active_mode_trigger_instruction(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_maximum_check_in_backoff(cluster_t *cluster, uint32_t value); +} /* attribute */ +} /* icd_management */ + +namespace wifi_network_diagnostics { +namespace attribute { +attribute_t *create_bssid(cluster_t *cluster, uint8_t *value, uint16_t length); +attribute_t *create_security_type(cluster_t *cluster, nullable value); +attribute_t *create_wifi_version(cluster_t *cluster, nullable value); +attribute_t *create_channel_number(cluster_t *cluster, nullable value); +attribute_t *create_rssi(cluster_t *cluster, nullable value); + +/** These attributes are optional for the cluster, but when added to this cluster, the value is maintained internally. + * If the attributes are added in some other cluster, then the value is not maintained internally. + **/ +attribute_t *create_beacon_lost_count(cluster_t *cluster, nullable value); +attribute_t *create_beacon_rx_count(cluster_t *cluster, nullable value); +attribute_t *create_packet_multicast_rx_count(cluster_t *cluster, nullable value); +attribute_t *create_packet_multicast_tx_count(cluster_t *cluster, nullable value); +attribute_t *create_packet_unicast_rx_count(cluster_t *cluster, nullable value); +attribute_t *create_packet_unicast_tx_count(cluster_t *cluster, nullable value); +attribute_t *create_current_max_rate(cluster_t *cluster, nullable value); +attribute_t *create_overrun_count(cluster_t *cluster, nullable value); +} /* attribute */ +} /* wifi_network_diagnostics */ + +namespace thread_network_diagnostics { +namespace attribute { +attribute_t *create_channel(cluster_t *cluster, nullable value); +attribute_t *create_routing_role(cluster_t *cluster, nullable value); +attribute_t *create_network_name(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_pan_id(cluster_t *cluster, nullable value); +attribute_t *create_extended_pan_id(cluster_t *cluster, nullable value); +attribute_t *create_mesh_local_prefix(cluster_t *cluster, uint8_t *value, uint16_t length); +attribute_t *create_neighbor_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_route_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_partition_id(cluster_t *cluster, nullable value); +attribute_t *create_weighting(cluster_t *cluster, nullable value); +attribute_t *create_data_version(cluster_t *cluster, nullable value); +attribute_t *create_stable_data_version(cluster_t *cluster, nullable value); +attribute_t *create_leader_router_id(cluster_t *cluster, nullable value); +attribute_t *create_security_policy(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_channel_page0_mask(cluster_t *cluster, uint8_t *value, uint16_t length); +attribute_t *create_operational_dataset_components(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_active_network_faults_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_ext_address(cluster_t *cluster, nullable value); +attribute_t *create_rloc16(cluster_t *cluster, nullable value); +attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value); +attribute_t *create_detached_role_count(cluster_t *cluster, uint16_t value); +attribute_t *create_child_role_count(cluster_t *cluster, uint16_t value); +attribute_t *create_router_role_count(cluster_t *cluster, uint16_t value); +attribute_t *create_leader_role_count(cluster_t *cluster, uint16_t value); +attribute_t *create_attach_attempt_count(cluster_t *cluster, uint16_t value); +attribute_t *create_partition_id_change_count(cluster_t *cluster, uint16_t value); +attribute_t *create_better_partition_attach_attempt_count(cluster_t *cluster, uint16_t value); +attribute_t *create_parent_change_count(cluster_t *cluster, uint16_t value); +attribute_t *create_tx_total_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_unicast_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_broadcast_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_ack_requested_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_acked_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_no_ack_requested_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_data_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_data_poll_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_beacon_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_beacon_request_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_other_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_retry_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_direct_max_retry_expiry_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_indirect_max_retry_expiry_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_err_cca_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_err_abort_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_err_busy_channel_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_total_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_unicast_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_broadcast_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_data_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_data_poll_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_beacon_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_beacon_request_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_other_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_address_filtered_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_dest_addr_filtered_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_duplicated_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_no_frame_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_unknown_neighbor_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_invalid_src_addr_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_sec_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_fcs_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_other_count(cluster_t *cluster, uint32_t value); +attribute_t *create_active_timestamp(cluster_t *cluster, nullable value); +attribute_t *create_pending_timestamp(cluster_t *cluster, nullable value); +attribute_t *create_delay(cluster_t *cluster, nullable value); +} /* attribute */ +} /* thread_network_diagnostics */ + +namespace ethernet_network_diagnostics { +namespace attribute { +attribute_t *create_phy_rate(cluster_t *cluster, nullable value); +attribute_t *create_full_duplex(cluster_t *cluster, nullable value); +attribute_t *create_packet_rx_count(cluster_t *cluster, uint64_t value); +attribute_t *create_packet_tx_count(cluster_t *cluster, uint64_t value); +attribute_t *create_tx_err_count(cluster_t *cluster, uint64_t value); +attribute_t *create_collision_count(cluster_t *cluster, uint64_t value); +attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value); +attribute_t *create_carrier_detect(cluster_t *cluster, nullable value); +attribute_t *create_time_since_reset(cluster_t *cluster, uint64_t value); +} /* attribute */ +} /* ethernet_network_diagnostics */ + +namespace bridged_device_basic_information { +constexpr uint8_t k_max_vendor_name_length = 32; +constexpr uint8_t k_max_product_name_length = 32; +constexpr uint8_t k_max_node_label_length = 32; +constexpr uint8_t k_max_hardware_version_string_length = 64; +constexpr uint8_t k_max_software_version_string_length = 64; +constexpr uint8_t k_max_manufacturing_date_length = 16; +constexpr uint8_t k_max_part_number_length = 32; +constexpr uint16_t k_max_product_url_length = 256; +constexpr uint8_t k_max_product_label_length = 64; +constexpr uint8_t k_max_serial_number_length = 32; +constexpr uint8_t k_max_unique_id_length = 32; + +namespace attribute { +attribute_t *create_vendor_name(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_vendor_id(cluster_t *cluster, uint16_t value); +attribute_t *create_product_name(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_product_id(cluster_t *cluster, uint16_t value); +attribute_t *create_node_label(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_hardware_version(cluster_t *cluster, uint16_t value); +attribute_t *create_hardware_version_string(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_software_version(cluster_t *cluster, uint32_t value); +attribute_t *create_software_version_string(cluster_t *cluster, char *value, uint16_t length); + +/** These attributes are optional for the cluster, but when added to this cluster, the value is maintained internally. + * If the attributes are added in some other cluster, then the value is not maintained internally. + **/ +attribute_t *create_manufacturing_date(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_part_number(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_product_url(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_product_label(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_serial_number(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_reachable(cluster_t *cluster, bool value); +attribute_t *create_unique_id(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_product_appearance(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_configuration_version(cluster_t *cluster, uint32_t *value); + +} /* attribute */ +} /* bridged_device_basic_information */ + +namespace user_label { +namespace attribute { +attribute_t *create_label_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +} /* attribute */ +} /* user_label */ + +namespace fixed_label { +namespace attribute { +attribute_t *create_label_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +} /* attribute */ +} /* fixed_label */ + +namespace identify { +namespace attribute { +attribute_t *create_identify_time(cluster_t *cluster, uint16_t value); +attribute_t *create_identify_type(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* identify */ + +namespace groups { +namespace attribute { +attribute_t *create_name_support(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* groups */ + +namespace scenes_management { +namespace attribute { +attribute_t *create_scene_table_size(cluster_t *cluster, uint16_t value); +attribute_t *create_fabric_scene_info(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ +} /* scenes_management */ + +namespace on_off { +namespace attribute { +attribute_t *create_on_off(cluster_t *cluster, bool value); +attribute_t *create_global_scene_control(cluster_t *cluster, bool value); +attribute_t *create_on_time(cluster_t *cluster, uint16_t value); +attribute_t *create_off_wait_time(cluster_t *cluster, uint16_t value); +attribute_t *create_start_up_on_off(cluster_t *cluster, nullable value); +} /* attribute */ +} /* on_off */ + +namespace level_control { +namespace attribute { +attribute_t *create_current_level(cluster_t *cluster, nullable value); +attribute_t *create_on_level(cluster_t *cluster, nullable value); +attribute_t *create_options(cluster_t *cluster, uint8_t value); +attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value); +attribute_t *create_min_level(cluster_t *cluster, uint8_t value); +attribute_t *create_max_level(cluster_t *cluster, uint8_t value); +attribute_t *create_current_frequency(cluster_t *cluster, uint16_t value); +attribute_t *create_min_frequency(cluster_t *cluster, uint16_t value); +attribute_t *create_max_frequency(cluster_t *cluster, uint16_t value); +attribute_t *create_on_off_transition_time(cluster_t *cluster, uint16_t value); +attribute_t *create_on_transition_time(cluster_t* cluster, nullable value); +attribute_t *create_off_transition_time(cluster_t* cluster, nullable value); +attribute_t *create_default_move_rate(cluster_t* cluster, nullable value); +attribute_t *create_start_up_current_level(cluster_t *cluster, nullable value); +} /* attribute */ +} /* level_control */ + +namespace color_control { +constexpr uint8_t k_max_compensation_text_length = 254; + +namespace attribute { +attribute_t *create_current_hue(cluster_t *cluster, uint8_t value); +attribute_t *create_current_saturation(cluster_t *cluster, uint8_t value); +attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value); +attribute_t *create_color_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_color_control_options(cluster_t *cluster, uint8_t value); +attribute_t *create_enhanced_color_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_color_capabilities(cluster_t *cluster, uint16_t value); +attribute_t *create_color_temperature_mireds(cluster_t *cluster, uint16_t value); +attribute_t *create_color_temp_physical_min_mireds(cluster_t *cluster, uint16_t value); +attribute_t *create_color_temp_physical_max_mireds(cluster_t *cluster, uint16_t value); +attribute_t *create_couple_color_temp_to_level_min_mireds(cluster_t *cluster, uint16_t value); +attribute_t *create_start_up_color_temperature_mireds(cluster_t *cluster, nullable value); +attribute_t *create_current_x(cluster_t *cluster, uint16_t value); +attribute_t *create_current_y(cluster_t *cluster, uint16_t value); +attribute_t *create_drift_compensation(cluster_t *cluster, uint8_t value); +attribute_t *create_compensation_text(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_enhanced_current_hue(cluster_t *cluster, uint16_t value); +attribute_t *create_color_loop_active(cluster_t *cluster, uint8_t value); +attribute_t *create_color_loop_direction(cluster_t *cluster, uint8_t value); +attribute_t *create_color_loop_time(cluster_t *cluster, uint16_t value); +attribute_t *create_color_loop_start_enhanced_hue(cluster_t *cluster, uint16_t value); +attribute_t *create_color_loop_stored_enhanced_hue(cluster_t *cluster, uint16_t value); +attribute_t *create_number_of_primaries(cluster_t *cluster, nullable value); +attribute_t *create_primary_n_x(cluster_t * cluster, uint16_t value, uint8_t index); +attribute_t *create_primary_n_y(cluster_t * cluster, uint16_t value, uint8_t index); +attribute_t *create_primary_n_intensity(cluster_t * cluster, nullable value, uint8_t index); +} /* attribute */ +} /* color_control */ + +namespace fan_control { +namespace attribute { +attribute_t *create_fan_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_fan_mode_sequence(cluster_t *cluster, const uint8_t value); +attribute_t *create_percent_setting(cluster_t *cluster, nullable value); +attribute_t *create_percent_current(cluster_t *cluster, uint8_t value); +attribute_t *create_speed_max(cluster_t *cluster, uint8_t value); +attribute_t *create_speed_setting(cluster_t *cluster, nullable value); +attribute_t *create_speed_current(cluster_t *cluster, uint8_t value); +attribute_t *create_rock_support(cluster_t *cluster, uint8_t value); +attribute_t *create_rock_setting(cluster_t *cluster, uint8_t value); +attribute_t *create_wind_support(cluster_t *cluster, uint8_t value); +attribute_t *create_wind_setting(cluster_t *cluster, uint8_t value); +attribute_t *create_airflow_direction(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* fan_control */ + +namespace thermostat { +const uint8_t k_max_active_preset_handle = 16u; +const uint8_t k_max_active_schedule_handle = 16u; +namespace attribute { +attribute_t *create_local_temperature(cluster_t *cluster, nullable value); +attribute_t *create_outdoor_temperature(cluster_t *cluster, nullable value); +attribute_t *create_occupancy(cluster_t *cluster, uint8_t value); +attribute_t *create_abs_min_heat_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_abs_max_heat_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_abs_min_cool_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_abs_max_cool_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_pi_cooling_demand(cluster_t *cluster, uint8_t value); +attribute_t *create_pi_heating_demand(cluster_t *cluster, uint8_t value); +attribute_t *create_local_temperature_calibration(cluster_t *cluster, int8_t value); +attribute_t *create_occupied_cooling_setpoint(cluster_t *cluster, int16_t value); +attribute_t *create_occupied_heating_setpoint(cluster_t *cluster, int16_t value); +attribute_t *create_unoccupied_cooling_setpoint(cluster_t *cluster, int16_t value); +attribute_t *create_unoccupied_heating_setpoint(cluster_t *cluster, int16_t value); +attribute_t *create_min_heat_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_max_heat_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_min_cool_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_max_cool_setpoint_limit(cluster_t *cluster, int16_t value); +attribute_t *create_min_setpoint_dead_band(cluster_t *cluster, int8_t value); +attribute_t *create_remote_sensing(cluster_t *cluster, uint8_t value); +attribute_t *create_control_sequence_of_operation(cluster_t *cluster, uint8_t value); +attribute_t *create_system_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_thermostat_running_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_temperature_setpoint_hold(cluster_t *cluster, uint8_t value); +attribute_t *create_temperature_setpoint_hold_duration(cluster_t *cluster, nullable value); +attribute_t *create_thermostat_programming_operation_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_thermostat_running_state(cluster_t *cluster, uint16_t value); +attribute_t *create_setpoint_change_source(cluster_t *cluster, uint8_t value); +attribute_t *create_setpoint_change_amount(cluster_t *cluster, nullable value); +attribute_t *create_setpoint_change_source_timestamp(cluster_t *cluster, uint32_t value); +attribute_t *create_occupied_setback(cluster_t *cluster, nullable value); +attribute_t *create_occupied_setback_min(cluster_t *cluster, nullable value); +attribute_t *create_occupied_setback_max(cluster_t *cluster, nullable value); +attribute_t *create_unoccupied_setback(cluster_t *cluster, nullable value); +attribute_t *create_unoccupied_setback_min(cluster_t *cluster, nullable value); +attribute_t *create_unoccupied_setback_max(cluster_t *cluster, nullable value); +attribute_t *create_emergency_heat_delta(cluster_t *cluster, uint8_t value); +attribute_t *create_ac_type(cluster_t *cluster, uint8_t value); +attribute_t *create_ac_capacity(cluster_t *cluster, uint16_t value); +attribute_t *create_ac_refrigerant_type(cluster_t *cluster, uint8_t value); +attribute_t *create_ac_compressor_type(cluster_t *cluster, uint8_t value); +attribute_t *create_ac_error_code(cluster_t *cluster, uint32_t value); +attribute_t *create_ac_louver_position(cluster_t *cluster, uint8_t value); +attribute_t *create_ac_coil_temperature(cluster_t *cluster, nullable value); +attribute_t *create_ac_capacity_format(cluster_t *cluster, uint8_t value); +attribute_t *create_preset_types(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_schedule_types(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_number_of_presets(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_schedules(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_schedule_transitions(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_schedule_transition_per_day(cluster_t *cluster, nullable value); +attribute_t *create_active_preset_handle(cluster_t *cluster, uint8_t*value, uint16_t length); +attribute_t *create_active_schedule_handle(cluster_t *cluster, uint8_t *value, uint16_t length); +attribute_t *create_presets(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_schedules(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_setpoint_hold_expiry_timestamp(cluster_t *cluster, nullable value); +} /* attribute */ +} /* thermostat */ + +namespace thermostat_user_interface_configuration { +namespace attribute { +attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value); +attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* thermostat_user_interface_configuration */ + +namespace air_quality { +namespace attribute { +attribute_t *create_air_quality(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* air_quality */ + +namespace resource_monitoring { +namespace attribute { +attribute_t *create_condition(cluster_t *cluster, uint8_t value); +attribute_t *create_degradation_direction(cluster_t *cluster, uint8_t value); +attribute_t *create_change_indication(cluster_t *cluster, uint8_t value); +attribute_t *create_in_place_indicator(cluster_t *cluster, bool value); +attribute_t *create_last_changed_time(cluster_t *cluster, nullable value); +attribute_t *create_replacement_product_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +} /* attribute */ +} /* resource_monitoring */ + +namespace hepa_filter_monitoring { +namespace attribute = resource_monitoring::attribute; +} /* hepa_filter_monitoring */ + +namespace activated_carbon_filter_monitoring { +namespace attribute = resource_monitoring::attribute; +} /* activated_carbon_filter_monitoring */ + +namespace concentration_measurement { +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_average_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value); +attribute_t *create_uncertainty(cluster_t *cluster, float value); +attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value); +attribute_t *create_level_value(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* concentration_measurement */ + +namespace carbon_monoxide_concentration_measurement { +namespace attribute = concentration_measurement::attribute; +} /* carbon_monoxide_concentration_measurement */ + +namespace carbon_dioxide_concentration_measurement { +namespace attribute = concentration_measurement::attribute; +} /* carbon_dioxide_concentration_measurement */ + +namespace nitrogen_dioxide_concentration_measurement { +namespace attribute = concentration_measurement::attribute; +} /* nitrogen_dioxide_concentration_measurement */ + +namespace ozone_concentration_measurement { +namespace attribute = concentration_measurement::attribute; +} /* ozone_concentration_measurement */ + +namespace formaldehyde_concentration_measurement { +namespace attribute = concentration_measurement::attribute; +} /* formaldehyde_concentration_measurement */ + +namespace pm1_concentration_measurement { +namespace attribute = concentration_measurement::attribute; +} /* pm1_concentration_measurement */ + +namespace pm25_concentration_measurement { +namespace attribute = concentration_measurement::attribute; +} /* pm25_concentration_measurement */ + +namespace pm10_concentration_measurement { +namespace attribute = concentration_measurement::attribute; +} /* pm10_concentration_measurement */ + +namespace radon_concentration_measurement { +namespace attribute = concentration_measurement::attribute; +} /* radon_concentration_measurement */ + +namespace total_volatile_organic_compounds_concentration_measurement { +namespace attribute = concentration_measurement::attribute; +} /* total_volatile_organic_compounds_concentration_measurement */ + +namespace operational_state { +namespace attribute { +attribute_t *create_phase_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_current_phase(cluster_t *cluster, nullable value); +attribute_t *create_countdown_time(cluster_t *cluster, nullable value); +attribute_t *create_operational_state_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_operational_state(cluster_t *cluster, uint8_t value); +attribute_t *create_operational_error(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +} /* attribute */ +} /* operational_state */ + +namespace door_lock { +constexpr uint8_t k_max_language_length = 3; +constexpr uint8_t k_max_aliro_reader_verification_key = 65; +constexpr uint8_t k_max_aliro_reader_group_identifier = 16; +constexpr uint8_t k_max_aliro_reader_group_sub_identifier = 16; +constexpr uint8_t k_max_aliro_group_resolving_key = 16; + +namespace attribute { +attribute_t *create_lock_state(cluster_t *cluster, nullable value); +attribute_t *create_lock_type(cluster_t *cluster, uint8_t value); +attribute_t *create_actuator_enabled(cluster_t *cluster, bool value); +attribute_t *create_door_state(cluster_t *cluster, nullable value); +attribute_t *create_door_open_events(cluster_t *cluster, uint32_t value); +attribute_t *create_door_closed_events(cluster_t *cluster, uint32_t value); +attribute_t *create_open_period(cluster_t *cluster, uint16_t value); +attribute_t *create_number_of_total_users_supported(cluster_t *cluster, const uint16_t value); +attribute_t *create_number_of_pin_users_supported(cluster_t *cluster, const uint16_t value); +attribute_t *create_number_of_rfid_users_supported(cluster_t *cluster, const uint16_t value); +attribute_t *create_number_of_weekday_schedules_supported_per_user(cluster_t *cluster, const uint8_t value); +attribute_t *create_number_of_year_day_schedules_supported_per_user(cluster_t *cluster, const uint8_t value); +attribute_t *create_number_of_holiday_schedules_supported(cluster_t *cluster, const uint8_t value); +attribute_t *create_max_pin_code_length(cluster_t *cluster, const uint8_t value); +attribute_t *create_min_pin_code_length(cluster_t *cluster, const uint8_t value); +attribute_t *create_max_rfid_code_length(cluster_t *cluster, const uint8_t value); +attribute_t *create_min_rfid_code_length(cluster_t *cluster, const uint8_t value); +attribute_t *create_credential_rules_support(cluster_t *cluster, const uint8_t value); +attribute_t *create_number_of_credentials_supported_per_user(cluster_t *cluster, const uint8_t value); +attribute_t *create_language(cluster_t *cluster, const char * value, uint16_t length); +attribute_t *create_led_settings(cluster_t *cluster, uint8_t value); +attribute_t *create_auto_relock_time(cluster_t *cluster, uint32_t value); +attribute_t *create_sound_volume(cluster_t *cluster, uint8_t value); +attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max); +attribute_t *create_supported_operating_modes(cluster_t *cluster, const uint16_t value); +attribute_t *create_default_configuration_register(cluster_t *cluster, uint16_t value); +attribute_t *create_enable_local_programming(cluster_t *cluster, bool value); +attribute_t *create_enable_one_touch_locking(cluster_t *cluster, bool value); +attribute_t *create_enable_inside_status_led(cluster_t *cluster, bool value); +attribute_t *create_enable_privacy_mode_button(cluster_t *cluster, bool value); +attribute_t *create_local_programming_features(cluster_t *cluster, uint8_t value); +attribute_t *create_wrong_code_entry_limit(cluster_t *cluster, uint8_t value); +attribute_t *create_user_code_temporary_disable_time(cluster_t *cluster, uint8_t value); +attribute_t *create_send_pin_over_the_air(cluster_t *cluster, bool value); +attribute_t *create_require_pin_for_remote_operation(cluster_t *cluster, bool value); +attribute_t *create_expiring_user_timeout(cluster_t *cluster, uint16_t value); +attribute_t *create_aliro_reader_verification_key(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_aliro_reader_group_identifier(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_aliro_reader_group_sub_identifier(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_aliro_expedited_transaction_supported_protocol_versions(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_aliro_group_resolving_key(cluster_t *cluster, uint8_t * value, uint16_t length); +attribute_t *create_aliro_supported_bleuwb_protocol_versions(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_aliro_ble_advertising_version(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_aliro_credential_issuer_keys_supported(cluster_t *cluster, uint16_t value); +attribute_t *create_number_of_aliro_endpoint_keys_supported(cluster_t *cluster, uint16_t value); +} /* attribute */ +} /* door_lock */ + +namespace laundry_washer_controls { +namespace attribute { +attribute_t *create_spin_speeds(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_spin_speed_current(cluster_t *cluster, nullable value); +attribute_t *create_number_of_rinses(cluster_t *cluster, uint8_t value); +attribute_t *create_supported_rinses(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +} /* attribute */ +} /* laundry_washer_controls */ + +namespace laundry_dryer_controls { +namespace attribute { +attribute_t *create_supported_dryness_levels(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_selected_dryness_level(cluster_t *cluster, nullable value); +} /* attribute */ +} /* laundry_dryer_controls */ + +namespace smoke_co_alarm { +namespace attribute { +attribute_t *create_expressed_state(cluster_t *cluster, uint8_t value); +attribute_t *create_smoke_state(cluster_t *cluster, uint8_t value); +attribute_t *create_co_state(cluster_t *cluster, uint8_t value); +attribute_t *create_battery_alert(cluster_t *cluster, uint8_t value); +attribute_t *create_device_muted(cluster_t *cluster, uint8_t value); +attribute_t *create_test_in_progress(cluster_t *cluster, bool value); +attribute_t *create_hardware_fault_alert(cluster_t *cluster, bool value); +attribute_t *create_end_of_service_alert(cluster_t *cluster, uint8_t value); +attribute_t *create_interconnect_smoke_alarm(cluster_t *cluster, uint8_t value); +attribute_t *create_interconnect_co_alarm(cluster_t *cluster, uint8_t value); +attribute_t *create_contamination_state(cluster_t *cluster, uint8_t value); +attribute_t *create_smoke_sensitivity_level(cluster_t *cluster, uint8_t value); +attribute_t *create_expiry_date(cluster_t *cluster, uint32_t value); +} /* attribute */ +} /* smoke_co_alarm */ + +namespace window_covering { +namespace attribute { +attribute_t *create_type(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_actuations_lift(cluster_t *cluster, uint16_t value); +attribute_t *create_number_of_actuations_tilt(cluster_t *cluster, uint16_t value); +attribute_t *create_config_status(cluster_t *cluster, uint8_t value); +attribute_t *create_current_position_lift_percentage(cluster_t *cluster, nullable value); +attribute_t *create_current_position_tilt_percentage(cluster_t *cluster, nullable value); +attribute_t *create_operational_status(cluster_t *cluster, uint8_t value); +attribute_t *create_target_position_lift_percent_100ths(cluster_t *cluster, nullable value); +attribute_t *create_target_position_tilt_percent_100ths(cluster_t *cluster, nullable value); +attribute_t *create_end_product_type(cluster_t *cluster, const uint8_t value); +attribute_t *create_current_position_lift_percent_100ths(cluster_t *cluster, nullable value); +attribute_t *create_current_position_tilt_percent_100ths(cluster_t *cluster, nullable value); +attribute_t *create_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_safety_status(cluster_t *cluster, uint16_t value); +} /* attribute */ +} /* window_covering */ + +namespace switch_cluster { +namespace attribute { +attribute_t *create_number_of_positions(cluster_t *cluster, uint8_t value); +attribute_t *create_current_position(cluster_t *cluster, uint8_t value); +attribute_t *create_multi_press_max(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* switch_cluster */ + +namespace temperature_measurement { +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value); +} /* attribute */ +} /* temperature_measurement */ + +namespace relative_humidity_measurement { +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_tolerance(cluster_t *cluster, nullable value); +} /* attribute */ +} /* relative_humidity_measurement */ + +namespace occupancy_sensing { +namespace attribute { +attribute_t *create_occupancy(cluster_t *cluster, uint8_t value); +attribute_t *create_occupancy_sensor_type(cluster_t *cluster, uint8_t value); +attribute_t *create_occupancy_sensor_type_bitmap(cluster_t *cluster, uint8_t value); +attribute_t *create_hold_time(cluster_t *cluster, uint16_t value); +attribute_t *create_hold_time_limits(cluster_t *cluster, uint8_t* value, uint16_t length, uint16_t count); +attribute_t *create_pir_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value); +attribute_t *create_pir_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value); +attribute_t *create_pir_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value); +attribute_t *create_ultrasonic_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value); +attribute_t *create_ultrasonic_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value); +attribute_t *create_ultrasonic_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value); +attribute_t *create_physical_contact_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value); +attribute_t *create_physical_contact_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value); +attribute_t *create_physical_contact_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* occupancy_sensing */ + +namespace boolean_state { +namespace attribute { +attribute_t *create_state_value(cluster_t *cluster, bool value); +} /* attribute */ +} /* boolean_state */ + +namespace boolean_state_configuration { +namespace attribute { +attribute_t *create_current_sensitivity_level(cluster_t *cluster, uint8_t value); +attribute_t *create_supported_sensitivity_levels(cluster_t *cluster, const uint8_t value); +attribute_t *create_default_sensitivity_level(cluster_t *cluster, const uint8_t value); +attribute_t *create_alarms_active(cluster_t *cluster, uint8_t value); +attribute_t *create_alarms_suppressed(cluster_t *cluster, uint8_t value); +attribute_t *create_alarms_enabled(cluster_t *cluster, uint8_t value); +attribute_t *create_alarms_supported(cluster_t *cluster, const uint8_t value); +attribute_t *create_sensor_fault(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* boolean_state_configuration */ + +namespace localization_configuration { + +constexpr uint8_t k_max_active_locale_length = 35; + +namespace attribute { +attribute_t *create_active_locale(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_supported_locales(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +} /* attribute */ +} /* localization_configuration */ + +namespace unit_localization { +namespace attribute { +attribute_t *create_temperature_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_supported_temperature_units(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); + +} /* attribute */ +} /* unit_localization */ + +namespace time_format_localization { +namespace attribute { +attribute_t *create_hour_format(cluster_t *cluster, uint8_t value); +attribute_t *create_active_calendar_type(cluster_t *cluster, uint8_t value); +attribute_t *create_supported_calendar_types(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +} /* attribute */ +} /* time_format_localization */ + +// Note: Attribute name for the below cluster deviates from Matter spec +namespace illuminance_measurement { +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value, nullable min, nullable max); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value, nullable min, nullable max); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value, nullable min, nullable max); +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max); +attribute_t *create_light_sensor_type(cluster_t *cluster, nullable value, nullable min, nullable max); +} /* attribute */ +} /* illuminance_measurement */ + +// Note: Attribute name for the below cluster deviates from Matter spec +namespace pressure_measurement { +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max); +attribute_t *create_scaled_value(cluster_t *cluster, nullable value); +attribute_t *create_min_scaled_value(cluster_t *cluster, nullable value); +attribute_t *create_max_scaled_value(cluster_t *cluster, nullable value); +attribute_t *create_scaled_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max); +attribute_t *create_scale(cluster_t *cluster, int8_t value); +} /* attribute */ +} /* pressure_measurement */ + +// Note: Attribute name for the below cluster deviates from Matter spec +namespace flow_measurement { +namespace attribute { +attribute_t *create_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_min_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_max_measured_value(cluster_t *cluster, nullable value); +attribute_t *create_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max); +} /* attribute */ +} /* flow_measurement */ + +namespace pump_configuration_and_control { +namespace attribute { +attribute_t *create_max_pressure(cluster_t *cluster, nullable value); +attribute_t *create_max_speed(cluster_t *cluster, nullable value); +attribute_t *create_max_flow(cluster_t *cluster, nullable value); +attribute_t *create_min_const_pressure(cluster_t *cluster, nullable value); +attribute_t *create_max_const_pressure(cluster_t *cluster, nullable value); +attribute_t *create_min_comp_pressure(cluster_t *cluster, nullable value); +attribute_t *create_max_comp_pressure(cluster_t *cluster, nullable value); +attribute_t *create_min_const_speed(cluster_t *cluster, nullable value); +attribute_t *create_max_const_speed(cluster_t *cluster, nullable value); +attribute_t *create_min_const_flow(cluster_t *cluster, nullable value); +attribute_t *create_max_const_flow(cluster_t *cluster, nullable value); +attribute_t *create_min_const_temp(cluster_t *cluster, nullable value); +attribute_t *create_max_const_temp(cluster_t *cluster, nullable value); +attribute_t *create_pump_status(cluster_t *cluster, uint16_t value); +attribute_t *create_effective_operation_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_effective_control_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_capacity(cluster_t *cluster, nullable value); +attribute_t *create_speed(cluster_t *cluster, nullable value); +attribute_t *create_lifetime_running_hours(cluster_t *cluster, nullable value); +attribute_t *create_power(cluster_t *cluster, nullable value); +attribute_t *create_lifetime_energy_consumed(cluster_t *cluster, nullable value); +attribute_t *create_operation_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_control_mode(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* pump_configuration_and_control */ + +namespace mode_select { +constexpr uint8_t k_max_description_length = 64; + +namespace attribute { +attribute_t *create_description(cluster_t *cluster, const char * value, uint16_t length); +attribute_t *create_standard_namespace(cluster_t *cluster, const nullable value); +attribute_t *create_supported_modes(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_start_up_mode(cluster_t *cluster, nullable value); +attribute_t *create_on_mode(cluster_t *cluster, nullable value); +} /* attribute */ +} /* mode_select */ + +namespace power_source { +constexpr uint8_t k_max_description_length = 60; +constexpr uint8_t k_max_fault_count = 8; +constexpr uint8_t k_max_designation_count = 20; +constexpr uint8_t k_max_charge_faults_count = 16; +constexpr uint8_t k_max_bat_replacement_description_length = 60; +constexpr uint8_t k_max_endpoint_count = 16; + +namespace attribute { +attribute_t *create_status(cluster_t *cluster, uint8_t value); +attribute_t *create_order(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max); +attribute_t *create_description(cluster_t *cluster, const char * value, uint16_t length); +attribute_t *create_wired_assessed_input_voltage(cluster_t *cluster, nullable value, nullable min, nullable max); +attribute_t *create_wired_assessed_input_frequency(cluster_t *cluster, nullable value, nullable min, nullable max); +attribute_t *create_wired_current_type(cluster_t *cluster, const uint8_t value); +attribute_t *create_wired_assessed_current(cluster_t *cluster, nullable value, nullable min, nullable max); +attribute_t *create_wired_nominal_voltage(cluster_t *cluster, const uint32_t value, uint32_t min, uint32_t max); +attribute_t *create_wired_maximum_current(cluster_t *cluster, const uint32_t value, uint32_t min, uint32_t max); +attribute_t *create_wired_present(cluster_t *cluster, bool value); +attribute_t *create_active_wired_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_bat_voltage(cluster_t *cluster, nullable value, nullable min, nullable max); +attribute_t *create_bat_percent_remaining(cluster_t *cluster, nullable value, nullable min, nullable max); +attribute_t *create_bat_time_remaining(cluster_t *cluster, nullable< uint32_t> value, nullable min, nullable max); +attribute_t *create_bat_charge_level(cluster_t *cluster, uint8_t value); +attribute_t *create_bat_replacement_needed(cluster_t *cluster, bool value); +attribute_t *create_bat_replaceability(cluster_t *cluster, const uint8_t value); +attribute_t *create_bat_present(cluster_t *cluster, bool value); +attribute_t *create_active_bat_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_bat_replacement_description(cluster_t *cluster, const char * value, uint16_t length); +attribute_t *create_bat_common_designation(cluster_t *cluster, const uint8_t value, uint8_t min, uint8_t max); +attribute_t *create_bat_ansi_designation(cluster_t *cluster, const char * value, uint16_t length); +attribute_t *create_bat_iec_designation(cluster_t *cluster, const char * value, uint16_t length); +attribute_t *create_bat_approved_chemistry(cluster_t *cluster, const uint8_t value, uint8_t min, uint8_t max); +attribute_t *create_bat_capacity(cluster_t *cluster, const uint32_t value, uint32_t min, uint32_t max); +attribute_t *create_bat_quantity(cluster_t *cluster, const uint8_t value, uint8_t min, uint8_t max); +attribute_t *create_bat_charge_state(cluster_t *cluster, uint8_t value); +attribute_t *create_bat_time_to_full_charge(cluster_t *cluster, nullable value, nullable min, nullable max); +attribute_t *create_bat_functional_while_charging(cluster_t *cluster, bool value); +attribute_t *create_bat_charging_current(cluster_t *cluster, nullable value, nullable min, nullable max); +attribute_t *create_active_bat_charge_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_endpoint_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ +} /* power_source */ + +namespace temperature_control { +constexpr uint8_t k_max_temp_level_count = 16; + +namespace attribute { +attribute_t *create_temperature_setpoint(cluster_t *cluster, int16_t value); +attribute_t *create_min_temperature(cluster_t *cluster, const int16_t value); +attribute_t *create_max_temperature(cluster_t *cluster, const int16_t value); +attribute_t *create_step(cluster_t *cluster, const int16_t value); +attribute_t *create_selected_temperature_level(cluster_t *cluster, uint8_t value); +attribute_t *create_supported_temperature_levels(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ +} /* temperature_control */ + +namespace refrigerator_alarm { +namespace attribute { +attribute_t *create_mask(cluster_t *cluster, uint32_t value); +attribute_t *create_state(cluster_t *cluster, uint32_t value); +attribute_t *create_supported(cluster_t *cluster, uint32_t value); +} /* attribute */ +} /* refrigerator_alarm */ + +namespace mode_base { +namespace attribute { +attribute_t *create_supported_modes(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_start_up_mode(cluster_t *cluster, nullable value); +attribute_t *create_on_mode(cluster_t *cluster, nullable value); +} /* attribute */ +} /* mode_base */ + +namespace power_topology { +namespace attribute { +attribute_t *create_available_endpoints(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_active_endpoints(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ +} /* power_topology */ + +namespace electrical_power_measurement { +namespace attribute { +attribute_t *create_power_mode(cluster_t *cluster, uint8_t value); +attribute_t *create_number_of_measurement_types(cluster_t *cluster, const uint8_t value); +attribute_t *create_accuracy(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_ranges(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_voltage(cluster_t *cluster, nullable value); +attribute_t *create_active_current(cluster_t *cluster, nullable value); +attribute_t *create_reactive_current(cluster_t *cluster, nullable value); +attribute_t *create_apparent_current(cluster_t *cluster, nullable value); +attribute_t *create_active_power(cluster_t *cluster, nullable value); +attribute_t *create_reactive_power(cluster_t *cluster, nullable value); +attribute_t *create_apparent_power(cluster_t *cluster, nullable value); +attribute_t *create_rms_voltage(cluster_t *cluster, nullable value); +attribute_t *create_rms_current(cluster_t *cluster, nullable value); +attribute_t *create_rms_power(cluster_t *cluster, nullable value); +attribute_t *create_frequency(cluster_t *cluster, nullable value); +attribute_t *create_harmonic_currents(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_harmonic_phases(cluster_t *cluster, const uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_power_factor(cluster_t *cluster, nullable value); +attribute_t *create_neutral_current(cluster_t *cluster, nullable value); +} /* attribute */ +} /* electrical_power_measurement */ + +namespace electrical_energy_measurement { +namespace attribute { +attribute_t *create_accuracy(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count); +attribute_t *create_cumulative_energy_imported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count); +attribute_t *create_cumulative_energy_exported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count); +attribute_t *create_periodic_energy_imported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count); +attribute_t *create_periodic_energy_exported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count); +attribute_t *create_cumulative_energy_reset(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count); +} /* attribute */ +} /* electrical_energy_measurement */ + +namespace energy_evse { +namespace attribute { + +constexpr uint8_t k_max_vehicle_id_length = 32; + +attribute_t *create_state(cluster_t *cluster, nullable value); +attribute_t *create_supply_state(cluster_t *cluster, uint8_t value); +attribute_t *create_fault_state(cluster_t *cluster, uint8_t value); +attribute_t *create_charging_enabled_until(cluster_t *cluster, nullable value); +attribute_t *create_discharging_enabled_until(cluster_t *cluster, nullable value); +attribute_t *create_circuit_capacity(cluster_t *cluster, int64_t value); +attribute_t *create_minimum_charge_current(cluster_t *cluster, int64_t value); +attribute_t *create_maximum_charge_current(cluster_t *cluster, int64_t value); +attribute_t *create_maximum_discharge_current(cluster_t *cluster, int64_t value); +attribute_t *create_user_maximum_charge_current(cluster_t *cluster, int64_t value); +attribute_t *create_randomization_delay_window(cluster_t *cluster, uint32_t value); +attribute_t *create_next_charge_start_time(cluster_t *cluster, nullable value); +attribute_t *create_next_charge_target_time(cluster_t *cluster, nullable value); +attribute_t *create_next_charge_required_energy(cluster_t *cluster, nullable value); +attribute_t *create_next_charge_target_soc(cluster_t *cluster, nullable value); +attribute_t *create_approximate_ev_efficiency(cluster_t *cluster, nullable value); +attribute_t *create_state_of_charge(cluster_t *cluster, nullable value); +attribute_t *create_battery_capacity(cluster_t *cluster, nullable value); +attribute_t *create_vehicle_id(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_session_id(cluster_t *cluster, nullable value); +attribute_t *create_session_duration(cluster_t *cluster, nullable value); +attribute_t *create_session_energy_charged(cluster_t *cluster, nullable value); +attribute_t *create_session_energy_discharged(cluster_t *cluster, nullable value); +} /* attribute */ +} /* energy_evse */ + +namespace microwave_oven_control { +namespace attribute { +attribute_t *create_cook_time(cluster_t *cluster, uint32_t value); +attribute_t *create_max_cook_time(cluster_t *cluster, uint32_t value); +attribute_t *create_power_setting(cluster_t *cluster, uint8_t value); +attribute_t *create_min_power(cluster_t *cluster, uint8_t value); +attribute_t *create_max_power(cluster_t *cluster, uint8_t value); +attribute_t *create_power_step(cluster_t *cluster, uint8_t value); +attribute_t *create_supported_watts(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_selected_watt_index(cluster_t *cluster, uint8_t value); +attribute_t *create_watt_rating(cluster_t *cluster, uint16_t value); +} /* attribute */ +} /* microwave_oven_control */ + +namespace valve_configuration_and_control { +namespace attribute { +attribute_t *create_open_duration(cluster_t *cluster, nullable value); +attribute_t *create_default_open_duration(cluster_t *cluster, nullable value); +attribute_t *create_auto_close_time(cluster_t *cluster, nullable value); +attribute_t *create_remaining_duration(cluster_t *cluster, nullable value); +attribute_t *create_current_state(cluster_t *cluster, nullable value); +attribute_t *create_target_state(cluster_t *cluster, nullable value); +attribute_t *create_current_level(cluster_t *cluster, nullable value); +attribute_t *create_target_level(cluster_t *cluster, nullable value); +attribute_t *create_default_open_level(cluster_t *cluster, uint8_t value); +attribute_t *create_valve_fault(cluster_t *cluster, uint16_t value); +attribute_t *create_level_step(cluster_t *cluster, const uint8_t value); +} /* attribute */ +} /* valve_configuration_and_control */ + +namespace device_energy_management { +namespace attribute { +attribute_t *create_esa_type(cluster_t *cluster, const uint8_t value); +attribute_t *create_esa_can_generate(cluster_t *cluster, const bool value); +attribute_t *create_esa_state(cluster_t *cluster, uint8_t value); +attribute_t *create_abs_min_power(cluster_t *cluster, int64_t value); +attribute_t *create_abs_max_power(cluster_t *cluster, int64_t value); +attribute_t *create_power_adjustment_capability(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_forecast(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_opt_out_state(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* device_energy_management */ + +namespace application_basic { +constexpr uint8_t k_max_vendor_name_length = 32; +constexpr uint8_t k_max_application_version_length = 32; + +namespace attribute { +attribute_t *create_vendor_name(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_vendor_id(cluster_t *cluster, uint16_t value); +attribute_t *create_application_name(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_product_id(cluster_t *cluster, uint16_t value); +attribute_t *create_application(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_status(cluster_t *cluster, uint16_t value); +attribute_t *create_application_version(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_allowed_vendor_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +} /* attribute */ +} /* application_basic */ + +namespace thread_border_router_management { +namespace attribute { +attribute_t *create_border_router_name(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_border_agent_id(cluster_t *cluster, uint8_t *value, uint16_t length); +attribute_t *create_thread_version(cluster_t *cluster, uint16_t value); +attribute_t *create_interface_enabled(cluster_t *cluster, bool value); +attribute_t *create_active_dataset_timestamp(cluster_t *cluster, nullable value); +attribute_t *create_pending_dataset_timestamp(cluster_t *cluster, nullable value); +} /* attribute */ +} /* thread_border_router_management */ + +namespace wifi_network_management { +namespace attribute { +attribute_t *create_ssid(cluster_t *cluster, uint8_t *value, uint16_t length); +attribute_t *create_passphrase_surrogate(cluster_t *cluster, nullable value); +} /* attribute */ +} /* wifi_network_management */ + +namespace thread_network_directory { +namespace attribute { +attribute_t *create_preferred_extended_pan_id(cluster_t *cluster, uint8_t *value, uint16_t length); +attribute_t *create_thread_networks(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_thread_network_table_size(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* thread_network_directory */ + +namespace service_area { +namespace attribute { +attribute_t *create_supported_areas(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_supported_maps(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_selected_areas(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_current_area(cluster_t *cluster, nullable value); +attribute_t *create_estimated_end_time(cluster_t *cluster, nullable value); +attribute_t *create_progress(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +} /* attribute */ +} /* service_area */ + +namespace water_heater_management { +namespace attribute { +attribute_t *create_heater_types(cluster_t *cluster, uint8_t value); +attribute_t *create_heat_demand(cluster_t *cluster, uint8_t value); +attribute_t *create_tank_volume(cluster_t *cluster, uint16_t value); +attribute_t *create_estimated_heat_required(cluster_t *cluster, int64_t value); +attribute_t *create_tank_percentage(cluster_t *cluster, uint8_t value); +attribute_t *create_boost_state(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* water_heater_management */ + +namespace energy_preference { +namespace attribute { +attribute_t *create_energy_balances(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_current_energy_balance(cluster_t *cluster, uint8_t value); +attribute_t *create_energy_priorities(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_low_power_mode_sensitivities(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_current_low_power_mode_sensitivity(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* energy_preference */ + +namespace commissioner_control { +namespace attribute { +attribute_t *create_supported_device_categories(cluster_t *cluster, uint32_t value); +} /* attribute */ +} /* commissioner_control */ + +namespace ecosystem_information { +namespace attribute { +attribute_t *create_device_directory(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_location_directory(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +} /* attribute */ +} /* ecosystem_information */ + +namespace time_synchronization { +namespace attribute { +attribute_t *create_utc_time(cluster_t *cluster, nullable value); +attribute_t *create_granularity(cluster_t *cluster, uint8_t value); +attribute_t *create_time_source(cluster_t *cluster, uint8_t value); +attribute_t *create_trusted_time_source(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_default_ntp(cluster_t *cluster, char *value, uint16_t length); +attribute_t *create_time_zone(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_dst_offset(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_local_time(cluster_t *cluster, nullable value); +attribute_t *create_time_zone_database(cluster_t *cluster, uint8_t value); +attribute_t *create_ntp_server_available(cluster_t *cluster, bool value); +attribute_t *create_time_zone_list_max_size(cluster_t *cluster, uint8_t value); +attribute_t *create_dst_offset_list_max_size(cluster_t *cluster, uint8_t value); +attribute_t *create_supports_dns_resolve(cluster_t *cluster, bool value); +} /* attribute */ +} /* time_synchronization */ + +namespace camera_av_stream_management { +namespace attribute { +attribute_t *create_max_concurrent_encoders(cluster_t *cluster, uint8_t value); +attribute_t *create_max_encoded_pixel_rate(cluster_t *cluster, uint32_t value); +attribute_t *create_video_sensor_params(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_night_vision_uses_infrared(cluster_t *cluster, bool value); +attribute_t *create_min_viewport_resolution(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_rate_distortion_trade_off_points(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_max_content_buffer_size(cluster_t *cluster, uint32_t value); +attribute_t *create_microphone_capabilities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_speaker_capabilities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_two_way_talk_support(cluster_t *cluster, uint8_t value); +attribute_t *create_snapshot_capabilities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_max_network_bandwidth(cluster_t *cluster, uint32_t value); +attribute_t *create_current_frame_rate(cluster_t *cluster, uint16_t value); +attribute_t *create_hdr_mode_enabled(cluster_t *cluster, bool value); +attribute_t *create_supported_stream_usages(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_allocated_video_streams(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_allocated_audio_streams(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_allocated_snapshot_streams(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_stream_usage_priorities(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_soft_recording_privacy_mode_enabled(cluster_t *cluster, bool value); +attribute_t *create_soft_livestream_privacy_mode_enabled(cluster_t *cluster, bool value); +attribute_t *create_hard_privacy_mode_on(cluster_t *cluster, bool value); +attribute_t *create_night_vision(cluster_t *cluster, uint8_t value); +attribute_t *create_night_vision_illum(cluster_t *cluster, uint8_t value); +attribute_t *create_viewport(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_speaker_muted(cluster_t *cluster, bool value); +attribute_t *create_speaker_volume_level(cluster_t *cluster, uint8_t value); +attribute_t *create_speaker_max_level(cluster_t *cluster, uint8_t value); +attribute_t *create_speaker_min_level(cluster_t *cluster, uint8_t value); +attribute_t *create_microphone_muted(cluster_t *cluster, bool value); +attribute_t *create_microphone_volume_level(cluster_t *cluster, uint8_t value); +attribute_t *create_microphone_max_level(cluster_t *cluster, uint8_t value); +attribute_t *create_microphone_min_level(cluster_t *cluster, uint8_t value); +attribute_t *create_microphone_agc_enabled(cluster_t *cluster, bool value); +attribute_t *create_image_rotation(cluster_t *cluster, uint16_t value); +attribute_t *create_image_flip_horizontal(cluster_t *cluster, bool value); +attribute_t *create_image_flip_vertical(cluster_t *cluster, bool value); +attribute_t *create_local_video_recording_enabled(cluster_t *cluster, bool value); +attribute_t *create_local_snapshot_recording_enabled(cluster_t *cluster, bool value); +attribute_t *create_status_light_enabled(cluster_t *cluster, bool value); +attribute_t *create_status_light_brightness(cluster_t *cluster, uint8_t value); + +} /* attribute */ +} /*camera av stream management*/ + +namespace webrtc_transport_provider { +namespace attribute { +attribute_t *create_current_sessions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); + +} /* attribute */ +}/*webrtc transport provider*/ + +namespace webrtc_transport_requestor { +namespace attribute { +attribute_t *create_current_sessions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); + +} /* attribute */ +}/*webrtc transport requestor*/ + +namespace chime { +namespace attribute { + +attribute_t *create_installed_chime_sounds(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_selected_chime(cluster_t *cluster, uint8_t value); +attribute_t *create_enabled(cluster_t *cluster, bool value); +} /* attribute */ +} /* chime */ + +namespace closure_control { +namespace attribute { + +attribute_t *create_countdown_time(cluster_t *cluster, nullable value); +attribute_t *create_main_state(cluster_t *cluster, uint8_t value); +attribute_t *create_current_error_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_overall_current_state(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_overall_target_state(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_latch_control_modes(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* closure_control */ + +namespace closure_dimension { +namespace attribute { + +attribute_t *create_current_state(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_target_state(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_resolution(cluster_t *cluster, uint16_t value); +attribute_t *create_step_value(cluster_t *cluster, uint16_t value); +attribute_t *create_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_unit_range(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_limit_range(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_translation_direction(cluster_t *cluster, uint8_t value); +attribute_t *create_rotation_axis(cluster_t *cluster, uint8_t value); +attribute_t *create_overflow(cluster_t *cluster, uint8_t value); +attribute_t *create_modulation_type(cluster_t *cluster, uint8_t value); +attribute_t *create_latch_control_modes(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* closure_dimension */ + +namespace camera_av_settings_user_level_management { +namespace attribute { + +attribute_t *create_mptz_position(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_max_presets(cluster_t *cluster, uint8_t value); +attribute_t *create_mptz_presets(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_dptz_streams(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_zoom_max(cluster_t *cluster, uint8_t value); +attribute_t *create_tilt_min(cluster_t *cluster, int16_t value); +attribute_t *create_tilt_max(cluster_t *cluster, int16_t value); +attribute_t *create_pan_min(cluster_t *cluster, int16_t value); +attribute_t *create_pan_max(cluster_t *cluster, int16_t value); +attribute_t *create_movement_state(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* camera_av_settings_user_level_management */ + +namespace push_av_stream_transport { +namespace attribute { + +attribute_t *create_supported_formats(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_connections(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ +} /* push_av_stream_transport */ + +namespace commodity_tariff { +namespace attribute { +attribute_t *create_tariff_info(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_tariff_unit(cluster_t *cluster, nullable value); +attribute_t *create_start_date(cluster_t *cluster, nullable value); +attribute_t *create_day_entries(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_day_patterns(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_calendar_periods(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_individual_days(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_day(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_next_day(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_day_entry(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_day_entry_date(cluster_t *cluster, nullable value); +attribute_t *create_next_day_entry(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_next_day_entry_date(cluster_t *cluster, nullable value); +attribute_t *create_tariff_components(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_tariff_periods(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_tariff_components(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_next_tariff_components(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_default_randomization_offset(cluster_t *cluster, nullable value); +attribute_t *create_default_randomization_type(cluster_t *cluster, nullable value); +} /* attribute */ +} /* commodity_tariff */ + +namespace commodity_price { +namespace attribute { +attribute_t *create_tariff_unit(cluster_t *cluster, uint8_t value); +attribute_t *create_currency(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_price(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_price_forecast(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ +} /* commodity_price */ + +namespace commodity_metering { +namespace attribute { + +attribute_t *create_metered_quantity(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_metered_quantity_timestamp(cluster_t *cluster, nullable value); +attribute_t *create_tariff_unit(cluster_t *cluster, nullable value); +attribute_t *create_maximum_metered_quantities(cluster_t *cluster, nullable value); +} /* attribute */ +} /* commodity_metering */ + +namespace electrical_grid_conditions { +namespace attribute { + +attribute_t *create_local_generation_available(cluster_t *cluster, nullable value); +attribute_t *create_current_conditions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_forecast_conditions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ +} /* electrical_grid_conditions */ + +namespace meter_identification { +namespace attribute { + +attribute_t *create_meter_type(cluster_t *cluster, nullable value); +attribute_t *create_point_of_delivery(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_meter_serial_number(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_protocol_version(cluster_t *cluster, char * value, uint16_t length); +attribute_t *create_power_threshold(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ +} /* meter_identification */ + +namespace soil_measurement { +namespace attribute { + +attribute_t *create_soil_moisture_measurement_limits(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_soil_moisture_measured_value(cluster_t *cluster, nullable value); +} /* attribute */ +} /* soil_measurement */ + +namespace zone_management { +namespace attribute { + +attribute_t *create_max_user_defined_zones(cluster_t *cluster, uint8_t value); +attribute_t *create_max_zones(cluster_t *cluster, uint8_t value); +attribute_t *create_zones(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_triggers(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_sensitivity_max(cluster_t *cluster, uint8_t value); +attribute_t *create_sensitivity(cluster_t *cluster, uint8_t value); +attribute_t *create_two_d_cartesian_max(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ +} /* zone_management */ + +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_cluster.cpp b/components/esp_matter/data_model/legacy/esp_matter_cluster.cpp similarity index 99% rename from components/esp_matter/data_model/esp_matter_cluster.cpp rename to components/esp_matter/data_model/legacy/esp_matter_cluster.cpp index 70a71b568..9cf5ccd32 100644 --- a/components/esp_matter/data_model/esp_matter_cluster.cpp +++ b/components/esp_matter/data_model/legacy/esp_matter_cluster.cpp @@ -15,9 +15,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/components/esp_matter/data_model/legacy/esp_matter_cluster_impl.h b/components/esp_matter/data_model/legacy/esp_matter_cluster_impl.h new file mode 100644 index 000000000..ab39ef554 --- /dev/null +++ b/components/esp_matter/data_model/legacy/esp_matter_cluster_impl.h @@ -0,0 +1,1074 @@ +// Copyright 2021 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include + +#include +#include +#include + +namespace esp_matter { +namespace cluster { + +/** Specific cluster create APIs + * + * These APIs also create the mandatory attributes and commands for the cluster. If the mandatory attribute is not + * managed internally, then a config is present for that attribute. The constructor for the config will set the + * attribute to the default value from the spec. + * + * If some standard cluster is not present here, it can be added. + * If a custom cluster needs to be created, the low level esp_matter::cluster::create() API can be used. + */ + +/** Note: Some features might appear to be missing in the cluster configuration because a feature configuration is + * only created if there are mandatory attributes managed by Esp-Matter. Since these features do not have any mandatory + * attributes, they have not been added to the cluster configuration. + * To create such features, you can directly pass their feature IDs in the features_flag of the cluster configuration. + */ + +namespace common { + +typedef struct config { + // Empty config for API consistency +} config_t; + +} /* common */ + +namespace descriptor { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* descriptor */ + +namespace actions { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* actions */ + +namespace access_control { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* access_control */ + +namespace basic_information { +typedef struct config { + char node_label[k_max_node_label_length + 1]; + config() : node_label{0} {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* basic_information */ + +namespace binding { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* binding */ + +namespace ota_software_update_provider { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* ota_software_update_provider */ + +namespace ota_software_update_requestor { +typedef struct config { + bool update_possible; + uint8_t update_state; + nullable update_state_progress; + config() : update_possible(true), update_state(0), update_state_progress() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* ota_software_update_requestor */ + +namespace general_commissioning { +typedef struct config { + uint64_t breadcrumb; + config() : breadcrumb(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* general_commissioning */ + +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG +namespace network_commissioning { +typedef struct config { + uint32_t feature_map; + config() : +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI + feature_map(chip::to_underlying(chip::app::Clusters::NetworkCommissioning::Feature::kWiFiNetworkInterface)) {} +#elif CHIP_DEVICE_CONFIG_ENABLE_THREAD + feature_map(chip::to_underlying(chip::app::Clusters::NetworkCommissioning::Feature::kThreadNetworkInterface)) {} +#else + feature_map(chip::to_underlying(chip::app::Clusters::NetworkCommissioning::Feature::kEthernetNetworkInterface)) {} +#endif +} config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* network_commissioning */ +#endif // CONFIG_CUSTOM_NETWORK_CONFIG + +namespace diagnostic_logs { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* diagnostic_logs */ + +namespace general_diagnostics { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* general_diagnostics */ + +namespace software_diagnostics { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* software_diagnostics */ + +namespace administrator_commissioning { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* administrator_commissioning */ + +namespace operational_credentials { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* operational_credentials */ + +namespace group_key_management { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, uint8_t flags); +} /* group_key_management */ + +namespace wifi_network_diagnostics { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* wifi_network_diagnostics */ + +namespace thread_network_diagnostics { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* thread_network_diagnostics */ + +namespace ethernet_network_diagnostics { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* ethernet_network_diagnostics */ + +namespace time_synchronization { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* time_synchronization */ + +namespace unit_localization { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* unit_localization */ + +namespace bridged_device_basic_information { +typedef struct config { + bool reachable; + config() : reachable(true) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* bridged_device_basic_information */ + +namespace power_source { +typedef struct config { + uint8_t status; + uint8_t order; + char description[k_max_description_length + 1]; + struct { + feature::wired::config_t wired; + feature::battery::config_t battery; + feature::rechargeable::config_t rechargeable; + feature::replaceable::config_t replaceable; + } features; + uint32_t feature_flags; + config() : status(0), order(0), description{0}, feature_flags(0) {} +} config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* power_source */ + +namespace icd_management { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* icd_management */ + +namespace user_label { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* user_label */ + +namespace fixed_label { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* fixed_label */ + +namespace identify { +typedef struct config { + uint16_t identify_time; + uint8_t identify_type; + config() : identify_time(0), identify_type(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* identify */ + +namespace groups { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +uint8_t get_server_cluster_count(); +} /* groups */ + +namespace scenes_management { +typedef struct config { + uint16_t scene_table_size; + config() : scene_table_size(16) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* scenes_management */ + +namespace on_off { +typedef struct config { + bool on_off; + config() : on_off(false) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* on_off */ + +namespace level_control { +typedef struct config { + nullable current_level; + nullable on_level; + uint8_t options; + config() : current_level(), on_level(), options(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* level_control */ + +namespace color_control { +typedef struct config { + uint8_t color_mode; + uint8_t color_control_options; + uint8_t enhanced_color_mode; + uint16_t color_capabilities; + nullable number_of_primaries; + config() : color_mode(1), color_control_options(0), enhanced_color_mode(1), + color_capabilities(0), number_of_primaries(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* color_control */ + +namespace fan_control { +typedef struct config { + uint8_t fan_mode; + uint8_t fan_mode_sequence; + nullable percent_setting; + uint8_t percent_current; + void *delegate; + config() : fan_mode(0), fan_mode_sequence(2), percent_setting(0), percent_current(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* fan_control */ + +namespace thermostat { +typedef struct config { + nullable local_temperature; + uint8_t control_sequence_of_operation; + uint8_t system_mode; + void *delegate; + struct { + feature::heating::config_t heating; + feature::cooling::config_t cooling; + feature::auto_mode::config_t auto_mode; + feature::occupancy::config_t occupancy; + feature::setback::config_t setback; + feature::local_temperature_not_exposed::config_t local_temperature_not_exposed; + feature::matter_schedule_configuration::config_t matter_schedule_configuration; + } features; + uint32_t feature_flags; + config() : local_temperature(), control_sequence_of_operation(4), system_mode(1), delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* thermostat */ + +namespace thermostat_user_interface_configuration { +typedef struct config { + uint8_t temperature_display_mode; + uint8_t keypad_lockout; + config() : temperature_display_mode(0), keypad_lockout(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* thermostat_user_interface_configuration */ + +namespace air_quality { +using config_t = common::config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* air_quality */ + +namespace resource_monitoring { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +} /* resource_monitoring */ + +namespace hepa_filter_monitoring { +using config_t = resource_monitoring::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* hepa_filter_monitoring */ + +namespace activated_carbon_filter_monitoring { +using config_t = resource_monitoring::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* activated_carbon_filter_monitoring */ + +namespace concentration_measurement { +typedef struct config { + uint8_t measurement_medium; + struct { + feature::numeric_measurement::config_t numeric_measurement; + feature::level_indication::config_t level_indication; + feature::peak_measurement::config_t peak_measurement; + feature::average_measurement::config_t average_measurement; + } features; + uint32_t feature_flags; + void *delegate; + config() : measurement_medium(0), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t cluster_id); +} /* concentration_measurement */ + +namespace carbon_monoxide_concentration_measurement { +using config_t = concentration_measurement::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* carbon_monoxide_concentration_measurement */ + +namespace carbon_dioxide_concentration_measurement { +using config_t = concentration_measurement::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* carbon_dioxide_concentration_measurement */ + +namespace nitrogen_dioxide_concentration_measurement { +using config_t = concentration_measurement::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* nitrogen_dioxide_concentration_measurement */ + +namespace ozone_concentration_measurement { +using config_t = concentration_measurement::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* ozone_concentration_measurement */ + +namespace formaldehyde_concentration_measurement { +using config_t = concentration_measurement::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* formaldehyde_concentration_measurement */ + +namespace pm1_concentration_measurement { +using config_t = concentration_measurement::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* pm1_concentration_measurement */ + +namespace pm25_concentration_measurement { +using config_t = concentration_measurement::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* pm25_concentration_measurement */ + +namespace pm10_concentration_measurement { +using config_t = concentration_measurement::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* pm10_concentration_measurement */ + +namespace radon_concentration_measurement { +using config_t = concentration_measurement::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* radon_concentration_measurement */ + +namespace total_volatile_organic_compounds_concentration_measurement { +using config_t = concentration_measurement::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* total_volatile_organic_compounds_concentration_measurement */ + +namespace operational_state { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* operational_state */ + +namespace laundry_washer_mode { +typedef struct config { + uint8_t current_mode; + void *delegate; + config() : current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* laundry_washer_mode */ + +namespace laundry_washer_controls { +typedef struct config { + struct { + feature::spin::config_t spin; + feature::rinse::config_t rinse; + } features; + uint32_t feature_flags; + void *delegate; + config() : feature_flags(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* laundry_washer_controls */ + +namespace laundry_dryer_controls { +typedef struct config { + nullable selected_dryness_level; + void *delegate; + config() : selected_dryness_level(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* laundry_dryer_controls */ + +namespace dish_washer_mode { +typedef struct config { + uint8_t current_mode; + void *delegate; + config() : current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* dish_washer_mode */ + +namespace dish_washer_alarm { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* dish_washer_alarm */ + +namespace smoke_co_alarm { +typedef struct config { + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* smoke_co_alarm */ + +namespace door_lock { +typedef struct config { + nullable lock_state; + uint8_t lock_type; + bool actuator_enabled; + uint8_t operating_mode; + uint16_t supported_operating_modes; + void *delegate; + config() : lock_state(0), lock_type(0), actuator_enabled(0), operating_mode(0), supported_operating_modes(0xFFF6), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* door_lock */ + +namespace window_covering { +typedef struct config { + uint8_t type; + uint8_t config_status; + uint8_t operational_status; + const uint8_t end_product_type; + uint8_t mode; + struct { + feature::position_aware_lift::config_t position_aware_lift; + feature::position_aware_tilt::config_t position_aware_tilt; + } features; + uint32_t feature_flags; + void *delegate; + config(uint8_t end_product_type = 0) : type(0), config_status(0), operational_status(0), end_product_type(end_product_type), mode(0), feature_flags(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* window_covering */ + +namespace switch_cluster { +typedef struct config { + uint8_t number_of_positions; + uint8_t current_position; + struct { + feature::momentary_switch_multi_press::config_t momentary_switch_multi_press; + } features; + uint32_t feature_flags; + config() : number_of_positions(2), current_position(0), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* switch_cluster */ + +namespace temperature_measurement { +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + config() : measured_value(), min_measured_value(), max_measured_value() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* temperature_measurement */ + +namespace relative_humidity_measurement { +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + config() : measured_value(), min_measured_value(), max_measured_value() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* relative_humidity_measurement */ + +namespace occupancy_sensing { +typedef struct config { + uint8_t occupancy; + uint8_t occupancy_sensor_type; + uint8_t occupancy_sensor_type_bitmap; + uint32_t feature_flags; + config() : occupancy(0), occupancy_sensor_type(0), + occupancy_sensor_type_bitmap(0), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* occupancy_sensing */ + +namespace boolean_state { +typedef struct config { + bool state_value; + config() : state_value(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* boolean_state */ + +namespace boolean_state_configuration { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* boolean_state */ + +namespace localization_configuration { +typedef struct config { + char active_locale[k_max_active_locale_length + 1]; + config() : active_locale{0} {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* localization_configuration_cluster */ + +namespace time_format_localization { +typedef struct config { + uint8_t hour_format; + config() : hour_format(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* time_format_localization */ + +namespace illuminance_measurement { +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + config() : measured_value(0), min_measured_value(), max_measured_value() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* illuminance_measurement */ + +namespace pressure_measurement { +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + config() : measured_value(), min_measured_value(), max_measured_value() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* pressure_measurement */ + +namespace flow_measurement { +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + config() : measured_value(), min_measured_value(), max_measured_value() {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* flow_measurement */ + +namespace pump_configuration_and_control { +typedef struct config { + // Pump Information Attributes + const nullable max_pressure; + const nullable max_speed; + const nullable max_flow; + // Pump Dynamic Information Attributes + uint8_t effective_operation_mode; + uint8_t effective_control_mode; + nullable capacity; + // Pump Settings Attributes + uint8_t operation_mode; + struct { + feature::constant_pressure::config_t constant_pressure; + feature::compensated_pressure::config_t compensated_pressure; + feature::constant_flow::config_t constant_flow; + feature::constant_speed::config_t constant_speed; + feature::constant_temperature::config_t constant_temperature; + } features; + uint32_t feature_flags; + config( + nullable max_pressure = nullable(), + nullable max_speed = nullable(), + nullable max_flow = nullable() + ) : max_pressure(max_pressure), max_speed(max_speed), max_flow(max_flow), + effective_operation_mode(0), effective_control_mode(0), capacity(), operation_mode(0), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* pump_configuration_and_control */ + +namespace mode_select { +typedef struct config { + char description[k_max_description_length + 1]; + const nullable standard_namespace; + uint8_t current_mode; + void *delegate; + config() : description{0}, standard_namespace(), current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* mode_select */ + +namespace temperature_control { +typedef struct config { + struct { + feature::temperature_number::config_t temperature_number; + feature::temperature_level::config_t temperature_level; + feature::temperature_step::config_t temperature_step; + } features; + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* temperature_control */ + +namespace refrigerator_alarm { +typedef struct config { + uint32_t mask; + uint32_t state; + uint32_t supported; + config() : mask(1), state(0), supported(1) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* refrigerator_alarm */ + +namespace refrigerator_and_tcc_mode { +typedef struct config { + uint8_t current_mode; + void *delegate; + config() : current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* refrigerator_and_tcc_mode */ + +namespace rvc_run_mode { +typedef struct config { + uint8_t current_mode; + void *delegate; + config() : current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* rvc_run_mode */ + +namespace rvc_clean_mode { +typedef struct config { + uint8_t current_mode; + void *delegate; + config() : current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* rvc_clean_mode */ + +namespace microwave_oven_mode { +typedef struct config { + uint8_t current_mode; + void *delegate; + config() : current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* microwave_oven_mode */ + +namespace microwave_oven_control { +typedef struct config { + uint32_t feature_flags; + void *delegate; + config() : feature_flags(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* microwave_oven_control */ + +namespace rvc_operational_state { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* rvc_operational_state */ + +namespace keypad_input { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* keypad_input */ + +namespace power_topology { +typedef struct config { + uint32_t feature_flags; + void *delegate; + config() : feature_flags(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* power_topology */ + +namespace electrical_power_measurement { +typedef struct config { + uint32_t feature_flags; + void *delegate; + config() : feature_flags(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* electrical_power_measurement */ + +namespace electrical_energy_measurement { +typedef struct config { + uint32_t feature_flags; + void *delegate; + config() : feature_flags(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* electrical_energy_measurement */ + +namespace energy_evse_mode { +typedef struct config { + uint8_t current_mode; + void *delegate; + config() : current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* energy_evse_mode */ + +namespace energy_evse { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* energy_evse */ + +namespace valve_configuration_and_control { +typedef struct config { + nullable open_duration; + nullable default_open_duration; + nullable current_state; + nullable target_state; + void *delegate; + config() : open_duration(), default_open_duration(), current_state(), target_state(), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* valve_configuration_and_control */ + +namespace device_energy_management { +typedef struct config { + void *delegate; + uint32_t feature_flags; + config() : delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* device_energy_management */ + +namespace device_energy_management_mode { +typedef struct config { + uint8_t current_mode; + void *delegate; + config() : current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* device_energy_management_mode */ + +namespace application_basic { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* application_basic */ + +namespace thread_border_router_management { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* thread_border_router_management */ + +namespace wifi_network_management { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* wifi_network_management */ + +namespace thread_network_directory { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* thread_network_directory */ + +namespace service_area { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* service_area */ + +namespace water_heater_management { +typedef struct config { + uint8_t heater_types; + uint8_t heat_demand; + uint8_t boost_state; + void *delegate; + config() : heater_types(0), heat_demand(0), boost_state(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* water_heater_management */ + +namespace water_heater_mode { +typedef struct config { + uint8_t current_mode; + void *delegate; + config() : current_mode(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* water_heater_mode */ + +namespace energy_preference { +typedef struct config { + struct { + feature::energy_balance::config_t energy_balance; + feature::low_power_mode_sensitivity::config_t low_power_mode_sensitivity; + } features; + uint32_t feature_flags; + void *delegate; + config() : feature_flags(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* energy_preference */ + +namespace commissioner_control { +typedef struct config { + uint32_t supported_device_categories; + void *delegate; + config() : supported_device_categories(0), delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* commissioner_control */ + +namespace ecosystem_information { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* ecosystem_information */ + +namespace camera_av_stream_management { +typedef struct config { + uint32_t max_content_buffer_size; + uint32_t max_network_bandwidth; + uint32_t feature_flags; + config() : max_content_buffer_size(0), max_network_bandwidth(0), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +}/*camera av stream management*/ + +namespace webrtc_transport_provider { +using config_t = common::config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +}/*webrtc transport provider*/ + +namespace webrtc_transport_requestor { +using config_t = common::config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +}/*webrtc transport requestor*/ + +namespace chime { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* chime */ + +namespace closure_control { +typedef struct config { + void *delegate; + uint32_t feature_flags; + config() : delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* closure_control */ + +namespace closure_dimension { +typedef struct config { + void *delegate; + uint32_t feature_flags = 0; + config() : delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* closure_dimension */ + +namespace camera_av_settings_user_level_management { +typedef struct config { + uint32_t feature_flags; + config() : feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* camera_av_settings_user_level_management */ + +namespace push_av_stream_transport { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* push_av_stream_transport */ + +namespace commodity_tariff { +typedef struct config { + void *delegate; + uint32_t feature_flags; + config() : delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* commodity_tariff */ + +namespace commodity_price { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* commodity_price */ + +namespace commodity_metering { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* commodity_metering */ + +namespace electrical_grid_conditions { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* electrical_grid_conditions */ + +namespace meter_identification { +using config_t = common::config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* meter_identification */ + +namespace soil_measurement { +using config_t = common::config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* soil_measurement */ + +namespace zone_management { +using config_t = common::config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* zone_management */ + +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_command.cpp b/components/esp_matter/data_model/legacy/esp_matter_command.cpp similarity index 99% rename from components/esp_matter/data_model/esp_matter_command.cpp rename to components/esp_matter/data_model/legacy/esp_matter_command.cpp index 5488d41d6..2d08407b5 100644 --- a/components/esp_matter/data_model/esp_matter_command.cpp +++ b/components/esp_matter/data_model/legacy/esp_matter_command.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include diff --git a/components/esp_matter/data_model/legacy/esp_matter_command_impl.h b/components/esp_matter/data_model/legacy/esp_matter_command_impl.h new file mode 100644 index 000000000..1ea508fb3 --- /dev/null +++ b/components/esp_matter/data_model/legacy/esp_matter_command_impl.h @@ -0,0 +1,625 @@ +// Copyright 2021 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include + +namespace esp_matter { +namespace cluster { + +/** Specific command create APIs + * + * If some standard command is not present here, it can be added. + * If a custom command needs to be created, the low level esp_matter::command::create() API can be used. + */ + +namespace actions { +namespace command { +command_t *create_instant_action(cluster_t *cluster); +command_t *create_instant_action_with_transition(cluster_t *cluster); +command_t *create_start_action(cluster_t *cluster); +command_t *create_start_action_with_duration(cluster_t *cluster); +command_t *create_stop_action(cluster_t *cluster); +command_t *create_pause_action(cluster_t *cluster); +command_t *create_pause_action_with_duration(cluster_t *cluster); +command_t *create_resume_action(cluster_t *cluster); +command_t *create_enable_action(cluster_t *cluster); +command_t *create_enable_action_with_duration(cluster_t *cluster); +command_t *create_disable_action(cluster_t *cluster); +command_t *create_disable_action_with_duration(cluster_t *cluster); +} /* command */ +} /* actions */ + +namespace access_control { +namespace command { +command_t *create_review_fabric_restrictions(cluster_t *cluster); +command_t *create_review_fabric_restrictions_response(cluster_t *cluster); +} /* command */ +} /* access_control */ + +namespace bridged_device_basic_information { +namespace command { +command_t *create_keep_active(cluster_t *cluster); +} /* command */ +} /* bridged_device_basic_information */ + +namespace thread_network_diagnostics { +namespace command { +command_t *create_reset_counts(cluster_t *cluster); +} /* command */ +} /* thread_network_diagnostics */ + +namespace wifi_network_diagnostics { +namespace command { +command_t *create_reset_counts(cluster_t *cluster); +} /* command */ +} /* wifi_network_diagnostics */ + +namespace ethernet_network_diagnostics { +namespace command { +command_t *create_reset_counts(cluster_t *cluster); +} /* command */ +} /* ethernet_network_diagnostics */ + +namespace diagnostic_logs { +namespace command { +command_t *create_retrieve_logs_request(cluster_t *cluster); +command_t *create_retrieve_logs_response(cluster_t *cluster); +} /* command */ +} /* diagnostic_logs */ + +namespace general_diagnostics { +namespace command { +command_t *create_test_event_trigger(cluster_t *cluster); +command_t *create_time_snap_shot(cluster_t *cluster); +command_t *create_time_snap_shot_response(cluster_t *cluster); +command_t *create_payload_test_request(cluster_t *cluster); +command_t *create_payload_test_response(cluster_t *cluster); +} /* command */ +} /* general_diagnostics */ + +namespace software_diagnostics { +namespace command { +command_t *create_reset_watermarks(cluster_t *cluster); +} /* command */ +} /* software_diagnostics */ + +namespace group_key_management { +namespace command { +command_t *create_key_set_write(cluster_t *cluster); +command_t *create_key_set_read(cluster_t *cluster); +command_t *create_key_set_remove(cluster_t *cluster); +command_t *create_key_set_read_all_indices(cluster_t *cluster); +command_t *create_key_set_read_response(cluster_t *cluster); +command_t *create_key_set_read_all_indices_response(cluster_t *cluster); +} /* command */ +} /* group_key_management */ + +namespace general_commissioning { +namespace command { +command_t *create_arm_fail_safe(cluster_t *cluster); +command_t *create_set_regulatory_config(cluster_t *cluster); +command_t *create_commissioning_complete(cluster_t *cluster); +command_t *create_arm_fail_safe_response(cluster_t *cluster); +command_t *create_set_regulatory_config_response(cluster_t *cluster); +command_t *create_commissioning_complete_response(cluster_t *cluster); +command_t *create_set_tc_acknowledgements(cluster_t *cluster); +command_t *create_set_tc_acknowledgements_response(cluster_t *cluster); +} /* command */ +} /* general_commissioning */ + +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG +namespace network_commissioning { +namespace command { +command_t *create_scan_networks(cluster_t *cluster); +command_t *create_add_or_update_wifi_network(cluster_t *cluster); +command_t *create_add_or_update_thread_network(cluster_t *cluster); +command_t *create_remove_network(cluster_t *cluster); +command_t *create_connect_network(cluster_t *cluster); +command_t *create_reorder_network(cluster_t *cluster); +command_t *create_scan_networks_response(cluster_t *cluster); +command_t *create_network_config_response(cluster_t *cluster); +command_t *create_connect_network_response(cluster_t *cluster); +} /* command */ +} /* network_commissioning */ +#endif // CONFIG_CUSTOM_NETWORK_CONFIG + +namespace administrator_commissioning { +namespace command { +command_t *create_open_commissioning_window(cluster_t *cluster); +command_t *create_open_basic_commissioning_window(cluster_t *cluster); +command_t *create_revoke_commissioning(cluster_t *cluster); +} /* command */ +} /* administrator_commissioning */ + +namespace operational_credentials { +namespace command { +command_t *create_attestation_request(cluster_t *cluster); +command_t *create_certificate_chain_request(cluster_t *cluster); +command_t *create_csr_request(cluster_t *cluster); +command_t *create_add_noc(cluster_t *cluster); +command_t *create_update_noc(cluster_t *cluster); +command_t *create_update_fabric_label(cluster_t *cluster); +command_t *create_remove_fabric(cluster_t *cluster); +command_t *create_add_trusted_root_certificate(cluster_t *cluster); +command_t *create_attestation_response(cluster_t *cluster); +command_t *create_certificate_chain_response(cluster_t *cluster); +command_t *create_csr_response(cluster_t *cluster); +command_t *create_noc_response(cluster_t *cluster); +command_t *create_set_vid_verification_statement(cluster_t *cluster); +command_t *create_sign_vid_verification_request(cluster_t *cluster); +command_t *create_sign_vid_verification_response(cluster_t *cluster); +} /* command */ +} /* operational_credentials */ + +namespace ota_software_update_provider { +namespace command { +command_t *create_query_image(cluster_t *cluster); +command_t *create_apply_update_request(cluster_t *cluster); +command_t *create_notify_update_applied(cluster_t *cluster); +command_t *create_query_image_response(cluster_t *cluster); +command_t *create_apply_update_response(cluster_t *cluster); +} /* command */ +} /* ota_software_update_provider */ + +namespace ota_software_update_requestor { +namespace command { +command_t *create_announce_ota_provider(cluster_t *cluster); +} /* command */ +} /* ota_software_update_requestor */ + +namespace identify { +namespace command { +command_t *create_identify(cluster_t *cluster); +command_t *create_trigger_effect(cluster_t *cluster); +} /* command */ +} /* identify */ + +namespace groups { +namespace command { +command_t *create_add_group(cluster_t *cluster); +command_t *create_view_group(cluster_t *cluster); +command_t *create_get_group_membership(cluster_t *cluster); +command_t *create_remove_group(cluster_t *cluster); +command_t *create_remove_all_groups(cluster_t *cluster); +command_t *create_add_group_if_identifying(cluster_t *cluster); +command_t *create_add_group_response(cluster_t *cluster); +command_t *create_view_group_response(cluster_t *cluster); +command_t *create_get_group_membership_response(cluster_t *cluster); +command_t *create_remove_group_response(cluster_t *cluster); +} /* command */ +} /* groups */ + +namespace icd_management { +namespace command { +command_t *create_register_client(cluster_t *cluster); +command_t *create_register_client_response(cluster_t *cluster); +command_t *create_unregister_client(cluster_t *cluster); +command_t *create_stay_active_request(cluster_t *cluster); +command_t *create_stay_active_response(cluster_t *cluster); +} /* command */ +} /* icd_management */ + +namespace scenes_management { +namespace command { +command_t *create_add_scene(cluster_t *cluster); +command_t *create_view_scene(cluster_t *cluster); +command_t *create_remove_scene(cluster_t *cluster); +command_t *create_remove_all_scenes(cluster_t *cluster); +command_t *create_store_scene(cluster_t *cluster); +command_t *create_recall_scene(cluster_t *cluster); +command_t *create_get_scene_membership(cluster_t *cluster); +command_t *create_copy_scene(cluster_t *cluster); +command_t *create_add_scene_response(cluster_t *cluster); +command_t *create_view_scene_response(cluster_t *cluster); +command_t *create_remove_scene_response(cluster_t *cluster); +command_t *create_remove_all_scenes_response(cluster_t *cluster); +command_t *create_store_scene_response(cluster_t *cluster); +command_t *create_get_scene_membership_response(cluster_t *cluster); +command_t *create_copy_scene_response(cluster_t *cluster); +} /* command */ +} /* scenes_management */ + +namespace on_off { +namespace command { +command_t *create_off(cluster_t *cluster); +command_t *create_on(cluster_t *cluster); +command_t *create_toggle(cluster_t *cluster); +command_t *create_off_with_effect(cluster_t *cluster); +command_t *create_on_with_recall_global_scene(cluster_t *cluster); +command_t *create_on_with_timed_off(cluster_t *cluster); +} /* command */ +} /* on_off */ + +namespace level_control { +namespace command { +command_t *create_move_to_level(cluster_t *cluster); +command_t *create_move(cluster_t *cluster); +command_t *create_step(cluster_t *cluster); +command_t *create_stop(cluster_t *cluster); +command_t *create_move_to_level_with_on_off(cluster_t *cluster); +command_t *create_move_with_on_off(cluster_t *cluster); +command_t *create_step_with_on_off(cluster_t *cluster); +command_t *create_stop_with_on_off(cluster_t *cluster); +command_t *create_move_to_closest_frequency(cluster_t *cluster); +} /* command */ +} /* level_control */ + +namespace color_control { +namespace command { +command_t *create_move_to_hue(cluster_t *cluster); +command_t *create_move_hue(cluster_t *cluster); +command_t *create_step_hue(cluster_t *cluster); +command_t *create_move_to_saturation(cluster_t *cluster); +command_t *create_move_saturation(cluster_t *cluster); +command_t *create_step_saturation(cluster_t *cluster); +command_t *create_move_to_hue_and_saturation(cluster_t *cluster); +command_t *create_stop_move_step(cluster_t *cluster); +command_t *create_move_to_color_temperature(cluster_t *cluster); +command_t *create_move_color_temperature(cluster_t *cluster); +command_t *create_step_color_temperature(cluster_t *cluster); +command_t *create_move_to_color(cluster_t *cluster); +command_t *create_move_color(cluster_t *cluster); +command_t *create_step_color(cluster_t *cluster); +command_t *create_enhanced_move_to_hue(cluster_t *cluster); +command_t *create_enhanced_move_hue(cluster_t *cluster); +command_t *create_enhanced_step_hue(cluster_t *cluster); +command_t *create_enhanced_move_to_hue_and_saturation(cluster_t *cluster); +command_t *create_color_loop_set(cluster_t *cluster); +} /* command */ +} /* color_control */ + +namespace thermostat { +namespace command { +command_t *create_setpoint_raise_lower(cluster_t *cluster); +command_t *create_set_active_schedule_request(cluster_t *cluster); +command_t *create_set_active_preset_request(cluster_t *cluster); +command_t *create_atomic_request(cluster_t *cluster); +command_t *create_atomic_response(cluster_t *cluster); +} /* command */ +} /* thermostat */ + +namespace operational_state { +namespace command { +command_t *create_pause(cluster_t *cluster); +command_t *create_stop(cluster_t *cluster); +command_t *create_start(cluster_t *cluster); +command_t *create_resume(cluster_t *cluster); +command_t *create_operational_command_response(cluster_t *cluster); +} /* command */ +} /* operational_state */ + +namespace smoke_co_alarm { +namespace command { +command_t *create_self_test_request(cluster_t *cluster); +} /* command */ +} /* smoke_co_alarm */ + +namespace door_lock { +namespace command { +command_t *create_lock_door(cluster_t *cluster); +command_t *create_unlock_door(cluster_t *cluster); +command_t *create_unlock_with_timeout(cluster_t *cluster); +command_t *create_set_weekday_schedule(cluster_t *cluster); +command_t *create_get_weekday_schedule(cluster_t *cluster); +command_t *create_get_weekday_schedule_response(cluster_t *cluster); +command_t *create_clear_weekday_schedule(cluster_t *cluster); +command_t *create_set_year_day_schedule(cluster_t *cluster); +command_t *create_get_year_day_schedule(cluster_t *cluster); +command_t *create_get_year_day_schedule_response(cluster_t *cluster); +command_t *create_clear_year_day_schedule(cluster_t *cluster); +command_t *create_set_holiday_schedule(cluster_t *cluster); +command_t *create_get_holiday_schedule(cluster_t *cluster); +command_t *create_get_holiday_schedule_response(cluster_t *cluster); +command_t *create_clear_holiday_schedule(cluster_t *cluster); +command_t *create_set_user_type(cluster_t *cluster); +command_t *create_get_user_type(cluster_t *cluster); +command_t *create_get_user_type_response(cluster_t *cluster); +command_t *create_set_user(cluster_t *cluster); +command_t *create_get_user(cluster_t *cluster); +command_t *create_get_user_response(cluster_t *cluster); +command_t *create_clear_user(cluster_t *cluster); +command_t *create_set_credential(cluster_t *cluster); +command_t *create_set_credential_response(cluster_t *cluster); +command_t *create_get_credential_status(cluster_t *cluster); +command_t *create_get_credential_status_response(cluster_t *cluster); +command_t *create_clear_credential(cluster_t *cluster); +command_t *create_unbolt_door(cluster_t *cluster); +command_t *create_set_aliro_reader_config(cluster_t *cluster); +command_t *create_clear_aliro_reader_config(cluster_t *cluster); +} /* command */ +} /* door_lock */ + +namespace window_covering { +namespace command { +command_t *create_up_or_open(cluster_t *cluster); +command_t *create_down_or_close(cluster_t *cluster); +command_t *create_stop_motion(cluster_t *cluster); +command_t *create_go_to_lift_percentage(cluster_t *cluster); +command_t *create_go_to_tilt_percentage(cluster_t *cluster); +} /* command */ +} /* window_covering */ + +namespace mode_select { +namespace command { +command_t *create_change_to_mode(cluster_t *cluster); +} /* command */ +} /* mode_select */ + +namespace temperature_control { +namespace command { +command_t *create_set_temperature(cluster_t *cluster); +} /* command */ +} /* temperature_control */ + +namespace fan_control { +namespace command { +command_t *create_step(cluster_t *cluster); +} /* command */ +} /* fan_control */ + +namespace resource_monitoring { +namespace command { +command_t *create_reset_condition(cluster_t *cluster); +} /* command */ +} /* resource_monitoring */ + +namespace hepa_filter_monitoring { +namespace command = resource_monitoring::command; +} /* hepa_filter_monitoring */ + +namespace activated_carbon_filter_monitoring { +namespace command = resource_monitoring::command; +} /* activated_carbon_filter_monitoring */ + +namespace mode_base { +namespace command { +command_t *create_change_to_mode(cluster_t *cluster); +command_t *create_change_to_mode_response(cluster_t *cluster); +} /* command */ +} /* mode_base */ + +namespace keypad_input { +namespace command { +command_t *create_send_key(cluster_t *cluster); +command_t *create_send_key_response(cluster_t *cluster); +} /* command */ +} /* keypad_input */ + +namespace boolean_state_configuration { +namespace command { +command_t *create_suppress_alarm(cluster_t *cluster); +command_t *create_enable_disable_alarm(cluster_t *cluster); +} /* command */ +} /* boolean_state_configuration */ + +namespace energy_evse { +namespace command { +command_t *create_disable(cluster_t *cluster); +command_t *create_enable_charging(cluster_t *cluster); +command_t *create_enable_discharging(cluster_t *cluster); +command_t *create_start_diagnostics(cluster_t *cluster); +command_t *create_set_targets(cluster_t *cluster); +command_t *create_get_targets(cluster_t *cluster); +command_t *create_clear_targets(cluster_t *cluster); +command_t *create_get_targets_response(cluster_t *cluster); +} /* command */ +} /* energy_evse */ + +namespace microwave_oven_control { +namespace command { +command_t *create_set_cooking_parameters(cluster_t *cluster); +command_t *create_add_more_time(cluster_t *cluster); +} /* command */ +} /* microwave_oven_control */ + +namespace valve_configuration_and_control { +namespace command { +command_t *create_open(cluster_t *cluster); +command_t *create_close(cluster_t *cluster); +} /* command */ +} /* valve_configuration_and_control */ + +namespace device_energy_management { +namespace command { +command_t *create_power_adjust_request(cluster_t *cluster); +command_t *create_cancel_power_adjust_request(cluster_t *cluster); +command_t *create_start_time_adjust_request(cluster_t *cluster); +command_t *create_pause_request(cluster_t *cluster); +command_t *create_resume_request(cluster_t *cluster); +command_t *create_modify_forecast_request(cluster_t *cluster); +command_t *create_request_constraint_based_forecast(cluster_t *cluster); +command_t *create_cancel_request(cluster_t *cluster); +} /* command */ +} /* device_energy_management */ + +namespace thread_border_router_management { +namespace command { +command_t *create_get_active_dataset_request(cluster_t *cluster); +command_t *create_get_pending_dataset_request(cluster_t *cluster); +command_t *create_dataset_response(cluster_t *cluster); +command_t *create_set_active_dataset_request(cluster_t *cluster); +command_t *create_set_pending_dataset_request(cluster_t *cluster); +} /* command */ +} /* thread_border_router_management */ + +namespace wifi_network_management { +namespace command { +command_t *create_network_passphrase_request(cluster_t *cluster); +command_t *create_network_passphrase_response(cluster_t *cluster); +} /* command */ +} /* wifi_network_management */ + +namespace thread_network_directory { +namespace command { +command_t *create_add_network(cluster_t *cluster); +command_t *create_remove_network(cluster_t *cluster); +command_t *create_get_operational_dataset(cluster_t *cluster); +command_t *create_operational_dataset_response(cluster_t *cluster); +} /* command */ +} /* thread_network_directory */ + +namespace service_area { +namespace command { +command_t *create_select_areas(cluster_t *cluster); +command_t *create_select_areas_response(cluster_t *cluster); +command_t *create_skip_area(cluster_t *cluster); +command_t *create_skip_area_response(cluster_t *cluster); +} /* command */ +} /* service_area */ + +namespace water_heater_management { +namespace command { +command_t *create_boost(cluster_t *cluster); +command_t *create_cancel_boost(cluster_t *cluster); +} /* command */ +} /* water_heater_management */ + +namespace commissioner_control { +namespace command { +command_t *create_request_commissioning_approval(cluster_t *cluster); +command_t *create_commission_node(cluster_t *cluster); +command_t *create_reverse_open_commissioning_window(cluster_t *cluster); +} /* command */ +} /* commissioner_control */ + +namespace time_synchronization { +namespace command { +command_t *create_set_utc_time(cluster_t *cluster); +command_t *create_set_trusted_time_source(cluster_t *cluster); +command_t *create_set_time_zone(cluster_t *cluster); +command_t *create_set_time_zone_response(cluster_t *cluster); +command_t *create_set_dst_offset(cluster_t *cluster); +command_t *create_set_default_ntp(cluster_t *cluster); +} /* command */ +} /* time_synchronization */ + +namespace camera_av_stream_management { +namespace command { +command_t *create_audio_stream_allocate(cluster_t *cluster); +command_t *create_audio_stream_allocate_response(cluster_t *cluster); +command_t *create_audio_stream_deallocate(cluster_t *cluster); +command_t *create_video_stream_allocate(cluster_t *cluster); +command_t *create_video_stream_allocate_response(cluster_t *cluster); +command_t *create_video_stream_modify(cluster_t *cluster); +command_t *create_video_stream_deallocate(cluster_t *cluster); +command_t *create_snapshot_stream_allocate(cluster_t *cluster); +command_t *create_snapshot_stream_allocate_response(cluster_t *cluster); +command_t *create_snapshot_stream_modify(cluster_t *cluster); +command_t *create_snapshot_stream_deallocate(cluster_t *cluster); +command_t *create_set_stream_priorities(cluster_t *cluster); +command_t *create_capture_snapshot(cluster_t *cluster); +command_t *create_capture_snapshot_response(cluster_t *cluster); +} /* command */ +} /*camera av stream transport*/ + +namespace webrtc_transport_provider { +namespace command { +command_t *create_solicit_offer(cluster_t *cluster); +command_t *create_solicit_offer_response(cluster_t *cluster); +command_t *create_provide_offer(cluster_t *cluster); +command_t *create_provide_offer_response(cluster_t *cluster); +command_t *create_provide_answer(cluster_t *cluster); +command_t *create_provide_ice_candidates(cluster_t *cluster); +command_t *create_end_session(cluster_t *cluster); +} /* command */ +}/*webrtc transport provider*/ + +namespace webrtc_transport_requestor { +namespace command { +command_t *create_offer(cluster_t *cluster); +command_t *create_answer(cluster_t *cluster); +command_t *create_ice_candidates(cluster_t *cluster); +command_t *create_end(cluster_t *cluster); +} /* command */ +}/*webrtc transport requestor*/ + +namespace chime { +namespace command { +command_t *create_play_chime_sound(cluster_t *cluster); +} /* command */ +} /* chime */ + +namespace closure_control { +namespace command { +command_t *create_stop(cluster_t *cluster); +command_t *create_move_to(cluster_t *cluster); +command_t *create_calibrate(cluster_t *cluster); +} /* command */ +} /* closure_control */ + +namespace closure_dimension { +namespace command { +command_t *create_set_target(cluster_t *cluster); +command_t *create_step(cluster_t *cluster); +} /* command */ +} /* closure_dimension */ + +namespace camera_av_settings_user_level_management { +namespace command { +command_t *create_mptz_set_position(cluster_t *cluster); +command_t *create_mptz_relative_move(cluster_t *cluster); +command_t *create_mptz_move_to_preset(cluster_t *cluster); +command_t *create_mptz_save_preset(cluster_t *cluster); +command_t *create_mptz_remove_preset(cluster_t *cluster); +command_t *create_dptz_set_viewport(cluster_t *cluster); +command_t *create_dptz_relative_move(cluster_t *cluster); +} /* command */ +} /* camera_av_settings_user_level_management */ + +namespace push_av_stream_transport { +namespace command { +command_t *create_allocate_push_transport(cluster_t *cluster); +command_t *create_allocate_push_transport_response(cluster_t *cluster); +command_t *create_deallocate_push_transport(cluster_t *cluster); +command_t *create_modify_push_transport(cluster_t *cluster); +command_t *create_set_transport_status(cluster_t *cluster); +command_t *create_manually_trigger_transport(cluster_t *cluster); +command_t *create_find_transport(cluster_t *cluster); +command_t *create_find_transport_response(cluster_t *cluster); +} /* command */ +} /* push_av_stream_transport */ + +namespace commodity_tariff { +namespace command { +command_t *create_get_tariff_component(cluster_t *cluster); +command_t *create_get_tariff_component_response(cluster_t *cluster); +command_t *create_get_day_entry(cluster_t *cluster); +command_t *create_get_day_entry_response(cluster_t *cluster); +} /* command */ +} /* commodity_tariff */ + +namespace commodity_price { +namespace command { +command_t *create_get_detailed_price_request(cluster_t *cluster); +command_t *create_get_detailed_price_response(cluster_t *cluster); +command_t *create_get_detailed_forecast_request(cluster_t *cluster); +command_t *create_get_detailed_forecast_response(cluster_t *cluster); +} /* command */ +} /* commodity_price */ + +namespace zone_management { +namespace command { +command_t *create_two_d_cartesian_zone(cluster_t *cluster); +command_t *create_two_d_cartesian_zone_response(cluster_t *cluster); +command_t *create_update_two_d_cartesian_zone(cluster_t *cluster); +command_t *create_remove_zone(cluster_t *cluster); +command_t *create_or_update_trigger(cluster_t *cluster); +command_t *create_remove_trigger(cluster_t *cluster); +} /* command */ +} /* zone_management */ + +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_endpoint.cpp b/components/esp_matter/data_model/legacy/esp_matter_endpoint.cpp similarity index 99% rename from components/esp_matter/data_model/esp_matter_endpoint.cpp rename to components/esp_matter/data_model/legacy/esp_matter_endpoint.cpp index 5f18a2dca..067e34a0a 100644 --- a/components/esp_matter/data_model/esp_matter_endpoint.cpp +++ b/components/esp_matter/data_model/legacy/esp_matter_endpoint.cpp @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "esp_matter_cluster.h" +#include "esp_matter_cluster_impl.h" #include #include -#include +#include #include static const char *TAG = "esp_matter_endpoint"; diff --git a/components/esp_matter/data_model/legacy/esp_matter_endpoint_impl.h b/components/esp_matter/data_model/legacy/esp_matter_endpoint_impl.h new file mode 100644 index 000000000..b29fadee5 --- /dev/null +++ b/components/esp_matter/data_model/legacy/esp_matter_endpoint_impl.h @@ -0,0 +1,1243 @@ +// Copyright 2021 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include + +/* Replace these with IDs from submodule whenever they are implemented */ +#define ESP_MATTER_ROOT_NODE_DEVICE_TYPE_ID 0x0016 +#define ESP_MATTER_ROOT_NODE_DEVICE_TYPE_VERSION 4 +#define ESP_MATTER_OTA_REQUESTOR_DEVICE_TYPE_ID 0x0012 +#define ESP_MATTER_OTA_REQUESTOR_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_OTA_PROVIDER_DEVICE_TYPE_ID 0x0014 +#define ESP_MATTER_OTA_PROVIDER_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_POWER_SOURCE_DEVICE_TYPE_ID 0x0011 +#define ESP_MATTER_POWER_SOURCE_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_AGGREGATOR_DEVICE_TYPE_ID 0x000E +#define ESP_MATTER_AGGREGATOR_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_BRIDGED_NODE_DEVICE_TYPE_ID 0x0013 +#define ESP_MATTER_BRIDGED_NODE_DEVICE_TYPE_VERSION 3 +#define ESP_MATTER_CONTROL_BRIDGE_DEVICE_TYPE_ID 0x0840 +#define ESP_MATTER_CONTROL_BRIDGE_DEVICE_TYPE_VERSION 3 + +#define ESP_MATTER_ON_OFF_LIGHT_DEVICE_TYPE_ID 0x0100 +#define ESP_MATTER_ON_OFF_LIGHT_DEVICE_TYPE_VERSION 3 +#define ESP_MATTER_DIMMABLE_LIGHT_DEVICE_TYPE_ID 0x0101 +#define ESP_MATTER_DIMMABLE_LIGHT_DEVICE_TYPE_VERSION 3 +#define ESP_MATTER_COLOR_TEMPERATURE_LIGHT_DEVICE_TYPE_ID 0x010C +#define ESP_MATTER_COLOR_TEMPERATURE_LIGHT_DEVICE_TYPE_VERSION 4 +#define ESP_MATTER_EXTENDED_COLOR_LIGHT_DEVICE_TYPE_ID 0x010D +#define ESP_MATTER_EXTENDED_COLOR_LIGHT_DEVICE_TYPE_VERSION 4 + +#define ESP_MATTER_ON_OFF_LIGHT_SWITCH_DEVICE_TYPE_ID 0x0103 +#define ESP_MATTER_ON_OFF_LIGHT_SWITCH_DEVICE_TYPE_VERSION 3 +#define ESP_MATTER_DIMMER_SWITCH_DEVICE_TYPE_ID 0x0104 +#define ESP_MATTER_DIMMER_SWITCH_DEVICE_TYPE_VERSION 3 +#define ESP_MATTER_COLOR_DIMMER_SWITCH_DEVICE_TYPE_ID 0x0105 +#define ESP_MATTER_COLOR_DIMMER_SWITCH_DEVICE_TYPE_VERSION 3 +#define ESP_MATTER_GENERIC_SWITCH_DEVICE_TYPE_ID 0x000F +#define ESP_MATTER_GENERIC_SWITCH_DEVICE_TYPE_VERSION 3 + +#define ESP_MATTER_ON_OFF_PLUG_IN_UNIT_DEVICE_TYPE_ID 0x010A +#define ESP_MATTER_ON_OFF_PLUG_IN_UNIT_DEVICE_TYPE_VERSION 4 +#define ESP_MATTER_DIMMABLE_PLUG_IN_UNIT_DEVICE_TYPE_ID 0x010B +#define ESP_MATTER_DIMMABLE_PLUG_IN_UNIT_DEVICE_TYPE_VERSION 5 +#define ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_ID 0x010F +#define ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_ID 0x0110 +#define ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_VERSION 2 + +#define ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_ID 0x0302 +#define ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_VERSION 3 +#define ESP_MATTER_OCCUPANCY_SENSOR_DEVICE_TYPE_ID 0x0107 +#define ESP_MATTER_OCCUPANCY_SENSOR_DEVICE_TYPE_VERSION 4 +#define ESP_MATTER_CONTACT_SENSOR_DEVICE_TYPE_ID 0x0015 +#define ESP_MATTER_CONTACT_SENSOR_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_LIGHT_SENSOR_DEVICE_TYPE_ID 0x0106 +#define ESP_MATTER_LIGHT_SENSOR_DEVICE_TYPE_VERSION 3 +#define ESP_MATTER_PRESSURE_SENSOR_DEVICE_TYPE_ID 0x0305 +#define ESP_MATTER_PRESSURE_SENSOR_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_FLOW_SENSOR_DEVICE_TYPE_ID 0x0306 +#define ESP_MATTER_FLOW_SENSOR_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_HUMIDITY_SENSOR_DEVICE_TYPE_ID 0x0307 +#define ESP_MATTER_HUMIDITY_SENSOR_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_ROOM_AIR_CONDITIONER_DEVICE_TYPE_ID 0x0072 +#define ESP_MATTER_ROOM_AIR_CONDITIONER_DEVICE_TYPE_VERSION 3 +#define ESP_MATTER_REFRIGERATOR_DEVICE_TYPE_ID 0x0070 +#define ESP_MATTER_REFRIGERATOR_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_TEMPERATURE_CONTROLLED_CABINET_DEVICE_TYPE_ID 0x0071 +#define ESP_MATTER_TEMPERATURE_CONTROLLED_CABINET_DEVICE_TYPE_VERSION 5 +#define ESP_MATTER_LAUNDRY_WASHER_DEVICE_TYPE_ID 0x0073 +#define ESP_MATTER_LAUNDRY_WASHER_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_DISH_WASHER_DEVICE_TYPE_ID 0x0075 +#define ESP_MATTER_DISH_WASHER_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_MICROWAVE_OVEN_DEVICE_TYPE_ID 0x0079 +#define ESP_MATTER_MICROWAVE_OVEN_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_SMOKE_CO_ALARM_DEVICE_TYPE_ID 0x0076 +#define ESP_MATTER_SMOKE_CO_ALARM_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_LAUNDRY_DRYER_DEVICE_TYPE_ID 0x007C +#define ESP_MATTER_LAUNDRY_DRYER_DEVICE_TYPE_VERSION 2 + +#define ESP_MATTER_FAN_DEVICE_TYPE_ID 0x002B +#define ESP_MATTER_FAN_DEVICE_TYPE_VERSION 4 +#define ESP_MATTER_THERMOSTAT_DEVICE_TYPE_ID 0x0301 +#define ESP_MATTER_THERMOSTAT_DEVICE_TYPE_VERSION 4 +#define ESP_MATTER_AIR_QUALITY_SENSOR_DEVICE_TYPE_ID 0x002C +#define ESP_MATTER_AIR_QUALITY_SENSOR_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_AIR_PURIFIER_DEVICE_TYPE_ID 0x002D +#define ESP_MATTER_AIR_PURIFIER_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_ID 0x000A +#define ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_VERSION 3 +#define ESP_MATTER_WINDOW_COVERING_DEVICE_TYPE_ID 0x0202 +#define ESP_MATTER_WINDOW_COVERING_DEVICE_TYPE_VERSION 5 +#define ESP_MATTER_PUMP_DEVICE_TYPE_ID 0x0303 +#define ESP_MATTER_PUMP_DEVICE_TYPE_VERSION 3 +#define ESP_MATTER_PUMP_CONTROLLER_DEVICE_TYPE_ID 0x0304 +#define ESP_MATTER_PUMP_CONTROLLER_DEVICE_TYPE_VERSION 4 +#define ESP_MATTER_MODE_SELECT_DEVICE_TYPE_ID 0x0027 +#define ESP_MATTER_MODE_SELECT_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_ROBOTIC_VACUUM_CLEANER_DEVICE_TYPE_ID 0x0074 +#define ESP_MATTER_ROBOTIC_VACUUM_CLEANER_DEVICE_TYPE_VERSION 4 +#define ESP_MATTER_WATER_LEAK_DETECTOR_DEVICE_TYPE_ID 0x0043 +#define ESP_MATTER_WATER_LEAK_DETECTOR_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_ID 0x0044 +#define ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_COOK_SURFACE_DEVICE_TYPE_ID 0x0077 +#define ESP_MATTER_COOK_SURFACE_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_COOKTOP_DEVICE_TYPE_ID 0x0078 +#define ESP_MATTER_COOKTOP_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_ID 0x0510 +#define ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_OVEN_DEVICE_TYPE_ID 0x007B +#define ESP_MATTER_OVEN_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_WATER_FREEZE_DETECTOR_DEVICE_TYPE_ID 0x0041 +#define ESP_MATTER_WATER_FREEZE_DETECTOR_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_ENERGY_EVSE_DEVICE_TYPE_ID 0x050C +#define ESP_MATTER_ENERGY_EVSE_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_EXTRACTOR_HOOD_DEVICE_TYPE_ID 0x007A +#define ESP_MATTER_EXTRACTOR_HOOD_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_WATER_VALVE_DEVICE_TYPE_ID 0x0042 +#define ESP_MATTER_WATER_VALVE_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_DEVICE_ENERGY_MANAGEMENT_DEVICE_TYPE_ID 0x050D +#define ESP_MATTER_DEVICE_ENERGY_MANAGEMENT_DEVICE_TYPE_VERSION 3 +#define ESP_MATTER_SECONDARY_NETWORK_INTERFACE_DEVICE_TYPE_ID 0x0019 +#define ESP_MATTER_SECONDARY_NETWORK_INTERFACE_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_WATER_HEATER_DEVICE_TYPE_ID 0x050F +#define ESP_MATTER_WATER_HEATER_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_SOLAR_POWER_DEVICE_TYPE_ID 0x0017 +#define ESP_MATTER_SOLAR_POWER_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_BATTERY_STORAGE_DEVICE_TYPE_ID 0x0018 +#define ESP_MATTER_BATTERY_STORAGE_DEVICE_TYPE_VERSION 2 + +#define ESP_MATTER_THREAD_BORDER_ROUTER_DEVICE_TYPE_ID 0x0091 +#define ESP_MATTER_THREAD_BORDER_ROUTER_DEVICE_TYPE_VERSION 2 +#define ESP_MATTER_HEAT_PUMP_DEVICE_TYPE_ID 0x0309 +#define ESP_MATTER_HEAT_PUMP_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_THERMOSTAT_CONTROLLER_DEVICE_TYPE_ID 0x030A +#define ESP_MATTER_THERMOSTAT_CONTROLLER_DEVICE_TYPE_VERSION 1 + +#define ESP_MATTER_CAMERA_DEVICE_TYPE_ID 0x0142 +#define ESP_MATTER_CAMERA_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_CLOSURE_CONTROLLER_DEVICE_TYPE_ID 0x023E +#define ESP_MATTER_CLOSURE_CONTROLLER_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_CLOSURE_DEVICE_TYPE_ID 0x0230 +#define ESP_MATTER_CLOSURE_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_CLOSURE_PANEL_DEVICE_TYPE_ID 0x0231 +#define ESP_MATTER_CLOSURE_PANEL_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_CHIME_DEVICE_TYPE_ID 0x0146 +#define ESP_MATTER_CHIME_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_ELECTRICAL_UTILITY_METER_DEVICE_TYPE_ID 0x0511 +#define ESP_MATTER_ELECTRICAL_UTILITY_METER_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_ELECTRICAL_ENERGY_TARIFF_DEVICE_TYPE_ID 0x0513 +#define ESP_MATTER_ELECTRICAL_ENERGY_TARIFF_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_ELECTRICAL_METER_DEVICE_TYPE_ID 0x0514 +#define ESP_MATTER_ELECTRICAL_METER_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_SOIL_SENSOR_DEVICE_TYPE_ID 0x0045 +#define ESP_MATTER_SOIL_SENSOR_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_ID 0x0040 +#define ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_VERSION 1 + +namespace esp_matter { + +/** Specific endpoint (device type) create APIs + * + * These APIs also create the mandatory clusters and the mandatory attributes and commands for the clusters. + * The configs has the cluster configs for the mandatory clusters, if it exists. + * + * If some standard endpoint (device type) is not present here, it can be added. + * If a custom endpoint needs to be created, the low level esp_matter::endpoint::create() API can be used. + */ +namespace endpoint { + +typedef struct { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; +} app_base_config; + +typedef struct : app_base_config { + cluster::groups::config_t groups; +} app_with_group_config; + +typedef struct : app_base_config { + cluster::binding::config_t binding; +} app_client_config; + +typedef struct : app_with_group_config { + cluster::on_off::config_t on_off; + cluster::on_off::feature::lighting::config_t on_off_lighting; + cluster::scenes_management::config_t scenes_management; +} on_off_with_lighting_config; + +typedef struct : app_with_group_config { + cluster::scenes_management::config_t scenes_management; + cluster::on_off::config_t on_off; +} on_off_config; + +typedef struct : app_base_config { + cluster::boolean_state::config_t boolean_state; +} app_with_bool_state_config; + +typedef struct { + cluster::descriptor::config_t descriptor; + cluster::operational_state::config_t operational_state; +} app_with_operational_state_config; + +namespace root_node { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::access_control::config_t access_control; + cluster::basic_information::config_t basic_information; + cluster::general_commissioning::config_t general_commissioning; +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG + cluster::network_commissioning::config_t network_commissioning; +#endif + cluster::general_diagnostics::config_t general_diagnostics; + cluster::administrator_commissioning::config_t administrator_commissioning; + cluster::operational_credentials::config_t operational_credentials; + cluster::icd_management::config_t icd_management; + cluster::icd_management::feature::user_active_mode_trigger::config_t icd_user_active_mode_trigger; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* root_node */ + +namespace ota_requestor { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::ota_software_update_requestor::config_t ota_software_update_requestor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* ota_requestor */ + +namespace ota_provider { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::ota_software_update_provider::config_t ota_software_update_provider; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* ota_provider */ + +namespace power_source { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::power_source::config_t power_source; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* power_source */ + +namespace on_off_light { + +typedef struct config : on_off_with_lighting_config { + config() + { + /* For lighting product, the default identify type should be 0x01: LightOutput*/ + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kLightOutput); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* on_off_light */ + +namespace dimmable_light { +typedef struct config : on_off_light::config_t { + cluster::level_control::config_t level_control; + cluster::level_control::feature::lighting::config_t level_control_lighting; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* dimmable_light */ + +namespace color_temperature_light { +typedef struct config : dimmable_light::config_t { + cluster::color_control::config_t color_control; + cluster::color_control::feature::color_temperature::config_t color_control_color_temperature; + uint16_t color_control_remaining_time; + config() : color_control_remaining_time(0) {} +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* color_temperature_light */ + +namespace extended_color_light { +typedef struct config : dimmable_light::config_t { + cluster::color_control::config_t color_control; + cluster::color_control::feature::color_temperature::config_t color_control_color_temperature; + cluster::color_control::feature::xy::config_t color_control_xy; + uint16_t color_control_remaining_time; + + config() : color_control_remaining_time(0) {} +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* extended_color_light */ + +namespace on_off_light_switch { + +typedef struct config : app_client_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* on_off_light_switch */ + +namespace dimmer_switch { + +typedef struct config : app_client_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* dimmer_switch */ + +namespace color_dimmer_switch { + +typedef struct config : app_client_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* color_dimmer_switch */ + +namespace generic_switch { +typedef struct config : app_base_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } + cluster::switch_cluster::config_t switch_cluster; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* generic_switch */ + +namespace on_off_plug_in_unit { + +typedef struct config : on_off_with_lighting_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* on_off_plug_in_unit */ + +namespace dimmable_plug_in_unit { +typedef struct config : on_off_plug_in_unit::config_t { + cluster::level_control::config_t level_control; + cluster::level_control::feature::lighting::config_t level_control_lighting; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* dimmable_plug_in_unit */ + +namespace fan { +typedef struct config : app_with_group_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); + } + cluster::fan_control::config_t fan_control; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* fan */ + +namespace thermostat { +typedef struct config : app_with_group_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } + cluster::scenes_management::config_t scenes_management; + cluster::thermostat::config_t thermostat; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* thermostat */ + +namespace air_quality_sensor { +typedef struct config : app_base_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } + cluster::air_quality::config_t air_quality; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* air_quality_sensor */ + +namespace air_purifier { +typedef struct config : app_base_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); + } + cluster::fan_control::config_t fan_control; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* air_purifier */ + +namespace dish_washer { +using config_t = app_with_operational_state_config; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* dish_washer */ + +namespace laundry_washer { +using config_t = app_with_operational_state_config; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* laundry_washer */ + +namespace laundry_dryer { +using config_t = app_with_operational_state_config; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* laundry_dryer */ + +namespace smoke_co_alarm { +typedef struct config : app_base_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep); + } + cluster::smoke_co_alarm::config_t smoke_co_alarm; +} config_t; +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* smoke_co_alarm */ + +namespace aggregator { +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* aggregator */ + +namespace bridged_node { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::bridged_device_basic_information::config_t bridged_device_basic_information; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +endpoint_t *resume(node_t *node, config_t *config, uint8_t flags, uint16_t endpoint_id, void *priv_data); +} /* bridged_node */ + +namespace control_bridge { + +using config_t = app_client_config; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* control_bridge */ + +namespace door_lock { +typedef struct config : app_base_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep); + } + cluster::door_lock::config_t door_lock; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* door_lock */ + +namespace window_covering { +typedef struct config : app_with_group_config { + cluster::window_covering::config_t window_covering; + config(uint8_t end_product_type = 0) : window_covering(end_product_type) + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* window_covering */ + +namespace temperature_sensor { +typedef struct config : app_base_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } + cluster::temperature_measurement::config_t temperature_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* temperature_sensor */ + +namespace humidity_sensor { +typedef struct config : app_base_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } + cluster::relative_humidity_measurement::config_t relative_humidity_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* humidity_sensor */ + +namespace occupancy_sensor { +typedef struct config : app_base_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep); + } + cluster::occupancy_sensing::config_t occupancy_sensing; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* occupancy_sensor */ + +namespace contact_sensor { + +typedef struct config : app_with_bool_state_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* contact_sensor */ + +namespace light_sensor { +typedef struct config : app_base_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } + cluster::illuminance_measurement::config_t illuminance_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* light_sensor */ + +namespace pressure_sensor { +typedef struct config : app_base_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } + cluster::pressure_measurement::config_t pressure_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* pressure_sensor */ + +namespace flow_sensor { +typedef struct config : app_base_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } + cluster::flow_measurement::config_t flow_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* flow_sensor */ + +namespace pump { +typedef struct config : app_base_config { + cluster::on_off::config_t on_off; + cluster::pump_configuration_and_control::config_t pump_configuration_and_control; + config( + nullable max_pressure = nullable(), + nullable max_speed = nullable(), + nullable max_flow = nullable() + ) : pump_configuration_and_control(max_pressure, max_speed, max_flow) + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** pump **/ + +namespace pump_controller { +typedef struct config : app_client_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** pump_controller **/ + +namespace mode_select { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::mode_select::config_t mode_select; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** mode_select **/ + +namespace room_air_conditioner { +typedef struct config : app_base_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); + } + cluster::on_off::config_t on_off; + cluster::thermostat::config_t thermostat; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** room air conditioner **/ + +namespace temperature_controlled_cabinet { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::temperature_control::config_t temperature_control; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** temperature_controlled_cabinet **/ + +namespace refrigerator { +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** refrigerator **/ + +namespace oven { +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** oven **/ + +namespace robotic_vacuum_cleaner { +typedef struct config : app_base_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); + } + cluster::rvc_run_mode::config_t rvc_run_mode; + cluster::rvc_operational_state::config_t rvc_operational_state; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** robotic_vacuum_cleaner **/ + +namespace water_leak_detector { + +typedef struct config : app_with_bool_state_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* water_leak_detector */ + +namespace water_freeze_detector { + +typedef struct config : app_with_bool_state_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* water_freeze_detector */ + +namespace rain_sensor { + +typedef struct config : app_with_bool_state_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* rain_sensor */ + +namespace electrical_sensor { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::power_topology::config_t power_topology; + cluster::electrical_power_measurement::config_t electrical_power_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* electrical_sensor */ + +namespace cook_surface { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::temperature_control::config_t temperature_control; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* cook_surface */ + +namespace cooktop { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::on_off::config_t on_off; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* cooktop */ + +namespace energy_evse { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::energy_evse::config_t energy_evse; + cluster::energy_evse_mode::config_t energy_evse_mode; + cluster::device_energy_management::config_t device_energy_management; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* energy_evse */ + +namespace microwave_oven { +typedef struct config : app_with_operational_state_config { + cluster::microwave_oven_mode::config_t microwave_oven_mode; + cluster::microwave_oven_control::config_t microwave_oven_control; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* microwave_oven */ + +namespace extractor_hood { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::fan_control::config_t fan_control; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* extractor_hood */ + +namespace water_valve { +typedef struct config : app_base_config { + cluster::valve_configuration_and_control::config_t valve_configuration_and_control; + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** water_valve **/ + +namespace device_energy_management { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::device_energy_management::config_t device_energy_management; + cluster::device_energy_management_mode::config_t device_energy_management_mode; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* device_energy_management */ + +namespace thread_border_router { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::thread_network_diagnostics::config_t thread_network_diagnostics; + cluster::thread_border_router_management::config_t thread_border_router_management; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* thread_border_router */ + +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG +namespace secondary_network_interface { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::network_commissioning::config_t network_commissioning; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* secondary_network_interface */ +#endif // CONFIG_CUSTOM_NETWORK_CONFIG + +namespace mounted_on_off_control { +typedef struct config : on_off_with_lighting_config { + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** mounted_on_off_control **/ + +namespace mounted_dimmable_load_control { +using config_t = dimmable_light::config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** mounted_dimmable_load_control **/ + +namespace water_heater { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::thermostat::config_t thermostat; + cluster::water_heater_management::config_t water_heater_management; + cluster::water_heater_mode::config_t water_heater_mode; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* water_heater */ + +namespace solar_power { +typedef struct config { + cluster::descriptor::config_t descriptor; + endpoint::power_source::config_t power_source_device; + electrical_sensor::config_t electrical_sensor; + cluster::electrical_energy_measurement::config_t electrical_energy_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* solar_power */ + +namespace battery_storage { +typedef struct config { + cluster::descriptor::config_t descriptor; + endpoint::power_source::config_t power_source_device; + electrical_sensor::config_t electrical_sensor; + device_energy_management::config_t device_energy_management; + cluster::electrical_energy_measurement::config_t electrical_energy_measurement; + + nullable bat_voltage; + nullable bat_percent_remaining; + nullable bat_time_remaining; + uint32_t bat_capacity; + nullable bat_time_to_full_charge; + nullable bat_charging_current; + + nullable voltage; + nullable active_current; + + config(): bat_voltage(), bat_percent_remaining(), bat_capacity(0), bat_time_to_full_charge(), bat_charging_current(), voltage(0), active_current(0) {} +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** battery_storage **/ + +namespace heat_pump { +typedef struct config { + cluster::descriptor::config_t descriptor; + endpoint::power_source::config_t power_source_device; + electrical_sensor::config_t electrical_sensor; + device_energy_management::config_t device_energy_management; + cluster::electrical_energy_measurement::config_t electrical_energy_measurement; + + nullable voltage; + nullable active_current; + + config(): voltage(0), active_current(0) {} +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** heat_pump **/ + +namespace camera { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::camera_av_stream_management::config_t camera_av_stream_management; + cluster::webrtc_transport_provider::config_t webrtc_transport_provider; + cluster::webrtc_transport_requestor::config_t webrtc_transport_requestor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); + +} /* camera */ + +namespace chime { + +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::chime::config_t chime; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); + +} /* chime */ + +namespace thermostat_controller { +using config_t = app_client_config; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /** thermostat_controller **/ + +namespace closure_controller { +using config_t = app_client_config; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* closure_controller */ + +namespace closure { +typedef struct config : app_base_config { + cluster::closure_control::config_t closure_control; + + config() + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); + } +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* closure */ + +namespace closure_panel { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::closure_dimension::config_t closure_dimension; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* closure_panel */ + +namespace electrical_utility_meter { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::meter_identification::config_t meter_identification; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* electrical_utility_meter */ + +namespace electrical_energy_tariff { +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* electrical_energy_tariff */ + +namespace electrical_meter { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::electrical_power_measurement::config_t electrical_power_measurement; + cluster::electrical_energy_measurement::config_t electrical_energy_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* electrical_meter */ + +namespace soil_sensor { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::soil_measurement::config_t soil_measurement; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} /* soil_sensor */ + +namespace irrigation_system { +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} +} /* endpoint */ + +namespace node { +/** Standard node create + * + * This creates the node, sets the attribute and the identification callbacks and also adds the root node device type, which + * is by default added to endpoint 0 (since this is the first endpoint which is created). + */ + +typedef struct config { + endpoint::root_node::config_t root_node; +} config_t; + +/** + * @param[in] config Configuration of the root node, a pointer to an object of type `node::config_t`. + * @param[in] attribute_callback This callback is called for every attribute update. The callback implementation shall + * handle the desired attributes and return an appropriate error code. If the attribute + * is not of your interest, please do not return an error code and strictly return ESP_OK. + * @param[in] identify_callback This callback is invoked when clients interact with the Identify Cluster. + * In the callback implementation, an endpoint can identify itself. + * (e.g., by flashing an LED or light). + * @param[in] priv_data Private data to send to the node. This parameter is optional + * and defaults to nullptr.This private data can be accessed in the attribute callback + * for the root endpoint only. + */ +node_t *create(config_t *config, attribute::callback_t attribute_callback, + identification::callback_t identify_callback, void* priv_data = nullptr); + +} /* node */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_event.cpp b/components/esp_matter/data_model/legacy/esp_matter_event.cpp similarity index 99% rename from components/esp_matter/data_model/esp_matter_event.cpp rename to components/esp_matter/data_model/legacy/esp_matter_event.cpp index 7a8724b24..14848dc84 100644 --- a/components/esp_matter/data_model/esp_matter_event.cpp +++ b/components/esp_matter/data_model/legacy/esp_matter_event.cpp @@ -13,7 +13,7 @@ // limitations under the License. #include -#include +#include #include #include diff --git a/components/esp_matter/data_model/legacy/esp_matter_event_impl.h b/components/esp_matter/data_model/legacy/esp_matter_event_impl.h new file mode 100644 index 000000000..479a310d5 --- /dev/null +++ b/components/esp_matter/data_model/legacy/esp_matter_event_impl.h @@ -0,0 +1,301 @@ +// Copyright 2022 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include + +namespace esp_matter { +namespace cluster { + +/** Specific event send APIs + * + * If some standard event is not present here, it can be added. + */ + +namespace access_control { +namespace event { +event_t *create_access_control_entry_changed(cluster_t *cluster); +event_t *create_access_control_extension_changed(cluster_t *cluster); +event_t *create_fabric_restriction_review_update(cluster_t *cluster); +} // namespace event +} // namespace access_control + +namespace actions { +namespace event { +event_t *create_state_changed(cluster_t *cluster); +event_t *create_action_failed(cluster_t *cluster); +} // namespace event +} // namespace actions +namespace basic_information { +namespace event { +event_t *create_start_up(cluster_t *cluster); +event_t *create_shut_down(cluster_t *cluster); +event_t *create_leave(cluster_t *cluster); +event_t *create_reachable_changed(cluster_t *cluster); +} // namespace event +} // namespace basic_information + +namespace ota_software_update_requestor { +namespace event { +event_t *create_state_transition(cluster_t *cluster); +event_t *create_version_applied(cluster_t *cluster); +event_t *create_download_error(cluster_t *cluster); +} // namespace event +} // namespace ota_software_update_requestor + +namespace general_diagnostics { +namespace event { +event_t *create_hardware_fault_change(cluster_t *cluster); +event_t *create_radio_fault_change(cluster_t *cluster); +event_t *create_network_fault_change(cluster_t *cluster); +event_t *create_boot_reason(cluster_t *cluster); +} // namespace event +} // namespace general_diagnostics + +namespace wifi_network_diagnostics { +namespace event { +event_t *create_disconnection(cluster_t *cluster); +event_t *create_association_failure(cluster_t *cluster); +event_t *create_connection_status(cluster_t *cluster); +} // namespace event +} // namespace wifi_network_diagnostics + +namespace thread_network_diagnostics { +namespace event { +event_t *create_connection_status(cluster_t *cluster); +event_t *create_network_fault_change(cluster_t *cluster); +} // namespace event +} // namespace thread_network_diagnostics + +namespace software_diagnostics { +namespace event { +event_t *create_software_fault(cluster_t *cluster); +} // namespace event +} // namespace software_diagnostics + +namespace time_synchronization { +namespace event { +event_t *create_dst_table_empty(cluster_t *cluster); +event_t *create_dst_status(cluster_t *cluster); +event_t *create_time_zone_status(cluster_t *cluster); +event_t *create_time_failure(cluster_t *cluster); +event_t *create_missing_trusted_time_source(cluster_t *cluster); +} // namespace event +} // namespace time_synchronization + +namespace bridged_device_basic_information { +namespace event { +event_t *create_active_changed(cluster_t *cluster); +event_t *create_start_up(cluster_t *cluster); +event_t *create_shut_down(cluster_t *cluster); +event_t *create_leave(cluster_t *cluster); +event_t *create_reachable_changed(cluster_t *cluster); +} // namespace event +} // namespace bridged_device_basic_information + +namespace power_source { +namespace event { +event_t *create_wired_fault_change(cluster_t *cluster); +event_t *create_bat_fault_change(cluster_t *cluster); +event_t *create_bat_charge_fault_change(cluster_t *cluster); +} +} + +namespace smoke_co_alarm { +namespace event { +event_t *create_smoke_alarm(cluster_t *cluster); +event_t *create_co_alarm(cluster_t *cluster); +event_t *create_low_battery(cluster_t *cluster); +event_t *create_hardware_fault(cluster_t *cluster); +event_t *create_end_of_service(cluster_t *cluster); +event_t *create_self_test_complete(cluster_t *cluster); +event_t *create_alarm_muted(cluster_t *cluster); +event_t *create_mute_ended(cluster_t *cluster); +event_t *create_interconnect_smoke_alarm(cluster_t *cluster); +event_t *create_interconnect_co_alarm(cluster_t *cluster); +event_t *create_all_clear(cluster_t *cluster); +} // namespace event +} // namespace smoke_co_alarm + +namespace door_lock { +namespace event { +event_t *create_door_lock_alarm(cluster_t *cluster); +event_t *create_door_state_change(cluster_t *cluster); +event_t *create_lock_operation(cluster_t *cluster); +event_t *create_lock_operation_error(cluster_t *cluster); +event_t *create_lock_user_change(cluster_t *cluster); +} // namespace event +} // namespace door_lock + +namespace switch_cluster { +namespace event { +event_t *create_switch_latched(cluster_t *cluster); +event_t *create_initial_press(cluster_t *cluster); +event_t *create_long_press(cluster_t *cluster); +event_t *create_short_release(cluster_t *cluster); +event_t *create_long_release(cluster_t *cluster); +event_t *create_multi_press_ongoing(cluster_t *cluster); +event_t *create_multi_press_complete(cluster_t *cluster); + +esp_err_t send_switch_latched(chip::EndpointId endpoint, uint8_t new_position); +esp_err_t send_initial_press(chip::EndpointId endpoint, uint8_t new_position); +esp_err_t send_long_press(chip::EndpointId endpoint, uint8_t new_position); +esp_err_t send_short_release(chip::EndpointId endpoint, uint8_t previous_position); +esp_err_t send_long_release(chip::EndpointId endpoint, uint8_t previous_position); +esp_err_t send_multi_press_ongoing(chip::EndpointId endpoint, uint8_t new_position, uint8_t count); +esp_err_t send_multi_press_complete(chip::EndpointId endpoint, uint8_t new_position, uint8_t count); +} // namespace event +} // namespace switch_cluster + +namespace boolean_state { +namespace event { +event_t *create_state_change(cluster_t *cluster); +} // namespace event +} // namespace boolean_state + +namespace boolean_state_configuration { +namespace event { +event_t *create_alarms_state_changed(cluster_t *cluster); +event_t *create_sensor_fault(cluster_t *cluster); +} // namespace event +} // namespace boolean_state_configuration + +namespace operational_state { +namespace event { +event_t *create_operational_error(cluster_t *cluster); +event_t *create_operation_completion(cluster_t *cluster); +} // namespace event +} // namespace operational_state + +namespace pump_configuration_and_control { +namespace event { +event_t *create_supply_voltage_low(cluster_t *cluster); +event_t *create_supply_voltage_high(cluster_t *cluster); +event_t *create_power_missing_phase(cluster_t *cluster); +event_t *create_system_pressure_low(cluster_t *cluster); +event_t *create_system_pressure_high(cluster_t *cluster); +event_t *create_dry_running(cluster_t *cluster); +event_t *create_motor_temperature_high(cluster_t *cluster); +event_t *create_pump_motor_fatal_failure(cluster_t *cluster); +event_t *create_electronic_temperature_high(cluster_t *cluster); +event_t *create_pump_blocked(cluster_t *cluster); +event_t *create_sensor_failure(cluster_t *cluster); +event_t *create_electronic_non_fatal_failure(cluster_t *cluster); +event_t *create_electronic_fatal_failure(cluster_t *cluster); +event_t *create_general_fault(cluster_t *cluster); +event_t *create_leakage(cluster_t *cluster); +event_t *create_air_detection(cluster_t *cluster); +event_t *create_turbine_operation(cluster_t *cluster); +} // namespace event +} // namespace pump_configuration_and_control + +namespace electrical_power_measurement { +namespace event { +event_t *create_measurement_period_ranges(cluster_t *cluster); +} // namespace event +} // namespace electrical_power_measurement + +namespace electrical_energy_measurement { +namespace event { +event_t *create_cumulative_energy_measured(cluster_t *cluster); +event_t *create_periodic_energy_measured(cluster_t *cluster); +} // namespace event +} // namespace electrical_energy_measurement + +namespace energy_evse { +namespace event { +event_t *create_ev_connected(cluster_t *cluster); +event_t *create_ev_not_detected(cluster_t *cluster); +event_t *create_energy_transfer_started(cluster_t *cluster); +event_t *create_energy_transfer_stopped(cluster_t *cluster); +event_t *create_fault(cluster_t *cluster); +event_t *create_rfid(cluster_t *cluster); +} /* event */ +} /* energy_evse */ + +namespace valve_configuration_and_control { +namespace event { +event_t *create_valve_state_changed(cluster_t *cluster); +event_t *create_valve_fault(cluster_t *cluster); +} // namespace event +} // namespace valve_configuration_and_control + +namespace device_energy_management { +namespace event { +event_t *create_power_adjust_start(cluster_t *cluster); +event_t *create_power_adjust_end(cluster_t *cluster); +event_t *create_paused(cluster_t *cluster); +event_t *create_resumed(cluster_t *cluster); +} // namespace event +} // namespace device_energy_management + +namespace water_heater_management { +namespace event { +event_t *create_boost_started(cluster_t *cluster); +event_t *create_boost_ended(cluster_t *cluster); +} // namespace event +} // namespace water_heater_management + +namespace commissioner_control { +namespace event { +event_t *create_commissioning_request_result(cluster_t *cluster); +} // namespace event +} // namespace commissioner_control + +namespace occupancy_sensing { +namespace event { +event_t *create_occupancy_changed(cluster_t *cluster); +} // namespace event +} // namespace occupancy_sensing + +namespace closure_control { +namespace event { +event_t *create_operational_error(cluster_t *cluster); +event_t *create_movement_completed(cluster_t *cluster); +event_t *create_engage_state_changed(cluster_t *cluster); +event_t *create_secure_state_changed(cluster_t *cluster); +} // namespace event +} // namespace closure_control + +namespace push_av_stream_transport { +namespace event { +event_t *create_push_transport_begin(cluster_t *cluster); +event_t *create_push_transport_end(cluster_t *cluster); +} // namespace event +} // namespace push_av_stream_transport + +namespace commodity_price { +namespace event { +event_t *create_price_change(cluster_t *cluster); +} // namespace event +} // namespace commodity_price + +namespace electrical_grid_conditions { +namespace event { +event_t *create_current_conditions_changed(cluster_t *cluster); +} // namespace event +} // namespace electrical_grid_conditions + +namespace zone_management { +namespace event { +event_t *create_zone_triggered(cluster_t *cluster); +event_t *create_zone_stopped(cluster_t *cluster); +} // namespace event +} // namespace zone_management + +} // namespace cluster +} // namespace esp_matter diff --git a/components/esp_matter/data_model/esp_matter_feature.cpp b/components/esp_matter/data_model/legacy/esp_matter_feature.cpp similarity index 99% rename from components/esp_matter/data_model/esp_matter_feature.cpp rename to components/esp_matter/data_model/legacy/esp_matter_feature.cpp index da9a489ee..0fab208a8 100644 --- a/components/esp_matter/data_model/esp_matter_feature.cpp +++ b/components/esp_matter/data_model/legacy/esp_matter_feature.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "esp_matter_attribute.h" -#include "esp_matter_command.h" +#include "esp_matter_attribute_impl.h" +#include "esp_matter_command_impl.h" #include #include -#include +#include #include #include diff --git a/components/esp_matter/data_model/legacy/esp_matter_feature_impl.h b/components/esp_matter/data_model/legacy/esp_matter_feature_impl.h new file mode 100644 index 000000000..f20455065 --- /dev/null +++ b/components/esp_matter/data_model/legacy/esp_matter_feature_impl.h @@ -0,0 +1,2171 @@ +// Copyright 2021 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include + +#define ESP_MATTER_NONE_FEATURE_ID 0x0000 + +/** Specific feature APIs + * + * These APIs also create the mandatory attributes and commands for the cluster for that particular feature. If the + * mandatory attribute is not managed internally, then a config is present for that attribute. The constructor for the + * config will set the attribute to the default value from the spec. + * + * If some standard feature is not present here, it can be added. + */ + +namespace esp_matter { +namespace cluster { + +namespace descriptor { +namespace feature { +namespace tag_list { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* tag_list */ + +} /* feature */ +} /* descriptor */ + +namespace access_control { +namespace feature { +namespace extension { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* extension */ + +namespace managed_device { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* managed_device */ + +} /* feature */ +} /* access_control */ + +namespace bridged_device_basic_information { +namespace feature { +namespace bridged_icd_support { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* bridged_icd_support */ + +} /* feature */ +} /* bridged_device_basic_information */ + +namespace administrator_commissioning { + +namespace feature { + +namespace basic { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* basic */ + +} /* feature */ +} /* administrator_commissioning */ + +namespace general_commissioning { +namespace feature { +namespace terms_and_conditions { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* terms_and_conditions */ +} /* feature */ +} /* general_commissioning */ + +namespace power_source { +namespace feature { +namespace wired { +typedef struct config { + uint8_t wired_current_type; + config(): wired_current_type(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* wired */ + +namespace battery { +typedef struct config { + uint8_t bat_charge_level; + bool bat_replacement_needed; + uint8_t bat_replaceability; + config(): bat_charge_level(0), bat_replacement_needed(false), bat_replaceability(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* battery */ + +// Rechargeable feature is dependent on Battery feature, in order to add +// Rechargeable feature one must add Battery feature first. +namespace rechargeable { +typedef struct config { + uint8_t bat_charge_state; + bool bat_functional_while_charging; + config(): bat_charge_state(0), bat_functional_while_charging(false) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* rechargeable */ + +// Replaceable feature is dependent on Battery feature, in order to add +// Replaceable feature one must add Battery feature first. +namespace replaceable { +typedef struct config { + char bat_replacement_description[k_max_bat_replacement_description_length + 1]; + uint8_t bat_quantity; + config(): bat_replacement_description{0}, bat_quantity(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* replaceable */ + +} /* feature */ +} /* power_source */ + +namespace scenes_management { +namespace feature { +namespace scene_names { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* scene_names */ + +} /* feature */ +} /* scenes_management */ + +namespace icd_management { +namespace feature { +namespace check_in_protocol_support { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* check_in_protocol_support */ + +namespace user_active_mode_trigger { +typedef struct config { + uint32_t user_active_mode_trigger_hint; + char user_active_mode_trigger_instruction[attribute::k_user_active_mode_trigger_instruction_length + 1]; + config() : user_active_mode_trigger_hint(0), user_active_mode_trigger_instruction{0} {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* user_active_mode_trigger */ + +namespace long_idle_time_support { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* long_idle_time_support */ + +namespace dynamic_sit_lit_support { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} // namespace dynamic_sit_lit_support + +} /* feature */ +} /* icd_management */ + +namespace on_off { +namespace feature { +namespace lighting { + +typedef struct config { + bool global_scene_control; + uint16_t on_time; + uint16_t off_wait_time; + nullable start_up_on_off; + config() : global_scene_control(1), on_time(0), off_wait_time(0), start_up_on_off(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* lighting */ + +namespace dead_front_behavior { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* dead_front_behavior */ + +namespace off_only { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* off_only */ +} /* feature */ +} /* on_off */ + +namespace level_control { +namespace feature { +namespace on_off { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* on_off */ + +namespace lighting { + +typedef struct config { + uint16_t remaining_time; + uint8_t min_level; + uint8_t max_level; + nullable start_up_current_level; + config() : remaining_time(0), min_level(1), max_level(254), start_up_current_level(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* lighting */ + +namespace frequency { + +typedef struct config { + uint16_t current_frequency; + uint16_t min_frequency; + uint16_t max_frequency; + config() : current_frequency(0), min_frequency(0), max_frequency(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* frequency */ +} /* feature */ +} /* level_control */ + +namespace color_control { +namespace feature { +namespace hue_saturation { + +typedef struct config { + uint8_t current_hue; + uint8_t current_saturation; + config() : current_hue(0), current_saturation(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* hue_saturation */ + +namespace color_temperature { + +typedef struct config { + uint16_t color_temperature_mireds; + uint16_t color_temp_physical_min_mireds; + uint16_t color_temp_physical_max_mireds; + uint16_t couple_color_temp_to_level_min_mireds; + nullable start_up_color_temperature_mireds; + config() : color_temperature_mireds(0x00fa), color_temp_physical_min_mireds(1), + color_temp_physical_max_mireds(0xfeff), couple_color_temp_to_level_min_mireds(1), + start_up_color_temperature_mireds(0x00fa) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* color_temperature */ + +namespace xy { + +typedef struct config { + uint16_t current_x; + uint16_t current_y; + config() : current_x(0x616b), current_y(0x607d) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* xy */ + +// EnhancedHue feature is dependent on HueSaturation feature, in order to add +// EnhancedHue feature one must add HueSaturation feature first. + +namespace enhanced_hue { + +typedef struct config { + uint16_t enhanced_current_hue; + config() : enhanced_current_hue(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* enhanced_hue */ + +// ColorLoop feature is dependent on EnhancedHue feature, in order to add +// ColorLoop feature one must add EnhancedHue feature first. + +namespace color_loop { + +typedef struct config { + uint8_t color_loop_active; + uint8_t color_loop_direction; + uint16_t color_loop_time; + uint16_t color_loop_start_enhanced_hue; + uint16_t color_loop_stored_enhanced_hue; + config() : color_loop_active(0), color_loop_direction(0), color_loop_time(0x19), + color_loop_start_enhanced_hue(0x2300), color_loop_stored_enhanced_hue(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* color_loop */ +} /* feature */ +} /* color_control */ + +namespace window_covering { +namespace feature { + +namespace lift { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* lift */ + +namespace tilt { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* tilt */ + +// PositionAwareLift feature is dependent on Lift feature, in order to add +// PositionAwareLift feature one must add Lift feature first. + +namespace position_aware_lift { + +typedef struct config { + nullable target_position_lift_percent_100ths; + nullable current_position_lift_percent_100ths; + config() : target_position_lift_percent_100ths(), current_position_lift_percent_100ths() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* position_aware_lift */ + +// PositionAwareTilt feature is dependent on Tilt feature, in order to add +// PositionAwareTilt feature one must add Tilt feature first. + +namespace position_aware_tilt { + +typedef struct config { + nullable target_position_tilt_percent_100ths; + nullable current_position_tilt_percent_100ths; + config() : target_position_tilt_percent_100ths(), current_position_tilt_percent_100ths() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* position_aware_tilt */ +} /* feature */ +} /* window_covering */ + +namespace wifi_network_diagnostics { +namespace feature { + +namespace packet_counts { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* packet_counts */ + +namespace error_counts { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* error_counts */ + +} /* feature */ +} /* wifi_network_diagnostics */ + +namespace thread_network_diagnostics { +namespace feature { + +namespace packet_counts { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* packet_counts */ + +namespace error_counts { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* error_counts */ + +namespace mle_counts { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* mle_counts */ + +namespace mac_counts { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* mac_counts */ + +} /* feature */ +} /* thread_network_diagnostics */ + +namespace ethernet_network_diagnostics { +namespace feature { + +namespace packet_counts { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* packet_counts */ + +namespace error_counts { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* error_counts */ + +} /* feature */ +} /* ethernet_network_diagnostics */ + +namespace thermostat { +namespace feature { + +namespace heating { + +typedef struct config { + int16_t occupied_heating_setpoint; + + config(): occupied_heating_setpoint(2000) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* heating */ + +namespace cooling { + +typedef struct config { + int16_t occupied_cooling_setpoint; + + config(): occupied_cooling_setpoint(2600) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* cooling */ + +// Attributes of Occupancy feature may have dependency on Heating, Cooling and Setback +// feature, one must add features according to the usecase first. +namespace occupancy { + +typedef struct config { + uint8_t occupancy; + int16_t unoccupied_cooling_setpoint; + int16_t unoccupied_heating_setpoint; + nullable unoccupied_setback; + nullable unoccupied_setback_min; + nullable unoccupied_setback_max; + + config(): occupancy(1), unoccupied_cooling_setpoint(2600), unoccupied_heating_setpoint(2000), unoccupied_setback(), unoccupied_setback_min(), unoccupied_setback_max() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* occupancy */ + +namespace setback { + +typedef struct config { + nullable occupied_setback; + nullable occupied_setback_min; + nullable occupied_setback_max; + + config(): occupied_setback(), occupied_setback_min(), occupied_setback_max() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* setback */ + +// Auto feature mandates the Heating and Cooling feature, while adding +// Auto feature one must add Heating and Colling features. + +namespace auto_mode { + +typedef struct config { + int8_t min_setpoint_dead_band; + + config(): min_setpoint_dead_band(2) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* auto_mode */ + +namespace local_temperature_not_exposed { + +typedef struct config { + int16_t local_temperature_calibration; + + config(): local_temperature_calibration(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* local_temperature_not_exposed */ + +namespace matter_schedule_configuration { + +typedef struct config { + uint8_t number_of_schedules; + uint8_t number_of_schedule_transitions; + nullable number_of_schedule_transition_per_day; + uint8_t active_schedule_handle[k_max_active_schedule_handle]; + + config(): number_of_schedules(0), number_of_schedule_transitions(0), number_of_schedule_transition_per_day() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* matter_schedule_configuration */ + +namespace presets { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* presets */ + +} /* feature */ +} /* thermostat */ + +namespace air_quality { +namespace feature { + +namespace fair { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* fair */ + +namespace moderate { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* moderate */ + +namespace very_poor { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* very_poor */ + +namespace extremely_poor { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* extremely_poor */ + +} /* feature */ +} /* air_quality */ + +namespace concentration_measurement { +namespace feature { + +namespace numeric_measurement { +typedef struct config { + nullable measured_value; + nullable min_measured_value; + nullable max_measured_value; + uint8_t measurement_unit; + config() : measured_value(), min_measured_value(), max_measured_value(), measurement_unit(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* numeric_measurement */ + +namespace level_indication { +typedef struct config { + uint8_t level_value; + config() : level_value(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* level_indication */ + +namespace medium_level { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* medium_level */ + +namespace critical_level { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* critical_level */ + +namespace peak_measurement { +typedef struct config { + nullable peak_measured_value; + uint32_t peak_measured_value_window; + config() : peak_measured_value(), peak_measured_value_window(1) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* peak_measurement */ + +namespace average_measurement { +typedef struct config { + nullable average_measured_value; + uint32_t average_measured_value_window; + config() : average_measured_value(), average_measured_value_window(1) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* average_measurement */ + +} /* feature */ +} /* concentration_measurement */ + +namespace carbon_monoxide_concentration_measurement { +namespace feature = concentration_measurement::feature; +} /* carbon_monoxide_concentration_measurement */ + +namespace carbon_dioxide_concentration_measurement { +namespace feature = concentration_measurement::feature; +} /* carbon_dioxide_concentration_measurement */ + +namespace nitrogen_dioxide_concentration_measurement { +namespace feature = concentration_measurement::feature; +} /* nitrogen_dioxide_concentration_measurement */ + +namespace ozone_concentration_measurement { +namespace feature = concentration_measurement::feature; +} /* ozone_concentration_measurement */ + +namespace formaldehyde_concentration_measurement { +namespace feature = concentration_measurement::feature; +} /* formaldehyde_concentration_measurement */ + +namespace pm1_concentration_measurement { +namespace feature = concentration_measurement::feature; +} /* pm1_concentration_measurement */ + +namespace pm25_concentration_measurement { +namespace feature = concentration_measurement::feature; +} /* pm25_concentration_measurement */ + +namespace pm10_concentration_measurement { +namespace feature = concentration_measurement::feature; +} /* pm10_concentration_measurement */ + +namespace radon_concentration_measurement { +namespace feature = concentration_measurement::feature; +} /* radon_concentration_measurement */ + +namespace total_volatile_organic_compounds_concentration_measurement { +namespace feature = concentration_measurement::feature; +} /* total_volatile_organic_compounds_concentration_measurement */ + +namespace resource_monitoring { +namespace feature { + +namespace condition { +typedef struct config { + uint8_t condition; + uint8_t degradation_direction; + config() : condition(0), degradation_direction(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* condition */ + +namespace warning { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* warning */ + +namespace replacement_product_list { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* replacement_product_list */ + +} /* feature */ +} /* resource_monitoring */ + +namespace hepa_filter_monitoring { +namespace feature = resource_monitoring::feature; +} /* hepa_filter_monitoring */ + +namespace activated_carbon_filter_monitoring { +namespace feature = resource_monitoring::feature; +} /* activated_carbon_filter_monitoring */ + +namespace laundry_washer_controls { +namespace feature { + +namespace spin { + +typedef struct config { + uint8_t spin_speed_current; + config() : spin_speed_current(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* spin */ + +namespace rinse { + +typedef struct config { + uint8_t number_of_rinses; + config() : number_of_rinses(1) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* rinse */ + +} /* feature */ +} /* laundry_washer_controls */ + +namespace smoke_co_alarm { +namespace feature { + +namespace smoke_alarm { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* smoke_alarm */ + +namespace co_alarm { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* co_alarm */ + +} /* feature */ +} /* smoke_co_alarm */ + +namespace switch_cluster { +namespace feature { + +// Note: Latching and Momentary switch features are mutually exclusive, only one of them shall be supported. + +namespace latching_switch { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* latching_switch */ + +namespace momentary_switch { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* momentary_switch */ + +// MomentarySwitchRelease feature has dependency on MomentarySwitch and !ActionSwitch features, in order to add +// MomentarySwitchRelease feature one must add MomentarySwitch feature first. + +namespace momentary_switch_release { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* momentary_switch_release */ + +// MomentarySwitchLongPress feature has dependency on MomentarySwitch and (MomentarySwitchRelease or ActionSwitch) features, in order to add +// MomentarySwitchLongPress feature one must add MomentarySwitch and (MomentarySwitchRelease or ActionSwitch) features first. + +namespace momentary_switch_long_press { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* momentary_switch_long_press */ + +// MomentarySwitchMultiPress feature has dependency on ActionSwitch or (MomentarySwitch and MomentarySwitchRelease) features, in order to add +// MomentarySwitchMultiPress feature one must add ActionSwitch or (MomentarySwitch and MomentarySwitchRelease) features first. + +namespace momentary_switch_multi_press { + +typedef struct config { + uint8_t multi_press_max; + config() : multi_press_max(2) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* momentary_switch_multi_press */ + +// ActionSwitch feature has dependency on MomentarySwitch feature, in order to add +// ActionSwitch feature one must add MomentarySwitch feature first. + +namespace action_switch { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* action_switch */ +} /* feature */ +} /* switch_cluster */ + +namespace unit_localization { +namespace feature { + +namespace temperature_unit { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* temperature_unit */ + +} /* feature */ +} /* unit_localization */ + +namespace time_format_localization { +namespace feature { + +namespace calendar_format { + +typedef struct config { + uint8_t active_calendar_type; + config() : active_calendar_type(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* calendar_format */ + +} /* feature */ +} /* time_format_localization */ + +namespace mode_select { +namespace feature { + +namespace on_off { + +typedef struct config { + nullable on_mode; + config() : on_mode() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* on_off */ + +} /* feature */ +} /* mode_select */ + +namespace general_diagnostics { +namespace feature { +namespace data_model_test { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* data_model_test */ +} /* feature */ +} /* general diagnostics */ + +namespace software_diagnostics { +namespace feature { + +namespace watermarks { + +typedef struct config { + uint64_t current_heap_high_watermark; + config() : current_heap_high_watermark(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* watermarks */ + +} /* feature */ +} /* software_diagnostics */ + +namespace temperature_control { +namespace feature { + +// TemperatureNumber and TemperatureLevel features are mutually exclusive, +// only one of them shall present. +namespace temperature_number { +typedef struct config { + int16_t temp_setpoint; + int16_t min_temperature; + int16_t max_temperature; + config() : temp_setpoint(1), min_temperature(0), max_temperature(10) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* temperature_number */ + +// TemperatureNumber and TemperatureLevel features are mutually exclusive, +// only one of them shall present. +namespace temperature_level { +typedef struct config { + uint8_t selected_temp_level; + config() : selected_temp_level(1) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* temperature_level */ + +// TemperatureStep feature have conformance of TemperatureNumber feature, +// in order to support TemperatureStep cluster shall support TemperatureNumber. +namespace temperature_step { +typedef struct config { + int16_t step; + config() : step(1) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* temperature_step */ + +} /* feature */ +} /* temperature_control */ + +namespace fan_control { +namespace feature { + +namespace multi_speed { +typedef struct config { + uint8_t speed_max; + nullable speed_setting; + uint8_t speed_current; + config() : speed_max(10), speed_setting(0), speed_current(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* multi_speed */ + +namespace fan_auto { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* fan_auto */ + +namespace rocking { +typedef struct config { + uint8_t rock_support; + uint8_t rock_setting; + config() : rock_support(0), rock_setting(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* rocking */ + +namespace wind { +typedef struct config { + uint8_t wind_support; + uint8_t wind_setting; + config() : wind_support(0), wind_setting(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* wind */ + +namespace step { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* step */ + +namespace airflow_direction { +typedef struct config { + uint8_t airflow_direction; + config() : airflow_direction(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* airflow_direction */ + +} /* feature */ +} /* fan_control */ + +namespace keypad_input { +namespace feature { + +namespace navigation_key_codes { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* navigation_key_codes */ + +namespace location_keys { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* location_keys */ + +namespace number_keys { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* number_keys */ + +} /* feature */ +} /* keypad_input */ + +namespace boolean_state_configuration { +namespace feature { + +namespace visual { + +typedef struct config { + uint8_t alarms_active; + uint8_t alarms_supported; + config() : alarms_active(0), alarms_supported(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* visual */ + +namespace audible { + +typedef struct config { + uint8_t alarms_active; + uint8_t alarms_supported; + config() : alarms_active(0), alarms_supported(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* audible */ + +namespace alarm_suppress { + +typedef struct config { + uint8_t alarms_suppressed; + config() : alarms_suppressed(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* alarm_suppress */ + +namespace sensitivity_level { + +typedef struct config { + uint8_t supported_sensitivity_levels; + config() : supported_sensitivity_levels(10) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* sensitivity_level */ + +} /* feature */ +} /* boolean_state_configuration */ + +namespace power_topology { +namespace feature { + +namespace node_topology { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* node_topology */ + +namespace tree_topology { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* tree_topology */ + +namespace set_topology { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* set_topology */ + +namespace dynamic_power_flow { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* dynamic_power_flow */ + +} /* feature */ +} /* power_topology */ + +namespace electrical_power_measurement { +namespace feature { + +namespace direct_current { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* direct_current */ + +namespace alternating_current { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* alternating_current */ + +namespace polyphase_power { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* polyphase_power */ + +namespace harmonics { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* harmonics */ + +namespace power_quality { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_quality */ + +} /* feature */ +} /* electrical_power_measurement */ + +namespace electrical_energy_measurement { +namespace feature { + +namespace imported_energy { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* imported_energy */ + +namespace exported_energy { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* exported_energy */ + +namespace cumulative_energy { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* cumulative_energy */ + +namespace periodic_energy { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* periodic_energy */ + +} /* feature */ +} /* electrical_energy_measurement */ + +namespace door_lock { +namespace feature { + +namespace pin_credential { +typedef struct config { + uint16_t number_pin_users_supported; + uint8_t max_pin_code_length; + uint8_t min_pin_code_length; + uint8_t wrong_code_entry_limit; + uint8_t user_code_temporary_disable_time; + bool require_pin_for_remote_operation; + config() : number_pin_users_supported(5), max_pin_code_length(16), min_pin_code_length(4), + wrong_code_entry_limit(5), user_code_temporary_disable_time(5), + require_pin_for_remote_operation(true) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* pin_credential */ + +namespace rfid_credential { +typedef struct config { + uint16_t number_rfid_users_supported; + uint8_t max_rfid_code_length; + uint8_t min_rfid_code_length; + uint8_t wrong_code_entry_limit; + uint8_t user_code_temporary_disable_time; + config() : number_rfid_users_supported(5), max_rfid_code_length(16), min_rfid_code_length(4), + wrong_code_entry_limit(5), user_code_temporary_disable_time(5) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* rfid_credential */ + +namespace finger_credentials { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* finger_credentials */ + +namespace weekday_access_schedules { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* weekday_access_schedules */ + +namespace door_position_sensor { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* door_position_sensor */ + +namespace face_credentials { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* face_credentials */ + +namespace credential_over_the_air_access { +typedef struct config { + bool require_pin_for_remote_operation; + config() : require_pin_for_remote_operation(false) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* credential_over_the_air_access */ + +namespace user { +typedef struct config { + uint16_t number_of_total_user_supported; + uint8_t credential_rules_supported; + uint8_t number_of_credentials_supported_per_user; + config() : number_of_total_user_supported(5), credential_rules_supported(0), number_of_credentials_supported_per_user(3) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* user */ + +namespace year_day_access_schedules { + +typedef struct config { + uint8_t number_of_year_day_schedules_supported_per_user; + config() : number_of_year_day_schedules_supported_per_user(1) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* year_day_access_schedules */ + +namespace holiday_schedules { + +typedef struct config { + uint8_t number_of_holiday_schedules_supported; + config() : number_of_holiday_schedules_supported(1) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* holiday_schedules */ + +namespace unbolting { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* unbolting */ + +namespace aliro_provisioning { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* aliro_provisioning */ + +namespace aliro_bleuwb { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* aliro_bleuwb */ + +} /* feature */ +}/* door_lock */ + +namespace energy_evse { +namespace feature { +namespace charging_preferences { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* charging_preferences */ + +namespace soc_reporting { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* soc_reporting */ + +namespace plug_and_charge { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* plug_and_charge */ + +namespace rfid { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* rfid */ + +namespace v2x { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* v2x */ + +} /* feature */ +} /* energy_evse */ + +namespace microwave_oven_control { +namespace feature { + +namespace power_as_number { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_as_number */ + +namespace power_in_watts { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_in_watts */ + +namespace power_number_limits { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_number_limits */ + +} /* feature */ +} /* microwave_oven_control */ + +namespace valve_configuration_and_control { +namespace feature { + +namespace time_sync { +typedef struct config { + nullable auto_close_time; + config() : auto_close_time() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* time_sync */ + +namespace level { +typedef struct config { + nullable current_level; + nullable target_level; + config() : current_level(), target_level() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* level */ + +} /* feature */ +} /* valve_configuration_and_control */ + +namespace device_energy_management { +namespace feature { + +namespace power_adjustment { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_adjustment */ + +namespace power_forecast_reporting { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_forecast_reporting */ + +namespace state_forecast_reporting { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* state_forecast_reporting */ + +namespace start_time_adjustment { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* start_time_adjustment */ + +namespace pausable { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* pausable */ + +namespace forecast_adjustment { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* forecast_adjustment */ + +namespace constraint_based_adjustment { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* constraint_based_adjustment */ + +} /* feature */ +} /* device_energy_management */ + +namespace thread_border_router_management { +namespace feature { + +namespace pan_change { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* pan_change */ + +} /* feature */ +} /* thread_border_router_management */ + +namespace service_area { +namespace feature { + +namespace select_while_running { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* select_while_running */ + +namespace progress_reporting { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* progress_reporting */ + +namespace maps { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* maps */ + +} /* feature */ +} /* service_area */ + +namespace water_heater_management { +namespace feature { + +namespace energy_management { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* energy_management */ + +namespace tank_percent { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* tank_percent */ +} /* feature */ +} /* water_heater_management */ + +namespace energy_preference { +namespace feature { + +namespace energy_balance { +typedef struct config { + uint8_t current_energy_balance; + config() : current_energy_balance(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* energy_balance */ + +namespace low_power_mode_sensitivity { +typedef struct config { + uint8_t current_low_power_mode_sensitivity; + config() : current_low_power_mode_sensitivity(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* low_power_mode_sensitivity */ + +} /* feature */ +} /* energy_preference */ + +namespace pressure_measurement { +namespace feature { + +namespace extended { + +typedef struct config { + nullable scaled_value; + nullable min_scaled_value; + nullable max_scaled_value; + uint8_t scale; + config() : scaled_value(), min_scaled_value(), max_scaled_value(), scale(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* extended */ + +} /* feature */ +} /* pressure_measurement */ + +namespace occupancy_sensing { +namespace feature { + +namespace other { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* other */ + +namespace passive_infrared { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* passive_infrared */ + +namespace ultrasonic { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* ultrasonic */ + +namespace physical_contact { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* physical_contact */ + +namespace active_infrared { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* active_infrared */ + +namespace radar { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* radar */ + +namespace rf_sensing { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* rf_sensing */ + +namespace vision { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* vision */ +} /* feature */ +} /* occupancy_sensing */ + +namespace pump_configuration_and_control { +namespace feature { + +namespace constant_pressure { + +typedef struct config { + nullable min_const_pressure; + nullable max_const_pressure; + config() : min_const_pressure(), max_const_pressure() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* constant_pressure */ + +namespace compensated_pressure { + +typedef struct config { + nullable min_comp_pressure; + nullable max_comp_pressure; + config() : min_comp_pressure(), max_comp_pressure() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* compensated_pressure */ + +namespace constant_flow { + +typedef struct config { + nullable min_const_flow; + nullable max_const_flow; + config() : min_const_flow(), max_const_flow() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* constant_flow */ + +namespace constant_speed { + +typedef struct config { + nullable min_const_speed; + nullable max_const_speed; + config() : min_const_speed(), max_const_speed() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* constant_speed */ + +namespace constant_temperature { + +typedef struct config { + nullable min_const_temp; + nullable max_const_temp; + config() : min_const_temp(), max_const_temp() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); + +} /* constant_temperature */ + +namespace automatic { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* automatic */ + +namespace local_operation { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* automatic */ +} /* feature */ +} /* pump_configuration_and_control */ + +namespace time_synchronization { +namespace feature { + +namespace time_zone { +typedef struct config { + uint8_t time_zone_database; + config() : time_zone_database(2/* None */) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* time_zone */ + +namespace ntp_client { +typedef struct config { + bool supports_dns_resolve; + config() : supports_dns_resolve(false) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* ntp_client */ + +namespace ntp_server { +typedef struct config { + bool ntp_server_available; + config() : ntp_server_available(false) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* ntp_server */ + +namespace time_sync_client { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* time_sync_client */ + +} /* feature */ +} /* time_synchronization */ + +namespace camera_av_stream_management { + +namespace feature { +namespace audio { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* audio */ + +namespace video { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* video */ + +namespace snapshot { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* snapshot */ + +namespace privacy { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* privacy */ + +namespace speaker { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* speaker */ + +namespace image_control { +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* image_control */ + +namespace watermark { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* watermark */ + +namespace on_screen_display { +typedef struct config { + config() {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* on_screen_display */ + +namespace local_storage { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* local_storage */ + +namespace high_dynamic_range { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* high_dynamic_range */ + +namespace night_vision { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* night_vision */ + +} /* feature */ +}/*camera av stream management*/ + +namespace webrtc_transport_provider { +}/*webrtc_transport_provider*/ + +namespace webrtc_transport_requestor { +}/*webrtc_transport_requestor*/ + +namespace closure_control { +namespace feature { + +namespace positioning { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* positioning */ + +namespace motion_latching { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* motion_latching */ + +namespace instantaneous { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* instantaneous */ + +namespace speed { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* speed */ + +namespace ventilation { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* ventilation */ + +namespace pedestrian { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* pedestrian */ + +namespace calibration { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* calibration */ + +namespace protection { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* protection */ + +namespace manually_operable { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* manually_operable */ + +} /* feature */ +} /* closure_control */ + +namespace closure_dimension { +namespace feature { + +namespace positioning { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* positioning */ + +namespace motion_latching { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* motion_latching */ + +namespace unit { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* unit */ + +namespace limitation { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* limitation */ + +namespace speed { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* speed */ + +namespace translation { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* translation */ + +namespace rotation { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* rotation */ + +namespace modulation { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* modulation */ + +} /* feature */ +} /* closure_dimension */ + +namespace camera_av_settings_user_level_management { +namespace feature { + +namespace digital_ptz { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* digital_ptz */ + +namespace mechanical_pan { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* mechanical_pan */ + +namespace mechanical_tilt { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* mechanical_tilt */ + +namespace mechanical_zoom { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* mechanical_zoom */ + +namespace mechanical_presets { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* mechanical_presets */ + +} /* feature */ +} /* camera_av_settings_user_level_management */ + +namespace push_av_stream_transport { +namespace feature { + +namespace per_zone_sensitivity { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* per_zone_sensitivity */ + +/* Provisional */ +namespace metadata { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* metadata */ + +} /* feature */ +} /* push_av_stream_transport */ + +namespace commodity_tariff { +namespace feature { + +namespace pricing { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* pricing */ + +namespace friendly_credit { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* friendly_credit */ + +namespace auxiliary_load { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* auxiliary_load */ + +namespace peak_period { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* peak_period */ + +namespace power_threshold { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_threshold */ + +namespace randomization { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* randomization */ + +} /* feature */ +} /* commodity_tariff */ + +namespace commodity_price { +namespace feature { + +namespace forecasting { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* forecasting */ + +} /* feature */ +} /* commodity_price */ + +namespace electrical_grid_conditions { +namespace feature { + +namespace forecasting { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* forecasting */ + +} /* feature */ +} /* electrical_grid_conditions */ + +namespace meter_identification { +namespace feature { + +namespace power_threshold { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_threshold */ + +} /* feature */ +} /* meter_identification */ + +namespace zone_management { +namespace feature { + +namespace two_dimensional_cartesian_zone { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* two_dimensional_cartesian_zone */ + +namespace per_zone_sensitivity { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* per_zone_sensitivity */ + +namespace user_defined { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* user_defined */ + +namespace focus_zones { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* focus_zones */ + +} /* feature */ +} /* zone_management */ + +} /* cluster */ +} /* esp_matter */ diff --git a/components/esp_matter/data_model_provider/esp_matter_data_model_provider.cpp b/components/esp_matter/data_model_provider/esp_matter_data_model_provider.cpp index efa06d52d..fc976bc92 100644 --- a/components/esp_matter/data_model_provider/esp_matter_data_model_provider.cpp +++ b/components/esp_matter/data_model_provider/esp_matter_data_model_provider.cpp @@ -14,6 +14,9 @@ #include #include +#ifdef CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL +#include +#endif // CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL #include #include #include diff --git a/components/esp_matter/esp_matter.h b/components/esp_matter/esp_matter.h index 1bf88eab8..cdcc58548 100644 --- a/components/esp_matter/esp_matter.h +++ b/components/esp_matter/esp_matter.h @@ -21,6 +21,9 @@ application. #include #ifdef CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER #ifdef CONFIG_ESP_MATTER_ENABLE_DATA_MODEL +#ifdef CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL +#include +#endif // CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL #include #include #include @@ -50,7 +53,7 @@ enum { kCommissioningSessionStarted = kRange_PublicPlatformSpecific + 0x1000, /** Signals that Commissioning session has stopped */ kCommissioningSessionStopped, - /** Signals that Commissioning window is now opend */ + /** Signals that Commissioning window is now opened */ kCommissioningWindowOpened, /** Signals that Commissioning window is now closed */ kCommissioningWindowClosed, diff --git a/docs/en/api-reference/esp_matter_data_model.rst b/docs/en/api-reference/esp_matter_data_model.rst index cf3609552..7ac634939 100644 --- a/docs/en/api-reference/esp_matter_data_model.rst +++ b/docs/en/api-reference/esp_matter_data_model.rst @@ -3,6 +3,73 @@ Data Model This has the high level APIs for Data Model. +Generated Data Model +==================== + +When **Enable Generated Data Model** is enabled in ``menuconfig`` +(``CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL``), ESP-Matter uses the +auto-generated data model instead of the legacy (manually implemented) one. + +Source Selection +---------------- + +- Generated implementation is used from:: + + components/esp_matter/data_model/generated/ + +- Legacy implementation (used when disabled) is located at:: + + components/esp_matter/data_model/legacy/ + +Directory Structure +------------------- + +- **Clusters** + + :: + + generated/clusters// + + Example (On/Off cluster): + + :: + + on_off/on_off.h + on_off/on_off.cpp + on_off/on_off_ids.h + +- **Device Types** + + :: + + generated/device_types/_device/ + + Example (Extended Color Light): + + :: + + extended_color_light_device/extended_color_light_device.h + extended_color_light_device/extended_color_light_device.cpp + +Regenerating the Data Model +--------------------------- + +To regenerate the data model files, run the following command from the +ESP-Matter repository root:: + + python tools/data_model_gen/data_model_gen.py + +For more details, refer to:: + + tools/data_model_gen/README.md + +Summary +------- + +- Enable ``CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL`` to use generated clusters and device types. +- Disable it to use the legacy implementation. +- The generated model improves maintainability and alignment with the data model definition as per the Matter specification. + API reference ------------- 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 71f6c2c0d..4f300e661 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 @@ -497,10 +497,15 @@ int create(uint8_t device_type_index) 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; +#ifndef CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL + // Electrical power measurement and ElectricalEnergyMeasurement cluster have choice features O.a+ + // Generated data model does not consider such clusters as mandatory for device type. + // TODO: Remove this from handwritten code as well. 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; +#endif // CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL endpoint = esp_matter::endpoint::electrical_sensor::create(node, &electrical_sensor_config, ENDPOINT_FLAG_NONE, NULL); if (endpoint) { @@ -541,8 +546,13 @@ int create(uint8_t device_type_index) static chip::app::Clusters::DeviceEnergyManagement::MockDeviceEnergyManagementDelegate evseDemDelegate; energy_evse_config.energy_evse.delegate = &energyEvseDelegate; energy_evse_config.energy_evse_mode.delegate = &evseModeDelegate; +#ifndef CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL + // Energy EVSE is composite device type with DeviceEnergyManagement. + // Generated data model does not generate config for composite device types + // TODO: Remove this once composite devices handled separately. energy_evse_config.device_energy_management.delegate = &evseDemDelegate; energy_evse_config.device_energy_management.feature_flags = cluster::device_energy_management::feature::power_adjustment::get_id(); +#endif // CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL endpoint = esp_matter::endpoint::energy_evse::create(node, &energy_evse_config, ENDPOINT_FLAG_NONE, NULL); esp_matter::endpoint::power_source::config_t power_source_config; @@ -593,7 +603,12 @@ int create(uint8_t device_type_index) esp_matter::endpoint::device_energy_management::config_t device_energy_management_config; static chip::app::Clusters::ModeBase::MockModeBaseDelegate demModeDelegate; static chip::app::Clusters::DeviceEnergyManagement::MockDeviceEnergyManagementDelegate demDelegate; +#ifndef CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL + // Device energy management mode cluster is Optional with condition=ControllableESA + // Generated data model does not consider such clusters as mandatory for device type. + // TODO: Consider such clusters as optional in handwritten code as well. device_energy_management_config.device_energy_management_mode.delegate = &demModeDelegate; +#endif // CONFIG_ESP_MATTER_ENABLE_GENERATED_DATA_MODEL device_energy_management_config.device_energy_management.delegate = &demDelegate; device_energy_management_config.device_energy_management.feature_flags = cluster::device_energy_management::feature::power_adjustment::get_id(); endpoint = esp_matter::endpoint::device_energy_management::create(node, &device_energy_management_config, ENDPOINT_FLAG_NONE, NULL); diff --git a/tools/data_model_gen/.gitignore b/tools/data_model_gen/.gitignore new file mode 100644 index 000000000..a83be94f3 --- /dev/null +++ b/tools/data_model_gen/.gitignore @@ -0,0 +1,5 @@ +generated/* +out/* +**/__pycache__/ +*.pyc +venv/ diff --git a/tools/data_model_gen/README.md b/tools/data_model_gen/README.md new file mode 100644 index 000000000..928660f07 --- /dev/null +++ b/tools/data_model_gen/README.md @@ -0,0 +1,128 @@ +# Matter Data Model Generator Tool + +This tool generates C++ header and source files for Matter clusters and device types directly from Matter specification XML files. + +## Overview + +The generator performs two main steps: + +1. **XML Processing**: Parses Matter specification XML files to generate intermediate JSON representations +2. **Code Generation**: Uses the intermediate JSON files to generate C++ header and source files + +## Prerequisites + +- ESP-Matter repository cloned with submodule update (Tool will select default xml files from connectedhomeip submodule directory) +- `ESP_MATTER_PATH` environment variable set to your ESP-Matter repository path + +## Installation + +Follow the steps below to set up **ESP-Matter** and install the required dependencies. + +### 1. Clone ESP-Matter + +If you haven't already cloned the repository, follow the official guide: + +https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html + +### 2. Set Environment Variable + +Set the `ESP_MATTER_PATH` environment variable to point to your local ESP-Matter directory. + +```bash +export ESP_MATTER_PATH=/path/to/esp-matter +``` + +### 3. Install Python Dependencies + +```bash +pip install -r tools/data_model_gen/requirements.txt +``` + +## Usage + +### Basic Usage + +```bash +# Run the complete generation process +# Data Model files generated with default 1.5 Matter specification. +python data_model_gen.py +``` + +This will: + +1. Parse all Matter XML files from the default location (`connectedhomeip/data_model/`) +2. Generate intermediate JSON files in default (`out`) directory +3. Generate C++ header and source files in the default output directory (`$ESP_MATTER_PATH/components/esp_matter/data_model/generated`) + +> **Note:** Generated files may not be properly formatted. Run **pre-commit** to format them before committing. + +### Advanced Usage + +```bash +# Run --help command for more advanced usage +python data_model_gen.py --help +``` +> **Note:** Single device file generation is intended **for testing purposes only** and may not produce compliant device types. +> Example: +> ```bash +> python data_model_gen.py --device-file +> ``` +### Module-Specific Scripts + +Run module scripts using Python’s module interface (`-m`) from the **project root**. + +***Generate XML files*** +```bash +python -m xml_processing.xml_parser +``` +For available options: +```bash +python -m xml_processing.xml_parser --help +``` + +***Generate data model source and header files*** +```bash +python -m code_generation.code_generator +``` +For available options: +```bash +python -m code_generation.code_generator --help +``` + +## Generated Files + +### Intermediate JSON Files + +The tool generates following intermediate JSON files during processing: + +- `clusters.json`: Contains clusters with their attributes, commands, events, and other data +- `device_types.json`: Contains device types with their required clusters +- `delegate_clusters.json`: Lists clusters with delegates +- `internally_managed_attributes.json`: Lists attributes managed by ConnectedHomeIP +- `plugin_init_cb_clusters.json`: Lists clusters with plugin init callbacks +- `zap_filter_list.json`: Filters attributes, commands, events based on ZAP XML files +- `migrated_clusters.json`: Lists clusters migrated to the code-driven approach + +### Output C++ Files + +For each cluster and device type, the tool generates: + +- **Cluster files**: `on_off.h`, `on_off.cpp` and `on_off_ids.h` from `on_off.xml` +- **Device files**: `extended_color_light.h` and `extended_color_light.cpp` from `extended_color_light.xml` + +These files are organized in the output directory structure: + +``` +/ +├── clusters/ +│ ├── on_off/ +│ │ ├── on_off_ids.h +│ │ └── on_off.h +│ │ └── on_off.cpp +│ └── ... +└── device_types/ + ├── extended_color_light_device/ + │ ├── extended_color_light.h + │ └── extended_color_light.cpp + └── ... +``` diff --git a/tools/data_model_gen/chip_source_deps/__init__.py b/tools/data_model_gen/chip_source_deps/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tools/data_model_gen/chip_source_deps/cluster_mapping.py b/tools/data_model_gen/chip_source_deps/cluster_mapping.py new file mode 100644 index 000000000..333cdd81a --- /dev/null +++ b/tools/data_model_gen/chip_source_deps/cluster_mapping.py @@ -0,0 +1,210 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging +import os +import re + +from utils.helper import convert_to_snake_case, write_to_file +from utils.helper import esp_name +from chip_source_deps.server_files_config import ( + local_mappings, + parser, + PLUGIN_CB_PATTERN, + DELEGATE_METHODS, + DELEGATE_VARIABLE_NAMES, +) + +logger = logging.getLogger(__name__) + + +def normalize_cluster_name(cluster_name, type="file"): + """Normalize a cluster name from a filename or a string + + :param cluster_name: The cluster name to normalize. + :param type: The type of the cluster name. + :returns: Normalized cluster name + + """ + if type == "file": + cluster_name = os.path.basename(cluster_name).split(".")[0] + cluster_name = cluster_name.replace("-server", "").lower() + cluster_name = esp_name(cluster_name) + cluster_name = local_mappings.get(cluster_name, cluster_name) + return cluster_name + + cluster_name = convert_to_snake_case(cluster_name) + cluster_name = local_mappings.get(cluster_name, cluster_name) + cluster_name = cluster_name.replace(" ", "_") + cluster_name = esp_name(cluster_name) + + return cluster_name + + +def check_if_delegate_method_available(node, code_bytes): + """Check if delegate is available in the given file using tree-sitter. + + :param node: The AST node to search from + :param code_bytes: The source code as bytes + :returns: True if delegate method is available, False otherwise. + """ + if node.type == "function_declarator" or node.type == "declaration": + text = code_bytes[node.start_byte : node.end_byte].decode( + "utf8", errors="ignore" + ) + if any(method in text for method in DELEGATE_METHODS): + return True + if node.type == "class_specifier": + for child in node.children: + if child.type == "field_declaration_list": + for field_declaration in child.children: + text = code_bytes[ + field_declaration.start_byte : field_declaration.end_byte + ].decode("utf8", errors="ignore") + if any(method in text for method in DELEGATE_METHODS): + return True + if any(variable in text for variable in DELEGATE_VARIABLE_NAMES): + return True + for child in node.children: + if check_if_delegate_method_available(child, code_bytes): + return True + return False + + +def find_delegate_server_files(root_dir): + """Find all delegate files in the given directory using tree-sitter. + + :param root_dir: + :returns: cluster list with delegate. + :rtype: Two sets + + """ + delegate_server_files = set() + + for dirpath, _, filenames in os.walk(root_dir): + for filename in filenames: + full_path = os.path.join(dirpath, filename) + + # Check for delegate callback in server files + if "-delegate.h" in filename.lower(): + cluster_name = normalize_cluster_name(dirpath, type="file") + delegate_server_files.add(cluster_name) + elif filename and filename.endswith(".h"): + with open(full_path, "r") as f: + content = f.read() + tree = parser.parse(bytes(content, "utf8")) + root = tree.root_node + code_bytes = bytes(content, "utf8") + if check_if_delegate_method_available(root, code_bytes): + cluster_name = normalize_cluster_name(dirpath, type="file") + delegate_server_files.add(cluster_name) + + return sorted(list(delegate_server_files)) + + +def generate_delegate_cluster_mapping( + root_dir, delegate_cluster_json_file_path +) -> tuple[bool, str]: + """Generate cluster mapping list for clusters with delegate + + :param root_dir: The root directory to search for server files. + :param delegate_cluster_json_file_path: The path to the JSON file for delegate clusters. + :returns: True if successful, False otherwise. + """ + try: + delegate_server_files = find_delegate_server_files(root_dir) + if write_to_file( + delegate_cluster_json_file_path, delegate_server_files, "json" + ): + logger.info( + f"Successfully written Delegate Clusters to {delegate_cluster_json_file_path}" + ) + return True, None + return False, f"Error writing to {delegate_cluster_json_file_path}" + except Exception as e: + return False, f"Error generating delegate cluster mapping: {str(e)}" + + +def find_plugin_init_callbacks(node, code_bytes): + """Find all MatterXXXPluginServerInitCallback function declarations using tree-sitter. + + :param node: The AST node to search from + :param code_bytes: The source code as bytes + :returns: List of cluster names + """ + clusters = [] + + if node.type == "function_declarator" or node.type == "declaration": + text = code_bytes[node.start_byte : node.end_byte].decode( + "utf8", errors="ignore" + ) + + pattern = re.compile(PLUGIN_CB_PATTERN) + match = pattern.search(text) + if match: + cluster_name = match.group(1) + snake_case = normalize_cluster_name(cluster_name, type="string") + clusters.append(snake_case) + + for child in node.children: + clusters.extend(find_plugin_init_callbacks(child, code_bytes)) + + return clusters + + +def extract_cluster_names(header_file_path): + """Extract cluster names from plugin init callback functions using tree-sitter. + + :param header_file_path: Path to the header file + :returns: List of cluster names + """ + try: + with open(header_file_path, "r", encoding="utf-8") as f: + content = f.read() + except Exception as e: + logger.error(f"Error reading file {header_file_path}: {e}") + return [] + + tree = parser.parse(bytes(content, "utf8")) + root = tree.root_node + code_bytes = bytes(content, "utf8") + + return find_plugin_init_callbacks(root, code_bytes) + + +def generated_plugin_init_cb_cluster_mapping( + header_file_path, plugin_init_cb_cluster_json_file_path +) -> tuple[bool, str]: + """ + Generate plugin init callback cluster mapping + + :param header_file_path: The path to the header file. + :param plugin_init_cb_cluster_json_file_path: The path to the JSON file for plugin init callback clusters. + :returns: True if successful, False otherwise. + + """ + try: + if not os.path.isfile(header_file_path): + logger.warning(f"File {header_file_path} does not exist") + return False, f"File {header_file_path} does not exist" + + cluster_names = extract_cluster_names(header_file_path) + if write_to_file(plugin_init_cb_cluster_json_file_path, cluster_names, "json"): + logger.info( + f"Successfully written Plugin Init Callback Clusters to {plugin_init_cb_cluster_json_file_path}" + ) + return True, None + return False, f"Error writing to {plugin_init_cb_cluster_json_file_path}" + except Exception as e: + return False, f"Error generating plugin init callback cluster mapping: {str(e)}" diff --git a/tools/data_model_gen/chip_source_deps/internally_managed_attributes.py b/tools/data_model_gen/chip_source_deps/internally_managed_attributes.py new file mode 100644 index 000000000..e3387c51a --- /dev/null +++ b/tools/data_model_gen/chip_source_deps/internally_managed_attributes.py @@ -0,0 +1,245 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import json +import os +import logging + +from utils.helper import convert_to_snake_case, write_to_file +from chip_source_deps.server_files_config import ( + parser, + local_mappings, + KEYWORDS, + ATTRIBUTE_REGEX, +) +from utils.tree_sitter_utils import get_function_by_keywords, extract_case_labels + +logger = logging.getLogger(__name__) + + +def merge_attributes_dicts(dict1, dict2): + """ + Merge two dictionaries of attributes, combining their values and removing duplicates + + :param dict1: First dictionary of attributes + :param dict2: Second dictionary of attributes + :return: Merged dictionary with sorted attributes + """ + merged = dict1.copy() + + for cluster_name, attributes in dict2.items(): + if cluster_name in merged: + merged[cluster_name] = sorted(list(set(merged[cluster_name] + attributes))) + else: + merged[cluster_name] = sorted(attributes) + + return merged + + +def extract_attributes_from_server_file(file_path): + """Extract attributes from Read Attribute function in the server source file. + + :param file_path: Path to the C++ file + :returns: A list of unique attributes found in Read Attribute function + + NOTE: There are different Read methods followed for different clusters. + This API try to find different Read method definitions and extract the attributes from them. + """ + try: + with open(file_path, "r", encoding="utf-8") as f: + code = f.read() + except Exception as e: + logger.error(f"Error reading file {file_path}: {e}") + return [] + + tree = parser.parse(bytes(code, "utf8")) + root = tree.root_node + code_bytes = bytes(code, "utf8") + + functions = get_function_by_keywords(root, code_bytes, KEYWORDS) + + all_attributes = [] + for func in functions: + attrs = extract_case_labels(func, code_bytes, ATTRIBUTE_REGEX) + all_attributes.extend(attrs) + + return sorted(list(set(all_attributes))) + + +def find_server_source_files(root_dir): + """Find all server source files in the given directory + + :param root_dir: cluster implementation directory from the connectedhomeip repository. + :returns: A dictionary of cluster names to their corresponding server source file path. + + NOTE: Now all source files from the corresponding repo. are matched with the cluster name + as there is no properly naming convention followed for the source files and it's difficult to identify the server source file from all the files. + + TODO: return only server source file once upstream follows same naming convention for all clusters. + """ + server_source_files = {} + for dirpath, _, filenames in os.walk(root_dir): + for filename in (f for f in filenames if f and f.endswith(".cpp")): + cluster_name = filename.replace("-server.cpp", "") + cluster_name = cluster_name.replace(".cpp", "") + cluster_name = cluster_name.replace("-cluster", "") + cluster_name = cluster_name.replace("cluster", "") + cluster_name = cluster_name.replace("Cluster", "") + cluster_name = local_mappings.get(cluster_name, cluster_name) + cluster_name = convert_to_snake_case(cluster_name) + + server_source_files[cluster_name] = os.path.join(dirpath, filename) + return server_source_files + + +def get_attributes_from_server_files(root_dir, json_file_path) -> bool: + """Parse all server source files in the given directory and extract attributes + + :param root_dir: The root directory to search for server source files. + :param json_file_path: The path to the JSON file to write the results to. + + """ + if not os.path.isdir(root_dir): + logger.warning("Directory %s does not exist", root_dir) + return False + server_source_files = find_server_source_files(root_dir) + + if not server_source_files: + logger.debug(f"No server source files found in {root_dir}") + return False + + logger.debug(f"Found {len(server_source_files)} server source files") + + internally_managed_attributes = {} + + for cluster_name, file_path in server_source_files.items(): + attributes = extract_attributes_from_server_file(file_path) + if attributes: + internally_managed_attributes[cluster_name] = sorted(attributes) + + internally_managed_attributes = dict(sorted(internally_managed_attributes.items())) + write_to_file(json_file_path, internally_managed_attributes, "json") + + logger.debug(f"\nResults written to {json_file_path}") + return True + + +def get_attributes_from_zcl(zcl_json_path, output_json_path): + """ + Get attributes from the zcl.json file in the connectedhomeip repository. + + :param zcl_json_path: Path to the zcl.json file + :param output_json_path: Path to write the output JSON file + + NOTE: The zcl.json file is maintained in the connectedhomeip repository. + It contains the attributes that are managed internally by the cluster. + + :return: True if attributes are extracted and written to the output JSON file, False otherwise + """ + try: + with open(zcl_json_path, "r", encoding="utf-8") as f: + zcl_data = json.load(f) + except Exception as e: + logger.error(f"Error reading zcl.json file: {e}") + return False + + if "attributeAccessInterfaceAttributes" not in zcl_data: + logger.error("attributeAccessInterfaceAttributes section not found in zcl.json") + return False + + attr_access_interface = zcl_data["attributeAccessInterfaceAttributes"] + + internally_managed_attributes = {} + + for cluster_name, attributes in attr_access_interface.items(): + cluster_key = convert_to_snake_case(cluster_name) + + attr_list = sorted([attr.lower() for attr in attributes]) + + internally_managed_attributes[cluster_key] = attr_list + + internally_managed_attributes = dict(sorted(internally_managed_attributes.items())) + + with open(output_json_path, "w", encoding="utf-8") as f: + json.dump(internally_managed_attributes, f, indent=4, sort_keys=True) + + return True + + +def generate_internally_managed_attributes( + root_cluster_server_dir, zcl_json_path, output_json_path +) -> tuple[bool, str]: + """ + Get internally managed attributes. + Get attributes from server source files and zcl.json. + Merge the attributes and write to single JSON file ensuring no missing attributes. + + :param root_cluster_server_dir: Path to the directory containing server files + :param zcl_json_path: Path to the zcl.json file + :param output_json_path: Path to write the output JSON file + :return: True if successful, False otherwise + """ + temp_server_file = None + temp_zcl_file = None + try: + temp_server_file = output_json_path + ".server_temp" + temp_zcl_file = output_json_path + ".zcl_temp" + + logger.debug("Extracting attributes from server files...") + server_success = get_attributes_from_server_files( + root_cluster_server_dir, temp_server_file + ) + + logger.debug("Extracting attributes from zcl.json...") + zcl_success = get_attributes_from_zcl(zcl_json_path, temp_zcl_file) + + if not server_success and not zcl_success: + return False, "Failed to generate attributes from both sources" + + server_attributes = {} + zcl_attributes = {} + + if server_success: + try: + with open(temp_server_file, "r", encoding="utf-8") as f: + server_attributes = json.load(f) + logger.debug( + f"Loaded {len(server_attributes)} clusters from server files" + ) + except Exception as e: + logger.error(f"Error reading server attributes: {e}") + + if zcl_success: + try: + with open(temp_zcl_file, "r", encoding="utf-8") as f: + zcl_attributes = json.load(f) + logger.debug(f"Loaded {len(zcl_attributes)} clusters from zcl.json") + except Exception as e: + logger.error(f"Error reading zcl attributes: {e}") + + merged_attributes = merge_attributes_dicts(server_attributes, zcl_attributes) + logger.debug(f"Combined into {len(merged_attributes)} clusters") + + sorted_merged_attributes = dict(sorted(merged_attributes.items())) + write_to_file(output_json_path, sorted_merged_attributes, "json") + logger.info( + f"Successfully generated Internally Managed Attributes at {output_json_path}" + ) + return True, None + except Exception as e: + return False, f"Error generating internally managed attributes: {str(e)}" + finally: + if os.path.exists(temp_server_file): + os.remove(temp_server_file) + if os.path.exists(temp_zcl_file): + os.remove(temp_zcl_file) diff --git a/tools/data_model_gen/chip_source_deps/parser.py b/tools/data_model_gen/chip_source_deps/parser.py new file mode 100644 index 000000000..425758c99 --- /dev/null +++ b/tools/data_model_gen/chip_source_deps/parser.py @@ -0,0 +1,213 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import os +import logging +from utils.config import FileNames +from utils.helper import write_to_file +from utils.exceptions import ConfigurationError, CodeGenerationError +from chip_source_deps.cluster_mapping import normalize_cluster_name +from chip_source_deps.cluster_mapping import ( + generate_delegate_cluster_mapping, + generated_plugin_init_cb_cluster_mapping, +) +from chip_source_deps.zap_filter import generate_zap_filter_list +from chip_source_deps.internally_managed_attributes import ( + generate_internally_managed_attributes, +) + +logger = logging.getLogger(__name__) + + +def generate_migrated_clusters( + root_dir, migrated_clusters_json_file_path +) -> tuple[bool, str]: + """Find all clusters that have a CodegenIntegration.cpp file + + Args: + root_dir: The root directory to search in + migrated_clusters_json_file_path: Path to save the migrated clusters list + Returns: + True if successful, False otherwise + """ + migrated_clusters = [] + + try: + for dirpath, _, filenames in os.walk(root_dir): + for filename in filenames: + if not filename.endswith(".cpp") and not filename.endswith(".h"): + continue + if ( + filename.lower() == "codegenintegration.cpp" + or filename.lower() == "codegeninstance.cpp" + ): + cluster_name = os.path.basename(dirpath) + migrated_clusters.append(normalize_cluster_name(cluster_name)) + else: + with open( + os.path.join(dirpath, filename), "r", encoding="utf-8" + ) as file: + if "DefaultServerCluster" in file.read(): + cluster_name = os.path.basename(dirpath) + migrated_clusters.append( + normalize_cluster_name(cluster_name) + ) + + migrated_clusters.sort() + + if write_to_file(migrated_clusters_json_file_path, migrated_clusters, "json"): + logger.info( + f"Successfully written Migrated Clusters to {migrated_clusters_json_file_path}" + ) + return True, None + else: + return False, f"Error writing to {migrated_clusters_json_file_path}" + except Exception as e: + return False, f"Error generating migrated clusters: {str(e)}" + + +def generate_requirements(esp_matter_path, output_dir): + """ + Generate all the required intermediate server files + + Args: + esp_matter_path: Path to the ESP Matter repository + output_dir: Directory where the generated files will be stored + Returns: + True if successful, False otherwise + """ + os.makedirs(output_dir, exist_ok=True) + + chip_dir = os.path.join(esp_matter_path, "connectedhomeip/connectedhomeip") + root_cluster_server_dir = os.path.join(chip_dir, "src/app/clusters/") + header_files_dir = os.path.join(chip_dir, "zzz_generated/app-common/clusters") + plugin_cb_header_file = os.path.join( + esp_matter_path, + "components/esp_matter/zap_common/app/PluginApplicationCallbacks.h", + ) + + if not os.path.exists(root_cluster_server_dir): + raise ConfigurationError( + "Clusters directory does not exist", + file_path=root_cluster_server_dir, + context="generate_requirements", + suggestion="Ensure connectedhomeip is checked out under esp_matter_path.", + ) + + if not os.path.exists(header_files_dir): + raise ConfigurationError( + "Header files directory does not exist", + file_path=header_files_dir, + context="generate_requirements", + suggestion="Generate CHIP app-common headers (zzz_generated) first.", + ) + + if not os.path.exists(plugin_cb_header_file): + raise ConfigurationError( + "Plugin callback header file does not exist", + file_path=plugin_cb_header_file, + context="generate_requirements", + suggestion="Ensure esp_matter components include zap_common/app/PluginApplicationCallbacks.h.", + ) + + file_paths = { + FileNames.INTERNALLY_MANAGED_ATTRIBUTES: os.path.join( + output_dir, FileNames.INTERNALLY_MANAGED_ATTRIBUTES.value + ), + FileNames.DELEGATE_CLUSTERS: os.path.join( + output_dir, FileNames.DELEGATE_CLUSTERS.value + ), + FileNames.PLUGIN_INIT_CB_CLUSTERS: os.path.join( + output_dir, FileNames.PLUGIN_INIT_CB_CLUSTERS.value + ), + FileNames.ZAP_FILTER_LIST: os.path.join( + output_dir, FileNames.ZAP_FILTER_LIST.value + ), + FileNames.MIGRATED_CLUSTERS: os.path.join( + output_dir, FileNames.MIGRATED_CLUSTERS.value + ), + } + + logger.debug( + "Generating internally managed attributes from both server files and zcl.json..." + ) + zcl_json_path = os.path.join(chip_dir, "src/app/zap-templates/zcl/zcl.json") + if not os.path.exists(zcl_json_path): + raise ConfigurationError( + "zcl.json file does not exist", + file_path=zcl_json_path, + context="generate_requirements", + suggestion="Ensure connectedhomeip zap-templates are present.", + ) + is_generated, error_message = generate_internally_managed_attributes( + root_cluster_server_dir, + zcl_json_path, + file_paths[FileNames.INTERNALLY_MANAGED_ATTRIBUTES], + ) + if not is_generated: + raise CodeGenerationError( + error_message, + file_path=file_paths[FileNames.INTERNALLY_MANAGED_ATTRIBUTES], + context="generate_requirements", + suggestion="Check CHIP cluster server sources and zcl.json format.", + ) + + logger.debug("Generating delegate clusters...") + is_generated, error_message = generate_delegate_cluster_mapping( + root_cluster_server_dir, file_paths[FileNames.DELEGATE_CLUSTERS] + ) + if not is_generated: + raise CodeGenerationError( + error_message, + file_path=file_paths[FileNames.DELEGATE_CLUSTERS], + context="generate_requirements", + suggestion=f"Check {root_cluster_server_dir} and write permissions.", + ) + + logger.debug("Generating plugin init callback clusters...") + is_generated, error_message = generated_plugin_init_cb_cluster_mapping( + plugin_cb_header_file, file_paths[FileNames.PLUGIN_INIT_CB_CLUSTERS] + ) + if not is_generated: + raise CodeGenerationError( + error_message, + file_path=file_paths[FileNames.PLUGIN_INIT_CB_CLUSTERS], + context="generate_requirements", + suggestion=f"Check {plugin_cb_header_file} and output path.", + ) + + logger.debug("Generating include list...") + is_generated, error_message = generate_zap_filter_list( + header_files_dir, file_paths[FileNames.ZAP_FILTER_LIST] + ) + if not is_generated: + raise CodeGenerationError( + error_message, + file_path=file_paths[FileNames.ZAP_FILTER_LIST], + context="generate_requirements", + suggestion=f"Check {header_files_dir} and write permissions.", + ) + + logger.debug("Finding migrated clusters...") + is_generated, error_message = generate_migrated_clusters( + root_cluster_server_dir, file_paths[FileNames.MIGRATED_CLUSTERS] + ) + if not is_generated: + raise CodeGenerationError( + error_message, + file_path=file_paths[FileNames.MIGRATED_CLUSTERS], + context="generate_requirements", + suggestion=f"Check {root_cluster_server_dir} and write permissions.", + ) + + return True diff --git a/tools/data_model_gen/chip_source_deps/server_files_config.py b/tools/data_model_gen/chip_source_deps/server_files_config.py new file mode 100644 index 000000000..342282a12 --- /dev/null +++ b/tools/data_model_gen/chip_source_deps/server_files_config.py @@ -0,0 +1,57 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from tree_sitter import Parser +from tree_sitter_languages import get_language + +LANG_CPP = get_language("cpp") +parser = Parser() +parser.set_language(LANG_CPP) + +# Plugin init callback pattern +PLUGIN_CB_PATTERN = r"\bvoid\s+Matter(\w+)PluginServerInitCallback\s*\(" + +# Delegate related methods +DELEGATE_METHODS = ["GetDelegate", "SetDefaultDelegate", "SetDelegate"] + +# Member variable +DELEGATE_VARIABLE_NAMES = ["mDelegate"] + +# Regex to capture case statements like case :Id: +ATTRIBUTE_REGEX = r"case\s+([\w:]+)(?:::Id)?:" + +# Search for these function names in server files for internally managed attributes +KEYWORDS = ["Read(", "ReadAttribute(", "ReadImpl("] + +ATTRIBUTE_PATTERN = ( + r"namespace\s+(\w+)\s*{[\s\n]*inline\s+constexpr\s+AttributeId\s+Id\s*=\s*([\w:]+);" +) +COMMAND_PATTERN = ( + r"namespace\s+(\w+)\s*{[\s\n]*inline\s+constexpr\s+CommandId\s+Id\s*=\s*([\w:]+);" +) +EVENT_PATTERN = ( + r"namespace\s+(\w+)\s*{[\s\n]*inline\s+constexpr\s+EventId\s+Id\s*=\s*([\w:]+);" +) +CLUSTER_ID_PATTERN = r"inline\s+constexpr\s+ClusterId\s+Id\s*=\s*([\w:]+);" + +local_mappings = { + "dishwasher": "dish_washer", + "dishwasher_alarm": "dish_washer_alarm", + "dishwasher_mode": "dish_washer_mode", + "ota_requestor": "ota_software_update_requestor", + "ota_provider": "ota_software_update_provider", + "group_key_mgmt": "group_key_management", + "bindings": "binding", + "boolean_state": "boolean_state_configuration", +} diff --git a/tools/data_model_gen/chip_source_deps/zap_filter.py b/tools/data_model_gen/chip_source_deps/zap_filter.py new file mode 100644 index 000000000..24b4fc9ce --- /dev/null +++ b/tools/data_model_gen/chip_source_deps/zap_filter.py @@ -0,0 +1,188 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import json +import os +import re +import logging + +from utils.conversion_utils import format_hex_value, is_hex_value +from chip_source_deps.server_files_config import ( + ATTRIBUTE_PATTERN, + COMMAND_PATTERN, + EVENT_PATTERN, + CLUSTER_ID_PATTERN, +) + +logger = logging.getLogger(__name__) + + +def parse_attributes_header(file_path): + """Parse a C++ header file containing attribute definitions and return a dictionary + mapping attribute names to their ID values. + + :param file_path: + :returns: Dictionary with attribute_name: attribute_id mapping + :rtype: dict + + """ + attributes = {} + + try: + with open(file_path, "r") as f: + content = f.read() + matches = re.finditer(ATTRIBUTE_PATTERN, content) + for match in matches: + attr_name = match.group(1) + attr_id = match.group(2) + if is_hex_value(attr_id): + attributes[attr_name] = format_hex_value(attr_id) + return attributes + except Exception as e: + logger.error(f"Error parsing attribute header file {file_path}: {e}") + return {} + + +def parse_commands_header(file_path): + """Parse a C++ header file containing command definitions and return a dictionary + mapping command names to their ID values. + + :param file_path: + :returns: Dictionary with command_name: command_id mapping + :rtype: dict + + """ + commands = {} + try: + with open(file_path, "r") as f: + content = f.read() + matches = re.finditer(COMMAND_PATTERN, content) + for match in matches: + cmd_name = match.group(1) + cmd_id = match.group(2) + commands[cmd_name] = format_hex_value(cmd_id) + return commands + except Exception as e: + logger.error(f"Error parsing command header file {file_path}: {e}") + return {} + + +def parse_events_header(file_path): + """Parse a C++ header file containing event definitions and return a dictionary + mapping event names to their ID values. + + :param file_path: + :returns: Dictionary with event_name: event_id mapping + :rtype: dict + + """ + events = {} + try: + with open(file_path, "r") as f: + content = f.read() + matches = re.finditer(EVENT_PATTERN, content) + for match in matches: + event_name = match.group(1) + event_id = match.group(2) + events[event_name] = format_hex_value(event_id) + return events + except Exception as e: + logger.error(f"Error parsing event header file {file_path}: {e}") + return {} + + +def extract_cluster_id(file_path): + """Extract cluster ID from ClusterId.h file. + + :param file_path: + :returns: Cluster ID value as a string + :rtype: str + + """ + try: + with open(file_path, "r") as f: + content = f.read() + match = re.search(CLUSTER_ID_PATTERN, content) + if match: + return format_hex_value(match.group(1)) + return None + except Exception as e: + logger.error(f"Error extracting cluster ID from {file_path}: {e}") + return None + + +def parse_cluster_directory(cluster_dir): + """Parse a cluster directory containing header files and return a structured dictionary + with all the cluster information. + + :param cluster_dir: + :returns: Dictionary with cluster information + :rtype: dict + + """ + cluster_name = os.path.basename(cluster_dir) + cluster_id_file = os.path.join(cluster_dir, "ClusterId.h") + attributes_file = os.path.join(cluster_dir, "AttributeIds.h") + commands_file = os.path.join(cluster_dir, "CommandIds.h") + events_file = os.path.join(cluster_dir, "EventIds.h") + result = { + "name": cluster_name, + "id": None, + "Attributes": {}, + "Commands": {}, + "Events": {}, + } + if os.path.exists(cluster_id_file): + result["id"] = extract_cluster_id(cluster_id_file) + if os.path.exists(attributes_file): + result["Attributes"] = parse_attributes_header(attributes_file) + if os.path.exists(commands_file): + result["Commands"] = parse_commands_header(commands_file) + if os.path.exists(events_file): + result["Events"] = parse_events_header(events_file) + return result + + +def generate_zap_filter_list(clusters_base_dir, output_file) -> tuple[bool, str]: + """Generate zap_filter_list.json from zap-generated header files. + + :param clusters_base_dir: The base directory containing the cluster header files. + :param output_file: + :returns: True if the file was written successfully, False otherwise. + + """ + all_clusters = {} + for cluster_dir in os.listdir(clusters_base_dir): + result = parse_cluster_directory(os.path.join(clusters_base_dir, cluster_dir)) + all_clusters[result["id"]] = { + "name": result["name"], + "Attributes": result["Attributes"], + "Commands": result["Commands"], + "Events": result["Events"], + } + formatted_output = {} + formatted_output["clusters"] = all_clusters + try: + output_dir = os.path.dirname(output_file) + if output_dir and not os.path.exists(output_dir): + os.makedirs(output_dir) + + with open(output_file, "w") as f: + json.dump(formatted_output, f, indent=2) + + logger.info( + f"Successfully written zap data model elements filter list to {output_file}" + ) + return True, None + except Exception as e: + return False, f"Error writing to {output_file}: {str(e)}" diff --git a/tools/data_model_gen/code_generation/__init__.py b/tools/data_model_gen/code_generation/__init__.py new file mode 100644 index 000000000..207b1ae5d --- /dev/null +++ b/tools/data_model_gen/code_generation/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Code generation logic for the data model generation""" diff --git a/tools/data_model_gen/code_generation/code_generator.py b/tools/data_model_gen/code_generation/code_generator.py new file mode 100644 index 000000000..bf80d822b --- /dev/null +++ b/tools/data_model_gen/code_generation/code_generator.py @@ -0,0 +1,233 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import os +import logging +from jinja2 import Environment, FileSystemLoader +from .deserializer import ClusterDeserializer, DeviceDeserializer +from .elements import Cluster, Device +from typing import List + +from utils.helper import write_to_file +from utils.exceptions import CodeGenerationError + +template_dir = os.path.join( + os.path.dirname(os.path.abspath(__file__)), "..", "templates" +) + + +def format_filter(value, fmt): + """Format filter for Jinja templates""" + return fmt.format(value) + + +env = Environment( + loader=FileSystemLoader(template_dir), + trim_blocks=True, + lstrip_blocks=True, + extensions=["jinja2.ext.do"], +) +env.filters["format_filter"] = format_filter + + +CLUSTER_CPP_TEMPLATE = "cluster.cpp.jinja" +CLUSTER_H_TEMPLATE = "cluster.h.jinja" +CLUSTER_IDS_TEMPLATE = "cluster_ids.h.jinja" +DEVICE_CPP_TEMPLATE = "device.cpp.jinja" +DEVICE_H_TEMPLATE = "device.h.jinja" + +logger = logging.getLogger(__name__) + + +def get_all_cluster_objects(json_path: str) -> List[Cluster]: + """Parse JSON file and create Cluster objects + + :param json_path: The path to the JSON file + :returns: A list of clusters + """ + return ClusterDeserializer().deserialize(json_path) + + +def get_all_device_objects(json_path: str, clusters: List[Cluster]) -> List[Device]: + """Parse device types JSON and create Device objects + + :param json_path: The path to the JSON file + :param clusters: A list of clusters + :returns: A list of devices + """ + cluster_lookup_table = {cluster.esp_name: cluster for cluster in clusters} + return DeviceDeserializer().deserialize(json_path, cluster_lookup_table) + + +def render_templates(obj, cpp_template_obj, h_template_obj): + if isinstance(obj, Cluster): + cpp_code = cpp_template_obj.render(cluster=obj) + h_code = h_template_obj.render(cluster=obj) + elif isinstance(obj, Device): + cpp_code = cpp_template_obj.render(device=obj) + h_code = h_template_obj.render(device=obj) + else: + return None, None + return cpp_code, h_code + + +def save_generated_files(file_name, cpp_code, h_code, output_dir): + """Save the generated C++ and header files.""" + cpp_file_path = os.path.join(output_dir, f"{file_name}.cpp") + h_file_path = os.path.join(output_dir, f"{file_name}.h") + if not write_to_file(cpp_file_path, cpp_code): + raise CodeGenerationError( + "Failed to write generated C++ file", + file_path=cpp_file_path, + context=file_name, + suggestion="Check write permissions and disk space.", + ) + if not write_to_file(h_file_path, h_code): + raise CodeGenerationError( + "Failed to write generated header file", + file_path=h_file_path, + context=file_name, + suggestion="Check write permissions and disk space.", + ) + + +def generate_cluster_files(json_path, output_dir): + """Parse cluster JSON and generate C++ and header files. + + :param json_path: The path to the cluster JSON file. + :param output_dir: The directory to save the generated files. + :returns: A list of clusters. + """ + try: + cluster_output_dir = os.path.join(output_dir, "clusters") + cluster_name_list = [] + + os.makedirs(cluster_output_dir, exist_ok=True) + + cpp_template = env.get_template(CLUSTER_CPP_TEMPLATE) + h_template = env.get_template(CLUSTER_H_TEMPLATE) + ids_template = env.get_template(CLUSTER_IDS_TEMPLATE) + + clusters = get_all_cluster_objects(json_path) + + for cluster in clusters: + cpp_code, h_code = render_templates(cluster, cpp_template, h_template) + ids_code = ids_template.render(cluster=cluster) + cluster_specific_dir = os.path.join(cluster_output_dir, cluster.esp_name) + os.makedirs(cluster_specific_dir, exist_ok=True) + if cpp_code and h_code: + save_generated_files( + cluster.esp_name, + cpp_code, + h_code, + cluster_specific_dir, + ) + cluster_name_list.append(cluster.esp_name) + ids_file_path = os.path.join( + cluster_specific_dir, f"{cluster.esp_name}_ids.h" + ) + write_to_file(ids_file_path, ids_code) + + header_file_path = os.path.join(output_dir, "clusters", "all_clusters.h") + generate_header_file(header_file_path, cluster_name_list) + logger.info(f"Cluster files generated at: {cluster_output_dir}") + return clusters + except Exception as e: + logger.error(f"Error generating cluster files: {e}") + raise CodeGenerationError( + "Error generating cluster files", + context="generate_cluster_files", + suggestion="Check the cluster JSON file and the template files.", + ) from e + + +def generate_device_files(json_path, output_dir, clusters: List[Cluster]): + """Parse device JSON and generate C++ and header files. + + :param json_path: The path to the device JSON file. + :param output_dir: The directory to save the generated files. + :param clusters: A list of clusters. + :returns: A list of devices. + """ + try: + device_output_dir = os.path.join(output_dir, "device_types") + device_name_list = [] + + os.makedirs(device_output_dir, exist_ok=True) + + cpp_template = env.get_template(DEVICE_CPP_TEMPLATE) + h_template = env.get_template(DEVICE_H_TEMPLATE) + devices = get_all_device_objects(json_path, clusters) + + for device in devices: + cpp_code, h_code = render_templates(device, cpp_template, h_template) + device_specific_dir = os.path.join(device_output_dir, device.filename) + os.makedirs(device_specific_dir, exist_ok=True) + if cpp_code and h_code: + save_generated_files( + device.filename, + cpp_code, + h_code, + device_specific_dir, + ) + device_name_list.append(device.filename) + + header_file_path = os.path.join( + output_dir, "device_types", "all_device_types.h" + ) + generate_header_file(header_file_path, device_name_list) + logger.info(f"Device files generated at: {device_output_dir}") + return devices + except Exception as e: + logger.error(f"Error generating device files: {e}") + raise CodeGenerationError( + "Error generating device files", + context="generate_device_files", + suggestion="Check the device JSON file and the template files.", + ) from e + + +def generate_header_file(output_file_path: str, objects: List[str]): + """Generate a all cluster and device header files. + :param output_file_path: The filepath to save the header file. + :param objects: A list of cluster or device names. + """ + os.makedirs(os.path.dirname(output_file_path), exist_ok=True) + header_content = [ + """// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +""" + ] + sorted_objects = sorted(objects) + + for object_name in sorted_objects: + header_content.append(f'#include "{object_name}.h"\n') + + with open(output_file_path, "w") as f: + f.writelines(header_content) + logger.info(f"Generated header file: {output_file_path}") diff --git a/tools/data_model_gen/code_generation/conformance_codegen.py b/tools/data_model_gen/code_generation/conformance_codegen.py new file mode 100644 index 000000000..ff505fe9a --- /dev/null +++ b/tools/data_model_gen/code_generation/conformance_codegen.py @@ -0,0 +1,507 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations +import logging +from abc import ABC, abstractmethod +from typing import Dict, Optional, Any, List +from utils.conformance import ( + ConformanceDecision, + get_conformance_type, + ConformanceTAG, + BaseConformance, + Choice, + ConformanceException, +) + +logger = logging.getLogger(__name__) + +# Conformance type constants +MANDATORY_CONFORM = "mandatory" +OPTIONAL_CONFORM = "optional" +OTHERWISE_CONFORM = "otherwise" +DEPRECATE_CONFORM = "deprecate" +DISALLOWED_CONFORM = "disallowed" +PROVISIONAL_CONFORM = "provisional" + +KEY_TYPE = "type" + + +class ExprIterator(ABC): + @abstractmethod + def iterate_attribute(self, expr): ... + + @abstractmethod + def iterate_feature(self, expr): ... + + @abstractmethod + def iterate_command(self, expr): ... + + @abstractmethod + def iterate_true(self, expr): ... + + @abstractmethod + def iterate_false(self, expr): ... + + @abstractmethod + def iterate_non(self, expr): ... + + @abstractmethod + def iterate_not(self, expr): ... + + @abstractmethod + def iterate_and(self, expr): ... + + @abstractmethod + def iterate_or(self, expr): ... + + @abstractmethod + def iterate_wrapper(self, expr): ... + + @abstractmethod + def iterate_otherwise(self, expr): ... + + +def filter_operand(operands: List[Expr]) -> List[Expr]: + """Filter out the operands that are not valid expressions.""" + return [ + op + for op in operands + if op() is not None and "true" not in op() and "false" not in op() + ] + + +class Expr(ABC): + @abstractmethod + def __call__(self) -> str: ... + + @abstractmethod + def iterate(self, iterator: ExprIterator): ... + + +class NonExpr(Expr): + def __call__(self) -> str: + return None + + def iterate(self, iterator: ExprIterator): + iterator.iterate_non(self) + + +class TrueExpr(Expr): + def __call__(self) -> str: + return "true" + + def iterate(self, iterator: ExprIterator): + iterator.iterate_true(self) + + +class FalseExpr(Expr): + def __call__(self) -> str: + return "false" + + def iterate(self, iterator: ExprIterator): + iterator.iterate_false(self) + + +class AttributeExpr(Expr): + def __init__(self, attr_name: str): + self.attr_name = attr_name + + def __call__(self) -> str: + return f"has_attribute({self.attr_name})" + + def iterate(self, iterator: ExprIterator): + iterator.iterate_attribute(self) + + +class CommandExpr(Expr): + def __init__(self, command_name: str, flag: str): + self.command_name = command_name + self.flag = flag + + def __call__(self) -> str: + return f"has_command({self.command_name}, {self.flag})" + + def iterate(self, iterator: ExprIterator): + iterator.iterate_command(self) + + +class FeatureExpr(Expr): + def __init__(self, feature_name: str): + self.feature_name = feature_name + + def __call__(self) -> str: + return f"has_feature({self.feature_name})" + + def iterate(self, iterator: ExprIterator): + iterator.iterate_feature(self) + + +class AndExpr(Expr): + def __init__(self, operands: List[Expr]): + self.operands = filter_operand(operands) + + def __call__(self) -> str: + joined_expr = " && ".join(f"({op()})" for op in self.operands) + return f"({joined_expr})" if len(self.operands) > 0 else None + + def iterate(self, iterator: ExprIterator): + iterator.iterate_and(self) + for op in self.operands: + op.iterate(iterator) + + +class OrExpr(Expr): + def __init__(self, operands: List[Expr]): + self.operands = filter_operand(operands) + + def __call__(self) -> str: + joined_expr = " || ".join(f"({op()})" for op in self.operands) + return f"({joined_expr})" if len(self.operands) > 0 else None + + def iterate(self, iterator: ExprIterator): + iterator.iterate_or(self) + for op in self.operands: + op.iterate(iterator) + + +class NotExpr(Expr): + def __init__(self, operand: Expr): + self.operand = operand + + def __call__(self) -> str: + return f"!({self.operand()})" + + def iterate(self, iterator: ExprIterator): + iterator.iterate_not(self) + self.operand.iterate(iterator) + + +class WrapperExpr(Expr): + def __init__(self, operand: Expr): + self.operand = operand + + def __call__(self) -> str: + return self.operand() + + def iterate(self, iterator: ExprIterator): + iterator.iterate_wrapper(self) + self.operand.iterate(iterator) + + +class MandatoryExpr(WrapperExpr): + pass + + +class OptionalExpr(WrapperExpr): + pass + + +class DeprecateExpr(WrapperExpr): + def __call__(self) -> str: + return f"(!({self.operand()}))" + + +class DisallowedExpr(WrapperExpr): + def __call__(self) -> str: + return f"(!({self.operand()}))" + + +class OtherwiseExpr(Expr): + def __init__(self, operands: List[Expr]): + self.operands = filter_operand(operands) + + def __call__(self) -> str: + joined_expr = " || ".join(op() for op in self.operands) + return f"({joined_expr})" if len(self.operands) > 0 else None + + def iterate(self, iterator: ExprIterator): + iterator.iterate_otherwise(self) + for op in self.operands: + op.iterate(iterator) + + +def parse_expr(obj: dict) -> Expr: + """Parse the conformance dictionary and return the corresponding Expr object. + :param obj: The conformance expression in dictionary format. + :returns: The corresponding Expr object. + """ + if obj is None: + return NonExpr() + + elif isinstance(obj, bool): + return TrueExpr() if obj else FalseExpr() + + elif ConformanceTAG.ATTRIBUTE.value in obj: + return AttributeExpr(obj[ConformanceTAG.ATTRIBUTE.value]) + + elif ConformanceTAG.FEATURE.value in obj: + return FeatureExpr(obj[ConformanceTAG.FEATURE.value]) + + elif ConformanceTAG.COMMAND.value in obj: + if ConformanceTAG.COMMAND_FLAG.value not in obj: + raise ConformanceException( + f"Command flag not found for command: {obj[ConformanceTAG.COMMAND.value]}", + context="conformance_codegen.parse_expr", + suggestion="Ensure the conformance JSON includes commandFlag for the command.", + ) + return CommandExpr( + obj[ConformanceTAG.COMMAND.value], obj[ConformanceTAG.COMMAND_FLAG.value] + ) + + elif ConformanceTAG.NOT.value in obj: + return NotExpr(parse_expr(obj[ConformanceTAG.NOT.value])) + + elif ConformanceTAG.AND.value in obj: + return AndExpr([parse_expr(x) for x in obj[ConformanceTAG.AND.value]]) + + elif ConformanceTAG.OR.value in obj: + return OrExpr([parse_expr(x) for x in obj[ConformanceTAG.OR.value]]) + + elif ConformanceTAG.GREATER.value in obj: + logger.debug(f"Greater than condition not supported: {obj}") + return NonExpr() + + else: + logger.debug(f"Unknown conformance expression: {obj}") + return NonExpr() + + +def parse_choice(conformance: Dict[str, Any]) -> Optional[Choice]: + if not conformance: + return None + choice = conformance.get("choice") + if choice: + more = bool(conformance.get("more", False)) + return Choice(choice, more) + + nested_conformance = conformance.get(ConformanceTAG.CONDITION.value, {}) + nested_optional_conformance = nested_conformance.get(OPTIONAL_CONFORM, {}) + if nested_optional_conformance: + if isinstance(nested_optional_conformance, list): + for cond in nested_optional_conformance: + choice = cond.get("choice") + more = bool(cond.get("more", False)) + return Choice(choice, more) + elif isinstance(nested_optional_conformance, dict): + choice = nested_optional_conformance.get("choice") + more = bool(nested_optional_conformance.get("more", False)) + return Choice(choice, more) + return None + return None + + +class NotIterator(ExprIterator): + def __init__(self): + self.found = False + + def iterate_attribute(self, expr): + return + + def iterate_feature(self, expr): + return + + def iterate_command(self, expr): + return + + def iterate_true(self, expr): + return + + def iterate_false(self, expr): + return + + def iterate_non(self, expr): + return + + def iterate_not(self, expr: NotExpr): + self.found = True + expr.operand.iterate(self) + + def iterate_and(self, expr: AndExpr): + for op in expr.operands: + op.iterate(self) + + def iterate_or(self, expr: OrExpr): + for op in expr.operands: + op.iterate(self) + + def iterate_wrapper(self, expr: WrapperExpr): + expr.operand.iterate(self) + + def iterate_otherwise(self, expr: OtherwiseExpr): + for op in expr.operands: + op.iterate(self) + + +class Conformance(BaseConformance, Expr): + """Conformance class.""" + + condition: Expr = None + is_not_term_present: bool = False + + def __init__(self, conformance: Dict[str, Any] = None): + if not conformance: + self.type = ConformanceDecision.NOT_APPLICABLE + return + self.conformance = conformance + self.type = get_conformance_type(conformance.get(KEY_TYPE)) + self.choice = parse_choice(conformance) + self.condition = self._generate_condition(conformance) + if self.condition: + not_iterator = NotIterator() + self.condition.iterate(not_iterator) + self.is_not_term_present = not_iterator.found + + def __call__(self) -> str: + return self.condition() if self.condition else None + + def get_mandatory_condition(self) -> Expr: + """Get the conformance condition for mandatory conformance.""" + return ( + self.condition() + if self.type == ConformanceDecision.MANDATORY and self.condition + else None + ) + + def get_optional_condition(self) -> Expr: + """Get the conformance condition for optional/otherwise conformance.""" + condition = self.conformance.get(ConformanceTAG.CONDITION.value) + if not condition: + return None + + if self.type == ConformanceDecision.OPTIONAL: + return OptionalExpr(parse_expr(condition))() + + if self.type == ConformanceDecision.OTHERWISE: + operands = [] + + def process(cond): + if cond is None: + return True + if isinstance(cond, bool): + return False + + conds = cond if isinstance(cond, list) else [cond] + + for c in conds: + if isinstance(c, bool): + return False + op = parse_expr(c) + if op() is None: + return False + operands.append(op) + return True + + if not process(condition.get(MANDATORY_CONFORM)): + return None + if not process(condition.get(OPTIONAL_CONFORM)): + return None + + return OtherwiseExpr(operands)() + + return None + + def _generate_condition(self, conformance: Dict[str, Any]) -> Expr: + """Generate the conformance expression for the conformance. + :param conformance: The conformance dictionary. + :returns: The conformance expression. + :raises: CodeGenerationError if the conformance type is invalid. + """ + if not conformance: + return None + condition = conformance.get(ConformanceTAG.CONDITION.value) + if not condition: + return None + if self.type == ConformanceDecision.OTHERWISE: + operands = [] + optional_condition = condition.get(OPTIONAL_CONFORM) + if optional_condition: + if isinstance(optional_condition, list): + for cond in optional_condition: + operands.append(parse_expr(cond)) + else: + operands.append(parse_expr(optional_condition)) + mandatory_condition = condition.get(MANDATORY_CONFORM) + if mandatory_condition: + mandatory = parse_expr(mandatory_condition) + operands.append(mandatory) + deprecate_condition = condition.get(DEPRECATE_CONFORM) + if deprecate_condition: + deprecate = DeprecateExpr(parse_expr(deprecate_condition)) + operands.append(deprecate) + disallowed_condition = condition.get(DISALLOWED_CONFORM) + if disallowed_condition: + disallowed = DisallowedExpr(parse_expr(disallowed_condition)) + operands.append(disallowed) + return OtherwiseExpr(operands) + elif self.type == ConformanceDecision.MANDATORY: + return MandatoryExpr(parse_expr(condition)) + elif self.type == ConformanceDecision.OPTIONAL: + return OptionalExpr(parse_expr(condition)) + elif self.type == ConformanceDecision.DISALLOWED: + return DisallowedExpr(parse_expr(condition)) + elif self.type == ConformanceDecision.DEPRECATED: + return DeprecateExpr(parse_expr(condition)) + else: + raise ConformanceException( + f"Unknown conformance type: {self.type}", + context="conformance_codegen._generate_condition", + suggestion="Use a valid ConformanceDecision value.", + ) + + def iterate(self, iterator: ExprIterator): + if self.condition: + self.condition.iterate(iterator) + + +class FeatureConformance(Conformance): + """Feature Specific Conformance class.""" + + # dependency on parent feature + mandatory_parent: Optional[str] = None + optional_parent: Optional[str] = None + + def __init__(self, conformance: Dict[str, Any] = None): + super().__init__(conformance) + if conformance and self.type == ConformanceDecision.OTHERWISE: + condition = conformance.get(ConformanceTAG.CONDITION.value) + if condition and isinstance(condition, dict): + mandatory = condition.get(MANDATORY_CONFORM) + if ( + mandatory + and isinstance(mandatory, dict) + and ConformanceTAG.FEATURE.value in mandatory + ): + self.mandatory_parent = mandatory[ConformanceTAG.FEATURE.value] + elif conformance and self.type == ConformanceDecision.OPTIONAL: + condition = conformance.get(ConformanceTAG.CONDITION.value) + if condition and isinstance(condition, dict): + self.optional_parent = condition.get(ConformanceTAG.FEATURE.value) + + elif conformance and self.type == ConformanceDecision.MANDATORY: + condition = conformance.get(ConformanceTAG.CONDITION.value) + if condition and isinstance(condition, dict): + self.mandatory_parent = condition.get(ConformanceTAG.FEATURE.value) + + def is_exact_one(self) -> bool: + """Check if the conformance is O.a""" + if self.choice is None: + return False + return self.choice.marker is not None and not self.choice.more + + def is_at_least_one(self) -> bool: + """Check if the conformance is O.a+""" + if self.choice is None: + return False + return self.choice.marker is not None and self.choice.more diff --git a/tools/data_model_gen/code_generation/deserializer.py b/tools/data_model_gen/code_generation/deserializer.py new file mode 100644 index 000000000..c355064b0 --- /dev/null +++ b/tools/data_model_gen/code_generation/deserializer.py @@ -0,0 +1,343 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +from typing import List, Dict, Any +import logging + +from .elements import Attribute, Command, Event, Feature, Cluster, Device +from .conformance_codegen import FeatureConformance, Conformance + +logger = logging.getLogger(__name__) + + +class ClusterDeserializer: + """Deserializer for building cluster objects from JSON data""" + + def deserialize(self, json_path: str) -> List[Cluster]: + """Deserialize clusters from cluster JSON file + + :param json_path: Path to the cluster JSON file + :returns: List of Cluster objects + """ + with open(json_path, "r") as f: + cluster_data_list = json.load(f) + + clusters = [ + self._deserialize_single_cluster(cluster_data) + for cluster_data in cluster_data_list + ] + + return sorted( + clusters, key=lambda x: (int(x.get_id(), 16), not x.server_cluster) + ) + + def _deserialize_single_cluster(self, cluster_data: Dict[str, Any]) -> Cluster: + """Deserialize a single cluster from cluster JSON data""" + logger.debug(f"Deserializing cluster: {cluster_data.get('name', 'Unknown')}") + + cluster = Cluster( + name=cluster_data["name"], + id=cluster_data["id"], + revision=cluster_data["revision"], + is_mandatory=cluster_data.get("is_mandatory", False), + ) + + self._set_cluster_properties(cluster, cluster_data) + + cluster.attributes = self._deserialize_attributes( + cluster_data.get("attributes", []) + ) + cluster.commands = self._deserialize_commands(cluster_data.get("commands", [])) + cluster.events = self._deserialize_events(cluster_data.get("events", [])) + cluster.features = self._deserialize_features( + cluster_data.get("features", []), cluster + ) + + return cluster + + def _set_cluster_properties( + self, cluster: Cluster, cluster_data: Dict[str, Any] + ) -> None: + """Set cluster properties""" + cluster.role = cluster_data.get("classification", {}).get("role", "Unknown") + cluster.server_cluster = cluster_data.get("type", "Unknown") == "Server" + cluster.client_cluster = cluster_data.get("type", "Unknown") == "Client" + cluster.callback_functions = cluster_data.get("callback_functions", []) + cluster.function_flags = cluster_data.get("function_flags", "") + cluster.delegate_init_callback = cluster_data.get( + "delegate_init_callback", "None" + ) + cluster.plugin_server_init_callback = cluster_data.get( + "plugin_server_init_callback", "" + ) + cluster.delegate_init_callback_available = bool(cluster.delegate_init_callback) + cluster.is_migrated_cluster = cluster_data.get("is_migrated_cluster", False) + cluster.is_derived_cluster = ( + cluster_data.get("classification", {}).get("hierarchy", "Unknown") + == "derived" + ) + + def _deserialize_attributes( + self, attributes_data: List[Dict[str, Any]] + ) -> List[Attribute]: + """Deserialize attributes from cluster JSON data""" + attributes = [] + for attr_data in attributes_data: + attr = Attribute( + name=attr_data["name"], + id=attr_data["id"], + type_=attr_data["type"], + is_mandatory=attr_data.get("mandatory", False), + default_value=attr_data.get("default_value", "0"), + ) + + attr.converted_type = attr_data.get("converted_type", "") + attr.is_nullable = attr_data.get("nullable", False) + attr._flag = attr_data.get("flags", "") + attr.max_length = attr_data.get("max_length", 0) + attr.min_value = attr_data.get("min_value", "") + attr.max_value = attr_data.get("max_value", "") + attr.conformance = Conformance(attr_data.get("conformance", "")) + attr.is_internally_managed = ( + "ATTRIBUTE_FLAG_MANAGED_INTERNALLY" in attr.get_flag() + ) + if attr.type in ["string", "octstr", "struct", "list", "array"]: + attr.is_complex = True + + attributes.append(attr) + + return attributes + + def _deserialize_commands( + self, commands_data: List[Dict[str, Any]] + ) -> List[Command]: + """Deserialize commands from cluster JSON data""" + commands = [] + for cmd_data in commands_data: + cmd = Command( + name=cmd_data["name"], + id=cmd_data["id"], + is_mandatory=cmd_data.get("mandatory", False), + direction=cmd_data.get("direction", ""), + response=self.get_command_response(cmd_data), + ) + + cmd._flag = cmd_data.get("flags", "") + cmd.has_callback = cmd_data.get("callback_required", False) + cmd.conformance = Conformance(cmd_data.get("conformance", "")) + + access_obj = cmd_data.get("access", "") + if access_obj: + cmd.is_fabric_scoped = access_obj.get("fabric_scoped", False) + + commands.append(cmd) + + return commands + + def get_command_response(self, cmd_data: Dict[str, Any]) -> str: + """Get the response command for a given command""" + if cmd_data.get("response") is None: + return None + if cmd_data.get("response") == "Y" or cmd_data.get("response") == "N": + return None + return cmd_data.get("response") + + def _deserialize_events(self, events_data: List[Dict[str, Any]]) -> List[Event]: + """Deserialize events from cluster JSON data""" + events = [] + for event_data in events_data: + event = Event( + name=event_data["name"], + id=event_data["id"], + is_mandatory=event_data.get("mandatory", False), + ) + + event.priority = event_data.get("priority", "Info") + event.conformance = Conformance(event_data.get("conformance", "")) + events.append(event) + + return events + + def _deserialize_features( + self, features_data: List[Dict[str, Any]], cluster: Cluster + ) -> List[Feature]: + """Deserialize features from cluster JSON data""" + features = [] + for feature_data in features_data: + feature = Feature( + name=feature_data["name"], + id=feature_data["id"], + code=feature_data.get("code", None), + is_mandatory=feature_data.get("mandatory", False), + ) + + conformance_data = feature_data.get("conformance", "") + if conformance_data is not None: + feature.conformance = FeatureConformance(conformance=conformance_data) + + self._link_feature_attributes( + feature, feature_data.get("attributes", []), cluster.attributes + ) + self._link_feature_commands( + feature, feature_data.get("commands", []), cluster.commands + ) + self._link_feature_events( + feature, feature_data.get("events", []), cluster.events + ) + + features.append(feature) + + return features + + def _link_feature_attributes( + self, + feature: Feature, + attr_names: List[str], + cluster_attributes: List[Attribute], + ) -> None: + """Replace attribute name list with actual attribute objects""" + for attr_name in attr_names: + attr = next((a for a in cluster_attributes if a.name == attr_name), None) + if attr: + feature.attributes.append(attr) + else: + logger.debug( + f"Attribute '{attr_name}' not found in cluster attributes may be deprecated" + ) + + def _link_feature_commands( + self, feature: Feature, cmd_names: List[str], cluster_commands: List[Command] + ) -> None: + """Replace command name list with actual command objects""" + for cmd_name in cmd_names: + cmd = next((c for c in cluster_commands if c.name == cmd_name), None) + if cmd: + feature.commands.append(cmd) + else: + logger.debug( + f"Command '{cmd_name}' not found in cluster commands may be deprecated" + ) + + def _link_feature_events( + self, feature: Feature, event_names: List[str], cluster_events: List[Event] + ) -> None: + """Replace event name list with actual event objects""" + for event_name in event_names: + event = next((e for e in cluster_events if e.name == event_name), None) + if event: + feature.events.append(event) + else: + logger.debug( + f"Event '{event_name}' not found in cluster events may be deprecated" + ) + + +class DeviceDeserializer: + """Deserializer for building device objects from JSON data""" + + def deserialize( + self, json_path: str, cluster_lookup_table: Dict[str, Cluster] + ) -> List[Device]: + """Deserialize devices from device JSON file + + :param json_path: Path to the device JSON file + :param cluster_lookup_table: Dictionary containing cluster lookup table + :returns: List of Device objects + """ + with open(json_path, "r") as f: + device_data_list = json.load(f) + + return [ + self._deserialize_single_device(device_data, cluster_lookup_table) + for device_data in device_data_list + ] + + def _deserialize_single_device( + self, + device_data: Dict[str, Any], + cluster_lookup_table: Dict[str, Cluster], + ) -> Device: + """Deserialize a single device from device JSON data""" + logger.debug(f"Deserializing device: {device_data.get('name', 'Unknown')}") + device = Device( + id=device_data["id"], + name=device_data["name"], + revision=device_data["revision"], + ) + + device.clusters = self._deserialize_device_clusters( + device_data.get("clusters", []), cluster_lookup_table + ) + return device + + def _deserialize_device_clusters( + self, + clusters_data: List[Dict[str, Any]], + cluster_lookup_table: Dict[str, Cluster], + ) -> List[Cluster]: + """Deserialize clusters for a device from device JSON data""" + clusters = [] + for cluster_data in clusters_data: + cluster = Cluster( + name=cluster_data["name"], + id=cluster_data["id"], + revision=cluster_data.get("revision", "0"), + is_mandatory=cluster_data.get("is_mandatory", False), + ) + + cluster_obj = cluster_lookup_table.get(cluster.esp_name, None) + + # Set device-specific cluster properties + cluster.function_flags = cluster_data.get("flags", "") + cluster.server_cluster = cluster_data.get("type", "Unknown") == "server" + cluster.client_cluster = cluster_data.get("type", "Unknown") == "client" + if cluster_obj: + cluster_attribute_names = cluster_data.get("attributes", []) + cluster_feature_names = cluster_data.get("features", []) + cluster_command_names = cluster_data.get("commands", []) + cluster_event_names = cluster_data.get("events", []) + cluster.has_choice_features = ( + True + if len(cluster_feature_names) > 0 + and cluster_obj.has_choice_features() + else False + ) + cluster.device_mandatory_attributes = [ + attribute + for attribute in cluster_obj.attributes + if attribute.func_name in cluster_attribute_names + ] + cluster.device_mandatory_features = [ + feature + for feature in cluster_obj.features + if feature.func_name in cluster_feature_names + or feature.code.lower() in cluster_feature_names + ] + cluster.device_mandatory_commands = [ + command + for command in cluster_obj.commands + if command.func_name in cluster_command_names + ] + cluster.device_mandatory_events = [ + event + for event in cluster_obj.events + if event.func_name in cluster_event_names + ] + else: + logger.error( + f"Cluster {cluster.esp_name} not found in cluster lookup table" + ) + clusters.append(cluster) + return clusters diff --git a/tools/data_model_gen/code_generation/elements.py b/tools/data_model_gen/code_generation/elements.py new file mode 100644 index 000000000..ee49de6e0 --- /dev/null +++ b/tools/data_model_gen/code_generation/elements.py @@ -0,0 +1,496 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from __future__ import annotations +import logging +from utils.base_elements import ( + BaseCluster, + BaseAttribute, + BaseCommand, + BaseEvent, + BaseFeature, + BaseDevice, +) +from .conformance_codegen import Conformance, ConformanceDecision, FeatureConformance +from typing import Dict, List, Tuple +from utils.conversion_utils import convert_to_int +from utils.overrides import ( + get_overridden_cluster_init_callback_name, + get_overridden_cluster_shutdown_callback_name, +) + +logger = logging.getLogger(__name__) + + +def get_id_name_lambda(): + """Returns a lambda function for sorting by ID and name""" + return lambda x: (convert_to_int(x.get_id()), x.name) + + +def get_choice_group( + parent_feature_type: str, + conformance_type: ConformanceDecision, + features: List[Feature], +): + """ + Get groups of parent feature with their dependent features. + Returns a list of dicts: { + "parent_feature": , + "dependent_features": [, ...], + "constraint": "at_least_one" | "exact_one" | None + } + """ + groups_by_key: Dict[Tuple[str, str], List] = {} + for feature in features: + if not feature.conformance: + continue + if feature.conformance.type != conformance_type: + continue + parent_name = getattr(feature.conformance, parent_feature_type, None) + if not parent_name or not feature.conformance.choice: + continue + key = (parent_name, feature.conformance.choice.marker) + if key not in groups_by_key: + groups_by_key[key] = [] + groups_by_key[key].append(feature) + + result = [] + for (parent_name, _marker), dependents in groups_by_key.items(): + parent = next( + (f for f in features if f.func_name == parent_name), + None, + ) + if not parent: + continue + first = dependents[0] + if first.conformance.is_at_least_one(): + constraint = "at_least_one" + elif first.conformance.is_exact_one(): + constraint = "exact_one" + else: + constraint = None + result.append( + { + "parent_feature": parent, + "dependent_features": sorted(dependents, key=get_id_name_lambda()), + "constraint": constraint, + } + ) + return result + + +class Cluster(BaseCluster): + """Cluster class that inherits from BaseCluster""" + + def __init__(self, name, id, revision, is_mandatory): + super().__init__(name=name, id=id, revision=revision, is_mandatory=is_mandatory) + self.attributes = [] + self.commands = [] + self.events = [] + self.features = [] + self.function_flags = "" + self.is_migrated_cluster = False + self.is_base_cluster = False + + def get_attributes(self): + """Get the list of attributes sorted by ID and name""" + return sorted(self.attributes, key=get_id_name_lambda()) + + def get_commands(self): + """Get the list of commands sorted by ID and name""" + return sorted(self.commands, key=get_id_name_lambda()) + + def get_events(self) -> List[BaseEvent]: + """Get the list of events sorted by ID and name""" + return sorted(self.events, key=get_id_name_lambda()) + + def get_features(self): + """Get the list of features sorted by ID and name""" + return sorted(self.features, key=get_id_name_lambda()) + + def get_mandatory_attributes(self): + """Get the list of mandatory attributes + Attribute is mandatory: + - if it is marked as mandatory in the cluster JSON file + - has no conformance condition or there is no NOT TERM present in the conformance condition + NOTE: NOT TERM indicate we have to create attribute by default while creating the cluster + """ + mandatory_attributes = [] + for attr in self.get_attributes(): + if attr.is_mandatory and ( + attr.conformance.get_mandatory_condition() is None + or attr.conformance.is_not_term_present + ): + mandatory_attributes.append(attr) + return mandatory_attributes + + def get_mandatory_commands(self): + """Get the list of mandatory commands + Command is mandatory: + - if it is marked as mandatory in the cluster JSON file + - has no conformance condition or there is no NOT TERM present in the conformance condition + NOTE: NOT TERM indicate we have to create command by default while creating the cluster + """ + mandatory_commands = [] + for cmd in self.get_commands(): + if cmd.is_mandatory and ( + cmd.conformance.get_mandatory_condition() is None + or cmd.conformance.is_not_term_present + ): + mandatory_commands.append(cmd) + return mandatory_commands + + def get_mandatory_events(self): + """Get the list of mandatory events + Event is mandatory: + - if it is marked as mandatory in the cluster JSON file + - has no conformance condition or there is no NOT TERM present in the conformance condition + NOTE: NOT TERM indicate we have to create event by default while creating the cluster + """ + mandatory_events = [] + for event in self.get_events(): + if event.is_mandatory and ( + event.conformance.get_mandatory_condition() is None + or event.conformance.is_not_term_present + ): + mandatory_events.append(event) + return mandatory_events + + def get_all_exact_one_features(self): + """Get all features that require exactly one feature to be supported""" + feature_list = {} + for feature in self.features: + if not feature.conformance: + continue + if feature.conformance.is_exact_one(): + key = feature.conformance.choice.marker + if key not in feature_list: + feature_list[key] = [] + feature_list[key].append(feature) + return feature_list + + def get_all_at_least_one_features(self) -> Dict: + """Get all features that require at least one feature to be supported""" + feature_list = {} + for feature in self.features: + if not feature.conformance: + continue + if feature.conformance.is_at_least_one(): + key = feature.conformance.choice.marker + if key not in feature_list: + feature_list[key] = [] + feature_list[key].append(feature) + return feature_list + + def has_choice_features(self): + """Check if the cluster has any choice features""" + return ( + len(self.get_all_exact_one_features()) > 0 + or len(self.get_all_at_least_one_features()) > 0 + ) + + def get_otherwise_choice_groups(self) -> List[Dict]: + return get_choice_group( + "mandatory_parent", ConformanceDecision.OTHERWISE, self.features + ) + + def get_optional_choice_groups(self) -> List[Dict]: + return get_choice_group( + "optional_parent", ConformanceDecision.OPTIONAL, self.features + ) + + def get_mandatory_choice_groups(self) -> List[Dict]: + return get_choice_group( + "mandatory_parent", ConformanceDecision.MANDATORY, self.features + ) + + def get_choice_group_feature_set(self) -> set: + """Set of features that are parent or dependent in any otherwise choice group.""" + feature_set = set() + for group in self.get_otherwise_choice_groups(): + feature_set.add(group["parent_feature"]) + feature_set.update(group["dependent_features"]) + for group in self.get_optional_choice_groups(): + feature_set.update(group["dependent_features"]) + for group in self.get_mandatory_choice_groups(): + feature_set.add(group["parent_feature"]) + feature_set.update(group["dependent_features"]) + return feature_set + + def get_standalone_choice_groups(self) -> List[Tuple[str, List]]: + """ + Choice groups that do not have a mandatory parent (not otherwise groups). + Returns list of (constraint_type, features) where constraint_type is + "exact_one", or "at_least_one". + """ + all_choice_set = self.get_choice_group_feature_set() + choice_group_list = [] + for marker, features in self.get_all_exact_one_features().items(): + if not all(f in all_choice_set for f in features): + choice_group_list.append(("exact_one", features)) + for marker, features in self.get_all_at_least_one_features().items(): + if not all(f in all_choice_set for f in features): + choice_group_list.append(("at_least_one", features)) + return choice_group_list + + def get_independent_features(self) -> List: + """Features that are not part of any otherwise choice group (parent or dependent).""" + choice_set = self.get_choice_group_feature_set() + choice_groups_list = self.get_standalone_choice_groups() + choice_groups_set = set() + for type, features in choice_groups_list: + choice_groups_set.update(features) + final_choice_set = choice_set | choice_groups_set + return [f for f in self.get_features() if f not in final_choice_set] + + def get_cluster_init_callback(self): + """Get the cluster init callback name""" + return get_overridden_cluster_init_callback_name(self.id, self.chip_name) + + def get_cluster_shutdown_callback(self): + """Get the cluster shutdown callback name""" + return get_overridden_cluster_shutdown_callback_name(self.id, self.chip_name) + + def get_response_command(self, command_name: str): + """Get the response command for a given command name""" + for command in self.commands: + if command.name == command_name: + return command + return None + + def get_destroyable_elements(self, feature_name: str): + """Get the list of destroyable elements for a given feature name""" + elements = { + "attributes": [], + "commands": [], + "events": [], + } + for attribute in self.attributes: + conformance_condition = ( + attribute.conformance.get_mandatory_condition() + if attribute.conformance + and attribute.conformance.get_mandatory_condition() is not None + else "" + ) + if ( + attribute.conformance.is_not_term_present + and f"!(has_feature({feature_name})" in conformance_condition + ): + elements["attributes"].append(attribute) + for command in self.commands: + conformance_condition = ( + command.conformance.get_mandatory_condition() + if command.conformance + and command.conformance.get_mandatory_condition() is not None + else "" + ) + if ( + command.conformance.is_not_term_present + and f"!(has_feature({feature_name})" in conformance_condition + ): + elements["commands"].append(command) + for event in self.events: + conformance_condition = ( + event.conformance.get_mandatory_condition() + if event.conformance + and event.conformance.get_mandatory_condition() is not None + else "" + ) + if ( + event.conformance.is_not_term_present + and f"!(has_feature({feature_name})" in conformance_condition + ): + elements["events"].append(event) + return elements + + +class Attribute(BaseAttribute): + """Attribute class that inherits from BaseAttribute""" + + def __init__(self, name, id, type_, is_mandatory, default_value): + super().__init__( + name=name, + id=id, + type_=type_, + is_mandatory=is_mandatory, + default_value=default_value, + ) + self.converted_type = None + self.is_nullable = False + self._flag = None + self.max_length = 0 # For string attributes + self.min_value = None # For attribute bounds + self.max_value = None # For attribute bounds + + self.conformance = Conformance() + self.is_internally_managed = False + self.is_complex = False + + def get_flag(self): + """Get the attribute flags""" + return self._flag + + def get_type(self): + """Get the attribute type""" + return self.converted_type + + def get_min_value(self): + """Get the min value""" + return self.min_value + + def get_max_value(self): + """Get the max value""" + if self.max_value is None: + return self.get_default_value() + return self.max_value + + def get_default_value(self): + """Get the default value""" + return self.default_value + + def get_default_value_type(self): + """Get the ESP type for the default value""" + value = self.get_default_value() + int_value = convert_to_int(value) + if int_value is None: + return "uint32_t" + elif int_value <= 255: + return "uint8_t" + elif int_value <= 65535: + return "uint16_t" + return "uint32_t" + + def get_conformance_condition(self): + """Get the conformance condition""" + return self.conformance.get_mandatory_condition() + + +class Command(BaseCommand): + """Command class that inherits from BaseCommand""" + + def __init__(self, name, id, is_mandatory, direction, response): + super().__init__( + name=name, + id=id, + is_mandatory=is_mandatory, + direction=direction, + response=response, + ) + self._flag = "" + self.has_callback = False + self.conformance = Conformance() + self.is_fabric_scoped = False + + def get_flag(self): + """Get the command flags""" + return self._flag + + def get_conformance_condition(self): + """Get the conformance condition""" + return self.conformance.get_mandatory_condition() + + +class Feature(BaseFeature): + """Feature class that inherits from BaseFeature""" + + def __init__(self, name, id, code, is_mandatory): + super().__init__(name=name, id=id, is_mandatory=is_mandatory) + self.attributes = [] + self.commands = [] + self.events = [] + self.conformance = FeatureConformance() + self.code = code + + def get_attributes(self): + """Get the list of attributes sorted by ID and name""" + return sorted(self.attributes, key=get_id_name_lambda()) + + def get_externally_managed_attributes(self): + """Get the list of attributes that are externally managed""" + return [attr for attr in self.attributes if not attr.is_internally_managed] + + def get_commands(self): + """Get the list of commands sorted by ID and name""" + return sorted(self.commands, key=get_id_name_lambda()) + + def get_events(self) -> List[BaseEvent]: + """Get the list of events sorted by ID and name""" + return sorted(self.events, key=get_id_name_lambda()) + + def get_conformance_condition(self): + """Get the conformance condition""" + return self.conformance.get_optional_condition() + + +class Event(BaseEvent): + """Event class that inherits from BaseEvent""" + + def __init__(self, name, id, is_mandatory): + super().__init__(name=name, id=id, is_mandatory=is_mandatory) + self.priority = "Info" # Default priority + self.conformance = Conformance() + + def get_conformance_condition(self): + """Get the conformance condition""" + return self.conformance.get_mandatory_condition() + + +class Device(BaseDevice): + """Device class that inherits from BaseDevice""" + + def __init__(self, id, name, revision): + super().__init__(id=id, name=name, revision=revision) + self.clusters = [] # List of Cluster objects + + def get_device_type_id(self): + """Return the device type ID""" + return self.id + + def get_device_type_version(self): + """Get the device type version""" + return self.revision + + def get_clusters(self): + """Get all clusters sorted by ID and server/client type""" + return sorted( + self.clusters, + key=lambda x: (convert_to_int(x.get_id()), not x.server_cluster), + ) + + def binding_cluster_available(self) -> bool: + """Check if a binding cluster is available""" + return any(cluster.client_cluster for cluster in self.get_mandatory_clusters()) + + def get_mandatory_clusters(self): + """Get all mandatory clusters""" + return [cluster for cluster in self.clusters if cluster.is_mandatory] + + def get_unique_mandatory_clusters(self): + """Get all unique mandatory clusters""" + return [ + cluster for cluster in self.get_unique_clusters() if cluster.is_mandatory + ] + + def get_unique_clusters(self): + """Get unique clusters (no duplicates) sorted by ID""" + unique_clusters = [] + seen_names = set() + # Add the descriptor and binding clusters to the set of seen names as they are always present + seen_names.add("descriptor") + seen_names.add("binding") + sorted_clusters = self.get_clusters() + for cluster in sorted_clusters: + if cluster.esp_name not in seen_names: + unique_clusters.append(cluster) + seen_names.add(cluster.esp_name) + return unique_clusters diff --git a/tools/data_model_gen/data_model_gen.py b/tools/data_model_gen/data_model_gen.py new file mode 100755 index 000000000..777de6ba5 --- /dev/null +++ b/tools/data_model_gen/data_model_gen.py @@ -0,0 +1,323 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import logging +import os +import sys +import shutil +import click +from dataclasses import dataclass +from typing import Optional + +from chip_source_deps import parser as chip_source_parser +from code_generation.code_generator import generate_cluster_files, generate_device_files +from xml_processing.xml_parser import ( + process_single_files, + process_cluster_files, + process_device_files, +) + +from utils.exceptions import DataModelGenError, ConfigurationError +import utils.config as global_config + +logger = logging.getLogger(__name__) + + +@dataclass +class DataModelGenConfig: + """Configuration required to execute the data model generation pipeline.""" + + esp_matter_path: str + output_dir: str + json_output_dir: str + chip_version: str + cluster_dir: Optional[str] = None + device_dir: Optional[str] = None + cluster_file: Optional[str] = None + device_file: Optional[str] = None + skip_xml_parsing: bool = False + skip_code_generation: bool = False + clean_output: bool = False + + +class DataModelGenerator: + def __init__(self, config: DataModelGenConfig): + self.config = config + self.logger = logging.getLogger(__name__) + self.chip_dir = os.path.join( + self.config.esp_matter_path, "connectedhomeip", "connectedhomeip" + ) + self.yaml_file_path = self.get_yaml_file_path() + + def run(self) -> None: + """Execute the data model generation pipeline.""" + try: + self._prepare_output_directories() + + if not self.config.skip_xml_parsing: + self.logger.info( + "Step 1: Parsing XML files to generate JSON intermediates" + ) + self._generate_intermediate_artifacts() + else: + self.logger.info("Skipping XML parsing as requested") + + if not self.config.skip_code_generation: + self.logger.info("Step 2: Generating code from JSON intermediates") + self._generate_code() + else: + self.logger.info("Skipping code generation as requested") + + self.logger.info( + "Data model generation completed successfully. Output directory: %s", + self.config.output_dir, + ) + except DataModelGenError as e: + self.logger.error("%s", e) + sys.exit(1) + + def _prepare_output_directories(self) -> None: + """Ensure output directories exist and clean generated artifacts if requested.""" + if self.config.clean_output: + self.logger.info( + "Cleaning generated artifacts in %s", self.config.output_dir + ) + for folder in ("clusters", "device_types"): + target = os.path.join(self.config.output_dir, folder) + if os.path.exists(target): + shutil.rmtree(target) + if os.path.exists(self.config.json_output_dir): + shutil.rmtree(self.config.json_output_dir) + os.makedirs(self.config.json_output_dir, exist_ok=True) + os.makedirs(self.config.output_dir, exist_ok=True) + os.makedirs(os.path.join(self.config.output_dir, "clusters"), exist_ok=True) + os.makedirs(os.path.join(self.config.output_dir, "device_types"), exist_ok=True) + + def _generate_intermediate_artifacts(self) -> None: + """Create JSON intermediates from connectedhomeip sdk and XML definitions.""" + self._generate_chip_source_metadata() + + if self.config.cluster_file or self.config.device_file: + process_single_files( + cluster_file=self.config.cluster_file, + device_file=self.config.device_file, + output_dir=self.config.json_output_dir, + yaml_file_path=self.yaml_file_path, + ) + else: + self.logger.debug( + "Processing device XML files from %s", self.config.device_dir + ) + process_device_files( + input_dir=self.config.device_dir, + output_dir=self.config.json_output_dir, + ) + self.logger.debug( + "Processing cluster XML files from %s", self.config.cluster_dir + ) + process_cluster_files( + input_dir=self.config.cluster_dir, + output_dir=self.config.json_output_dir, + yaml_file_path=self.yaml_file_path, + ) + + def _generate_chip_source_metadata(self) -> None: + """Generate the required intermediate JSON files from the connectedhomeip sdk.""" + self.logger.debug("Generating CHIP server metadata artifacts") + chip_source_parser.generate_requirements( + esp_matter_path=self.config.esp_matter_path, + output_dir=self.config.json_output_dir, + ) + + def _generate_code(self) -> None: + """Generate the C++ data model files from the generated JSON artifacts.""" + cluster_json = os.path.join( + self.config.json_output_dir, global_config.FileNames.CLUSTER_JSON.value + ) + device_json = os.path.join( + self.config.json_output_dir, global_config.FileNames.DEVICE_JSON.value + ) + + if os.path.exists(cluster_json): + clusters = generate_cluster_files(cluster_json, self.config.output_dir) + self.logger.debug( + "Successfully generated cluster files for %d clusters", len(clusters) + ) + else: + self.logger.warning( + "Cluster JSON file not found at %s (skipping cluster generation)", + cluster_json, + ) + clusters = [] + + if os.path.exists(device_json): + devices = generate_device_files( + device_json, self.config.output_dir, clusters + ) + self.logger.debug( + "Successfully generated device files for %d devices", len(devices) + ) + else: + self.logger.warning( + "Device JSON file not found at %s (skipping device generation)", + device_json, + ) + devices = [] + + def get_yaml_file_path(self) -> str: + """Get the path to the CHIP YAML configuration file.""" + file_path = os.path.join( + self.chip_dir, "src", "app", "common", "templates", "config-data.yaml" + ) + if not os.path.exists(file_path): + raise ConfigurationError( + "YAML configuration file does not exist", + file_path=file_path, + context="get_yaml_file_path", + suggestion="Ensure connectedhomeip is checked out and config-data.yaml exists under the CHIP path.", + ) + return file_path + + +@click.command() +@click.option( + "--output-dir", + default=None, + help="Directory where generated files will be written (default: generated in esp-matter repository)", +) +@click.option( + "--cluster-file", type=str, help="Path to a specific cluster XML file to process" +) +@click.option( + "--device-file", type=str, help="Path to a specific device XML file to process" +) +@click.option( + "--cluster-dir", + type=str, + help="Path to a directory that contains cluster XML files", +) +@click.option( + "--device-dir", type=str, help="Path to a directory that contains device XML files" +) +@click.option( + "--chip-version", + default=global_config.DEFAULT_CHIP_VERSION, + type=click.Choice(global_config.SPECIFICATION_VERSIONS), + help="Matter specification version used to generate the data model", +) +@click.option("--verbose", is_flag=True, help="Enable verbose logging") +@click.option("--no-colored-logs", is_flag=True, help="Disable colored logs") +@click.option( + "--skip-xml-parsing", + is_flag=True, + help="Skip XML parsing and reuse existing JSON intermediates", +) +@click.option( + "--skip-code-generation", + is_flag=True, + help="Skip code generation and only refresh JSON intermediates", +) +@click.option( + "--clean", is_flag=True, help="Remove previously generated sources before running" +) +@click.option( + "--allow-provisional", + is_flag=True, + default=False, + help="Allow provisional elements", +) +def main( + output_dir: str, + cluster_file: str, + device_file: str, + cluster_dir: str, + device_dir: str, + chip_version: str, + verbose: bool, + no_colored_logs: bool, + skip_xml_parsing: bool, + skip_code_generation: bool, + clean: bool, + allow_provisional: bool, +) -> None: + log_level = logging.DEBUG if verbose else logging.INFO + global_config.setup_logger(log_level, not no_colored_logs) + + try: + esp_dir = os.getenv("ESP_MATTER_PATH") + if not esp_dir: + raise ConfigurationError( + "ESP_MATTER_PATH is not set", + context="main", + suggestion="Set ESP_MATTER_PATH environment variable to the esp-matter repository root.", + ) + + if not output_dir: + output_dir = global_config.get_default_data_model_dir() + + chip_path = os.path.join(esp_dir, "connectedhomeip", "connectedhomeip") + + logger.info("Running with provisional mode: %s", allow_provisional) + + global_config.setup_provisional_mode(allow_provisional) + global_config.set_esp_matter_path(esp_dir) + + if not cluster_dir or not device_dir: + default_xml_input_dir = os.path.join(chip_path, "data_model", chip_version) + if not os.path.exists(default_xml_input_dir): + raise ConfigurationError( + f"Data model directory for version {chip_version} does not exist", + file_path=default_xml_input_dir, + context="main", + suggestion=f"Ensure data_model/{chip_version} exists under the connectedhomeip path.", + ) + cluster_dir = os.path.join(default_xml_input_dir, "clusters") + device_dir = os.path.join(default_xml_input_dir, "device_types") + if not os.path.exists(cluster_dir): + raise ConfigurationError( + "Clusters directory does not exist", + file_path=cluster_dir, + context="main", + suggestion="Provide a valid --cluster-dir or set ESP_MATTER_PATH with connectedhomeip.", + ) + if not os.path.exists(device_dir): + raise ConfigurationError( + "Device types directory does not exist", + file_path=device_dir, + context="main", + suggestion="Provide a valid --device-dir or set ESP_MATTER_PATH with connectedhomeip.", + ) + + data_model_gen_config = DataModelGenConfig( + esp_matter_path=esp_dir, + output_dir=output_dir, + json_output_dir=global_config.DEFAULT_OUTPUT_DIR, + chip_version=chip_version, + cluster_dir=cluster_dir, + device_dir=device_dir, + cluster_file=cluster_file or None, + device_file=device_file or None, + skip_xml_parsing=skip_xml_parsing, + skip_code_generation=skip_code_generation, + clean_output=clean or False, + ) + + generator = DataModelGenerator(data_model_gen_config) + generator.run() + except DataModelGenError as e: + logger.error("%s", e) + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/tools/data_model_gen/requirements.txt b/tools/data_model_gen/requirements.txt new file mode 100644 index 000000000..c280ba220 --- /dev/null +++ b/tools/data_model_gen/requirements.txt @@ -0,0 +1,6 @@ +click==8.1.7 +pyyaml==6.0.2 +jinja2>=3.1.6,<3.2 # 3.1.6 fixes CVE-2024-34064 (xmlattr filter sandbox escape) +colorlog==6.9.0 +tree-sitter==0.21.3 +tree-sitter-languages==1.10.2 diff --git a/tools/data_model_gen/templates/attribute.cpp.jinja b/tools/data_model_gen/templates/attribute.cpp.jinja new file mode 100644 index 000000000..44247c3bb --- /dev/null +++ b/tools/data_model_gen/templates/attribute.cpp.jinja @@ -0,0 +1,33 @@ +{% if cluster.get_attributes() | length > 0 %} +namespace attribute { +{% for attr in cluster.get_attributes() %} +{% if attr.has_special_config() %} +#if {{ attr.get_special_config() }} +{% endif %} +{% set has_bounds = attr.type not in ["list", "string", "octstr"] and attr.get_max_value() is not none and attr.get_min_value() is not none and not attr.is_internally_managed %} +attribute_t *create_{{ attr.func_name }}(cluster_t *cluster{% if attr.type in ["string", "octstr"] %}, {{ "char *" if attr.type == "string" else "uint8_t *" }}value, uint16_t length{% elif attr.type == "list" %}, uint8_t *value, uint16_t length, uint16_t count{% elif attr.is_nullable %}, nullable<{{ attr.get_type() }}> value{% else %}, {{ attr.get_type() }} value{% endif %}) +{ + {% if attr.get_conformance_condition() %} + {% if "feature" in attr.get_conformance_condition()|string %} + uint32_t feature_map = get_feature_map_value(cluster); + {% endif %} + VerifyOrReturnValue({{ attr.get_conformance_condition() }}, NULL); + {% endif %} + {% if attr.type in ["string", "octstr"] and attr.get_default_value() not in [0, "0", 'null', "NULL"] and not attr.is_internally_managed %} + VerifyOrReturnValue(length <= k_max_{{ attr.func_name }}_length + 1, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); + {% endif %} + {% if has_bounds %} + attribute_t *attribute = esp_matter::attribute::create(cluster, {{ attr.chip_name }}::Id, {{ attr.get_flag() }}, {% if attr.type == "string" %}esp_matter_char_str(value, length){% if not attr.is_internally_managed %}, k_max_{{ attr.func_name }}_length + 1{% endif %}{% elif attr.type == "octstr" %}esp_matter_octet_str(value, length){% elif attr.type == "list" %}esp_matter_array(value, length, count){% elif attr.is_nullable %}esp_matter_nullable_{{ attr.type }}(value){% else %}esp_matter_{{ attr.type }}(value){% endif %}); + esp_matter::attribute::add_bounds(attribute, {% if attr.is_nullable %}esp_matter_nullable_{{ attr.type }}({{attr.get_min_value()}}){% else %}esp_matter_{{ attr.type }}({{attr.get_min_value()}}){% endif %}, {% if attr.is_nullable %}esp_matter_nullable_{{ attr.type }}({{attr.get_max_value()}}){% else %}esp_matter_{{ attr.type }}({{attr.get_max_value()}}){% endif %}); + return attribute; + {% else %} + return esp_matter::attribute::create(cluster, {{ attr.chip_name }}::Id, {{ attr.get_flag() }}, {% if attr.type == "string" %}esp_matter_char_str(value, length){% if not attr.is_internally_managed %}, k_max_{{ attr.func_name }}_length + 1{% endif %}{% elif attr.type == "octstr" %}esp_matter_octet_str(value, length){% elif attr.type == "list" %}esp_matter_array(value, length, count){% elif attr.is_nullable %}esp_matter_nullable_{{ attr.type }}(value){% else %}esp_matter_{{ attr.type }}(value){% endif %}); + {% endif %} +} +{% if attr.has_special_config() %} +#endif // {{ attr.get_special_config() }} +{% endif %} + +{% endfor %} +} /* attribute */ +{% endif %} diff --git a/tools/data_model_gen/templates/attribute.h.jinja b/tools/data_model_gen/templates/attribute.h.jinja new file mode 100644 index 000000000..37f6e0e75 --- /dev/null +++ b/tools/data_model_gen/templates/attribute.h.jinja @@ -0,0 +1,24 @@ +{% if cluster.get_attributes() | length > 0 %} +namespace attribute { +{% for attr in cluster.get_attributes() %} +{% if attr.has_special_config() %} +#if {{ attr.get_special_config() }} +{% endif %} + {% if attr.type == 'string' %} +attribute_t *create_{{ attr.func_name }}(cluster_t *cluster, char * value, uint16_t length); + {% elif attr.type == 'octstr' %} +attribute_t *create_{{ attr.func_name }}(cluster_t *cluster, uint8_t * value, uint16_t length); + {% elif attr.type == 'list' %} +attribute_t *create_{{ attr.func_name }}(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); + {% elif attr.is_nullable %} +attribute_t *create_{{ attr.func_name }}(cluster_t *cluster, nullable<{{ attr.get_type() }}> value); + {% else %} +attribute_t *create_{{ attr.func_name }}(cluster_t *cluster, {{ attr.get_type() }} value); + {% endif %} +{% if attr.has_special_config() %} +#endif // {{ attr.get_special_config() }} +{% endif %} +{% endfor %} +} /* attribute */ + +{% endif %} \ No newline at end of file diff --git a/tools/data_model_gen/templates/cluster.cpp.jinja b/tools/data_model_gen/templates/cluster.cpp.jinja new file mode 100644 index 000000000..72fcefbfa --- /dev/null +++ b/tools/data_model_gen/templates/cluster.cpp.jinja @@ -0,0 +1,173 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#include +#include +#include + +#include +#include +#include +#include +{% if "mode" in cluster.esp_name %} +#include +{% endif %} +{% if cluster.delegate_init_callback_available %} +#include +{% endif %} +#include <{{ cluster.esp_name }}.h> +#include <{{ cluster.esp_name }}_ids.h> +#include +#include +{% if cluster.is_migrated_cluster %} +#include +{% endif %} + +{# Switch cluster Exceptions #} +{% if cluster.esp_name == "switch_cluster" %} +#include + +using chip::EndpointId; +{% endif %} +using namespace chip::app::Clusters; +using chip::app::CommandHandler; +using chip::app::DataModel::Decode; +using chip::TLV::TLVReader; +using namespace esp_matter; +using namespace esp_matter::cluster; +{% if cluster.delegate_init_callback_available %} +using namespace esp_matter::cluster::delegate_cb; +{% endif %} + +static const char *TAG = "{{ cluster.esp_name }}_cluster"; +constexpr uint16_t cluster_revision = {{ cluster.get_revision() }}; +{% include "command_callback.cpp.jinja" | indent(4) %} + +namespace esp_matter { +namespace cluster { +namespace {{ cluster.esp_name }} { + +{% include "feature.cpp.jinja" | indent(4) %} +{% include "attribute.cpp.jinja" | indent(4) %} +{% include "command.cpp.jinja" | indent(4) %} +{% include "event.cpp.jinja" | indent(4) %} + +{% if cluster.role == "application" and not cluster.is_derived_cluster and cluster.id != "0xffff" %} +static void create_default_binding_cluster(endpoint_t *endpoint) +{ + binding::config_t config; + binding::create(endpoint, &config, CLUSTER_FLAG_SERVER); +} + +{% endif %} +{% if cluster.id != "0xffff" %} +{% if cluster.callback_functions | length > 0 %} +const function_generic_t function_list[] = { + {% for function in cluster.callback_functions %} + (function_generic_t){{ function }}, + {% endfor %} +}; +{% else %} +const function_generic_t *function_list = NULL; +{% endif %} + +const int function_flags = {{ cluster.function_flags }}; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, {{ cluster.esp_name }}::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, {{ cluster.esp_name }}::Id)); + {% if cluster.has_special_config() %} + #if {{ cluster.get_special_config() }} + {% endif %} + if (flags & CLUSTER_FLAG_SERVER) { + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + {% if cluster.delegate_init_callback %} + if (config->delegate != nullptr) { + static const auto delegate_init_cb = {{ cluster.delegate_init_callback }}; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + {% endif %} + {% if cluster.plugin_server_init_callback != None %} + static const auto plugin_server_init_cb = CALL_ONCE({{ cluster.plugin_server_init_callback }}); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + {% endif %} + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, {% if cluster.has_choice_features() and cluster.get_features() | length > 0 %}config->feature_flags{% else %}0{% endif %}); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + {% set attrs = cluster.get_mandatory_attributes() %} + {% if attrs | length > 0 %} + {% filter indent(8, true) %} + {% include "common.attribute.cpp.jinja" %} + {% endfilter %} + {% endif %} + {% if cluster.has_choice_features() and cluster.get_features() | length > 0 %} + + {% filter indent(8, true) %} + {% include "common.feature.cpp.jinja" %} + {% endfilter %} + {% endif %} + {% if cluster.get_mandatory_commands() | length > 0 %} + {% for command in cluster.get_mandatory_commands() %} +{% if command.has_special_config() %} +#if {{ command.get_special_config() }} +{% endif %} + command::create_{{ command.func_name | lower }}(cluster); +{% if command.has_special_config() %} +#endif // {{ command.get_special_config() }} +{% endif %} + {% endfor %} + {% endif %} + {% if cluster.get_mandatory_events() | length > 0 %} + /* Events */ + {% for event in cluster.get_mandatory_events() %} +{% if event.has_special_config() %} +#if {{ event.get_special_config() }} +{% endif %} + event::create_{{ event.func_name | lower }}(cluster); +{% if event.has_special_config() %} +#endif // {{ event.get_special_config() }} +{% endif %} + {% endfor %} + {% endif %} + {% if cluster.is_migrated_cluster %} + + cluster::set_init_and_shutdown_callbacks(cluster, {{ cluster.get_cluster_init_callback() }}, + {{ cluster.get_cluster_shutdown_callback() }}); + {% endif %} + } +{% if cluster.has_special_config() %} +#endif // {{ cluster.get_special_config() }} +{% endif %} + + {% if cluster.role == "application" and not cluster.is_derived_cluster and not cluster.name == "Binding" %} + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + {% endif %} + return cluster; +} + +{% endif %} +} /* {{ cluster.esp_name }} */ +} /* cluster */ +} /* esp_matter */ + diff --git a/tools/data_model_gen/templates/cluster.h.jinja b/tools/data_model_gen/templates/cluster.h.jinja new file mode 100644 index 000000000..d809fdd1d --- /dev/null +++ b/tools/data_model_gen/templates/cluster.h.jinja @@ -0,0 +1,91 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace {{ cluster.esp_name }} { + +{% for attribute in cluster.get_attributes() %} +{% if not attribute.is_internally_managed %} +{% if attribute.type == "string" or attribute.type == "octstr" %} +const {{ attribute.get_default_value_type() }} k_max_{{ attribute.func_name }}_length = {{ attribute.get_max_value() }}u; +{% endif %} +{% endif %} +{% endfor %} +{% include "feature.h.jinja" | indent(4) %} +{% include "attribute.h.jinja" | indent(4) %} +{% include "command.h.jinja" | indent(4) %} +{% include "event.h.jinja" | indent(4) %} +{% set init_list = [] %} +{% set feature_list = cluster.get_features() if cluster.has_choice_features() else [] %} +{% set config_features = [] %} +{% for feature in feature_list %} + {% if feature.get_externally_managed_attributes() | length > 0 %} + {% do config_features.append(feature) %} + {% endif %} +{% endfor %} +{% if cluster.id != "0xffff" %} +typedef struct config { + {% for attribute in cluster.get_mandatory_attributes() %} + {% if not attribute.is_internally_managed %} + {% if attribute.type == "string" %} + {% set _ = init_list.append(attribute.func_name ~ "{" ~ 0 ~ "}") %} + char {{ attribute.func_name }}[k_max_{{ attribute.func_name }}_length + 1]; + {% elif attribute.type == "octstr" %} + {% set _ = init_list.append(attribute.func_name ~ "{" ~ 0 ~ "}") %} + uint8_t {{ attribute.func_name }}[k_max_{{ attribute.func_name }}_length]; + {% elif attribute.type == "list" %} + {% elif attribute.is_nullable %} + {% set _ = init_list.append(attribute.func_name ~ "(" ~ attribute.get_default_value() ~ ")") %} + nullable<{{ attribute.get_type() }}> {{ attribute.func_name }}; + {% else %} + {% set _ = init_list.append(attribute.func_name ~ "(" ~ attribute.get_default_value() ~ ")") %} + {{ attribute.get_type() }} {{ attribute.func_name }}; + {% endif %} + {% endif %} + {% endfor %} + {% if cluster.delegate_init_callback and cluster.id != "0xffff" %} + void *delegate; + {% endif %} + {% if feature_list %} + {% if config_features %} + struct { + {% for feature in config_features %} + feature::{{ feature.func_name | lower }}::config_t {{ feature.func_name | lower }}; + {% endfor %} + } features; + {% endif %} + uint32_t feature_flags; + {% endif %} + {% if cluster.delegate_init_callback and cluster.id != "0xffff" %} + {% set _ = init_list.append("delegate(nullptr)") %} + {% endif %} + {% if cluster.has_choice_features() and cluster.get_features() | length > 0 %} + {% set _ = init_list.append("feature_flags(0)") %} + {% endif %} + config(){% if init_list %} : {{ init_list | join(", ") }}{% endif %} {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +{% endif %} + +} /* {{ cluster.esp_name }} */ +} /* cluster */ +} /* esp_matter */ + diff --git a/tools/data_model_gen/templates/cluster_ids.h.jinja b/tools/data_model_gen/templates/cluster_ids.h.jinja new file mode 100644 index 000000000..2d6c0a6a6 --- /dev/null +++ b/tools/data_model_gen/templates/cluster_ids.h.jinja @@ -0,0 +1,71 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* THIS IS A GENERATED FILE, DO NOT EDIT */ + +#pragma once +#include + +namespace esp_matter { +namespace cluster { +namespace {{ cluster.esp_name }} { + +inline constexpr uint32_t Id = {{ cluster.get_id() }}; +{% set features = cluster.get_features() %} +{% if features | length > 0 %} + +namespace feature { +{# ---------- Feature IDs ---------- #} +{% for feature in features %} +namespace {{ feature.chip_name }} { +inline constexpr uint32_t Id = {{ feature.get_id() }}; +} /* {{ feature.chip_name }} */ +{% endfor %} +} /* feature */ +{% endif %} +{% if cluster.get_attributes() | length > 0 %} + +namespace attribute { +{% for attr in cluster.get_attributes() %} +namespace {{ attr.chip_name }} { +inline constexpr uint32_t Id = {{ attr.get_id()}}; +} /* {{ attr.name }} */ +{% endfor %} +} /* attribute */ +{% endif %} +{% if cluster.get_commands() | length > 0 %} + +namespace command { +{% for command in cluster.get_commands() %} +namespace {{ command.chip_name }} { +inline constexpr uint32_t Id = {{ command.get_id()}}; +} /* {{ command.chip_name }} */ +{% endfor %} +} /* command */ +{% endif %} +{% if cluster.get_events() | length > 0 %} + +namespace event { +{% for event in cluster.get_events() %} +namespace {{ event.chip_name }} { +inline constexpr uint32_t Id = {{ event.get_id()}}; +} /* {{ event.chip_name }} */ +{% endfor %} +} /* event */ +{% endif %} + +} /* {{ cluster.esp_name }} */ +} /* cluster */ +} /* esp_matter */ + diff --git a/tools/data_model_gen/templates/command.cpp.jinja b/tools/data_model_gen/templates/command.cpp.jinja new file mode 100644 index 000000000..166068490 --- /dev/null +++ b/tools/data_model_gen/templates/command.cpp.jinja @@ -0,0 +1,23 @@ +{% if cluster.get_commands() | length > 0 %} +namespace command { +{% for command in cluster.get_commands() %} +{% if command.has_special_config() %} +#if {{ command.get_special_config() }} +{% endif %} +command_t *create_{{ command.func_name | lower }}(cluster_t *cluster) +{ + {% if command.get_conformance_condition() %} + {% if "feature" in command.get_conformance_condition()|string %} + uint32_t feature_map = get_feature_map_value(cluster); + {% endif %} + VerifyOrReturnValue({{ command.get_conformance_condition() }}, NULL); + {% endif %} + return esp_matter::command::create(cluster, {{ command.chip_name }}::Id, {{ command.get_flag() }}, {% if command.has_callback %}esp_matter_command_callback_{{ command.func_name | lower }}{% else %}NULL{% endif %}); +} +{% if command.has_special_config() %} +#endif // {{ command.get_special_config() }} +{% endif %} + +{% endfor %} +} /* command */ +{% endif %} diff --git a/tools/data_model_gen/templates/command.h.jinja b/tools/data_model_gen/templates/command.h.jinja new file mode 100644 index 000000000..d8b7988b8 --- /dev/null +++ b/tools/data_model_gen/templates/command.h.jinja @@ -0,0 +1,14 @@ +{% if cluster.get_commands() | length > 0 %} +namespace command { + {% for command in cluster.get_commands() %} +{% if command.has_special_config() %} +#if {{ command.get_special_config() }} +{% endif %} +command_t *create_{{ command.func_name | lower }}(cluster_t *cluster); +{% if command.has_special_config() %} +#endif // {{ command.get_special_config() }} +{% endif %} + {% endfor %} +} /* command */ + +{% endif %} \ No newline at end of file diff --git a/tools/data_model_gen/templates/command_callback.cpp.jinja b/tools/data_model_gen/templates/command_callback.cpp.jinja new file mode 100644 index 000000000..1b9768f87 --- /dev/null +++ b/tools/data_model_gen/templates/command_callback.cpp.jinja @@ -0,0 +1,22 @@ +{% for command in cluster.get_commands() %} +{% if command.has_callback %} + +static esp_err_t esp_matter_command_callback_{{ command.func_name | lower }}(const ConcreteCommandPath &command_path, TLVReader &tlv_data, + void *opaque_ptr) +{ + chip::app::Clusters::{{ cluster.chip_name }}::Commands::{{ command.name }}::DecodableType command_data; + {% if command.is_fabric_scoped %} + chip::app::CommandHandler *command_obj = (chip::app::CommandHandler *)opaque_ptr; + CHIP_ERROR error = command_data.Decode(tlv_data, command_obj->GetAccessingFabricIndex()); + {% else %} + CHIP_ERROR error = Decode(tlv_data, command_data); + {% endif %} + if (error == CHIP_NO_ERROR) { + {% if command.direction == 'commandToServer' %} + emberAf{{ cluster.chip_name }}Cluster{{ command.name }}Callback((CommandHandler *)opaque_ptr, command_path, command_data); + {% endif %} + } + return ESP_OK; +} +{% endif %} +{% endfor %} diff --git a/tools/data_model_gen/templates/common.attribute.cpp.jinja b/tools/data_model_gen/templates/common.attribute.cpp.jinja new file mode 100644 index 000000000..9f01c5484 --- /dev/null +++ b/tools/data_model_gen/templates/common.attribute.cpp.jinja @@ -0,0 +1,53 @@ +{# --- Partition attributes into config-based vs default-based --- #} +{% set config_attrs = [] %} +{% set default_attrs = [] %} +{% for a in attrs %} + {% set is_config_attr = ( + not a.is_internally_managed + and not (a.type in ["string", "octstr"] and a.get_default_value() in ["null","NULL"]) + and not (a.type == "list") + ) %} + {% if is_config_attr %} + {% do config_attrs.append(a) %} + {% else %} + {% do default_attrs.append(a) %} + {% endif %} +{% endfor %} +{# --- Config-dependent attributes --- #} +{% if config_attrs | length > 0 %} +{% for a in config_attrs %} +{% if a.has_special_config() %} +#if {{ a.get_special_config() }} +{% endif %} + {% if a.type in ["string", "octstr"] %} +attribute::create_{{ a.func_name }}(cluster, config->{{ a.func_name }}, sizeof(config->{{ a.func_name }})); + {% else %} +attribute::create_{{ a.func_name }}(cluster, config->{{ a.func_name }}); + {% endif %} +{% if a.has_special_config() %} +#endif // {{ a.get_special_config() }} +{% endif %} +{% endfor %} +{% endif %} +{# --- Default attributes (no config) --- #} +{% for a in default_attrs %} +{% if a.has_special_config() %} +#if {{ a.get_special_config() }} +{% endif %} + {% if a.type == "list" %} +attribute::create_{{ a.func_name }}(cluster, NULL, 0, 0); + {% elif a.type in ["string", "octstr"] %} + {% if a.get_default_value() not in ["null","NULL"] %} + {% if a.is_internally_managed %} +attribute::create_{{ a.func_name }}(cluster, NULL, 0); + {% else %} +attribute::create_{{ a.func_name }}(cluster, "{{ a.get_default_value() }}", sizeof("{{ a.get_default_value() }}")); + {% endif %} + {% endif %} + {% else %} +attribute::create_{{ a.func_name }}(cluster, {{ a.get_default_value() }}); + {% endif %} +{% if a.has_special_config() %} +#endif // {{ a.get_special_config() }} +{% endif %} +{% endfor %} diff --git a/tools/data_model_gen/templates/common.feature.cpp.jinja b/tools/data_model_gen/templates/common.feature.cpp.jinja new file mode 100644 index 000000000..b37e9ae4b --- /dev/null +++ b/tools/data_model_gen/templates/common.feature.cpp.jinja @@ -0,0 +1,107 @@ +uint32_t feature_map = config->feature_flags; +{# Otherwise choice groups: if parent present add parent + all dependents; else validate choice and add only selected dependents #} +{% for group in cluster.get_otherwise_choice_groups() %} +if (feature_map & feature::{{ group.parent_feature.func_name | lower }}::get_id()) { + {% if group.parent_feature.get_externally_managed_attributes() | length > 0 %} + VerifyOrReturnValue(feature::{{ group.parent_feature.func_name | lower }}::add(cluster, &(config->features.{{ group.parent_feature.func_name | lower }})) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + {% else %} + VerifyOrReturnValue(feature::{{ group.parent_feature.func_name | lower }}::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + {% endif %} + {% for dep in group.dependent_features %} + {% if dep.get_externally_managed_attributes() | length > 0 %} + VerifyOrReturnValue(feature::{{ dep.func_name | lower }}::add(cluster, &(config->features.{{ dep.func_name | lower }})) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + {% else %} + VerifyOrReturnValue(feature::{{ dep.func_name | lower }}::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + {% endif %} + {% endfor %} +} else { + {% if group.dependent_features | length > 0 %} + {% if group.constraint == 'exact_one' %} + VALIDATE_FEATURES_EXACT_ONE("{{ group.dependent_features | map(attribute='name') | join(',') }}", + {{ group.dependent_features | map(attribute='func_name') | map('lower') | map('replace', ' ', '_') | map('format_filter', 'feature::{}::get_id()') | join(', ') }}); + {% elif group.constraint == 'at_least_one' %} + VALIDATE_FEATURES_AT_LEAST_ONE("{{ group.dependent_features | map(attribute='name') | join(',') }}", + {{ group.dependent_features | map(attribute='func_name') | map('lower') | map('replace', ' ', '_') | map('format_filter', 'feature::{}::get_id()') | join(', ') }}); + {% endif %} + {% endif %} + {% for dep in group.dependent_features %} + {% if dep.conformance.get_mandatory_condition() %} + if ((feature_map & feature::{{ dep.func_name | lower }}::get_id()) && {{ dep.conformance.get_mandatory_condition() }}) { + {% else %} + if (feature_map & feature::{{ dep.func_name | lower }}::get_id()) { + {% endif %} + {% if dep.get_externally_managed_attributes() | length > 0 %} + VerifyOrReturnValue(feature::{{ dep.func_name | lower }}::add(cluster, &(config->features.{{ dep.func_name | lower }})) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + {% else %} + VerifyOrReturnValue(feature::{{ dep.func_name | lower }}::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + {% endif %} + } + {% endfor %} +} +{% endfor %} +{# Standalone choice groups depends on the optional condition #} +{% for group in cluster.get_optional_choice_groups() %} +if (feature_map & feature::{{ group.parent_feature.func_name | lower }}::get_id()) { + {% if group.constraint == 'exact_one' %} + VALIDATE_FEATURES_EXACT_ONE("{{ group.dependent_features | map(attribute='name') | join(',') }}", + {{ group.dependent_features | map(attribute='func_name') | map('lower') | map('replace', ' ', '_') | map('format_filter', 'feature::{}::get_id()') | join(', ') }}); + {% elif group.constraint == 'at_least_one' %} + VALIDATE_FEATURES_AT_LEAST_ONE("{{ group.dependent_features | map(attribute='name') | join(',') }}", + {{ group.dependent_features | map(attribute='func_name') | map('lower') | map('replace', ' ', '_') | map('format_filter', 'feature::{}::get_id()') | join(', ') }}); + {% endif %} + {% for dep in group.dependent_features %} + {% if dep.get_externally_managed_attributes() | length > 0 %} + if (feature_map & feature::{{ dep.func_name | lower }}::get_id()) { + VerifyOrReturnValue(feature::{{ dep.func_name | lower }}::add(cluster, &(config->features.{{ dep.func_name | lower }})) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + {% else %} + if (feature_map & feature::{{ dep.func_name | lower }}::get_id()) { + VerifyOrReturnValue(feature::{{ dep.func_name | lower }}::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + {% endif %} + {% endfor %} +} +{% endfor %} +{# Standalone choice groups: no mandatory parent #} +{% for constraint_type, features in cluster.get_standalone_choice_groups() %} +{% if features | length > 0 %} +{% set optional_condition = features[0].conformance.get_optional_condition() %} +{% set indent = ' ' if optional_condition else '' %} +{% if optional_condition %} +if ({{ optional_condition }}) { +{% endif %} +{% if constraint_type == 'exact_one' %} +{{ indent }}VALIDATE_FEATURES_EXACT_ONE("{{ features | map(attribute='name') | join(',') }}", + {{ features | map(attribute='func_name') | map('lower') | map('replace', ' ', '_') | map('format_filter', 'feature::{}::get_id()') | join(', ') }}); +{% elif constraint_type == 'at_least_one' %} +{{ indent }}VALIDATE_FEATURES_AT_LEAST_ONE("{{ features | map(attribute='name') | join(',') }}", + {{ features | map(attribute='func_name') | map('lower') | map('replace', ' ', '_') | map('format_filter', 'feature::{}::get_id()') | join(', ') }}); +{% endif %} +{% for feature in features %} +{{ indent }}if (feature_map & feature::{{ feature.func_name | lower }}::get_id()) { + {% if feature.get_externally_managed_attributes() | length > 0 %} + {{ indent }}VerifyOrReturnValue(feature::{{ feature.func_name | lower }}::add(cluster, &(config->features.{{ feature.func_name | lower }})) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + {% else %} + {{ indent }}VerifyOrReturnValue(feature::{{ feature.func_name | lower }}::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + {% endif %} +{{ indent }}} +{% endfor %} +{% endif %} +{% if optional_condition %} +} +{% endif %} +{% endfor %} +{# Independent features: add when selected (and condition if any) #} +{% for feature in cluster.get_independent_features() %} +{% if feature.conformance.get_mandatory_condition() %} +if ((feature_map & feature::{{ feature.func_name | lower }}::get_id()) && {{ feature.conformance.get_mandatory_condition() }}) { +{% else %} +if (feature_map & feature::{{ feature.func_name | lower }}::get_id()) { +{% endif %} + {% if feature.get_externally_managed_attributes() | length > 0 %} + VerifyOrReturnValue(feature::{{ feature.func_name | lower }}::add(cluster, &(config->features.{{ feature.func_name | lower }})) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + {% else %} + VerifyOrReturnValue(feature::{{ feature.func_name | lower }}::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + {% endif %} +} +{% endfor %} diff --git a/tools/data_model_gen/templates/device.cpp.jinja b/tools/data_model_gen/templates/device.cpp.jinja new file mode 100644 index 000000000..1f245a6bd --- /dev/null +++ b/tools/data_model_gen/templates/device.cpp.jinja @@ -0,0 +1,183 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#include +#include +#include +#include <{{ device.filename }}.h> + +using namespace esp_matter; +using namespace esp_matter::cluster; +using namespace esp_matter::endpoint; + +namespace esp_matter { +namespace endpoint { +namespace {{ device.esp_name }} { +uint32_t get_device_type_id() +{ + return ESP_MATTER_{{ device.esp_name | upper }}_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_{{ device.esp_name | upper }}_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = esp_matter::endpoint::create(node, flags, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("{{ device.esp_name }}", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("{{ device.esp_name }}", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(add(endpoint, config) == ESP_OK, NULL, ESP_LOGE("{{ device.esp_name }}", "Failed to add device type")); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + + {% for cluster in device.get_clusters() %} + {% if cluster.is_mandatory %} +{% if cluster.esp_name == "network_commissioning"%} +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG +{% endif %} +{% if cluster.has_special_config() %} +#if {{ cluster.get_special_config() }} +{% endif %} + {% if cluster.esp_name == "network_commissioning" %} +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI + config->network_commissioning.feature_flags |= cluster::network_commissioning::feature::wi_fi_network_interface::get_id(); +#elif CHIP_DEVICE_CONFIG_ENABLE_THREAD + config->network_commissioning.feature_flags |= cluster::network_commissioning::feature::thread_network_interface::get_id(); +#else + config->network_commissioning.feature_flags |= cluster::network_commissioning::feature::ethernet_network_interface::get_id(); +#endif + {% endif %} + {% if cluster.server_cluster %} +{% if cluster.device_mandatory_features and cluster.has_choice_features %} +{% if cluster.has_choice_features %} +config->{{ cluster.func_name }}.feature_flags |= {% for mandatory_feature in cluster.device_mandatory_features %} +cluster::{{ cluster.func_name }}::feature::{{ mandatory_feature.func_name }}::get_id(){% if not loop.last %} | {% endif %} +{% endfor %}; +{% endif %} +{% endif %} + {% set has_mandatory_items = cluster.device_mandatory_attribute or cluster.device_mandatory_commands or cluster.device_mandatory_events or (cluster.device_mandatory_features and not cluster.has_choice_features) %} + {% if has_mandatory_items %} + cluster_t *{{ cluster.esp_name }} = cluster::{{ cluster.esp_name }}::create(endpoint, &(config->{{ cluster.esp_name }}), {{ cluster.function_flags }}); + VerifyOrReturnValue({{ cluster.esp_name }} != NULL, ESP_FAIL, ESP_LOGE("{{ device.esp_name }}", "Failed to create cluster: {{ cluster.esp_name }}")); + {% for attr in cluster.device_mandatory_attributes %} +{% if attr.has_special_config() %} +#if {{ attr.get_special_config() }} +{% endif %} + {% if not attr.is_internally_managed %} + {% if attr.type in ["string", "octstr"] %} + cluster::{{ cluster.esp_name }}::attribute::create_{{ attr.func_name }}({{ cluster.esp_name }}, config->{{ attr.func_name }}, sizeof(config->{{ attr.func_name }})); + {% else %} + cluster::{{ cluster.esp_name }}::attribute::create_{{ attr.func_name }}({{ cluster.esp_name }}, config->{{ attr.func_name }}); + {% endif %} + {% else %} + {% if attr.type in ["string", "octstr"] %} + cluster::{{ cluster.esp_name }}::attribute::create_{{ attr.func_name }}({{ cluster.esp_name }}, NULL, 0); + {% elif attr.type == "list" %} + cluster::{{ cluster.esp_name }}::attribute::create_{{ attr.func_name }}({{ cluster.esp_name }}, NULL, NULL, 0); + {% else %} + cluster::{{ cluster.esp_name }}::attribute::create_{{ attr.func_name }}({{ cluster.esp_name }}, {{ attr.get_default_value() }}); + {% endif %} + {% endif %} +{% if attr.has_special_config() %} +#endif // {{ attr.get_special_config() }} +{% endif %} + {% endfor %} + {% if cluster.device_mandatory_features | length > 0 %} + {% for mandatory_feature in cluster.device_mandatory_features %} +{% if mandatory_feature.has_special_config() %} +#if {{ mandatory_feature.get_special_config() }} +{% endif %} + {% if mandatory_feature.get_externally_managed_attributes() | length > 0 %} + cluster::{{ cluster.esp_name }}::feature::{{ mandatory_feature.func_name }}::add({{cluster.esp_name}}, &(config->{{ cluster.esp_name}}_{{ mandatory_feature.func_name }})); + {% else %} + cluster::{{ cluster.esp_name }}::feature::{{ mandatory_feature.func_name }}::add({{cluster.esp_name}}); + {% endif %} +{% if mandatory_feature.has_special_config() %} +#endif // {{ mandatory_feature.get_special_config() }} +{% endif %} + {% endfor %} + {% endif %} + {% if cluster.device_mandatory_commands | length > 0 %} + {% for mandatory_command in cluster.device_mandatory_commands %} +{% if mandatory_command.has_special_config() %} +#if {{ mandatory_command.get_special_config() }} +{% endif %} + cluster::{{ cluster.esp_name }}::command::create_{{ mandatory_command.func_name | lower }}({{cluster.esp_name}}); +{% if mandatory_command.has_special_config() %} +#endif // {{ mandatory_command.get_special_config() }} +{% endif %} + {% endfor %} + {% endif %} + {% if cluster.device_mandatory_events | length > 0 %} + {% for mandatory_event in cluster.device_mandatory_events %} +{% if mandatory_event.has_special_config() %} +#if {{ mandatory_event.get_special_config() }} +{% endif %} + cluster::{{ cluster.esp_name }}::event::create_{{ mandatory_event.func_name | lower }}({{cluster.esp_name}}); +{% if mandatory_event.has_special_config() %} +#endif // {{ mandatory_event.get_special_config() }} +{% endif %} + {% endfor %} + {% endif %} + {% else %} + cluster::{{ cluster.esp_name }}::create(endpoint, &(config->{{ cluster.esp_name }}), {{ cluster.function_flags }}); + {% endif %} + {% else %} + cluster::{{ cluster.esp_name }}::create(endpoint, NULL, {{ cluster.function_flags }}); + {% endif %} +{% if cluster.esp_name == "network_commissioning" %} +#endif // CONFIG_CUSTOM_NETWORK_CONFIG +{% endif %} +{% if cluster.has_special_config() %} +#endif // {{ cluster.get_special_config() }} +{% endif %} + {% endif %} + {% endfor %} +{% if device.binding_cluster_available() %} + binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); + +{% endif %} + return ESP_OK; +} + +{% if device.esp_name == "bridged_node"%} +endpoint_t *resume(node_t *node, config_t *config, uint8_t flags, uint16_t endpoint_id, void *priv_data) +{ + esp_matter::endpoint_t *endpoint = esp_matter::endpoint::resume(node, flags | ENDPOINT_FLAG_DESTROYABLE, endpoint_id, priv_data); + VerifyOrReturnValue(endpoint != nullptr, NULL, ESP_LOGE("{{ device.esp_name }}", "Failed to create endpoint")); + + cluster_t *descriptor_cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + VerifyOrReturnValue(descriptor_cluster != nullptr, NULL, ESP_LOGE("{{ device.esp_name }}", "Failed to create descriptor cluster")); + + VerifyOrReturnValue(ESP_OK == add(endpoint, config), NULL, ESP_LOGE("{{ device.esp_name }}", "Failed to add cluster")); + return endpoint; +} + +{% endif %} +} /* {{ device.esp_name }} */ +} /* endpoint */ +} /* esp_matter */ + diff --git a/tools/data_model_gen/templates/device.h.jinja b/tools/data_model_gen/templates/device.h.jinja new file mode 100644 index 000000000..1e57ec135 --- /dev/null +++ b/tools/data_model_gen/templates/device.h.jinja @@ -0,0 +1,86 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This is a Generated File */ + +#pragma once +#include + +#include +{% if device.binding_cluster_available() %} +#include +{% endif %} +{% for cluster in device.get_unique_mandatory_clusters() %} +#include <{{ cluster.esp_name }}.h> +{% endfor %} + +#include + +#define ESP_MATTER_{{ device.esp_name | upper }}_DEVICE_TYPE_ID {{ device.id }} +#define ESP_MATTER_{{ device.esp_name | upper }}_DEVICE_TYPE_VERSION {{device.revision }} + +namespace esp_matter { +namespace endpoint { +namespace {{ device.esp_name }} { + +{% set init_list = [] %} + +typedef struct config { + cluster::descriptor::config_t descriptor; + {% if device.binding_cluster_available() %} + cluster::binding::config_t binding; + {% endif %} + {% for cluster in device.get_unique_mandatory_clusters() %} + {% if cluster.server_cluster %} + cluster::{{ cluster.esp_name }}::config_t {{ cluster.esp_name }}; + {% for attribute in cluster.device_mandatory_attributes %} + {% if not attribute.is_complex and not attribute.is_internally_managed %} + {% set _ = init_list.append(attribute.func_name ~ "(" ~ attribute.get_default_value() ~ ")") %} + {% endif %} + {% if not attribute.is_internally_managed %} + {% if attribute.type == "string" %} + char {{ attribute.func_name }}[k_max_{{ attribute.func_name }}_length + 1]; + {% elif attribute.type == "octstr" %} + uint8_t {{ attribute.func_name }}[k_max_{{ attribute.func_name }}_length]; + {% elif attribute.type == "list" %} + {% elif attribute.is_nullable %} + nullable<{{ attribute.get_type() }}> {{ attribute.func_name }}; + {% else %} + {{ attribute.get_type() }} {{ attribute.func_name }}; + {% endif %} + {% endif %} + {% endfor %} + {% for mandatory_feature in cluster.device_mandatory_features %} + {% if mandatory_feature.get_externally_managed_attributes() | length > 0 %} + cluster::{{ cluster.esp_name }}::feature::{{ mandatory_feature.func_name }}::config_t {{cluster.esp_name}}_{{ mandatory_feature.func_name }}; + {% endif %} + {% endfor %} + {% endif %} + {% endfor %} + {% if init_list %} + config() : {{ init_list | join(", ") }} {} + {% endif %} +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +{% if device.esp_name == "bridged_node"%} +endpoint_t *resume(node_t *node, config_t *config, uint8_t flags, uint16_t endpoint_id, void *priv_data); +{% endif %} +} /* {{ device.esp_name }} */ +} /* endpoint */ +} /* esp_matter */ + diff --git a/tools/data_model_gen/templates/event.cpp.jinja b/tools/data_model_gen/templates/event.cpp.jinja new file mode 100644 index 000000000..ec0041387 --- /dev/null +++ b/tools/data_model_gen/templates/event.cpp.jinja @@ -0,0 +1,62 @@ +{% if cluster.get_events() | length > 0 %} + +namespace event { +{% for event in cluster.get_events() %} +event_t *create_{{ event.func_name | lower }}(cluster_t *cluster) +{ + {% if event.get_conformance_condition() %} + {% if "feature" in event.get_conformance_condition()|string %} + uint32_t feature_map = get_feature_map_value(cluster); + {% endif %} + VerifyOrReturnValue({{ event.get_conformance_condition() }}, NULL); + {% endif %} + return esp_matter::event::create(cluster, {{ event.chip_name }}::Id); +} + +{% endfor %} +{# Exceptions for switch cluster #} +{% if cluster.esp_name == "switch_cluster" %} +esp_err_t send_switch_latched(EndpointId endpoint, uint8_t new_position) +{ + SwitchServer::Instance().OnSwitchLatch(endpoint, new_position); + return ESP_OK; +} + +esp_err_t send_initial_press(EndpointId endpoint, uint8_t new_position) +{ + SwitchServer::Instance().OnInitialPress(endpoint, new_position); + return ESP_OK; +} + +esp_err_t send_long_press(EndpointId endpoint, uint8_t new_position) +{ + SwitchServer::Instance().OnLongPress(endpoint, new_position); + return ESP_OK; +} + +esp_err_t send_short_release(EndpointId endpoint, uint8_t previous_position) +{ + SwitchServer::Instance().OnShortRelease(endpoint, previous_position); + return ESP_OK; +} + +esp_err_t send_long_release(EndpointId endpoint, uint8_t previous_position) +{ + SwitchServer::Instance().OnLongRelease(endpoint, previous_position); + return ESP_OK; +} + +esp_err_t send_multi_press_ongoing(EndpointId endpoint, uint8_t new_position, uint8_t count) +{ + SwitchServer::Instance().OnMultiPressOngoing(endpoint, new_position, count); + return ESP_OK; +} + +esp_err_t send_multi_press_complete(EndpointId endpoint, uint8_t new_position, uint8_t count) +{ + SwitchServer::Instance().OnMultiPressComplete(endpoint, new_position, count); + return ESP_OK; +} +{% endif %} +} /* event */ +{% endif %} diff --git a/tools/data_model_gen/templates/event.h.jinja b/tools/data_model_gen/templates/event.h.jinja new file mode 100644 index 000000000..48398e7ee --- /dev/null +++ b/tools/data_model_gen/templates/event.h.jinja @@ -0,0 +1,18 @@ +{% if cluster.get_events() | length > 0 %} +namespace event { + {% for event in cluster.get_events() %} +event_t *create_{{ event.func_name | lower }}(cluster_t *cluster); + {% endfor %} + {# Exceptions for switch cluster #} + {% if cluster.esp_name == "switch_cluster" %} +esp_err_t send_switch_latched(chip::EndpointId endpoint, uint8_t new_position); +esp_err_t send_initial_press(chip::EndpointId endpoint, uint8_t new_position); +esp_err_t send_long_press(chip::EndpointId endpoint, uint8_t new_position); +esp_err_t send_short_release(chip::EndpointId endpoint, uint8_t previous_position); +esp_err_t send_long_release(chip::EndpointId endpoint, uint8_t previous_position); +esp_err_t send_multi_press_ongoing(chip::EndpointId endpoint, uint8_t new_position, uint8_t count); +esp_err_t send_multi_press_complete(chip::EndpointId endpoint, uint8_t new_position, uint8_t count); + {% endif %} +} /* event */ + +{% endif %} \ No newline at end of file diff --git a/tools/data_model_gen/templates/feature.cpp.jinja b/tools/data_model_gen/templates/feature.cpp.jinja new file mode 100644 index 000000000..ea8e7fac5 --- /dev/null +++ b/tools/data_model_gen/templates/feature.cpp.jinja @@ -0,0 +1,90 @@ +{% set features = cluster.get_features() %} +{% if features | length > 0 %} +namespace feature { +{% for feature in features %} +namespace {{ feature.func_name | lower }} { +uint32_t get_id() +{ + return {{ feature.chip_name }}::Id; +} + +{% set ext_attrs = feature.get_externally_managed_attributes() %} +{% set has_config = ext_attrs | length > 0 %} +esp_err_t add(cluster_t *cluster{% if has_config %}, config_t *config{% endif %}) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG); +{% if has_config %} + VerifyOrReturnError(config, ESP_ERR_INVALID_ARG); +{% endif %} +{% if feature.get_conformance_condition() %} +{% if "feature" in feature.get_conformance_condition()|string %} + uint32_t feature_map = get_feature_map_value(cluster); +{% endif %} + VerifyOrReturnError({{ feature.get_conformance_condition() }}, ESP_ERR_INVALID_ARG); +{% endif %} + update_feature_map(cluster, get_id()); + {# --- Attributes --- #} + {% set attrs = feature.get_attributes() %} + {% if attrs | length > 0 %} + {% filter indent(4, true) %} + {% include "common.attribute.cpp.jinja" %} + {% endfilter %} + {% endif %} + {# --- Commands --- #} + {% for command in feature.get_commands() %} +{% if command.has_special_config() %} +#if {{ command.get_special_config() }} +{% endif %} + command::create_{{ command.func_name }}(cluster); +{% if command.has_special_config() %} +#endif // {{ command.get_special_config() }} +{% endif %} + {% endfor %} + {# --- Events --- #} + {% for event in feature.get_events() %} +{% if event.has_special_config() %} +#if {{ event.get_special_config() }} +{% endif %} + event::create_{{ event.func_name }}(cluster); +{% if event.has_special_config() %} +#endif // {{ event.get_special_config() }} +{% endif %} + {% endfor %} + {% set elements = cluster.get_destroyable_elements(feature.func_name) %} + {% set d_attrs = elements["attributes"] %} + {% if d_attrs | length > 0 %} + {% for d_attr in d_attrs %} + attribute_t *{{ d_attr.func_name }} = + esp_matter::attribute::get(cluster, attribute::{{ d_attr.chip_name }}::Id); + if ({{ d_attr.func_name }}) { + esp_matter::attribute::destroy(cluster, {{ d_attr.func_name }}); + } + {% endfor %} + {% endif %} + {% set d_commands = elements["commands"] %} + {% if d_commands | length > 0 %} + {% for d_command in d_commands %} + command_t *{{ d_command.func_name }} = esp_matter::command::get(cluster, command::{{ d_command.chip_name }}::Id, {{ d_command.get_flag() }}); + if ({{ d_command.func_name }}) { + esp_matter::command::destroy(cluster, {{ d_command.func_name }}); + } + {% endfor %} + {% endif %} + {% set d_events = elements["events"] %} + {% if d_events | length > 0 %} + {% for d_event in d_events %} + event_t *{{ d_event.func_name }} = esp_matter::event::get(cluster, event::{{ d_event.chip_name }}::Id); + if ({{ d_event.func_name }}) { + esp_matter::event::destroy(cluster, {{ d_event.func_name }}); + } + {% endfor %} + {% endif %} + + return ESP_OK; +} +} /* {{ feature.func_name | lower }} */ + +{% endfor %} +} /* feature */ + +{% endif %} \ No newline at end of file diff --git a/tools/data_model_gen/templates/feature.h.jinja b/tools/data_model_gen/templates/feature.h.jinja new file mode 100644 index 000000000..0418dd451 --- /dev/null +++ b/tools/data_model_gen/templates/feature.h.jinja @@ -0,0 +1,43 @@ +{% set features = cluster.get_features() %} +{% if features | length > 0 %} +namespace feature { +{# ---------- Feature Implementations ---------- #} +{% for feature in features %} +namespace {{ feature.func_name | lower }} { +{% set ext_attrs = feature.get_externally_managed_attributes() %} +{% set has_config = ext_attrs | length > 0 %} +{% if has_config %} +typedef struct config { + {% for attr in ext_attrs %} + {% if attr.type == "string" %} + char {{ attr.func_name }}[k_max_{{ attr.func_name }}_length + 1]; + {% elif attr.type == "octstr" %} + uint8_t {{ attr.func_name }}[k_max_{{ attr.func_name }}_length]; + {% elif attr.type == "list" %} + {% elif attr.is_nullable %} + nullable<{{ attr.get_type() }}> {{ attr.func_name }}; + {% else %} + {{ attr.get_type() }} {{ attr.func_name }}; + {% endif %} + {% endfor %} + {% set init_items = [] %} + {% for attr in feature.get_attributes() %} + {% if not attr.is_complex and not attr.is_internally_managed %} + {% set _ = init_items.append(attr.func_name ~ "(" ~ attr.get_default_value() ~ ")") %} + {% endif %} + {% endfor %} + {% if init_items %} + config() : {{ init_items | join(", ") }} {} + {% else %} + config() {} + {% endif %} +} config_t; +{% endif %} +uint32_t get_id(); +esp_err_t add(cluster_t *cluster{% if has_config %}, config_t *config{% endif %}); +} /* {{ feature.func_name | lower }} */ + +{% endfor %} +} /* feature */ + +{% endif %} \ No newline at end of file diff --git a/tools/data_model_gen/tests/__init__.py b/tools/data_model_gen/tests/__init__.py new file mode 100644 index 000000000..9778ce606 --- /dev/null +++ b/tools/data_model_gen/tests/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Test suite for data model generation tools.""" diff --git a/tools/data_model_gen/tests/run_tests.py b/tools/data_model_gen/tests/run_tests.py new file mode 100755 index 000000000..b12097d5a --- /dev/null +++ b/tools/data_model_gen/tests/run_tests.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Test runner for data model generation tools. + +Usage: + python3 tests/run_tests.py # Run all tests + python3 tests/run_tests.py conformance # Run only conformance tests + python3 tests/run_tests.py -v # Run with verbose output +""" + +import sys +import os +import unittest +import argparse + +# Add parent directory to path for imports +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + + +def run_all_tests(verbosity=2): + """Run all tests in the tests directory""" + loader = unittest.TestLoader() + start_dir = os.path.dirname(os.path.abspath(__file__)) + suite = loader.discover(start_dir, pattern="test_*.py") + + runner = unittest.TextTestRunner(verbosity=verbosity) + result = runner.run(suite) + return result.wasSuccessful() + + +def run_specific_test(test_name, verbosity=2): + """Run a specific test module""" + module_name = ( + f"test_{test_name}" if not test_name.startswith("test_") else test_name + ) + + try: + loader = unittest.TestLoader() + suite = loader.loadTestsFromName(module_name) + + runner = unittest.TextTestRunner(verbosity=verbosity) + result = runner.run(suite) + return result.wasSuccessful() + except Exception as e: + print(f"Error loading test module '{module_name}': {e}") + return False + + +def main(): + parser = argparse.ArgumentParser( + description="Run tests for data model generation tools" + ) + parser.add_argument( + "test_name", nargs="?", help="Specific test module to run (e.g., conformance)" + ) + parser.add_argument( + "-v", "--verbose", action="store_true", help="Verbose output (show each test)" + ) + parser.add_argument( + "-q", "--quiet", action="store_true", help="Quiet output (minimal info)" + ) + + args = parser.parse_args() + + # Determine verbosity level + if args.quiet: + verbosity = 0 + elif args.verbose: + verbosity = 2 + else: + verbosity = 1 + + # Run tests + if args.test_name: + success = run_specific_test(args.test_name, verbosity) + else: + success = run_all_tests(verbosity) + + sys.exit(0 if success else 1) + + +if __name__ == "__main__": + main() diff --git a/tools/data_model_gen/tests/test_attribute_type.py b/tools/data_model_gen/tests/test_attribute_type.py new file mode 100644 index 000000000..05317fbaa --- /dev/null +++ b/tools/data_model_gen/tests/test_attribute_type.py @@ -0,0 +1,162 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Tests for xml_processing/attribute_type.py — Matter type to C type mappings.""" + +import unittest +import sys +import os + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from xml_processing.attribute_type import ( # noqa: E402 + AttributeType, + attribute_types, + attribute_type_map, +) + + +class TestAttributeType(unittest.TestCase): + """Test AttributeType class — type string to C type mapping.""" + + def test_uint8(self): + self.assertEqual(AttributeType("uint8").get_attribute_type(), "uint8_t") + + def test_uint16(self): + self.assertEqual(AttributeType("uint16").get_attribute_type(), "uint16_t") + + def test_uint32(self): + self.assertEqual(AttributeType("uint32").get_attribute_type(), "uint32_t") + + def test_uint64(self): + self.assertEqual(AttributeType("uint64").get_attribute_type(), "uint64_t") + + def test_int8(self): + self.assertEqual(AttributeType("int8").get_attribute_type(), "int8_t") + + def test_int16(self): + self.assertEqual(AttributeType("int16").get_attribute_type(), "int16_t") + + def test_int32(self): + self.assertEqual(AttributeType("int32").get_attribute_type(), "int32_t") + + def test_int64(self): + self.assertEqual(AttributeType("int64").get_attribute_type(), "int64_t") + + def test_bool(self): + self.assertEqual(AttributeType("bool").get_attribute_type(), "bool") + + def test_enum8(self): + self.assertEqual(AttributeType("enum8").get_attribute_type(), "uint8_t") + + def test_enum16(self): + self.assertEqual(AttributeType("enum16").get_attribute_type(), "uint16_t") + + def test_bitmap8(self): + self.assertEqual(AttributeType("bitmap8").get_attribute_type(), "uint8_t") + + def test_bitmap16(self): + self.assertEqual(AttributeType("bitmap16").get_attribute_type(), "uint16_t") + + def test_bitmap32(self): + self.assertEqual(AttributeType("bitmap32").get_attribute_type(), "uint32_t") + + def test_string(self): + self.assertEqual(AttributeType("string").get_attribute_type(), "char *") + + def test_octstr(self): + self.assertEqual(AttributeType("octstr").get_attribute_type(), "uint8_t *") + + def test_list(self): + self.assertEqual(AttributeType("list").get_attribute_type(), "uint8_t *") + + def test_unknown_type_raises(self): + from utils.exceptions import XmlParseError + + at = AttributeType("custom_unknown") + with self.assertRaises(XmlParseError): + at.get_attribute_type() + + +class TestAttributeTypesDict(unittest.TestCase): + """Test the global attribute_types dictionary — key type mappings.""" + + def test_subject_id_is_uint64(self): + self.assertEqual(attribute_types.get("subject-id"), "uint64") + + def test_fabric_idx_is_uint8(self): + self.assertEqual(attribute_types.get("fabric-idx"), "uint8") + + def test_node_id(self): + self.assertEqual(attribute_types.get("node-id"), "uint64") + + def test_epoch_us(self): + self.assertEqual(attribute_types.get("epoch-us"), "uint64") + + def test_epoch_s(self): + self.assertEqual(attribute_types.get("epoch-s"), "uint32") + + def test_vendor_id(self): + self.assertEqual(attribute_types.get("vendor-id"), "uint16") + + def test_percent(self): + self.assertEqual(attribute_types.get("percent"), "uint8") + + def test_percent100ths(self): + self.assertEqual(attribute_types.get("percent100ths"), "uint16") + + def test_temperature(self): + self.assertEqual(attribute_types.get("temperature"), "int16") + + def test_basic_primitives_present(self): + for t in [ + "uint8", + "uint16", + "uint32", + "uint64", + "int8", + "int16", + "int32", + "int64", + ]: + self.assertIn(t, attribute_types, f"Missing type: {t}") + + def test_string_types(self): + self.assertIn("string", attribute_types) + self.assertIn("octstr", attribute_types) + + +class TestAttributeTypeMap(unittest.TestCase): + """Test per-cluster attribute type overrides.""" + + def test_color_control_overrides_exist(self): + self.assertIn("color_control", attribute_type_map) + + def test_thermostat_overrides_exist(self): + self.assertIn("thermostat", attribute_type_map) + + def test_door_lock_overrides_exist(self): + self.assertIn("door_lock", attribute_type_map) + + def test_override_values_are_valid(self): + for cluster, overrides in attribute_type_map.items(): + for attr_name, type_val in overrides.items(): + self.assertIsInstance( + type_val, + (str, dict), + f"{cluster}.{attr_name} type should be str or dict", + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/tests/test_base_elements.py b/tools/data_model_gen/tests/test_base_elements.py new file mode 100644 index 000000000..6f102a28a --- /dev/null +++ b/tools/data_model_gen/tests/test_base_elements.py @@ -0,0 +1,313 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Tests for utils/base_elements.py — abstract base classes for model elements.""" + +import unittest +import sys +import os + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from utils.base_elements import ( # noqa: E402 + BaseElement, + BaseAttribute, + BaseCommand, + BaseEvent, + BaseFeature, + BaseCluster, + BaseDevice, +) +from code_generation.elements import get_id_name_lambda # noqa: E402 + + +# Concrete subclasses for testing abstract classes +class ConcreteElement(BaseElement): + pass + + +class ConcreteFeature(BaseFeature): + def get_attributes(self): + return [] + + def get_commands(self): + return [] + + def get_events(self): + return [] + + +class ConcreteCluster(BaseCluster): + def get_attributes(self): + return [] + + def get_commands(self): + return [] + + def get_events(self): + return [] + + def get_features(self): + return [] + + +class ConcreteDevice(BaseDevice): + def get_clusters(self): + return [] + + +class TestBaseElement(unittest.TestCase): + """Test BaseElement name processing and ID handling.""" + + def test_name_and_id(self): + elem = ConcreteElement(name="Test Element", id="0x0001", element_type="Test") + self.assertEqual(elem.id, "0x0001") + self.assertEqual(elem.get_id(), "0x0001") + + def test_esp_name_generation(self): + elem = ConcreteElement(name="Color Control", id="0x0001", element_type="Test") + self.assertEqual(elem.esp_name, "color_control") + + def test_chip_name_generation(self): + elem = ConcreteElement(name="Color Control", id="0x0001", element_type="Test") + self.assertEqual(elem.chip_name, "ColorControl") + + def test_func_name_generation(self): + elem = ConcreteElement(name="Color Control", id="0x0001", element_type="Test") + self.assertEqual(elem.func_name, "color_control") + + def test_reserved_word_renaming_via_cluster_element(self): + """Reserved word handling happens in BaseClusterElement, not BaseElement directly.""" + attr = BaseAttribute( + name="auto", + id="0x0001", + type_="uint8", + is_mandatory=True, + default_value="0", + ) + self.assertIn("Attribute", attr.name) + + def test_special_config(self): + elem = ConcreteElement(name="icd_management", id="0x0001", element_type="Test") + self.assertTrue(elem.has_special_config()) + self.assertEqual(elem.get_special_config(), "CHIP_CONFIG_ENABLE_ICD_SERVER") + + def test_no_special_config(self): + elem = ConcreteElement(name="Thermostat", id="0x0001", element_type="Test") + self.assertFalse(elem.has_special_config()) + self.assertIsNone(elem.get_special_config()) + + def test_name_required(self): + with self.assertRaises(AssertionError): + ConcreteElement(name="", id="0x0001", element_type="Test") + + +class TestBaseClusterElement(unittest.TestCase): + """Test BaseClusterElement with reserved word handling.""" + + def test_reserved_word_attribute(self): + attr = BaseAttribute( + name="auto", + id="0x0001", + type_="uint8", + is_mandatory=True, + default_value="0", + ) + self.assertIn("Attribute", attr.name) + + def test_reserved_word_command(self): + cmd = BaseCommand( + name="auto", + id="0x0001", + is_mandatory=True, + direction="commandToServer", + response="Y", + ) + self.assertIn("Command", cmd.name) + + def test_reserved_word_event(self): + evt = BaseEvent(name="switch", id="0x0001", is_mandatory=True) + self.assertIn("Event", evt.name) + + def test_non_reserved_word(self): + attr = BaseAttribute( + name="temperature", + id="0x0001", + type_="int16", + is_mandatory=True, + default_value="0", + ) + self.assertEqual(attr.func_name, "temperature") + + def test_mandatory_flag(self): + attr = BaseAttribute( + name="test", + id="0x0001", + type_="uint8", + is_mandatory=True, + default_value="0", + ) + self.assertTrue(attr.is_mandatory) + + def test_optional_flag(self): + attr = BaseAttribute( + name="test", + id="0x0001", + type_="uint8", + is_mandatory=False, + default_value="0", + ) + self.assertFalse(attr.is_mandatory) + + +class TestBaseAttribute(unittest.TestCase): + """Test BaseAttribute initialization.""" + + def test_type_stored(self): + attr = BaseAttribute( + name="temp", + id="0x0001", + type_="int16", + is_mandatory=True, + default_value="20", + ) + self.assertEqual(attr.type, "int16") + + def test_default_value_stored(self): + attr = BaseAttribute( + name="temp", + id="0x0001", + type_="int16", + is_mandatory=True, + default_value="20", + ) + self.assertEqual(attr.default_value, "20") + + def test_nullable_default_false(self): + attr = BaseAttribute( + name="temp", + id="0x0001", + type_="int16", + is_mandatory=True, + default_value="0", + ) + self.assertFalse(attr.is_nullable) + + +class TestBaseCommand(unittest.TestCase): + """Test BaseCommand initialization.""" + + def test_direction_stored(self): + cmd = BaseCommand( + name="SetTemp", + id="0x0001", + is_mandatory=True, + direction="commandToServer", + response="Y", + ) + self.assertEqual(cmd.direction, "commandToServer") + + def test_response_stored(self): + cmd = BaseCommand( + name="SetTemp", + id="0x0001", + is_mandatory=True, + direction="commandToServer", + response="Y", + ) + self.assertEqual(cmd.response, "Y") + + +class TestBaseFeature(unittest.TestCase): + """Test BaseFeature with abstract methods.""" + + def test_creation(self): + feat = ConcreteFeature(name="Lighting", id="0x0001", is_mandatory=False) + self.assertFalse(feat.is_mandatory) + self.assertEqual(feat.get_attributes(), []) + self.assertEqual(feat.get_commands(), []) + self.assertEqual(feat.get_events(), []) + + +class TestBaseCluster(unittest.TestCase): + """Test BaseCluster initialization and callback flags.""" + + def test_revision(self): + cluster = ConcreteCluster( + name="OnOff", id="0x0006", revision=6, is_mandatory=True + ) + self.assertEqual(cluster.get_revision(), 6) + + def test_default_flags(self): + cluster = ConcreteCluster( + name="OnOff", id="0x0006", revision=6, is_mandatory=True + ) + self.assertFalse(cluster.server_cluster) + self.assertFalse(cluster.client_cluster) + self.assertFalse(cluster.init_function_available) + self.assertFalse(cluster.delegate_init_callback_available) + self.assertIsNone(cluster.role) + + def test_abstract_methods(self): + cluster = ConcreteCluster( + name="OnOff", id="0x0006", revision=6, is_mandatory=True + ) + self.assertEqual(cluster.get_attributes(), []) + self.assertEqual(cluster.get_features(), []) + + +class TestBaseDevice(unittest.TestCase): + """Test BaseDevice filename and revision.""" + + def test_filename_generation(self): + device = ConcreteDevice(name="On/Off Light", id="0x0100", revision=3) + self.assertEqual(device.filename, "on_off_light_device") + + def test_device_type_id(self): + device = ConcreteDevice(name="Temperature Sensor", id="0x0302", revision=2) + self.assertEqual(device.get_device_type_id(), "0x0302") + + def test_device_type_version(self): + device = ConcreteDevice(name="Temperature Sensor", id="0x0302", revision=2) + self.assertEqual(device.get_device_type_version(), 2) + + def test_device_name_override(self): + device = ConcreteDevice(name="Dishwasher", id="0x0075", revision=1) + self.assertIn("dish_washer", device.esp_name) + + +class TestGetIdNameLambda(unittest.TestCase): + """Test sorting lambda.""" + + def test_sorts_by_id(self): + sorter = get_id_name_lambda() + + class FakeElem: + def __init__(self, id_, name): + self._id = id_ + self.name = name + + def get_id(self): + return self._id + + items = [ + FakeElem("0x0003", "C"), + FakeElem("0x0001", "A"), + FakeElem("0x0002", "B"), + ] + sorted_items = sorted(items, key=sorter) + self.assertEqual([i.name for i in sorted_items], ["A", "B", "C"]) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/tests/test_codegen_elements.py b/tools/data_model_gen/tests/test_codegen_elements.py new file mode 100644 index 000000000..ac003d480 --- /dev/null +++ b/tools/data_model_gen/tests/test_codegen_elements.py @@ -0,0 +1,427 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Tests for code_generation/elements.py — Cluster, Attribute, Command, Event, Feature, Device +used during Jinja template rendering. +""" + +import unittest +import sys +import os + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from code_generation.elements import ( # noqa: E402 + Cluster, + Attribute, + Command, + Event, + Feature, + Device, + get_choice_group, + get_id_name_lambda, +) +from code_generation.conformance_codegen import ConformanceDecision # noqa: E402 + + +# --------------------------------------------------------------------------- +# Helpers +# --------------------------------------------------------------------------- + + +def _make_attr(name, id_, type_="uint8", mandatory=True, default="0"): + a = Attribute( + name=name, id=id_, type_=type_, is_mandatory=mandatory, default_value=default + ) + a.converted_type = "uint8_t" + a._flag = "ATTRIBUTE_FLAG_NONE" + return a + + +def _make_cmd(name, id_, mandatory=True, direction="commandToServer", response="Y"): + c = Command( + name=name, + id=id_, + is_mandatory=mandatory, + direction=direction, + response=response, + ) + c._flag = "COMMAND_FLAG_ACCEPTED" + c.has_callback = True + return c + + +def _make_event(name, id_, mandatory=True): + return Event(name=name, id=id_, is_mandatory=mandatory) + + +def _make_feature(name, id_, code="XX", mandatory=False, conformance=None): + f = Feature(name=name, id=id_, code=code, is_mandatory=mandatory) + if conformance: + f.conformance = conformance + return f + + +def _make_cluster(name="TestCluster", id_="0x0001", revision=1): + return Cluster(name=name, id=id_, revision=revision, is_mandatory=True) + + +# --------------------------------------------------------------------------- +# Attribute (codegen) +# --------------------------------------------------------------------------- + + +class TestCodegenAttribute(unittest.TestCase): + """Test code_generation.elements.Attribute.""" + + def test_basic_creation(self): + a = _make_attr("Temp", "0x0001") + self.assertEqual(a.get_id(), "0x0001") + self.assertTrue(a.is_mandatory) + + def test_get_flag(self): + a = _make_attr("Temp", "0x0001") + a._flag = "ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE" + self.assertIn("WRITABLE", a.get_flag()) + + def test_get_type(self): + a = _make_attr("Temp", "0x0001") + a.converted_type = "int16_t" + self.assertEqual(a.get_type(), "int16_t") + + def test_get_default_value(self): + a = _make_attr("Temp", "0x0001", default="42") + self.assertEqual(a.get_default_value(), "42") + + def test_get_default_value_type_small(self): + a = _make_attr("Temp", "0x0001", default="10") + self.assertEqual(a.get_default_value_type(), "uint8_t") + + def test_get_default_value_type_medium(self): + a = _make_attr("Temp", "0x0001", default="1000") + self.assertEqual(a.get_default_value_type(), "uint16_t") + + def test_get_default_value_type_large(self): + a = _make_attr("Temp", "0x0001", default="100000") + self.assertEqual(a.get_default_value_type(), "uint32_t") + + def test_get_default_value_type_non_numeric(self): + a = _make_attr("Temp", "0x0001", default="abc") + self.assertEqual(a.get_default_value_type(), "uint32_t") + + def test_min_max_value(self): + a = _make_attr("Temp", "0x0001") + a.min_value = -100 + a.max_value = 200 + self.assertEqual(a.get_min_value(), -100) + self.assertEqual(a.get_max_value(), 200) + + def test_max_value_falls_back_to_default(self): + a = _make_attr("Temp", "0x0001", default="50") + a.max_value = None + self.assertEqual(a.get_max_value(), "50") + + def test_conformance_condition_default_none(self): + a = _make_attr("Temp", "0x0001") + self.assertIsNone(a.get_conformance_condition()) + + def test_is_internally_managed_default(self): + a = _make_attr("Temp", "0x0001") + self.assertFalse(a.is_internally_managed) + + def test_is_complex_default(self): + a = _make_attr("Temp", "0x0001") + self.assertFalse(a.is_complex) + + +# --------------------------------------------------------------------------- +# Command (codegen) +# --------------------------------------------------------------------------- + + +class TestCodegenCommand(unittest.TestCase): + """Test code_generation.elements.Command.""" + + def test_basic(self): + c = _make_cmd("Off", "0x0001") + self.assertEqual(c.get_flag(), "COMMAND_FLAG_ACCEPTED") + self.assertTrue(c.has_callback) + + def test_conformance_condition_default(self): + c = _make_cmd("Off", "0x0001") + self.assertIsNone(c.get_conformance_condition()) + + def test_fabric_scoped_default(self): + c = _make_cmd("Off", "0x0001") + self.assertFalse(c.is_fabric_scoped) + + +# --------------------------------------------------------------------------- +# Event (codegen) +# --------------------------------------------------------------------------- + + +class TestCodegenEvent(unittest.TestCase): + """Test code_generation.elements.Event.""" + + def test_basic(self): + e = _make_event("StateChange", "0x0001") + self.assertEqual(e.priority, "Info") + + def test_conformance_condition_default(self): + e = _make_event("StateChange", "0x0001") + self.assertIsNone(e.get_conformance_condition()) + + +# --------------------------------------------------------------------------- +# Feature (codegen) +# --------------------------------------------------------------------------- + + +class TestCodegenFeature(unittest.TestCase): + """Test code_generation.elements.Feature.""" + + def test_basic(self): + f = _make_feature("Lighting", "0x0001", code="LT") + self.assertEqual(f.code, "LT") + + def test_get_attributes_sorted(self): + f = _make_feature("Lighting", "0x0001", code="LT") + f.attributes = [_make_attr("B", "0x0002"), _make_attr("A", "0x0001")] + attrs = f.get_attributes() + self.assertEqual(attrs[0].get_id(), "0x0001") + + def test_get_externally_managed_attributes(self): + f = _make_feature("Lighting", "0x0001", code="LT") + a1 = _make_attr("Ext", "0x0001") + a1.is_internally_managed = False + a2 = _make_attr("Int", "0x0002") + a2.is_internally_managed = True + f.attributes = [a1, a2] + ext = f.get_externally_managed_attributes() + self.assertEqual(len(ext), 1) + self.assertEqual(ext[0].get_id(), "0x0001") + + def test_get_commands_sorted(self): + f = _make_feature("Lighting", "0x0001", code="LT") + f.commands = [_make_cmd("B", "0x0002"), _make_cmd("A", "0x0001")] + cmds = f.get_commands() + self.assertEqual(cmds[0].get_id(), "0x0001") + + def test_get_events_sorted(self): + f = _make_feature("Lighting", "0x0001", code="LT") + f.events = [_make_event("B", "0x0002"), _make_event("A", "0x0001")] + evts = f.get_events() + self.assertEqual(evts[0].get_id(), "0x0001") + + +# --------------------------------------------------------------------------- +# Cluster (codegen) +# --------------------------------------------------------------------------- + + +class TestCodegenCluster(unittest.TestCase): + """Test code_generation.elements.Cluster — sorting, mandatory, choice groups.""" + + def test_get_attributes_sorted(self): + c = _make_cluster() + c.attributes = [_make_attr("B", "0x0002"), _make_attr("A", "0x0001")] + self.assertEqual(c.get_attributes()[0].get_id(), "0x0001") + + def test_get_commands_sorted(self): + c = _make_cluster() + c.commands = [_make_cmd("B", "0x0002"), _make_cmd("A", "0x0001")] + self.assertEqual(c.get_commands()[0].get_id(), "0x0001") + + def test_get_events_sorted(self): + c = _make_cluster() + c.events = [_make_event("B", "0x0002"), _make_event("A", "0x0001")] + self.assertEqual(c.get_events()[0].get_id(), "0x0001") + + def test_get_features_sorted(self): + c = _make_cluster() + c.features = [ + _make_feature("B", "0x0002", code="BB"), + _make_feature("A", "0x0001", code="AA"), + ] + self.assertEqual(c.get_features()[0].get_id(), "0x0001") + + def test_get_mandatory_attributes(self): + c = _make_cluster() + a1 = _make_attr("M", "0x0001", mandatory=True) + a2 = _make_attr("O", "0x0002", mandatory=False) + c.attributes = [a1, a2] + mandatory = c.get_mandatory_attributes() + self.assertEqual(len(mandatory), 1) + self.assertEqual(mandatory[0].get_id(), "0x0001") + + def test_get_mandatory_commands(self): + c = _make_cluster() + c1 = _make_cmd("M", "0x0001", mandatory=True) + c2 = _make_cmd("O", "0x0002", mandatory=False) + c.commands = [c1, c2] + mandatory = c.get_mandatory_commands() + self.assertEqual(len(mandatory), 1) + + def test_get_mandatory_events(self): + c = _make_cluster() + e1 = _make_event("M", "0x0001", mandatory=True) + e2 = _make_event("O", "0x0002", mandatory=False) + c.events = [e1, e2] + mandatory = c.get_mandatory_events() + self.assertEqual(len(mandatory), 1) + + def test_has_choice_features_false(self): + c = _make_cluster() + self.assertFalse(c.has_choice_features()) + + def test_get_cluster_init_callback(self): + c = _make_cluster(name="OnOff") + cb = c.get_cluster_init_callback() + self.assertIn("OnOff", cb) + self.assertIn("Init", cb) + + def test_get_cluster_shutdown_callback(self): + c = _make_cluster(name="OnOff") + cb = c.get_cluster_shutdown_callback() + self.assertIn("OnOff", cb) + self.assertIn("Shutdown", cb) + + def test_get_response_command(self): + c = _make_cluster() + cmd = _make_cmd("GetResponse", "0x0001") + c.commands = [cmd] + self.assertEqual(c.get_response_command("GetResponse"), cmd) + self.assertIsNone(c.get_response_command("Unknown")) + + def test_get_destroyable_elements_empty(self): + c = _make_cluster() + c.attributes = [_make_attr("A", "0x0001")] + result = c.get_destroyable_elements("lighting") + self.assertEqual(result["attributes"], []) + self.assertEqual(result["commands"], []) + self.assertEqual(result["events"], []) + + def test_get_independent_features_all_independent(self): + c = _make_cluster() + f1 = _make_feature("A", "0x0001", code="AA") + f2 = _make_feature("B", "0x0002", code="BB") + c.features = [f1, f2] + independent = c.get_independent_features() + self.assertEqual(len(independent), 2) + + def test_standalone_choice_groups_empty(self): + c = _make_cluster() + self.assertEqual(c.get_standalone_choice_groups(), []) + + +# --------------------------------------------------------------------------- +# Device (codegen) +# --------------------------------------------------------------------------- + + +class TestCodegenDevice(unittest.TestCase): + """Test code_generation.elements.Device.""" + + def test_basic(self): + d = Device(id="0x0100", name="On/Off Light", revision=3) + self.assertEqual(d.get_device_type_id(), "0x0100") + self.assertEqual(d.get_device_type_version(), 3) + + def test_get_clusters_sorted(self): + d = Device(id="0x0100", name="Test", revision=1) + c1 = _make_cluster("B", "0x0006") + c1.server_cluster = True + c2 = _make_cluster("A", "0x0003") + c2.server_cluster = True + d.clusters = [c1, c2] + self.assertEqual(d.get_clusters()[0].get_id(), "0x0003") + + def test_get_mandatory_clusters(self): + d = Device(id="0x0100", name="Test", revision=1) + c1 = _make_cluster("M", "0x0001") + c1.is_mandatory = True + c2 = Cluster(name="O", id="0x0002", revision=1, is_mandatory=False) + d.clusters = [c1, c2] + self.assertEqual(len(d.get_mandatory_clusters()), 1) + + def test_get_unique_clusters_deduplicates(self): + d = Device(id="0x0100", name="Test", revision=1) + c1 = _make_cluster("Same", "0x0006") + c1.server_cluster = True + c2 = _make_cluster("Same", "0x0006") + c2.server_cluster = False + d.clusters = [c1, c2] + unique = d.get_unique_clusters() + self.assertEqual(len(unique), 1) + + def test_binding_cluster_available(self): + d = Device(id="0x0100", name="Test", revision=1) + c = _make_cluster("Test", "0x0006") + c.client_cluster = True + c.is_mandatory = True + d.clusters = [c] + self.assertTrue(d.binding_cluster_available()) + + def test_no_binding_cluster(self): + d = Device(id="0x0100", name="Test", revision=1) + c = _make_cluster("Test", "0x0006") + c.server_cluster = True + c.client_cluster = False + c.is_mandatory = True + d.clusters = [c] + self.assertFalse(d.binding_cluster_available()) + + def test_filename(self): + d = Device(id="0x0100", name="Temperature Sensor", revision=1) + self.assertTrue(d.filename.endswith("_device")) + + +# --------------------------------------------------------------------------- +# Deserializer roundtrip helpers +# --------------------------------------------------------------------------- + + +class TestGetIdNameLambda(unittest.TestCase): + """Test sorting helper.""" + + def test_sorts_correctly(self): + items = [ + _make_attr("C", "0x0003"), + _make_attr("A", "0x0001"), + _make_attr("B", "0x0002"), + ] + sorted_items = sorted(items, key=get_id_name_lambda()) + self.assertEqual( + [i.get_id() for i in sorted_items], ["0x0001", "0x0002", "0x0003"] + ) + + +class TestGetChoiceGroup(unittest.TestCase): + """Test get_choice_group() utility.""" + + def test_empty_features(self): + result = get_choice_group("mandatory_parent", ConformanceDecision.OTHERWISE, []) + self.assertEqual(result, []) + + def test_no_matching_conformance(self): + f = _make_feature("A", "0x0001", code="AA") + result = get_choice_group( + "mandatory_parent", ConformanceDecision.OTHERWISE, [f] + ) + self.assertEqual(result, []) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/tests/test_config.py b/tools/data_model_gen/tests/test_config.py new file mode 100644 index 000000000..b30ed57b5 --- /dev/null +++ b/tools/data_model_gen/tests/test_config.py @@ -0,0 +1,123 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Tests for utils/config.py — configuration, provisional mode, logger, file names.""" + +import unittest +import sys +import os +import logging + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from utils.config import ( # noqa: E402 + setup_provisional_mode, + allow_provisional, + set_esp_matter_path, + setup_logger, + FileNames, + SPECIFICATION_VERSIONS, + DEFAULT_CHIP_VERSION, +) +from utils.exceptions import ConfigurationError # noqa: E402 + + +class TestProvisionalMode(unittest.TestCase): + """Test provisional mode control.""" + + def tearDown(self): + setup_provisional_mode(False) + + def test_default_not_provisional(self): + setup_provisional_mode(False) + self.assertFalse(allow_provisional()) + + def test_enable_provisional(self): + setup_provisional_mode(True) + self.assertTrue(allow_provisional()) + + def test_disable_provisional(self): + setup_provisional_mode(True) + setup_provisional_mode(False) + self.assertFalse(allow_provisional()) + + +class TestSetEspMatterPath(unittest.TestCase): + """Test set_esp_matter_path() — path validation.""" + + def test_empty_path_raises(self): + with self.assertRaises(ConfigurationError): + set_esp_matter_path("") + + def test_whitespace_path_raises(self): + with self.assertRaises(ConfigurationError): + set_esp_matter_path(" ") + + def test_none_path_raises(self): + with self.assertRaises(ConfigurationError): + set_esp_matter_path(None) + + def test_nonexistent_path_raises(self): + with self.assertRaises(ConfigurationError): + set_esp_matter_path("/nonexistent/path/that/does/not/exist") + + def test_valid_path(self): + import tempfile + + with tempfile.TemporaryDirectory() as tmpdir: + set_esp_matter_path(tmpdir) + + +class TestSetupLogger(unittest.TestCase): + """Test setup_logger() — logger configuration.""" + + def test_setup_default(self): + setup_logger("INFO", False) + root = logging.getLogger() + self.assertTrue(root.hasHandlers()) + + def test_setup_colored(self): + setup_logger("DEBUG", True) + root = logging.getLogger() + self.assertTrue(root.hasHandlers()) + + +class TestFileNames(unittest.TestCase): + """Test FileNames enum values.""" + + def test_cluster_json(self): + self.assertEqual(FileNames.CLUSTER_JSON.value, "clusters.json") + + def test_device_json(self): + self.assertEqual(FileNames.DEVICE_JSON.value, "device_types.json") + + def test_all_values_are_json(self): + for fn in FileNames: + self.assertTrue( + fn.value.endswith(".json"), f"{fn.name} should end with .json" + ) + + +class TestSpecificationVersions(unittest.TestCase): + """Test specification version constants.""" + + def test_versions_list(self): + self.assertIn("1.4", SPECIFICATION_VERSIONS) + self.assertIn("1.5", SPECIFICATION_VERSIONS) + + def test_default_version(self): + self.assertIn(DEFAULT_CHIP_VERSION, SPECIFICATION_VERSIONS) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/tests/test_conformance_codegen.py b/tools/data_model_gen/tests/test_conformance_codegen.py new file mode 100644 index 000000000..6ee6645b7 --- /dev/null +++ b/tools/data_model_gen/tests/test_conformance_codegen.py @@ -0,0 +1,344 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Comprehensive test suite for conformance code generation. + +Tests the conversion of conformance JSON (from XML parsing) to C++ conditional +expressions used in the ESP Matter SDK. +""" + +import unittest +import sys +import os + +# Add parent directory to path for imports +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from code_generation.conformance_codegen import ( # noqa: E402 + Conformance, + FeatureConformance, +) +from utils.conformance import ConformanceException # noqa: E402 + + +class TestBasicCodeGeneration(unittest.TestCase): + """Test basic conformance to C++ code generation""" + + def test_none_conformance(self): + """Test that None conformance returns None""" + result = Conformance(None)() + self.assertIsNone(result) + + def test_empty_conformance(self): + """Test that empty dict returns None""" + result = Conformance({})() + self.assertIsNone(result) + + def test_no_condition(self): + """Test conformance with type but no condition""" + conformance = {"type": "mandatory"} + result = Conformance(conformance)() + self.assertIsNone(result) + + def test_no_type(self): + """Test conformance with condition but no type""" + conformance = {"condition": {"feature": "lighting"}} + with self.assertRaises(ConformanceException): + Conformance(conformance)() + + +class TestFeatureConditions(unittest.TestCase): + """Test feature-based conformance code generation""" + + def test_single_feature(self): + """Test single feature with runtime check""" + conformance = {"type": "mandatory", "condition": {"feature": "lighting"}} + result = Conformance(conformance)() + + self.assertEqual("has_feature(lighting)", result) + + +class TestAttributeConditions(unittest.TestCase): + """Test attribute-based conformance code generation""" + + def test_attribute_existence_check(self): + """Test attribute existence condition""" + conformance = {"type": "mandatory", "condition": {"attribute": "HoldTime"}} + result = Conformance(conformance)() + + self.assertEqual( + "has_attribute(HoldTime)", + result, + ) + + +class TestCommandConditions(unittest.TestCase): + """Test command-based conformance code generation""" + + def test_command_existence_check(self): + """Test command existence condition""" + conformance = { + "type": "mandatory", + "condition": {"command": "SetHoldTime", "flag": "COMMAND_FLAG_ACCEPTED"}, + } + result = Conformance(conformance)() + + self.assertEqual( + "has_command(SetHoldTime, COMMAND_FLAG_ACCEPTED)", + result, + ) + + def test_command_without_flag(self): + """Test command condition without explicit flag""" + conformance = {"type": "mandatory", "condition": {"command": "SetHoldTime"}} + with self.assertRaises(ConformanceException): + Conformance(conformance)() + + +class TestBooleanOperations(unittest.TestCase): + """Test AND, OR, NOT operations in code generation""" + + def test_and_two_features(self): + """Test AND of two features""" + conformance = { + "type": "mandatory", + "condition": { + "and": [{"feature": "lighting"}, {"feature": "dead_front_behavior"}] + }, + } + result = Conformance(conformance)() + + self.assertEqual( + "((has_feature(lighting)) && (has_feature(dead_front_behavior)))", + result, + ) + + def test_or_two_features(self): + """Test OR of two features""" + conformance = { + "type": "mandatory", + "condition": {"or": [{"feature": "hue_saturation"}, {"feature": "xy"}]}, + } + result = Conformance(conformance)() + + self.assertEqual( + "((has_feature(hue_saturation)) || (has_feature(xy)))", + result, + ) + + def test_not_feature(self): + """Test NOT of a feature""" + conformance = { + "type": "optional", + "condition": {"not": {"feature": "off_only"}}, + } + result = Conformance(conformance)() + + self.assertEqual("!(has_feature(off_only))", result) + + def test_complex_nested_and_or_not(self): + """Test complex nested: AND(OR(...), NOT(...))""" + conformance = { + "type": "mandatory", + "condition": { + "and": [ + {"or": [{"feature": "hs"}, {"feature": "xy"}]}, + {"not": {"feature": "off_only"}}, + ] + }, + } + result = Conformance(conformance)() + + self.assertEqual( + "((((has_feature(hs)) || (has_feature(xy)))) && (!(has_feature(off_only))))", + result, + ) + + +class TestOtherwiseConformance(unittest.TestCase): + """Test otherwise conformance code generation""" + + def test_otherwise_simple(self): + """Test otherwise with simple sub-conditions""" + conformance = { + "type": "otherwise", + "condition": {"mandatory": {"feature": "lighting"}, "optional": True}, + } + result = Conformance(conformance)() + + self.assertEqual("(has_feature(lighting))", result) + + def test_otherwise_with_deprecated(self): + """Test otherwise with deprecated sub-condition""" + conformance = { + "type": "otherwise", + "condition": { + "mandatory": {"feature": "lighting"}, + "deprecate": True, + }, + } + result = Conformance(conformance)() + + self.assertEqual("(has_feature(lighting))", result) + + def test_otherwise_all_true(self): + """Test otherwise where all sub-conditions are True""" + conformance = { + "type": "otherwise", + "condition": {"mandatory": True, "optional": True}, + } + result = Conformance(conformance)() + + self.assertIsNone(result) + + +class TestHasNotCondition(unittest.TestCase): + """Test has_not_condition helper function""" + + def test_has_not_at_top_level(self): + """Test detection of NOT at top level""" + conformance = { + "type": "optional", + "condition": {"not": {"feature": "off_only"}}, + } + self.assertTrue(Conformance(conformance).is_not_term_present) + + def test_no_not_condition(self): + """Test when there's no NOT condition""" + conformance = {"type": "mandatory", "condition": {"feature": "lighting"}} + self.assertFalse(Conformance(conformance).is_not_term_present) + + def test_not_nested_deeper(self): + """Test NOT nested in AND (not at top level)""" + conformance = { + "type": "mandatory", + "condition": {"and": [{"feature": "a"}, {"not": {"feature": "b"}}]}, + } + self.assertTrue(FeatureConformance(conformance).is_not_term_present) + + def test_none_conformance(self): + """Test with None conformance""" + self.assertFalse(FeatureConformance(None).is_not_term_present) + + def test_no_condition_key(self): + """Test with conformance missing condition key""" + self.assertFalse(FeatureConformance({"type": "mandatory"}).is_not_term_present) + + +class TestFeatureConformanceClass(unittest.TestCase): + """Test FeatureConformance analysis class""" + + def test_simple_mandatory_feature(self): + """Test extraction of simple mandatory feature""" + conformance = {"type": "mandatory", "condition": {"feature": "lighting"}} + fc = FeatureConformance(conformance)() + + self.assertEqual("has_feature(lighting)", fc) + + def test_mandatory_parent_feature_name(self): + """Test extraction of mandatory parent feature name""" + conformance = { + "type": "otherwise", + "condition": {"mandatory": {"feature": "lighting"}, "optional": True}, + } + fc = FeatureConformance(conformance) + + self.assertEqual("lighting", fc.mandatory_parent) + + def test_exact_one_feature_detection(self): + """Test detection of 'exactly one' choice conformance""" + conformance = {"type": "optional", "choice": "a"} + fc = FeatureConformance(conformance) + self.assertTrue(fc.is_exact_one()) + + def test_at_least_one_feature_detection(self): + """Test detection of 'at least one' choice conformance""" + conformance = {"type": "optional", "choice": "a", "more": True, "min": 1} + fc = FeatureConformance(conformance) + + self.assertTrue(fc.is_at_least_one()) + self.assertFalse(fc.is_exact_one()) + + +class TestEdgeCases(unittest.TestCase): + """Test edge cases and error handling""" + + def test_invalid_condition_type(self): + """Test with invalid condition type (not a dict)""" + conformance = {"type": "mandatory", "condition": "invalid"} + with self.assertRaises(AttributeError): + Conformance(conformance)() + + def test_empty_and_list(self): + """Test AND with empty list""" + conformance = {"type": "mandatory", "condition": {"and": []}} + result = Conformance(conformance)() + + self.assertIsNone(result) + + def test_empty_or_list(self): + """Test OR with empty list""" + conformance = {"type": "mandatory", "condition": {"or": []}} + result = Conformance(conformance)() + + self.assertIsNone(result) + + def test_single_element_and(self): + """Test AND with single element""" + conformance = { + "type": "mandatory", + "condition": {"and": [{"feature": "lighting"}]}, + } + result = Conformance(conformance)() + + self.assertIsNotNone(result) + # Should not have && operator for single element + self.assertNotIn("&&", result) + + def test_single_element_or(self): + """Test OR with single element""" + conformance = { + "type": "mandatory", + "condition": {"or": [{"feature": "lighting"}]}, + } + result = Conformance(conformance)() + + self.assertIsNotNone(result) + # Should not have || operator for single element + self.assertNotIn("||", result) + + def test_and_with_none_subconditions(self): + """Test AND where some subconditions are invalid""" + conformance = { + "type": "mandatory", + "condition": {"and": [{"feature": "lighting"}, {"invalid": "data"}]}, + } + result = Conformance(conformance)() + + # Should still generate code for valid subcondition + self.assertIsNotNone(result) + self.assertIn("has_feature(lighting)", result) + + +def run_tests(): + """Run all tests with verbose output""" + loader = unittest.TestLoader() + suite = loader.loadTestsFromModule(__import__(__name__)) + runner = unittest.TextTestRunner(verbosity=2) + result = runner.run(suite) + return result.wasSuccessful() + + +if __name__ == "__main__": + sys.exit(0 if run_tests() else 1) diff --git a/tools/data_model_gen/tests/test_conformance_extended.py b/tools/data_model_gen/tests/test_conformance_extended.py new file mode 100644 index 000000000..e3000f03b --- /dev/null +++ b/tools/data_model_gen/tests/test_conformance_extended.py @@ -0,0 +1,531 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Extended tests for conformance system — covers conformance.py, conformance_parser.py, +and conformance_codegen.py areas not covered by existing tests. +""" + +import unittest +import sys +import os +from xml.etree.ElementTree import Element, SubElement + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from utils.conformance import ( # noqa: E402 + ConformanceDecision, + get_conformance_type, + Choice, + SUPPORTED_CONFORMANCE_TAGS, +) +from xml_processing.conformance_parser import ( # noqa: E402 + Conformance, + parse_conformance, + parse_choice, + parse_boolean_term, + parse_element_reference, + is_mandatory, + is_restricted_by_conformance, + match_conformance_items, + replace_references, + get_restricted_tags, +) +from utils import config # noqa: E402 + + +# Mock feature for testing +class MockFeature: + def __init__(self, name, code, func_name=None): + self.name = name + self.code = code + self.func_name = func_name or name.lower() + + +class TestGetConformanceType(unittest.TestCase): + """Test get_conformance_type() — all conformance type mappings.""" + + def test_mandatory(self): + self.assertEqual( + get_conformance_type("mandatoryConform"), ConformanceDecision.MANDATORY + ) + self.assertEqual( + get_conformance_type("mandatory"), ConformanceDecision.MANDATORY + ) + + def test_optional(self): + self.assertEqual( + get_conformance_type("optionalConform"), ConformanceDecision.OPTIONAL + ) + self.assertEqual(get_conformance_type("optional"), ConformanceDecision.OPTIONAL) + + def test_otherwise(self): + self.assertEqual( + get_conformance_type("otherwiseConform"), ConformanceDecision.OTHERWISE + ) + + def test_deprecated(self): + self.assertEqual( + get_conformance_type("deprecateConform"), ConformanceDecision.DEPRECATED + ) + self.assertEqual( + get_conformance_type("deprecated"), ConformanceDecision.DEPRECATED + ) + + def test_disallowed(self): + self.assertEqual( + get_conformance_type("disallowConform"), ConformanceDecision.DISALLOWED + ) + self.assertEqual( + get_conformance_type("disallow"), ConformanceDecision.DISALLOWED + ) + + def test_provisional(self): + self.assertEqual( + get_conformance_type("provisionalConform"), ConformanceDecision.PROVISIONAL + ) + self.assertEqual( + get_conformance_type("provisional"), ConformanceDecision.PROVISIONAL + ) + + def test_described(self): + self.assertEqual( + get_conformance_type("describedConform"), ConformanceDecision.DESCRIBED + ) + + def test_unknown(self): + self.assertEqual( + get_conformance_type("unknownConform"), ConformanceDecision.NOT_APPLICABLE + ) + + +class TestSupportedConformanceTags(unittest.TestCase): + """Test that all expected conformance tags are in the set.""" + + def test_all_tags_present(self): + expected = { + "mandatoryConform", + "optionalConform", + "otherwiseConform", + "deprecateConform", + "disallowConform", + "provisionalConform", + "describedConform", + } + self.assertEqual(SUPPORTED_CONFORMANCE_TAGS, expected) + + +class TestChoice(unittest.TestCase): + """Test Choice dataclass.""" + + def test_basic_choice(self): + c = Choice(marker="a", more=False) + self.assertEqual(c.marker, "a") + self.assertFalse(c.more) + + def test_choice_with_more(self): + c = Choice(marker="b", more=True) + self.assertEqual(str(c), "b+") + + def test_choice_to_dict(self): + c = Choice(marker="a", more=True) + d = c.to_dict() + self.assertEqual(d["choice"], "a") + self.assertTrue(d["more"]) + self.assertEqual(d["min"], 1) + + def test_choice_to_dict_no_more(self): + c = Choice(marker="a", more=False) + d = c.to_dict() + self.assertEqual(d["choice"], "a") + self.assertNotIn("more", d) + + def test_none_marker_to_dict(self): + c = Choice(marker=None) + d = c.to_dict() + self.assertNotIn("choice", d) + + +class TestParseChoice(unittest.TestCase): + """Test parse_choice() — XML choice attribute parsing.""" + + def test_none_element(self): + self.assertIsNone(parse_choice(None)) + + def test_with_choice(self): + elem = Element("optionalConform", choice="a") + c = parse_choice(elem) + self.assertIsNotNone(c) + self.assertEqual(c.marker, "a") + + def test_with_more(self): + elem = Element("optionalConform", choice="a", more="true") + c = parse_choice(elem) + self.assertTrue(c.more) + + def test_no_choice_attribute(self): + elem = Element("optionalConform") + c = parse_choice(elem) + self.assertIsNone(c) + + +class TestGetRestrictedTags(unittest.TestCase): + """Test get_restricted_tags() — respects provisional mode.""" + + def test_default_includes_provisional(self): + config.setup_provisional_mode(False) + tags = get_restricted_tags() + self.assertIn("provisionalConform", tags) + self.assertIn("disallowConform", tags) + self.assertIn("deprecateConform", tags) + + def test_provisional_mode_excludes_provisional(self): + config.setup_provisional_mode(True) + tags = get_restricted_tags() + self.assertNotIn("provisionalConform", tags) + self.assertIn("disallowConform", tags) + config.setup_provisional_mode(False) # reset + + +class TestParseConformance(unittest.TestCase): + """Test parse_conformance() — main entry point.""" + + def test_none_element(self): + self.assertIsNone(parse_conformance(None, {})) + + def test_mandatory_conformance(self): + elem = Element("conformance") + SubElement(elem, "mandatoryConform") + result = parse_conformance(elem, {}) + self.assertIsNotNone(result) + self.assertEqual(result.type, ConformanceDecision.MANDATORY) + + def test_optional_conformance(self): + elem = Element("conformance") + SubElement(elem, "optionalConform") + result = parse_conformance(elem, {}) + self.assertIsNotNone(result) + self.assertEqual(result.type, ConformanceDecision.OPTIONAL) + + def test_deprecated_conformance(self): + elem = Element("conformance") + SubElement(elem, "deprecateConform") + result = parse_conformance(elem, {}) + self.assertIsNotNone(result) + self.assertEqual(result.type, ConformanceDecision.DEPRECATED) + + def test_disallowed_conformance(self): + elem = Element("conformance") + SubElement(elem, "disallowConform") + result = parse_conformance(elem, {}) + self.assertIsNotNone(result) + self.assertEqual(result.type, ConformanceDecision.DISALLOWED) + + def test_mandatory_with_feature(self): + feature_map = {"LT": MockFeature("Lighting", "LT", "lighting")} + elem = Element("conformance") + mandatory = SubElement(elem, "mandatoryConform") + SubElement(mandatory, "feature", name="LT") + result = parse_conformance(elem, feature_map) + self.assertIsNotNone(result) + self.assertIsNotNone(result.condition) + + def test_no_matching_tag(self): + elem = Element("conformance") + SubElement(elem, "unknownConform") + result = parse_conformance(elem, {}) + self.assertIsNone(result) + + +class TestConformanceClass(unittest.TestCase): + """Test Conformance class methods.""" + + def test_get_dependent_features_simple(self): + conf = Conformance({}) + condition = {"feature": "lighting"} + features = conf.get_dependent_features(condition) + self.assertEqual(features, ["lighting"]) + + def test_get_dependent_features_and(self): + conf = Conformance({}) + condition = {"and": [{"feature": "a"}, {"feature": "b"}]} + features = conf.get_dependent_features(condition) + self.assertIn("a", features) + self.assertIn("b", features) + + def test_get_dependent_features_not_excluded(self): + conf = Conformance({}) + condition = {"not": {"feature": "excluded"}} + features = conf.get_dependent_features(condition) + self.assertEqual(features, []) + + def test_get_dependent_features_none(self): + conf = Conformance({}) + features = conf.get_dependent_features(None) + self.assertEqual(features, []) + + def test_has_feature(self): + fm = {"LT": MockFeature("Lighting", "LT", "lighting")} + conf = Conformance(fm) + conf.condition = {"feature": "lighting"} + self.assertTrue(conf.has_feature("LT")) + + def test_has_feature_missing(self): + fm = {"LT": MockFeature("Lighting", "LT", "lighting")} + conf = Conformance(fm) + conf.condition = {"feature": "lighting"} + self.assertFalse(conf.has_feature("XX")) + + def test_has_feature_no_condition(self): + fm = {"LT": MockFeature("Lighting", "LT", "lighting")} + conf = Conformance(fm) + conf.condition = None + self.assertFalse(conf.has_feature("LT")) + + def test_to_dict(self): + fm = {} + conf = Conformance(fm) + conf.type = ConformanceDecision.MANDATORY + conf.condition = {"feature": "lighting"} + d = conf.to_dict() + self.assertEqual(d["type"], "mandatory") + self.assertIn("condition", d) + + +class TestParseBooleanTerm(unittest.TestCase): + """Test parse_boolean_term() — AND/OR/NOT parsing.""" + + def test_not_term(self): + elem = Element("notTerm") + SubElement(elem, "feature", name="LT") + fm = {"LT": MockFeature("Lighting", "LT", "lighting")} + result = parse_boolean_term(elem, fm) + self.assertIn("not", result) + + def test_and_term_single_operand(self): + elem = Element("andTerm") + SubElement(elem, "feature", name="LT") + fm = {"LT": MockFeature("Lighting", "LT", "lighting")} + result = parse_boolean_term(elem, fm) + self.assertIn("and", result) + self.assertIsInstance(result["and"], list) + + def test_and_term_multiple_operands(self): + elem = Element("andTerm") + SubElement(elem, "feature", name="LT") + SubElement(elem, "feature", name="CT") + fm = { + "LT": MockFeature("Lighting", "LT", "lighting"), + "CT": MockFeature("ColorTemp", "CT", "color_temp"), + } + result = parse_boolean_term(elem, fm) + self.assertIn("and", result) + self.assertEqual(len(result["and"]), 2) + + def test_or_term(self): + elem = Element("orTerm") + SubElement(elem, "feature", name="LT") + SubElement(elem, "feature", name="CT") + fm = { + "LT": MockFeature("Lighting", "LT", "lighting"), + "CT": MockFeature("ColorTemp", "CT", "color_temp"), + } + result = parse_boolean_term(elem, fm) + self.assertIn("or", result) + + def test_empty_not_returns_none(self): + elem = Element("notTerm") + result = parse_boolean_term(elem, {}) + self.assertIsNone(result) + + +class TestParseElementReference(unittest.TestCase): + """Test parse_element_reference() — feature/attribute/command/condition refs.""" + + def test_feature_reference(self): + elem = Element("feature", name="LT") + fm = {"LT": MockFeature("Lighting", "LT", "lighting")} + result = parse_element_reference(elem, fm) + self.assertIn("feature", result) + self.assertEqual(result["feature"], "lighting") + + def test_attribute_reference(self): + elem = Element("attribute", name="OnOff") + result = parse_element_reference(elem, {}) + self.assertEqual(result, {"attribute": "OnOff"}) + + def test_command_reference(self): + elem = Element("command", name="Toggle") + result = parse_element_reference(elem, {}) + self.assertEqual(result, {"command": "Toggle"}) + + def test_condition_reference(self): + elem = Element("condition", name="Zigbee") + result = parse_element_reference(elem, {}) + self.assertEqual(result, {"condition": "Zigbee"}) + + def test_unknown_feature_returns_none(self): + elem = Element("feature", name="UNKNOWN") + result = parse_element_reference(elem, {}) + self.assertIsNone(result) + + def test_unknown_tag_returns_none(self): + elem = Element("unknown", name="something") + result = parse_element_reference(elem, {}) + self.assertIsNone(result) + + +class TestIsMandatory(unittest.TestCase): + """Test is_mandatory() — XML conformance mandatory check.""" + + def test_mandatory(self): + elem = Element("conformance") + SubElement(elem, "mandatoryConform") + self.assertTrue(is_mandatory(elem)) + + def test_not_mandatory(self): + elem = Element("conformance") + SubElement(elem, "optionalConform") + self.assertFalse(is_mandatory(elem)) + + def test_otherwise_mandatory(self): + elem = Element("conformance") + otherwise = SubElement(elem, "otherwiseConform") + SubElement(otherwise, "mandatoryConform") + self.assertTrue(is_mandatory(elem)) + + +class TestIsRestrictedByConformance(unittest.TestCase): + """Test is_restricted_by_conformance() — element filtering.""" + + def test_no_conformance(self): + elem = Element("attribute", name="test") + self.assertFalse(is_restricted_by_conformance({}, elem)) + + def test_deprecated_element(self): + elem = Element("attribute", name="test") + SubElement(elem, "deprecateConform") + self.assertTrue(is_restricted_by_conformance({}, elem)) + + def test_disallowed_element(self): + elem = Element("attribute", name="test") + SubElement(elem, "disallowConform") + self.assertTrue(is_restricted_by_conformance({}, elem)) + + def test_zigbee_specific_skipped(self): + elem = Element("attribute", name="test") + optional = SubElement(elem, "optionalConform") + SubElement(optional, "condition", name="Zigbee") + self.assertTrue(is_restricted_by_conformance({}, elem)) + + def test_missing_feature_skipped(self): + elem = Element("attribute", name="test") + mandatory = SubElement(elem, "mandatoryConform") + SubElement(mandatory, "feature", name="MISSING") + self.assertTrue(is_restricted_by_conformance({}, elem)) + + def test_present_feature_not_skipped(self): + elem = Element("attribute", name="test") + mandatory = SubElement(elem, "mandatoryConform") + SubElement(mandatory, "feature", name="LT") + fm = {"LT": MockFeature("Lighting", "LT")} + self.assertFalse(is_restricted_by_conformance(fm, elem)) + + +class TestReplaceReferences(unittest.TestCase): + """Test replace_references() — attribute/command name replacement.""" + + def test_attribute_reference(self): + condition = {"attribute": "OnOff"} + result = replace_references(condition, {}) + self.assertEqual(result, {"attribute": "OnOff"}) + + def test_command_reference_with_map(self): + condition = {"command": "Toggle"} + ref_map = {"Toggle": ("0x0002", "COMMAND_FLAG_ACCEPTED")} + result = replace_references(condition, ref_map) + self.assertEqual(result["command"], "Toggle") + self.assertEqual(result["flag"], "COMMAND_FLAG_ACCEPTED") + + def test_nested_condition(self): + condition = {"and": [{"feature": "a"}, {"feature": "b"}]} + result = replace_references(condition, {}) + self.assertEqual(len(result["and"]), 2) + + def test_list_condition(self): + condition = [{"feature": "a"}, {"feature": "b"}] + result = replace_references(condition, {}) + self.assertEqual(len(result), 2) + + def test_scalar_passthrough(self): + self.assertEqual(replace_references("test", {}), "test") + self.assertEqual(replace_references(42, {}), 42) + + +class TestMatchConformanceItems(unittest.TestCase): + """Test match_conformance_items() — feature-to-item matching.""" + + def test_no_conformance(self): + class MockItem: + conformance = None + + feature = MockFeature("Lighting", "LT", "lighting") + result = match_conformance_items(feature, [MockItem()]) + self.assertEqual(result, []) + + def test_mandatory_match(self): + class MockItem: + pass + + item = MockItem() + fm = {"LT": MockFeature("Lighting", "LT", "lighting")} + conf = Conformance(fm) + conf.type = ConformanceDecision.MANDATORY + conf.condition = {"feature": "lighting"} + item.conformance = conf + feature = MockFeature("Lighting", "LT", "lighting") + result = match_conformance_items(feature, [item]) + self.assertEqual(len(result), 1) + + def test_no_match(self): + class MockItem: + pass + + item = MockItem() + fm = {"CT": MockFeature("ColorTemp", "CT", "color_temp")} + conf = Conformance(fm) + conf.type = ConformanceDecision.MANDATORY + conf.condition = {"feature": "color_temp"} + item.conformance = conf + feature = MockFeature("Lighting", "LT", "lighting") + result = match_conformance_items(feature, [item]) + self.assertEqual(len(result), 0) + + +class TestConformanceDecision(unittest.TestCase): + """Test ConformanceDecision enum.""" + + def test_to_string(self): + self.assertEqual(ConformanceDecision.MANDATORY.to_string(), "mandatory") + self.assertEqual(ConformanceDecision.OPTIONAL.to_string(), "optional") + self.assertEqual(ConformanceDecision.DISALLOWED.to_string(), "disallowed") + self.assertEqual(ConformanceDecision.DEPRECATED.to_string(), "deprecated") + self.assertEqual(ConformanceDecision.PROVISIONAL.to_string(), "provisional") + + def test_all_values_unique(self): + values = [e.value for e in ConformanceDecision] + self.assertEqual(len(values), len(set(values))) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/tests/test_conformance_parser.py b/tools/data_model_gen/tests/test_conformance_parser.py new file mode 100644 index 000000000..9474d5869 --- /dev/null +++ b/tools/data_model_gen/tests/test_conformance_parser.py @@ -0,0 +1,706 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Comprehensive test suite for conformance parsing based on real XML examples +from connectedhomeip/data_model/1.5/clusters/ +""" + +import sys +import os + +# Add parent directory to path for imports +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + +import unittest # noqa: E402 +import xml.etree.ElementTree as ET # noqa: E402 +import json # noqa: E402 +from xml_processing.conformance_parser import ( # noqa: E402 + parse_conformance, + Conformance, + is_restricted_by_conformance, + match_conformance_items, +) +from utils.helper import convert_to_snake_case # noqa: E402 +from utils.conformance import ConformanceDecision # noqa: E402 + + +class MockFeature: + """Mock feature object for testing""" + + def __init__(self, name, code): + self.name = name + self.code = code + self.func_name = convert_to_snake_case(name) + + +class MockItem: + """Mock item (attribute/command/event) for testing conformance matching""" + + def __init__(self, name, conformance=None): + self.name = name + self.conformance = conformance + + +class TestBasicConformance(unittest.TestCase): + """Test basic conformance types without conditions""" + + def test_simple_mandatory_conformance(self): + """Test parsing simple tags""" + xml = "" + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + self.assertIsNotNone(result) + self.assertEqual(result.type, ConformanceDecision.MANDATORY) + self.assertIsNone(result.condition) + + def test_simple_optional_conformance(self): + """Test parsing simple tags""" + xml = "" + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + self.assertIsNotNone(result) + self.assertEqual(result.type, ConformanceDecision.OPTIONAL) + self.assertIsNone(result.condition) + + def test_simple_deprecated_conformance(self): + """Test parsing simple tags""" + xml = "" + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + self.assertIsNotNone(result) + self.assertEqual(result.type, ConformanceDecision.DEPRECATED) + + def test_simple_disallowed_conformance(self): + """Test parsing simple tags""" + xml = "" + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + self.assertIsNotNone(result) + self.assertEqual(result.type, ConformanceDecision.DISALLOWED) + + def test_simple_provisional_conformance(self): + """Test parsing simple tags""" + xml = "" + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + self.assertIsNotNone(result) + self.assertEqual(result.type, ConformanceDecision.PROVISIONAL) + + +class TestChoiceConformance(unittest.TestCase): + """Test choice conformance patterns from OccupancySensing cluster""" + + def test_choice_conformance_with_min_and_more(self): + """Test: + From OccupancySensing features - at least 1 sensing method required""" + xml = '' + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.OPTIONAL) + self.assertEqual(result.choice.marker, "a") + self.assertTrue(result.choice.more) + + def test_choice_conformance_serialization(self): + """Test JSON serialization of choice conformance""" + xml = '' + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + dict_result = result.to_dict() + + self.assertEqual(dict_result["type"], "optional") + self.assertEqual(dict_result["choice"], "a") + self.assertTrue(dict_result["more"]) + self.assertEqual(dict_result["min"], 1) + + +class TestFeatureBasedConformance(unittest.TestCase): + """Test feature-based conformance patterns""" + + def test_mandatory_with_single_feature(self): + """Test: + From OnOff cluster commands""" + xml = """ + + """ + elem = ET.fromstring(xml) + feature_map = {"LT": MockFeature("Lighting", "LT")} + result = Conformance(feature_map).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.MANDATORY) + self.assertIsNotNone(result.condition) + self.assertEqual(result.condition, {"feature": "lighting"}) + + def test_mandatory_with_or_features(self): + """Test: + From ColorControl cluster""" + xml = """ + + + + + + """ + elem = ET.fromstring(xml) + feature_map = { + "HS": MockFeature("HueSaturation", "HS"), + "XY": MockFeature("XY", "XY"), + "CT": MockFeature("ColorTemperature", "CT"), + } + result = Conformance(feature_map).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.MANDATORY) + self.assertIn("or", result.condition) + self.assertEqual(len(result.condition["or"]), 3) + + def test_optional_with_not_feature(self): + """Test: + From OnOff cluster - LT feature""" + xml = """ + + + + """ + elem = ET.fromstring(xml) + feature_map = {"OFFONLY": MockFeature("OffOnly", "OFFONLY")} + result = Conformance(feature_map).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.OPTIONAL) + self.assertIn("not", result.condition) + self.assertEqual(result.condition["not"]["feature"], "off_only") + + def test_nested_not_or_features(self): + """Test: + From OnOff cluster - OFFONLY feature""" + xml = """ + + + + + + + """ + elem = ET.fromstring(xml) + feature_map = { + "LT": MockFeature("Lighting", "LT"), + "DF": MockFeature("DeadFrontBehavior", "DF"), + } + result = Conformance(feature_map).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.OPTIONAL) + self.assertIn("not", result.condition) + self.assertIn("or", result.condition["not"]) + + def test_mandatory_with_not_feature(self): + """Test: + From OnOff cluster - On/Toggle commands""" + xml = """ + + + + """ + elem = ET.fromstring(xml) + feature_map = {"OFFONLY": MockFeature("OffOnly", "OFFONLY")} + result = Conformance(feature_map).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.MANDATORY) + self.assertIn("not", result.condition) + + +class TestAttributeCommandConformance(unittest.TestCase): + """Test conformance based on attributes and commands""" + + def test_attribute_reference(self): + """Test: """ + xml = """ + + """ + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.MANDATORY) + self.assertEqual(result.condition, {"attribute": "OnOff"}) + + def test_command_reference(self): + """Test: """ + xml = """ + + """ + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.MANDATORY) + self.assertEqual(result.condition, {"command": "Off"}) + + def test_attribute_or_command(self): + """Test OR of attributes/commands""" + xml = """ + + + + + """ + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.MANDATORY) + self.assertIn("or", result.condition) + + +class TestOtherwiseConformance(unittest.TestCase): + """Test otherwise conformance patterns""" + + def test_otherwise_with_mandatory_and_deprecated(self): + """Test: + From OccupancySensing cluster""" + xml = """ + + + """ + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.OTHERWISE) + self.assertIn("mandatory", result.condition) + self.assertIn("deprecated", result.condition) + + def test_otherwise_with_provisional_and_mandatory(self): + """Test: + From BasicInformation cluster""" + xml = """ + + + """ + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.OTHERWISE) + self.assertIn("provisional", result.condition) + self.assertIn("mandatory", result.condition) + + def test_otherwise_with_conditional_mandatory(self): + """Test otherwise with mandatory that has conditions""" + xml = """ + + + + + + + + """ + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.OTHERWISE) + self.assertIn("mandatory", result.condition) + self.assertIn("optional", result.condition) + + def test_otherwise_with_optional_choice(self): + """Test otherwise with optional that has choice attributes""" + xml = """ + + + + + """ + elem = ET.fromstring(xml) + feature_map = { + "LT": MockFeature("Lighting", "LT"), + "AUTO": MockFeature("Auto", "AUTO"), + } + result = Conformance(feature_map).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.OTHERWISE) + self.assertIn("optional", result.condition) + self.assertEqual(result.condition["optional"]["choice"], "a") + self.assertTrue(result.condition["optional"]["more"]) + self.assertEqual(result.condition["optional"]["min"], 1) + + +class TestComplexNestedConformance(unittest.TestCase): + """Test complex nested conformance structures""" + + def test_and_of_features(self): + """Test AND operation with multiple features""" + xml = """ + + + + + """ + elem = ET.fromstring(xml) + feature_map = { + "LT": MockFeature("Lighting", "LT"), + "DF": MockFeature("DeadFrontBehavior", "DF"), + } + result = Conformance(feature_map).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.MANDATORY) + self.assertIn("and", result.condition) + self.assertEqual(len(result.condition["and"]), 2) + + def test_complex_nested_boolean_operations(self): + """Test complex nested: AND(OR(...), NOT(...))""" + xml = """ + + + + + + + + + + """ + elem = ET.fromstring(xml) + feature_map = { + "HS": MockFeature("HueSaturation", "HS"), + "XY": MockFeature("XY", "XY"), + "OFFONLY": MockFeature("OffOnly", "OFFONLY"), + } + result = Conformance(feature_map).parse(elem) + + self.assertEqual(result.type, ConformanceDecision.MANDATORY) + self.assertIn("and", result.condition) + # Check that we have both OR and NOT in the AND + and_elements = result.condition["and"] + has_or = any( + "or" in elem if isinstance(elem, dict) else False for elem in and_elements + ) + has_not = any( + "not" in elem if isinstance(elem, dict) else False for elem in and_elements + ) + self.assertTrue(has_or and has_not) + + def test_implicit_and_of_multiple_features(self): + """Test implicit AND when multiple features at same level""" + xml = """ + + + """ + elem = ET.fromstring(xml) + feature_map = { + "LT": MockFeature("Lighting", "LT"), + "DF": MockFeature("DeadFrontBehavior", "DF"), + } + result = Conformance(feature_map).parse(elem) + + # Multiple features at same level should be implicitly AND-ed + self.assertEqual(result.type, ConformanceDecision.MANDATORY) + if result.condition: + self.assertTrue("and" in result.condition or "feature" in result.condition) + + +class TestConformanceRestrictions(unittest.TestCase): + """Test is_restricted_by_conformance function""" + + def test_skip_disallowed_conformance(self): + """Test that disallowed elements are flagged for skipping""" + xml = """ + + """ + elem = ET.fromstring(xml) + should_skip = is_restricted_by_conformance({}, elem) + self.assertTrue(should_skip) + + def test_skip_deprecated_conformance(self): + """Test that deprecated elements are flagged for skipping""" + xml = """ + + """ + elem = ET.fromstring(xml) + should_skip = is_restricted_by_conformance({}, elem) + self.assertTrue(should_skip) + + def test_skip_provisional_conformance(self): + """Test that provisional elements are flagged for skipping""" + xml = """ + + """ + elem = ET.fromstring(xml) + should_skip = is_restricted_by_conformance({}, elem) + self.assertTrue(should_skip) + + def test_skip_otherwise_with_provisional_first(self): + """Test that otherwise conformance with provisional first is skipped""" + xml = """ + + + + + """ + elem = ET.fromstring(xml) + should_skip = is_restricted_by_conformance({}, elem) + self.assertTrue(should_skip) + + def test_skip_missing_feature_in_mandatory(self): + """Test skipping when mandatory conformance references non-existent feature""" + xml = """ + + + + + + + """ + elem = ET.fromstring(xml) + feature_map = {"LT": MockFeature("Lighting", "LT")} # NONEXISTENT not in map + should_skip = is_restricted_by_conformance(feature_map, elem) + self.assertTrue(should_skip) + + def test_dont_skip_valid_mandatory(self): + """Test that valid mandatory conformance is not skipped""" + xml = """ + + """ + elem = ET.fromstring(xml) + should_skip = is_restricted_by_conformance({}, elem) + self.assertFalse(should_skip) + + def test_skip_zigbee_specific(self): + """Test that Zigbee-specific optional conformance is skipped""" + xml = """ + + + + """ + elem = ET.fromstring(xml) + should_skip = is_restricted_by_conformance({}, elem) + self.assertTrue(should_skip) + + +class TestConformanceSerialization(unittest.TestCase): + """Test JSON serialization of conformance objects""" + + def test_to_dict_basic(self): + """Test basic to_dict conversion""" + xml = "" + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + dict_result = result.to_dict() + + self.assertEqual(dict_result["type"], "mandatory") + + def test_to_dict_with_condition(self): + """Test to_dict with conditions""" + xml = """ + + """ + elem = ET.fromstring(xml) + feature_map = {"LT": MockFeature("Lighting", "LT")} + result = Conformance(feature_map).parse(elem) + dict_result = result.to_dict() + + self.assertIn("condition", dict_result) + self.assertIsNotNone(dict_result["condition"]) + + def test_to_dict_with_attribute_map(self): + """Test to_dict with attribute name to ID mapping""" + xml = """ + + + + + """ + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + # Without attribute map + dict_without_map = result.to_dict() + self.assertEqual(dict_without_map["condition"]["or"][0]["attribute"], "OnOff") + + # With attribute map - should replace names with IDs + attribute_map = {"OnOff": "OnOff", "LevelControl": "LevelControl"} + dict_with_map = result.to_dict(attribute_map) + self.assertEqual(dict_with_map["condition"]["or"][0]["attribute"], "OnOff") + self.assertEqual( + dict_with_map["condition"]["or"][1]["attribute"], "LevelControl" + ) + + def test_to_dict_with_command_map(self): + """Test to_dict with command name to ID/flag mapping""" + xml = """ + + """ + elem = ET.fromstring(xml) + result = Conformance({}).parse(elem) + + # With command map (stored as tuple with flag) + command_map = {"Off": ("Off", "COMMAND_FLAG_ACCEPTED")} + dict_with_map = result.to_dict(command_map) + self.assertEqual(dict_with_map["condition"]["command"], "Off") + self.assertEqual(dict_with_map["condition"]["flag"], "COMMAND_FLAG_ACCEPTED") + + def test_to_dict_json_serializable(self): + """Test that to_dict output is JSON serializable""" + xml = """ + + + + + """ + elem = ET.fromstring(xml) + feature_map = { + "LT": MockFeature("Lighting", "LT"), + "DF": MockFeature("DeadFrontBehavior", "DF"), + } + result = Conformance(feature_map).parse(elem) + dict_result = result.to_dict() + + # Should not raise exception + json_str = json.dumps(dict_result) + self.assertIsNotNone(json_str) + + +class TestMatchConformanceItems(unittest.TestCase): + """Test matching items with feature conformance""" + + def test_match_mandatory_feature(self): + """Test matching items with mandatory feature conformance""" + # Create a feature + feature = MockFeature("Lighting", "LT") + + # Create conformance that requires this feature + xml = """ + + """ + elem = ET.fromstring(xml) + feature_map = {"LT": feature} + conformance = Conformance(feature_map).parse(elem) + + # Create items with this conformance + item1 = MockItem("OnCommand", conformance) + item2 = MockItem("OffCommand", None) + + items = [item1, item2] + matched = match_conformance_items(feature, items) + + self.assertEqual(len(matched), 1) + self.assertEqual(matched[0].name, "OnCommand") + + def test_match_otherwise_mandatory_feature(self): + """Test matching items with otherwise conformance containing mandatory feature""" + feature = MockFeature("Lighting", "LT") + + # Create otherwise conformance + xml = """ + + + + + """ + elem = ET.fromstring(xml) + feature_map = {"LT": feature} + conformance = Conformance(feature_map).parse(elem) + + item = MockItem("LightingCommand", conformance) + items = [item] + matched = match_conformance_items(feature, items) + + # Should match if otherwise has mandatory with this feature + # Note: Current implementation checks for condition.get("mandatory") + self.assertGreaterEqual(len(matched), 0) + + +class TestConformanceHasFeature(unittest.TestCase): + """Test has_feature method on Conformance objects""" + + def test_has_feature_simple(self): + """Test has_feature with simple feature conformance""" + xml = """ + + """ + elem = ET.fromstring(xml) + feature = MockFeature("Lighting", "LT") + feature_map = {"LT": feature} + conformance = Conformance(feature_map).parse(elem) + + self.assertTrue(conformance.has_feature("LT")) + self.assertFalse(conformance.has_feature("DF")) + + def test_has_feature_in_or(self): + """Test has_feature when feature is in OR term""" + xml = """ + + + + + """ + elem = ET.fromstring(xml) + feature_map = { + "LT": MockFeature("Lighting", "LT"), + "DF": MockFeature("DeadFrontBehavior", "DF"), + } + conformance = Conformance(feature_map).parse(elem) + + self.assertTrue(conformance.has_feature("LT")) + self.assertTrue(conformance.has_feature("DF")) + + def test_has_feature_in_and(self): + """Test has_feature when feature is in AND term""" + xml = """ + + + + + """ + elem = ET.fromstring(xml) + feature_map = { + "LT": MockFeature("Lighting", "LT"), + "DF": MockFeature("DeadFrontBehavior", "DF"), + } + conformance = Conformance(feature_map).parse(elem) + + self.assertTrue(conformance.has_feature("LT")) + self.assertTrue(conformance.has_feature("DF")) + + +class TestConformanceParsing(unittest.TestCase): + """Test parsing of conformance elements""" + + def test_parse_mandatory_conformance(self): + """Test parsing of mandatory conformance""" + xml = """ + + + + + """ + elem = ET.fromstring(xml) + feature_map = {"OCC": MockFeature("Occupancy", "OCC")} + conformance = parse_conformance(elem, feature_map) + self.assertEqual(conformance.type, ConformanceDecision.MANDATORY) + self.assertEqual(conformance.condition, {"feature": "occupancy"}) + + +def run_tests(): + """Run all tests with verbose output""" + loader = unittest.TestLoader() + suite = loader.loadTestsFromModule(__import__(__name__)) + runner = unittest.TextTestRunner(verbosity=2) + result = runner.run(suite) + return result.wasSuccessful() + + +if __name__ == "__main__": + import sys + + sys.exit(0 if run_tests() else 1) diff --git a/tools/data_model_gen/tests/test_conversion_utils.py b/tools/data_model_gen/tests/test_conversion_utils.py new file mode 100644 index 000000000..5f86fb4ef --- /dev/null +++ b/tools/data_model_gen/tests/test_conversion_utils.py @@ -0,0 +1,120 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Tests for utils/conversion_utils.py — hex/int conversions and validation.""" + +import unittest +import sys +import os + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from utils.conversion_utils import ( # noqa: E402 + convert_to_int, + format_hex_value, + hex_to_int, + is_hex_value, +) + + +class TestConvertToInt(unittest.TestCase): + """Test convert_to_int() — flexible integer conversion.""" + + def test_hex_string(self): + self.assertEqual(convert_to_int("0x0A"), 10) + + def test_decimal_string(self): + self.assertEqual(convert_to_int("200"), 200) + + def test_int_passthrough(self): + self.assertEqual(convert_to_int(42), 42) + + def test_none_returns_default(self): + self.assertEqual(convert_to_int(None, default=0), 0) + + def test_none_returns_none(self): + self.assertIsNone(convert_to_int(None)) + + def test_invalid_string_returns_default(self): + self.assertEqual(convert_to_int("abc", default=0), 0) + + def test_float_returns_default(self): + self.assertIsNone(convert_to_int(3.14)) + + def test_zero(self): + self.assertEqual(convert_to_int("0"), 0) + + def test_negative(self): + self.assertEqual(convert_to_int("-5"), -5) + + +class TestHexToInt(unittest.TestCase): + """Test hex_to_int() — hex string to integer conversion.""" + + def test_hex_string(self): + self.assertEqual(hex_to_int("0x0A"), 10) + + def test_int_passthrough(self): + self.assertEqual(hex_to_int(42), 42) + + def test_list_conversion(self): + result = hex_to_int(["0x01", "0x0A"]) + self.assertEqual(result, [1, 10]) + + def test_non_hex_string(self): + self.assertEqual(hex_to_int("FF"), 255) + + def test_other_type(self): + self.assertIsNone(hex_to_int(None)) + + +class TestIsHexValue(unittest.TestCase): + """Test is_hex_value() — hex string validation.""" + + def test_valid_hex_with_prefix(self): + self.assertTrue(is_hex_value("0x0001")) + + def test_valid_hex_without_prefix(self): + self.assertTrue(is_hex_value("FF")) + + def test_invalid_hex(self): + self.assertFalse(is_hex_value("0xGGGG")) + + def test_decimal_as_hex(self): + self.assertTrue(is_hex_value("123")) + + +class TestFormatHexValue(unittest.TestCase): + """Test format_hex_value() — normalize hex formatting.""" + + def test_long_hex(self): + self.assertEqual(format_hex_value("0x00000001"), "0x0001") + + def test_short_hex(self): + self.assertEqual(format_hex_value("0x01"), "0x0001") + + def test_already_formatted(self): + self.assertEqual(format_hex_value("0x0001"), "0x0001") + + def test_large_value(self): + self.assertEqual(format_hex_value("0xFFFF"), "0xFFFF") + + def test_non_hex(self): + self.assertEqual(format_hex_value("hello"), "hello") + + def test_none(self): + self.assertIsNone(format_hex_value(None)) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/tests/test_data_type_parser.py b/tools/data_model_gen/tests/test_data_type_parser.py new file mode 100644 index 000000000..1165eddc9 --- /dev/null +++ b/tools/data_model_gen/tests/test_data_type_parser.py @@ -0,0 +1,435 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Tests for xml_processing/data_type_parser.py — type resolution, bounds, data types.""" + +import unittest +import sys +import os +from xml.etree.ElementTree import Element, SubElement + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from xml_processing.data_type_parser import ( # noqa: E402 + resolve_attribute_type, + resolve_attribute_bounds, + _fallback_unknown_type, + _override_type_by_default_value, + _default_bounds_by_type, + _normalize_bounds, + _bounds_from_constraint, + _infer_type_by_count, + INT_BOUNDS, + Item, + Enum, + Bitmap, + Struct, + DataTypeParser, +) +from utils.exceptions import XmlParseError # noqa: E402 + + +class TestIntBounds(unittest.TestCase): + """Test INT_BOUNDS constant correctness.""" + + def test_uint8_bounds(self): + self.assertEqual(INT_BOUNDS["uint8"], (0, 254)) + + def test_uint16_bounds(self): + self.assertEqual(INT_BOUNDS["uint16"], (0, 65534)) + + def test_uint32_bounds(self): + self.assertEqual(INT_BOUNDS["uint32"], (0, 2**32 - 2)) + + def test_uint64_bounds(self): + self.assertEqual(INT_BOUNDS["uint64"], (0, 2**32 - 2)) + + def test_int8_bounds(self): + self.assertEqual(INT_BOUNDS["int8"], (-128, 126)) + + def test_int16_bounds(self): + self.assertEqual(INT_BOUNDS["int16"], (-32768, 32766)) + + def test_int32_bounds(self): + self.assertEqual(INT_BOUNDS["int32"], (-(2**31), 2**31 - 2)) + + def test_int64_bounds(self): + self.assertEqual(INT_BOUNDS["int64"], (-(2**31), 2**31 - 2)) + + +class TestResolveAttributeType(unittest.TestCase): + """Test resolve_attribute_type() — XML type to C type resolution.""" + + def test_basic_type(self): + elem = Element("attribute", type="uint8") + result = resolve_attribute_type(elem, {"uint8": "uint8"}) + self.assertEqual(result, "uint8") + + def test_type_with_space(self): + elem = Element("attribute", type="uint8 some extra") + result = resolve_attribute_type(elem, {"uint8": "uint8"}) + self.assertEqual(result, "uint8") + + def test_none_type_raises(self): + elem = Element("attribute") + with self.assertRaises(XmlParseError): + resolve_attribute_type(elem, {}) + + def test_unknown_type_fallback(self): + elem = Element("attribute", type="CustomBitmapType") + result = resolve_attribute_type(elem, {}) + self.assertEqual(result, "bitmap8") + + def test_enum_widening_by_default_value(self): + elem = Element("attribute", type="enum8", default="0x100") + result = resolve_attribute_type(elem, {"enum8": "enum8"}) + self.assertEqual(result, "enum16") + + +class TestFallbackUnknownType(unittest.TestCase): + """Test _fallback_unknown_type() — fallback for unrecognized types.""" + + def test_bitmap_fallback(self): + self.assertEqual(_fallback_unknown_type("someBitmapType"), "bitmap8") + + def test_enum_fallback(self): + self.assertEqual(_fallback_unknown_type("myEnumType"), "enum8") + + def test_struct_fallback(self): + self.assertEqual(_fallback_unknown_type("MyStructType"), "list") + + def test_unknown_passthrough(self): + self.assertEqual(_fallback_unknown_type("custom"), "custom") + + +class TestOverrideTypeByDefaultValue(unittest.TestCase): + """Test _override_type_by_default_value() — enum/bitmap widening.""" + + def test_no_default(self): + elem = Element("attribute", type="enum8") + self.assertEqual(_override_type_by_default_value(elem, "enum8"), "enum8") + + def test_enum8_to_enum16(self): + elem = Element("attribute", type="enum8", default="0x100") + self.assertEqual(_override_type_by_default_value(elem, "enum8"), "enum16") + + def test_bitmap8_to_bitmap16(self): + elem = Element("attribute", type="bitmap8", default="0x100") + self.assertEqual(_override_type_by_default_value(elem, "bitmap8"), "bitmap16") + + def test_no_widening_needed(self): + elem = Element("attribute", type="enum8", default="0x0A") + self.assertEqual(_override_type_by_default_value(elem, "enum8"), "enum8") + + def test_decimal_default(self): + elem = Element("attribute", type="enum8", default="256") + self.assertEqual(_override_type_by_default_value(elem, "enum8"), "enum16") + + def test_non_numeric_default(self): + elem = Element("attribute", type="enum8", default="auto") + self.assertEqual(_override_type_by_default_value(elem, "enum8"), "enum8") + + +class TestDefaultBoundsByType(unittest.TestCase): + """Test _default_bounds_by_type() — applies default bounds from INT_BOUNDS.""" + + def _make_attr(self, type_, min_val=None, max_val=None): + class FakeAttr: + pass + + a = FakeAttr() + a.type = type_ + a.min_value = min_val + a.max_value = max_val + return a + + def test_uint8_default_bounds(self): + attr = self._make_attr("uint8") + _default_bounds_by_type(attr) + self.assertEqual(attr.min_value, 0) + self.assertEqual(attr.max_value, 254) + + def test_uint32_default_bounds(self): + attr = self._make_attr("uint32") + _default_bounds_by_type(attr) + self.assertEqual(attr.min_value, 0) + self.assertEqual(attr.max_value, 2**32 - 2) + + def test_int16_default_bounds(self): + attr = self._make_attr("int16") + _default_bounds_by_type(attr) + self.assertEqual(attr.min_value, -32768) + self.assertEqual(attr.max_value, 32766) + + def test_preserves_existing_bounds(self): + attr = self._make_attr("uint16", min_val=10, max_val=100) + _default_bounds_by_type(attr) + self.assertEqual(attr.min_value, 10) + self.assertEqual(attr.max_value, 100) + + def test_unknown_type_no_bounds(self): + attr = self._make_attr("string") + _default_bounds_by_type(attr) + self.assertIsNone(attr.min_value) + self.assertIsNone(attr.max_value) + + +class TestNormalizeBounds(unittest.TestCase): + """Test _normalize_bounds() — hex/string to int conversion.""" + + def _make_attr(self, min_val, max_val): + class FakeAttr: + pass + + a = FakeAttr() + a.min_value = min_val + a.max_value = max_val + return a + + def test_hex_string(self): + attr = self._make_attr("0x0A", "0xFF") + _normalize_bounds(attr) + self.assertEqual(attr.min_value, 10) + self.assertEqual(attr.max_value, 255) + + def test_non_digit_string(self): + attr = self._make_attr("abc", None) + _normalize_bounds(attr) + self.assertIsNone(attr.min_value) + + def test_negative_digit_string(self): + attr = self._make_attr("-100", "100") + _normalize_bounds(attr) + # Negative digit strings should be kept (they pass lstrip("-").isdigit()) + self.assertEqual(attr.min_value, "-100") + + def test_none_preserved(self): + attr = self._make_attr(None, None) + _normalize_bounds(attr) + self.assertIsNone(attr.min_value) + + def test_int_preserved(self): + attr = self._make_attr(10, 100) + _normalize_bounds(attr) + self.assertEqual(attr.min_value, 10) + self.assertEqual(attr.max_value, 100) + + +class TestBoundsFromConstraint(unittest.TestCase): + """Test _bounds_from_constraint() — XML constraint parsing.""" + + def _make_attr(self): + class FakeAttr: + pass + + a = FakeAttr() + a.min_value = None + a.max_value = None + a.type = "uint16" + return a + + def test_min_max_constraint(self): + attr = self._make_attr() + elem = Element("attribute") + constraint = SubElement(elem, "constraint") + SubElement(constraint, "min", value="10") + SubElement(constraint, "max", value="100") + _bounds_from_constraint(attr, elem) + self.assertEqual(attr.min_value, "10") + self.assertEqual(attr.max_value, "100") + + def test_between_constraint(self): + attr = self._make_attr() + elem = Element("attribute") + constraint = SubElement(elem, "constraint") + between = SubElement(constraint, "between") + SubElement(between, "from", value="5") + SubElement(between, "to", value="50") + _bounds_from_constraint(attr, elem) + self.assertEqual(attr.min_value, "5") + self.assertEqual(attr.max_value, "50") + + def test_max_length_constraint(self): + attr = self._make_attr() + elem = Element("attribute") + constraint = SubElement(elem, "constraint") + SubElement(constraint, "maxLength", value="254") + _bounds_from_constraint(attr, elem) + self.assertEqual(attr.min_value, 0) + self.assertEqual(attr.max_value, "254") + + def test_no_constraint(self): + attr = self._make_attr() + elem = Element("attribute") + _bounds_from_constraint(attr, elem) + self.assertIsNone(attr.min_value) + self.assertIsNone(attr.max_value) + + +class TestResolveAttributeBounds(unittest.TestCase): + """Test resolve_attribute_bounds() — full bounds resolution pipeline.""" + + def _make_attr(self, type_): + class FakeAttr: + pass + + a = FakeAttr() + a.type = type_ + a.min_value = None + a.max_value = None + return a + + def test_enum_bounds_from_items(self): + attr = self._make_attr("enum8") + elem = Element("attribute", type="testenum") + items = [ + Item("A", "0", "", True), + Item("B", "1", "", True), + Item("C", "2", "", True), + ] + data_types = {"enums": {"testenum": Enum("TestEnum", "enum8", items)}} + resolve_attribute_bounds(attr, elem, data_types) + self.assertEqual(attr.min_value, 0) + self.assertEqual(attr.max_value, 2) + + def test_bitmap_bounds_from_bitfields(self): + attr = self._make_attr("bitmap8") + elem = Element("attribute", type="testbitmap") + fields = [ + Item("A", "0", "", True), + Item("B", "1", "", True), + Item("C", "2", "", True), + ] + data_types = { + "bitmaps": {"testbitmap": Bitmap("TestBitmap", "bitmap8", fields)} + } + resolve_attribute_bounds(attr, elem, data_types) + self.assertEqual(attr.min_value, 0) + self.assertEqual(attr.max_value, 7) # 2^3 - 1 + + def test_uint8_default_bounds(self): + attr = self._make_attr("uint8") + elem = Element("attribute", type="uint8") + resolve_attribute_bounds(attr, elem, {}) + self.assertEqual(attr.min_value, 0) + self.assertEqual(attr.max_value, 254) + + +class TestInferTypeByCount(unittest.TestCase): + """Test _infer_type_by_count() — enum/bitmap size inference.""" + + def test_small_enum(self): + self.assertEqual(_infer_type_by_count(5, "enum", (256, 65536)), "enum8") + + def test_medium_enum(self): + self.assertEqual(_infer_type_by_count(300, "enum", (256, 65536)), "enum16") + + def test_large_enum(self): + self.assertEqual(_infer_type_by_count(70000, "enum", (256, 65536)), "enum32") + + def test_small_bitmap(self): + self.assertEqual(_infer_type_by_count(5, "bitmap"), "bitmap8") + + def test_medium_bitmap(self): + self.assertEqual(_infer_type_by_count(10, "bitmap"), "bitmap16") + + +class TestDataClasses(unittest.TestCase): + """Test Item, Enum, Bitmap, Struct data classes.""" + + def test_item_to_dict(self): + item = Item("TestItem", "0x01", "A test item", True) + d = item.to_dict() + self.assertEqual(d["name"], "TestItem") + self.assertEqual(d["value"], "0x01") + self.assertTrue(d["is_mandatory"]) + + def test_enum_to_dict(self): + items = [Item("A", "0", "", True)] + e = Enum("TestEnum", "enum8", items) + d = e.to_dict() + self.assertEqual(d["name"], "TestEnum") + self.assertEqual(d["base_type"], "enum8") + self.assertEqual(len(d["items"]), 1) + + def test_bitmap_to_dict(self): + fields = [Item("Bit0", "0", "", True)] + b = Bitmap("TestBitmap", "bitmap8", fields) + d = b.to_dict() + self.assertEqual(d["name"], "TestBitmap") + self.assertEqual(len(d["bitfields"]), 1) + + def test_struct_to_dict(self): + fields = [Item("Field1", "uint8", "", True)] + s = Struct("TestStruct", "list", fields) + d = s.to_dict() + self.assertEqual(d["name"], "TestStruct") + self.assertEqual(d["base_type"], "list") + + +class TestDataTypeParser(unittest.TestCase): + """Test DataTypeParser — XML dataTypes section parsing.""" + + def test_parse_enums(self): + root = Element("cluster") + data_types = SubElement(root, "dataTypes") + enum_el = SubElement(data_types, "enum", name="StatusEnum") + SubElement(enum_el, "item", name="Success", value="0", summary="OK") + SubElement(enum_el, "item", name="Failure", value="1", summary="Fail") + + parser = DataTypeParser() + types = parser.parse(root) + self.assertIn("statusenum", types) + self.assertEqual(types["statusenum"], "enum8") + self.assertIn("statusenum", parser.enums) + self.assertEqual(len(parser.enums["statusenum"].items), 2) + + def test_parse_bitmaps(self): + root = Element("cluster") + data_types = SubElement(root, "dataTypes") + bitmap_el = SubElement(data_types, "bitmap", name="FeatureBitmap") + SubElement(bitmap_el, "bitfield", name="Bit0", bit="0", summary="First") + SubElement(bitmap_el, "bitfield", name="Bit1", bit="1", summary="Second") + + parser = DataTypeParser() + types = parser.parse(root) + self.assertIn("featurebitmap", types) + self.assertIn("featurebitmap", parser.bitmaps) + + def test_parse_structs(self): + root = Element("cluster") + data_types = SubElement(root, "dataTypes") + struct_el = SubElement(data_types, "struct", name="TestStruct") + SubElement(struct_el, "field", name="field1", type="uint8", summary="F1") + + parser = DataTypeParser() + types = parser.parse(root) + self.assertIn("teststruct", types) + self.assertEqual(types["teststruct"], "list") + + def test_parse_no_data_types(self): + root = Element("cluster") + parser = DataTypeParser() + types = parser.parse(root) + self.assertIsInstance(types, dict) + + def test_get_data_types(self): + parser = DataTypeParser() + dt = parser.get_data_types() + self.assertIn("enums", dt) + self.assertIn("bitmaps", dt) + self.assertIn("structs", dt) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/tests/test_deserializer.py b/tools/data_model_gen/tests/test_deserializer.py new file mode 100644 index 000000000..b681e1efb --- /dev/null +++ b/tools/data_model_gen/tests/test_deserializer.py @@ -0,0 +1,283 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Tests for code_generation/deserializer.py — JSON to object reconstruction. +Uses temporary JSON files for integration-level tests. +""" + +import unittest +import sys +import os +import json +import tempfile + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from code_generation.deserializer import ClusterDeserializer, DeviceDeserializer # noqa: E402 + + +def _write_json(data): + f = tempfile.NamedTemporaryFile(mode="w", suffix=".json", delete=False) + json.dump(data, f, indent=2) + f.close() + return f.name + + +# Minimal cluster JSON fixture +CLUSTER_DATA = [ + { + "name": "OnOff", + "id": "0x0006", + "revision": 6, + "is_mandatory": False, + "type": "Server", + "classification": {"role": "application", "hierarchy": "base"}, + "callback_functions": ["emberAfOnOffClusterServerInitCallback"], + "function_flags": "CLUSTER_FLAG_INIT_FUNCTION", + "delegate_init_callback": None, + "plugin_server_init_callback": "MatterOnOffPluginServerInitCallback", + "is_migrated_cluster": False, + "attributes": [ + { + "name": "OnOff", + "id": "0x0000", + "type": "bool", + "converted_type": "bool", + "default_value": "false", + "mandatory": True, + "nullable": False, + "flags": "ATTRIBUTE_FLAG_NONVOLATILE", + "max_length": 0, + "min_value": None, + "max_value": None, + "conformance": {"type": "mandatory"}, + }, + ], + "commands": [ + { + "name": "Off", + "id": "0x0000", + "direction": "commandToServer", + "response": "Y", + "mandatory": True, + "flags": "COMMAND_FLAG_ACCEPTED", + "callback_required": True, + "conformance": {"type": "mandatory"}, + "fields": [], + }, + { + "name": "On", + "id": "0x0001", + "direction": "commandToServer", + "response": "Y", + "mandatory": True, + "flags": "COMMAND_FLAG_ACCEPTED", + "callback_required": True, + "conformance": {"type": "mandatory"}, + "fields": [], + }, + ], + "events": [ + { + "name": "StateChange", + "id": "0x0000", + "mandatory": False, + "priority": "Info", + "conformance": {"type": "optional"}, + }, + ], + "features": [ + { + "name": "Lighting", + "id": "0x0001", + "code": "LT", + "mandatory": False, + "conformance": {"type": "optional"}, + "attributes": ["OnOff"], + "commands": [], + "events": [], + }, + ], + } +] + + +class TestClusterDeserializer(unittest.TestCase): + """Test ClusterDeserializer — JSON to Cluster objects.""" + + @classmethod + def setUpClass(cls): + cls.json_path = _write_json(CLUSTER_DATA) + + @classmethod + def tearDownClass(cls): + os.unlink(cls.json_path) + + def test_deserialize_count(self): + clusters = ClusterDeserializer().deserialize(self.json_path) + self.assertEqual(len(clusters), 1) + + def test_cluster_name(self): + clusters = ClusterDeserializer().deserialize(self.json_path) + c = clusters[0] + self.assertIn("on_off", c.esp_name.lower()) + + def test_cluster_revision(self): + clusters = ClusterDeserializer().deserialize(self.json_path) + self.assertEqual(clusters[0].get_revision(), 6) + + def test_cluster_role(self): + clusters = ClusterDeserializer().deserialize(self.json_path) + self.assertEqual(clusters[0].role, "application") + + def test_server_cluster(self): + clusters = ClusterDeserializer().deserialize(self.json_path) + self.assertTrue(clusters[0].server_cluster) + + def test_attributes_deserialized(self): + clusters = ClusterDeserializer().deserialize(self.json_path) + self.assertEqual(len(clusters[0].attributes), 1) + attr = clusters[0].attributes[0] + self.assertEqual(attr.type, "bool") + self.assertTrue(attr.is_mandatory) + + def test_commands_deserialized(self): + clusters = ClusterDeserializer().deserialize(self.json_path) + self.assertEqual(len(clusters[0].commands), 2) + + def test_command_has_callback(self): + clusters = ClusterDeserializer().deserialize(self.json_path) + off_cmd = next(c for c in clusters[0].commands if c.name == "Off") + self.assertTrue(off_cmd.has_callback) + + def test_events_deserialized(self): + clusters = ClusterDeserializer().deserialize(self.json_path) + self.assertEqual(len(clusters[0].events), 1) + + def test_features_deserialized(self): + clusters = ClusterDeserializer().deserialize(self.json_path) + self.assertEqual(len(clusters[0].features), 1) + feat = clusters[0].features[0] + self.assertEqual(feat.code, "LT") + + def test_feature_linked_attributes(self): + clusters = ClusterDeserializer().deserialize(self.json_path) + feat = clusters[0].features[0] + # The attr name "OnOff" goes through name override to "On/Off", + # so linking by name may not always match. Just verify no crash. + self.assertIsInstance(feat.attributes, list) + + def test_is_migrated_cluster(self): + clusters = ClusterDeserializer().deserialize(self.json_path) + self.assertFalse(clusters[0].is_migrated_cluster) + + def test_callback_functions(self): + clusters = ClusterDeserializer().deserialize(self.json_path) + self.assertEqual(len(clusters[0].callback_functions), 1) + + def test_command_response_y(self): + d = ClusterDeserializer() + self.assertIsNone(d.get_command_response({"response": "Y"})) + + def test_command_response_n(self): + d = ClusterDeserializer() + self.assertIsNone(d.get_command_response({"response": "N"})) + + def test_command_response_none(self): + d = ClusterDeserializer() + self.assertIsNone(d.get_command_response({"response": None})) + + def test_command_response_name(self): + d = ClusterDeserializer() + self.assertEqual(d.get_command_response({"response": "GetResp"}), "GetResp") + + +# Minimal device JSON fixture +DEVICE_DATA = [ + { + "name": "On/Off Light", + "id": "0x0100", + "revision": 3, + "clusters": [ + { + "name": "OnOff", + "id": "0x0006", + "revision": 6, + "is_mandatory": True, + "type": "server", + "flags": "CLUSTER_FLAG_SERVER", + "attributes": [], + "features": [], + "commands": [], + "events": [], + }, + ], + } +] + + +class TestDeviceDeserializer(unittest.TestCase): + """Test DeviceDeserializer — JSON to Device objects.""" + + @classmethod + def setUpClass(cls): + cls.cluster_json_path = _write_json(CLUSTER_DATA) + cls.device_json_path = _write_json(DEVICE_DATA) + cls.clusters = ClusterDeserializer().deserialize(cls.cluster_json_path) + cls.cluster_lookup = {c.esp_name: c for c in cls.clusters} + + @classmethod + def tearDownClass(cls): + os.unlink(cls.cluster_json_path) + os.unlink(cls.device_json_path) + + def test_deserialize_count(self): + devices = DeviceDeserializer().deserialize( + self.device_json_path, self.cluster_lookup + ) + self.assertEqual(len(devices), 1) + + def test_device_name(self): + devices = DeviceDeserializer().deserialize( + self.device_json_path, self.cluster_lookup + ) + self.assertIn("on_off_light", devices[0].esp_name.lower()) + + def test_device_revision(self): + devices = DeviceDeserializer().deserialize( + self.device_json_path, self.cluster_lookup + ) + self.assertEqual(devices[0].get_device_type_version(), 3) + + def test_device_clusters(self): + devices = DeviceDeserializer().deserialize( + self.device_json_path, self.cluster_lookup + ) + self.assertEqual(len(devices[0].clusters), 1) + + def test_device_cluster_server(self): + devices = DeviceDeserializer().deserialize( + self.device_json_path, self.cluster_lookup + ) + self.assertTrue(devices[0].clusters[0].server_cluster) + + def test_device_cluster_mandatory(self): + devices = DeviceDeserializer().deserialize( + self.device_json_path, self.cluster_lookup + ) + self.assertTrue(devices[0].clusters[0].is_mandatory) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/tests/test_elements.py b/tools/data_model_gen/tests/test_elements.py new file mode 100644 index 000000000..8b51bc9bd --- /dev/null +++ b/tools/data_model_gen/tests/test_elements.py @@ -0,0 +1,432 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Tests for xml_processing/elements.py — Device, Cluster, Attribute, Command, Event, Feature.""" + +import unittest +import sys +import os + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from xml_processing.elements import Device, Cluster, Attribute, Command, Event, Feature # noqa: E402 + + +class TestAttribute(unittest.TestCase): + """Test Attribute — flags, default values, type conversion.""" + + def _make_attr(self, name="test_attr", type_="uint8", default="0", **kwargs): + return Attribute( + name=name, + id="0x0001", + type_=type_, + default_value=default, + is_mandatory=True, + **kwargs, + ) + + def test_basic_creation(self): + attr = self._make_attr() + self.assertEqual(attr.type, "uint8") + self.assertEqual(attr.get_type(), "uint8_t") + + def test_flag_none(self): + attr = self._make_attr() + self.assertEqual(attr.get_flag(), "ATTRIBUTE_FLAG_NONE") + + def test_flag_writable(self): + access = Attribute.Access( + read="true", readPrivilege="view", write="true", writePrivilege="operate" + ) + attr = self._make_attr(access=access) + self.assertIn("ATTRIBUTE_FLAG_WRITABLE", attr.get_flag()) + + def test_flag_nullable(self): + quality = Attribute.Quality( + changeOmitted="false", + nullable="true", + scene="false", + persistence="volatile", + reportable="false", + ) + attr = self._make_attr(quality=quality) + self.assertTrue(attr.is_nullable) + self.assertIn("ATTRIBUTE_FLAG_NULLABLE", attr.get_flag()) + + def test_flag_nonvolatile(self): + quality = Attribute.Quality( + changeOmitted="false", + nullable="false", + scene="false", + persistence="nonVolatile", + reportable="false", + ) + attr = self._make_attr(quality=quality) + self.assertIn("ATTRIBUTE_FLAG_NONVOLATILE", attr.get_flag()) + + def test_flag_managed_internally(self): + access = Attribute.Access( + read="true", readPrivilege="view", write="false", writePrivilege="" + ) + attr = self._make_attr(access=access) + attr.internally_managed = True + self.assertIn("ATTRIBUTE_FLAG_MANAGED_INTERNALLY", attr.get_flag()) + + def test_multiple_flags(self): + access = Attribute.Access( + read="true", readPrivilege="view", write="true", writePrivilege="operate" + ) + quality = Attribute.Quality( + changeOmitted="false", + nullable="true", + scene="false", + persistence="nonVolatile", + reportable="false", + ) + attr = self._make_attr(access=access, quality=quality) + flag = attr.get_flag() + self.assertIn("ATTRIBUTE_FLAG_WRITABLE", flag) + self.assertIn("ATTRIBUTE_FLAG_NULLABLE", flag) + self.assertIn("ATTRIBUTE_FLAG_NONVOLATILE", flag) + self.assertIn(" | ", flag) + + def test_default_value_uint(self): + attr = self._make_attr(type_="uint8", default="42") + self.assertEqual(attr.get_default_value(), 42) + + def test_default_value_bool_true(self): + attr = self._make_attr(type_="bool", default="true") + self.assertEqual(attr.get_default_value(), "true") + + def test_default_value_bool_false(self): + attr = self._make_attr(type_="bool", default="false") + self.assertEqual(attr.get_default_value(), "false") + + def test_default_value_bool_none(self): + attr = self._make_attr(type_="bool", default=None) + self.assertEqual(attr.get_default_value(), "false") + + def test_default_value_enum(self): + attr = self._make_attr(type_="enum8", default="0x02") + self.assertEqual(attr.get_default_value(), 2) + + def test_default_value_string_with_constraint(self): + constraint = Attribute.Constraint(type="maxLength", value="32") + attr = self._make_attr(type_="string", default=None, constraint=constraint) + self.assertEqual(attr.get_default_value(), 32) + + def test_default_value_string_no_constraint(self): + attr = self._make_attr(type_="string", default=None) + self.assertEqual(attr.get_default_value(), 0) + + def test_default_value_list(self): + attr = self._make_attr(type_="list", default=None) + self.assertEqual(attr.get_default_value(), 0) + + def test_default_value_temperature_degrees(self): + attr = self._make_attr(type_="int16", default="20°C") + self.assertEqual(attr.get_default_value(), 2000) + + def test_get_default_value_type_small(self): + attr = self._make_attr(type_="uint8", default="10") + self.assertEqual(attr.get_default_value_type(), "uint8_t") + + def test_get_default_value_type_medium(self): + attr = self._make_attr(type_="uint16", default="1000") + self.assertEqual(attr.get_default_value_type(), "uint16_t") + + def test_get_default_value_type_large(self): + attr = self._make_attr(type_="uint32", default="100000") + self.assertEqual(attr.get_default_value_type(), "uint32_t") + + def test_min_max_values(self): + attr = self._make_attr() + attr.min_value = 0 + attr.max_value = 254 + self.assertEqual(attr.get_min_value(), 0) + self.assertEqual(attr.get_max_value(), 254) + + def test_constraint_to_dict(self): + c = Attribute.Constraint(type="between", from_="0", to_="100") + d = c.to_dict() + self.assertEqual(d["type"], "between") + self.assertEqual(d["min"], "0") + self.assertEqual(d["max"], "100") + + +class TestCommand(unittest.TestCase): + """Test Command — flags, callback logic.""" + + def _make_cmd(self, name="TestCmd", direction="commandToServer", response="Y"): + return Command( + id="0x0001", + name=name, + direction=direction, + response=response, + is_mandatory=True, + ) + + def test_flag_accepted(self): + cmd = self._make_cmd(direction="commandToServer") + self.assertEqual(cmd.get_flag(), "COMMAND_FLAG_ACCEPTED") + + def test_flag_generated(self): + cmd = self._make_cmd(direction="responseFromServer") + self.assertEqual(cmd.get_flag(), "COMMAND_FLAG_GENERATED") + + def test_flag_none(self): + cmd = self._make_cmd(direction=None) + self.assertEqual(cmd.get_flag(), "COMMAND_FLAG_NONE") + + def test_callback_required_server_command(self): + cmd = self._make_cmd(direction="commandToServer", response="Y") + self.assertTrue(cmd.callback_required()) + + def test_callback_not_required_response(self): + cmd = self._make_cmd( + name="TestResponse", direction="responseFromServer", response="Y" + ) + self.assertFalse(cmd.callback_required()) + + def test_callback_not_required_no_response(self): + cmd = self._make_cmd(direction="commandToServer", response="N") + self.assertFalse(cmd.callback_required()) + + def test_callback_not_required_response_name(self): + cmd = self._make_cmd( + name="GetStatusResponse", direction="commandToServer", response="Y" + ) + self.assertFalse(cmd.callback_required()) + + def test_callback_skip_by_handler(self): + cmd = self._make_cmd() + cmd.command_handler_available = True + self.assertFalse(cmd.callback_required()) + + def test_command_name_strips_suffix(self): + cmd = Command( + id="0x0001", + name="SetTemp Command", + direction="commandToServer", + response="Y", + is_mandatory=True, + ) + self.assertNotIn(" Command", cmd.name) + + def test_add_field(self): + cmd = self._make_cmd() + field = Command.CommandField(id="0x00", name="mode", type_="uint8") + cmd.add_field(field) + self.assertEqual(len(cmd.fields), 1) + self.assertEqual(cmd.fields[0].name, "mode") + + +class TestEvent(unittest.TestCase): + """Test Event — basic creation and serialization.""" + + def test_creation(self): + event = Event(id="0x0001", name="StateChange", is_mandatory=True) + self.assertEqual(event.get_id(), "0x0001") + self.assertTrue(event.is_mandatory) + self.assertIsNone(event.conformance) + + +class TestFeature(unittest.TestCase): + """Test Feature — attribute/command/event management.""" + + def test_creation(self): + feat = Feature(name="Lighting", code="LT", id="0x0001") + self.assertEqual(feat.code, "LT") + + def test_add_and_get_attributes(self): + feat = Feature(name="Lighting", code="LT", id="0x0001") + attr = Attribute( + name="OnOff", + id="0x0001", + type_="bool", + default_value="false", + is_mandatory=True, + ) + feat.add_attribute_list({attr}) + attrs = feat.get_attributes() + self.assertEqual(len(attrs), 1) + + def test_add_and_get_commands(self): + feat = Feature(name="Lighting", code="LT", id="0x0001") + cmd = Command( + id="0x0001", + name="Toggle", + direction="commandToServer", + response="Y", + is_mandatory=True, + ) + feat.add_command_list({cmd}) + cmds = feat.get_commands() + self.assertEqual(len(cmds), 1) + + def test_add_and_get_events(self): + feat = Feature(name="Lighting", code="LT", id="0x0001") + evt = Event(id="0x0001", name="StateChange", is_mandatory=True) + feat.add_event_list({evt}) + evts = feat.get_events() + self.assertEqual(len(evts), 1) + + def test_attributes_sorted_by_id(self): + feat = Feature(name="Lighting", code="LT", id="0x0001") + a1 = Attribute( + name="Attr3", + id="0x0003", + type_="uint8", + default_value="0", + is_mandatory=True, + ) + a2 = Attribute( + name="Attr1", + id="0x0001", + type_="uint8", + default_value="0", + is_mandatory=True, + ) + feat.add_attribute_list({a1, a2}) + attrs = feat.get_attributes() + self.assertEqual(attrs[0].get_id(), "0x0001") + self.assertEqual(attrs[1].get_id(), "0x0003") + + +class TestDevice(unittest.TestCase): + """Test Device — cluster management.""" + + def test_creation(self): + device = Device(id="0x0100", name="On/Off Light", revision=3) + self.assertIn("on_off_light", device.esp_name) + + def test_get_clusters_empty(self): + device = Device(id="0x0100", name="Test Device", revision=1) + self.assertEqual(device.get_clusters(), []) + + def test_get_unique_clusters(self): + device = Device(id="0x0100", name="Test Device", revision=1) + c1 = Cluster(name="OnOff", id="0x0006", revision=6) + c1.server_cluster = True + c2 = Cluster(name="OnOff", id="0x0006", revision=6) + c2.server_cluster = False + device.clusters = {c1, c2} + unique = device.get_unique_clusters() + self.assertEqual(len(unique), 1) + + def test_filename(self): + device = Device(id="0x0100", name="On/Off Light", revision=3) + self.assertTrue(device.filename.endswith("_device")) + + +class TestCluster(unittest.TestCase): + """Test Cluster — callbacks, attributes, commands.""" + + def _make_cluster(self, name="OnOff", id="0x0006", revision=6): + return Cluster(name=name, id=id, revision=revision) + + def test_creation(self): + c = self._make_cluster() + self.assertEqual(c.get_revision(), 6) + + def test_callback_functions_empty(self): + c = self._make_cluster() + self.assertEqual(c.get_callback_functions(), []) + + def test_callback_functions_init(self): + c = self._make_cluster() + c.init_function_available = True + cbs = c.get_callback_functions() + self.assertEqual(len(cbs), 1) + self.assertIn("Init", cbs[0]) + + def test_callback_functions_all(self): + c = self._make_cluster() + c.init_function_available = True + c.attribute_changed_function_available = True + c.shutdown_function_available = True + c.pre_attribute_change_function_available = True + cbs = c.get_callback_functions() + self.assertEqual(len(cbs), 4) + + def test_plugin_server_init_callback(self): + c = self._make_cluster(name="OnOff") + c.plugin_init_cb_available = True + cb = c.get_plugin_server_init_callback() + self.assertIn("MatterOnOffPluginServerInitCallback", cb) + + def test_plugin_server_init_callback_skip(self): + c = self._make_cluster(name="ICD Management", id="0x0046") + c.plugin_init_cb_available = True + cb = c.get_plugin_server_init_callback() + self.assertIsNone(cb) + + def test_default_role(self): + c = self._make_cluster() + self.assertEqual(c.role, "application") + + def test_add_and_get_attributes(self): + c = self._make_cluster() + attr = Attribute( + name="OnOff", + id="0x0000", + type_="bool", + default_value="false", + is_mandatory=True, + ) + c.attributes.add(attr) + attrs = c.get_attributes() + self.assertEqual(len(attrs), 1) + + def test_attributes_sorted(self): + c = self._make_cluster() + a1 = Attribute( + name="B", id="0x0002", type_="uint8", default_value="0", is_mandatory=True + ) + a2 = Attribute( + name="A", id="0x0001", type_="uint8", default_value="0", is_mandatory=True + ) + c.attributes = {a1, a2} + attrs = c.get_attributes() + self.assertEqual(attrs[0].get_id(), "0x0001") + + def test_add_and_get_commands(self): + c = self._make_cluster() + cmd = Command( + id="0x0001", + name="Off", + direction="commandToServer", + response="Y", + is_mandatory=True, + ) + c.commands.add(cmd) + cmds = c.get_commands() + self.assertEqual(len(cmds), 1) + + def test_add_and_get_events(self): + c = self._make_cluster() + evt = Event(id="0x0001", name="StateChange", is_mandatory=True) + c.events.add(evt) + evts = c.get_events() + self.assertEqual(len(evts), 1) + + def test_add_and_get_features(self): + c = self._make_cluster() + feat = Feature(name="Lighting", code="LT", id="0x0001") + c.features.add(feat) + feats = c.get_features() + self.assertEqual(len(feats), 1) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/tests/test_exceptions.py b/tools/data_model_gen/tests/test_exceptions.py new file mode 100644 index 000000000..bba4ed6be --- /dev/null +++ b/tools/data_model_gen/tests/test_exceptions.py @@ -0,0 +1,144 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Tests for custom exception classes (XmlParseError, CodeGenerationError, ConfigurationError).""" + +import sys +import os +import unittest + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + +from utils.exceptions import ( # noqa: E402 + DataModelGenError, + XmlParseError, + CodeGenerationError, + ConfigurationError, +) + + +class TestDataModelGenError(unittest.TestCase): + """Tests for base DataModelGenError.""" + + def test_message_only(self): + e = DataModelGenError("Something failed") + self.assertEqual(str(e), "Something failed") + self.assertIn("Something failed", e.args[0]) + + def test_with_context(self): + e = DataModelGenError( + "Invalid element", + file_path="/path/to/file.xml", + line_number=10, + context="cluster Foo", + suggestion="Check the XML schema.", + ) + msg = e.args[0] + self.assertIn("Invalid element", msg) + self.assertIn("File: /path/to/file.xml", msg) + self.assertIn("Line: 10", msg) + self.assertIn("cluster Foo", msg) + self.assertIn("Check the XML schema", msg) + self.assertEqual(e.file_path, "/path/to/file.xml") + self.assertEqual(e.line_number, 10) + + +class TestXmlParseError(unittest.TestCase): + """Tests for XmlParseError (xml_processing).""" + + def test_inherits_from_data_model_gen_error(self): + self.assertTrue(issubclass(XmlParseError, DataModelGenError)) + + def test_raise_and_catch(self): + with self.assertRaises(DataModelGenError) as ctx: + raise XmlParseError( + "Attribute type is None", + context="resolve_attribute_type", + suggestion="Add a type attribute.", + ) + self.assertIsInstance(ctx.exception, XmlParseError) + self.assertIn("Attribute type is None", str(ctx.exception)) + + def test_used_in_xml_processing(self): + from xml_processing.data_type_parser import resolve_attribute_type + from xml.etree.ElementTree import Element + + elem = Element("attribute") + elem.set("name", "test") + with self.assertRaises(XmlParseError) as ctx: + resolve_attribute_type(elem, {}) + self.assertIn("type", str(ctx.exception).lower()) + + +class TestCodeGenerationError(unittest.TestCase): + """Tests for CodeGenerationError (code_generation).""" + + def test_inherits_from_data_model_gen_error(self): + self.assertTrue(issubclass(CodeGenerationError, DataModelGenError)) + + def test_raise_and_catch(self): + with self.assertRaises(DataModelGenError) as ctx: + raise CodeGenerationError( + "Template render failed", + file_path="cluster.h.jinja", + suggestion="Check template syntax.", + ) + self.assertIsInstance(ctx.exception, CodeGenerationError) + self.assertIn("Template render failed", str(ctx.exception)) + + def test_used_in_conformance_codegen(self): + from code_generation.conformance_codegen import parse_expr + from utils.conformance import ConformanceTAG, ConformanceException + + obj = {ConformanceTAG.COMMAND.value: "foo"} + with self.assertRaises(ConformanceException) as ctx: + parse_expr(obj) + self.assertIn("Command flag", str(ctx.exception)) + + +class TestConfigurationError(unittest.TestCase): + """Tests for ConfigurationError (configuration).""" + + def test_inherits_from_data_model_gen_error(self): + self.assertTrue(issubclass(ConfigurationError, DataModelGenError)) + + def test_raise_and_catch(self): + with self.assertRaises(DataModelGenError) as ctx: + raise ConfigurationError( + "ESP_MATTER_PATH is not set", + context="main", + suggestion="Set the environment variable.", + ) + self.assertIsInstance(ctx.exception, ConfigurationError) + self.assertIn("ESP_MATTER_PATH", str(ctx.exception)) + + def test_set_esp_matter_path_empty_raises(self): + import utils.config as config + + with self.assertRaises(ConfigurationError) as ctx: + config.set_esp_matter_path("") + self.assertIn("empty", str(ctx.exception).lower()) + with self.assertRaises(ConfigurationError): + config.set_esp_matter_path(" ") + + def test_set_esp_matter_path_nonexistent_dir_raises(self): + import utils.config as config + + with self.assertRaises(ConfigurationError) as ctx: + config.set_esp_matter_path("/nonexistent/path/12345") + self.assertIn("directory", str(ctx.exception).lower()) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/tests/test_helper.py b/tools/data_model_gen/tests/test_helper.py new file mode 100644 index 000000000..34a227799 --- /dev/null +++ b/tools/data_model_gen/tests/test_helper.py @@ -0,0 +1,198 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Tests for utils/helper.py — name conversions, ID validation, type conversions, file I/O.""" + +import unittest +import sys +import os +import tempfile +import json + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from utils.helper import ( # noqa: E402 + chip_name, + esp_name, + convert_to_snake_case, + check_valid_id, + safe_get_attr, + write_to_file, +) + + +class TestChipName(unittest.TestCase): + """Test chip_name() — converts names to CamelCase chip convention.""" + + def test_already_camel_case(self): + self.assertEqual(chip_name("OnOff"), "OnOff") + + def test_slash_separated(self): + self.assertEqual(chip_name("On/Off"), "OnOff") + + def test_space_separated(self): + self.assertEqual(chip_name("Color Control"), "ColorControl") + + def test_hyphen_separated(self): + self.assertEqual(chip_name("Wi-Fi"), "WiFi") + + def test_dishwasher_special_case(self): + self.assertEqual(chip_name("Dish Washer Mode"), "DishwasherMode") + + def test_single_uppercase_word(self): + self.assertEqual(chip_name("Thermostat"), "Thermostat") + + def test_mixed_special_chars(self): + result = chip_name("PM2.5 Concentration") + self.assertTrue(result[0].isupper()) + + def test_all_lowercase(self): + result = chip_name("on off") + self.assertEqual(result, "OnOff") + + +class TestEspName(unittest.TestCase): + """Test esp_name() — converts names to lowercase underscore convention.""" + + def test_simple_name(self): + self.assertEqual(esp_name("OnOff"), "onoff") + + def test_spaces_to_underscores(self): + self.assertEqual(esp_name("Color Control"), "color_control") + + def test_slash_to_underscore(self): + self.assertEqual(esp_name("On/Off"), "on_off") + + def test_hyphen_to_underscore(self): + self.assertEqual(esp_name("Wi-Fi"), "wi_fi") + + def test_already_lowercase(self): + self.assertEqual(esp_name("thermostat"), "thermostat") + + +class TestConvertToSnakeCase(unittest.TestCase): + """Test convert_to_snake_case() — CamelCase/mixed to snake_case.""" + + def test_camel_case(self): + result = convert_to_snake_case("ColorControl") + self.assertEqual(result, "color_control") + + def test_with_command_suffix(self): + result = convert_to_snake_case("SetpointRaiseLowerCommand") + self.assertNotIn("command", result.lower()) + + def test_empty_string(self): + self.assertEqual(convert_to_snake_case(""), "") + + def test_none(self): + self.assertIsNone(convert_to_snake_case(None)) + + def test_numbers_separated(self): + result = convert_to_snake_case("PM25Concentration") + self.assertIn("_", result) + + def test_all_uppercase_acronym(self): + result = convert_to_snake_case("ICDManagement") + self.assertIn("icd", result) + self.assertIn("management", result) + + def test_already_snake_case(self): + result = convert_to_snake_case("on_off") + self.assertEqual(result, "on_off") + + +class TestCheckValidId(unittest.TestCase): + """Test check_valid_id() — hex ID validation.""" + + def test_valid_hex_id(self): + self.assertTrue(check_valid_id("0x0001")) + + def test_valid_long_hex_id(self): + self.assertTrue(check_valid_id("0x00000006")) + + def test_none_id(self): + self.assertFalse(check_valid_id(None)) + + def test_empty_id(self): + self.assertFalse(check_valid_id("")) + + def test_no_hex_prefix(self): + self.assertFalse(check_valid_id("0001")) + + def test_tbd_id(self): + self.assertFalse(check_valid_id("ID-TBD")) + + def test_invalid_hex_chars(self): + self.assertFalse(check_valid_id("0xGGGG")) + + +class TestSafeGetAttr(unittest.TestCase): + """Test safe_get_attr() — safely get attributes with defaults.""" + + def test_existing_attribute(self): + class Obj: + x = 42 + + self.assertEqual(safe_get_attr(Obj(), "x"), 42) + + def test_missing_attribute(self): + class Obj: + pass + + self.assertIsNone(safe_get_attr(Obj(), "missing")) + + def test_missing_with_default(self): + class Obj: + pass + + self.assertEqual(safe_get_attr(Obj(), "missing", "default"), "default") + + def test_none_object(self): + self.assertIsNone(safe_get_attr(None, "x")) + + def test_none_object_with_default(self): + self.assertEqual(safe_get_attr(None, "x", 99), 99) + + +class TestWriteToFile(unittest.TestCase): + """Test write_to_file() — file I/O with error handling.""" + + def test_write_text(self): + with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) as f: + path = f.name + try: + self.assertTrue(write_to_file(path, "hello world")) + with open(path) as f: + self.assertEqual(f.read(), "hello world") + finally: + os.unlink(path) + + def test_write_json(self): + with tempfile.NamedTemporaryFile(mode="w", suffix=".json", delete=False) as f: + path = f.name + try: + data = {"key": "value", "num": 42} + self.assertTrue(write_to_file(path, data, file_type="json")) + with open(path) as f: + loaded = json.load(f) + self.assertEqual(loaded, data) + finally: + os.unlink(path) + + def test_write_to_invalid_path(self): + with self.assertRaises(Exception): + write_to_file("/nonexistent/dir/file.txt", "data") + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/tests/test_overrides.py b/tools/data_model_gen/tests/test_overrides.py new file mode 100644 index 000000000..c5449b891 --- /dev/null +++ b/tools/data_model_gen/tests/test_overrides.py @@ -0,0 +1,301 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Tests for utils/overrides.py — name overrides, reserved words, skip lists, special config.""" + +import unittest +import sys +import os + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from utils.overrides import ( # noqa: E402 + normalize_cluster_display_name, + normalize_feature_name, + normalize_device_type_name, + normalize_element_name, + is_cpp_reserved_word, + should_skip_cluster_command_callbacks, + should_skip_delegate_callback, + should_include_delegate_callback, + should_skip_plugin_callback, + should_skip_internally_managed_flag, + get_overridden_cluster_init_callback_name, + get_overridden_cluster_shutdown_callback_name, + get_special_config_for_element, +) + + +class TestClusterNameOverrides(unittest.TestCase): + """Test cluster display name normalization.""" + + def test_onoff_override(self): + self.assertEqual( + normalize_cluster_display_name("OnOff", cluster_id="0x0006"), "On/Off" + ) + + def test_operational_credentials_override(self): + self.assertEqual( + normalize_cluster_display_name( + "Node Operational Credentials", cluster_id="0x003E" + ), + "Operational Credentials", + ) + + def test_dishwasher_override(self): + self.assertEqual( + normalize_cluster_display_name("Dishwasher Mode", cluster_id="0x0059"), + "Dish Washer Mode", + ) + + def test_no_override(self): + self.assertEqual( + normalize_cluster_display_name("Thermostat", cluster_id="0x0201"), + "Thermostat", + ) + + def test_name_fallback(self): + """Without cluster_id, falls back to name-based lookup.""" + self.assertEqual(normalize_cluster_display_name("OnOff"), "On/Off") + + +class TestFeatureNameOverrides(unittest.TestCase): + """Test feature name normalization.""" + + def test_auto_override(self): + self.assertEqual( + normalize_feature_name("Auto", cluster_id="0x0202", feature_id="0x2"), + "fan_auto", + ) + + def test_weekday_override(self): + self.assertEqual( + normalize_feature_name( + "WeekDayAccessSchedules", cluster_id="0x0101", feature_id="0x10" + ), + "weekday_access_schedules", + ) + + def test_no_override(self): + self.assertEqual(normalize_feature_name("Lighting"), "Lighting") + + def test_name_fallback(self): + """Without IDs, falls back to name-based lookup.""" + self.assertEqual(normalize_feature_name("Auto"), "fan_auto") + + +class TestDeviceNameOverrides(unittest.TestCase): + """Test device type name normalization.""" + + def test_dishwasher_override(self): + self.assertEqual( + normalize_device_type_name("Dishwasher", device_id="0x0075"), "Dish Washer" + ) + + def test_no_override(self): + self.assertEqual(normalize_device_type_name("Fan", device_id="0x002B"), "Fan") + + def test_name_fallback(self): + """Without device_id, falls back to name-based lookup.""" + self.assertEqual(normalize_device_type_name("Dishwasher"), "Dish Washer") + + +class TestElementNameOverrides(unittest.TestCase): + """Test element name normalization.""" + + def test_pin_override(self): + self.assertEqual( + normalize_element_name( + "RequirePINforRemoteOperation", cluster_id="0x0101", element_id="0x0033" + ), + "require_pin_for_remote_operation", + ) + + def test_soc_override(self): + self.assertEqual( + normalize_element_name( + "NextChargeTargetSoC", cluster_id="0x0099", element_id="0x0026" + ), + "next_charge_target_soc", + ) + + def test_no_override(self): + self.assertEqual(normalize_element_name("temperature"), "temperature") + + def test_name_fallback(self): + """Without IDs, falls back to name-based lookup.""" + self.assertEqual( + normalize_element_name("RequirePINforRemoteOperation"), + "require_pin_for_remote_operation", + ) + + +class TestCppReservedWords(unittest.TestCase): + """Test C++ reserved word detection.""" + + def test_switch_is_reserved(self): + self.assertTrue(is_cpp_reserved_word("switch")) + + def test_auto_is_reserved(self): + self.assertTrue(is_cpp_reserved_word("auto")) + + def test_case_insensitive(self): + self.assertTrue(is_cpp_reserved_word("SWITCH")) + self.assertTrue(is_cpp_reserved_word("Switch")) + + def test_non_reserved(self): + self.assertFalse(is_cpp_reserved_word("temperature")) + self.assertFalse(is_cpp_reserved_word("on_off")) + + def test_observed_keywords(self): + # Only words actually observed in practice in Matter XML are tracked; + # the list intentionally stays minimal and grows on demand. + for word in ["auto", "switch"]: + self.assertTrue(is_cpp_reserved_word(word), f"{word} should be reserved") + + +class TestSkipLists(unittest.TestCase): + """Test skip/include callback logic.""" + + def test_skip_command_callback(self): + self.assertTrue( + should_skip_cluster_command_callbacks("0x0039") + ) # bridged_device_basic_information + + def test_no_skip_command_callback(self): + self.assertFalse(should_skip_cluster_command_callbacks("0x0006")) # on_off + + def test_skip_delegate_callback(self): + self.assertTrue( + should_skip_delegate_callback("0x0553") + ) # webrtc_transport_provider + + def test_no_skip_delegate_callback(self): + self.assertFalse(should_skip_delegate_callback("0x0201")) # thermostat + + def test_include_delegate_callback(self): + self.assertTrue(should_include_delegate_callback("0x0050")) # mode_select + + def test_no_include_delegate_callback(self): + self.assertFalse(should_include_delegate_callback("0x0201")) # thermostat + + def test_skip_plugin_callback(self): + self.assertTrue(should_skip_plugin_callback("0x0046")) # icd_management + + def test_no_skip_plugin_callback(self): + self.assertFalse(should_skip_plugin_callback("0x0006")) # on_off + + +class TestInternallyManagedSkip(unittest.TestCase): + """Test internally managed attribute skip logic.""" + + def test_skip_icd_attribute(self): + self.assertTrue( + should_skip_internally_managed_flag( + "0x0046", "0x0006" + ) # icd_management, user_active_mode_trigger_hint + ) + + def test_skip_thermostat_attribute(self): + self.assertTrue( + should_skip_internally_managed_flag( + "0x0201", "0x0000" + ) # thermostat, local_temperature + ) + + def test_no_skip_unknown_cluster(self): + self.assertFalse( + should_skip_internally_managed_flag("0x0006", "0x0000") # on_off, some_attr + ) + + def test_no_skip_unknown_attribute(self): + self.assertFalse( + should_skip_internally_managed_flag( + "0x0201", "0x0001" + ) # thermostat, unknown_attr + ) + + +class TestCallbackNameOverrides(unittest.TestCase): + """Test WebRTC callback name overrides.""" + + def test_webrtc_provider_init(self): + result = get_overridden_cluster_init_callback_name( + "0x0553", "WebrtcTransportProvider" + ) + self.assertIn("WebRTC", result) + + def test_webrtc_requestor_shutdown(self): + result = get_overridden_cluster_shutdown_callback_name( + "0x0554", "WebrtcTransportRequestor" + ) + self.assertIn("WebRTC", result) + + def test_no_override(self): + result = get_overridden_cluster_init_callback_name("0x0201", "Thermostat") + self.assertEqual(result, "ESPMatterThermostatClusterServerInitCallback") + + +class TestSpecialConfig(unittest.TestCase): + """Test special config (preprocessor guard) lookups.""" + + def test_icd_management_by_name(self): + self.assertEqual( + get_special_config_for_element("icd_management"), + "CHIP_CONFIG_ENABLE_ICD_SERVER", + ) + + def test_wifi_feature_by_id(self): + # element_name is unused when both cluster_id and element_id resolve + # via SPECIAL_CONFIG_LIST, but is still required by the signature. + self.assertEqual( + get_special_config_for_element( + "wifi_network_interface", + cluster_id="0x0031", + element_id="0x1", + ), + "CHIP_DEVICE_CONFIG_ENABLE_WIFI", + ) + + def test_thread_feature_by_name(self): + self.assertEqual( + get_special_config_for_element("thread_network_interface"), + "CHIP_DEVICE_CONFIG_ENABLE_THREAD", + ) + + def test_no_special_config(self): + self.assertIsNone(get_special_config_for_element("on_off")) + + def test_name_fallback_for_feature(self): + """Without cluster_id, falls back to name-based lookup.""" + self.assertEqual( + get_special_config_for_element("wifi_network_interface"), + "CHIP_DEVICE_CONFIG_ENABLE_WIFI", + ) + + def test_id_based_with_both_ids(self): + """With both cluster_id and element_id, uses precise ID lookup.""" + # element_name is unused on the ID-based path but still required by + # the signature; pass an unrelated name to prove the ID lookup wins. + self.assertEqual( + get_special_config_for_element( + "ignored_name", + cluster_id="0x0046", + element_id="0x0004", + ), + "CHIP_CONFIG_ENABLE_ICD_LIT", + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/tests/test_parsers.py b/tools/data_model_gen/tests/test_parsers.py new file mode 100644 index 000000000..c144ace86 --- /dev/null +++ b/tools/data_model_gen/tests/test_parsers.py @@ -0,0 +1,638 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Tests for xml_processing parsers: + - element_parser_base.py (ClusterElementBaseParser) + - attribute_parser.py (AttributeParser) + - command_parser.py (CommandParser) + - event_parser.py (EventParser) + - feature_parser.py (FeatureParser) + - parse_context.py (ClusterParseContext) +""" + +import unittest +import sys +import os +from xml.etree.ElementTree import Element, SubElement + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from xml_processing.elements import Cluster, Attribute, Command, Event, Feature # noqa: E402 +from xml_processing.element_parser_base import ClusterElementBaseParser # noqa: E402 +from xml_processing.attribute_parser import AttributeParser # noqa: E402 +from xml_processing.command_parser import CommandParser # noqa: E402 +from xml_processing.event_parser import EventParser # noqa: E402 +from xml_processing.feature_parser import FeatureParser # noqa: E402 +from xml_processing.parse_context import ClusterParseContext # noqa: E402 + + +# --------------------------------------------------------------------------- +# Helpers to build minimal XML trees +# --------------------------------------------------------------------------- + + +def _make_cluster(name="TestCluster", id_="0x0001", revision=1): + c = Cluster(name=name, id=id_, revision=revision) + c.attribute_types = { + "uint8": "uint8", + "bool": "bool", + "int16": "int16", + "uint16": "uint16", + } + c.data_types = {} + c.skip_command_cb = False + c.command_handler_available = False + c.is_migrated_cluster = False + return c + + +def _attr_xml(name, id_, type_="uint8", default="0", mandatory=False): + elem = Element("attribute", name=name, id=id_, type=type_, default=default) + if mandatory: + SubElement(elem, "mandatoryConform") + return elem + + +def _cmd_xml(name, id_, direction="commandToServer", response="Y", mandatory=False): + elem = Element("command", name=name, id=id_, direction=direction, response=response) + if mandatory: + SubElement(elem, "mandatoryConform") + return elem + + +def _event_xml(name, id_, mandatory=False): + elem = Element("event", name=name, id=id_) + if mandatory: + SubElement(elem, "mandatoryConform") + return elem + + +def _cluster_root_with_attrs(*attrs): + root = Element("cluster", name="Test", id="0x0001", revision="1") + attrs_section = SubElement(root, "attributes") + for a in attrs: + attrs_section.append(a) + return root + + +def _cluster_root_with_cmds(*cmds): + root = Element("cluster", name="Test", id="0x0001", revision="1") + cmds_section = SubElement(root, "commands") + for c in cmds: + cmds_section.append(c) + return root + + +def _cluster_root_with_events(*events): + root = Element("cluster", name="Test", id="0x0001", revision="1") + events_section = SubElement(root, "events") + for e in events: + events_section.append(e) + return root + + +# --------------------------------------------------------------------------- +# ClusterElementBaseParser +# --------------------------------------------------------------------------- + + +class _ConcreteParser(ClusterElementBaseParser): + """Concrete subclass for testing the abstract base.""" + + def parse(self, root): + pass + + +class TestClusterElementBaseParser(unittest.TestCase): + """Test the shared skip / ID logic in ClusterElementBaseParser.""" + + def _parser(self, cluster=None, feature_map=None, allowed_ids=None, base=None): + c = cluster or _make_cluster() + p = _ConcreteParser(c, feature_map or {}, allowed_ids or [], base or []) + return p + + def test_skip_missing_name(self): + p = self._parser() + elem = Element("attribute", id="0x0001") + skip, reason = p.can_skip(elem) + self.assertTrue(skip) + self.assertIn("missing name", reason) + + def test_skip_duplicate_name(self): + p = self._parser() + elem = Element("attribute", name="Temp", id="0x0001") + p.can_skip(elem) + skip, reason = p.can_skip(Element("attribute", name="Temp", id="0x0001")) + self.assertTrue(skip) + self.assertIn("already processed", reason) + + def test_skip_invalid_id(self): + p = self._parser() + elem = Element("attribute", name="Bad", id="INVALID") + skip, reason = p.can_skip(elem) + self.assertTrue(skip) + self.assertIn("invalid id", reason) + + def test_skip_no_id(self): + p = self._parser() + elem = Element("attribute", name="NoId") + skip, _ = p.can_skip(elem) + self.assertTrue(skip) + + def test_skip_id_not_in_allowed(self): + p = self._parser(allowed_ids=[1, 2, 3]) + elem = Element("attribute", name="X", id="0x00FF") + skip, reason = p.can_skip(elem) + self.assertTrue(skip) + self.assertIn("not in allowed", reason) + + def test_no_skip_valid(self): + p = self._parser() + elem = Element("attribute", name="Valid", id="0x0001") + skip, _ = p.can_skip(elem) + self.assertFalse(skip) + + def test_skip_deprecated_conformance(self): + p = self._parser() + elem = Element("attribute", name="Dep", id="0x0001") + SubElement(elem, "deprecateConform") + skip, reason = p.can_skip(elem) + self.assertTrue(skip) + self.assertIn("conformance", reason) + + def test_fill_from_base_sets_id(self): + base_attr = Attribute( + name="BaseAttr", + id="0x00AA", + type_="uint8", + default_value="0", + is_mandatory=True, + ) + p = self._parser(base=[base_attr]) + elem = Element("attribute", name="BaseAttr") + p._fill_from_base(elem, base_attr) + self.assertEqual(elem.get("id"), "0x00AA") + + +# --------------------------------------------------------------------------- +# AttributeParser +# --------------------------------------------------------------------------- + + +class TestAttributeParser(unittest.TestCase): + """Test AttributeParser — create, parse, type overrides, internally managed.""" + + def _parser(self, cluster=None, managed=None, base=None): + c = cluster or _make_cluster() + return AttributeParser( + c, + feature_map={}, + managed_attributes=managed or [], + base_attributes=base or [], + ) + + def test_create_basic(self): + p = self._parser() + elem = _attr_xml("Temp", "0x0001", "uint8", "25", mandatory=True) + attr = p.create(elem) + self.assertEqual(attr.func_name, "temp") + self.assertEqual(attr.type, "uint8") + self.assertTrue(attr.is_mandatory) + + def test_create_with_access(self): + p = self._parser() + elem = _attr_xml("Writable", "0x0002", "uint8", "0") + SubElement( + elem, + "access", + read="true", + readPrivilege="view", + write="true", + writePrivilege="operate", + ) + attr = p.create(elem) + self.assertIsNotNone(attr.access) + self.assertEqual(attr.access.write, "true") + + def test_create_with_quality(self): + p = self._parser() + elem = _attr_xml("Nullable", "0x0003", "uint8", "0") + SubElement( + elem, + "quality", + nullable="true", + persistence="nonVolatile", + changeOmitted="false", + scene="false", + reportable="false", + ) + attr = p.create(elem) + self.assertIsNotNone(attr.quality) + self.assertTrue(attr.is_nullable) + + def test_create_with_constraint_max_length(self): + p = self._parser() + elem = _attr_xml("Str", "0x0004", "uint8", "0") + constraint_el = SubElement(elem, "constraint") + SubElement(constraint_el, "maxLength", value="32") + attr = p.create(elem) + self.assertIsNotNone(attr.constraint) + self.assertEqual(attr.constraint.type, "maxLength") + self.assertEqual(attr.constraint.value, "32") + + def test_create_with_constraint_between(self): + p = self._parser() + elem = _attr_xml("Bounded", "0x0005", "uint8", "0") + constraint_el = SubElement(elem, "constraint") + between = SubElement(constraint_el, "between") + SubElement(between, "from", value="10") + SubElement(between, "to", value="200") + attr = p.create(elem) + self.assertEqual(attr.constraint.type, "between") + self.assertEqual(attr.constraint.from_, "10") + self.assertEqual(attr.constraint.to_, "200") + + def test_internally_managed_list_type(self): + p = self._parser() + elem = _attr_xml("Entries", "0x0006", "list", "0") + # list type, so resolve_attribute_type needs "list" in type map + p.cluster.attribute_types["list"] = "list" + attr = p.create(elem) + self.assertTrue(attr.internally_managed) + + def test_internally_managed_by_name(self): + p = self._parser(managed=["temp"]) + elem = _attr_xml("Temp", "0x0007", "uint8", "0") + attr = p.create(elem) + self.assertTrue(attr.internally_managed) + + def test_not_internally_managed(self): + p = self._parser(managed=[]) + elem = _attr_xml("Level", "0x0008", "uint8", "0") + attr = p.create(elem) + self.assertFalse(attr.internally_managed) + + def test_parse_adds_to_cluster(self): + cluster = _make_cluster() + p = AttributeParser(cluster, {}, []) + root = _cluster_root_with_attrs( + _attr_xml("AttrA", "0x0001", "uint8", "0"), + _attr_xml("AttrB", "0x0002", "uint8", "0"), + ) + p.parse(root) + self.assertEqual(len(cluster.attributes), 2) + + def test_parse_skips_invalid_id(self): + cluster = _make_cluster() + p = AttributeParser(cluster, {}, []) + root = _cluster_root_with_attrs( + _attr_xml("Good", "0x0001", "uint8", "0"), + _attr_xml("Bad", "INVALID", "uint8", "0"), + ) + p.parse(root) + self.assertEqual(len(cluster.attributes), 1) + + def test_parse_merges_base_attributes(self): + cluster = _make_cluster() + base_attr = Attribute( + name="BaseOnly", + id="0x00FF", + type_="uint8", + default_value="0", + is_mandatory=True, + ) + p = AttributeParser(cluster, {}, [], base_attributes=[base_attr]) + root = _cluster_root_with_attrs( + _attr_xml("New", "0x0001", "uint8", "0"), + ) + p.parse(root) + names = {a.func_name for a in cluster.attributes} + self.assertIn("base_only", names) + + def test_parse_no_constraint(self): + p = self._parser() + attr = p._constraint(None) + self.assertIsNone(attr) + + +# --------------------------------------------------------------------------- +# CommandParser +# --------------------------------------------------------------------------- + + +class TestCommandParser(unittest.TestCase): + """Test CommandParser — create, parse, fields, access.""" + + def _parser(self, cluster=None, base=None): + c = cluster or _make_cluster() + return CommandParser(c, feature_map={}, base_commands=base or []) + + def test_create_basic(self): + p = self._parser() + elem = _cmd_xml("Off", "0x0001", "commandToServer", "Y", mandatory=True) + cmd = p.create(elem) + self.assertEqual(cmd.direction, "commandToServer") + self.assertEqual(cmd.response, "Y") + + def test_create_with_access(self): + p = self._parser() + elem = _cmd_xml("Timed", "0x0002") + SubElement( + elem, "access", invokePrivilege="admin", timed="true", fabricScoped="false" + ) + cmd = p.create(elem) + p._set_access(cmd, elem) + self.assertIsNotNone(cmd.access) + self.assertTrue(cmd.access.timed) + self.assertFalse(cmd.access.fabric_scoped) + + def test_create_with_fields(self): + p = self._parser() + elem = _cmd_xml("Move", "0x0003") + SubElement(elem, "field", id="0x00", name="level", type="uint8") + SubElement(elem, "field", id="0x01", name="rate", type="uint8") + cmd = p.create(elem) + p._set_fields(cmd, elem) + self.assertEqual(len(cmd.fields), 2) + self.assertEqual(cmd.fields[0].name, "level") + + def test_create_field_with_constraint(self): + p = self._parser() + elem = _cmd_xml("Bounded", "0x0004") + field = SubElement(elem, "field", id="0x00", name="val", type="uint8") + constraint = SubElement(field, "constraint") + SubElement(constraint, "max", value="100") + cmd = p.create(elem) + p._set_fields(cmd, elem) + self.assertIsNotNone(cmd.fields[0].constraint) + self.assertEqual(cmd.fields[0].constraint["type"], "max") + + def test_create_skips_incomplete_fields(self): + p = self._parser() + elem = _cmd_xml("Partial", "0x0005") + SubElement(elem, "field", id="0x00", name="ok", type="uint8") + SubElement(elem, "field", id="0x01", name="missing_type") # no type + SubElement(elem, "field", name="no_id", type="uint8") # no id + cmd = p.create(elem) + p._set_fields(cmd, elem) + self.assertEqual(len(cmd.fields), 1) + + def test_parse_adds_to_cluster(self): + cluster = _make_cluster() + p = CommandParser(cluster, {}) + root = _cluster_root_with_cmds( + _cmd_xml("Off", "0x0001"), + _cmd_xml("On", "0x0002"), + ) + p.parse(root) + self.assertEqual(len(cluster.commands), 2) + + def test_parse_skips_invalid(self): + cluster = _make_cluster() + p = CommandParser(cluster, {}) + root = _cluster_root_with_cmds( + _cmd_xml("Good", "0x0001"), + _cmd_xml("Bad", "INVALID"), + ) + p.parse(root) + self.assertEqual(len(cluster.commands), 1) + + def test_parse_merges_base_commands(self): + cluster = _make_cluster() + base_cmd = Command( + id="0x00FF", + name="BaseCmd", + direction="commandToServer", + response="Y", + is_mandatory=True, + ) + p = CommandParser(cluster, {}, base_commands=[base_cmd]) + root = _cluster_root_with_cmds(_cmd_xml("New", "0x0001")) + p.parse(root) + names = {c.func_name for c in cluster.commands} + self.assertIn("base_cmd", names) + + def test_skip_command_cb_flag(self): + cluster = _make_cluster() + cluster.skip_command_cb = True + p = CommandParser(cluster, {}) + root = _cluster_root_with_cmds(_cmd_xml("Flagged", "0x0001")) + p.parse(root) + for cmd in cluster.commands: + self.assertTrue(cmd.skip_command_cb) + + def test_command_handler_available(self): + cluster = _make_cluster() + cluster.command_handler_available = True + p = CommandParser(cluster, {}) + elem = _cmd_xml("Handled", "0x0001") + cmd = p.create(elem) + self.assertTrue(cmd.command_handler_available) + + def test_field_constraint_between(self): + p = self._parser() + elem = Element("constraint") + between = SubElement(elem, "between") + SubElement(between, "from", value="0") + SubElement(between, "to", value="100") + result = p._field_constraint(elem) + self.assertEqual(result["type"], "between") + self.assertEqual(result["min"], "0") + self.assertEqual(result["max"], "100") + + def test_field_constraint_none(self): + p = self._parser() + self.assertIsNone(p._field_constraint(None)) + + +# --------------------------------------------------------------------------- +# EventParser +# --------------------------------------------------------------------------- + + +class TestEventParser(unittest.TestCase): + """Test EventParser — create, parse, base event merging.""" + + def test_create_basic(self): + cluster = _make_cluster() + p = EventParser(cluster, {}) + elem = _event_xml("StateChange", "0x0001", mandatory=True) + evt = p.create(elem) + self.assertEqual(evt.get_id(), "0x0001") + self.assertTrue(evt.is_mandatory) + + def test_parse_adds_to_cluster(self): + cluster = _make_cluster() + p = EventParser(cluster, {}) + root = _cluster_root_with_events( + _event_xml("EvtA", "0x0001"), + _event_xml("EvtB", "0x0002"), + ) + p.parse(root) + self.assertEqual(len(cluster.events), 2) + + def test_parse_skips_invalid(self): + cluster = _make_cluster() + p = EventParser(cluster, {}) + root = _cluster_root_with_events( + _event_xml("Good", "0x0001"), + _event_xml("Bad", "INVALID"), + ) + p.parse(root) + self.assertEqual(len(cluster.events), 1) + + def test_parse_merges_base_events(self): + cluster = _make_cluster() + base_evt = Event(id="0x00FF", name="BaseEvt", is_mandatory=True) + p = EventParser(cluster, {}, base_events=[base_evt]) + root = _cluster_root_with_events(_event_xml("New", "0x0001")) + p.parse(root) + names = {e.func_name for e in cluster.events} + self.assertIn("base_evt", names) + + +# --------------------------------------------------------------------------- +# FeatureParser +# --------------------------------------------------------------------------- + + +class TestFeatureParser(unittest.TestCase): + """Test FeatureParser — feature map creation, feature ID generation, item linking.""" + + def _feature_root(self, *features_data): + root = Element("cluster", name="Test", id="0x0001", revision="1") + features_section = SubElement(root, "features") + for name, code, bit in features_data: + feat_el = SubElement( + features_section, "feature", name=name, code=code, bit=str(bit) + ) + SubElement(feat_el, "optionalConform") + return root + + def test_feature_map_creation(self): + root = self._feature_root(("Lighting", "LT", 0), ("ColorTemp", "CT", 1)) + cluster = _make_cluster() + p = FeatureParser(root, cluster, []) + self.assertIn("LT", p.feature_map) + self.assertIn("CT", p.feature_map) + + def test_feature_id_generation(self): + root = self._feature_root(("Lighting", "LT", 0)) + cluster = _make_cluster() + p = FeatureParser(root, cluster, []) + elem = Element("feature", bit="3") + fid = p._generate_feature_id(elem) + self.assertEqual(fid, hex(0x1 << 3)) + + def test_feature_id_bit_0(self): + root = self._feature_root(("Lighting", "LT", 0)) + cluster = _make_cluster() + p = FeatureParser(root, cluster, []) + elem = Element("feature", bit="0") + fid = p._generate_feature_id(elem) + self.assertEqual(fid, "0x1") + + def test_parse_adds_to_cluster(self): + root = self._feature_root(("Lighting", "LT", 0), ("ColorTemp", "CT", 1)) + cluster = _make_cluster() + p = FeatureParser(root, cluster, []) + p.parse(root) + self.assertGreaterEqual(len(cluster.features), 1) + + def test_create_feature(self): + root = self._feature_root(("Lighting", "LT", 0)) + cluster = _make_cluster() + p = FeatureParser(root, cluster, []) + elem = Element("feature", name="Lighting", code="LT", bit="0") + feat = p.create(elem) + self.assertEqual(feat.code, "LT") + + def test_feature_map_excludes_restricted(self): + root = Element("cluster", name="Test", id="0x0001", revision="1") + features_section = SubElement(root, "features") + feat_el = SubElement( + features_section, "feature", name="Deprecated", code="DP", bit="0" + ) + SubElement(feat_el, "deprecateConform") + cluster = _make_cluster() + p = FeatureParser(root, cluster, []) + self.assertNotIn("DP", p.feature_map) + + def test_base_features_merged_into_map(self): + base_feat = Feature(name="BaseFeature", code="BF", id="0x0010") + root = self._feature_root(("Lighting", "LT", 0)) + cluster = _make_cluster() + p = FeatureParser(root, cluster, [base_feat]) + self.assertIn("BF", p.feature_map) + + +# --------------------------------------------------------------------------- +# ClusterParseContext +# --------------------------------------------------------------------------- + + +class TestClusterParseContext(unittest.TestCase): + """Test ClusterParseContext — pre-loaded metadata lookups.""" + + def _ctx(self, zap=None, managed=None): + return ClusterParseContext( + delegate_clusters=[], + plugin_init_cb_clusters=[], + migrated_clusters=[], + zap_filter_list=zap or {}, + internally_managed_attributes=managed or {}, + ) + + def test_get_allowed_attributes_empty(self): + ctx = self._ctx() + self.assertEqual(ctx.get_allowed_attributes("0x0001"), []) + + def test_get_allowed_attributes(self): + zap = { + "clusters": { + "0x0006": {"Attributes": {"OnOff": "0x0000", "Level": "0x0001"}} + } + } + ctx = self._ctx(zap=zap) + result = ctx.get_allowed_attributes("0x0006") + self.assertEqual(len(result), 2) + self.assertIn(0, result) + self.assertIn(1, result) + + def test_get_allowed_commands(self): + zap = {"clusters": {"0x0006": {"Commands": {"Off": "0x0000"}}}} + ctx = self._ctx(zap=zap) + result = ctx.get_allowed_commands("0x0006") + self.assertEqual(result, [0]) + + def test_get_allowed_events(self): + zap = {"clusters": {"0x0006": {"Events": {"StateChange": "0x0000"}}}} + ctx = self._ctx(zap=zap) + result = ctx.get_allowed_events("0x0006") + self.assertEqual(result, [0]) + + def test_get_internally_managed_attributes(self): + ctx = self._ctx(managed={"on_off": ["on_off", "global_scene_control"]}) + result = ctx.get_internally_managed_attributes("on_off") + self.assertEqual(len(result), 2) + self.assertIn("on_off", result) + + def test_get_internally_managed_missing_cluster(self): + ctx = self._ctx(managed={}) + result = ctx.get_internally_managed_attributes("unknown") + self.assertEqual(result, []) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/tests/test_serializers.py b/tools/data_model_gen/tests/test_serializers.py new file mode 100644 index 000000000..a16101bdf --- /dev/null +++ b/tools/data_model_gen/tests/test_serializers.py @@ -0,0 +1,236 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Tests for xml_processing/serializers.py — dict conversion for all element types.""" + +import unittest +import sys +import os + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from xml_processing.elements import Attribute, Command, Event, Feature, Cluster, Device # noqa: E402 +from xml_processing.data_type_parser import Item, Enum # noqa: E402 +from xml_processing.serializers import DataTypeSerializer # noqa: E402 + + +class TestAttributeSerialization(unittest.TestCase): + """Test Attribute.to_dict() serialization.""" + + def test_basic_attribute_dict(self): + attr = Attribute( + name="TestAttr", + id="0x0000", + type_="bool", + default_value="false", + is_mandatory=True, + ) + d = attr.to_dict() + self.assertIn("name", d) + self.assertEqual(d["id"], "0x0000") + self.assertEqual(d["type"], "bool") + self.assertIn("default_value", d) + self.assertIn("flags", d) + self.assertIn("mandatory", d) + + def test_attribute_with_bounds(self): + attr = Attribute( + name="temp", + id="0x0001", + type_="int16", + default_value="0", + is_mandatory=True, + ) + attr.min_value = -100 + attr.max_value = 100 + d = attr.to_dict() + self.assertEqual(d["min_value"], -100) + self.assertEqual(d["max_value"], 100) + + def test_attribute_with_access(self): + access = Attribute.Access( + read="true", readPrivilege="view", write="true", writePrivilege="operate" + ) + attr = Attribute( + name="test", + id="0x0001", + type_="uint8", + default_value="0", + is_mandatory=True, + access=access, + ) + d = attr.to_dict() + self.assertIsNotNone(d["access"]) + + def test_attribute_nullable(self): + quality = Attribute.Quality( + changeOmitted="false", + nullable="true", + scene="false", + persistence="volatile", + reportable="false", + ) + attr = Attribute( + name="test", + id="0x0001", + type_="uint8", + default_value="0", + is_mandatory=True, + quality=quality, + ) + d = attr.to_dict() + self.assertTrue(d["nullable"]) + + +class TestCommandSerialization(unittest.TestCase): + """Test Command.to_dict() serialization.""" + + def test_basic_command_dict(self): + cmd = Command( + id="0x0001", + name="Off", + direction="commandToServer", + response="Y", + is_mandatory=True, + ) + d = cmd.to_dict() + self.assertEqual(d["name"], "Off") + self.assertEqual(d["id"], "0x0001") + self.assertIn("direction", d) + self.assertIn("flags", d) + + def test_command_with_fields(self): + cmd = Command( + id="0x0001", + name="MoveToLevel", + direction="commandToServer", + response="Y", + is_mandatory=True, + ) + field = Command.CommandField(id="0x00", name="level", type_="uint8") + cmd.add_field(field) + d = cmd.to_dict() + self.assertIn("fields", d) + self.assertEqual(len(d["fields"]), 1) + + +class TestEventSerialization(unittest.TestCase): + """Test Event.to_dict() serialization.""" + + def test_basic_event_dict(self): + evt = Event(id="0x0001", name="StateChange", is_mandatory=True) + d = evt.to_dict() + self.assertEqual(d["name"], "StateChange") + self.assertEqual(d["id"], "0x0001") + self.assertIn("mandatory", d) + + +class TestFeatureSerialization(unittest.TestCase): + """Test Feature.to_dict() serialization.""" + + def test_basic_feature_dict(self): + feat = Feature(name="Lighting", code="LT", id="0x0001") + d = feat.to_dict() + self.assertEqual(d["name"], feat.name) + self.assertEqual(d["id"], "0x0001") + self.assertIn("code", d) + self.assertEqual(d["code"], "LT") + + def test_feature_with_attributes(self): + feat = Feature(name="Lighting", code="LT", id="0x0001") + attr = Attribute( + name="Level", + id="0x0002", + type_="uint8", + default_value="0", + is_mandatory=True, + ) + feat.add_attribute_list({attr}) + d = feat.to_dict() + self.assertIn("attributes", d) + self.assertEqual(len(d["attributes"]), 1) + + +class TestClusterSerialization(unittest.TestCase): + """Test Cluster.to_dict() serialization.""" + + def test_basic_cluster_dict(self): + c = Cluster(name="OnOff", id="0x0006", revision=6) + d = c.to_dict() + self.assertEqual(d["name"], c.name) + self.assertEqual(d["id"], "0x0006") + self.assertEqual(d["revision"], 6) + self.assertIn("attributes", d) + self.assertIn("commands", d) + self.assertIn("events", d) + self.assertIn("features", d) + + def test_cluster_with_elements(self): + c = Cluster(name="OnOff", id="0x0006", revision=6) + attr = Attribute( + name="OnOff", + id="0x0000", + type_="bool", + default_value="false", + is_mandatory=True, + ) + cmd = Command( + id="0x0001", + name="Off", + direction="commandToServer", + response="Y", + is_mandatory=True, + ) + c.attributes.add(attr) + c.commands.add(cmd) + d = c.to_dict() + self.assertEqual(len(d["attributes"]), 1) + self.assertEqual(len(d["commands"]), 1) + + +class TestDeviceSerialization(unittest.TestCase): + """Test Device.to_dict() serialization.""" + + def test_basic_device_dict(self): + dev = Device(id="0x0100", name="On/Off Light", revision=3) + d = dev.to_dict() + self.assertIn("name", d) + self.assertEqual(d["id"], "0x0100") + self.assertIn("clusters", d) + + def test_device_with_clusters(self): + dev = Device(id="0x0100", name="On/Off Light", revision=3) + c = Cluster(name="OnOff", id="0x0006", revision=6) + c.server_cluster = True + dev.clusters.add(c) + d = dev.to_dict() + self.assertEqual(len(d["clusters"]), 1) + + +class TestDataTypeSerializer(unittest.TestCase): + """Test DataTypeSerializer — data type dict conversion.""" + + def test_serialize_enums(self): + items = [Item("A", "0", "", True), Item("B", "1", "", False)] + enums = {"TestEnum": Enum("TestEnum", "enum8", items)} + result = DataTypeSerializer.to_dict({"enums": enums}) + self.assertIn("enums", result) + self.assertEqual(len(result["enums"]), 1) + + def test_serialize_empty(self): + result = DataTypeSerializer.to_dict({"enums": {}, "bitmaps": {}}) + self.assertEqual(len(result["enums"]), 0) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/data_model_gen/utils/__init__.py b/tools/data_model_gen/utils/__init__.py new file mode 100644 index 000000000..4c7781eaa --- /dev/null +++ b/tools/data_model_gen/utils/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Utility functions for the data model generation""" diff --git a/tools/data_model_gen/utils/base_elements.py b/tools/data_model_gen/utils/base_elements.py new file mode 100644 index 000000000..3534bd2ea --- /dev/null +++ b/tools/data_model_gen/utils/base_elements.py @@ -0,0 +1,200 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from abc import ABC, abstractmethod +from xml.etree import ElementTree +from typing import List +from utils.overrides import ( + is_cpp_reserved_word, + normalize_cluster_display_name, + normalize_device_type_name, + normalize_feature_name, + get_special_config_for_element, +) +from utils.helper import chip_name, convert_to_snake_case, esp_name + + +class BaseElement(ABC): + """Base class for all elements in the Matter data model""" + + def __init__(self, name, id, element_type): + assert name, "Name is required" + self.element_type = element_type + self.id = id + self.name = name.replace(" ", "_") + self.esp_name = esp_name(name) + self.chip_name = chip_name(name) + self.func_name = convert_to_snake_case(name) + + self.special_config = get_special_config_for_element( + element_name=self.func_name, cluster_id=None, element_id=self.id + ) + + def get_id(self): + """Get the ID of the element""" + return self.id + + def has_special_config(self) -> bool: + return self.special_config is not None + + def get_special_config(self) -> str: + return self.special_config if self.has_special_config() else None + + +class BaseClusterElement(BaseElement): + """Base class for elements within a cluster""" + + def __init__(self, name, id, is_mandatory, element_type): + if name and is_cpp_reserved_word(name): + name = f"{name}_{element_type}" + if name and element_type == "Cluster": + name = normalize_cluster_display_name( + name, cluster_id=id if element_type == "Cluster" else None + ) + super().__init__(name=name, id=id, element_type=element_type) + self.is_mandatory = is_mandatory + + +class BaseAttribute(BaseClusterElement): + """Base class for attributes""" + + def __init__(self, name, id, type_, is_mandatory, default_value): + super().__init__( + name=name, id=id, is_mandatory=is_mandatory, element_type="Attribute" + ) + self.type = type_ + self.default_value = default_value + self.is_nullable = False + + +class BaseCommand(BaseClusterElement): + """Base class for commands""" + + def __init__(self, name, id, is_mandatory, direction, response): + super().__init__( + name=name, id=id, is_mandatory=is_mandatory, element_type="Command" + ) + self.direction = direction + self.response = response + + +class BaseEvent(BaseClusterElement): + """Base class for events""" + + def __init__(self, name, id, is_mandatory): + super().__init__( + name=name, id=id, is_mandatory=is_mandatory, element_type="Event" + ) + + +class BaseFeature(BaseClusterElement): + """Base class for features""" + + def __init__(self, name, id, is_mandatory): + name = normalize_feature_name(name, feature_id=id) + super().__init__( + name=name, id=id, is_mandatory=is_mandatory, element_type="Feature" + ) + + @abstractmethod + def get_attributes(self) -> List[BaseAttribute]: + """Get the list of attributes""" + pass + + @abstractmethod + def get_commands(self) -> List[BaseCommand]: + """Get the list of commands""" + pass + + @abstractmethod + def get_events(self) -> List[BaseEvent]: + """Get the list of events""" + pass + + +class BaseCluster(BaseClusterElement): + """Base class for clusters""" + + def __init__(self, name, id, revision, is_mandatory): + super().__init__( + name=name, id=id, is_mandatory=is_mandatory, element_type="Cluster" + ) + self.revision = revision + self.server_cluster = False + self.client_cluster = False + self.command_handler_available = False + self.init_function_available = False + self.attribute_changed_function_available = False + self.shutdown_function_available = False + self.pre_attribute_change_function_available = False + self.delegate_init_callback_available = False + self.plugin_init_cb_available = False + + self.delegate_init_callback = None + self.plugin_server_init_callback = None + self.role = None + + def get_revision(self): + """Get the revision of the cluster""" + return self.revision + + @abstractmethod + def get_attributes(self) -> List[BaseAttribute]: + """Get the list of attributes""" + pass + + @abstractmethod + def get_commands(self) -> List[BaseCommand]: + """Get the list of commands""" + pass + + @abstractmethod + def get_events(self) -> List[BaseEvent]: + """Get the list of events""" + pass + + @abstractmethod + def get_features(self) -> List[BaseFeature]: + """Get the list of features""" + pass + + +class BaseDevice(BaseElement): + """Base class for devices""" + + def __init__(self, name, id, revision): + name = normalize_device_type_name(name, device_id=id) + super().__init__(name=name, id=id, element_type="Device") + self.filename = self.esp_name + "_device" + self.revision = revision + + def get_device_type_id(self): + """Get the device type ID""" + return self.id + + def get_device_type_version(self): + """Get the device type version""" + return self.revision + + @abstractmethod + def get_clusters(self) -> List[BaseCluster]: + """Get the list of clusters""" + pass + + +class BaseElementParser(ABC): + """Base class for element parsers""" + + @abstractmethod + def parse(self, element: ElementTree.Element): + raise NotImplementedError diff --git a/tools/data_model_gen/utils/config.py b/tools/data_model_gen/utils/config.py new file mode 100644 index 000000000..981af9004 --- /dev/null +++ b/tools/data_model_gen/utils/config.py @@ -0,0 +1,144 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import logging +import os +from enum import Enum + +from .exceptions import ConfigurationError +from colorlog import ColoredFormatter +import sys + +# Use %(filename)s instead of %(pathname)s to get just the filename +LOG_FORMAT_STRING = "[%(levelname)s] %(filename)s:%(lineno)d: %(message)s" + +COLORED_FORMATTER = ColoredFormatter( + "%(log_color)s" + LOG_FORMAT_STRING, + log_colors={ + "DEBUG": "cyan", + "INFO": "green", + "WARNING": "yellow", + "ERROR": "red", + "CRITICAL": "bold_red", + }, +) + +DEFAULT_OUTPUT_DIR = "out" +DEFAULT_CHIP_VERSION = "1.5" + +SPECIFICATION_VERSIONS = ["1.1", "1.2", "1.3", "1.4", "1.4.2", "1.5", "1.6"] + +ALLOW_PROVISIONAL = False + +DEFAULT_DATA_MODEL_DIR = None + +ESP_MATTER_PATH = None + + +def allow_provisional(): + """ + Check if provisional elements are allowed. + """ + return ALLOW_PROVISIONAL + + +def setup_provisional_mode(allow: bool): + """ + Setup provisional mode. + + Args: + allow: Whether to allow provisional elements + """ + global ALLOW_PROVISIONAL + ALLOW_PROVISIONAL = allow + + +def get_default_data_model_dir(): + """ + Get the default data model directory. + """ + esp_path = ESP_MATTER_PATH or os.getenv("ESP_MATTER_PATH", "") + if not esp_path or not os.path.isdir(esp_path): + raise ConfigurationError( + "ESP Matter path is not set or is not a directory", + context="get_default_data_model_dir", + suggestion="Set ESP_MATTER_PATH environment variable to the esp-matter repository root.", + ) + return os.path.join(esp_path, "components", "esp_matter", "data_model", "generated") + + +def set_esp_matter_path(path: str): + """ + Set the ESP Matter path. + + Args: + path: The path to the ESP Matter repository + + Raises: + ConfigurationError: If path is empty or does not exist. + """ + if not path or not path.strip(): + raise ConfigurationError( + "ESP Matter path is empty", + context="set_esp_matter_path", + suggestion="Set ESP_MATTER_PATH environment variable to the esp-matter repository root.", + ) + if not os.path.isdir(path): + raise ConfigurationError( + f"ESP Matter path is not a directory: {path}", + context="set_esp_matter_path", + suggestion="Ensure ESP_MATTER_PATH points to an existing directory.", + ) + global ESP_MATTER_PATH + ESP_MATTER_PATH = path + global DEFAULT_DATA_MODEL_DIR + DEFAULT_DATA_MODEL_DIR = os.path.join( + ESP_MATTER_PATH, "components", "esp_matter", "data_model", "generated" + ) + + +def setup_logger(log_level="INFO", is_colored=False): + """ + Sets up a logger with the specified level and color formatting. + + Args: + log_level: Logging level to use + is_colored: Whether to use colored output + """ + root_logger = logging.getLogger() + root_logger.setLevel(log_level) + + if root_logger.hasHandlers(): + root_logger.handlers.clear() + + stream_handler = logging.StreamHandler(sys.stdout) + + if is_colored: + stream_handler.setFormatter(COLORED_FORMATTER) + else: + stream_handler.setFormatter(logging.Formatter(LOG_FORMAT_STRING)) + + root_logger.addHandler(stream_handler) + + +class FileNames(Enum): + """Enum for file names used by the data model generation tool""" + + INTERNALLY_MANAGED_ATTRIBUTES = "internally_managed_attributes.json" + DELEGATE_CLUSTERS = "delegate_clusters.json" + PLUGIN_INIT_CB_CLUSTERS = "plugin_init_cb_clusters.json" + CLUSTER_MAPPING = "cluster_mapping.json" + MIGRATED_CLUSTERS = "migrated_clusters.json" + ZAP_FILTER_LIST = "zap_filter_list.json" + CLUSTER_JSON = "clusters.json" + DEVICE_JSON = "device_types.json" diff --git a/tools/data_model_gen/utils/conformance.py b/tools/data_model_gen/utils/conformance.py new file mode 100644 index 000000000..8057f66cf --- /dev/null +++ b/tools/data_model_gen/utils/conformance.py @@ -0,0 +1,119 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import logging +from enum import Enum, auto +from dataclasses import dataclass +from typing import Optional + +from utils.exceptions import DataModelGenError + +logger = logging.getLogger(__name__) + +SUPPORTED_CONFORMANCE_TAGS = { + "mandatoryConform", + "optionalConform", + "otherwiseConform", + "deprecateConform", + "disallowConform", + "provisionalConform", + "describedConform", +} + + +class ConformanceException(DataModelGenError): + """Exception raised when conformance parsing fails""" + + def __init__( + self, msg, context: Optional[str] = None, suggestion: Optional[str] = None + ): + super().__init__(msg, context=context, suggestion=suggestion) + + +class ConformanceDecision(Enum): + MANDATORY = auto() + OPTIONAL = auto() + OTHERWISE = auto() + DEPRECATED = auto() + DISALLOWED = auto() + PROVISIONAL = auto() + DESCRIBED = auto() + NOT_APPLICABLE = auto() + + def to_string(self): + return self.name.lower() + + +class ConformanceTAG(Enum): + FEATURE = "feature" + ATTRIBUTE = "attribute" + COMMAND = "command" + COMMAND_FLAG = "flag" + EVENT = "event" + CONDITION = "condition" + GREATER = "greater" + EQUAL = "equal" + TRUE = "true" + FALSE = "false" + NON = "non" + NOT = "not" + AND = "and" + OR = "or" + + +def get_conformance_type(conformance_type: str) -> ConformanceDecision: + if conformance_type == "mandatory" or conformance_type == "mandatoryConform": + return ConformanceDecision.MANDATORY + elif conformance_type == "optional" or conformance_type == "optionalConform": + return ConformanceDecision.OPTIONAL + elif conformance_type == "otherwise" or conformance_type == "otherwiseConform": + return ConformanceDecision.OTHERWISE + elif conformance_type == "deprecated" or conformance_type == "deprecateConform": + return ConformanceDecision.DEPRECATED + elif conformance_type == "disallow" or conformance_type == "disallowConform": + return ConformanceDecision.DISALLOWED + elif conformance_type == "provisional" or conformance_type == "provisionalConform": + return ConformanceDecision.PROVISIONAL + elif conformance_type == "described" or conformance_type == "describedConform": + return ConformanceDecision.DESCRIBED + else: + logger.warning(f"Unknown conformance type: {conformance_type}") + return ConformanceDecision.NOT_APPLICABLE + + +@dataclass(frozen=True) +class Choice: + marker: str = None + more: bool = False + + def __str__(self): + marker_str = self.marker if self.marker else "" + more_str = "+" if self.more else "" + return marker_str + more_str + + def to_dict(self): + result = {} + if self.marker: + result["choice"] = self.marker + if self.more: + result["more"] = self.more + result["min"] = 1 + return result + + +@dataclass +class BaseConformance: + """Base class for conformance.""" + + type: ConformanceDecision = None + choice: Optional[Choice] = None diff --git a/tools/data_model_gen/utils/conversion_utils.py b/tools/data_model_gen/utils/conversion_utils.py new file mode 100644 index 000000000..7bf593466 --- /dev/null +++ b/tools/data_model_gen/utils/conversion_utils.py @@ -0,0 +1,55 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +def convert_to_int(value, default=None): + """Convert a string or int value to an integer. Handles hex (0x...) and decimal strings.""" + if value is None: + return default + try: + if isinstance(value, int): + return value + if isinstance(value, str): + return int(value, 16) if value.startswith("0x") else int(value) + return default + except ValueError: + return default + + +def hex_to_int(value): + """Convert a hex string (or list of hex strings) to integer(s).""" + if isinstance(value, list): + return [hex_to_int(v) for v in value] + if isinstance(value, int): + return value + if isinstance(value, str): + return int(value, 16) + return value + + +def is_hex_value(value): + """Check if a value is a valid hex value e.g. 0x0001""" + try: + int(value, 16) + return True + except ValueError: + return False + + +def format_hex_value(hex_value): + """Format a hex value by removing unnecessary leading zeros e.g. 0x00000001 -> 0x0001""" + if hex_value and hex_value.startswith("0x"): + int_value = int(hex_value, 16) + return f"0x{int_value:04X}" + return hex_value diff --git a/tools/data_model_gen/utils/exceptions.py b/tools/data_model_gen/utils/exceptions.py new file mode 100644 index 000000000..10395c006 --- /dev/null +++ b/tools/data_model_gen/utils/exceptions.py @@ -0,0 +1,72 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Custom exception classes for the data model generator. + +All exceptions include optional context (file_path, line_number, cluster/device name) +and optional suggestion for fixing the issue to improve error and debug messages. +""" + +from typing import Optional + + +class DataModelGenError(Exception): + """Base exception for all data model generator errors.""" + + def __init__( + self, + message: str, + *, + file_path: Optional[str] = None, + line_number: Optional[int] = None, + context: Optional[str] = None, + suggestion: Optional[str] = None, + ): + self.message = message + self.file_path = file_path + self.line_number = line_number + self.context = context + self.suggestion = suggestion + parts = [message] + if file_path: + parts.append(f"File: {file_path}") + if line_number is not None: + parts.append(f"Line: {line_number}") + if context: + parts.append(f"Context: {context}") + if suggestion: + parts.append(f"Suggestion: {suggestion}") + super().__init__(" | ".join(parts)) + + def __str__(self) -> str: + return self.args[0] if self.args else self.message + + +class XmlParseError(DataModelGenError): + """Raised when XML parsing fails (invalid structure, missing elements, etc.).""" + + pass + + +class CodeGenerationError(DataModelGenError): + """Raised when code generation fails (template render, file write, etc.).""" + + pass + + +class ConfigurationError(DataModelGenError): + """Raised when configuration is invalid or required config is missing.""" + + pass diff --git a/tools/data_model_gen/utils/helper.py b/tools/data_model_gen/utils/helper.py new file mode 100644 index 000000000..55d176f23 --- /dev/null +++ b/tools/data_model_gen/utils/helper.py @@ -0,0 +1,128 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import json +import re +import logging + +from utils.conversion_utils import is_hex_value +from utils.overrides import normalize_element_name + +logger = logging.getLogger(__name__) + + +def chip_name(name): + """Convert a name to as per the chip naming convention e.g. On/Off -> OnOff + + Args: + name: The name to convert + Returns: + The converted name + """ + if re.match(r"^[A-Z][a-zA-Z0-9]+$", name): + return name + name = re.sub(r"[^a-zA-Z0-9]", " ", name) + words = [word.capitalize() for word in name.split()] + name = "".join(words) + name = name.replace("DishWasher", "Dishwasher") + return name + + +def esp_name(name): + """Convert a name to as per the esp matter naming convention e.g. On/Off -> on_off + + Args: + name: The name to convert + Returns: + The converted name + """ + name = re.sub(r"[^a-zA-Z0-9_]", "_", name) + return name.lower() + + +def convert_to_snake_case(name): + """Convert a name to snake_case. PM2.5 Concentration Measurement -> pm2_5_concentration_measurement + + Args: + name: The name to convert + Returns: + The converted name + """ + if not name: + return name + if name.endswith("Command"): + name = name[:-7].replace(" ", "_") + name = normalize_element_name(name) + name = re.sub(r"\s+", "_", name) + name = re.sub(r"[\/_|\{\}\(\)\\-]", "_", name) + name = re.sub(r"([A-Z]+)([A-Z][a-z])", r"\1_\2", name) + name = re.sub(r"([a-zA-Z])([0-9])", r"\1_\2", name) + name = re.sub(r"([a-z0-9])([A-Z])", r"\1_\2", name) + return name.lower() + + +def check_valid_id(id): + """Check if an id is valid. + + Args: + id: The id to check + Returns: + True if the id is valid, False otherwise + """ + if id is None or id == "": + return False + elif not id.startswith("0x"): + return False + elif not is_hex_value(id): + return False + return True + + +def safe_get_attr(obj, attr_name, default=None): + """Safely get an attribute from an object, returning default if attribute doesn't exist + + Args: + obj: The object to get the attribute from + attr_name: The name of the attribute to get + default: The default value to return if the attribute doesn't exist + Returns: + The attribute value if it exists, otherwise the default value + """ + return getattr(obj, attr_name, default) if obj else default + + +def write_to_file(file_path, data, file_type="default") -> bool: + """Write data to a file. + + Args: + file_path: Path to the file where the data will be written. + data: The data to write. For ``file_type="json"`` this must be a + JSON-serializable object; otherwise it must be a string. + file_type: ``"json"`` to ``json.dump()`` the data with indent=4, + anything else to write the raw string. + + Returns: + ``True`` on success. + + Raises: + Exception: Re-raised wrapping the underlying I/O error on failure. + """ + try: + with open(file_path, "w") as f: + if file_type == "json": + json.dump(data, f, indent=4) + else: + f.write(data) + return True + except Exception as e: + raise Exception("Error writing to file") from e diff --git a/tools/data_model_gen/utils/overrides.py b/tools/data_model_gen/utils/overrides.py new file mode 100644 index 000000000..a4021b3ad --- /dev/null +++ b/tools/data_model_gen/utils/overrides.py @@ -0,0 +1,363 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from typing import Dict, FrozenSet, Optional, Tuple + +from utils.conversion_utils import convert_to_int + + +# ── Cluster-level skip / include sets (keyed by cluster ID) ───────────────── + +COMMAND_CALLBACK_SKIP: FrozenSet[int] = frozenset( + [ + 0x0039, # bridged_device_basic_information + ] +) + +DELEGATE_CALLBACK_SKIP: FrozenSet[int] = frozenset( + [ + 0x0552, # camera_av_settings_user_level_management + 0x0551, # camera_av_stream_management + 0x0553, # webrtc_transport_provider + 0x0554, # webrtc_transport_requestor + 0x0801, # tls_certificate_management + 0x0802, # tls_client_management + 0x0550, # zone_management + ] +) + +# TODO: To be removed once the delegate callback is present in the codebase +# connectedhomeip/src/app/clusters/mode-select/ +DELEGATE_CALLBACK_INCLUDE: FrozenSet[int] = frozenset( + [ + 0x0050, # mode_select + ] +) + +PLUGIN_CALLBACK_SKIP: FrozenSet[int] = frozenset( + [ + 0x0046, # icd_management + ] +) + + +# ── Cluster display name overrides ────────────────────────────────────────── +# (cluster_id, original_name_key, corrected_name) +_CLUSTER_NAME_OVERRIDE_DEFS = ( + (0x003E, "Node Operational Credentials", "Operational Credentials"), + (0x0096, "Demand Response and Load Control", "Demand Response Load Control"), + (0x0503, "WakeOnLAN", "Wake on LAN"), + (0x0006, "OnOff", "On/Off"), + (0x005D, "Dishwasher Alarm", "Dish Washer Alarm"), + (0x0059, "Dishwasher Mode", "Dish Washer Mode"), +) + +CLUSTER_NAME_OVERRIDES: Dict[int, str] = { + cid: corrected for cid, _, corrected in _CLUSTER_NAME_OVERRIDE_DEFS +} + +_CLUSTER_NAME_OVERRIDES_BY_NAME: Dict[str, str] = { + orig: corrected for _, orig, corrected in _CLUSTER_NAME_OVERRIDE_DEFS +} + + +# ── Feature name overrides ────────────────────────────────────────────────── +# (cluster_id, feature_id, original_name, corrected_name) +_FEATURE_NAME_OVERRIDE_DEFS = ( + (0x0101, 0x0010, "WeekDayAccessSchedules", "weekday_access_schedules"), # Door Lock + (0x0202, 0x0002, "Auto", "fan_auto"), # Fan Control +) + +FEATURE_NAME_OVERRIDES: Dict[Tuple[int, int], str] = { + (cid, fid): corrected for cid, fid, _, corrected in _FEATURE_NAME_OVERRIDE_DEFS +} + +_FEATURE_NAME_OVERRIDES_BY_NAME: Dict[str, str] = { + orig: corrected for _, _, orig, corrected in _FEATURE_NAME_OVERRIDE_DEFS +} + + +# ── Device type name overrides ────────────────────────────────────────────── +# (device_id, original_name, corrected_name) +_DEVICE_NAME_OVERRIDE_DEFS = ((0x0075, "Dishwasher", "Dish Washer"),) + +DEVICE_NAME_OVERRIDES: Dict[int, str] = { + did: corrected for did, _, corrected in _DEVICE_NAME_OVERRIDE_DEFS +} + +_DEVICE_NAME_OVERRIDES_BY_NAME: Dict[str, str] = { + orig: corrected for _, orig, corrected in _DEVICE_NAME_OVERRIDE_DEFS +} + + +# ── Element name overrides (attribute/command/event name corrections) ─────── +# (cluster_id, element_id, original_name, corrected_name) +_ELEMENT_NAME_OVERRIDE_DEFS = ( + ( + 0x0101, + 0x0033, + "RequirePINforRemoteOperation", + "require_pin_for_remote_operation", + ), # Door Lock + (0x0099, 0x0026, "NextChargeTargetSoC", "next_charge_target_soc"), # Energy EVSE +) + +ELEMENT_NAME_OVERRIDES: Dict[Tuple[int, int], str] = { + (cid, eid): corrected for cid, eid, _, corrected in _ELEMENT_NAME_OVERRIDE_DEFS +} + +_ELEMENT_NAME_OVERRIDES_BY_NAME: Dict[str, str] = { + orig: corrected for _, _, orig, corrected in _ELEMENT_NAME_OVERRIDE_DEFS +} + + +# ── Skip internally managed attribute flag ────────────────────────────────── +# cluster_id -> frozenset of attribute_ids to skip +SKIP_INTERNALLY_MANAGED_ATTRIBUTE_FLAG: Dict[int, FrozenSet[int]] = { + 0x0046: frozenset( # icd_management + [ + 0x0006, # user_active_mode_trigger_hint + 0x0007, # user_active_mode_trigger_instruction + ] + ), + 0x0062: frozenset( # scenes_management + [ + 0x0001, # scene_table_size + ] + ), + 0x0201: frozenset( # thermostat + [ + 0x0000, # local_temperature + 0x001A, # remote_sensing + ] + ), + 0x005B: frozenset( # air_quality + [ + 0x0000, # air_quality + ] + ), +} + + +# ── Cluster callback name overrides ───────────────────────────────────────── +# cluster_id -> (init_callback_name, shutdown_callback_name) +CLUSTER_CALLBACK_NAME_OVERRIDES: Dict[int, Tuple[str, str]] = { + 0x0553: ( # webrtc_transport_provider + "ESPMatterWebRTCTransportProviderClusterServerInitCallback", + "ESPMatterWebRTCTransportProviderClusterServerShutdownCallback", + ), + 0x0554: ( # webrtc_transport_requestor + "ESPMatterWebRTCTransportRequestorClusterServerInitCallback", + "ESPMatterWebRTCTransportRequestorClusterServerShutdownCallback", + ), +} + + +# ── Special config (preprocessor guards) ──────────────────────────────────── +# (cluster_id, element_id, element_func_name, config_macro) +# element_id is None for cluster-level configs +_SPECIAL_CONFIG_DEFS = ( + # Cluster-level + (0x0046, None, "icd_management", "CHIP_CONFIG_ENABLE_ICD_SERVER"), + # Attributes + ( + 0x0039, + 0x0012, + "endpoint_unique_id", + "CHIP_CONFIG_USE_ENDPOINT_UNIQUE_ID", + ), # Bridged Device Basic Info - UniqueID + ( + 0x001F, + 0x0005, + "commissioning_arl", + "CHIP_CONFIG_USE_ACCESS_RESTRICTIONS", + ), # Access Control + (0x001F, 0x0006, "arl", "CHIP_CONFIG_USE_ACCESS_RESTRICTIONS"), # Access Control + # Commands + ( + 0x001F, + 0x0000, + "review_fabric_restrictions", + "CHIP_CONFIG_USE_ACCESS_RESTRICTIONS", + ), # Access Control + # Features + ( + 0x0031, + 0x0001, + "wifi_network_interface", + "CHIP_DEVICE_CONFIG_ENABLE_WIFI", + ), # Network Commissioning + ( + 0x0031, + 0x0002, + "thread_network_interface", + "CHIP_DEVICE_CONFIG_ENABLE_THREAD", + ), # Network Commissioning + ( + 0x0031, + 0x0004, + "ethernet_network_interface", + "CHIP_DEVICE_CONFIG_ENABLE_ETHERNET", + ), # Network Commissioning + ( + 0x0046, + 0x0004, + "long_idle_time_support", + "CHIP_CONFIG_ENABLE_ICD_LIT", + ), # ICD Management + ( + 0x0046, + 0x0001, + "check_in_protocol_support", + "CHIP_CONFIG_ENABLE_ICD_CIP", + ), # ICD Management + ( + 0x0046, + 0x0002, + "user_active_mode_trigger", + "CHIP_CONFIG_ENABLE_ICD_UAT", + ), # ICD Management + # Events (none currently) +) + +SPECIAL_CONFIG_LIST: Dict[Tuple[int, Optional[int]], str] = { + (cid, eid): config for cid, eid, _, config in _SPECIAL_CONFIG_DEFS +} + +_SPECIAL_CONFIG_BY_NAME: Dict[str, str] = { + name: config for _, _, name, config in _SPECIAL_CONFIG_DEFS +} + + +# ── C++ reserved words (name-based — not cluster/element related) ─────────── +# can grow over time as we observe more reserved words in the codebase +_RESERVED_WORDS_OBSERVED_IN_PRACTICE: FrozenSet[str] = frozenset( + word.lower() + for word in [ + "auto", + "switch", + ] +) + + +# ── Public API ────────────────────────────────────────────────────────────── + + +def normalize_cluster_display_name(cluster_name: str, cluster_id: str = None) -> str: + """Normalize a cluster display name. Uses ID-based lookup when cluster_id is provided, + falls back to name-based lookup otherwise.""" + if cluster_id is not None: + cid = convert_to_int(cluster_id) + if cid in CLUSTER_NAME_OVERRIDES: + return CLUSTER_NAME_OVERRIDES[cid] + return _CLUSTER_NAME_OVERRIDES_BY_NAME.get(cluster_name, cluster_name) + + +def normalize_feature_name( + feature_name: str, cluster_id: str = None, feature_id: str = None +) -> str: + """Normalize a feature name. Uses ID-based lookup when both cluster_id and feature_id + are provided, falls back to name-based lookup otherwise.""" + if cluster_id is not None and feature_id is not None: + key = (convert_to_int(cluster_id), convert_to_int(feature_id)) + if key in FEATURE_NAME_OVERRIDES: + return FEATURE_NAME_OVERRIDES[key] + return _FEATURE_NAME_OVERRIDES_BY_NAME.get(feature_name, feature_name) + + +def normalize_device_type_name(device_type_name: str, device_id: str = None) -> str: + """Normalize a device type name. Uses ID-based lookup when device_id is provided, + falls back to name-based lookup otherwise.""" + if device_id is not None: + did = convert_to_int(device_id) + if did in DEVICE_NAME_OVERRIDES: + return DEVICE_NAME_OVERRIDES[did] + return _DEVICE_NAME_OVERRIDES_BY_NAME.get(device_type_name, device_type_name) + + +def normalize_element_name( + element_name: str, cluster_id: str = None, element_id: str = None +) -> str: + """Normalize an element name. Uses ID-based lookup when both cluster_id and element_id + are provided, falls back to name-based lookup otherwise.""" + if cluster_id is not None and element_id is not None: + key = (convert_to_int(cluster_id), convert_to_int(element_id)) + if key in ELEMENT_NAME_OVERRIDES: + return ELEMENT_NAME_OVERRIDES[key] + return _ELEMENT_NAME_OVERRIDES_BY_NAME.get(element_name, element_name) + + +def is_cpp_reserved_word(cpp_name: str) -> bool: + return cpp_name.lower() in _RESERVED_WORDS_OBSERVED_IN_PRACTICE + + +def should_skip_cluster_command_callbacks(cluster_id: str) -> bool: + return convert_to_int(cluster_id) in COMMAND_CALLBACK_SKIP + + +def should_skip_delegate_callback(cluster_id: str) -> bool: + return convert_to_int(cluster_id) in DELEGATE_CALLBACK_SKIP + + +def should_include_delegate_callback(cluster_id: str) -> bool: + return convert_to_int(cluster_id) in DELEGATE_CALLBACK_INCLUDE + + +def should_skip_plugin_callback(cluster_id: str) -> bool: + return convert_to_int(cluster_id) in PLUGIN_CALLBACK_SKIP + + +def should_skip_internally_managed_flag(cluster_id: str, attribute_id: str) -> bool: + cid = convert_to_int(cluster_id) + if cid not in SKIP_INTERNALLY_MANAGED_ATTRIBUTE_FLAG: + return False + return convert_to_int(attribute_id) in SKIP_INTERNALLY_MANAGED_ATTRIBUTE_FLAG[cid] + + +def get_overridden_cluster_init_callback_name(cluster_id: str, chip_name: str) -> str: + cid = convert_to_int(cluster_id) + entry = CLUSTER_CALLBACK_NAME_OVERRIDES.get(cid) + if entry: + return entry[0] + return f"ESPMatter{chip_name}ClusterServerInitCallback" + + +def get_overridden_cluster_shutdown_callback_name( + cluster_id: str, chip_name: str +) -> str: + cid = convert_to_int(cluster_id) + entry = CLUSTER_CALLBACK_NAME_OVERRIDES.get(cid) + if entry: + return entry[1] + return f"ESPMatter{chip_name}ClusterServerShutdownCallback" + + +def get_special_config_for_element( + element_name: str, cluster_id: str = None, element_id: str = None +) -> str: + """Look up the special config (preprocessor guard) for an element. + Uses (cluster_id, element_id) pair when both are provided, + falls back to element_name-based lookup otherwise.""" + # ID-based lookup with both cluster and element ID + if cluster_id is not None and element_id is not None: + cid = convert_to_int(cluster_id) + eid = convert_to_int(element_id) + result = SPECIAL_CONFIG_LIST.get((cid, eid)) + if result: + return result + + # Fallback to name-based lookup + if element_name is not None: + return _SPECIAL_CONFIG_BY_NAME.get(element_name) + + return None diff --git a/tools/data_model_gen/utils/tree_sitter_utils.py b/tools/data_model_gen/utils/tree_sitter_utils.py new file mode 100644 index 000000000..391168885 --- /dev/null +++ b/tools/data_model_gen/utils/tree_sitter_utils.py @@ -0,0 +1,68 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import re + + +def get_function_by_keywords(node, code_bytes, keywords=None): + """Find all function definitions containing any of the keywords. + + :param node: The AST node to search from + :param code_bytes: The source code as bytes + :param keywords: Iterable of substrings to match against function declarations. + If None or empty, no functions match. + :returns: List of matching function nodes + """ + keywords = keywords or () + results = [] + if node.type == "function_definition": + decl_node = node.child_by_field_name("declarator") + if decl_node: + name = code_bytes[decl_node.start_byte : decl_node.end_byte].decode( + "utf8", errors="ignore" + ) + if any(keyword in name for keyword in keywords): + results.append(node) + + for child in node.children: + results.extend(get_function_by_keywords(child, code_bytes, keywords)) + return results + + +def extract_case_labels(node, code_bytes, regex_pattern): + """Find all case statements and extract matches for ``regex_pattern``. + + :param node: The AST node to search from + :param code_bytes: The source code as bytes + :param regex_pattern: A regex string (or compiled pattern) to apply against + each case statement's source. Required — passing an + empty default would produce a TypeError from re.findall. + :returns: List of matching label strings. + """ + labels = [] + + if node.type == "case_statement": + src = code_bytes[node.start_byte : node.end_byte].decode( + "utf8", errors="ignore" + ) + matches = re.findall(regex_pattern, src) + if matches: + for match in matches: + parts = match.split("::") + if len(parts) >= 2 and "Id" in parts[-1]: + labels.append(parts[-2].lower()) + + for child in node.children: + labels.extend(extract_case_labels(child, code_bytes, regex_pattern)) + + return labels diff --git a/tools/data_model_gen/xml_processing/__init__.py b/tools/data_model_gen/xml_processing/__init__.py new file mode 100644 index 000000000..23785cefd --- /dev/null +++ b/tools/data_model_gen/xml_processing/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""XML processing logic for the data model generation""" diff --git a/tools/data_model_gen/xml_processing/attribute_parser.py b/tools/data_model_gen/xml_processing/attribute_parser.py new file mode 100644 index 000000000..62be4eabd --- /dev/null +++ b/tools/data_model_gen/xml_processing/attribute_parser.py @@ -0,0 +1,176 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import logging +from xml.etree.ElementTree import Element + +from .conformance_parser import parse_conformance, is_mandatory +from .data_type_parser import resolve_attribute_type, resolve_attribute_bounds +from .element_parser_base import ClusterElementBaseParser +from .elements import Attribute, Cluster +from .attribute_type import attribute_type_map +from utils.overrides import should_skip_internally_managed_flag +from typing import List +from utils.helper import safe_get_attr + +logger = logging.getLogger(__name__) + + +class AttributeParser(ClusterElementBaseParser): + """Parses cluster attributes from XML.""" + + def __init__( + self, + cluster: Cluster, + feature_map: dict, + managed_attributes: list, + allowed_attributes_ids: list = None, + base_attributes: List[Attribute] = None, + ): + super().__init__( + cluster, feature_map, allowed_attributes_ids or [], base_attributes or [] + ) + self.managed_attributes = managed_attributes if managed_attributes else [] + + def parse(self, root) -> None: + """ + Parse attributes from cluster XML root and add to cluster.attributes. Merges base_attributes not already present. + Raises: + XmlParseError: From resolve_attribute_type if an attribute has no type. + """ + logger.debug( + f"Parsing attributes for cluster {safe_get_attr(self.cluster, 'name')}" + ) + for elem in root.findall("attributes/attribute"): + skip, reason = self.can_skip(elem) + if skip: + logger.debug("Skipping attribute %s: %s", elem.get("name"), reason) + continue + attr = self.create(elem) + self._apply_type_overrides(attr, elem) + self.cluster.attributes.add(attr) + + for base_attr in self.base_elements: + # check if the base attribute is already processed + # priority is given to derived cluster attributes over base attributes + if base_attr.name not in self.processed: + if base_attr.conformance is not None: + base_attr.conformance.feature_map = self.feature_map + if base_attr.conformance.is_disallowed(): + continue + self.cluster.attributes.add(base_attr) + + def _fill_from_base(self, elem: Element, base): + super()._fill_from_base(elem, base) + if not elem.get("type") and getattr(base, "type", None): + elem.set("type", base.type) + + def create(self, elem: Element) -> Attribute: + """ + Build one Attribute from XML element. + Raises: + XmlParseError: If type cannot be resolved (from resolve_attribute_type). + """ + name = elem.get("name") + code = elem.get("id") + type_str = resolve_attribute_type(elem, self.cluster.attribute_types) + attr = Attribute( + name=name, + id=code, + type_=type_str, + is_mandatory=is_mandatory(elem), + access=self._access(elem.find("access")), + quality=self._quality(elem.find("quality")), + constraint=self._constraint(elem.find("constraint")), + default_value=elem.get("default"), + ) + self._set_internally_managed(attr) + resolve_attribute_bounds(attr, elem, self.cluster.data_types) + attr.conformance = parse_conformance(elem, self.feature_map) + return attr + + def _apply_type_overrides(self, attr: Attribute, elem: Element) -> None: + """some cluster/attribute types are inferred wrong from XML""" + cluster_name = self.cluster.func_name + if ( + cluster_name not in attribute_type_map + or attr.func_name not in attribute_type_map[cluster_name] + ): + return + override_attr = attribute_type_map[cluster_name][attr.func_name] + attr.type = override_attr["type"] + attr.min_value = override_attr.get("min") + attr.max_value = override_attr.get("max") + + def _set_internally_managed(self, attr: Attribute) -> None: + if attr.type == "list": + attr.internally_managed = True + return + if self.cluster.is_migrated_cluster: + attr.internally_managed = False + return + if should_skip_internally_managed_flag(self.cluster.id, attr.id): + attr.internally_managed = False + elif attr.name and attr.name.lower() in self.managed_attributes: + attr.internally_managed = True + else: + attr.internally_managed = False + + def _access(self, access_elem: Element): + if access_elem is None: + return None + return Attribute.Access( + read=access_elem.get("read", "false"), + readPrivilege=access_elem.get("readPrivilege"), + write=access_elem.get("write", "false"), + writePrivilege=access_elem.get("writePrivilege"), + ) + + def _quality(self, quality_elem: Element): + if quality_elem is None: + return None + return Attribute.Quality( + changeOmitted=quality_elem.get("changeOmitted", "false"), + nullable=quality_elem.get("nullable", "false"), + scene=quality_elem.get("scene", "false"), + persistence=quality_elem.get("persistence", ""), + reportable=quality_elem.get("reportable", "false"), + sourceAttribution=quality_elem.get("sourceAttribution", "false"), + quieterReporting=quality_elem.get("quieterReporting", "false"), + ) + + def _constraint(self, constraint_elem: Element): + if constraint_elem is None: + return None + _CONSTRAINT_TAG_HANDLERS = { + "maxLength": ("maxLength", lambda c: c.get("value", "")), + "min": ("min", lambda c: c.get("value", "")), + "max": ("max", lambda c: c.get("value", "")), + } + ctype, cfrom, cto, cval = None, None, None, None + for child in constraint_elem: + if child.tag == "between": + ctype = "between" + from_el = child.find("from") + to_el = child.find("to") + cfrom = from_el.get("value", "0") if from_el is not None else "0" + cto = to_el.get("value", "0") if to_el is not None else "0" + elif child.tag == "desc": + ctype = "desc" + cval = (child.text or "").strip() or None + elif child.tag in _CONSTRAINT_TAG_HANDLERS: + ctype, getter = _CONSTRAINT_TAG_HANDLERS[child.tag] + cval = getter(child) + if ctype == "between": + return Attribute.Constraint(type=ctype, from_=cfrom, to_=cto, value=None) + return Attribute.Constraint(type=ctype, from_=cval, to_=cval, value=cval) diff --git a/tools/data_model_gen/xml_processing/attribute_type.py b/tools/data_model_gen/xml_processing/attribute_type.py new file mode 100644 index 000000000..24f0d8819 --- /dev/null +++ b/tools/data_model_gen/xml_processing/attribute_type.py @@ -0,0 +1,325 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +class AttributeType: + """Class for handling Matter attribute types and their conversions""" + + _basic_types = { + "bool": "bool", + "uint8": "uint8_t", + "uint16": "uint16_t", + "uint32": "uint32_t", + "uint64": "uint64_t", + "int8": "int8_t", + "int16": "int16_t", + "int32": "int32_t", + "int64": "int64_t", + "float": "float", + "double": "double", + } + + _string_type = {"string": "char *", "octstr": "uint8_t *"} + + _array_type = {"list": "uint8_t *"} + + _enum_type = { + "enum8": "uint8_t", + "enum16": "uint16_t", + "enum32": "uint32_t", + "enum64": "uint64_t", + } + + _bitmap_type = { + "bitmap8": "uint8_t", + "bitmap16": "uint16_t", + "bitmap32": "uint32_t", + "bitmap64": "uint64_t", + } + + def __init__(self, type_str: str): + self.type_str = type_str + + def get_attribute_type(self) -> str: + """Get the attribute type for a given type string + The attribute types are converted from cpp type to the types used in esp-matter. + + Returns: + The attribute type. + """ + if self.type_str in self._basic_types: + return self._basic_types[self.type_str] + elif self.type_str in self._string_type: + return self._string_type[self.type_str] + elif self.type_str in self._array_type: + return self._array_type[self.type_str] + elif self.type_str in self._enum_type: + return self._enum_type[self.type_str] + elif self.type_str in self._bitmap_type: + return self._bitmap_type[self.type_str] + else: + from utils.exceptions import XmlParseError + + raise XmlParseError( + f"Could not resolve type: {self.type_str}", + context="attribute_type", + suggestion="Check that the type is defined in the cluster data types or attribute type map.", + ) + + def get_attribute_category(self) -> str: + """Get the attribute category for a given type string + + Returns: + The attribute category. + """ + if self.type_str in self._basic_types: + return "PRIMITIVE" + elif self.type_str in self._string_type: + return "STRING" + elif self.type_str in self._array_type: + return "ARRAY" + elif self.type_str in self._enum_type: + return "ENUM" + elif self.type_str in self._bitmap_type: + return "BITMAP" + else: + return "UNKNOWN" + + +attribute_type_map = { + "alarm_base": { + "mask": { + "type": "bitmap32", + "min": "0", + "max": "4294967295", + }, + "latch": { + "type": "bitmap32", + "min": "0", + "max": "4294967295", + }, + "state": { + "type": "bitmap32", + "min": "0", + "max": "4294967295", + }, + "supported": { + "type": "bitmap32", + "min": "0", + "max": "4294967295", + }, + }, + "color_control": { + "color_capabilities": { + "type": "bitmap16", + "min": "0", + "max": "65535", + }, + }, + "network_commissioning": { + "supported_thread_features": { + "type": "bitmap16", + "min": "0", + "max": "65535", + }, + }, + "thermostat": { + "thermostat_running_state": { + "type": "bitmap16", + "min": "0", + "max": "65535", + }, + "ac_error_code": { + "type": "bitmap32", + "min": "0", + "max": "4294967295", + }, + }, + "door_lock": { + "supported_operating_modes": { + "type": "bitmap16", + "min": "0", + "max": "65535", + }, + "default_configuration_register": { + "type": "bitmap16", + "min": "0", + "max": "65535", + }, + }, + "valve_configuration_and_control": { + "valve_fault": { + "type": "bitmap16", + "min": "0", + "max": "65535", + }, + }, + "commissioner_control": { + "supported_device_categories": { + "type": "bitmap32", + "min": "0", + "max": "4294967295", + } + }, + "electrical_energy_measurement": { + "accuracy": {"type": "list", "min": None, "max": None} + }, + "commodity_tariff": { + "tariff_unit": { + "type": "enum8", + "min": "0", + "max": "1", + }, + }, + "commodity_metering": { + "tariff_unit": { + "type": "enum8", + "min": "0", + "max": "1", + }, + }, + "commodity_price": { + "tariff_unit": { + "type": "enum8", + "min": "0", + "max": "1", + }, + }, +} + +# Global attribute mapping xml-type -> cpp->type +attribute_types = { + # PRIMITIVE + "uint8": "uint8", + "uint16": "uint16", + "uint32": "uint32", + "uint64": "uint64", + "int8": "int8", + "int16": "int16", + "int32": "int32", + "int64": "int64", + "float": "float", + "double": "double", + "list": "list", + "bool": "bool", + "enum8": "enum8", + "enum16": "enum16", + "enum32": "enum32", + "enum64": "enum64", + "bitmap8": "bitmap8", + "bitmap16": "bitmap16", + "bitmap32": "bitmap32", + "bitmap64": "bitmap64", + "struct": "list", + "percent": "uint8", + "percent100ths": "uint16", + "tod": "list", + "date": "list", + "epoch-us": "uint64", + "epoch-s": "uint32", + "utc": "uint32", + # DERIVED + # ANALOG + "posix-ms": "uint64", + "systime-us": "uint64", + "systime-ms": "uint64", + "elapsed-s": "uint32", + # Physical Quantities + "power-mw": "int64", + "amperage-ma": "int64", + "voltage-mv": "int64", + "energy-mwh": "int64", + "power-mva": "int64", + "energy-mvah": "int64", + "power-mvar": "int64", + "energy-mvarh": "int64", + "money": "int64", + "tempdiff": "int16", + "utemp": "uint8", + "stemp": "int8", + # DISCRETE + "priority": "uint8", + "status": "uint8", + "group-id": "uint16", + "endpoint-id": "uint16", + "endpoint-no": "uint16", + "vendor-id": "uint16", + "devtype-id": "uint32", + "fabric-id": "uint64", + "fabric-idx": "uint8", + "cluster-id": "uint32", + "attrib-id": "uint32", + "field-id": "uint32", + "event-id": "uint32", + "command-id": "uint32", + "action-id": "uint8", + "subject-id": "uint64", + "trans-id": "uint32", + "node-id": "uint64", + "EUI64": "uint64", + "entry-idx": "uint16", + "data-ver": "uint32", + "event-no": "uint64", + # COMPOSITE + "string": "string", + "octstr": "octstr", + # address + "ipadr": "octstr", + "ipv4adr": "octstr", + "ipv6adr": "octstr", + "ipv6pre": "octstr", + "hwadr": "octstr", + # tag + "semtag": "list", + "namespace": "enum8", + "tag": "enum8", + # location + "locationdesc": "list", + # Custom (not in the spec) + # Temperature + "signedtemperature": "int8", + "unsignedtemperature": "uint8", + "temperaturedifference": "int16", + "temperature": "int16", + # Additional types + "unknown": "unknown", + "custom": "custom", + "map8": "bitmap8", + "map16": "bitmap16", + "map32": "bitmap32", + "map64": "bitmap64", + "uint24": "uint32", + "uint40": "uint64", + "uint48": "uint64", + "uint56": "uint64", + "int24": "int32", + "int40": "int64", + "int48": "int64", + "int56": "int64", + "int8s": "int8", + "int16s": "int16", + "int32s": "int32", + "int64s": "int64", + "single": "float", + "message-id": "uint32", + "mode": "bool", + "boolean": "bool", + "min": "uint8", # Not sure + "max": "uint8", # Not sure + "datatypelist[ref_groupkeysetstruct]": "list", + "datatypelist[datastore": "list", + "datastore": "list", + "unit8": "uint8", + "unit16": "uint16", +} diff --git a/tools/data_model_gen/xml_processing/cluster_parser.py b/tools/data_model_gen/xml_processing/cluster_parser.py new file mode 100644 index 000000000..f899f79e8 --- /dev/null +++ b/tools/data_model_gen/xml_processing/cluster_parser.py @@ -0,0 +1,270 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import logging +import xml.etree.ElementTree as ET +from xml.etree.ElementTree import Element + +from .attribute_parser import AttributeParser +from .command_parser import CommandParser +from .data_type_parser import DataTypeParser +from .event_parser import EventParser +from .feature_parser import FeatureParser +from .parse_context import ClusterParseContext, load_cluster_parse_context +from .yaml_parser import YamlParser +from .elements import Cluster +from utils.helper import check_valid_id, esp_name, safe_get_attr +from utils.overrides import should_skip_cluster_command_callbacks + +logger = logging.getLogger(__name__) +DUMMY_CLUSTER_ID = hex(0xFFFF) + + +class ClusterParser: + """Class for parsing cluster data""" + + def parse( + self, + file_path, + output_dir: str, + yaml_parser: YamlParser, + base_clusters: list[Cluster] = None, + context: ClusterParseContext = None, + root=None, + ): + """Parses an XML cluster file + (A single base cluster file can have multiple derived clusters in single file) + + :param file_path: The path to the cluster XML file (used for logging; for parsing if root is None). + :param output_dir: The path to the output directory. + :param yaml_parser: The YAML parser. + :param base_clusters: list[Cluster]: (Default value = None) + :param context: Pre-loaded metadata; if None, loaded from output_dir. + :param root: Optional pre-parsed XML root element; if None, file_path is parsed. + :returns: A list of clusters. + """ + if root is None: + tree = ET.parse(file_path) + root = tree.getroot() + clusters = [] + context = context or load_cluster_parse_context(output_dir) + # If single file has multiple cluster ids, skip command callback generation (e.g. ResourceMonitoring) + # or base cluster with dummy Id + skip_command_cb = False + + cluster_name_id_list = self._get_cluster_name_and_id(root) + if not cluster_name_id_list or len(cluster_name_id_list) == 0: + logger.warning(f"Skipping {file_path} as it is not a valid cluster") + return clusters + if len(cluster_name_id_list) > 1: + skip_command_cb = True + + for cluster_name, cluster_id in cluster_name_id_list: + if not cluster_name or not cluster_id: + logger.warning( + f"Skipping {file_path} as name or id is missing, (Either base cluster or not supported yet)" + ) + continue + if not check_valid_id(cluster_id): + logger.warning(f"Skipping {file_path} as id is not valid: {cluster_id}") + continue + cluster = self.create(cluster_name, cluster_id, root) + if cluster_id == DUMMY_CLUSTER_ID: + skip_command_cb = True + cluster.skip_command_cb = skip_command_cb + self._set_context_flags(cluster, context, skip_command_cb) + self._process_cluster_yaml(cluster, yaml_parser) + + base_cluster = ( + self._get_base_cluster(root, base_clusters) if base_clusters else None + ) + self._inherit_from_base_cluster(cluster, base_cluster) + + base_features = safe_get_attr(base_cluster, "features", []) + feature_parser = FeatureParser(root, cluster, base_features) + feature_map = feature_parser.feature_map + + self._parse_attributes(cluster, feature_map, root, context, base_cluster) + self._parse_commands(cluster, feature_map, root, context, base_cluster) + self._parse_events(cluster, feature_map, root, context, base_cluster) + feature_parser.parse(root) + + clusters.append(cluster) + return clusters + + def create(self, cluster_name: str, cluster_id: str, elem: Element) -> Cluster: + """Create a cluster object from the XML element. + Assuming cluster has valid id and name.""" + cluster = Cluster( + id=cluster_id, + name=cluster_name, + revision=elem.get("revision", "Unknown"), + ) + self._set_metadata(cluster, elem) + self._parse_revision_history(cluster, elem) + return cluster + + def _inherit_from_base_cluster(self, derived_cluster, base_cluster): + """Inherit property flags from base cluster to derived cluster.""" + if not derived_cluster or not base_cluster: + return + if base_cluster.delegate_init_callback_available: + derived_cluster.delegate_init_callback_available = True + if base_cluster.attribute_changed_function_available: + derived_cluster.attribute_changed_function_available = True + if base_cluster.shutdown_function_available: + derived_cluster.shutdown_function_available = True + if base_cluster.pre_attribute_change_function_available: + derived_cluster.pre_attribute_change_function_available = True + if base_cluster.plugin_init_cb_available: + derived_cluster.plugin_init_cb_available = True + + def _set_context_flags(self, cluster, context, skip_command_cb=False): + cluster.skip_command_cb = ( + skip_command_cb or should_skip_cluster_command_callbacks(cluster.id) + ) + if cluster.esp_name in context.delegate_clusters: + cluster.delegate_init_callback_available = True + if cluster.esp_name in context.plugin_init_cb_clusters: + cluster.plugin_init_cb_available = True + if cluster.esp_name in context.migrated_clusters: + cluster.is_migrated_cluster = True + + def _set_metadata(self, cluster: Cluster, root: Element): + classification = root.find("classification") + + if classification is not None: + cluster.role = classification.get("role", "application") + cluster.hierarchy = classification.get("hierarchy") + base_cluster_name = classification.get("baseCluster") + if base_cluster_name: + cluster.base_cluster_name = esp_name(base_cluster_name) + cluster.pics_code = classification.get("picsCode") + cluster.scope = classification.get("scope") + else: + logger.debug( + f"Setting default role 'application' for cluster {cluster.name}" + ) + cluster.role = "application" + + def _parse_attributes(self, cluster, feature_map, root, context, base_cluster): + allowed_attribute_ids = context.get_allowed_attributes(cluster.id) + managed_attributes = context.get_internally_managed_attributes(cluster.esp_name) + base_attributes = safe_get_attr(base_cluster, "attributes", []) + data_type_parser = DataTypeParser() + attribute_parser = AttributeParser( + cluster, + feature_map, + managed_attributes, + allowed_attribute_ids, + base_attributes, + ) + cluster.attribute_types = data_type_parser.parse(root) + cluster.data_types = data_type_parser.get_data_types() + attribute_parser.parse(root) + + def _parse_commands(self, cluster, feature_map, root, context, base_cluster): + allowed_command_ids = context.get_allowed_commands(cluster.id) + base_commands = safe_get_attr(base_cluster, "commands", []) + command_parser = CommandParser( + cluster, + feature_map, + allowed_command_ids, + base_commands, + ) + command_parser.parse(root) + + def _parse_events(self, cluster, feature_map, root, context, base_cluster): + allowed_event_ids = context.get_allowed_events(cluster.id) + base_events = safe_get_attr(base_cluster, "events", []) + event_parser = EventParser( + cluster, + feature_map, + allowed_event_ids, + base_events, + ) + event_parser.parse(root) + + def _parse_revision_history(self, cluster, root): + revision_history_elem = root.find("revisionHistory") + if revision_history_elem is not None: + for revision in revision_history_elem.findall("revision"): + revision_info = { + "revision": revision.get("revision", "1"), + "summary": revision.get("summary", ""), + } + cluster.revision_history.append(revision_info) + + def _get_cluster_name_and_id(self, root): + name_id_list = [] + cluster_name = root.get("name", "").replace(" Cluster", "") + cluster_id = root.get("id") + + if cluster_name and cluster_id: + return [[cluster_name, cluster_id]] + + if not cluster_name or not cluster_id: + all_cluster_ids_element = root.find("clusterIds") + if all_cluster_ids_element is None: + return name_id_list + cluster_ids_element = all_cluster_ids_element.findall("clusterId") + for cluster_id_element in cluster_ids_element: + cluster_name = cluster_id_element.get("name") + cluster_id = cluster_id_element.get("id") + if not cluster_id: + # Default to 0xFFFF if id is not present + cluster_id = hex(0xFFFF) + if cluster_name and cluster_id: + name_id_list.append([cluster_name, cluster_id]) + return name_id_list + + def _get_base_cluster(self, root, base_clusters: list[Cluster]): + classification = root.find("classification") + if classification is None: + return None + base_cluster_name = classification.get("baseCluster") + if not base_cluster_name: + return None + return next( + ( + bc + for bc in base_clusters + if esp_name(bc.name) == esp_name(base_cluster_name) + ), + None, + ) + + # YAML list name -> cluster attribute to set (if cluster name is in that list) + _YAML_CLUSTER_FLAGS = ( + ("CommandHandlerInterfaceOnlyClusters", "command_handler_available"), + ("ClustersWithInitFunctions", "init_function_available"), + ( + "ClustersWithAttributeChangedFunctions", + "attribute_changed_function_available", + ), + ("ClustersWithShutdownFunctions", "shutdown_function_available"), + ( + "ClustersWithPreAttributeChangeFunctions", + "pre_attribute_change_function_available", + ), + ("CodeDrivenClusters", "is_migrated_cluster"), + ) + + def _process_cluster_yaml(self, cluster, yaml_parser: YamlParser): + """Set cluster flags from YAML config: each list name maps to a cluster attribute.""" + if not yaml_parser: + return + cluster_name = safe_get_attr(cluster, "name") + for list_name, attr_name in self._YAML_CLUSTER_FLAGS: + if yaml_parser.is_present_in_list(list_name, cluster_name): + setattr(cluster, attr_name, True) diff --git a/tools/data_model_gen/xml_processing/command_parser.py b/tools/data_model_gen/xml_processing/command_parser.py new file mode 100644 index 000000000..edf59afc9 --- /dev/null +++ b/tools/data_model_gen/xml_processing/command_parser.py @@ -0,0 +1,132 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import logging +from xml.etree.ElementTree import Element + +from .conformance_parser import parse_conformance +from .element_parser_base import ClusterElementBaseParser +from .elements import Cluster, Command +from utils.helper import safe_get_attr +from typing import List + +logger = logging.getLogger(__name__) + + +class CommandParser(ClusterElementBaseParser): + """Parses cluster commands from XML.""" + + def __init__( + self, + cluster: Cluster, + feature_map: dict, + allowed_commands_ids: list = None, + base_commands: List[Command] = None, + ): + super().__init__( + cluster, feature_map, allowed_commands_ids or [], base_commands or [] + ) + + def parse(self, root) -> None: + """Parse commands from cluster XML root and add to cluster.commands. Merges base_commands if provided.""" + logger.debug( + f"Parsing commands for cluster {safe_get_attr(self.cluster, 'name')}" + ) + for elem in root.findall("commands/command"): + skip, reason = self.can_skip(elem) + if skip: + logger.debug("Skipping command %s: %s", elem.get("name"), reason) + continue + cmd = self.create(elem) + self._set_access(cmd, elem) + cmd.conformance = parse_conformance(elem, self.feature_map) + self._set_fields(cmd, elem) + self.cluster.commands.add(cmd) + if self.cluster.skip_command_cb: + cmd.skip_command_cb = True + + for base_cmd in self.base_elements: + if base_cmd.name not in self.processed: + if base_cmd.conformance is not None: + base_cmd.conformance.feature_map = self.feature_map + if base_cmd.conformance.is_disallowed(): + continue + self.cluster.commands.add(base_cmd) + + def create(self, elem: Element) -> Command: + name = elem.get("name") + cmd = Command( + id=elem.get("id"), + name=name, + direction=elem.get("direction"), + response=elem.get("response"), + is_mandatory=elem.find("mandatoryConform") is not None, + ) + if safe_get_attr(self.cluster, "command_handler_available") or safe_get_attr( + self.cluster, "is_migrated_cluster" + ): + cmd.command_handler_available = True + return cmd + + def _set_access(self, cmd: Command, elem: Element) -> None: + access_elem = elem.find("access") + if access_elem is None: + return + cmd.set_access( + Command.CommandAccess( + invokePrivilege=access_elem.get("invokePrivilege"), + timed=access_elem.get("timed") == "true", + fabric_scoped=access_elem.get("fabricScoped") == "true", + ) + ) + + def _set_fields(self, cmd: Command, elem: Element) -> None: + for field_elem in elem.findall("field"): + fid, fname, ftype = ( + field_elem.get("id"), + field_elem.get("name"), + field_elem.get("type"), + ) + if not fid or not fname or not ftype: + continue + constraint = self._field_constraint(field_elem.find("constraint")) + cmd.add_field( + Command.CommandField( + id=fid, + name=fname, + type_=ftype, + default_value=field_elem.get("default"), + is_mandatory=field_elem.find("mandatoryConform") is not None, + constraint=constraint, + ) + ) + + def _field_constraint(self, constraint_elem: Element): + if constraint_elem is None: + return None + out = {} + for child in constraint_elem: + if child.tag == "maxLength": + out["type"], out["value"] = "maxLength", child.get("value") + elif child.tag == "min": + out["type"], out["value"] = "min", child.get("value") + elif child.tag == "max": + out["type"], out["value"] = "max", child.get("value") + elif child.tag == "between": + out["type"] = "between" + from_el, to_el = child.find("from"), child.find("to") + out["min"] = from_el.get("value", "0") if from_el is not None else "0" + out["max"] = to_el.get("value", "0") if to_el is not None else "0" + elif child.tag == "desc": + out["type"], out["value"] = "desc", None + return out if out else None diff --git a/tools/data_model_gen/xml_processing/conformance_parser.py b/tools/data_model_gen/xml_processing/conformance_parser.py new file mode 100644 index 000000000..53ded300f --- /dev/null +++ b/tools/data_model_gen/xml_processing/conformance_parser.py @@ -0,0 +1,412 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging +from utils.helper import convert_to_snake_case, safe_get_attr +from xml.etree.ElementTree import Element +from utils.conformance import ( + get_conformance_type, + ConformanceTAG, + ConformanceDecision, + BaseConformance, + Choice, + SUPPORTED_CONFORMANCE_TAGS, +) +from typing import Optional +from utils import config + +logger = logging.getLogger(__name__) + +# XML tag constants +OTHERWISE_CONFORM = "otherwiseConform" +OPTIONAL_CONFORM = "optionalConform" +PROVISIONAL_CONFORM = "provisionalConform" +MANDATORY_CONFORM = "mandatoryConform" +DEPRECATE_CONFORM = "deprecateConform" +DISALLOW_CONFORM = "disallowConform" + + +BOOLEAN_TERMS = { + "andTerm": ConformanceTAG.AND.value, + "orTerm": ConformanceTAG.OR.value, + "notTerm": ConformanceTAG.NOT.value, +} + + +def get_restricted_tags(): + if config.allow_provisional(): + return { + DISALLOW_CONFORM, + DEPRECATE_CONFORM, + } + return { + DISALLOW_CONFORM, + DEPRECATE_CONFORM, + PROVISIONAL_CONFORM, + } + + +def parse_choice(choice_elem: Element) -> Optional[Choice]: + if choice_elem is None: + return None + marker = choice_elem.get("choice") + more = choice_elem.get("more", "").lower() == "true" + if marker is not None: + return Choice(marker, more) + return None + + +class Conformance(BaseConformance): + """ + Base class representing conformance requirements for Matter Data Model elements. + """ + + def __init__(self, feature_map: dict): + self.feature_map = feature_map + self.condition = None + self.choice = None + self.more = None + self.min = None + self.type = None + + def parse(self, conformance_elem: Element): + if conformance_elem is None: + return None + + self.type = get_conformance_type(conformance_elem.tag) + if self.type == ConformanceDecision.OTHERWISE: + self.condition = self._parse_otherwise_conformance(conformance_elem) + else: + self.choice = parse_choice(conformance_elem) + self.condition = self._parse_common_conformance(conformance_elem) + return self + + def _parse_otherwise_conformance(self, conformance_elem: Element): + sub_conditions = {} + for child in conformance_elem: + if child.tag not in SUPPORTED_CONFORMANCE_TAGS: + continue + child_type = get_conformance_type(child.tag).to_string() + sub_condition = self._build_sub_condition(child, child_type) + self._add_to_conditions(sub_conditions, child_type, sub_condition) + return sub_conditions + + def _build_sub_condition(self, child: Element, child_type: str) -> dict: + """Build a sub-condition from a conformance child element.""" + sub_condition = {} + if child_type == ConformanceDecision.OPTIONAL.to_string(): + choice = parse_choice(child) + if choice: + sub_condition.update(choice.to_dict()) + parsed = self._parse_common_conformance(child) + if parsed: + if isinstance(parsed, dict): + sub_condition.update(parsed) + else: + sub_condition["condition"] = parsed + return sub_condition + + def _add_to_conditions(self, conditions: dict, key: str, value) -> None: + """Add a condition value, converting to list if key already exists.""" + value = value if value else True + if key in conditions: + existing = conditions[key] + conditions[key] = ( + [existing, value] + if not isinstance(existing, list) + else existing + [value] + ) + else: + conditions[key] = value + + def _parse_common_conformance(self, parent_elem: Element): + conditions = parse_children(parent_elem, self.feature_map) + + if not conditions: + return None + if len(conditions) == 1: + return conditions[0] + return {ConformanceTAG.AND.value: conditions} + + def get_dependent_features(self, condition: dict): + """ + Get all features on which the condition depends. + NOTE: `not` term indicates that condition is not dependent on that feature. + """ + features = [] + if isinstance(condition, dict): + feature = condition.get(ConformanceTAG.FEATURE.value) + if feature: + features.append(feature) + for key, value in condition.items(): + if key == ConformanceTAG.NOT.value: + continue + features.extend(self.get_dependent_features(value)) + elif isinstance(condition, list): + for item in condition: + features.extend(self.get_dependent_features(item)) + + return features + + def has_feature(self, feature_code): + """Check if conformance involves a specific feature.""" + if not self.condition: + return False + feature_obj = self.feature_map.get(feature_code) + feature_name = getattr(feature_obj, "func_name", None) if feature_obj else None + if not feature_name: + return False + return feature_name in self.get_dependent_features(self.condition) + + def is_disallowed(self): + """Check if the conformance is disallowed or depends on unavailable features.""" + if self.type.value in [ + get_conformance_type(tag).value for tag in get_restricted_tags() + ]: + return True + features = self.get_dependent_features(self.condition) + return any( + self._get_code_from_feature_name(feature) not in self.feature_map + for feature in features + ) + + def _get_code_from_feature_name(self, feature_name): + for feature_code, feature in self.feature_map.items(): + if feature.func_name == feature_name: + return feature_code + return None + + def to_dict(self, attribute_map=None): + if attribute_map is None: + attribute_map = {} + result = {"type": self.type.to_string()} + + if self.condition: + result["condition"] = replace_references(self.condition, attribute_map) + + if self.choice: + result.update(self.choice.to_dict()) + + return result + + +def is_mandatory(conformance_elem: Element) -> bool: + """Check if conformance is mandatory.""" + mandatory_conform = conformance_elem.find("mandatoryConform") + if mandatory_conform is not None: + return True + otherwise_mandatory = conformance_elem.find("otherwiseConform/mandatoryConform") + if otherwise_mandatory is not None: + return ( + len(otherwise_mandatory) == 0 + or otherwise_mandatory.find("greaterTerm") is not None + ) + return False + + +def replace_references(condition, reference_map): + """ + Replace attribute and command names with their IDs in the reference map. + """ + if isinstance(condition, dict): + attr_name = condition.get(ConformanceTAG.ATTRIBUTE.value) + if attr_name: + return {ConformanceTAG.ATTRIBUTE.value: attr_name} + cmd_name = condition.get(ConformanceTAG.COMMAND.value) + if cmd_name and cmd_name in reference_map: + cmd_data = reference_map.get(cmd_name) + if isinstance(cmd_data, tuple) and len(cmd_data) == 2: + return { + ConformanceTAG.COMMAND.value: cmd_name, + ConformanceTAG.COMMAND_FLAG.value: cmd_data[1], + } + else: + return {ConformanceTAG.COMMAND.value: cmd_name} + return { + key: replace_references(value, reference_map) + for key, value in condition.items() + } + elif isinstance(condition, list): + return [replace_references(item, reference_map) for item in condition] + return condition + + +def parse_conformance(conformance_elem, feature_map): + """Parse conformance from XML; single entry point for attaching conformance to cluster elements.""" + if conformance_elem is None: + return None + for tag in SUPPORTED_CONFORMANCE_TAGS: + conformance = conformance_elem.find(tag) + if conformance is not None: + return Conformance(feature_map).parse(conformance) + logger.debug(f"Unknown conformance tag for element {conformance_elem}") + return None + + +def parse_children(parent_elem, feature_map): + return [ + parsed + for child in parent_elem + if (parsed := parse_condition(child, feature_map)) + ] + + +def parse_condition(elem, feature_map): + """ + Parse any condition element. + """ + if elem.tag in BOOLEAN_TERMS: + return parse_boolean_term(elem, feature_map) + return parse_element_reference(elem, feature_map) + + +def parse_boolean_term(term_elem, feature_map): + """ + Parse a boolean terms. + NOTE: Greater and Equal terms are not supported as no use in esp-matter. + """ + term_type = BOOLEAN_TERMS[term_elem.tag] + operands = parse_children(term_elem, feature_map) + + if term_type == ConformanceTAG.NOT.value: + return {term_type: operands[0]} if operands else None + + if term_type in (ConformanceTAG.AND.value, ConformanceTAG.OR.value): + if len(operands) == 1: + return {term_type: [operands[0]]} + return {term_type: operands} if operands else None + + return None + + +def parse_element_reference(ref_elem, feature_map): + """ + Parse a reference to a feature, attribute, command, or condition. + """ + if ref_elem.tag == ConformanceTAG.ATTRIBUTE.value: + return {ConformanceTAG.ATTRIBUTE.value: ref_elem.get("name")} + + elif ref_elem.tag == ConformanceTAG.COMMAND.value: + return {ConformanceTAG.COMMAND.value: ref_elem.get("name")} + + elif ref_elem.tag == ConformanceTAG.FEATURE.value: + feature_code = ref_elem.get("name") + if feature_code in feature_map: + feature_name = convert_to_snake_case(feature_map[feature_code].name) + return {ConformanceTAG.FEATURE.value: feature_name} + else: + logger.warning(f"Feature {feature_code} not found in feature map") + return None + + elif ref_elem.tag == ConformanceTAG.CONDITION.value: + return {ConformanceTAG.CONDITION.value: ref_elem.get("name")} + + return None + + +def is_restricted_by_conformance(feature_map, element): + """ + Check if the conformance is provisional, deprecated, disallowed or if depends on any disallowed feature. + + Args: + feature_map: The feature map + element: The element from the cluster XML file + + Returns: + True if the element should be skipped, False otherwise + """ + conformance_element = None + conformance_element = next( + (elem for elem in element.iter() if elem.tag.endswith("Conform")), None + ) + + if conformance_element is None: + return False + + element_name = element.get("name", "Unknown") + + if conformance_element.tag in get_restricted_tags(): + logger.debug( + f"Skipping - {conformance_element.tag} conformance for element {element_name}" + ) + return True + + if conformance_element.tag == OTHERWISE_CONFORM: + first_child = next(iter(conformance_element), None) + if first_child is not None: + if first_child.tag == MANDATORY_CONFORM: + # Check if all required features exist in feature map + feature_list = first_child.findall(".//feature") + for feature in feature_list: + feature_name = feature.get("name") + if feature_name not in feature_map: + return True + return False + elif first_child.tag in get_restricted_tags(): + return True + + # Check for Zigbee-specific optional conformance + condition = conformance_element.find("condition") + if condition is not None: + zigbee_condition = condition.get("name") + if zigbee_condition and zigbee_condition.lower() == "zigbee": + logger.debug(f"Skipping - Zigbee specific element {element_name}") + return True + + # Checks if conformance depends on features that are not in feature map + all_features_list = conformance_element.findall(".//feature") + for feature in all_features_list: + feature_name = feature.get("name") + if feature_name and feature_name not in feature_map: + logger.debug( + f"Skipping - feature {feature_name} not in feature map for element {element_name}" + ) + return True + return False + + +def match_conformance_items(feature, item_list): + """ + Get list of items matched with current feature. + + This finds all items (attributes, commands, events) that have a mandatory + conformance relationship with the given feature. + + Args: + feature: Feature object to match against + item_list: List of items to check for match + + Returns: + A list of items that have conformance with the given feature + """ + matched_items = [] + for item in item_list: + conformance = safe_get_attr(item, "conformance") + if not conformance: + continue + + if ( + conformance.type == ConformanceDecision.MANDATORY + and conformance.has_feature(feature.code) + ): + matched_items.append(item) + if ( + conformance.type == ConformanceDecision.OTHERWISE + and conformance.condition + and conformance.condition.get("mandatory", False) + and conformance.has_feature(feature.code) + ): + matched_items.append(item) + + return matched_items diff --git a/tools/data_model_gen/xml_processing/data_type_parser.py b/tools/data_model_gen/xml_processing/data_type_parser.py new file mode 100644 index 000000000..213f59b29 --- /dev/null +++ b/tools/data_model_gen/xml_processing/data_type_parser.py @@ -0,0 +1,376 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import logging +from typing import Dict +from xml.etree.ElementTree import Element + +from .attribute_type import attribute_types +from utils.conversion_utils import convert_to_int +from utils.helper import safe_get_attr +from utils.exceptions import XmlParseError + +logger = logging.getLogger(__name__) + +INT_BOUNDS = { + "int8": (-(2**7), 2**7 - 2), + "int16": (-(2**15), 2**15 - 2), + "int32": (-(2**31), 2**31 - 2), + "int64": ( + -(2**31), + 2**31 - 2, + ), # NOTE: getting esp-idf compiler warnings for int64 bounds, so we are using int32 bounds for now + "uint8": (0, 2**8 - 2), + "uint16": (0, 2**16 - 2), + "uint32": (0, 2**32 - 2), + "uint64": ( + 0, + 2**32 - 2, + ), # NOTE: getting esp-idf compiler warnings for uint64 bounds, so we are using uint32 bounds for now +} + + +def resolve_attribute_type(attribute_elem: Element, attribute_types_dict: dict) -> str: + """ + Resolve attribute type from XML using cluster type map. Widens enum/bitmap by default value. + Raises: + XmlParseError: If attribute has no type and it cannot be inferred. + """ + raw = attribute_elem.get("type") + if raw is None: + raise XmlParseError( + f"Attribute type is None for {attribute_elem}", + context="resolve_attribute_type", + suggestion="Ensure the attribute element has a 'type' attribute in the XML.", + ) + type_str = raw.split(" ")[0].lower() + resolved = attribute_types_dict.get(type_str) + if resolved is None: + resolved = _fallback_unknown_type(type_str) + return _override_type_by_default_value(attribute_elem, resolved) + + +def _fallback_unknown_type(type_str: str) -> str: + """some XML types missing; map to concrete type.""" + if "bitmap" in type_str.lower(): + return "bitmap8" + if "enum" in type_str.lower(): + return "enum8" + if "struct" in type_str.lower(): + return "list" + return type_str + + +def _override_type_by_default_value(attribute_elem: Element, type_str: str) -> str: + default = attribute_elem.get("default") + if default is None: + return type_str + try: + if isinstance(default, str) and default.startswith("0x"): + val = int(default, 16) + elif isinstance(default, str) and default.isdigit(): + val = int(default) + else: + return type_str + except ValueError: + return type_str + if val > 255 and type_str == "enum8": + return "enum16" + if val > 65535 and type_str == "enum16": + return "enum32" + if val > 4294967295 and type_str == "enum32": + return "enum64" + if val > 255 and type_str == "bitmap8": + return "bitmap16" + if val > 65535 and type_str == "bitmap16": + return "bitmap32" + if val > 4294967295 and type_str == "bitmap32": + return "bitmap64" + return type_str + + +def resolve_attribute_bounds( + attr, attribute_elem: Element, data_types_dict: dict +) -> None: + """Set attr.min_value and attr.max_value from enum, bitmap, constraint, or type defaults.""" + attr.min_value = None + attr.max_value = None + data_types_dict = data_types_dict or {} + enums = data_types_dict.get("enums") or {} + bitmaps = data_types_dict.get("bitmaps") or {} + + if "enum" in (attr.type or "").lower(): + xml_type = (attribute_elem.get("type") or "").lower() + if xml_type in enums and safe_get_attr(enums[xml_type], "items"): + attr.min_value = 0 + attr.max_value = len(enums[xml_type].items) - 1 + _bounds_to_int(attr) + return + if "bitmap" in (attr.type or "").lower(): + xml_type = (attribute_elem.get("type") or "").lower() + if xml_type in bitmaps and safe_get_attr(bitmaps[xml_type], "bitfields"): + attr.min_value = 0 + attr.max_value = 2 ** len(bitmaps[xml_type].bitfields) - 1 + _bounds_to_int(attr) + return + + _bounds_from_constraint(attr, attribute_elem) + _normalize_bounds(attr) + _default_bounds_by_type(attr) + _bounds_to_int(attr) + + +def _bounds_from_constraint(attr, attribute_elem: Element) -> None: + constraint_elem = attribute_elem.find("constraint") + if not constraint_elem: + return + min_el = constraint_elem.find("min") + if min_el is not None and min_el.get("value") is not None: + attr.min_value = min_el.get("value", None) + max_el = constraint_elem.find("max") + if max_el is not None and max_el.get("value") is not None: + attr.max_value = max_el.get("value", None) + between = constraint_elem.find("between") + if between is not None: + f, t = between.find("from"), between.find("to") + if f is not None and f.get("value") is not None: + attr.min_value = f.get("value", None) + if t is not None and t.get("value") is not None: + attr.max_value = t.get("value", None) + length_between = constraint_elem.find("lengthBetween") + if length_between is not None: + f, t = length_between.find("from"), length_between.find("to") + if f is not None and f.get("value") is not None: + attr.min_value = f.get("value", None) + if t is not None and t.get("value") is not None: + attr.max_value = t.get("value", None) + max_len = constraint_elem.find("maxLength") + if max_len is not None and max_len.get("value") is not None: + attr.max_value = max_len.get("value", None) + if attr.min_value is None: + attr.min_value = 0 + allowed = constraint_elem.find("allowed") + if allowed is not None and (attr.type == "string" or attr.type == "octstr"): + allowed_value = convert_to_int(allowed.get("value", None)) + if allowed_value is not None: + attr.max_value = allowed_value + attr.min_value = 0 + + +def _normalize_bounds(attr) -> None: + for key in ("min_value", "max_value"): + v = getattr(attr, key) + if v is None: + continue + if not isinstance(v, str): + continue + if "0x" in v: + try: + setattr(attr, key, int(v, 16)) + except ValueError: + setattr(attr, key, None) + elif not v.lstrip("-").isdigit(): + setattr(attr, key, None) + + +def _default_bounds_by_type(attr) -> None: + bounds = INT_BOUNDS.get(attr.type) + if not bounds: + return + + min_val, max_val = bounds + + if attr.min_value is None: + attr.min_value = min_val + + if attr.max_value is None: + attr.max_value = max_val + + +def _bounds_to_int(attr) -> None: + if attr.min_value is not None: + attr.min_value = int(attr.min_value) + if attr.max_value is not None: + attr.max_value = int(attr.max_value) + + +class Item: + """Class representing an item in a data type (enum, bitmap, struct)""" + + def __init__(self, name, value, summary, is_mandatory): + self.name = name + self.value = value + self.summary = summary + self.is_mandatory = is_mandatory + + def to_dict(self): + """Convert item to dictionary representation""" + return { + "name": self.name, + "value": self.value, + "summary": self.summary, + "is_mandatory": self.is_mandatory, + } + + +class Enum: + """Class representing an enumeration data type""" + + def __init__(self, name, base_type, items): + self.name: str = name + self.base_type: str = base_type + self.items: list[Item] = items + + def to_dict(self): + """Convert enum to dictionary representation""" + return { + "name": self.name, + "base_type": self.base_type, + "items": [item.to_dict() for item in self.items], + } + + +class Bitmap: + """Class representing a bitmap data type""" + + def __init__(self, name, base_type, bitfields): + self.name: str = name + self.base_type: str = base_type + self.bitfields: list[Item] = bitfields + + def to_dict(self): + """Convert bitmap to dictionary representation""" + return { + "name": self.name, + "base_type": self.base_type, + "bitfields": [bitfield.to_dict() for bitfield in self.bitfields], + } + + +class Struct: + """Class representing a struct data type""" + + def __init__(self, name, base_type, fields): + self.name: str = name + self.base_type: str = base_type + self.fields: list[Item] = fields + + def to_dict(self): + """Convert struct to dictionary representation""" + return { + "name": self.name, + "base_type": self.base_type, + "fields": [field.to_dict() for field in self.fields], + } + + +def _infer_type_by_count( + count: int, type_prefix: str, thresholds: tuple = (8, 16) +) -> str: + """Infer type size based on item count. Used for both enum and bitmap.""" + if count < thresholds[0]: + return f"{type_prefix}8" + if count < thresholds[1]: + return f"{type_prefix}16" + return f"{type_prefix}32" + + +class DataTypeParser: + """Parser for Matter data types""" + + def __init__(self): + self.attribute_types: Dict[str, str] = dict(attribute_types) + self.enums: Dict[str, Enum] = {} + self.bitmaps: Dict[str, Bitmap] = {} + self.structs: Dict[str, Struct] = {} + + def parse(self, root: Element) -> Dict[str, str]: + """Parse dataTypes section and create type mapping.""" + logger.debug("Parsing dataTypes section") + data_types = root.find("dataTypes") + if data_types is None: + return self.attribute_types + + self._parse_enums(data_types) + self._parse_bitmaps(data_types) + self._parse_structs(data_types) + + return self.attribute_types + + def _parse_enums(self, data_types: Element) -> None: + for enum in data_types.findall("enum"): + enum_name = enum.get("name", "").lower() + if not enum_name: + continue + items = enum.findall("item") + base_type = _infer_type_by_count(len(items), "enum", (256, 65536)) + self.attribute_types[enum_name] = base_type + self.enums[enum_name] = Enum( + enum.get("name"), + base_type, + [ + Item( + item.get("name"), + item.get("value"), + item.get("summary"), + item.find("mandatoryConform") is not None, + ) + for item in items + ], + ) + + def _parse_bitmaps(self, data_types: Element) -> None: + for bitmap in data_types.findall("bitmap"): + bitmap_name = bitmap.get("name", "").lower() + if not bitmap_name: + continue + bitfields = bitmap.findall("bitfield") + base_type = _infer_type_by_count(len(bitfields), "bitmap") + self.attribute_types[bitmap_name] = base_type + self.bitmaps[bitmap_name] = Bitmap( + bitmap.get("name"), + base_type, + [ + Item( + bf.get("name"), + bf.get("bit"), + bf.get("summary"), + bf.find("mandatoryConform") is not None, + ) + for bf in bitfields + ], + ) + + def _parse_structs(self, data_types: Element) -> None: + for struct in data_types.findall("struct"): + struct_name = struct.get("name", "").lower() + if not struct_name: + continue + self.attribute_types[struct_name] = "list" + self.structs[struct_name] = Struct( + struct.get("name", ""), + "list", + [ + Item( + field.get("name"), + field.get("type"), + field.get("summary"), + field.find("mandatoryConform") is not None, + ) + for field in struct.findall("field") + ], + ) + + def get_data_types(self) -> Dict[str, Dict]: + """Return all parsed data types.""" + return {"enums": self.enums, "bitmaps": self.bitmaps, "structs": self.structs} diff --git a/tools/data_model_gen/xml_processing/device_parser.py b/tools/data_model_gen/xml_processing/device_parser.py new file mode 100644 index 000000000..e6c520925 --- /dev/null +++ b/tools/data_model_gen/xml_processing/device_parser.py @@ -0,0 +1,156 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import logging +import xml.etree.ElementTree as ET +from xml.etree.ElementTree import Element +from .elements import Cluster, Device +from utils.helper import check_valid_id, convert_to_snake_case, safe_get_attr + +logger = logging.getLogger(__name__) + + +def is_mandatory(element: Element) -> bool: + mandatory_conform = element.find("mandatoryConform") + return mandatory_conform is not None and len(mandatory_conform) == 0 + + +class DeviceParser: + def can_skip(self, element: Element): + if not element.get("name"): + return True, "name is missing" + if not element.get("id"): + return True, "id is missing" + if not check_valid_id(element.get("id")): + return True, "id is not valid" + return False, "Unknown reason" + + def parse(self, file_path): + """Parse a device XML file and return the parsed device object. + + :param file_path: + :returns: The parsed device object. + + """ + tree = ET.parse(file_path) + root = tree.getroot() + + skip, reason = self.can_skip(root) + if skip: + logger.warning(f"Skipping {file_path} reason : {reason}") + return None + + device = self.create_device(root) + for cluster_elem in root.findall("clusters/cluster"): + skip, reason = self.can_skip(cluster_elem) + if skip: + logger.warning( + f"Skipping cluster {cluster_elem.get('name')} reason : {reason}" + ) + continue + cluster = self.create_cluster(cluster_elem) + device.clusters.add(cluster) + logger.debug( + f"Processed device {safe_get_attr(device, 'name')} successfully with {len(device.clusters)} clusters" + ) + return device + + def create_device(self, root: Element): + """Create a device object from the device XML element. + Assumes device has valid id and name. + """ + device = Device( + id=root.get("id"), + name=root.get("name"), + revision=root.get("revision", "Unknown"), + ) + device.revision_history = self._get_revision_history(root) + device.classification = self._get_classification(root) + device.conditions = self._get_conditions(root) + return device + + def create_cluster(self, cluster_elem: Element): + """Create a cluster object from the cluster XML element. + Assumes cluster has valid id and name. + """ + cluster = Cluster( + name=cluster_elem.get("name"), id=cluster_elem.get("id"), revision=None + ) + cluster.server_cluster = cluster_elem.get("side") == "server" + cluster.client_cluster = cluster_elem.get("side") == "client" + + mandatory_conform = cluster_elem.find("mandatoryConform") + if ( + mandatory_conform is not None + and mandatory_conform.find("condition") is None + ): + cluster.is_mandatory = True + attribute_list = [] + for attribute_elem in cluster_elem.findall("attributes/attribute"): + if is_mandatory(attribute_elem): + attribute_list.append(convert_to_snake_case(attribute_elem.get("name"))) + cluster.attribute_name_list = attribute_list + + feature_list = [] + for feature_elem in cluster_elem.findall("features/feature"): + if is_mandatory(feature_elem): + feature_name = ( + feature_elem.get("name") + if feature_elem.get("name") + else feature_elem.get("code") + ) + feature_list.append(convert_to_snake_case(feature_name)) + cluster.feature_name_list = feature_list + + command_list = [] + for command_elem in cluster_elem.findall("commands/command"): + if is_mandatory(command_elem): + command_list.append(convert_to_snake_case(command_elem.get("name"))) + cluster.command_name_list = command_list + + event_list = [] + for event_elem in cluster_elem.findall("events/event"): + if is_mandatory(event_elem): + event_list.append(convert_to_snake_case(event_elem.get("name"))) + cluster.event_name_list = event_list + + return cluster + + def _get_revision_history(self, root): + revision_history = [] + for revision in root.findall("revisionHistory/revision"): + revision_history.append( + { + "revision": revision.get("revision"), + "summary": revision.get("summary"), + } + ) + return revision_history + + def _get_classification(self, root): + classification = {} + for classification_elem in root.findall("classification"): + for attr_name, attr_value in classification_elem.attrib.items(): + classification[attr_name] = attr_value + return classification + + def _get_conditions(self, root): + conditions = [] + for condition_elem in root.findall("conditions/condition"): + conditions.append( + { + "name": condition_elem.get("name"), + "summary": condition_elem.get("summary"), + } + ) + return conditions diff --git a/tools/data_model_gen/xml_processing/element_parser_base.py b/tools/data_model_gen/xml_processing/element_parser_base.py new file mode 100644 index 000000000..3d8bf1570 --- /dev/null +++ b/tools/data_model_gen/xml_processing/element_parser_base.py @@ -0,0 +1,62 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import logging +from xml.etree.ElementTree import Element + +from utils.base_elements import BaseElementParser +from utils.helper import check_valid_id +from .conformance_parser import is_restricted_by_conformance + +logger = logging.getLogger(__name__) + + +class ClusterElementBaseParser(BaseElementParser): + """Base for cluster element parsers (attribute, command, event). Shared skip and id/name logic.""" + + def __init__(self, cluster, feature_map, allowed_ids, base_elements=None): + self.cluster = cluster + self.feature_map = feature_map or {} + self.allowed_ids = allowed_ids or [] + self.base_elements = base_elements or [] + self.processed = set() # NOTE: contains all the visited element names + + def can_skip(self, elem: Element) -> (bool, str): + """Return True if this element should be skipped (invalid, filtered, or conformance).""" + name = elem.get("name") + if not name: + return True, "missing name" + if name in self.processed: + return True, "already processed" + self.processed.add(name) + + base_list = self.base_elements + base = next((b for b in base_list if getattr(b, "name", None) == name), None) + if base: + self._fill_from_base(elem, base) + + elem_id = elem.get("id") + if not check_valid_id(elem_id): + return True, "invalid id" + if not (name and elem_id): + return True, "missing name or id" + if self.allowed_ids and int(elem_id, 16) not in self.allowed_ids: + return True, "id not in allowed list" + if is_restricted_by_conformance(self.feature_map, elem): + return True, "conformance restrictions" + return False, "Unknown reason" + + def _fill_from_base(self, elem: Element, base): + """Fill elem from base when attribute is missing. Override in AttributeParser to also set type.""" + if not elem.get("id", None) and getattr(base, "id", None): + elem.set("id", base.id) diff --git a/tools/data_model_gen/xml_processing/elements.py b/tools/data_model_gen/xml_processing/elements.py new file mode 100644 index 000000000..39f6e860a --- /dev/null +++ b/tools/data_model_gen/xml_processing/elements.py @@ -0,0 +1,580 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import logging +from dataclasses import dataclass +from typing import List, Any +from .attribute_type import AttributeType +from utils.base_elements import ( + BaseDevice, + BaseEvent, + BaseFeature, + BaseCommand, + BaseAttribute, + BaseCluster, +) +from utils.overrides import ( + should_skip_delegate_callback, + should_skip_plugin_callback, + should_include_delegate_callback, +) +from utils.conversion_utils import convert_to_int +from .serializers import ( + DeviceSerializer, + EventSerializer, + FeatureSerializer, +) + +logger = logging.getLogger(__name__) + + +class Device(BaseDevice): + """Device class that inherits from BaseDevice.""" + + def __init__(self, id, name, revision): + super().__init__(id=id, name=name, revision=revision) + self.clusters = set() + self.features = set() + self.commands = set() + self.attributes = set() + self.classification = {} + self.conformance = None + self.filename = self.esp_name + "_device" + self.revision_history = [] + self.conditions = [] + + def add_feature(self, feature: str): + self.features.add(feature) + + def add_command(self, command: str): + self.commands.add(command) + + def add_attribute(self, attribute: str): + self.attributes.add(attribute) + + def get_clusters(self) -> List[BaseCluster]: + return sorted( + self.clusters, key=lambda x: (int(x.get_id(), 16), not x.server_cluster) + ) + + def get_unique_clusters(self): + unique_clusters_dict = {} + for cluster in self.clusters: + cluster_id = cluster.get_id() + if cluster_id not in unique_clusters_dict: + unique_clusters_dict[cluster_id] = cluster + unique_clusters = list(unique_clusters_dict.values()) + return sorted( + unique_clusters, key=lambda x: (int(x.get_id(), 16), not x.server_cluster) + ) + + def to_dict(self): + return DeviceSerializer.to_dict(self) + + +class Event(BaseEvent): + def __init__(self, id, name, is_mandatory): + super().__init__(name, id, is_mandatory) + self.conformance = None + + def to_dict(self, attribute_map=None): + """Convert event object to dictionary representation""" + return EventSerializer.to_dict(self, attribute_map) + + +class Feature(BaseFeature): + def __init__(self, name, code, id): + super().__init__(name, id, is_mandatory=False) + self.code = code + self.command_set = set() + self.attribute_set = set() + self.event_set = set() + self.summary = None + self.conformance = None + + def add_attribute_list(self, attributes: set): + if attributes: + self.attribute_set.update(attributes) + + def add_event_list(self, events: set): + if events: + self.event_set.update(events) + + def get_attributes(self): + """Returns the list of mandatory attributes for this feature""" + attr_list = list(self.attribute_set) + if len(attr_list) > 0: + attr_list.sort(key=lambda x: int(x.get_id(), 16)) + return attr_list + + def get_events(self) -> List[BaseEvent]: + """Returns the list of mandatory events for this feature""" + event_list = list(self.event_set) + if len(event_list) > 0: + event_list.sort(key=lambda x: int(x.get_id(), 16)) + return event_list + + def add_command_list(self, commands): + if commands is not None: + self.command_set.update(commands) + + def get_commands(self): + command_list = list(self.command_set) + if len(command_list) > 0: + command_list.sort(key=lambda x: int(x.get_id(), 16)) + return command_list + + def to_dict(self, attribute_map=None): + """Convert feature object to dictionary representation""" + return FeatureSerializer.to_dict(self, attribute_map) + + +class Command(BaseCommand): + @dataclass(frozen=True) + class CommandFlags: + COMMAND_FLAG_NONE: str = "COMMAND_FLAG_NONE" + COMMAND_FLAG_CUSTOM: str = "COMMAND_FLAG_CUSTOM" + COMMAND_FLAG_ACCEPTED: str = "COMMAND_FLAG_ACCEPTED" + COMMAND_FLAG_GENERATED: str = "COMMAND_FLAG_GENERATED" + + @dataclass + class CommandAccess: + invokePrivilege: str + timed: bool + fabric_scoped: bool + + @dataclass + class CommandField: + id: Any + name: str + type_: str + default_value: Any = None + is_mandatory: bool = False + constraint: Any = None + + def __init__(self, id, name, direction, response, is_mandatory): + super().__init__( + ( + name.split(" ")[0] + if len(name.split(" ")) > 1 and name.split(" ")[1] == "Command" + else name + ), + id, + is_mandatory, + direction, + response, + ) + self.feature_list = set() + self.access = None + self.conformance = None + self.fields = [] # List of CommandField objects + self.feature_map = {} + + self.skip_command_cb = False + self.command_handler_available = False + + def set_access(self, access): + self.access = access + + def set_conformance(self, conformance): + self.conformance = conformance + + def add_field(self, field): + self.fields.append(field) + + def get_flag(self): + if self.direction and self.direction.lower() == "commandtoserver": + return self.CommandFlags.COMMAND_FLAG_ACCEPTED + elif self.direction and self.direction.lower() == "responsefromserver": + return self.CommandFlags.COMMAND_FLAG_GENERATED + return self.CommandFlags.COMMAND_FLAG_NONE + + def callback_required(self): + """Determine if a command requires a callback""" + if self.command_handler_available: + return False + + # If command is part of a cluster file with multiple cluster ids e.g. ResourceMonitoring + if self.skip_command_cb: + return False + + # Skip callbacks for client-bound commands + if self.direction is not None and self.direction.lower() != "commandtoserver": + return False + + # Commands with response='Y' or specific response commands need callbacks + if self.response is None or self.response == "N": + return False + + # Check if this is a response command (ends with 'Response') + if self.name and self.name.endswith("Response"): + return False + + return True + + def to_dict(self, attribute_map=None): + """Convert command object to dictionary representation""" + from .serializers import CommandSerializer + + return CommandSerializer.to_dict(self, attribute_map) + + +class Attribute(BaseAttribute): + @dataclass(frozen=True) + class AttributeFlags: + ATTRIBUTE_FLAG_NONE: str = "ATTRIBUTE_FLAG_NONE" + ATTRIBUTE_FLAG_WRITABLE: str = "ATTRIBUTE_FLAG_WRITABLE" + ATTRIBUTE_FLAG_NONVOLATILE: str = "ATTRIBUTE_FLAG_NONVOLATILE" + ATTRIBUTE_FLAG_MIN_MAX: str = "ATTRIBUTE_FLAG_MIN_MAX" + ATTRIBUTE_FLAG_MUST_USE_TIMED_WRITE: str = "ATTRIBUTE_FLAG_MUST_USE_TIMED_WRITE" + ATTRIBUTE_FLAG_EXTERNAL_STORAGE: str = "ATTRIBUTE_FLAG_EXTERNAL_STORAGE" + ATTRIBUTE_FLAG_SINGLETON: str = "ATTRIBUTE_FLAG_SINGLETON" + ATTRIBUTE_FLAG_NULLABLE: str = "ATTRIBUTE_FLAG_NULLABLE" + ATTRIBUTE_FLAG_OVERRIDE: str = "ATTRIBUTE_FLAG_OVERRIDE" + ATTRIBUTE_FLAG_DEFERRED: str = "ATTRIBUTE_FLAG_DEFERRED" + ATTRIBUTE_FLAG_MANAGED_INTERNALLY: str = "ATTRIBUTE_FLAG_MANAGED_INTERNALLY" + + @dataclass + class Access: + read: str + readPrivilege: str + write: str + writePrivilege: str + + @dataclass + class Quality: + changeOmitted: str + nullable: str + scene: str + persistence: str + reportable: str + sourceAttribution: str = None + quieterReporting: str = None + + @dataclass + class Constraint: + type: str + from_: str = None + to_: str = None + value: str = None + + def to_dict(self): + result = {"type": self.type} + + if not self.type: + return result + + if self.type == "min": + if self.value: + result["min"] = self.value + elif self.type == "max": + if self.value: + result["max"] = self.value + elif self.type == "maxLength": + if self.value: + result["maxLength"] = self.value + elif self.type == "between": + if self.from_: + result["min"] = self.from_ + if self.to_: + result["max"] = self.to_ + elif self.type == "desc": + if self.value: + result["description"] = self.value + else: + # For other constraint types + if self.value: + result["value"] = self.value + + return result + + def __init__( + self, + name, + id, + type_, + default_value, + is_mandatory, + access=None, + quality=None, + constraint=None, + ): + super().__init__(name, id, type_, is_mandatory, default_value) + self.conformance = None + self.max_value = None + self.min_value = None + + # Store access, quality, and constraint information + self.access = access + self.quality = quality + self.constraint = constraint + self.internally_managed = False + self.is_nullable = ( + self.quality is not None + and getattr(self.quality, "nullable", None) is not None + and self.quality.nullable.lower() == "true" + ) + + def get_flag(self): + flags = [] + if self.access is not None: + write_val = getattr(self.access, "write", None) + if write_val and write_val.lower() in ("true", "optional"): + flags.append(self.AttributeFlags.ATTRIBUTE_FLAG_WRITABLE) + if self.internally_managed: + flags.append(self.AttributeFlags.ATTRIBUTE_FLAG_MANAGED_INTERNALLY) + + if self.quality is not None: + nullable_val = getattr(self.quality, "nullable", None) + if nullable_val and nullable_val.lower() == "true": + flags.append(self.AttributeFlags.ATTRIBUTE_FLAG_NULLABLE) + persistence_val = getattr(self.quality, "persistence", None) + if persistence_val and persistence_val.lower() == "nonvolatile": + flags.append(self.AttributeFlags.ATTRIBUTE_FLAG_NONVOLATILE) + + return " | ".join(flags) if flags else self.AttributeFlags.ATTRIBUTE_FLAG_NONE + + def get_default_value_type(self): + """Get the ESP type for the default value""" + value = self.get_default_value() + if isinstance(value, bool): + return "bool" + if isinstance(value, int): + if value <= 255: + return "uint8_t" + elif value <= 65535: + return "uint16_t" + return "uint32_t" + return "uint32_t" + + def get_default_value(self): + """Get the default value of the attribute""" + return self._convert_default_values() + + def get_type(self): + """Get the ESP type for the attribute""" + return AttributeType(self.type).get_attribute_type() + + def _convert_default_values(self): + """Convert the default value to known values""" + if self.type == "bool": + if self.default_value is None: + return "false" + return "true" if self.default_value.lower() in ("true", "1") else "false" + + if self.type in ("string", "octstr"): + if ( + self.constraint is not None + and getattr(self.constraint, "type", None) == "maxLength" + and getattr(self.constraint, "value", None) is not None + ): + return int(self.constraint.value) + return 0 + + if self.type == "list": + if ( + self.constraint is not None + and getattr(self.constraint, "value", None) + and self.constraint.value.isdigit() + ): + return int(self.constraint.value) + return 0 + + if "enum" in self.type.lower() or "bitmap" in self.type.lower(): + if self.default_value is not None: + return convert_to_int(self.default_value, default="0") + return "0" + + if self.default_value is not None and "°" in self.default_value: + default_value = self.default_value.split("°")[0] + if default_value.isdigit(): + return int(default_value) * 100 + return 0 + + if self.default_value is not None and not self.default_value.isdigit(): + first_part = self.default_value.split(" ")[0] + if first_part.isdigit(): + return int(first_part) + + return convert_to_int(self.default_value, default="0") + + def get_max_value(self): + """Get the max value of the attribute""" + return self.max_value + + def get_min_value(self): + """Get the min value of the attribute""" + return self.min_value + + def to_dict(self, attribute_map=None): + """Convert attribute object to dictionary representation""" + from .serializers import AttributeSerializer + + return AttributeSerializer.to_dict(self, attribute_map) + + +class Cluster(BaseCluster): + @dataclass(frozen=True) + class ClusterFlags: + CLUSTER_FLAG_NONE: str = "CLUSTER_FLAG_NONE" + CLUSTER_FLAG_INIT_FUNCTION: str = "CLUSTER_FLAG_INIT_FUNCTION" + CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION: str = ( + "CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION" + ) + CLUSTER_FLAG_SHUTDOWN_FUNCTION: str = "CLUSTER_FLAG_SHUTDOWN_FUNCTION" + CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION: str = ( + "CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION" + ) + CLUSTER_FLAG_SERVER: str = "CLUSTER_FLAG_SERVER" + CLUSTER_FLAG_CLIENT: str = "CLUSTER_FLAG_CLIENT" + + def __init__(self, name, id, revision, is_mandatory=False): + super().__init__(name, id, revision, is_mandatory) + self.attributes = set() + self.commands = set() + self.events = set() + self.features = set() + self.conformance = None + self.revision_history = [] + self.data_types = {} + # Classification details + self.role = "application" # Default value + self.hierarchy = None + self.pics_code = None + self.scope = None + self.base_cluster_name = None + self.is_migrated_cluster = False + self.skip_command_cb = False + + def get_callback_functions(self): + """Get the callback functions for the cluster""" + callback_functions = [] + if self.init_function_available: + callback_functions.append( + f"emberAf{self.chip_name}ClusterServerInitCallback" + ) + if self.attribute_changed_function_available: + callback_functions.append( + f"Matter{self.chip_name}ClusterServerAttributeChangedCallback" + ) + if self.shutdown_function_available: + callback_functions.append( + f"Matter{self.chip_name}ClusterServerShutdownCallback" + ) + if self.pre_attribute_change_function_available: + callback_functions.append( + f"Matter{self.chip_name}ClusterServerPreAttributeChangedCallback" + ) + return callback_functions + + def get_plugin_server_init_callback(self): + """Get the plugin server init callback for the cluster""" + if not self.plugin_init_cb_available or should_skip_plugin_callback(self.id): + return None + if "_cluster" in self.name.lower(): + cluster_name = self.name.split("_Cluster")[0] + return f"Matter{cluster_name}PluginServerInitCallback" + else: + return f"Matter{self.chip_name}PluginServerInitCallback" + + def get_delegate_init_callback(self): + """Get the delegate init callback for the cluster""" + if self.delegate_init_callback_available and not should_skip_delegate_callback( + self.id + ): + return f"{self.chip_name}DelegateInitCB" + if should_include_delegate_callback(self.id): + return f"{self.chip_name}DelegateInitCB" + return None + + def get_attributes(self): + """Get all attributes sorted by attribute id, then by name if ids match""" + attributes = list(self.attributes) + attributes.sort(key=lambda x: (int(x.get_id(), 16), x.name)) + return attributes + + def get_commands(self): + """Get all commands sorted by command id, then by name if ids match""" + commands = list(self.commands) + commands.sort(key=lambda x: (int(x.get_id(), 16), x.name)) + return commands + + def get_events(self) -> List[BaseEvent]: + """Get all events sorted by event id, then by name if ids match""" + events = list(self.events) + events.sort(key=lambda x: (int(x.get_id(), 16), x.name)) + return events + + def get_features(self): + """Get all features sorted by feature id""" + features = list(self.features) + features.sort(key=lambda x: int(x.get_id(), 16)) + return features + + def _get_mandatory_elements(self, elements): + """Helper to filter mandatory elements with no conformance condition.""" + result = [] + for elem in elements: + if not elem.is_mandatory: + continue + conformance = getattr(elem, "conformance", None) + if conformance is None: + continue + condition = ( + conformance.get("condition") if isinstance(conformance, dict) else None + ) + if condition is None: + result.append(elem) + return ( + sorted(result, key=lambda x: (int(x.get_id(), 16), x.name)) + if result + else result + ) + + def get_mandatory_attributes(self): + """Get only mandatory attributes from the attribute list""" + return self._get_mandatory_elements(self.attributes) + + def get_mandatory_commands(self): + """Get only mandatory commands from the command list""" + return self._get_mandatory_elements(self.commands) + + def get_mandatory_events(self): + """Get only mandatory events from the event list""" + return self._get_mandatory_elements(self.events) + + def get_function_flags(self): + """Get the function flags for the cluster""" + flags = [] + if self.server_cluster: + flags.append(self.ClusterFlags.CLUSTER_FLAG_SERVER) + if self.client_cluster: + flags.append(self.ClusterFlags.CLUSTER_FLAG_CLIENT) + if self.init_function_available: + flags.append(self.ClusterFlags.CLUSTER_FLAG_INIT_FUNCTION) + if self.attribute_changed_function_available: + flags.append(self.ClusterFlags.CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION) + if self.shutdown_function_available: + flags.append(self.ClusterFlags.CLUSTER_FLAG_SHUTDOWN_FUNCTION) + if self.pre_attribute_change_function_available: + flags.append(self.ClusterFlags.CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION) + + if len(flags) > 0: + return " | ".join(flags) + return self.ClusterFlags.CLUSTER_FLAG_NONE + + def to_dict(self): + """Convert cluster object to dictionary representation""" + from .serializers import ClusterSerializer + + return ClusterSerializer.to_dict(self) diff --git a/tools/data_model_gen/xml_processing/event_parser.py b/tools/data_model_gen/xml_processing/event_parser.py new file mode 100644 index 000000000..e5ec2f8c1 --- /dev/null +++ b/tools/data_model_gen/xml_processing/event_parser.py @@ -0,0 +1,68 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import logging +from xml.etree.ElementTree import Element + +from .conformance_parser import parse_conformance +from .element_parser_base import ClusterElementBaseParser +from .elements import Event +from utils.helper import safe_get_attr +from typing import List + +logger = logging.getLogger(__name__) + + +class EventParser(ClusterElementBaseParser): + """Parses cluster events from XML.""" + + def __init__( + self, + cluster, + feature_map, + allowed_events_ids: list = None, + base_events: List[Event] = None, + ): + super().__init__( + cluster, feature_map, allowed_events_ids or [], base_events or [] + ) + + def parse(self, root) -> None: + """Parse events from cluster XML root and add to cluster.events. Merges base_events if provided.""" + logger.debug( + f"Parsing events for cluster {safe_get_attr(self.cluster, 'name')}" + ) + for elem in root.findall("events/event"): + skip, reason = self.can_skip(elem) + if skip: + logger.debug("Skipping event %s: %s", elem.get("name"), reason) + continue + evt = self.create(elem) + self.cluster.events.add(evt) + + for base_evt in self.base_elements: + if base_evt.name not in self.processed: + if base_evt.conformance is not None: + base_evt.conformance.feature_map = self.feature_map + if base_evt.conformance.is_disallowed(): + continue + self.cluster.events.add(base_evt) + + def create(self, elem: Element) -> Event: + event = Event( + id=elem.get("id"), + name=elem.get("name"), + is_mandatory=elem.find("mandatoryConform") is not None, + ) + event.conformance = parse_conformance(elem, self.feature_map) + return event diff --git a/tools/data_model_gen/xml_processing/feature_parser.py b/tools/data_model_gen/xml_processing/feature_parser.py new file mode 100644 index 000000000..8cafd5c99 --- /dev/null +++ b/tools/data_model_gen/xml_processing/feature_parser.py @@ -0,0 +1,93 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import logging +from xml.etree.ElementTree import Element +from typing import List +from .conformance_parser import parse_conformance, match_conformance_items +from .elements import Feature +from .conformance_parser import is_restricted_by_conformance +from .element_parser_base import ClusterElementBaseParser + +logger = logging.getLogger(__name__) + + +class FeatureParser(ClusterElementBaseParser): + """Parses cluster features from XML and links them to attributes/commands/events via conformance.""" + + def __init__(self, root: Element, cluster, base_features: List[Feature]): + self.feature_map = self._generate_feature_map(root, base_features) + super().__init__(cluster, self.feature_map, [], base_features) + + def parse(self, root: Element): + """Parse features from cluster XML and add it to the cluster + NOTE: This function expect the feature map to be created and populated before calling this function + """ + for elem in root.findall("features/feature"): + elem.set("id", str(self._generate_feature_id(elem))) + skip, reason = self.can_skip(elem) + if skip: + logger.debug("Skipping feature %s: %s", elem.get("name"), reason) + self.feature_map.pop(elem.get("code"), None) + continue + feature = self.create(elem) + feature.conformance = parse_conformance(elem, self.feature_map) + self._link_feature_items(feature) + self.cluster.features.add(feature) + for base_feature in self.base_elements: + if ( + base_feature.name not in self.processed + and base_feature.code in self.feature_map.keys() + ): + self.cluster.features.add(base_feature) + + def create(self, elem: Element) -> Feature: + name = elem.get("name") + code = elem.get("code") + feature_id = self._generate_feature_id(elem) + feature = Feature(name=name, code=code, id=feature_id) + return feature + + def _generate_feature_map( + self, root: Element, base_features: List[Feature] + ) -> dict: + """Build valid {code: Feature} map""" + logger.debug( + f"Creating feature map for the cluster {root.get('name', 'Unknown')}" + ) + feature_map = {} + for feature_elem in root.findall("features/feature"): + feature = self.create(feature_elem) + feature_map[feature.code] = feature + for base_feature in base_features: + if base_feature.code not in feature_map: + feature_map[base_feature.code] = base_feature + for feature_elem in root.findall("features/feature"): + if is_restricted_by_conformance(feature_map, feature_elem): + feature_map.pop(feature_elem.get("code"), None) + return feature_map + + def _generate_feature_id(self, elem: Element) -> hex: + bit = elem.get("bit") + return hex(0x1 << int(bit)) if bit is not None else 0 + + def _link_feature_items(self, feature: Feature) -> None: + attrs = match_conformance_items(feature, self.cluster.get_attributes()) + if attrs: + feature.add_attribute_list(attrs) + cmds = match_conformance_items(feature, self.cluster.get_commands()) + if cmds: + feature.add_command_list(cmds) + evts = match_conformance_items(feature, self.cluster.get_events()) + if evts: + feature.add_event_list(evts) diff --git a/tools/data_model_gen/xml_processing/parse_context.py b/tools/data_model_gen/xml_processing/parse_context.py new file mode 100644 index 000000000..caeea8b28 --- /dev/null +++ b/tools/data_model_gen/xml_processing/parse_context.py @@ -0,0 +1,85 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Parse context: pre-loaded metadata used during cluster parsing. +Loads JSON artifacts once per run to avoid repeated file I/O. +""" + +import json +import os + +from utils.config import FileNames +from utils.conversion_utils import hex_to_int + + +def load_cluster_parse_context(output_dir: str): + """Load all cluster-related metadata from output_dir into a single context.""" + + def _load_json(filename: str): + path = os.path.join(output_dir, filename) + with open(path, "r") as f: + return json.load(f) + + return ClusterParseContext( + delegate_clusters=_load_json(FileNames.DELEGATE_CLUSTERS.value), + plugin_init_cb_clusters=_load_json(FileNames.PLUGIN_INIT_CB_CLUSTERS.value), + migrated_clusters=_load_json(FileNames.MIGRATED_CLUSTERS.value), + zap_filter_list=_load_json(FileNames.ZAP_FILTER_LIST.value), + internally_managed_attributes=_load_json( + FileNames.INTERNALLY_MANAGED_ATTRIBUTES.value + ), + ) + + +class ClusterParseContext: + """Holds pre-loaded metadata for cluster parsing. Built once per run.""" + + def __init__( + self, + delegate_clusters: list, + plugin_init_cb_clusters: list, + migrated_clusters: list, + zap_filter_list: dict, + internally_managed_attributes: dict, + ): + self.delegate_clusters = delegate_clusters + self.plugin_init_cb_clusters = plugin_init_cb_clusters + self.migrated_clusters = migrated_clusters + self.zap_filter_list = zap_filter_list + self.internally_managed_attributes = internally_managed_attributes + + def get_allowed_attributes(self, cluster_id: str): + """Return allowed attributes for cluster_id.""" + cluster_info = self.zap_filter_list.get("clusters", {}).get(cluster_id, {}) + if not cluster_info: + return [] + return hex_to_int(list(cluster_info.get("Attributes", {}).values())) + + def get_allowed_commands(self, cluster_id: str): + """Return allowed commands for cluster_id.""" + cluster_info = self.zap_filter_list.get("clusters", {}).get(cluster_id, {}) + if not cluster_info: + return [] + return hex_to_int(list(cluster_info.get("Commands", {}).values())) + + def get_allowed_events(self, cluster_id: str): + """Return allowed events for cluster_id.""" + cluster_info = self.zap_filter_list.get("clusters", {}).get(cluster_id, {}) + if not cluster_info: + return [] + return hex_to_int(list(cluster_info.get("Events", {}).values())) + + def get_internally_managed_attributes(self, esp_name: str) -> list: + """Return list of internally managed attribute names for the cluster.""" + return self.internally_managed_attributes.get(esp_name, []) diff --git a/tools/data_model_gen/xml_processing/serializers.py b/tools/data_model_gen/xml_processing/serializers.py new file mode 100644 index 000000000..a195a15ac --- /dev/null +++ b/tools/data_model_gen/xml_processing/serializers.py @@ -0,0 +1,372 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Serializer classes to convert source parser elements to dictionary representations. +""" + +import logging +from utils.helper import safe_get_attr + +logger = logging.getLogger(__name__) + + +class DataTypeSerializer: + @staticmethod + def to_dict(data_types): + parsed = {} + for data_type, data_type_list in data_types.items(): + type_list = [] + for data_type_name, data_type_object in data_type_list.items(): + type_list.append(data_type_object.to_dict()) + parsed[data_type] = type_list + return parsed + + +class AttributeSerializer: + @staticmethod + def to_dict(attr, attribute_map=None): + return { + "name": attr.name, + "id": attr.get_id(), + "type": safe_get_attr(attr, "type"), + "converted_type": attr.get_type(), + "default_value": attr.get_default_value(), + "mandatory": safe_get_attr(attr, "is_mandatory"), + "nullable": safe_get_attr(attr, "is_nullable"), + "flags": attr.get_flag(), + "max_length": safe_get_attr(attr, "max_length"), + "min_value": attr.min_value, + "max_value": attr.max_value, + "conformance": ( + safe_get_attr(attr, "conformance").to_dict(attribute_map=attribute_map) + if safe_get_attr(attr, "conformance") + and safe_get_attr(safe_get_attr(attr, "conformance"), "to_dict") + else safe_get_attr(attr, "conformance") + ), + "constraint": ( + safe_get_attr(attr, "constraint").to_dict() + if safe_get_attr(attr, "constraint") + and safe_get_attr(safe_get_attr(attr, "constraint"), "to_dict") + else safe_get_attr(attr, "constraint") + ), + "access": AccessSerializer.to_dict(safe_get_attr(attr, "access")), + "quality": QualitySerializer.to_dict(safe_get_attr(attr, "quality")), + } + + +class CommandSerializer: + @staticmethod + def to_dict(cmd, attribute_map=None): + return { + "name": cmd.name, + "id": cmd.get_id(), + "direction": safe_get_attr(cmd, "direction"), + "response": safe_get_attr(cmd, "response"), + "mandatory": safe_get_attr(cmd, "is_mandatory"), + "flags": cmd.get_flag(), + "callback_required": cmd.callback_required(), + "conformance": ( + safe_get_attr(cmd, "conformance").to_dict(attribute_map=attribute_map) + if safe_get_attr(cmd, "conformance") + and safe_get_attr(safe_get_attr(cmd, "conformance"), "to_dict") + else safe_get_attr(cmd, "conformance") + ), + "fields": [ + CommandFieldSerializer.to_dict(field) + for field in safe_get_attr(cmd, "fields", []) + ], + "access": CommandAccessSerializer.to_dict(safe_get_attr(cmd, "access")), + } + + +class EventSerializer: + @staticmethod + def to_dict(event, attribute_map=None): + return { + "name": event.name, + "id": event.get_id(), + "mandatory": safe_get_attr(event, "is_mandatory"), + "conformance": ( + safe_get_attr(event, "conformance").to_dict(attribute_map=attribute_map) + if safe_get_attr(event, "conformance") + and safe_get_attr(safe_get_attr(event, "conformance"), "to_dict") + else safe_get_attr(event, "conformance") + ), + } + + +class FeatureSerializer: + @staticmethod + def to_dict(feature, attribute_map=None): + return { + "name": feature.name, + "id": feature.get_id(), + "code": safe_get_attr(feature, "code"), + "summary": safe_get_attr(feature, "summary"), + "conformance": ( + safe_get_attr(feature, "conformance").to_dict( + attribute_map=attribute_map + ) + if safe_get_attr(feature, "conformance") + and safe_get_attr(safe_get_attr(feature, "conformance"), "to_dict") + else safe_get_attr(feature, "conformance") + ), + "attributes": [ + attr.name + for attr in sorted( + ( + feature.get_attributes() + if safe_get_attr(feature, "get_attributes") + else safe_get_attr(feature, "attributes", []) + ), + key=lambda attr: ( + safe_get_attr(attr, "id", 0), + safe_get_attr(attr, "name", ""), + ), + ) + ], + "commands": [ + cmd.name + for cmd in sorted( + ( + feature.get_commands() + if safe_get_attr(feature, "get_commands") + else safe_get_attr(feature, "commands", []) + ), + key=lambda cmd: ( + safe_get_attr(cmd, "id", 0), + safe_get_attr(cmd, "name", ""), + ), + ) + ], + "events": [ + event.name + for event in sorted( + ( + feature.get_events() + if safe_get_attr(feature, "get_events") + else safe_get_attr(feature, "events", []) + ), + key=lambda event: ( + safe_get_attr(event, "id", 0), + safe_get_attr(event, "name", ""), + ), + ) + ], + } + + +class AccessSerializer: + @staticmethod + def to_dict(access): + if not access: + return None + + return { + "read": safe_get_attr(access, "read"), + "write": safe_get_attr(access, "write"), + "readPrivilege": safe_get_attr(access, "readPrivilege"), + "writePrivilege": safe_get_attr(access, "writePrivilege"), + } + + +class CommandAccessSerializer: + @staticmethod + def to_dict(access): + if not access: + return None + + return { + "invokePrivilege": safe_get_attr(access, "invokePrivilege"), + "timed": safe_get_attr(access, "timed"), + "fabric_scoped": safe_get_attr(access, "fabric_scoped"), + } + + +class QualitySerializer: + @staticmethod + def to_dict(quality): + if not quality: + return None + + return { + "scene": safe_get_attr(quality, "scene"), + "persistence": safe_get_attr(quality, "persistence"), + "nullable": safe_get_attr(quality, "nullable"), + "reportable": safe_get_attr(quality, "reportable"), + "changeOmitted": safe_get_attr(quality, "changeOmitted"), + "sourceAttribution": safe_get_attr(quality, "sourceAttribution"), + "quieterReporting": safe_get_attr(quality, "quieterReporting"), + } + + +class ClusterSerializer: + @staticmethod + def to_dict(cluster): + attribute_map = {} + for attr in cluster.get_attributes(): + attribute_map[attr.name] = attr.get_id() + + command_map = {} + for cmd in cluster.get_commands(): + command_map[cmd.name] = (cmd.get_id(), cmd.get_flag()) + + reference_map = {**attribute_map, **command_map} + + return { + "name": cluster.name, + "id": cluster.get_id(), + "revision": cluster.get_revision(), + "revision_history": safe_get_attr(cluster, "revision_history"), + "classification": { + "hierarchy": safe_get_attr(cluster, "hierarchy"), + "role": safe_get_attr(cluster, "role"), + "picsCode": safe_get_attr(cluster, "pics_code"), + "scope": safe_get_attr(cluster, "scope"), + "baseCluster": safe_get_attr(cluster, "base_cluster_name"), + }, + "callback_functions": cluster.get_callback_functions(), + "function_flags": cluster.get_function_flags(), + "bound_callback_available": safe_get_attr( + cluster, "bound_callback_available" + ), + "delegate_init_callback": cluster.get_delegate_init_callback(), + "plugin_server_init_callback": cluster.get_plugin_server_init_callback(), + "is_migrated_cluster": safe_get_attr(cluster, "is_migrated_cluster"), + "data_types": DataTypeSerializer.to_dict(cluster.data_types), + "attributes": [ + AttributeSerializer.to_dict(attr, reference_map) + for attr in sorted( + ( + cluster.get_attributes() + if safe_get_attr(cluster, "get_attributes") + else safe_get_attr(cluster, "attributes", []) + ), + key=lambda attr: ( + safe_get_attr(attr, "id", 0), + safe_get_attr(attr, "name", ""), + ), + ) + ], + "commands": [ + CommandSerializer.to_dict(cmd, reference_map) + for cmd in sorted( + ( + cluster.get_commands() + if safe_get_attr(cluster, "get_commands") + else safe_get_attr(cluster, "commands", []) + ), + key=lambda cmd: ( + safe_get_attr(cmd, "id", 0), + safe_get_attr(cmd, "name", ""), + ), + ) + ], + "events": [ + EventSerializer.to_dict(event, reference_map) + for event in sorted( + ( + cluster.get_events() + if safe_get_attr(cluster, "get_events") + else safe_get_attr(cluster, "events", []) + ), + key=lambda event: ( + safe_get_attr(event, "id", 0), + safe_get_attr(event, "name", ""), + ), + ) + ], + "features": [ + FeatureSerializer.to_dict(feature, reference_map) + for feature in sorted( + ( + cluster.get_features() + if safe_get_attr(cluster, "get_features") + else safe_get_attr(cluster, "features", []) + ), + key=lambda feature: ( + safe_get_attr(feature, "id", 0), + safe_get_attr(feature, "name", ""), + ), + ) + ], + } + + +class DeviceSerializer: + @staticmethod + def to_dict(device): + result = { + "name": safe_get_attr(device, "name"), + "id": device.get_id(), + "revision": safe_get_attr(device, "revision"), + "classification": safe_get_attr(device, "classification", {}), + "revision_history": safe_get_attr(device, "revision_history", []), + "conditions": safe_get_attr(device, "conditions", []), + "clusters": [ + { + "name": cluster.name, + "id": cluster.get_id(), + "is_mandatory": safe_get_attr(cluster, "is_mandatory", False), + "type": ( + "server" + if safe_get_attr(cluster, "server_cluster") + else ( + "client" + if safe_get_attr(cluster, "client_cluster") + else None + ) + ), + "flags": cluster.get_function_flags(), + "features": safe_get_attr(cluster, "feature_name_list", []), + "commands": safe_get_attr(cluster, "command_name_list", []), + "attributes": safe_get_attr(cluster, "attribute_name_list", []), + "events": safe_get_attr(cluster, "event_name_list", []), + } + for cluster in ( + device.get_clusters() + if safe_get_attr(device, "get_clusters") + else safe_get_attr(device, "clusters", []) + ) + ], + } + return result + + +class CommandFieldSerializer: + @staticmethod + def to_dict(field): + if not field: + logger.debug("No field element found") + return None + + result = { + "id": safe_get_attr(field, "id"), + "name": safe_get_attr(field, "name"), + "type": safe_get_attr(field, "type"), + "mandatory": safe_get_attr(field, "is_mandatory"), + } + + default_value = safe_get_attr(field, "default_value") + if default_value: + result["default_value"] = default_value + + constraint = safe_get_attr(field, "constraint") + if constraint: + if isinstance(constraint, dict): + result["constraint"] = constraint + elif safe_get_attr(constraint, "to_dict"): + result["constraint"] = constraint.to_dict() + + return result diff --git a/tools/data_model_gen/xml_processing/xml_parser.py b/tools/data_model_gen/xml_processing/xml_parser.py new file mode 100644 index 000000000..e3d8ee55c --- /dev/null +++ b/tools/data_model_gen/xml_processing/xml_parser.py @@ -0,0 +1,186 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import os +import logging +import xml.etree.ElementTree as ET + +from .cluster_parser import ClusterParser +from .device_parser import DeviceParser +from .parse_context import load_cluster_parse_context +from utils.helper import write_to_file +from utils.exceptions import XmlParseError +from .yaml_parser import YamlParser +from utils.config import FileNames + +logger = logging.getLogger(__name__) + + +def get_base_and_derived_cluster_files(input_dir): + """Return (base_list, derived_list), each a list of (file_path, root). + Parses each XML once; roots are reused by the cluster parser to avoid double parse. + """ + base_cluster_files = [] + derived_cluster_files = [] + for file_name in os.listdir(input_dir): + if os.path.isfile( + os.path.join(input_dir, file_name) + ) and not file_name.endswith(".xml"): + logger.debug(f"Skipping {file_name} as it is not a valid file") + continue + file_path = os.path.join(input_dir, file_name) + tree = ET.parse(file_path) + root = tree.getroot() + classification = root.find("classification") + if ( + classification is not None + and classification.get("hierarchy", "") == "derived" + ): + derived_cluster_files.append((file_path, root)) + else: + base_cluster_files.append((file_path, root)) + return base_cluster_files, derived_cluster_files + + +def write_to_json_file(file_path, data): + data_list = [item.to_dict() for item in data] + data_list.sort(key=lambda x: int(x.get("id", "0"), 16)) + if not write_to_file(file_path, data_list, "json"): + raise XmlParseError( + "Failed to write JSON output", + file_path=file_path, + suggestion="Check write permissions and disk space.", + ) + logger.info("GENERATED json at %s", file_path) + return file_path + + +def process_cluster_files( + input_dir, + output_dir, + yaml_file_path, +): + """Process all cluster XML files from input directory and generate intermediate cluster json file. + First it generates base cluster objects as during parsing of the derived cluster files, the base cluster objects are needed. + Then it generates derived cluster objects. + + :param input_dir: Path to the directory containing the cluster XML files. + :param output_dir: Path to the output directory. + :returns: None + + """ + base_cluster_xml_files, derived_cluster_xml_files = ( + get_base_and_derived_cluster_files(input_dir) + ) + if len(base_cluster_xml_files) == 0 and len(derived_cluster_xml_files) == 0: + logger.error(f"No cluster XML files found in {input_dir}") + return + + yaml_parser = YamlParser(yaml_file_path) + + cluster_parser = ClusterParser() + context = load_cluster_parse_context(output_dir) + base_clusters = [] + derived_clusters = [] + + for file_path, root in base_cluster_xml_files: + cluster_list = cluster_parser.parse( + file_path=file_path, + output_dir=output_dir, + yaml_parser=yaml_parser, + context=context, + root=root, + ) + if cluster_list is None or len(cluster_list) == 0: + logger.error( + "Processing of cluster file failed | File: %s", + file_path, + ) + continue + base_clusters.extend(cluster_list) + + for file_path, root in derived_cluster_xml_files: + cluster_list = cluster_parser.parse( + file_path=file_path, + output_dir=output_dir, + base_clusters=base_clusters, + yaml_parser=yaml_parser, + context=context, + root=root, + ) + if cluster_list is None or len(cluster_list) == 0: + logger.error( + "Processing of derived cluster file failed | File: %s", + file_path, + ) + continue + derived_clusters.extend(cluster_list) + + clusters = base_clusters + derived_clusters + write_to_json_file(os.path.join(output_dir, FileNames.CLUSTER_JSON.value), clusters) + + +def process_device_files(input_dir, output_dir): + """Process all device XML files from input directory and generate intermediate device json file. + + :param input_dir: Path to the directory containing the device XML files. + :param output_dir: Path to the output directory. + :returns: None + + """ + devices = [] + device_parser = DeviceParser() + for file_name in os.listdir(input_dir): + if os.path.isfile(os.path.join(input_dir, file_name)) and file_name.endswith( + ".xml" + ): + file_path = os.path.join(input_dir, file_name) + device = device_parser.parse(file_path=file_path) + if device is not None: + devices.append(device) + + write_to_json_file(os.path.join(output_dir, FileNames.DEVICE_JSON.value), devices) + + +def process_single_files(cluster_file, device_file, output_dir, yaml_file_path=None): + """Process single cluster and device files and generate intermediate cluster and device json files. + + :param cluster_file: Path to the input cluster xml file to process. + :param device_file: Path to the input device xml file to process. + :param output_dir: Path to the output directory. + :param yaml_file_path: Path to the yaml configuration file. + :returns: None + """ + clusters = [] + devices = [] + if cluster_file is not None: + cluster_parser = ClusterParser() + context = load_cluster_parse_context(output_dir) + yaml_parser = YamlParser(yaml_file_path) + # Base cluster objects not available for single file processing + cluster_list = cluster_parser.parse( + file_path=cluster_file, + output_dir=output_dir, + yaml_parser=yaml_parser, + context=context, + ) + if cluster_list is not None: + clusters.extend(cluster_list) + if device_file is not None: + device_parser = DeviceParser() + device = device_parser.parse(file_path=device_file) + if device is not None: + devices.append(device) + + write_to_json_file(os.path.join(output_dir, FileNames.CLUSTER_JSON.value), clusters) + write_to_json_file(os.path.join(output_dir, FileNames.DEVICE_JSON.value), devices) diff --git a/tools/data_model_gen/xml_processing/yaml_parser.py b/tools/data_model_gen/xml_processing/yaml_parser.py new file mode 100644 index 000000000..8b67bb646 --- /dev/null +++ b/tools/data_model_gen/xml_processing/yaml_parser.py @@ -0,0 +1,63 @@ +# Copyright 2026 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import yaml + +from utils.helper import esp_name + + +class YamlParser: + """Parser for YAML configuration files""" + + def __init__(self, file_path: str): + """Initialize the YAML parser + + Args: + file_path: Path to the YAML file + """ + self.file_path = file_path + with open(file_path, "r") as file: + self.config = yaml.safe_load(file) + + def is_present(self, key: str) -> bool: + """Check if a key exists in the YAML configuration + + Args: + key: The key to check + Returns: + True if the key exists, False otherwise + """ + return key in self.config + + def get_list(self, key: str) -> list: + """Get a list of values from the YAML configuration + + Args: + key: The key to get values for + Returns: + A list of values from the YAML configuration + """ + return self.config.get(key, []) + + def is_present_in_list(self, key: str, value: str) -> bool: + """Check if a value exists in a list in the YAML configuration + + Args: + key: The key to check in the YAML configuration + value: The value to check for + Returns: + True if the value exists in the list, False otherwise + """ + if self.is_present(key): + return any(esp_name(value) == esp_name(item) for item in self.get_list(key)) + return False