mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
components/esp-matter: added attribute::get_val_type() API
This works for both base attributes i.e. managed internally as well as esp-matter managed attributes as well.
This commit is contained in:
@@ -737,6 +737,18 @@ esp_err_t get_val(attribute_t *attribute, esp_matter_attr_val_t *val)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_matter_val_type_t get_val_type(attribute_t *attribute)
|
||||
{
|
||||
VerifyOrReturnValue(attribute, ESP_MATTER_VAL_TYPE_INVALID, ESP_LOGE(TAG, "Attribute cannot be NULL"));
|
||||
_attribute_t *current_attribute = (_attribute_t *)attribute;
|
||||
return current_attribute->attribute_val_type;
|
||||
}
|
||||
|
||||
esp_matter_val_type_t get_val_type(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id)
|
||||
{
|
||||
return get_val_type(get(endpoint_id, cluster_id, attribute_id));
|
||||
}
|
||||
|
||||
esp_err_t add_bounds(attribute_t *attribute, esp_matter_attr_val_t min, esp_matter_attr_val_t max)
|
||||
{
|
||||
VerifyOrReturnError(attribute, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Attribute cannot be NULL"));
|
||||
|
||||
@@ -912,6 +912,26 @@ esp_err_t set_val(attribute_t *attribute, esp_matter_attr_val_t *val, bool call_
|
||||
*/
|
||||
esp_err_t get_val(attribute_t *attribute, esp_matter_attr_val_t *val);
|
||||
|
||||
/** Get the attribute value type for the given attribute handle.
|
||||
*
|
||||
* @param[in] attribute Attribute handle.
|
||||
*
|
||||
* @return Attribute value type on success.
|
||||
* @return ESP_MATTER_VAL_TYPE_INVALID, i.e. 0, in case of failure.
|
||||
*/
|
||||
esp_matter_val_type_t get_val_type(attribute_t *attribute);
|
||||
|
||||
/** Get the attribute value type for the given endpoint, cluster and attribute id.
|
||||
*
|
||||
* @param[in] endpoint_id Endpoint id.
|
||||
* @param[in] cluster_id Cluster id.
|
||||
* @param[in] attribute_id Attribute id.
|
||||
*
|
||||
* @return Attribute value type on success.
|
||||
* @return ESP_MATTER_VAL_TYPE_INVALID, i.e. 0, in case of failure.
|
||||
*/
|
||||
esp_matter_val_type_t get_val_type(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id);
|
||||
|
||||
/** Add attribute bounds
|
||||
*
|
||||
* Add bounds to the attribute (has `ATTRIBUTE_FLAG_EXTERNAL_STORAGE` flag). Bounds cannot be added to string/array type attributes.
|
||||
|
||||
Reference in New Issue
Block a user