Skip to content

Commit bf40bef

Browse files
Update to latest spec datatypes and classes
1 parent 93dab0d commit bf40bef

10 files changed

+176
-76
lines changed

Development/nmos-cpp-node/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ int main(int argc, char* argv[])
138138
.on_request_authorization_code(nmos::experimental::make_request_authorization_code_handler(gate)); // may be omitted, only required for OAuth client which is using the Authorization Code Flow to obtain the access token
139139
}
140140

141-
nmos::experimental::control_protocol_state control_protocol_state(node_implementation.get_lost_packet_counters, node_implementation.get_late_packet_counters, node_implementation.reset_packet_counters, node_implementation.control_protocol_property_changed);
141+
nmos::experimental::control_protocol_state control_protocol_state(node_implementation.get_lost_packet_counters, node_implementation.get_late_packet_counters, node_implementation.reset_packet_counters, node_implementation.reset_synchronization_source_changes, node_implementation.control_protocol_property_changed);
142142
if (0 <= nmos::fields::control_protocol_ws_port(node_model.settings))
143143
{
144144
node_implementation

Development/nmos-cpp-node/node_implementation.cpp

+11-3
Original file line numberDiff line numberDiff line change
@@ -1746,8 +1746,15 @@ nmos::reset_packet_counters_handler make_node_implementation_reset_packet_counte
17461746
};
17471747
}
17481748

1749-
1750-
1749+
// Example Receiver Status Monitor callback for reset_synchronization_source_changes method
1750+
nmos::reset_synchronization_source_changes_handler make_reset_synchronization_source_changes_handler()
1751+
{
1752+
return [&]()
1753+
{
1754+
// Implement reset of lost and late packet counters
1755+
return nmos::details::make_nc_method_result({ nmos::nc_method_status::ok });
1756+
};
1757+
}
17511758

17521759
namespace impl
17531760
{
@@ -1906,5 +1913,6 @@ nmos::experimental::node_implementation make_node_implementation(nmos::node_mode
19061913
.on_control_protocol_property_changed(make_node_implementation_control_protocol_property_changed_handler(gate)) // may be omitted if IS-12 not required
19071914
.on_get_lost_packet_counters(make_node_implementation_get_lost_packet_counters_handler())
19081915
.on_get_late_packet_counters(make_node_implementation_get_late_packet_counters_handler())
1909-
.on_reset_packet_counters(make_node_implementation_reset_packet_counters_handler());
1916+
.on_reset_packet_counters(make_node_implementation_reset_packet_counters_handler())
1917+
.on_reset_synchronization_source_changes(make_reset_synchronization_source_changes_handler());
19101918
}

Development/nmos/control_protocol_handlers.h

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ namespace nmos
4141
typedef std::function<web::json::value(void)> get_lost_packet_counters_handler;
4242
typedef std::function<web::json::value(void)> get_late_packet_counters_handler;
4343
typedef std::function<web::json::value(void)> reset_packet_counters_handler;
44+
typedef std::function<web::json::value(void)> reset_synchronization_source_changes_handler;
4445

4546
namespace experimental
4647
{

Development/nmos/control_protocol_resource.cpp

+64-36
Large diffs are not rendered by default.

Development/nmos/control_protocol_resource.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ namespace nmos
263263
web::json::value make_nc_class_manager_properties();
264264
web::json::value make_nc_class_manager_methods();
265265
web::json::value make_nc_class_manager_events();
266-
266+
267267
// Monitoring feature set control classes
268268
// TODO: link
269269
web::json::value make_nc_status_monitor_properties();
@@ -426,6 +426,8 @@ namespace nmos
426426
// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#ncconnectionstatus
427427
web::json::value make_nc_connection_status_datatype();
428428
// TODO: link
429+
web::json::value make_nc_essence_status_datatype();
430+
// TODO: link
429431
web::json::value make_nc_overall_status_datatype();
430432
// TODO: link
431433
web::json::value make_nc_link_status_datatype();
@@ -434,9 +436,11 @@ namespace nmos
434436
// TODO: link
435437
web::json::value make_nc_stream_status_datatype();
436438
// TODO: link
437-
web::json::value make_nc_packet_counter_datatype();
439+
web::json::value make_nc_counter_datatype();
438440
// TODO: link
439441
web::json::value make_nc_method_result_counters_datatype();
442+
// TODO: link
443+
web::json::value make_nc_transmission_status_datatype();
440444
}
441445

442446
#endif

Development/nmos/control_protocol_state.cpp

+33-10
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ namespace nmos
185185
{
186186
// Delegate to user defined handler
187187
auto result = nmos::details::make_nc_method_result_error({ nmos::nc_method_status::method_not_implemented }, U("not implemented"));
188-
188+
189189
if (get_lost_packet_counters)
190190
{
191191
result = get_lost_packet_counters();
@@ -239,9 +239,29 @@ namespace nmos
239239
return result;
240240
};
241241
}
242+
nmos::experimental::control_protocol_method_handler make_nc_reset_synchronization_source_changes_handler(reset_synchronization_source_changes_handler reset_synchonization_source_changes)
243+
{
244+
return [reset_synchonization_source_changes](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
245+
{
246+
// Delegate to user defined handler
247+
auto result = nmos::details::make_nc_method_result_error({ nmos::nc_method_status::method_not_implemented }, U("not implemented"));
248+
249+
if (reset_synchonization_source_changes)
250+
{
251+
result = reset_synchonization_source_changes();
252+
253+
const auto& status = nmos::fields::nc::status(result);
254+
if (!web::http::is_error_status_code((web::http::status_code)status) && is_deprecated)
255+
{
256+
return nmos::details::make_nc_method_result({ nmos::nc_method_status::method_deprecated }, nmos::fields::nc::value(result));
257+
}
258+
}
259+
return result;
260+
};
261+
}
242262
}
243263

244-
control_protocol_state::control_protocol_state(get_lost_packet_counters_handler get_lost_packet_counters, get_late_packet_counters_handler get_late_packet_counters, reset_packet_counters_handler reset_packet_counters, control_protocol_property_changed_handler property_changed)
264+
control_protocol_state::control_protocol_state(get_lost_packet_counters_handler get_lost_packet_counters, get_late_packet_counters_handler get_late_packet_counters, reset_packet_counters_handler reset_packet_counters, reset_synchronization_source_changes_handler reset_synchonization_source_changes, control_protocol_property_changed_handler property_changed)
245265
{
246266
using web::json::value;
247267

@@ -374,11 +394,12 @@ namespace nmos
374394
to_vector(make_nc_receiver_monitor_properties()),
375395
// NcReceiverMonitor methods
376396
to_methods_vector(make_nc_receiver_monitor_methods(),
377-
{
397+
{
378398
// link NcReceiverMonitor method_ids with method functions
379399
{ nc_receiver_monitor_get_lost_packet_counters_method_id, details::make_nc_get_lost_packet_counters_handler(get_lost_packet_counters)},
380400
{ nc_receiver_monitor_get_late_packet_counters_method_id, details::make_nc_get_late_packet_counters_handler(get_late_packet_counters)},
381-
{ nc_receiver_monitor_reset_packet_counters_method_id, details::make_nc_reset_packet_counters_handler(reset_packet_counters)}
401+
{ nc_receiver_monitor_reset_packet_counters_method_id, details::make_nc_reset_packet_counters_handler(reset_packet_counters)},
402+
{ nc_receiver_monitor_reset_synchonization_source_changes_method_id, details::make_nc_reset_synchronization_source_changes_handler(reset_packet_counters) }
382403
}),
383404
// NcReceiverMonitor events
384405
to_vector(make_nc_receiver_monitor_events())) }
@@ -460,12 +481,14 @@ namespace nmos
460481
// Monitoring feature set
461482
// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#datatypes
462483
{ U("NcConnectionStatus"), {make_nc_connection_status_datatype()} },
463-
{ U("NcOverallStatus"), {make_nc_overall_status_datatype() } },
464-
{ U("NcLinkStatus"), {make_nc_link_status_datatype() } },
465-
{ U("NcSynchronizationStatus"), {make_nc_synchronization_status_datatype() } },
466-
{ U("NcStreamStatus"), {make_nc_stream_status_datatype() } },
467-
{ U("NcPacketCounter"), {make_nc_packet_counter_datatype() } },
468-
{ U("NcMethodResultCounters"), {make_nc_method_result_counters_datatype() } }
484+
{ U("NcCounter"), {make_nc_counter_datatype()} },
485+
{ U("NcEssenceStatus"), {make_nc_essence_status_datatype()} },
486+
{ U("NcLinkStatus"), {make_nc_link_status_datatype()} },
487+
{ U("NcMethodResultCounters"), {make_nc_method_result_counters_datatype()} },
488+
{ U("NcOverallStatus"), {make_nc_overall_status_datatype()} },
489+
{ U("NcSynchronizationStatus"), {make_nc_synchronization_status_datatype()} },
490+
{ U("NcStreamStatus"), {make_nc_stream_status_datatype()} },
491+
{ U("NcTransmissionStatus"), {make_nc_transmission_status_datatype()} }
469492
};
470493
}
471494

Development/nmos/control_protocol_state.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ namespace nmos
5858
nmos::read_lock read_lock() const { return nmos::read_lock{ mutex }; }
5959
nmos::write_lock write_lock() const { return nmos::write_lock{ mutex }; }
6060

61-
control_protocol_state(get_lost_packet_counters_handler get_lost_packet_counters = nullptr, get_late_packet_counters_handler get_late_packet_counters = nullptr, reset_packet_counters_handler reset_packet_counters = nullptr, control_protocol_property_changed_handler property_changed = nullptr);
61+
control_protocol_state(get_lost_packet_counters_handler get_lost_packet_counters = nullptr, get_late_packet_counters_handler get_late_packet_counters = nullptr, reset_packet_counters_handler reset_packet_counters = nullptr, reset_synchronization_source_changes_handler reset_synchonization_source_changes = nullptr, control_protocol_property_changed_handler property_changed = nullptr);
6262

6363
// insert control class descriptor, false if class descriptor already inserted
6464
bool insert(const experimental::control_class_descriptor& control_class_descriptor);

Development/nmos/control_protocol_typedefs.h

+51-20
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ namespace nmos
9898
};
9999
}
100100

101+
// BCP-008-01/02 enum types
102+
101103
// NcConnectionStatus
102104
// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#ncconnectionstatus
103105
namespace nc_connection_status
@@ -111,15 +113,16 @@ namespace nmos
111113
};
112114
}
113115

114-
// NcOverallStatus
116+
// NcEssenceStatus
115117
// TODO: link
116-
namespace nc_overall_status
118+
namespace nc_essence_status
117119
{
118120
enum status
119121
{
120-
healthy = 1, // // The overall status is healthy
121-
partially_unhealthy = 2,// The overall status is partially healthy
122-
unhealthy = 3 // The overall status is unhealthy
122+
inactive = 0, // Inactive
123+
healthy = 1, // Active and healthy
124+
partially_healthy = 2, // Active and partially healthy
125+
unhealthy = 3 // Active and unhealthy
123126
};
124127
}
125128

@@ -129,9 +132,22 @@ namespace nmos
129132
{
130133
enum status
131134
{
132-
all_down = 1, // All the associated network interfaces are down
133-
some_down = 2, // Some of the associated network interfaces are down
134-
all_up = 3 // All the associated network interfaces are up
135+
all_up = 1, // All the associated network interfaces are up
136+
some_down = 2, // Some of the associated network interfaces are down
137+
all_down = 3 // All the associated network interfaces are down
138+
};
139+
}
140+
141+
// NcOverallStatus
142+
// TODO: link
143+
namespace nc_overall_status
144+
{
145+
enum status
146+
{
147+
inactive = 0, // Inactive
148+
healthy = 1, // The overall status is healthy
149+
partially_healthy = 2,// The overall status is partially healthy
150+
unhealthy = 3 // The overall status is unhealthy
135151
};
136152
}
137153

@@ -141,12 +157,10 @@ namespace nmos
141157
{
142158
enum status
143159
{
144-
not_used = 0, // Feature not in use
145-
baseband_locked = 1, // Locked from baseband
146-
baseband_partially_locked = 2, // Partially locked from baseband
147-
network_locked = 3, // Partially locked from network
148-
network_partially_locked = 4, // Partially locked from network
149-
not_locked = 5 // Not locked
160+
not_used = 0, // Feature not in use
161+
healthy = 1, // Locked to a synchronization source
162+
partially_healthy = 2, // Partially locked to a synchronization source
163+
unhealthy = 3 // Not locked to a synchronization source
150164
};
151165
}
152166

@@ -163,6 +177,19 @@ namespace nmos
163177
};
164178
}
165179

180+
//NcTransmissionStatus
181+
// TODO: add link
182+
namespace nc_transmission_status
183+
{
184+
enum status
185+
{
186+
inactive = 0, // Inactive
187+
healthy = 1, // Active and healthy
188+
partially_healthy = 2, // Active and partially healthy
189+
unhealthy = 3 // Active and unhealthy
190+
};
191+
}
192+
166193
// NcElementId
167194
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncelementid
168195
struct nc_element_id
@@ -215,6 +242,7 @@ namespace nmos
215242
const nc_method_id nc_receiver_monitor_get_lost_packet_counters_method_id(4, 1);
216243
const nc_method_id nc_receiver_monitor_get_late_packet_counters_method_id(4, 2);
217244
const nc_method_id nc_receiver_monitor_reset_packet_counters_method_id(4, 3);
245+
const nc_method_id nc_receiver_monitor_reset_synchonization_source_changes_method_id(4, 4);
218246

219247
// NcPropertyId
220248
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncpropertyid
@@ -255,18 +283,21 @@ namespace nmos
255283
// NcPropertyIds for NcStatusMonitor
256284
const nc_property_id nc_status_monitor_overall_status_property_id(3, 1);
257285
const nc_property_id nc_status_monitor_overall_status_message_property_id(3, 2);
286+
const nc_property_id nc_status_monitor_status_reporting_delay(3, 3);
258287
// NcPropertyids for NcReceiverMonitor
259288
// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#ncreceivermonitor
260289
const nc_property_id nc_receiver_monitor_link_status_property_id(4, 1);
261290
const nc_property_id nc_receiver_monitor_link_status_message_property_id(4, 2);
262291
const nc_property_id nc_receiver_monitor_connection_status_property_id(4, 3);
263292
const nc_property_id nc_receiver_monitor_connection_status_message_property_id(4, 4);
264-
const nc_property_id nc_receiver_monitor_synchronization_status_property_id(4, 5);
265-
const nc_property_id nc_receiver_monitor_synchronization_status_message_property_id(4, 6);
266-
const nc_property_id nc_receiver_monitor_synchronization_synchronization_source_id_property_id(4, 7);
267-
const nc_property_id nc_receiver_monitor_stream_status_property_id(4, 8);
268-
const nc_property_id nc_receiver_monitor_stream_status_message_property_id(4, 9);
269-
const nc_property_id nc_receiver_monitor_protected_signal_protection_status_property_id(4, 1);
293+
const nc_property_id nc_receiver_monitor_external_synchronization_status_property_id(4, 5);
294+
const nc_property_id nc_receiver_monitor_external_synchronization_status_message_property_id(4, 6);
295+
const nc_property_id nc_receiver_monitor_synchronization_source_id_property_id(4, 7);
296+
const nc_property_id nc_receiver_monitor_synchronization_source_changes_property_id(4, 8);
297+
const nc_property_id nc_receiver_monitor_stream_status_property_id(4, 9);
298+
const nc_property_id nc_receiver_monitor_stream_status_message_property_id(4, 10);
299+
const nc_property_id nc_receiver_monitor_auto_reset_packet_counters_property_id(4, 11);
300+
const nc_property_id nc_receiver_monitor_auto_reset_synchronization_source_changes_property_id(4, 12);
270301
// NcPropertyids for NcIdentBeacon
271302
// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/identification/#ncidentbeacon
272303
const nc_property_id nc_ident_beacon_active_property_id(3, 1);

Development/nmos/json_fields.h

+6-3
Original file line numberDiff line numberDiff line change
@@ -334,15 +334,18 @@ namespace nmos
334334
const web::json::field_as_string connection_status_message{ U("connectionStatusMessage") };
335335
const web::json::field_as_integer link_status{ U("linkStatus") }; // NcLinkStatus
336336
const web::json::field_as_string link_status_message{ U("linkStatusMessage") };
337-
const web::json::field_as_integer synchronization_status{ U("synchronizationStatus") }; // NcSynchronizationStatus
338-
const web::json::field_as_string synchronization_status_message{ U("synchronizationStatusMessage") };
337+
const web::json::field_as_integer synchronization_status{ U("externalSynchronizationStatus") }; // NcSynchronizationStatus
338+
const web::json::field_as_string synchronization_status_message{ U("externalSynchronizationStatusMessage") };
339339
const web::json::field_as_string synchronization_source_id{ U("synchronizationSourceId") };
340-
const web::json::field_as_bool signal_protection_status{ U("signalProtectionStatus") };
340+
const web::json::field_as_integer synchronization_source_changes{ U("synchronizationSourceChanges") };
341341
const web::json::field_as_integer stream_status{ U("streamStatus") }; // NcStreamStatus
342342
const web::json::field_as_string stream_status_message{ U("streamStatusMessage") };
343+
const web::json::field_as_bool auto_reset_packet_counters{ U("autoResetPacketCounters") };
344+
const web::json::field_as_bool auto_reset_synchronization_source_changes{ U("autoResetSynchronizationSourceChanges") };
343345
const web::json::field_as_bool active{ U("active") };
344346
const web::json::field_as_integer overall_status{ U("overallStatus") };
345347
const web::json::field_as_string overall_status_message{ U("overallStatusMessage") };
348+
const web::json::field_as_integer status_reporting_delay{ U("statusReportingDelay") };
346349
}
347350

348351
// NMOS Parameter Registers

Development/nmos/node_server.h

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ namespace nmos
8585
node_implementation& on_get_lost_packet_counters(nmos::get_lost_packet_counters_handler get_lost_packet_counters) { this->get_lost_packet_counters = std::move(get_lost_packet_counters); return *this; }
8686
node_implementation& on_get_late_packet_counters(nmos::get_late_packet_counters_handler get_late_packet_counters) { this->get_late_packet_counters = std::move(get_late_packet_counters); return *this; }
8787
node_implementation& on_reset_packet_counters(nmos::reset_packet_counters_handler reset_packet_counters) { this->reset_packet_counters = std::move(reset_packet_counters); return *this; }
88+
node_implementation& on_reset_synchronization_source_changes(nmos::reset_synchronization_source_changes_handler reset_synchronization_source_changes) { this->reset_synchronization_source_changes = std::move(reset_synchronization_source_changes); return *this; }
8889

8990
// deprecated, use on_validate_connection_resource_patch
9091
node_implementation& on_validate_merged(nmos::details::connection_resource_patch_validator validate_merged) { return on_validate_connection_resource_patch(std::move(validate_merged)); }
@@ -130,6 +131,7 @@ namespace nmos
130131
nmos::get_lost_packet_counters_handler get_lost_packet_counters;
131132
nmos::get_late_packet_counters_handler get_late_packet_counters;
132133
nmos::reset_packet_counters_handler reset_packet_counters;
134+
nmos::reset_synchronization_source_changes_handler reset_synchronization_source_changes;
133135
};
134136

135137
// Construct a server instance for an NMOS Node, implementing the IS-04 Node API, IS-05 Connection API, IS-07 Events API

0 commit comments

Comments
 (0)