diff --git a/components/esp_matter/data_model/esp_matter_attribute.cpp b/components/esp_matter/data_model/esp_matter_attribute.cpp index de58f552c..d97e21f2d 100644 --- a/components/esp_matter/data_model/esp_matter_attribute.cpp +++ b/components/esp_matter/data_model/esp_matter_attribute.cpp @@ -5065,5 +5065,89 @@ 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 */ + +namespace push_av_stream_transport { +namespace attribute { +attribute_t *create_supported_formats(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, PushAvStreamTransport::Attributes::SupportedFormats::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_connections(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, PushAvStreamTransport::Attributes::CurrentConnections::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count)); +} + +} /* attribute */ + +} /* push_av_stream_transport */ + } /* 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..3145b23b7 100644 --- a/components/esp_matter/data_model/esp_matter_attribute.h +++ b/components/esp_matter/data_model/esp_matter_attribute.h @@ -1309,5 +1309,29 @@ 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 */ + +namespace push_av_stream_transport { +namespace attribute { + +attribute_t *create_supported_formats(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_connections(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +} /* attribute */ +} /* push_av_stream_transport */ + } /* 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 6f86c8229..63616caac 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); @@ -4240,5 +4234,110 @@ 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 */ + +namespace push_av_stream_transport { +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, PushAvStreamTransport::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, PushAvStreamTransport::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + if (config && config->delegate != nullptr) { + static const auto delegate_init_cb = PushAvStreamTransportDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterPushAvStreamTransportPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + attribute::create_supported_formats(cluster, NULL, 0, 0); + attribute::create_current_connections(cluster, NULL, 0, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + command::create_allocate_push_transport(cluster); + command::create_allocate_push_transport_response(cluster); + command::create_deallocate_push_transport(cluster); + command::create_modify_push_transport(cluster); + command::create_set_transport_status(cluster); + command::create_manually_trigger_transport(cluster); + command::create_find_transport(cluster); + command::create_find_transport_response(cluster); + + /* Events */ + event::create_push_transport_begin(cluster); + event::create_push_transport_end(cluster); + cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterPushAvStreamTransportClusterServerInitCallback, + ESPMatterPushAvStreamTransportClusterServerShutdownCallback); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* push_av_stream_transport */ + } /* 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..601599758 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,23 @@ 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 */ + +namespace push_av_stream_transport { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* push_av_stream_transport */ + } /* 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..422948ffe 100644 --- a/components/esp_matter/data_model/esp_matter_command.cpp +++ b/components/esp_matter/data_model/esp_matter_command.cpp @@ -3053,5 +3053,105 @@ 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 */ + +namespace push_av_stream_transport { +namespace command { +command_t *create_allocate_push_transport(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::AllocatePushTransport::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_allocate_push_transport_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::AllocatePushTransportResponse::Id, + COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_deallocate_push_transport(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::DeallocatePushTransport::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_modify_push_transport(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::ModifyPushTransport::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_set_transport_status(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::SetTransportStatus::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_manually_trigger_transport(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::ManuallyTriggerTransport::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_find_transport(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::FindTransport::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_find_transport_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::FindTransportResponse::Id, + COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ +} /* push_av_stream_transport */ + } /* 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..5b8cf496a 100644 --- a/components/esp_matter/data_model/esp_matter_command.h +++ b/components/esp_matter/data_model/esp_matter_command.h @@ -567,5 +567,30 @@ 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 */ + +namespace push_av_stream_transport { +namespace command { +command_t *create_allocate_push_transport(cluster_t *cluster); +command_t *create_allocate_push_transport_response(cluster_t *cluster); +command_t *create_deallocate_push_transport(cluster_t *cluster); +command_t *create_modify_push_transport(cluster_t *cluster); +command_t *create_set_transport_status(cluster_t *cluster); +command_t *create_manually_trigger_transport(cluster_t *cluster); +command_t *create_find_transport(cluster_t *cluster); +command_t *create_find_transport_response(cluster_t *cluster); +} /* command */ +} /* push_av_stream_transport */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp b/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp index f01f5cbe0..b6e39e108 100644 --- a/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp +++ b/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include using namespace chip::app::Clusters; @@ -571,6 +572,18 @@ void ClosureDimensionDelegateInitCB(void *delegate, uint16_t endpoint_id) server_interface->Init(); } + +void PushAvStreamTransportDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + static PushAvStreamTransportServer * pushavstreamtransportserverinstance = nullptr; + PushAvStreamTransportDelegate *push_av_stream_transport_delegate = static_cast(delegate); + uint32_t feature_map = get_feature_map_value(endpoint_id, PushAvStreamTransport::Id); + pushavstreamtransportserverinstance = new PushAvStreamTransportServer(endpoint_id, chip::BitMask(feature_map)); + pushavstreamtransportserverinstance->SetDelegate(push_av_stream_transport_delegate); + pushavstreamtransportserverinstance->Init(); +} + } // namespace delegate_cb } // namespace cluster } // namespace esp_matter diff --git a/components/esp_matter/data_model/esp_matter_delegate_callbacks.h b/components/esp_matter/data_model/esp_matter_delegate_callbacks.h index 3b303cfb2..b175ed800 100644 --- a/components/esp_matter/data_model/esp_matter_delegate_callbacks.h +++ b/components/esp_matter/data_model/esp_matter_delegate_callbacks.h @@ -58,6 +58,7 @@ void DiagnosticLogsDelegateInitCB(void *delegate, uint16_t endpoint_id); void ChimeDelegateInitCB(void *delegate, uint16_t endpoint_id); void ClosureControlDelegateInitCB(void *delegate, uint16_t endpoint_id); void ClosureDimensionDelegateInitCB(void *delegate, uint16_t endpoint_id); +void PushAvStreamTransportDelegateInitCB(void *delegate, uint16_t endpoint_id); } // namespace delegate_cb } // namespace cluster diff --git a/components/esp_matter/data_model/esp_matter_event.cpp b/components/esp_matter/data_model/esp_matter_event.cpp index 91805bd77..14d11077e 100644 --- a/components/esp_matter/data_model/esp_matter_event.cpp +++ b/components/esp_matter/data_model/esp_matter_event.cpp @@ -867,5 +867,20 @@ event_t *create_secure_state_changed(cluster_t *cluster) } // namespace event } // namespace closure_control +namespace push_av_stream_transport { +namespace event { +event_t *create_push_transport_begin(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, PushAvStreamTransport::Events::PushTransportBegin::Id); +} + +event_t *create_push_transport_end(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, PushAvStreamTransport::Events::PushTransportEnd::Id); +} + +} // namespace event +} // namespace push_av_stream_transport + } // namespace cluster } // namespace esp_matter diff --git a/components/esp_matter/data_model/esp_matter_event.h b/components/esp_matter/data_model/esp_matter_event.h index 17a742a1d..26da3f6ff 100644 --- a/components/esp_matter/data_model/esp_matter_event.h +++ b/components/esp_matter/data_model/esp_matter_event.h @@ -272,5 +272,12 @@ event_t *create_secure_state_changed(cluster_t *cluster); } // namespace event } // namespace closure_control +namespace push_av_stream_transport { +namespace event { +event_t *create_push_transport_begin(cluster_t *cluster); +event_t *create_push_transport_end(cluster_t *cluster); +} // namespace event +} // namespace push_av_stream_transport + } // namespace cluster } // namespace 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..52da8f685 100644 --- a/components/esp_matter/data_model/esp_matter_feature.cpp +++ b/components/esp_matter/data_model/esp_matter_feature.cpp @@ -4518,5 +4518,161 @@ 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 */ + +namespace push_av_stream_transport { +namespace feature { +namespace per_zone_sensitivity { + +uint32_t get_id() +{ + return static_cast(PushAvStreamTransport::Feature::kPerZoneSensitivity); +} + +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; +} + +} /* per_zone_sensitivity */ + +namespace metadata { + +uint32_t get_id() +{ + return static_cast(PushAvStreamTransport::Feature::kMetadata); +} + +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; +} + +} + +} /* feature */ +} /* push_av_stream_transport */ + } /* 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..590a6bccc 100644 --- a/components/esp_matter/data_model/esp_matter_feature.h +++ b/components/esp_matter/data_model/esp_matter_feature.h @@ -2006,5 +2006,60 @@ 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 */ + +namespace push_av_stream_transport { +namespace feature { + +namespace per_zone_sensitivity { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* per_zone_sensitivity */ + +/* Provisional */ +namespace metadata { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* metadata */ + +} /* feature */ +} /* push_av_stream_transport */ + } /* 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..ede631f17 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,14 @@ 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 push_av_stream_transport { +constexpr uint16_t cluster_revision = 1; +} // namespace push_av_stream_transport + } // namespace cluster } // namespace esp_matter