diff --git a/components/esp_matter/data_model/esp_matter_cluster.cpp b/components/esp_matter/data_model/esp_matter_cluster.cpp index a3a24018a..014e10ae3 100644 --- a/components/esp_matter/data_model/esp_matter_cluster.cpp +++ b/components/esp_matter/data_model/esp_matter_cluster.cpp @@ -2011,10 +2011,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) feature::position_aware_tilt::add(cluster, &(config->features.position_aware_tilt)); } } - // optional if absolute position is supported - if (has(feature::absolute_position::get_id())) { - feature::absolute_position::add(cluster, &(config->features.absolute_position)); - } } if (flags & CLUSTER_FLAG_CLIENT) { @@ -2902,23 +2898,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) global::attribute::create_cluster_revision(cluster, cluster_revision); /* Attributes managed internally */ - global::attribute::create_feature_map(cluster, config->feature_flags); - - // check against O.a feature conformance for microwave oven control - VALIDATE_FEATURES_EXACT_ONE("PowerAsNumber,PowerInWatts", - feature::power_as_number::get_id(), feature::power_in_watts::get_id()); - - if (has(feature::power_as_number::get_id())) { - feature::power_as_number::add(cluster); - - // power number limits optionally depends on power as number - if (has(feature::power_number_limits::get_id())) { - feature::power_number_limits::add(cluster); - } - } - if (has(feature::power_in_watts::get_id())) { - feature::power_in_watts::add(cluster); - } + global::attribute::create_feature_map(cluster, 0); } // if (flags & CLUSTER_FLAG_SERVER) /* Commands */ diff --git a/components/esp_matter/data_model/esp_matter_cluster.h b/components/esp_matter/data_model/esp_matter_cluster.h index 13f693ed9..c42d3158e 100644 --- a/components/esp_matter/data_model/esp_matter_cluster.h +++ b/components/esp_matter/data_model/esp_matter_cluster.h @@ -538,7 +538,6 @@ typedef struct config { feature::lift::config_t lift; feature::tilt::config_t tilt; feature::position_aware_lift::config_t position_aware_lift; - feature::absolute_position::config_t absolute_position; feature::position_aware_tilt::config_t position_aware_tilt; } features; uint32_t feature_flags; @@ -777,9 +776,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); namespace microwave_oven_control { typedef struct config { - uint32_t feature_flags; void *delegate; - config() : feature_flags(0), delegate(nullptr) {} + config() : delegate(nullptr) {} } config_t; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); diff --git a/components/esp_matter/data_model/esp_matter_feature.cpp b/components/esp_matter/data_model/esp_matter_feature.cpp index fb1d1a13c..c25cfadca 100644 --- a/components/esp_matter/data_model/esp_matter_feature.cpp +++ b/components/esp_matter/data_model/esp_matter_feature.cpp @@ -543,29 +543,6 @@ esp_err_t add(cluster_t *cluster, config_t *config) } /* lighting */ -namespace frequency { - -uint32_t get_id() -{ - return (uint32_t)LevelControl::Feature::kFrequency; -} - -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()); - - /* Attributes not managed internally */ - attribute::create_current_frequency(cluster, config->current_frequency); - attribute::create_min_frequency(cluster, config->min_frequency); - attribute::create_max_frequency(cluster, config->max_frequency); - - /* Commands */ - command::create_move_to_closest_frequency(cluster); - - return ESP_OK; -} -} /* frequency */ } /* feature */ } /* level_control */ @@ -822,66 +799,6 @@ esp_err_t add(cluster_t *cluster, config_t *config) } } /* position_aware_lift */ -namespace absolute_position { - -uint32_t get_id() -{ - return (uint32_t)WindowCovering::Feature::kAbsolutePosition; -} - -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()); - - uint32_t abs_and_pa_lf_and_lf_feature_map = get_id() | feature::position_aware_lift::get_id() | feature::lift::get_id(); - uint32_t abs_and_pa_tl_and_tl_feature_map = get_id() | feature::position_aware_tilt::get_id() | feature::tilt::get_id(); - uint32_t abs_and_lift_feature_map = get_id() | feature::lift::get_id(); - uint32_t abs_and_tilt_feature_map = get_id() | feature::tilt::get_id(); - if ( - (get_feature_map_value(cluster) & abs_and_pa_lf_and_lf_feature_map) != abs_and_pa_lf_and_lf_feature_map - && (get_feature_map_value(cluster) & abs_and_pa_tl_and_tl_feature_map) != abs_and_pa_tl_and_tl_feature_map - && (get_feature_map_value(cluster) & abs_and_lift_feature_map) != abs_and_lift_feature_map - && (get_feature_map_value(cluster) & abs_and_tilt_feature_map) != abs_and_tilt_feature_map - ) { - ESP_LOGE(TAG, "Cluster shall support Lift (and optionally Position_Aware_Lift) and/or Tilt (and optionally Position_Aware_Tilt) features"); - return ESP_ERR_NOT_SUPPORTED; - } - if ((get_feature_map_value(cluster) & abs_and_pa_lf_and_lf_feature_map) == abs_and_pa_lf_and_lf_feature_map) { - attribute::create_physical_closed_limit_lift(cluster, config->physical_closed_limit_lift); - attribute::create_current_position_lift(cluster, config->current_position_lift); - attribute::create_installed_open_limit_lift(cluster, config->installed_open_limit_lift); - attribute::create_installed_closed_limit_lift(cluster, config->installed_closed_limit_lift); - } else { - ESP_LOGW(TAG, "Lift related attributes were not created because cluster does not support Position_Aware_Lift feature"); - } - - if ((get_feature_map_value(cluster) & abs_and_pa_tl_and_tl_feature_map) == abs_and_pa_tl_and_tl_feature_map) { - attribute::create_physical_closed_limit_tilt(cluster, config->physical_closed_limit_tilt); - attribute::create_current_position_tilt(cluster, config->current_position_tilt); - attribute::create_installed_open_limit_tilt(cluster, config->installed_open_limit_tilt); - attribute::create_installed_closed_limit_tilt(cluster, config->installed_closed_limit_tilt); - } else { - ESP_LOGW(TAG, "Tilt related attributes were not created because cluster does not support Position_Aware_Tilt feature"); - } - - if ((get_feature_map_value(cluster) & abs_and_lift_feature_map) == abs_and_lift_feature_map) { - command::create_go_to_lift_value(cluster); - } else { - ESP_LOGW(TAG, "Lift commands were not created because cluster does not support Lift feature"); - } - - if ((get_feature_map_value(cluster) & abs_and_tilt_feature_map) == abs_and_tilt_feature_map) { - command::create_go_to_tilt_value(cluster); - } else { - ESP_LOGW(TAG, "Tilt commands were not created because cluster does not support Tilt feature"); - } - - return ESP_OK; -} - -} /* absolute_position */ - namespace position_aware_tilt { uint32_t get_id() @@ -2634,30 +2551,6 @@ esp_err_t add(cluster_t *cluster, config_t *config) } /* rfid_credential */ -namespace finger_credentials { - -uint32_t get_id() -{ - return (uint32_t)DoorLock::Feature::kFingerCredentials; -} - -esp_err_t add(cluster_t *cluster) -{ - VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); - update_feature_map(cluster, get_id()); - - uint32_t usr_feature_map = feature::user::get_id(); - if (!(get_feature_map_value(cluster) & usr_feature_map)) { - /* todo: some commands for !USR & FGP feature not define in the - connectedhomeip/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h - will update when added*/ - } - - return ESP_OK; -} - -} /* finger_credentials */ - namespace logging { uint32_t get_id() @@ -2734,23 +2627,6 @@ esp_err_t add(cluster_t *cluster) } /* door_position_sensor */ -namespace face_credentials { - -uint32_t get_id() -{ - return (uint32_t)DoorLock::Feature::kFaceCredentials; -} - -esp_err_t add(cluster_t *cluster) -{ - VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); - update_feature_map(cluster, get_id()); - - return ESP_OK; -} - -} /* face_credentials */ - namespace credential_over_the_air_access { uint32_t get_id() @@ -2786,10 +2662,8 @@ 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 pin = feature::pin_credential::get_id(); uint32_t rid = feature::rfid_credential::get_id(); - uint32_t fgp = feature::finger_credentials::get_id(); - uint32_t face = feature::face_credentials::get_id(); uint32_t feature = get_feature_map_value(cluster); - VerifyOrReturnError((feature & (pin | rid | fgp | face)) != 0, ESP_FAIL, ESP_LOGE(TAG, "Should add at least one of PIN, RID, FGP and FACE feature before add USR feature")); + VerifyOrReturnError((feature & (pin | rid)) != 0, ESP_FAIL, ESP_LOGE(TAG, "Should add at least one of PIN, RID feature before add USR feature")); update_feature_map(cluster, get_id()); @@ -2995,46 +2869,6 @@ esp_err_t add(cluster_t *cluster) } /* charging_preferences */ -namespace soc_reporting { - -uint32_t get_id() -{ - return (uint32_t)EnergyEvse::Feature::kSoCReporting; -} - -esp_err_t add(cluster_t *cluster) -{ - VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); - update_feature_map(cluster, get_id()); - - /* Attributes managed internally */ - attribute::create_state_of_charge(cluster, 0); - attribute::create_battery_capacity(cluster, 0); - - return ESP_OK; -} - -} /* soc_reporting */ - -namespace plug_and_charge { - -uint32_t get_id() -{ - return (uint32_t)EnergyEvse::Feature::kPlugAndCharge; -} - -esp_err_t add(cluster_t *cluster) -{ - VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); - update_feature_map(cluster, get_id()); - - /* Attributes managed internally */ - attribute::create_vehicle_id(cluster, NULL, 0); - - return ESP_OK; -} - -} /* plug_and_charge */ namespace rfid { @@ -3053,30 +2887,6 @@ esp_err_t add(cluster_t *cluster) } /* rfid */ -namespace v2x { - -uint32_t get_id() -{ - return (uint32_t)EnergyEvse::Feature::kV2x; -} - -esp_err_t add(cluster_t *cluster) -{ - VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); - update_feature_map(cluster, get_id()); - - /* Attributes managed internally */ - attribute::create_discharging_enabled_until(cluster, 0); - attribute::create_maximum_discharge_current(cluster, 0); - attribute::create_session_energy_discharged(cluster, 0); - - /* Commands */ - command::create_enable_discharging(cluster); - return ESP_OK; -} - -} /* v2x*/ - } /* feature */ } /* energy_evse */ @@ -3093,45 +2903,14 @@ uint32_t get_id() esp_err_t add(cluster_t *cluster) { VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); - uint32_t power_in_watts_feature_map = feature::power_in_watts::get_id(); - if ((get_feature_map_value(cluster) & power_in_watts_feature_map) != power_in_watts_feature_map) { - update_feature_map(cluster, get_id()); - /* Attributes managed internally */ - attribute::create_power_setting(cluster, 0); - } else { - ESP_LOGE(TAG, "Cluster shall support either PowerAsNumber or PowerInWatts feature"); - return ESP_ERR_NOT_SUPPORTED; - } + update_feature_map(cluster, get_id()); + /* Attributes managed internally */ + attribute::create_power_setting(cluster, 0); return ESP_OK; } } /* power_as_number */ -namespace power_in_watts { - -uint32_t get_id() -{ - return (uint32_t)MicrowaveOvenControl::Feature::kPowerInWatts; -} - -esp_err_t add(cluster_t *cluster) -{ - VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); - uint32_t power_as_number_feature_map = feature::power_as_number::get_id(); - if ((get_feature_map_value(cluster) & power_as_number_feature_map) != power_as_number_feature_map) { - update_feature_map(cluster, get_id()); - /* Attributes managed internally */ - attribute::create_supported_watts(cluster, NULL, 0, 0); - attribute::create_selected_watt_index(cluster, 0); - } else { - ESP_LOGE(TAG, "Cluster shall support either PowerInWatts or PowerAsNumber feature"); - return ESP_ERR_NOT_SUPPORTED; - } - - return ESP_OK; -} -} /* power_in_watts */ - namespace power_number_limits { uint32_t get_id() diff --git a/components/esp_matter/data_model/esp_matter_feature.h b/components/esp_matter/data_model/esp_matter_feature.h index 1b5382a24..0455b669e 100644 --- a/components/esp_matter/data_model/esp_matter_feature.h +++ b/components/esp_matter/data_model/esp_matter_feature.h @@ -265,18 +265,6 @@ 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 */ @@ -407,28 +395,6 @@ esp_err_t add(cluster_t *cluster, config_t *config); } /* position_aware_lift */ -// Attributes of AbsolutePosition feature may have dependency on LF, TL, PA_LF, PA_TL -// feature, one must add features according to the usecase first. - -namespace absolute_position { - -typedef struct config { - uint16_t physical_closed_limit_lift; - nullable current_position_lift; - uint16_t installed_open_limit_lift; - uint16_t installed_closed_limit_lift; - uint16_t physical_closed_limit_tilt; - nullable current_position_tilt; - uint16_t installed_open_limit_tilt; - uint16_t installed_closed_limit_tilt; - config() : physical_closed_limit_lift(0), current_position_lift(), installed_open_limit_lift(0), installed_closed_limit_lift(65534), physical_closed_limit_tilt(0), current_position_tilt(), installed_open_limit_tilt(0), installed_closed_limit_tilt(65534) {} -} config_t; - -uint32_t get_id(); -esp_err_t add(cluster_t *cluster, config_t *config); - -} /* absolute_position */ - // PositionAwareTilt feature is dependent on Tilt feature, in order to add // PositionAwareTilt feature one must add Tilt feature first. @@ -1333,12 +1299,6 @@ 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(); @@ -1351,12 +1311,6 @@ 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; @@ -1422,20 +1376,6 @@ 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(); @@ -1443,13 +1383,6 @@ 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 */ @@ -1462,12 +1395,6 @@ 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(); 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 69deb7913..af46fc663 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 @@ -292,7 +292,6 @@ int create(uint8_t device_type_index) endpoint = esp_matter::endpoint::window_covering_device::create(node, &window_covering_device_config, ENDPOINT_FLAG_NONE, NULL); cluster_t *cluster = cluster::get(endpoint, chip::app::Clusters::WindowCovering::Id); cluster::window_covering::feature::position_aware_lift::config_t position_aware_lift; - cluster::window_covering::feature::absolute_position::config_t absolute_position; nullable percentage = nullable(0); nullable percentage_100ths = nullable(0); @@ -301,7 +300,6 @@ int create(uint8_t device_type_index) position_aware_lift.current_position_lift_percent_100ths = percentage_100ths; cluster::window_covering::feature::position_aware_lift::add(cluster, &position_aware_lift); - cluster::window_covering::feature::absolute_position::add(cluster, &absolute_position); break; } case ESP_MATTER_TEMP_SENSOR: {