Skip to content

Commit

Permalink
Add status-reporting data types
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-r-thorpe committed May 22, 2024
1 parent 3dec42a commit 40f42de
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Development/nmos/control_protocol_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace nmos
// update receiver-monitor's connectionStatus and payloadStatus properties

const auto active = nmos::fields::master_enable(nmos::fields::endpoint_active(connection_resource.data));
const web::json::value connection_status = active ? nc_connection_status::connected : nc_connection_status::disconnected;
const web::json::value connection_status = active ? nc_connection_status::healthy : nc_connection_status::inactive;
const web::json::value payload_status = active ? nc_payload_status::payload_ok : nc_payload_status::undefined;

// hmm, maybe updating connectionStatusMessage and payloadStatusMessage too
Expand Down
70 changes: 65 additions & 5 deletions Development/nmos/control_protocol_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2024,20 +2024,22 @@ namespace nmos
return details::make_nc_datatype_typedef(U("Version code in semantic versioning format"), U("NcVersionCode"), false, U("NcString"), value::null());
}

// Monitoring datatype defintions
//
// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#ncconnectionstatus
web::json::value make_nc_connection_status_datatype()
{
using web::json::value;

auto items = value::array();
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("This is the value when there is no receiver"), U("Undefined"), 0));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("Connected to a stream"), U("Connected"), 1));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("Not connected to a stream"), U("Disconnected"), 2));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("A connection error was encountered"), U("ConnectionError"), 3));
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("Active and healthy"), U("Healthy"), 1));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("Active and partially healthy"), U("PartiallyHealthy"), 2));
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("Connection status enum data typee"), U("NcConnectionStatus"), items, value::null());
}

// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#ncpayloadstatus
// ******************
web::json::value make_nc_payload_status_datatype()
{
using web::json::value;
Expand All @@ -2049,4 +2051,62 @@ namespace nmos
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("A payload error was encountered"), U("PayloadError"), 3));
return details::make_nc_datatype_descriptor_enum(U("Connection status enum data typee"), U("NcPayloadStatus"), items, value::null());
}
// ***********************
// TOO: link
web::json::value make_nc_overall_status_datatype()
{
using web::json::value;

auto items = value::array();
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));
return details::make_nc_datatype_descriptor_enum(U("Overall status enum data type"), U("NcOverallStatus"), items, value::null());
}
// TOO: link
web::json::value make_nc_link_status_datatype()
{
using web::json::value;

auto items = value::array();
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("All the associated network interfaces are down"), U("AllDown"), 1));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("Some of the associated network interfaces are down"), U("SomeDown"), 2));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("All the associated network interfaces are up"), U("AllUp"), 3));
return details::make_nc_datatype_descriptor_enum(U("Link status enum data type"), U("NcLinkStatus"), items, value::null());
}
// TOO: link
web::json::value make_nc_synchronization_status_datatype()
{
using web::json::value;

auto items = value::array();
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("Feature not in use"), U("NotUsed"), 0));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("Locked from baseband"), U("BasebandLocked"), 1));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("Partially locked from baseband"), U("BasebandPartiallyLocked"), 2));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("Partially locked from network"), U("NetworkLocked"), 3));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("Locked from network"), U("NetworkPartiallyLocked"), 4));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("Not locked"), U("NotLocked"), 5));
return details::make_nc_datatype_descriptor_enum(U("Synchronization status enum data type"), U("NcSynchronizationStatus"), items, value::null());
}
// TOO: link
web::json::value make_nc_stream_status_datatype()
{
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("Active and healthy"), U("Healthy"), 1));
web::json::push_back(items, details::make_nc_enum_item_descriptor(U("Active and partially healthy"), U("PartiallyHealthy"), 2));
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()
{
using web::json::value;

auto fields = value::array();
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());
}
}
10 changes: 10 additions & 0 deletions Development/nmos/control_protocol_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,16 @@ namespace nmos
web::json::value make_nc_connection_status_datatype();
// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#ncpayloadstatus
web::json::value make_nc_payload_status_datatype();
// TOO: link
web::json::value make_nc_overall_status_datatype();
// TOO: link
web::json::value make_nc_link_status_datatype();
// TOO: link
web::json::value make_nc_synchronization_status_datatype();
// TOO: link
web::json::value make_nc_stream_status_datatype();
// TOO: link
web::json::value make_nc_method_result_counter_datatype();
}

#endif
4 changes: 2 additions & 2 deletions Development/nmos/control_protocol_resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ namespace nmos
//
// create Receiver Monitor resource
control_protocol_resource make_receiver_monitor(nc_oid oid, bool constant_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 enabled = true,
nc_connection_status::status connection_status = nc_connection_status::status::undefined,
nc_connection_status::status connection_status = nc_connection_status::status::inactive,
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("")
);
// create Receiver Monitor Protected resource
control_protocol_resource make_receiver_monitor_protected(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 = web::json::value::null(), bool enabled = true,
nc_connection_status::status connection_status = nc_connection_status::status::undefined,
nc_connection_status::status connection_status = nc_connection_status::status::inactive,
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(""),
Expand Down
7 changes: 6 additions & 1 deletion Development/nmos/control_protocol_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,12 @@ namespace nmos
// Monitoring feature set
// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#datatypes
{ U("NcConnectionStatus"), {make_nc_connection_status_datatype()} },
{ U("NcPayloadStatus"), {make_nc_payload_status_datatype()} }
{ U("NcPayloadStatus"), {make_nc_payload_status_datatype()} },
{ U("NcOverallStatus"), {make_nc_overall_status_datatype() } },
{ U("NcLinkStatus"), {make_nc_link_status_datatype() } },
{ U("NcSynchronizationStatus"), {make_nc_synchronization_status_datatype() } },
{ U("NcStreamStatus"), {make_nc_stream_status_datatype() } },
{ U("NcMethodResultCounter"), {make_nc_method_result_counter_datatype() } }
};
}

Expand Down
60 changes: 56 additions & 4 deletions Development/nmos/control_protocol_typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ namespace nmos
{
enum status
{
undefined = 0, // This is the value when there is no receiver
connected = 1, // Connected to a stream
disconnected = 2, // Not connected to a stream
connection_error = 3 // A connection error was encountered
inactive = 0, // Inactive
healthy = 1, // Active and healthy
partially_healthy = 2, // Active and partially healthy
unhealthy = 3 // Active and unhealthy
};
}

Expand All @@ -124,6 +124,58 @@ namespace nmos
};
}

// NcOverallStatus
// TODO: link
namespace nc_overall_status
{
enum status
{
healthy = 1, // // The overall status is healthy
partially_unhealthy = 2,// The overall status is partially healthy
unhealthy = 3 // The overall status is unhealthy
};
}

//NcLinkStatus
// TODO: link
namespace nc_link_status
{
enum status
{
all_down = 1, // All the associated network interfaces are down
some_down = 2, // Some of the associated network interfaces are down
all_up = 3 // All the associated network interfaces are up
};
}

//NcSynchronizationStatus
// TODO: link
namespace nc_synchronization_status
{
enum status
{
not_used = 0, // Feature not in use
baseband_locked = 1, // Locked from baseband
baseband_partially_locked = 2, // Partially locked from baseband
network_locked = 3, // Partially locked from network
network_partially_locked = 4, // Partially locked from network
not_locked = 5 // Not locked
};
}

//NcStreamStatus
// TODO: add link
namespace nc_stream_status
{
enum status
{
inactive = 0, // Inactive
healthy = 1, // Active and healthy
partially_healthy = 2, // Active and partially healthy
unhealthy = 3 // Active and unhealthy
};
}

// NcElementId
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncelementid
struct nc_element_id
Expand Down

0 comments on commit 40f42de

Please sign in to comment.