components/esp-matter: Update feature checks on switch cluster and update documentation.

This commit is contained in:
Rohit Jadhav
2024-12-20 12:02:11 +05:30
parent 2e0eaf66a5
commit dbddd5bb51
2 changed files with 8 additions and 11 deletions
@@ -2802,7 +2802,6 @@ uint32_t get_id()
esp_err_t add(cluster_t *cluster)
{
VerifyOrReturnError((get_feature_map_value(cluster) & feature::momentary_switch::get_id()) == feature::momentary_switch::get_id(), ESP_ERR_NOT_SUPPORTED, ESP_LOGE(TAG, "Momentary switch release is not supported because momentary is absent"));
uint32_t as_feature_map = feature::action_switch::get_id();
uint32_t ms_feature_map = feature::momentary_switch::get_id();
uint32_t feature_map = get_feature_map_value(cluster);
@@ -2824,8 +2823,6 @@ uint32_t get_id()
esp_err_t add(cluster_t *cluster)
{
uint32_t momentary_and_momentart_switch_release_feature_map = feature::momentary_switch::get_id() | feature::momentary_switch_release::get_id();
VerifyOrReturnError((get_feature_map_value(cluster) & momentary_and_momentart_switch_release_feature_map) == momentary_and_momentart_switch_release_feature_map, ESP_ERR_NOT_SUPPORTED, ESP_LOGE(TAG, "Momentary switch long press is not supported because momentary switch and/or momentary switch release is absent"));
uint32_t msr_feature_map = feature::momentary_switch_release::get_id();
uint32_t as_feature_map = feature::action_switch::get_id();
uint32_t ms_feature_map = feature::momentary_switch::get_id();
@@ -2850,10 +2847,7 @@ uint32_t get_id()
esp_err_t add(cluster_t *cluster, config_t *config)
{
uint32_t momentary_and_momentart_switch_release_feature_map = feature::momentary_switch::get_id() | feature::momentary_switch_release::get_id();
VerifyOrReturnError((get_feature_map_value(cluster) & momentary_and_momentart_switch_release_feature_map) == momentary_and_momentart_switch_release_feature_map, ESP_ERR_NOT_SUPPORTED, ESP_LOGE(TAG, "Momentary switch multi press is not supported because momentary switch and/or momentary switch releaseis absent"));
uint32_t as_feature_map = feature::action_switch::get_id();
VerifyOrReturnError((get_feature_map_value(cluster) & as_feature_map) != as_feature_map, ESP_ERR_NOT_SUPPORTED, ESP_LOGE(TAG, "Momentary switch multi press is not supported because action switch is absent"));
uint32_t ms_feature_map = feature::momentary_switch::get_id();
uint32_t msr_feature_map = feature::momentary_switch_release::get_id();
uint32_t ms_and_msr = ms_feature_map | msr_feature_map;
+8 -5
View File
@@ -1503,7 +1503,7 @@ esp_err_t add(cluster_t *cluster);
} /* momentary_switch */
// MomentarySwitchRelease feature is dependent on MomentarySwitch feature, in order to add
// 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 {
@@ -1513,8 +1513,8 @@ esp_err_t add(cluster_t *cluster);
} /* momentary_switch_release */
// MomentarySwitchRelease feature is dependent on MomentarySwitch and MomentarySwitchRelease feature, in order to add
// MomentarySwitchRelease feature one must add MomentarySwitch and MomentarySwitchRelease feature first.
// 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 {
@@ -1523,8 +1523,8 @@ esp_err_t add(cluster_t *cluster);
} /* momentary_switch_long_press */
// MomentarySwitchRelease feature is dependent on MomentarySwitch and MomentarySwitchRelease feature, in order to add
// MomentarySwitchRelease feature one must add MomentarySwitch and MomentarySwitchRelease feature first.
// 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 {
@@ -1538,6 +1538,9 @@ 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();