From 9406d81db579e3644df01c0399976365b784b24f Mon Sep 17 00:00:00 2001 From: "Jonathan Thorpe (Sony)" Date: Mon, 26 Feb 2024 16:46:20 +0000 Subject: [PATCH] Added Receiver Monitor Protected and Ident Beacon workers to control_protocol_resources --- .../nmos/control_protocol_resources.cpp | 52 +++++++++++++++++-- Development/nmos/control_protocol_resources.h | 18 +++++++ Development/nmos/type.h | 1 + 3 files changed, 66 insertions(+), 5 deletions(-) diff --git a/Development/nmos/control_protocol_resources.cpp b/Development/nmos/control_protocol_resources.cpp index b1a267f7..155e1273 100644 --- a/Development/nmos/control_protocol_resources.cpp +++ b/Development/nmos/control_protocol_resources.cpp @@ -64,18 +64,60 @@ namespace nmos return{ is12_versions::v1_0, types::nc_class_manager, std::move(data), true }; } + // Monitoring feature set control classes + // + namespace details + { + web::json::value make_receiver_monitor(const nc_class_id& class_id, nc_oid oid, nmos::nc_oid owner, const utility::string_t& role, const utility::string_t& user_label, const utility::string_t& description, const web::json::value& touchpoints, const web::json::value& runtime_property_constraints, + nc_connection_status::status connection_status, const utility::string_t& connection_status_message, nc_payload_status::status payload_status, const utility::string_t& payload_status_message) + { + using web::json::value; + + auto data = nmos::details::make_nc_worker(class_id, oid, true, owner, role, value::string(user_label), description, touchpoints, runtime_property_constraints, true); + data[nmos::fields::nc::connection_status] = value::number(connection_status); + data[nmos::fields::nc::connection_status_message] = value::string(connection_status_message); + data[nmos::fields::nc::payload_status] = value::number(payload_status); + data[nmos::fields::nc::payload_status_message] = value::string(payload_status_message); + + return data; + } + + } // See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#ncreceivermonitor control_protocol_resource make_receiver_monitor(nc_oid oid, nmos::nc_oid owner, const utility::string_t& role, const utility::string_t& user_label, const utility::string_t& description, const web::json::value& touchpoints, const web::json::value& runtime_property_constraints, nc_connection_status::status connection_status, const utility::string_t& connection_status_message, nc_payload_status::status payload_status, const utility::string_t& payload_status_message) { using web::json::value; - auto data = nmos::details::make_nc_worker(nc_receiver_monitor_class_id, oid, true, owner, role, value::string(user_label), description, touchpoints, runtime_property_constraints, true); - data[nmos::fields::nc::connection_status] = value::number(connection_status); - data[nmos::fields::nc::connection_status_message] = value::string(connection_status_message); - data[nmos::fields::nc::payload_status] = value::number(payload_status); - data[nmos::fields::nc::payload_status_message] = value::string(payload_status_message); + auto data = nmos::details::make_receiver_monitor(nc_receiver_monitor_class_id, oid, owner, role, user_label, description, touchpoints, runtime_property_constraints, connection_status, connection_status_message, payload_status, payload_status_message); return{ is12_versions::v1_0, types::nc_receiver_monitor, std::move(data), true }; } + + // See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#ncreceivermonitorprotected + control_protocol_resource make_receiver_monitor_protected(nc_oid oid, nmos::nc_oid owner, const utility::string_t& role, const utility::string_t& user_label, const utility::string_t& description, const web::json::value& touchpoints, const web::json::value& runtime_property_constraints, + nc_connection_status::status connection_status, const utility::string_t& connection_status_message, nc_payload_status::status payload_status, const utility::string_t& payload_status_message, bool signal_protection_status) + { + using web::json::value; + + auto data = nmos::details::make_receiver_monitor(nc_receiver_monitor_protected_class_id, oid, owner, role, user_label, description, touchpoints, runtime_property_constraints, connection_status, connection_status_message, payload_status, payload_status_message); + data[nmos::fields::nc::signal_protection_status] = value::boolean(signal_protection_status); + + return{ is12_versions::v1_0, types::nc_receiver_monitor_protected, std::move(data), true }; + } + + // Identification feature set control classes + // + // See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/identification/#ncidentbeacon + control_protocol_resource make_ident_beacon(nc_oid oid, nmos::nc_oid owner, const utility::string_t& role, const utility::string_t& user_label, const utility::string_t& description, const web::json::value& touchpoints, const web::json::value& runtime_property_constraints, + bool active) + { + using web::json::value; + + auto data = nmos::details::make_nc_worker(nc_ident_beacon_class_id, oid, true, owner, role, value::string(user_label), description, touchpoints, runtime_property_constraints, true); + data[nmos::fields::nc::active] = value::boolean(active); + + return{ is12_versions::v1_0, types::nc_ident_beacon, std::move(data), true }; + } + } diff --git a/Development/nmos/control_protocol_resources.h b/Development/nmos/control_protocol_resources.h index c17edcc8..eb9aedf8 100644 --- a/Development/nmos/control_protocol_resources.h +++ b/Development/nmos/control_protocol_resources.h @@ -25,6 +25,8 @@ namespace nmos // create Class manager resource control_protocol_resource make_class_manager(nc_oid oid, const nmos::experimental::control_protocol_state& control_protocol_state); + // Monitoring feature set control classes + // // create Receiver Monitor resource control_protocol_resource make_receiver_monitor(nc_oid oid, nmos::nc_oid owner, const utility::string_t& role, const utility::string_t& user_label, const utility::string_t& description, const web::json::value& touchpoints = web::json::value::null(), const web::json::value& runtime_property_constraints = web::json::value::null(), nc_connection_status::status connection_status = nc_connection_status::status::undefined, @@ -32,6 +34,22 @@ namespace nmos nc_payload_status::status payload_status = nc_payload_status::status::undefined, const utility::string_t& payload_status_message = U("") ); + + // create Receiver Monitor Protected resource + control_protocol_resource make_receiver_monitor_protected(nc_oid oid, nmos::nc_oid owner, const utility::string_t& role, const utility::string_t& user_label, const utility::string_t& description, const web::json::value& touchpoints, const web::json::value& runtime_property_constraints = web::json::value::null(), + nc_connection_status::status connection_status = nc_connection_status::status::undefined, + const utility::string_t& connection_status_message = U(""), + nc_payload_status::status payload_status = nc_payload_status::status::undefined, + const utility::string_t& payload_status_message = U(""), + bool signal_protection_status = true + ); + + // Identification feature set control classes + // + // create Ident Beacon resource + control_protocol_resource make_ident_beacon(nc_oid oid, nmos::nc_oid owner, const utility::string_t& role, const utility::string_t& user_label, const utility::string_t& description, const web::json::value& touchpoints = web::json::value::null(), const web::json::value& runtime_property_constraints = web::json::value::null(), + bool active = false + ); } #endif diff --git a/Development/nmos/type.h b/Development/nmos/type.h index 3c2853eb..8da37f68 100644 --- a/Development/nmos/type.h +++ b/Development/nmos/type.h @@ -48,6 +48,7 @@ namespace nmos const type nc_class_manager{ U("nc_class_manager") }; const type nc_receiver_monitor{ U("nc_receiver_monitor") }; const type nc_receiver_monitor_protected{ U("nc_receiver_monitor_protected") }; + const type nc_ident_beacon{ U("nc_ident_beacon") }; } }