Skip to content

Commit 7949ab5

Browse files
Update receiver monitor connection example (#384)
* Update Receiver-Monitor connection activation example * Update Development/nmos/control_protocol_handlers.cpp --------- Co-authored-by: jonathan-r-thorpe <[email protected]>
1 parent ad66e8b commit 7949ab5

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Development/nmos/control_protocol_handlers.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,24 @@ namespace nmos
7777
auto found = find_control_protocol_resource(resources, nmos::types::nc_receiver_monitor, connection_resource.id);
7878
if (resources.end() != found && nc_receiver_monitor_class_id == details::parse_nc_class_id(nmos::fields::nc::class_id(found->data)))
7979
{
80-
// update receiver-monitor's connectionStatus propertry
80+
// update receiver-monitor's connectionStatus and payloadStatus properties
8181

8282
const auto active = nmos::fields::master_enable(nmos::fields::endpoint_active(connection_resource.data));
83-
const web::json::value value = active ? nc_connection_status::connected : nc_connection_status::disconnected;
83+
const web::json::value connection_status = active ? nc_connection_status::connected : nc_connection_status::disconnected;
84+
const web::json::value payload_status = active ? nc_payload_status::payload_ok : nc_payload_status::undefined;
8485

85-
// hmm, maybe updating connectionStatusMessage, payloadStatus, and payloadStatusMessage too
86+
// hmm, maybe updating connectionStatusMessage and payloadStatusMessage too
8687

8788
const auto property_changed_event = make_property_changed_event(nmos::fields::nc::oid(found->data),
8889
{
89-
{ nc_receiver_monitor_connection_status_property_id, nc_property_change_type::type::value_changed, value }
90+
{ nc_receiver_monitor_connection_status_property_id, nc_property_change_type::type::value_changed, connection_status },
91+
{ nc_receiver_monitor_payload_status_property_id, nc_property_change_type::type::value_changed, payload_status }
9092
});
9193

9294
modify_control_protocol_resource(resources, found->id, [&](nmos::resource& resource)
9395
{
94-
resource.data[nmos::fields::nc::connection_status] = value;
96+
resource.data[nmos::fields::nc::connection_status] = connection_status;
97+
resource.data[nmos::fields::nc::payload_status] = payload_status;
9598

9699
}, property_changed_event);
97100
}

Development/nmos/control_protocol_ws_api.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace nmos
2929
};
3030
}
3131

32-
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_);
32+
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);
3333
}
3434

3535
#endif

0 commit comments

Comments
 (0)