From 8fe2b63c7817406d3240a278740dd584f89e2f13 Mon Sep 17 00:00:00 2001 From: Rohit Jadhav Date: Mon, 21 Oct 2024 17:53:40 +0530 Subject: [PATCH] components/esp-matter: Update application clusters wrt matter spec components/esp-matter: Update utility clusters wrt matter spec. --- .../esp_matter/esp_matter_attribute.cpp | 276 ++++++++++++ components/esp_matter/esp_matter_attribute.h | 49 +++ .../esp_matter_attribute_bounds.cpp | 7 +- components/esp_matter/esp_matter_cluster.cpp | 10 +- components/esp_matter/esp_matter_cluster.h | 2 + components/esp_matter/esp_matter_command.cpp | 139 +++++++ components/esp_matter/esp_matter_command.h | 22 + components/esp_matter/esp_matter_event.cpp | 45 +- components/esp_matter/esp_matter_event.h | 13 + components/esp_matter/esp_matter_feature.cpp | 393 +++++++++++++++++- components/esp_matter/esp_matter_feature.h | 148 ++++++- .../private/esp_matter_cluster_revisions.h | 46 +- 12 files changed, 1092 insertions(+), 58 deletions(-) diff --git a/components/esp_matter/esp_matter_attribute.cpp b/components/esp_matter/esp_matter_attribute.cpp index f9d1b859a..0f0be1d8b 100644 --- a/components/esp_matter/esp_matter_attribute.cpp +++ b/components/esp_matter/esp_matter_attribute.cpp @@ -136,6 +136,20 @@ attribute_t *create_access_control_entries_per_fabric(cluster_t *cluster, uint16 ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); } +#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS +attribute_t *create_commissioning_arl(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, AccessControl::Attributes::CommissioningARL::Id, ATTRIBUTE_FLAG_NONE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, + esp_matter_array(value, length, count)); +} + +attribute_t *create_arl(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, AccessControl::Attributes::ARL::Id, ATTRIBUTE_FLAG_NONE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, + esp_matter_array(value, length, count)); +} + +#endif } /* attribute */ } /* access_control */ @@ -363,6 +377,38 @@ attribute_t *create_supports_concurrent_connection(cluster_t *cluster, bool valu ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_bool(value)); } +attribute_t *create_tc_accepted_version(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, GeneralCommissioning::Attributes::TCAcceptedVersion::Id, + ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); +} + +attribute_t *create_tc_min_required_version(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, GeneralCommissioning::Attributes::TCMinRequiredVersion::Id, + ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); +} + +attribute_t *create_tc_acknowledgements(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, GeneralCommissioning::Attributes::TCAcknowledgements::Id, + ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bitmap16(value)); +} + +attribute_t *create_tc_acknowledgements_required(cluster_t *cluster, bool value) +{ + return esp_matter::attribute::create(cluster, GeneralCommissioning::Attributes::TCAcknowledgementsRequired::Id, + ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value)); +} + +attribute_t *create_tc_update_deadline(cluster_t *cluster, nullable value) +{ + // Current CHIP submodule don't have this attribute + //return esp_matter::attribute::create(cluster, GeneralCommissioning::Attributes::TCUpdateDeadline::Id, + // ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); + return NULL; +} + } /* attribute */ } /* general_commissioning */ @@ -832,6 +878,26 @@ attribute_t *create_active_network_faults(cluster_t *cluster, uint8_t *value, ui ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); } +attribute_t *create_ext_address(cluster_t *cluster, nullable value) +{ + // Current CHIP submodule don't have this attribute + // TODO: https://jira.espressif.com:8443/browse/CON-1438 + // return esp_matter::attribute::create(cluster, + // ThreadNetworkDiagnostics::Attributes::ExtAddress::Id, + // ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_nullable_uint64(value)); + return NULL; +} + +attribute_t *create_rloc16(cluster_t *cluster, nullable value) +{ + // Current CHIP submodule don't have this attribute + // TODO: https://jira.espressif.com:8443/browse/CON-1438 + // return esp_matter::attribute::create(cluster, + // ThreadNetworkDiagnostics::Attributes::Rloc16::Id, + // ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_nullable_uint16(value)); + return NULL; +} + } /* attribute */ } /* thread_network_diagnostics */ @@ -910,6 +976,12 @@ attribute_t *create_product_name(cluster_t *cluster, char *value, uint16_t lengt esp_matter_char_str(value, length), k_max_product_name_length); } +attribute_t *create_product_id(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, BridgedDeviceBasicInformation::Attributes::ProductID::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_uint16(value)); +} + attribute_t *create_node_label(cluster_t *cluster, char *value, uint16_t length) { VerifyOrReturnValue(length <= k_max_node_label_length, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); @@ -1829,6 +1901,74 @@ attribute_t *create_ac_capacity_format(cluster_t *cluster, uint8_t value) ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value)); } +attribute_t *create_schedule_type(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Thermostat::Attributes::ScheduleTypes::Id, ATTRIBUTE_FLAG_NONE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, + esp_matter_array(value, length, count)); +} + +attribute_t *create_number_of_presets(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, Thermostat::Attributes::NumberOfPresets::Id, + ATTRIBUTE_FLAG_NONE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_number_of_schedules(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, Thermostat::Attributes::NumberOfSchedules::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); +} + +attribute_t *create_number_of_schedule_transitions(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, Thermostat::Attributes::NumberOfScheduleTransitions::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); +} + +attribute_t *create_number_of_schedule_transition_per_day(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, Thermostat::Attributes::NumberOfScheduleTransitionPerDay::Id, + ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); +} + +attribute_t *create_active_preset_handle(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + if (length > k_max_active_preset_handle) { + ESP_LOGE(TAG, "Could not create attribute, string size out of bound"); + return NULL; + } + return esp_matter::attribute::create(cluster, Thermostat::Attributes::ActivePresetHandle::Id, ATTRIBUTE_FLAG_NULLABLE | + ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_octet_str(value, length), k_max_active_preset_handle); +} + +attribute_t *create_active_schedule_handle(cluster_t *cluster, uint8_t *value, uint16_t length) +{ + if (length > k_max_active_schedule_handle) { + ESP_LOGE(TAG, "Could not create attribute, string size out of bound"); + return NULL; + } + return esp_matter::attribute::create(cluster, Thermostat::Attributes::ActiveScheduleHandle::Id, ATTRIBUTE_FLAG_NULLABLE | + ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_octet_str(value, length), k_max_active_schedule_handle); +} + +attribute_t *create_presets(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Thermostat::Attributes::Presets::Id, ATTRIBUTE_FLAG_NONVOLATILE | + ATTRIBUTE_FLAG_WRITABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_schedules(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, Thermostat::Attributes::Schedules::Id, ATTRIBUTE_FLAG_NONVOLATILE | + ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_setpoint_hold_expiry_timestamp(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, Thermostat::Attributes::SetpointHoldExpiryTimestamp::Id, + ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value)); +} + } /* attribute */ } /* thermostat */ @@ -3070,6 +3210,76 @@ attribute_t *create_expiring_user_timeout(cluster_t *cluster, uint16_t value) return attribute; } +attribute_t *create_aliro_reader_verification_key(cluster_t *cluster, uint8_t * value, uint16_t length) +{ + if (length > k_max_aliro_reader_verification_key) { + ESP_LOGE(TAG, "Could not create attribute, string size out of bound"); + return NULL; + } + return esp_matter::attribute::create(cluster, DoorLock::Attributes::AliroReaderVerificationKey::Id, ATTRIBUTE_FLAG_NONE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, + esp_matter_octet_str(value, length), k_max_aliro_reader_verification_key); +} + +attribute_t *create_aliro_reader_group_identifier(cluster_t *cluster, uint8_t * value, uint16_t length) +{ + if (length > k_max_aliro_reader_group_identifier) { + ESP_LOGE(TAG, "Could not create attribute, string size out of bound"); + return NULL; + } + return esp_matter::attribute::create(cluster, DoorLock::Attributes::AliroReaderGroupIdentifier::Id, ATTRIBUTE_FLAG_NONE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, + esp_matter_octet_str(value, length), k_max_aliro_reader_group_identifier); +} + +attribute_t *create_aliro_reader_group_sub_identifier(cluster_t *cluster, uint8_t * value, uint16_t length) +{ + if (length > k_max_aliro_reader_group_sub_identifier) { + ESP_LOGE(TAG, "Could not create attribute, string size out of bound"); + return NULL; + } + return esp_matter::attribute::create(cluster, DoorLock::Attributes::AliroReaderGroupSubIdentifier::Id, ATTRIBUTE_FLAG_NONE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, + esp_matter_octet_str(value, length), k_max_aliro_reader_group_sub_identifier); +} + +attribute_t *create_aliro_expedited_transaction_supported_protocol_versions(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, DoorLock::Attributes::AliroExpeditedTransactionSupportedProtocolVersions::Id, + ATTRIBUTE_FLAG_NONE | 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) +{ + if (length > k_max_aliro_group_resolving_key) { + ESP_LOGE(TAG, "Could not create attribute, string size out of bound"); + return NULL; + } + return esp_matter::attribute::create(cluster, DoorLock::Attributes::AliroGroupResolvingKey::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, + esp_matter_octet_str(value, length), k_max_aliro_group_resolving_key); +} + +attribute_t *create_aliro_supported_bleuwb_protocol_versions(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, DoorLock::Attributes::AliroSupportedBLEUWBProtocolVersions::Id, + ATTRIBUTE_FLAG_NONE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_aliro_ble_advertising_version(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, DoorLock::Attributes::AliroBLEAdvertisingVersion::Id, + ATTRIBUTE_FLAG_NONE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_number_of_aliro_credential_issuer_keys_supported(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, DoorLock::Attributes::NumberOfAliroCredentialIssuerKeysSupported::Id, + ATTRIBUTE_FLAG_NONE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_number_of_aliro_endpoint_keys_supported(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, DoorLock::Attributes::NumberOfAliroEndpointKeysSupported::Id, + ATTRIBUTE_FLAG_NONE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + } /* attribute */ } /* door_lock */ @@ -3316,6 +3526,72 @@ attribute_t *create_occupancy_sensor_type_bitmap(cluster_t *cluster, uint8_t val ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); } +attribute_t *create_hold_time(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::HoldTime::Id, + ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_hold_time_limits(cluster_t *cluster, uint8_t* value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::HoldTimeLimits::Id, + ATTRIBUTE_FLAG_NONE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_pir_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PIROccupiedToUnoccupiedDelay::Id, + ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint16(value)); +} + +attribute_t *create_pir_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PIRUnoccupiedToOccupiedDelay::Id, + ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint16(value)); +} + +attribute_t *create_pir_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PIRUnoccupiedToOccupiedThreshold::Id, + ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint8(value)); +} + +attribute_t *create_ultrasonic_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::UltrasonicOccupiedToUnoccupiedDelay::Id, + ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint16(value)); +} + +attribute_t *create_ultrasonic_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedDelay::Id, + ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint16(value)); +} + +attribute_t *create_ultrasonic_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedThreshold::Id, + ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint8(value)); +} + +attribute_t *create_physical_contact_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Id, + ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint16(value)); +} + +attribute_t *create_physical_contact_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedDelay::Id, + ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint16(value)); +} + +attribute_t *create_physical_contact_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedThreshold::Id, + ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint8(value)); +} + } /* attribute */ } /* occupancy_sensing */ diff --git a/components/esp_matter/esp_matter_attribute.h b/components/esp_matter/esp_matter_attribute.h index c2fe84ec8..fd991450d 100644 --- a/components/esp_matter/esp_matter_attribute.h +++ b/components/esp_matter/esp_matter_attribute.h @@ -60,6 +60,10 @@ attribute_t *create_extension(cluster_t *cluster, uint8_t *value, uint16_t lengt 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 */ @@ -119,6 +123,11 @@ attribute_t *create_basic_commissioning_info(cluster_t *cluster, uint8_t *value, 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 */ @@ -238,6 +247,8 @@ attribute_t *create_security_policy(cluster_t *cluster, uint8_t *value, uint16_t 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(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 */ } /* thread_network_diagnostics */ @@ -272,6 +283,7 @@ 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); @@ -405,6 +417,8 @@ attribute_t *create_airflow_direction(cluster_t *cluster, uint8_t value); } /* 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); @@ -455,6 +469,17 @@ 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_type(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_schedule_type(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 */ @@ -667,6 +692,10 @@ attribute_t *create_operational_error(cluster_t *cluster, uint8_t value); 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); @@ -705,6 +734,15 @@ attribute_t *create_user_code_temporary_disable_time(cluster_t *cluster, uint8_t 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 */ @@ -799,6 +837,17 @@ 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 */ diff --git a/components/esp_matter/esp_matter_attribute_bounds.cpp b/components/esp_matter/esp_matter_attribute_bounds.cpp index f2262fb05..560de7464 100644 --- a/components/esp_matter/esp_matter_attribute_bounds.cpp +++ b/components/esp_matter/esp_matter_attribute_bounds.cpp @@ -132,12 +132,7 @@ void add_bounds_cb(cluster_t *cluster) } case LevelControl::Attributes::MinLevel::Id: { esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - uint8_t min = 1, max = UINT8_MAX; - if(cluster::get_attribute_value(cluster, LevelControl::Attributes::MaxLevel::Id, - &max_val) == ESP_OK) - { - max = max_val.val.u8; - } + uint8_t min = 1, max = 254; esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); break; } diff --git a/components/esp_matter/esp_matter_cluster.cpp b/components/esp_matter/esp_matter_cluster.cpp index 51d86fd05..06ad2d83b 100644 --- a/components/esp_matter/esp_matter_cluster.cpp +++ b/components/esp_matter/esp_matter_cluster.cpp @@ -201,7 +201,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) } event::create_access_control_entry_changed(cluster); - event::create_access_control_extension_changed(cluster); return cluster; } @@ -729,6 +728,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) /* Attributes managed internally */ global::attribute::create_feature_map(cluster, 0); + attribute::create_unique_id(cluster, NULL, 0); /* Attributes not managed internally */ global::attribute::create_cluster_revision(cluster, cluster_revision); @@ -1619,7 +1619,7 @@ const function_generic_t function_list[] = { }; const int function_flags = CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; -cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features) { cluster_t *cluster = cluster::create(endpoint, LaundryWasherControls::Id, flags); VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, LaundryWasherControls::Id)); @@ -1642,6 +1642,12 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) create_default_binding_cluster(endpoint); } + if (features & feature::spin::get_id()) { + feature::spin::add(cluster, &(config->spin)); + } + if (features & feature::rinse::get_id()) { + feature::rinse::add(cluster, &(config->rinse)); + } return cluster; } } /* laundry_washer_controls */ diff --git a/components/esp_matter/esp_matter_cluster.h b/components/esp_matter/esp_matter_cluster.h index 37b8ab53a..958f1dbeb 100644 --- a/components/esp_matter/esp_matter_cluster.h +++ b/components/esp_matter/esp_matter_cluster.h @@ -480,6 +480,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); namespace laundry_washer_controls { typedef struct config { + feature::spin::config_t spin; + feature::rinse::config_t rinse; void *delegate; config() : delegate(nullptr) {} } config_t; diff --git a/components/esp_matter/esp_matter_command.cpp b/components/esp_matter/esp_matter_command.cpp index 29207f4ad..51707f800 100644 --- a/components/esp_matter/esp_matter_command.cpp +++ b/components/esp_matter/esp_matter_command.cpp @@ -170,6 +170,18 @@ static esp_err_t esp_matter_command_callback_commissioning_complete(const Concre return ESP_OK; } +static esp_err_t esp_matter_command_callback_set_tc_acknowledgements(const ConcreteCommandPath &command_path, + TLVReader &tlv_data, void *opaque_ptr) +{ + chip::app::Clusters::GeneralCommissioning::Commands::SetTCAcknowledgements::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfGeneralCommissioningClusterSetTCAcknowledgementsCallback((CommandHandler *)opaque_ptr, command_path, + command_data); + } + return ESP_OK; +} + static esp_err_t esp_matter_command_callback_open_commissioning_window(const ConcreteCommandPath &command_path, TLVReader &tlv_data, void *opaque_ptr) { @@ -1079,6 +1091,28 @@ static esp_err_t esp_matter_command_callback_unbolt_door(const ConcreteCommandPa 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; +} + static esp_err_t esp_matter_command_callback_setpoint_raise_lower(const ConcreteCommandPath &command_path, TLVReader &tlv_data, void *opaque_ptr) { @@ -1123,6 +1157,28 @@ static esp_err_t esp_matter_command_callback_clear_weekly_schedule(const Concret 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; +} + static esp_err_t esp_matter_command_callback_thread_reset_counts(const ConcreteCommandPath &command_path, TLVReader &tlv_data, void *opaque_ptr) { @@ -1429,6 +1485,26 @@ static esp_err_t esp_matter_command_callback_disable_action_with_duration(const return ESP_OK; } +static esp_err_t esp_matter_command_callback_review_fabric_restrictions(const ConcreteCommandPath &command_path, TLVReader &tlv_data, void *opaque_ptr) +{ + chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictions::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfAccessControlClusterReviewFabricRestrictionsCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_keep_active(const ConcreteCommandPath &command_path, TLVReader &tlv_data, void *opaque_ptr) +{ + chip::app::Clusters::BridgedDeviceBasicInformation::Commands::KeepActive::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfBridgedDeviceBasicInformationClusterKeepActiveCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + 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; @@ -1559,6 +1635,33 @@ 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) +{ + return esp_matter::command::create(cluster, AccessControl::Commands::ReviewFabricRestrictions::Id, COMMAND_FLAG_ACCEPTED, + esp_matter_command_callback_review_fabric_restrictions); +} + +command_t *create_review_fabric_restrictions_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, AccessControl::Commands::ReviewFabricRestrictionsResponse::Id, COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ +} /* access_control */ + +namespace bridged_device_basic_information { +namespace command { +command_t *create_keep_active(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, BridgedDeviceBasicInformation::Commands::KeepActive::Id, COMMAND_FLAG_ACCEPTED, + esp_matter_command_callback_keep_active); +} + +} /* command */ +} /* bridged_device_basic_information */ + namespace thread_network_diagnostics { namespace command { @@ -1783,6 +1886,18 @@ command_t *create_commissioning_complete_response(cluster_t *cluster) COMMAND_FLAG_GENERATED, NULL); } +command_t *create_set_tc_acknowledgements(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GeneralCommissioning::Commands::SetTCAcknowledgements::Id, + COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_tc_acknowledgements); +} + +command_t *create_set_tc_acknowledgements_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, GeneralCommissioning::Commands::SetTCAcknowledgementsResponse::Id, + COMMAND_FLAG_GENERATED, NULL); +} + } /* command */ } /* general_commissioning */ @@ -2580,6 +2695,18 @@ command_t *create_get_weekly_schedule_response(cluster_t *cluster) NULL); } +command_t *create_set_active_schedule_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Thermostat::Commands::SetActiveScheduleRequest::Id, COMMAND_FLAG_ACCEPTED, + esp_matter_command_callback_set_active_schedule_request); +} + +command_t *create_set_active_preset_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, Thermostat::Commands::SetActivePresetRequest::Id, COMMAND_FLAG_ACCEPTED, + esp_matter_command_callback_set_active_preset_request); +} + } /* command */ } /* thermostat */ @@ -2785,6 +2912,18 @@ command_t *create_unbolt_door(cluster_t *cluster) esp_matter_command_callback_unbolt_door); } +command_t *create_set_aliro_reader_config(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, DoorLock::Commands::SetAliroReaderConfig::Id, COMMAND_FLAG_ACCEPTED, + esp_matter_command_callback_set_aliro_reader_config); +} + +command_t *create_clear_aliro_reader_config(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, DoorLock::Commands::ClearAliroReaderConfig::Id, COMMAND_FLAG_ACCEPTED, + esp_matter_command_callback_clear_aliro_reader_config); +} + } /* command */ } /* door_lock */ diff --git a/components/esp_matter/esp_matter_command.h b/components/esp_matter/esp_matter_command.h index 31d519097..91c0d3e8d 100644 --- a/components/esp_matter/esp_matter_command.h +++ b/components/esp_matter/esp_matter_command.h @@ -56,6 +56,19 @@ 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); @@ -114,6 +127,8 @@ 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 */ @@ -279,6 +294,8 @@ command_t *create_set_weekly_schedule(cluster_t *cluster); command_t *create_get_weekly_schedule(cluster_t *cluster); command_t *create_clear_weekly_schedule(cluster_t *cluster); command_t *create_get_weekly_schedule_response(cluster_t *cluster); +command_t *create_set_active_schedule_request(cluster_t *cluster); +command_t *create_set_active_preset_request(cluster_t *cluster); } /* command */ } /* thermostat */ @@ -315,6 +332,9 @@ 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); @@ -325,6 +345,8 @@ 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 */ diff --git a/components/esp_matter/esp_matter_event.cpp b/components/esp_matter/esp_matter_event.cpp index 5c233ddc4..811755703 100644 --- a/components/esp_matter/esp_matter_event.cpp +++ b/components/esp_matter/esp_matter_event.cpp @@ -36,22 +36,22 @@ event_t *create_access_control_extension_changed(cluster_t *cluster) return esp_matter::event::create(cluster, AccessControl::Events::AccessControlExtensionChanged::Id); } -esp_err_t send_state_changed(EndpointId endpoint, uint16_t action_id, uint32_t invoke_id, uint8_t action_state) +event_t *create_fabric_restriction_review_update(cluster_t *cluster) { - /* Not implemented */ - return ESP_OK; + return esp_matter::event::create(cluster, AccessControl::Events::FabricRestrictionReviewUpdate::Id); } - -esp_err_t send_action_failed(EndpointId endpoint, uint16_t action_id, uint32_t invoke_id, uint8_t action_state, - uint8_t error) -{ - /* Not implemented */ - return ESP_OK; -} - } // namespace event } // namespace access_control +namespace bridged_device_basic_information { +namespace event { +event_t *create_active_changed(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, BridgedDeviceBasicInformation::Events::ActiveChanged::Id); +} +} // namespace event +} // namespace bridged_device_basic_information + namespace actions { namespace event { event_t *create_state_changed(cluster_t *cluster) @@ -64,6 +64,19 @@ event_t *create_action_failed(cluster_t *cluster) return esp_matter::event::create(cluster, Actions::Events::ActionFailed::Id); } +esp_err_t send_state_changed(EndpointId endpoint, uint16_t action_id, uint32_t invoke_id, uint8_t action_state) +{ + /* Not implemented */ + return ESP_OK; +} + +esp_err_t send_action_failed(EndpointId endpoint, uint16_t action_id, uint32_t invoke_id, uint8_t action_state, + uint8_t error) +{ + /* Not implemented */ + return ESP_OK; +} + } // namespace event } // namespace actions @@ -769,5 +782,15 @@ 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) +{ + return esp_matter::event::create(cluster, OccupancySensing::Events::OccupancyChanged::Id); +} + +} // namespace event +} // namespace occupancy_sensing + } // namespace cluster } // namespace esp_matter diff --git a/components/esp_matter/esp_matter_event.h b/components/esp_matter/esp_matter_event.h index 90f9e66fe..c566f3861 100644 --- a/components/esp_matter/esp_matter_event.h +++ b/components/esp_matter/esp_matter_event.h @@ -30,6 +30,7 @@ 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 @@ -40,6 +41,12 @@ event_t *create_action_failed(cluster_t *cluster); } // namespace event } // namespace actions +namespace bridged_device_basic_information { +namespace event { +event_t *create_active_changed(cluster_t *cluster); +} // namespace event +} // namespace bridged_device_basic_information + namespace basic_information { namespace event { event_t *create_start_up(cluster_t *cluster); @@ -236,5 +243,11 @@ 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 cluster } // namespace esp_matter diff --git a/components/esp_matter/esp_matter_feature.cpp b/components/esp_matter/esp_matter_feature.cpp index 3ccae2b37..885123fd1 100644 --- a/components/esp_matter/esp_matter_feature.cpp +++ b/components/esp_matter/esp_matter_feature.cpp @@ -79,10 +79,95 @@ esp_err_t add(cluster_t *cluster) } } -namespace administrator_commissioning { - +namespace access_control { namespace feature { +namespace extension { +uint32_t get_id() +{ + return (uint32_t)AccessControl::Feature::kExtension; +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + + /* Attributes managed internally */ + 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 (uint32_t)AccessControl::Feature::kManagedDevice; +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + +#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS + /* Attributes managed internally */ + attribute::create_commissioning_arl(cluster, NULL, 0, 0); + attribute::create_arl(cluster, NULL, 0, 0); +#endif + + command::create_review_fabric_restrictions(cluster); + command::create_review_fabric_restrictions_response(cluster); + + event::create_fabric_restriction_review_update(cluster); + + return ESP_OK; +} +} /* managed_device */ + +} +} /* access_control */ + +namespace bridged_device_basic_information { +namespace feature { +namespace bridged_icd_support { + +uint32_t get_id() +{ + return (uint32_t)BridgedDeviceBasicInformation::Feature::kBridgedICDSupport; +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return 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 */ +} /* bridged_device_basic_information */ + +namespace administrator_commissioning { +namespace feature { namespace basic { uint32_t get_id() @@ -100,12 +185,43 @@ esp_err_t add(cluster_t *cluster) return ESP_OK; } - } /* basic */ } +} /* administrator_commissioning */ + +namespace general_commissioning { +namespace feature { +namespace terms_and_conditions { + +uint32_t get_id() +{ + return (uint32_t)GeneralCommissioning::Feature::kTermsAndConditions; } +esp_err_t add(cluster_t *cluster, config_t *config) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return 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 */ + +} +} /* general_commissioning */ + namespace power_source { namespace feature { namespace wired { @@ -118,6 +234,11 @@ uint32_t get_id() esp_err_t add(cluster_t *cluster, config_t *config) { VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + uint32_t battery_feature_map = feature::battery::get_id(); + if ((get_feature_map_value(cluster) & battery_feature_map) == battery_feature_map) { + ESP_LOGE(TAG, "Cluster already supports Battery feature"); + return ESP_ERR_NOT_SUPPORTED; + } update_feature_map(cluster, get_id()); /* Attributes not managed internally */ @@ -138,6 +259,11 @@ uint32_t get_id() esp_err_t add(cluster_t *cluster, config_t *config) { VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + uint32_t wired_feature_map = feature::wired::get_id(); + if ((get_feature_map_value(cluster) & wired_feature_map) == wired_feature_map) { + ESP_LOGE(TAG, "Cluster already supports Wired feature"); + return ESP_ERR_NOT_SUPPORTED; + } update_feature_map(cluster, get_id()); /* Attributes not managed internally */ @@ -2332,6 +2458,7 @@ uint32_t get_id() esp_err_t add(cluster_t *cluster, config_t *config) { VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + update_feature_map(cluster, get_id()); attribute::create_spin_speed_current(cluster, config->spin_speed_current); @@ -2351,6 +2478,7 @@ uint32_t get_id() esp_err_t add(cluster_t *cluster, config_t *config) { VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + update_feature_map(cluster, get_id()); attribute::create_number_of_rinses(cluster, config->number_of_rinses); @@ -2571,6 +2699,59 @@ esp_err_t add(cluster_t *cluster, config_t *config) } } /* local_temperature_not_exposed */ +namespace matter_schedule_configuration { + +uint32_t get_id() +{ + return (uint32_t)Thermostat::Feature::kMatterScheduleConfiguration; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + + attribute::create_schedule_type(cluster, NULL, 0, 0); + 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_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 (uint32_t)Thermostat::Feature::kPresets; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + + /* Attributes managed internally */ + attribute::create_preset_type(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 */ } /* thermostat */ @@ -3759,6 +3940,61 @@ esp_err_t add(cluster_t *cluster) } /* unbolting */ +namespace aliro_provisioning { + +uint32_t get_id() +{ + return (uint32_t)DoorLock::Feature::kAliroProvisioning; +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + + /* Attributes managed internally */ + 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); + + /* Commands */ + 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 (uint32_t)DoorLock::Feature::kAliroBLEUWB; +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + + /* Attributes managed internally */ + 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 */ } /* door_lock */ @@ -4338,7 +4574,6 @@ esp_err_t add(cluster_t *cluster, config_t *config) return ESP_ERR_INVALID_ARG; } update_feature_map(cluster, get_id()); - attribute::create_energy_balances(cluster, NULL, 0, 0); attribute::create_current_energy_balance(cluster, config->current_energy_balance); attribute::create_energy_priorities(cluster, NULL, 0, 0); @@ -4372,5 +4607,155 @@ esp_err_t add(cluster_t *cluster, config_t *config) } /* feature */ } /* energy_preference */ +namespace occupancy_sensing { +namespace feature { + +namespace other { + +uint32_t get_id() +{ + return static_cast(OccupancySensing::Feature::kOther); +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + return ESP_OK; +} +} /* other */ + +namespace passive_infrared { + +uint32_t get_id() +{ + return static_cast(OccupancySensing::Feature::kPassiveInfrared); +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + return ESP_OK; +} +} /* passive_infrared */ + +namespace ultrasonic { + +uint32_t get_id() +{ + return static_cast(OccupancySensing::Feature::kUltrasonic); +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + return ESP_OK; +} +} /* ultrasonic */ + +namespace physical_contact { + +uint32_t get_id() +{ + return static_cast(OccupancySensing::Feature::kPhysicalContact); +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + return ESP_OK; +} +} /* physical_contact */ + +namespace active_infrared { + +uint32_t get_id() +{ + return static_cast(OccupancySensing::Feature::kActiveInfrared); +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + return ESP_OK; +} +} /* active_infrared */ + +namespace radar { + +uint32_t get_id() +{ + return static_cast(OccupancySensing::Feature::kRadar); +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + return ESP_OK; +} +} /* radar */ + +namespace rf_sensing { + +uint32_t get_id() +{ + return static_cast(OccupancySensing::Feature::kRFSensing); +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + + return ESP_OK; +} +} /* rf_sensing */ + +namespace vision { + +uint32_t get_id() +{ + return static_cast(OccupancySensing::Feature::kVision); +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + return ESP_OK; +} +} /* vision */ + +} /* feature */ +} /* occupancy_sensing */ } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/esp_matter_feature.h b/components/esp_matter/esp_matter_feature.h index 4772b7ad6..3680e2e92 100644 --- a/components/esp_matter/esp_matter_feature.h +++ b/components/esp_matter/esp_matter_feature.h @@ -43,6 +43,37 @@ esp_err_t add(cluster_t *cluster); } /* 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 { @@ -57,6 +88,25 @@ esp_err_t add(cluster_t *cluster); } /* feature */ } /* administrator_commissioning */ +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 */ +} /* general_commissioning */ + namespace power_source { namespace feature { namespace wired { @@ -572,6 +622,27 @@ 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 */ @@ -1863,12 +1934,6 @@ uint32_t get_id(); esp_err_t add(cluster_t *cluster); } /* finger_credentials */ -namespace logging { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* logging */ - namespace weekday_access_schedules { uint32_t get_id(); @@ -1910,12 +1975,6 @@ uint32_t get_id(); esp_err_t add(cluster_t *cluster, config_t *config); } /* user */ -namespace notification { - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster); -} /* notification */ - namespace year_day_access_schedules { uint32_t get_id(); @@ -1940,6 +1999,18 @@ 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 */ @@ -2177,5 +2248,58 @@ esp_err_t add(cluster_t *cluster, config_t *config); } /* feature */ } /* energy_preference */ +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 */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/private/esp_matter_cluster_revisions.h b/components/esp_matter/private/esp_matter_cluster_revisions.h index e347135f0..c76e4679c 100644 --- a/components/esp_matter/private/esp_matter_cluster_revisions.h +++ b/components/esp_matter/private/esp_matter_cluster_revisions.h @@ -28,11 +28,11 @@ constexpr uint16_t cluster_revision = 1; } // namespace actions namespace access_control { -constexpr uint16_t cluster_revision = 1; +constexpr uint16_t cluster_revision = 2; } // namespace access_control namespace basic_information { -constexpr uint16_t cluster_revision = 3; +constexpr uint16_t cluster_revision = 4; } // namespace basic_information namespace binding { @@ -48,7 +48,7 @@ constexpr uint16_t cluster_revision = 1; } // namespace ota_requestor namespace general_commissioning { -constexpr uint16_t cluster_revision = 1; +constexpr uint16_t cluster_revision = 2; } // namespace general_commissioning namespace network_commissioning { @@ -84,7 +84,7 @@ constexpr uint16_t cluster_revision = 1; } // namespace wifi_network_diagnotics namespace thread_network_diagnostics { -constexpr uint16_t cluster_revision = 2; +constexpr uint16_t cluster_revision = 3; } // namespace thread_network_diagnostics namespace ethernet_network_diagnostics { @@ -100,11 +100,11 @@ constexpr uint16_t cluster_revision = 1; } // namespace unit_localization namespace bridged_device_basic_information { -constexpr uint16_t cluster_revision = 2; +constexpr uint16_t cluster_revision = 4; } // namespace bridged_device_basic_information namespace power_source { -constexpr uint16_t cluster_revision = 2; +constexpr uint16_t cluster_revision = 3; } // namespace power_source namespace icd_management { @@ -120,7 +120,7 @@ constexpr uint16_t cluster_revision = 1; } // namespace fixed_label namespace identify { -constexpr uint16_t cluster_revision = 4; +constexpr uint16_t cluster_revision = 5; } // namespace identify namespace groups { @@ -136,11 +136,11 @@ constexpr uint16_t cluster_revision = 6; } // namespace on_off namespace level_control { -constexpr uint16_t cluster_revision = 5; +constexpr uint16_t cluster_revision = 6; } // namespace level_control namespace color_control { -constexpr uint16_t cluster_revision = 6; +constexpr uint16_t cluster_revision = 7; } // namespace color_control namespace fan_control { @@ -148,7 +148,7 @@ constexpr uint16_t cluster_revision = 4; } // namespace fan_control namespace thermostat { -constexpr uint16_t cluster_revision = 6; +constexpr uint16_t cluster_revision = 8; } // namespace thermostat namespace thermostat_user_interface_configuration { @@ -212,11 +212,11 @@ constexpr uint16_t cluster_revision = 2; } // namespace operational_state namespace laundry_washer_mode { -constexpr uint16_t cluster_revision = 1; +constexpr uint16_t cluster_revision = 3; } // namespace laundry_washer_mode namespace laundry_washer_controls { -constexpr uint16_t cluster_revision = 1; +constexpr uint16_t cluster_revision = 2; } // namespace laundry_washer_controls namespace laundry_dryer_controls { @@ -224,7 +224,7 @@ constexpr uint16_t cluster_revision = 1; } // namespace laundry_dryer_controls namespace dish_washer_mode { -constexpr uint16_t cluster_revision = 1; +constexpr uint16_t cluster_revision = 3; } // namespace dish_washer_mode namespace dish_washer_alarm { @@ -236,7 +236,7 @@ constexpr uint16_t cluster_revision = 1; } // namespace smoke_co_alarm namespace door_lock { -constexpr uint16_t cluster_revision = 7; +constexpr uint16_t cluster_revision = 8; } // namespace door_lock namespace window_covering { @@ -244,7 +244,7 @@ constexpr uint16_t cluster_revision = 5; } // namespace window_covering namespace switch_cluster { -constexpr uint16_t cluster_revision = 1; +constexpr uint16_t cluster_revision = 2; } // namespace switch_cluster namespace temperature_measurement { @@ -256,7 +256,7 @@ constexpr uint16_t cluster_revision = 3; } // namespace relative_humidity_measurement namespace occupancy_sensing { -constexpr uint16_t cluster_revision = 4; +constexpr uint16_t cluster_revision = 5; } // namespace occupancy_sensing namespace boolean_state { @@ -304,15 +304,15 @@ constexpr uint16_t cluster_revision = 1; } // namespace refrigerator_alarm namespace refrigerator_and_tcc_mode { -constexpr uint16_t cluster_revision = 1; +constexpr uint16_t cluster_revision = 3; } // namespace refrigerator_and_tcc_mode namespace rvc_run_mode { -constexpr uint16_t cluster_revision = 1; +constexpr uint16_t cluster_revision = 3; } // namespace rvc_run_mode namespace rvc_clean_mode { -constexpr uint16_t cluster_revision = 1; +constexpr uint16_t cluster_revision = 3; } // namespace rvc_clean_mode namespace water_heater_mode { @@ -328,7 +328,7 @@ constexpr uint16_t cluster_revision = 1; } // namespace microwave_oven_control namespace rvc_operational_state { -constexpr uint16_t cluster_revision = 1; +constexpr uint16_t cluster_revision = 2; } // namespace rvc_operational_state namespace keypad_input { @@ -348,11 +348,11 @@ constexpr uint16_t cluster_revision = 1; } // namespace electrical_energy_measurement namespace energy_evse_mode { -constexpr uint16_t cluster_revision = 1; +constexpr uint16_t cluster_revision = 2; } // namespace energy_evse_mode namespace energy_evse { -constexpr uint16_t cluster_revision = 1; +constexpr uint16_t cluster_revision = 3; } // namespace energy_evse namespace valve_configuration_and_control { @@ -364,7 +364,7 @@ constexpr uint16_t cluster_revision = 4; } // namespace device_energy_management namespace device_energy_management_mode { -constexpr uint16_t cluster_revision = 1; +constexpr uint16_t cluster_revision = 2; } // namespace device_energy_management_mode namespace application_basic {