Skip to content

Commit

Permalink
Update receiver monitor connection example (#384)
Browse files Browse the repository at this point in the history
* Update Receiver-Monitor connection activation example
* Update Development/nmos/control_protocol_handlers.cpp
---------

Co-authored-by: jonathan-r-thorpe <[email protected]>
  • Loading branch information
lo-simon and jonathan-r-thorpe authored Mar 28, 2024
1 parent ad66e8b commit 7949ab5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions Development/nmos/control_protocol_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,24 @@ namespace nmos
auto found = find_control_protocol_resource(resources, nmos::types::nc_receiver_monitor, connection_resource.id);
if (resources.end() != found && nc_receiver_monitor_class_id == details::parse_nc_class_id(nmos::fields::nc::class_id(found->data)))
{
// update receiver-monitor's connectionStatus propertry
// 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 value = active ? nc_connection_status::connected : nc_connection_status::disconnected;
const web::json::value connection_status = active ? nc_connection_status::connected : nc_connection_status::disconnected;
const web::json::value payload_status = active ? nc_payload_status::payload_ok : nc_payload_status::undefined;

// hmm, maybe updating connectionStatusMessage, payloadStatus, and payloadStatusMessage too
// hmm, maybe updating connectionStatusMessage and payloadStatusMessage too

const auto property_changed_event = make_property_changed_event(nmos::fields::nc::oid(found->data),
{
{ nc_receiver_monitor_connection_status_property_id, nc_property_change_type::type::value_changed, value }
{ nc_receiver_monitor_connection_status_property_id, nc_property_change_type::type::value_changed, connection_status },
{ nc_receiver_monitor_payload_status_property_id, nc_property_change_type::type::value_changed, payload_status }
});

modify_control_protocol_resource(resources, found->id, [&](nmos::resource& resource)
{
resource.data[nmos::fields::nc::connection_status] = value;
resource.data[nmos::fields::nc::connection_status] = connection_status;
resource.data[nmos::fields::nc::payload_status] = payload_status;

}, property_changed_event);
}
Expand Down
2 changes: 1 addition & 1 deletion Development/nmos/control_protocol_ws_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace nmos
};
}

void send_control_protocol_ws_messages_thread(web::websockets::experimental::listener::websocket_listener& listener, nmos::node_model& model, nmos::websockets& websockets, slog::base_gate& gate_);
void send_control_protocol_ws_messages_thread(web::websockets::experimental::listener::websocket_listener& listener, nmos::node_model& model, nmos::websockets& websockets, slog::base_gate& gate);
}

#endif

0 comments on commit 7949ab5

Please sign in to comment.