Skip to content

Commit

Permalink
Merge pull request #5 from lo-simon/is-14-datatype-defs
Browse files Browse the repository at this point in the history
Added Device configuration data type definitions.
  • Loading branch information
lo-simon authored Jun 3, 2024
2 parents 8f24340 + 173af96 commit 81d41ec
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 1 deletion.
70 changes: 70 additions & 0 deletions Development/nmos/control_protocol_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2049,4 +2049,74 @@ 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());
}

// Device Configuration datatypes
// TODO: add link
web::json::value make_nc_property_value_holder_datatype()
{
using web::json::value;

auto fields = value::array();
web::json::push_back(fields, details::make_nc_field_descriptor(U("Property id"), nmos::fields::nc::id, U("NcPropertyId"), false, false, value::null()));
web::json::push_back(fields, details::make_nc_field_descriptor(U("Property name"), nmos::fields::nc::name, U("NcString"), false, false, value::null()));
web::json::push_back(fields, details::make_nc_field_descriptor(U("Property type name. If null it means the type is any"), nmos::fields::nc::type_name, U("NcName"), true, false, value::null()));
web::json::push_back(fields, details::make_nc_field_descriptor(U("Is the property ReadOnly?"), nmos::fields::nc::is_read_only, U("NcBoolean"), true, false, value::null()));
web::json::push_back(fields, details::make_nc_field_descriptor(U("Property value"), nmos::fields::nc::value, true, false, value::null()));

return details::make_nc_datatype_descriptor_struct(U("Property value holder descriptor"), U("NcPropertyValueHolder"), fields, value::null());
}
// TODO: add link
web::json::value make_nc_object_properties_holder_datatype()
{
using web::json::value;

auto fields = value::array();
web::json::push_back(fields, details::make_nc_field_descriptor(U("Object role path"), nmos::fields::nc::path, U("NcRolePath"), false, false, value::null()));
web::json::push_back(fields, details::make_nc_field_descriptor(U("Object properties values"), nmos::fields::nc::values, U("NcPropertyValueHolder"), false, true, value::null()));

return details::make_nc_datatype_descriptor_struct(U("Object properties holder descriptor"), U("NcObjectPropertiesHolder"), fields, value::null());
}
// TODO: add link
web::json::value make_nc_bulk_values_holder_datatype()
{
using web::json::value;

auto fields = value::array();
web::json::push_back(fields, details::make_nc_field_descriptor(U("Optional vendor specific fingerprinting mechanism used for validation purposes"), nmos::fields::nc::validation_fingerprint, U("NcString"), true, false, value::null()));
web::json::push_back(fields, details::make_nc_field_descriptor(U("Values by rolePath"), nmos::fields::nc::values, U("NcObjectPropertiesHolder"), false, true, value::null()));

return details::make_nc_datatype_descriptor_struct(U("Bulk values holder descriptor"), U("NcBulkValuesHolder"), fields, value::null());
}
// TODO: add link
web::json::value make_nc_object_properties_set_validation_datatype()
{
using web::json::value;

auto fields = value::array();
web::json::push_back(fields, details::make_nc_field_descriptor(U("Object role path"), nmos::fields::nc::path, U("NcRolePath"), false, false, value::null()));
web::json::push_back(fields, details::make_nc_field_descriptor(U("Validation status"), nmos::fields::nc::status, U("NcMethodStatus"), false, false, value::null()));
web::json::push_back(fields, details::make_nc_field_descriptor(U("Validation status message"), nmos::fields::nc::status_message, U("NcString"), true, false, value::null()));

return details::make_nc_datatype_descriptor_struct(U("Object properties set validation descriptor"), U("NcObjectPropertiesSetValidation"), fields, value::null());
}
// TODO: add link
web::json::value make_nc_method_result_bulk_values_holder_datatype()
{
using web::json::value;

auto fields = value::array();
web::json::push_back(fields, details::make_nc_field_descriptor(U("Bulk values holder value"), nmos::fields::nc::value, U("NcBulkValuesHolder"), false, false, value::null()));

return details::make_nc_datatype_descriptor_struct(U("Method result containing bulk values holder descriptor"), U("NcMethodResultBulkValuesHolder"), fields, U("NcMethodResult"), value::null());
}
// TODO: add link
web::json::value make_nc_method_result_object_properties_set_validation_datatype()
{
using web::json::value;

auto fields = value::array();
web::json::push_back(fields, details::make_nc_field_descriptor(U("Object properties set path validation"), nmos::fields::nc::value, U("NcObjectPropertiesSetValidation"), false, true, value::null()));

return details::make_nc_datatype_descriptor_struct(U("Method result containing object properties set validation descriptor"), U("NcMethodResultObjectPropertiesSetValidation"), fields, U("NcMethodResult"), value::null());
}
}
15 changes: 15 additions & 0 deletions Development/nmos/control_protocol_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,21 @@ 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();

// Device configuration feature set datatypes
// TODO: add link
//
web::json::value make_nc_property_value_holder_datatype();
//
web::json::value make_nc_object_properties_holder_datatype();
//
web::json::value make_nc_bulk_values_holder_datatype();
//
web::json::value make_nc_object_properties_set_validation_datatype();
//
web::json::value make_nc_method_result_bulk_values_holder_datatype();
//
web::json::value make_nc_method_result_object_properties_set_validation_datatype();
}

#endif
10 changes: 9 additions & 1 deletion Development/nmos/control_protocol_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,15 @@ 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()} },
// Device configuration feature set
// TODO: add link
{ U("NcPropertyValueHolder"), {make_nc_property_value_holder_datatype()}},
{ U("NcObjectPropertiesHolder"), {make_nc_object_properties_holder_datatype()}},
{ U("NcBulkValuesHolder"), {make_nc_bulk_values_holder_datatype()}},
{ U("NcObjectPropertiesSetValidation"), {make_nc_object_properties_set_validation_datatype()}},
{ U("NcMethodResultBulkValuesHolder"), {make_nc_method_result_bulk_values_holder_datatype()}},
{ U("NcMethodResultObjectPropertiesSetValidation"), {make_nc_method_result_object_properties_set_validation_datatype()}}
};
}

Expand Down
3 changes: 3 additions & 0 deletions Development/nmos/json_fields.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ namespace nmos
const web::json::field_as_string payload_status_message{ U("payloadStatusMessage") };
const web::json::field_as_bool signal_protection_status{ U("signalProtectionStatus") };
const web::json::field_as_bool active{ U("active") };
const web::json::field_as_array values{ U("values") };
const web::json::field_as_string validation_fingerprint{ U("validationFingerprint") };
const web::json::field_as_string status_message{ U("statusMessage") };
}

// NMOS Parameter Registers
Expand Down

0 comments on commit 81d41ec

Please sign in to comment.