diff --git a/components/esp_matter/data_model/esp_matter_attribute.cpp b/components/esp_matter/data_model/esp_matter_attribute.cpp index de58f552c..c0eb9d65e 100644 --- a/components/esp_matter/data_model/esp_matter_attribute.cpp +++ b/components/esp_matter/data_model/esp_matter_attribute.cpp @@ -5065,5 +5065,71 @@ attribute_t *create_latch_control_modes(cluster_t *cluster, uint8_t value) } /* 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) +{ + return esp_matter::attribute::create(cluster, CameraAvSettingsUserLevelManagement::Attributes::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) +{ + return esp_matter::attribute::create(cluster, CameraAvSettingsUserLevelManagement::Attributes::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) +{ + return esp_matter::attribute::create(cluster, CameraAvSettingsUserLevelManagement::Attributes::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) +{ + return esp_matter::attribute::create(cluster, CameraAvSettingsUserLevelManagement::Attributes::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) +{ + return esp_matter::attribute::create(cluster, CameraAvSettingsUserLevelManagement::Attributes::ZoomMax::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value)); +} + +attribute_t *create_tilt_min(cluster_t *cluster, int16_t value) +{ + return esp_matter::attribute::create(cluster, CameraAvSettingsUserLevelManagement::Attributes::TiltMin::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_int16(value)); +} + +attribute_t *create_tilt_max(cluster_t *cluster, int16_t value) +{ + return esp_matter::attribute::create(cluster, CameraAvSettingsUserLevelManagement::Attributes::TiltMax::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_int16(value)); +} + +attribute_t *create_pan_min(cluster_t *cluster, int16_t value) +{ + return esp_matter::attribute::create(cluster, CameraAvSettingsUserLevelManagement::Attributes::PanMin::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_int16(value)); +} + +attribute_t *create_pan_max(cluster_t *cluster, int16_t value) +{ + return esp_matter::attribute::create(cluster, CameraAvSettingsUserLevelManagement::Attributes::PanMax::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_int16(value)); +} + +attribute_t *create_movement_state(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, CameraAvSettingsUserLevelManagement::Attributes::MovementState::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value)); +} + +} /* attribute */ + +} /* camera_av_settings_user_level_management */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_attribute.h b/components/esp_matter/data_model/esp_matter_attribute.h index 10132fb0a..e1684d291 100644 --- a/components/esp_matter/data_model/esp_matter_attribute.h +++ b/components/esp_matter/data_model/esp_matter_attribute.h @@ -1309,5 +1309,21 @@ 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 */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp b/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp index dda319912..6a064b696 100644 --- a/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp +++ b/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp @@ -673,5 +673,46 @@ void add_bounds_cb(cluster_t *cluster) } /* thermostat_user_interface_configuration */ +namespace camera_av_settings_user_level_management { + +void add_bounds_cb(cluster_t *cluster) +{ + VerifyOrReturn(cluster != nullptr, ESP_LOGE(TAG, "Cluster is NULL. Add bounds Failed!!")); + attribute_t *current_attribute = esp_matter::attribute::get_first(cluster); + VerifyOrReturn(current_attribute != nullptr, ESP_LOGE(TAG, "Attribute is NULL.")); + while(current_attribute) { + switch(esp_matter::attribute::get_id(current_attribute)) { + case CameraAvSettingsUserLevelManagement::Attributes::ZoomMax::Id: { + uint8_t min = 2, max = 100; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); + break; + } + case CameraAvSettingsUserLevelManagement::Attributes::TiltMin::Id: { + int16_t min = -180, max = 179; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + case CameraAvSettingsUserLevelManagement::Attributes::TiltMax::Id: { + int16_t min = -179, max = 180; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + case CameraAvSettingsUserLevelManagement::Attributes::PanMin::Id: { + int16_t min = -180, max = 179; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + case CameraAvSettingsUserLevelManagement::Attributes::PanMax::Id: { + int16_t min = -179, max = 180; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + default: + break; + } + current_attribute = esp_matter::attribute::get_next(current_attribute); + } +} +} /* camera_av_settings_user_level_management */ } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_attribute_bounds.h b/components/esp_matter/data_model/esp_matter_attribute_bounds.h index 0244f24be..215b2b994 100644 --- a/components/esp_matter/data_model/esp_matter_attribute_bounds.h +++ b/components/esp_matter/data_model/esp_matter_attribute_bounds.h @@ -46,5 +46,8 @@ namespace thermostat_user_interface_configuration { void add_bounds_cb(cluster_t *cluster); } /* thermostat_user_interface_configuration */ +namespace camera_av_settings_user_level_management { +void add_bounds_cb(cluster_t *cluster); +} /* camera_av_settings_user_level_management */ } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_cluster.cpp b/components/esp_matter/data_model/esp_matter_cluster.cpp index df050082f..e236ba6a3 100644 --- a/components/esp_matter/data_model/esp_matter_cluster.cpp +++ b/components/esp_matter/data_model/esp_matter_cluster.cpp @@ -3829,11 +3829,9 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) cluster_t *cluster = esp_matter::cluster::create(endpoint, CameraAvStreamManagement::Id, flags); VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, CameraAvStreamManagement::Id)); if (flags & CLUSTER_FLAG_SERVER) { - // The server creation api is complex and cannot be called directly from esp_matter_delegate_callbacks.cpp - // if (config->delegate != nullptr) { - // static const auto delegate_init_cb = CameraAvStreamManagementDelegateInitCB; - // set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); - // } + // TODO: Add a delegate initialization callback. + // The current esp_matter initialization flow makes this hard to implement cleanly. + 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); @@ -3843,7 +3841,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) global::attribute::create_feature_map(cluster, config->feature_flags); /* Attributes not managed internally */ - global::attribute::create_cluster_revision(cluster, 1); + global::attribute::create_cluster_revision(cluster, cluster_revision); attribute::create_max_content_buffer_size(cluster, config->max_content_buffer_size); attribute::create_max_network_bandwidth(cluster, config->max_network_bandwidth); @@ -3912,18 +3910,16 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) cluster_t *cluster = esp_matter::cluster::create(endpoint, WebRTCTransportProvider::Id, flags); VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, WebRTCTransportProvider::Id)); if (flags & CLUSTER_FLAG_SERVER) { - // The server creation api is complex and cannot be called directly from esp_matter_delegate_callbacks.cpp - // if (config->delegate != nullptr) { - // static const auto delegate_init_cb = WebrtcTransportProviderDelegateInitCB; - // set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); - // } + // TODO: Add a delegate initialization callback. + // The current esp_matter initialization flow makes this hard to implement cleanly. + 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, 1); + global::attribute::create_cluster_revision(cluster, cluster_revision); attribute::create_current_sessions(cluster, NULL, 0, 0); @@ -3955,18 +3951,16 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) cluster_t *cluster = esp_matter::cluster::create(endpoint, WebRTCTransportRequestor::Id, flags); VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, WebRTCTransportRequestor::Id)); if (flags & CLUSTER_FLAG_SERVER) { - // The server creation api is complex and cannot be called directly from esp_matter_delegate_callbacks.cpp - // if (config->delegate != nullptr) { - // static const auto delegate_init_cb = WebrtcTransportRequestorDelegateInitCB; - // set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); - // } + // TODO: Add a delegate initialization callback. + // The current esp_matter initialization flow makes this hard to implement cleanly. + 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, 1); + global::attribute::create_cluster_revision(cluster, cluster_revision); attribute::create_current_sessions(cluster, NULL, 0, 0); @@ -4242,5 +4236,60 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) } /* closure_dimension */ +namespace camera_av_settings_user_level_management { +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, CameraAvSettingsUserLevelManagement::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, CameraAvSettingsUserLevelManagement::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + // TODO: Add a delegate initialization callback. + // The current esp_matter initialization flow makes this hard to implement cleanly. + + static const auto plugin_server_init_cb = CALL_ONCE(MatterCameraAvSettingsUserLevelManagementPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + set_add_bounds_callback(cluster, camera_av_settings_user_level_management::add_bounds_cb); + add_function_list(cluster, function_list, function_flags); + + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + // check against O.a+ feature conformance + 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 (has(feature::digital_ptz::get_id())) { + VerifyOrReturnValue(feature::digital_ptz::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (has(feature::mechanical_pan::get_id())) { + VerifyOrReturnValue(feature::mechanical_pan::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (has(feature::mechanical_tilt::get_id())) { + VerifyOrReturnValue(feature::mechanical_tilt::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (has(feature::mechanical_zoom::get_id())) { + VerifyOrReturnValue(feature::mechanical_zoom::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (has(feature::mechanical_presets::get_id())) { + if (has(feature::mechanical_pan::get_id()) || has(feature::mechanical_tilt::get_id()) || has(feature::mechanical_zoom::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/esp_matter_cluster.h b/components/esp_matter/data_model/esp_matter_cluster.h index 9e78c8890..908f15c49 100644 --- a/components/esp_matter/data_model/esp_matter_cluster.h +++ b/components/esp_matter/data_model/esp_matter_cluster.h @@ -971,7 +971,6 @@ namespace camera_av_stream_management { typedef struct config { uint32_t max_content_buffer_size; uint32_t max_network_bandwidth; - void* delegate; uint32_t feature_flags; config() : max_content_buffer_size(0), max_network_bandwidth(0), feature_flags(0) {} } config_t; @@ -980,19 +979,13 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); }/*camera av stream management*/ namespace webrtc_transport_provider { - typedef struct config { - void* delegate; - config() {} -} config_t; +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 { - typedef struct config { - void* delegate; - config() {} -} config_t; +using config_t = common::config_t; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); }/*webrtc transport requestor*/ @@ -1027,5 +1020,14 @@ typedef struct config { 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 */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_command.cpp b/components/esp_matter/data_model/esp_matter_command.cpp index 2a0fc8130..c977289c5 100644 --- a/components/esp_matter/data_model/esp_matter_command.cpp +++ b/components/esp_matter/data_model/esp_matter_command.cpp @@ -3053,5 +3053,52 @@ 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) +{ + return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZSetPosition::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_mptz_relative_move(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZRelativeMove::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_mptz_move_to_preset(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZMoveToPreset::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_mptz_save_preset(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZSavePreset::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_mptz_remove_preset(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZRemovePreset::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_dptz_set_viewport(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::DPTZSetViewport::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_dptz_relative_move(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::DPTZRelativeMove::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +} /* command */ +} /* camera_av_settings_user_level_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 3dc0fa3e6..226c14cb2 100644 --- a/components/esp_matter/data_model/esp_matter_command.h +++ b/components/esp_matter/data_model/esp_matter_command.h @@ -567,5 +567,17 @@ 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 */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_feature.cpp b/components/esp_matter/data_model/esp_matter_feature.cpp index b62d9e0a1..8de514c5c 100644 --- a/components/esp_matter/data_model/esp_matter_feature.cpp +++ b/components/esp_matter/data_model/esp_matter_feature.cpp @@ -4518,5 +4518,124 @@ esp_err_t add(cluster_t *cluster) } /* feature */ } /* closure_dimension */ +namespace camera_av_settings_user_level_management { +namespace feature { +namespace digital_ptz { + +uint32_t get_id() +{ + return static_cast(CameraAvSettingsUserLevelManagement::Feature::kDigitalPTZ); +} + +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 + attribute::create_dptz_streams(cluster, NULL, 0, 0); + // Commands + command::create_dptz_set_viewport(cluster); + return ESP_OK; +} + +} /* digital_ptz */ + +namespace mechanical_pan { + +uint32_t get_id() +{ + return static_cast(CameraAvSettingsUserLevelManagement::Feature::kMechanicalPan); +} + +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 + 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); + // Commands + 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 static_cast(CameraAvSettingsUserLevelManagement::Feature::kMechanicalTilt); +} + +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 + 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); + // Commands + 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 static_cast(CameraAvSettingsUserLevelManagement::Feature::kMechanicalZoom); +} + +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 + attribute::create_mptz_position(cluster, NULL, 0, 0); + attribute::create_zoom_max(cluster, 0); + attribute::create_movement_state(cluster, 0); + // Commands + 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 static_cast(CameraAvSettingsUserLevelManagement::Feature::kMechanicalPresets); +} + +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 + attribute::create_max_presets(cluster, 0); + attribute::create_mptz_presets(cluster, NULL, 0, 0); + // Commands + 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 */ +} /* camera_av_settings_user_level_management */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_feature.h b/components/esp_matter/data_model/esp_matter_feature.h index f72e28552..4f71991f6 100644 --- a/components/esp_matter/data_model/esp_matter_feature.h +++ b/components/esp_matter/data_model/esp_matter_feature.h @@ -2006,5 +2006,41 @@ esp_err_t add(cluster_t *cluster); } /* 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 */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h b/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h index 87c51a96e..b13c85b02 100644 --- a/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h +++ b/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h @@ -391,6 +391,10 @@ namespace closure_dimension { constexpr uint16_t cluster_revision = 1; } // namespace closure_dimension +namespace camera_av_settings_user_level_management { +constexpr uint16_t cluster_revision = 1; +} // namespace camera_av_settings_user_level_management + } // namespace cluster } // namespace esp_matter