Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update receiver monitor connection example #384

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 propertries
jonathan-r-thorpe marked this conversation as resolved.
Show resolved Hide resolved

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
Loading