Skip to content

Commit

Permalink
Update datatypes to latest version of spec
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-r-thorpe committed Jun 28, 2024
1 parent 06df262 commit 4e37320
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 22 deletions.
27 changes: 19 additions & 8 deletions Development/nmos/control_protocol_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ namespace nmos
}

// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#ncreceivermonitor
web::json::value make_receiver_monitor(const nc_class_id& class_id, nc_oid oid, bool constant_oid, 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 enabled, nc_overall_status::status overall_status, const utility::string_t& overall_status_message, nc_link_status::status link_status, const utility::string_t& link_status_message, nc_connection_status::status connection_status, const utility::string_t& connection_status_message, nc_synchronization_status::status synchronization_status, const utility::string_t& synchronization_status_message, const utility::string_t& grand_master_clock_id, nc_stream_status::status stream_status, const utility::string_t& stream_status_message)
web::json::value make_receiver_monitor(const nc_class_id& class_id, nc_oid oid, bool constant_oid, 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 enabled, nc_overall_status::status overall_status, const utility::string_t& overall_status_message, nc_link_status::status link_status, const utility::string_t& link_status_message, nc_connection_status::status connection_status, const utility::string_t& connection_status_message, nc_synchronization_status::status synchronization_status, const utility::string_t& synchronization_status_message, const utility::string_t& synchronization_source_id, nc_stream_status::status stream_status, const utility::string_t& stream_status_message)
{
using web::json::value;

Expand All @@ -763,7 +763,7 @@ namespace nmos
data[nmos::fields::nc::connection_status_message] = value::string(connection_status_message);
data[nmos::fields::nc::synchronization_status] = value::number(synchronization_status);
data[nmos::fields::nc::synchronization_status_message] = value::string(synchronization_status_message);
data[nmos::fields::nc::grand_master_clock_id] = value::string(grand_master_clock_id);
data[nmos::fields::nc::synchronization_source_id] = value::string(synchronization_source_id);
data[nmos::fields::nc::stream_status] = value::number(stream_status);
data[nmos::fields::nc::stream_status_message] = value::string(stream_status_message);

Expand Down Expand Up @@ -1208,7 +1208,7 @@ namespace nmos
web::json::push_back(properties, details::make_nc_property_descriptor(U("Connection status message property"), nc_receiver_monitor_connection_status_message_property_id, nmos::fields::nc::connection_status_message, U("NcString"), true, true, false, false, value::null()));
web::json::push_back(properties, details::make_nc_property_descriptor(U("Synchronization status property"), nc_receiver_monitor_synchronization_status_property_id, nmos::fields::nc::synchronization_status, U("NcSynchronizationStatus"), true, false, false, false, value::null()));
web::json::push_back(properties, details::make_nc_property_descriptor(U("Synchronization status message property"), nc_receiver_monitor_synchronization_status_message_property_id, nmos::fields::nc::synchronization_status_message, U("NcString"), true, true, false, false, value::null()));
web::json::push_back(properties, details::make_nc_property_descriptor(U("Grand master clock id property"), nc_receiver_monitor_synchronization_grand_master_clock_id_property_id, nmos::fields::nc::grand_master_clock_id, U("NcString"), true, true, false, false, value::null()));
web::json::push_back(properties, details::make_nc_property_descriptor(U("Grand master clock id property"), nc_receiver_monitor_synchronization_synchronization_source_id_property_id, nmos::fields::nc::synchronization_source_id, U("NcString"), true, true, false, false, value::null()));
web::json::push_back(properties, details::make_nc_property_descriptor(U("Stream status property"), nc_receiver_monitor_stream_status_property_id, nmos::fields::nc::stream_status, U("NcStreamStatus"), true, false, false, false, value::null()));
web::json::push_back(properties, details::make_nc_property_descriptor(U("Stream status message property"), nc_receiver_monitor_stream_status_message_property_id, nmos::fields::nc::stream_status_message, U("NcString"), true, true, false, false, value::null()));

Expand All @@ -1219,8 +1219,8 @@ namespace nmos
using web::json::value;

auto methods = value::array();
web::json::push_back(methods, details::make_nc_method_descriptor(U("Gets the lost packets"), nc_receiver_monitor_get_lost_packets_method_id, U("GetLostPackets"), U("NcMethodResultCounter"), value::array(), false));
web::json::push_back(methods, details::make_nc_method_descriptor(U("Gets the late packets"), nc_receiver_monitor_get_late_packets_method_id, U("GetLatePackets"), U("NcMethodResultCounter"), value::array(), false));
web::json::push_back(methods, details::make_nc_method_descriptor(U("Gets the lost packet counters"), nc_receiver_monitor_get_lost_packet_counters_method_id, U("GetLostPacketCounters"), U("NcMethodResultCounters"), value::array(), false));
web::json::push_back(methods, details::make_nc_method_descriptor(U("Gets the late packet counters"), nc_receiver_monitor_get_late_packet_counters_method_id, U("GetLatePacketCounters"), U("NcMethodResultCounters"), value::array(), false));
web::json::push_back(methods, details::make_nc_method_descriptor(U("Resets the packet counters"), nc_receiver_monitor_reset_packet_counters_method_id, U("ResetPacketCounters"), U("NcMethodResult"), value::array(), false));

return methods;
Expand Down Expand Up @@ -2073,6 +2073,7 @@ namespace nmos
using web::json::value;

auto items = value::array();
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("Inactive"), U("Inactive"), 0));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("The overall status is healthy"), U("Healthy"), 1));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("The overall status is partially healthy"), U("PartiallyHealthy"), 2));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("The overall status is unhealthy"), U("Unhealthy"), 3));
Expand Down Expand Up @@ -2115,13 +2116,23 @@ namespace nmos
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("Active and unhealthy"), U("Unhealthy"), 3));
return details::make_nc_datatype_descriptor_enum(U("Stream status enum data type"), U("NcStreamStatus"), items, value::null());
}
// TOO: link
web::json::value make_nc_method_result_counter_datatype()
// TODO: link
web::json::value make_nc_packet_counter_datatype()
{
using web::json::value;

auto fields = value::array();
web::json::push_back(fields, details::make_nc_field_descriptor(U("Counter name"), nmos::fields::nc::name, U("NcString"), false, false, value::null()));
web::json::push_back(fields, details::make_nc_field_descriptor(U("Counter value"), nmos::fields::nc::value, U("NcUint64"), false, false, value::null()));
return details::make_nc_datatype_descriptor_struct(U("Counter method result"), U("NcMethodResultCounter"), fields, U("NcMethodResult"), value::null());
return details::make_nc_datatype_descriptor_struct(U("Packet counter data type"), U("NcPacketCounter"), fields, value::null());
}
// TOO: link
web::json::value make_nc_method_result_counters_datatype()
{
using web::json::value;

auto fields = value::array();
web::json::push_back(fields, details::make_nc_field_descriptor(U("Counters"), nmos::fields::nc::value, U("NcPacketCounter"), false, true, value::null()));
return details::make_nc_datatype_descriptor_struct(U("Counter method result"), U("NcMethodResultCounters"), fields, U("NcMethodResult"), value::null());
}
}
16 changes: 9 additions & 7 deletions Development/nmos/control_protocol_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ namespace nmos
// TODO: add link
web::json::value make_nc_status_monitor(const nc_class_id& class_id, nc_oid oid, bool constant_oid, 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 enabled, nc_overall_status::status overall_status, const utility::string_t& overall_status_message);
// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#ncreceivermonitor
web::json::value make_receiver_monitor(const nc_class_id& class_id, nc_oid oid, bool constant_oid, 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 enabled, nc_overall_status::status overall_status, const utility::string_t& overall_status_message, nc_link_status::status link_status, const utility::string_t& link_status_message, nc_connection_status::status connection_status, const utility::string_t& connection_status_message, nc_synchronization_status::status synchronization_status, const utility::string_t& synchronization_status_message, const utility::string_t& grand_master_clock_id, nc_stream_status::status stream_status, const utility::string_t& stream_status_message);
web::json::value make_receiver_monitor(const nc_class_id& class_id, nc_oid oid, bool constant_oid, 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 enabled, nc_overall_status::status overall_status, const utility::string_t& overall_status_message, nc_link_status::status link_status, const utility::string_t& link_status_message, nc_connection_status::status connection_status, const utility::string_t& connection_status_message, nc_synchronization_status::status synchronization_status, const utility::string_t& synchronization_status_message, const utility::string_t& synchronization_source_id, nc_stream_status::status stream_status, const utility::string_t& stream_status_message);

// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncmanager
web::json::value make_nc_manager(const nc_class_id& class_id, nc_oid oid, bool constant_oid, const web::json::value& owner, const utility::string_t& role, const web::json::value& user_label, const utility::string_t& description, const web::json::value& touchpoints, const web::json::value& runtime_property_constraints);
Expand Down Expand Up @@ -425,16 +425,18 @@ namespace nmos
//
// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#ncconnectionstatus
web::json::value make_nc_connection_status_datatype();
// TOO: link
// TODO: link
web::json::value make_nc_overall_status_datatype();
// TOO: link
// TODO: link
web::json::value make_nc_link_status_datatype();
// TOO: link
// TODO: link
web::json::value make_nc_synchronization_status_datatype();
// TOO: link
// TODO: link
web::json::value make_nc_stream_status_datatype();
// TOO: link
web::json::value make_nc_method_result_counter_datatype();
// TODO: link
web::json::value make_nc_packet_counter_datatype();
// TODO: link
web::json::value make_nc_method_result_counters_datatype();
}

#endif
4 changes: 2 additions & 2 deletions Development/nmos/control_protocol_resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ namespace nmos
//
// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#ncreceivermonitor
control_protocol_resource make_receiver_monitor(nc_oid oid, bool constant_oid, 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 enabled,
nc_overall_status::status overall_status, const utility::string_t& overall_status_message, nc_link_status::status link_status, const utility::string_t& link_status_message, nc_connection_status::status connection_status, const utility::string_t& connection_status_message, nc_synchronization_status::status synchronization_status, const utility::string_t& synchronization_status_message, const utility::string_t& grand_master_clock_id, nc_stream_status::status stream_status, const utility::string_t& stream_status_message)
nc_overall_status::status overall_status, const utility::string_t& overall_status_message, nc_link_status::status link_status, const utility::string_t& link_status_message, nc_connection_status::status connection_status, const utility::string_t& connection_status_message, nc_synchronization_status::status synchronization_status, const utility::string_t& synchronization_status_message, const utility::string_t& synchronization_source_id, nc_stream_status::status stream_status, const utility::string_t& stream_status_message)
{
auto data = details::make_receiver_monitor(nc_receiver_monitor_class_id, oid, constant_oid, owner, role, user_label, description, touchpoints, runtime_property_constraints, enabled, overall_status, overall_status_message, link_status, link_status_message, connection_status, connection_status_message, synchronization_status, synchronization_status_message, grand_master_clock_id, stream_status, stream_status_message);
auto data = details::make_receiver_monitor(nc_receiver_monitor_class_id, oid, constant_oid, owner, role, user_label, description, touchpoints, runtime_property_constraints, enabled, overall_status, overall_status_message, link_status, link_status_message, connection_status, connection_status_message, synchronization_status, synchronization_status_message, synchronization_source_id, stream_status, stream_status_message);

return{ is12_versions::v1_0, types::nc_receiver_monitor, std::move(data), true };
}
Expand Down
2 changes: 1 addition & 1 deletion Development/nmos/control_protocol_resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace nmos
const utility::string_t& connection_status_message = U(""),
nc_synchronization_status::status synchronization_status = nc_synchronization_status::not_used,
const utility::string_t& synchronization_status_message = U(""),
const utility::string_t& grand_master_clock_id = U(""),
const utility::string_t& synchronization_source_id = U(""),
nc_stream_status::status stream_status = nc_stream_status::inactive,
const utility::string_t& stream_status_message = U("")
);
Expand Down
6 changes: 3 additions & 3 deletions Development/nmos/control_protocol_typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ namespace nmos
const nc_method_id nc_class_manager_get_datatype_method_id(3, 2);
// NcMethodIds for NcReceiverMonitor
// TODO: link
const nc_method_id nc_receiver_monitor_get_lost_packets_method_id(4, 1);
const nc_method_id nc_receiver_monitor_get_late_packets_method_id(4, 2);
const nc_method_id nc_receiver_monitor_get_lost_packet_counters_method_id(4, 1);
const nc_method_id nc_receiver_monitor_get_late_packet_counters_method_id(4, 2);
const nc_method_id nc_receiver_monitor_reset_packet_counters_method_id(4, 3);

// NcPropertyId
Expand Down Expand Up @@ -263,7 +263,7 @@ namespace nmos
const nc_property_id nc_receiver_monitor_connection_status_message_property_id(4, 4);
const nc_property_id nc_receiver_monitor_synchronization_status_property_id(4, 5);
const nc_property_id nc_receiver_monitor_synchronization_status_message_property_id(4, 6);
const nc_property_id nc_receiver_monitor_synchronization_grand_master_clock_id_property_id(4, 7);
const nc_property_id nc_receiver_monitor_synchronization_synchronization_source_id_property_id(4, 7);
const nc_property_id nc_receiver_monitor_stream_status_property_id(4, 8);
const nc_property_id nc_receiver_monitor_stream_status_message_property_id(4, 9);
const nc_property_id nc_receiver_monitor_protected_signal_protection_status_property_id(4, 1);
Expand Down
2 changes: 1 addition & 1 deletion Development/nmos/json_fields.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ namespace nmos
const web::json::field_as_string link_status_message{ U("linkStatusMessage") };
const web::json::field_as_integer synchronization_status{ U("synchronizationStatus") }; // NcSynchronizationStatus
const web::json::field_as_string synchronization_status_message{ U("synchronizationStatusMessage") };
const web::json::field_as_string grand_master_clock_id{ U("grandMasterClockId") };
const web::json::field_as_string synchronization_source_id{ U("synchronizationSourceId") };
const web::json::field_as_bool signal_protection_status{ U("signalProtectionStatus") };
const web::json::field_as_integer stream_status{ U("streamStatus") }; // NcStreamStatus
const web::json::field_as_string stream_status_message{ U("streamStatusMessage") };
Expand Down

0 comments on commit 4e37320

Please sign in to comment.