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

IS-14 support #387

Draft
wants to merge 146 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
71f13f0
Create IS-12 websocket server
lo-simon May 9, 2023
c3d3637
Remove incorrect comment
lo-simon May 10, 2023
4728d7c
Add `control_protocol_ws_port` to node example config
lo-simon May 10, 2023
7de45f3
Merge branch 'sony:is-12' into is-12
lo-simon May 15, 2023
549dd0e
Use lock to protect websockets
lo-simon May 15, 2023
599a5f5
Fix to obtain the event_ws position from the ws_handlers
lo-simon May 15, 2023
fae85fb
Create Root block, Device manager and Class manager nmos resources
lo-simon Aug 3, 2023
f42bb05
Merge remote-tracking branch 'origin/master' into is-12
lo-simon Aug 3, 2023
bb6db52
Add readonly on Get propertry support.
lo-simon Aug 8, 2023
eb71ebd
Fix declaration of nmos::experimental::control_classes for Linux
lo-simon Aug 8, 2023
212bdf4
Move functions around
lo-simon Aug 8, 2023
bb87347
Update IS-12 schemas
lo-simon Aug 8, 2023
2aba14a
Tidy up make_nc_class_manager
lo-simon Aug 8, 2023
71f97b5
Add NcObject's GetSequenceItem
lo-simon Aug 8, 2023
6e1640f
Fix GetSequenceItem and add GetSequenceLength
lo-simon Aug 8, 2023
a4455bc
Code tidy up
lo-simon Aug 9, 2023
bbf2604
Add SetSequenceItem, AddSequenceItem, RemoveSequenceItem, FindMembers…
lo-simon Aug 9, 2023
b5cbfc7
Fix AddSequenceItem
lo-simon Aug 9, 2023
4eab0e0
Fix FindMembersByPath
lo-simon Aug 10, 2023
5eeaa3b
Add FindMembersByRole and FindMembersByClassId
lo-simon Aug 11, 2023
5d5e2b8
Add GetControlClass, and GetDataType
lo-simon Aug 15, 2023
6eddf4e
Bump up ubuntu 14.04 to use python 3.7 to overcome
lo-simon Aug 16, 2023
fa17cd1
Fix ModuleNotFoundError: No module named '_ctypes'
lo-simon Aug 16, 2023
a356f3e
Fixing python3.7 install
lo-simon Aug 16, 2023
15a4e19
Bump up to python3.8
lo-simon Aug 16, 2023
70155a4
Add NcIdentBeacon, NcReceiverMonitor and NcReceiverMonitorProtected
lo-simon Aug 18, 2023
f7dacb2
Use control_protocol_ws_port to construct request URLs for the Contro…
lo-simon Aug 18, 2023
52dc55a
Remove unused code
lo-simon Aug 19, 2023
3924c6b
Fix find_members_by_path and write log on method
lo-simon Aug 22, 2023
9145752
Remove un-used code
lo-simon Aug 22, 2023
0ef34d0
Add Log gate to method
lo-simon Aug 22, 2023
dba1042
Move nc_class_id definition from control_protocol_resource to control…
lo-simon Aug 22, 2023
38077d2
Add nested block examples
lo-simon Aug 22, 2023
90a768b
Extract IS-12 version from the rx ws path
lo-simon Aug 23, 2023
d47b47a
Add helper functions to create non-standard control class, and genera…
lo-simon Aug 24, 2023
901780a
Use of nc_class_id struct and method_id struct for map key
lo-simon Aug 29, 2023
40c3dc1
Remove un-used code
lo-simon Aug 30, 2023
e4e54d6
Add support for allowing user to insert non-standard control class me…
lo-simon Aug 31, 2023
c581781
Fix 'nmos::experimental::control_class' constructor initialization
lo-simon Aug 31, 2023
3b58506
Fix indentation
lo-simon Sep 7, 2023
279358c
Use better error instead of `out of bounds`
lo-simon Sep 7, 2023
431b4a8
Add non-standard Example class based on nmos-device-control-mock
lo-simon Sep 12, 2023
0b87a78
Update log messages
lo-simon Sep 12, 2023
d8a803f
Fix is_nc_block()
lo-simon Sep 12, 2023
9e1fdc8
Tidy-up function signatures
lo-simon Sep 12, 2023
8b4d0d1
Add subscription support
lo-simon Sep 15, 2023
b7a24e5
Update outdated IS-12 links
lo-simon Sep 15, 2023
ec51638
Tidy up, less casting
lo-simon Sep 18, 2023
de5beed
Add description to nc_object to simplify create nc_xxx class
lo-simon Sep 19, 2023
fa2a4ba
Move nc helper functions to nc utils
lo-simon Sep 19, 2023
ac8f21b
look before accessing control_protocol_state
lo-simon Sep 19, 2023
a805d8a
pusback allows on NcBlock only
lo-simon Sep 19, 2023
4873c40
Add control protocol unit tests
lo-simon Sep 19, 2023
68defeb
Add more unit tests
lo-simon Sep 20, 2023
f773372
Add NcPropertyConstraintsNumber, NcPropertyConstraintsString, NcParam…
lo-simon Sep 21, 2023
1bd7283
Tidy up make_nc_class_descriptor
lo-simon Sep 21, 2023
c1a9aca
Merge remote-tracking branch 'origin/master' into is-12
lo-simon Sep 25, 2023
84f13d4
Fix to handle empty NCP URL path
lo-simon Oct 6, 2023
645ff22
Code fix to construct nc_property_changed_event_data, thanks for @maw…
lo-simon Oct 6, 2023
472883e
Insert root block resource to the model will also inserting all its n…
lo-simon Oct 13, 2023
094f568
Add IS-12 to Readme
lo-simon Oct 13, 2023
3ff45a4
Add tounchpoint support and link Receiver-Monitor with IS-04/IS-05 Re…
lo-simon Oct 18, 2023
f8f5270
Add new headers to makefile
lo-simon Oct 18, 2023
264cfba
Set IS-12 nmos resource with relevant nmos::type
lo-simon Oct 19, 2023
ce62865
Clean up on how to construct propertry changed event
lo-simon Oct 19, 2023
f483ffd
Merge remote-tracking branch 'origin/master' into is-12
lo-simon Oct 23, 2023
28187d8
Add constraints support, see https://specs.amwa.tv/ms-05-02/branches/…
lo-simon Oct 26, 2023
677f66e
Update comments
lo-simon Oct 30, 2023
ad85dd0
typo
lo-simon Oct 30, 2023
613beaf
Add primitive types
lo-simon Oct 31, 2023
35de2d0
Merge remote-tracking branch 'origin/master' into is-12
lo-simon Nov 3, 2023
cbedf53
Add a simple temperature sensor example, which pumps out new temperat…
lo-simon Nov 3, 2023
d21ca75
Fix non-standard class's method handing
lo-simon Nov 7, 2023
f039f8f
Remove un-used code and fix typo
lo-simon Nov 8, 2023
98b4b56
Test readonly on set_sequence_item and add_sequence_item
lo-simon Nov 8, 2023
b14afef
Enhance level 0 datatype constraints validation
lo-simon Nov 14, 2023
0049eaa
Return property_deprecated(298) if property is marked as deprecated
lo-simon Nov 14, 2023
cf492a4
Code tidy-up
lo-simon Nov 14, 2023
93f69c2
Enhance non-standard example control method handlers, add level 2 and…
lo-simon Nov 14, 2023
d26bc32
Prevent comparsion warning
lo-simon Nov 14, 2023
2471b01
Reject Set on non-sequence value to sequence property
lo-simon Nov 15, 2023
4420e1e
Fix runtime and property sequence constraints validation
lo-simon Nov 15, 2023
bc5e0f5
Add method parameters constriants validation, and check method deprec…
lo-simon Nov 18, 2023
65e8ebb
Add comments
lo-simon Nov 20, 2023
092519e
No arguments object to those methods which do not require any arguments
lo-simon Nov 20, 2023
14aa16f
Add deprecated property and deprecated method to Example Control Class
lo-simon Nov 20, 2023
0bed427
Add logging for contraints validation
lo-simon Nov 21, 2023
64111a4
Merge branch 'master' into is-12
lo-simon Dec 22, 2023
4f83f38
Add property changed callback to perform application-specific operati…
lo-simon Jan 4, 2024
ea732da
Add authorization support to IS-12
lo-simon Jan 4, 2024
17bfd21
Merge remote-tracking branch 'origin/master' into is-12
lo-simon Jan 8, 2024
6fd4e78
Prevent warning C26800
lo-simon Jan 8, 2024
31321f7
Add ncp authorization field to IS-04 controls array of an NMOS Device
lo-simon Jan 10, 2024
ff3b9a3
Add IS-14 support
lo-simon Jan 10, 2024
e0a3755
Merge branch 'master' into is-14
lo-simon Mar 7, 2024
f685729
Add IS-14 schemas
lo-simon Mar 12, 2024
893f12d
Add GET /rolePaths and /rolePaths/{rolePath} support
lo-simon Mar 13, 2024
0124aa3
Merge branch 'master' into is-14
lo-simon Apr 11, 2024
a8794c5
Update comment
lo-simon Apr 12, 2024
05d6270
Update IS-14 schemas
lo-simon Apr 12, 2024
3a63684
Remove tabs with spaces
lo-simon Apr 12, 2024
c8eb564
IS-14 Added "/rolePaths/{rolePath}/properties" Endpoint (#1)
jonathan-r-thorpe Apr 22, 2024
b4a9038
Add const root block role
lo-simon Apr 23, 2024
a328772
Remove blanks
lo-simon Apr 24, 2024
143f4a0
Add /rolePaths/{rolePath}/methods endpoint
lo-simon Apr 24, 2024
96c5320
Remove blank
lo-simon Apr 25, 2024
d05ce02
Add /rolePaths/{rolePath}/descriptor endpoint, and tidy up
lo-simon Apr 25, 2024
7744eca
Add properties endpoint
jonathan-r-thorpe Apr 22, 2024
5adef6a
Update propertyId regular expression
jonathan-r-thorpe Apr 24, 2024
a4f6591
added /rolePaths/{rolePath}/property/{propertyId}/value and /rolePath…
jonathan-r-thorpe Apr 26, 2024
6788b1f
Fixed property id parsing
jonathan-r-thorpe Apr 26, 2024
e9306f2
Expose make_nc_method_result utility function
jonathan-r-thorpe Apr 26, 2024
f001640
Refactor method result creation
jonathan-r-thorpe Apr 26, 2024
c1d3c10
Fix descriptor endpoints to return NcMethodResult objects instead of …
jonathan-r-thorpe Apr 26, 2024
014cb37
Tidy up
lo-simon Apr 29, 2024
514468f
Add common functions and rename get_nc_object to get_nc_resource
lo-simon Apr 29, 2024
a3d05c2
Merge pull request #2 from lo-simon/is-14-properties-endpoint
lo-simon Apr 30, 2024
b2ae537
Add /rolePaths/{rolePath}/methods/{methodId} PATCH and /rolePaths/{ro…
lo-simon May 8, 2024
1e28e16
Make deprecated properties and methods return OK
jonathan-r-thorpe May 10, 2024
e51d708
Merge pull request #3 from lo-simon/is-14-deprecated
lo-simon May 16, 2024
b54931a
Pull command handle up to IS-12 command handling level to standard me…
jonathan-r-thorpe May 17, 2024
c0dc2f2
Removed and renamed command message response helper functions
jonathan-r-thorpe May 17, 2024
d2cca6d
Apply suggestions from code review
jonathan-r-thorpe May 20, 2024
3dec42a
Merge pull request #4 from lo-simon/refactor-is12-handle
lo-simon May 20, 2024
59da8c5
Added Device configuration data type definitions.
jonathan-r-thorpe May 21, 2024
cafa976
Merge branch 'sony:master' into is-14
lo-simon May 28, 2024
8f24340
Remove not in use code, thanks for @maweit suggestion
lo-simon May 28, 2024
173af96
Update Development/nmos/json_fields.h
jonathan-r-thorpe Jun 3, 2024
81d41ec
Merge pull request #5 from lo-simon/is-14-datatype-defs
lo-simon Jun 3, 2024
44f9857
Merge branch 'master' into is-14
lo-simon Jun 5, 2024
976d766
Modify using the updated version of the control method handler
lo-simon Jun 5, 2024
2588cfb
Add IS-14 bulkPropertiesManager object and endpoints (#7)
jonathan-r-thorpe Jun 19, 2024
3deaccb
Use the correct events for NcBulkPropertiesManager class descriptor
lo-simon Jun 20, 2024
bd9b59a
typo
lo-simon Jun 20, 2024
780c11a
Remove unused code
lo-simon Jun 20, 2024
66434d1
Merge branch 'master' into is-14
lo-simon Jun 21, 2024
226dc59
IS-14 Refactor bulkProperties methods (#8)
jonathan-r-thorpe Jul 14, 2024
4f3de3e
Merge branch 'master' into is-14
lo-simon Aug 1, 2024
7830330
Remove redundant parameters.
jonathan-r-thorpe Aug 6, 2024
b14f570
Apply suggestions from code review
jonathan-r-thorpe Aug 16, 2024
dd7185b
Merge pull request #9 from lo-simon/remove_redundant_params
lo-simon Sep 4, 2024
fa2eea2
Changed ncp_nmos_resource_type to ncp_touchpoint_resource_type
jonathan-r-thorpe Sep 4, 2024
8210589
Generalize find_control_protocol_resource
jonathan-r-thorpe Sep 4, 2024
87cfb85
Remove redundant parameters
jonathan-r-thorpe Sep 4, 2024
9f68dbf
Merge pull request #10 from lo-simon/is-14-simplify
lo-simon Sep 4, 2024
5e2847c
Merge branch 'master' into is-14
jonathan-r-thorpe Nov 6, 2024
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
88 changes: 88 additions & 0 deletions Development/cmake/NmosCppLibraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,90 @@ target_include_directories(nmos_is12_schemas PUBLIC
list(APPEND NMOS_CPP_TARGETS nmos_is12_schemas)
add_library(nmos-cpp::nmos_is12_schemas ALIAS nmos_is12_schemas)

# nmos_is14_schemas library

set(NMOS_IS14_SCHEMAS_HEADERS
nmos/is14_schemas/is14_schemas.h
)

set(NMOS_IS14_V1_0_TAG v1.0.x)

set(NMOS_IS14_V1_0_SCHEMAS_JSON
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/base.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/bulkProperties-get-response.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/bulkProperties-set-request.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/bulkProperties-set-response.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/bulkProperties-validate-request.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/bulkProperties-validate-response.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/descriptor-get.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/method-patch-request.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/method-patch-response.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/methods-base.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/ms05-error.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/properties-base.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/property.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/property-descriptor.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/property-value-get.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/property-value-put-request.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/property-value-put-response.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/rolePath.json
third_party/is-14/${NMOS_IS14_V1_0_TAG}/APIs/schemas/rolePaths-base.json
)

set(NMOS_IS14_SCHEMAS_JSON_MATCH "third_party/is-14/([^/]+)/APIs/schemas/([^;]+)\\.json")
set(NMOS_IS14_SCHEMAS_SOURCE_REPLACE "${CMAKE_CURRENT_BINARY_DIR_REPLACE}/nmos/is14_schemas/\\1/\\2.cpp")
string(REGEX REPLACE "${NMOS_IS14_SCHEMAS_JSON_MATCH}(;|$)" "${NMOS_IS14_SCHEMAS_SOURCE_REPLACE}\\3" NMOS_IS14_V1_0_SCHEMAS_SOURCES "${NMOS_IS14_V1_0_SCHEMAS_JSON}")

foreach(JSON ${NMOS_IS14_V1_0_SCHEMAS_JSON})
string(REGEX REPLACE "${NMOS_IS14_SCHEMAS_JSON_MATCH}" "${NMOS_IS14_SCHEMAS_SOURCE_REPLACE}" SOURCE "${JSON}")
string(REGEX REPLACE "${NMOS_IS14_SCHEMAS_JSON_MATCH}" "\\1" NS "${JSON}")
string(REGEX REPLACE "${NMOS_IS14_SCHEMAS_JSON_MATCH}" "\\2" VAR "${JSON}")
string(MAKE_C_IDENTIFIER "${NS}" NS)
string(MAKE_C_IDENTIFIER "${VAR}" VAR)

file(WRITE "${SOURCE}.in" "\
// Auto-generated from: ${JSON}\n\
\n\
namespace nmos\n\
{\n\
namespace is14_schemas\n\
{\n\
namespace ${NS}\n\
{\n\
const char* ${VAR} = R\"-auto-generated-(")

file(READ "${JSON}" RAW)
file(APPEND "${SOURCE}.in" "${RAW}")

file(APPEND "${SOURCE}.in" ")-auto-generated-\";\n\
}\n\
}\n\
}\n")

configure_file("${SOURCE}.in" "${SOURCE}" COPYONLY)
endforeach()

add_library(
nmos_is14_schemas STATIC
${NMOS_IS14_SCHEMAS_HEADERS}
${NMOS_IS14_V1_0_SCHEMAS_SOURCES}
)

source_group("nmos\\is14_schemas\\Header Files" FILES ${NMOS_IS14_SCHEMAS_HEADERS})
source_group("nmos\\is14_schemas\\${NMOS_IS14_V1_0_TAG}\\Source Files" FILES ${NMOS_IS14_V1_0_SCHEMAS_SOURCES})

target_link_libraries(
nmos_is14_schemas PRIVATE
nmos-cpp::compile-settings
)
target_include_directories(nmos_is14_schemas PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${NMOS_CPP_INSTALL_INCLUDEDIR}>
)

list(APPEND NMOS_CPP_TARGETS nmos_is14_schemas)
add_library(nmos-cpp::nmos_is14_schemas ALIAS nmos_is14_schemas)

# nmos-cpp library

set(NMOS_CPP_BST_SOURCES
Expand Down Expand Up @@ -921,6 +1005,7 @@ set(NMOS_CPP_NMOS_SOURCES
nmos/channels.cpp
nmos/client_utils.cpp
nmos/components.cpp
nmos/configuration_api.cpp
nmos/connection_activation.cpp
nmos/connection_api.cpp
nmos/connection_events_activation.cpp
Expand Down Expand Up @@ -1014,6 +1099,7 @@ set(NMOS_CPP_NMOS_HEADERS
nmos/colorspace.h
nmos/components.h
nmos/copyable_atomic.h
nmos/configuration_api.h
nmos/connection_activation.h
nmos/connection_api.h
nmos/connection_events_activation.h
Expand Down Expand Up @@ -1048,6 +1134,7 @@ set(NMOS_CPP_NMOS_HEADERS
nmos/is09_versions.h
nmos/is10_versions.h
nmos/is12_versions.h
nmos/is14_versions.h
nmos/issuers.h
nmos/json_fields.h
nmos/json_schema.h
Expand Down Expand Up @@ -1198,6 +1285,7 @@ target_link_libraries(
nmos-cpp::nmos_is09_schemas
nmos-cpp::nmos_is10_schemas
nmos-cpp::nmos_is12_schemas
nmos-cpp::nmos_is14_schemas
nmos-cpp::mdns
nmos-cpp::slog
nmos-cpp::OpenSSL
Expand Down
2 changes: 1 addition & 1 deletion Development/nmos-cpp-node/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ int main(int argc, char* argv[])
.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
}

nmos::experimental::control_protocol_state control_protocol_state(node_implementation.control_protocol_property_changed);
nmos::experimental::control_protocol_state control_protocol_state(node_implementation.control_protocol_property_changed, node_implementation.get_properties_by_path, node_implementation.validate_set_properties_by_path, node_implementation.set_properties_by_path);
if (0 <= nmos::fields::control_protocol_ws_port(node_model.settings))
{
node_implementation
Expand Down
48 changes: 46 additions & 2 deletions Development/nmos-cpp-node/node_implementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,9 @@ void node_implementation_init(nmos::node_model& model, nmos::experimental::contr
// example class manager
auto class_manager = nmos::make_class_manager(++oid, control_protocol_state);

// example bulk properties manager
auto bulk_properties_manager = nmos::make_bulk_properties_manager(++oid);

// example stereo gain
const auto stereo_gain_oid = ++oid;
auto stereo_gain = nmos::make_block(stereo_gain_oid, nmos::root_block_oid, U("stereo-gain"), U("Stereo gain"), U("Stereo gain block"));
Expand Down Expand Up @@ -1263,7 +1266,7 @@ void node_implementation_init(nmos::node_model& model, nmos::experimental::contr
utility::stringstream_t role;
role << U("monitor-") << ++count;
const auto& receiver = nmos::find_resource(model.node_resources, receiver_id);
const auto receiver_monitor = nmos::make_receiver_monitor(++oid, true, nmos::root_block_oid, role.str(), nmos::fields::label(receiver->data), nmos::fields::description(receiver->data), value_of({ { nmos::details::make_nc_touchpoint_nmos({nmos::ncp_nmos_resource_types::receiver, receiver_id}) } }));
const auto receiver_monitor = nmos::make_receiver_monitor(++oid, true, nmos::root_block_oid, role.str(), nmos::fields::label(receiver->data), nmos::fields::description(receiver->data), value_of({ { nmos::details::make_nc_touchpoint_nmos({nmos::ncp_touchpoint_resource_types::receiver, receiver_id}) } }));

// add receiver-monitor to root-block
nmos::push_back(root_block, receiver_monitor);
Expand All @@ -1284,6 +1287,8 @@ void node_implementation_init(nmos::node_model& model, nmos::experimental::contr
nmos::push_back(root_block, class_manager);
// add device-manager to root-block
nmos::push_back(root_block, device_manager);
// add bulk-properties-manager to root-block
nmos::push_back(root_block, bulk_properties_manager);

// insert control protocol resources to model
insert_root_after(delay_millis, root_block, gate);
Expand Down Expand Up @@ -1714,6 +1719,42 @@ nmos::control_protocol_property_changed_handler make_node_implementation_control
};
}

// Example Device Configuration callback for creating a back-up dataset
nmos::get_properties_by_path_handler make_node_implementation_get_properties_by_path_handler(const nmos::resources& resources, slog::base_gate& gate)
{
return [&resources, &gate](nmos::get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor, nmos::get_control_protocol_datatype_descriptor_handler get_control_protocol_datatype_descriptor, const nmos::resource& resource, bool recurse)
{
slog::log<slog::severities::info>(gate, SLOG_FLF) << nmos::stash_category(impl::categories::node_implementation) << "Do get_properties_by_path";

// Implement backup of device model here
return nmos::details::make_nc_method_result({ nmos::nc_method_status::ok });
};
}

// Example Device Configuration callback for validating a back-up dataset
nmos::validate_set_properties_by_path_handler make_node_implementation_validate_set_properties_by_path_handler(const nmos::resources& resources, slog::base_gate& gate)
{
return [&resources, &gate](nmos::get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor, nmos::get_control_protocol_datatype_descriptor_handler get_control_protocol_datatype_descriptor, const nmos::resource& resource, const web::json::value& backup_data_set, bool recurse, const web::json::array& included_property_traits)
{
slog::log<slog::severities::info>(gate, SLOG_FLF) << nmos::stash_category(impl::categories::node_implementation) << "Do validate_set_properties_by_path";

// Can this backup be restored?
return nmos::details::make_nc_method_result({ nmos::nc_method_status::ok });
};
}

// Example Device Configuration callback for restoring a back-up dataset
nmos::set_properties_by_path_handler make_node_implementation_set_properties_by_path_handler(nmos::resources& resources, slog::base_gate& gate)
{
return [&resources, &gate](nmos::get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor, nmos::get_control_protocol_datatype_descriptor_handler get_control_protocol_datatype_descriptor, const nmos::resource& resource, const web::json::value& data_set, bool recurse, const web::json::array& included_property_traits)
{
slog::log<slog::severities::info>(gate, SLOG_FLF) << nmos::stash_category(impl::categories::node_implementation) << "Do set_properties_by_path";

// Implement restore of device model here
return nmos::details::make_nc_method_result({ nmos::nc_method_status::ok });
};
}

namespace impl
{
nmos::interlace_mode get_interlace_mode(const nmos::settings& settings)
Expand Down Expand Up @@ -1868,5 +1909,8 @@ nmos::experimental::node_implementation make_node_implementation(nmos::node_mode
.on_connection_activated(make_node_implementation_connection_activation_handler(model, gate))
.on_validate_channelmapping_output_map(make_node_implementation_map_validator()) // may be omitted if not required
.on_channelmapping_activated(make_node_implementation_channelmapping_activation_handler(gate))
.on_control_protocol_property_changed(make_node_implementation_control_protocol_property_changed_handler(gate)); // may be omitted if IS-12 not required
.on_control_protocol_property_changed(make_node_implementation_control_protocol_property_changed_handler(gate)) // may be omitted if IS-12 not required
.on_get_properties_by_path(make_node_implementation_get_properties_by_path_handler(model.control_protocol_resources, gate)) // may be omitted if IS-14 not required
.on_validate_set_properties_by_path(make_node_implementation_validate_set_properties_by_path_handler(model.control_protocol_resources, gate)) // may be omitted if IS-14 not required
.on_set_properties_by_path(make_node_implementation_set_properties_by_path_handler(model.control_protocol_resources, gate)); // may be omitted if IS-14 not required
}
7 changes: 7 additions & 0 deletions Development/nmos/api_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ namespace nmos
const route_pattern channelmapping_api = make_route_pattern(U("api"), U("channelmapping"));
// IS-09 System API (originally specified in JT-NM TR-1001-1:2018 Annex A)
const route_pattern system_api = make_route_pattern(U("api"), U("system"));
// IS-14 Configuration API
const route_pattern configuration_api = make_route_pattern(U("api"), U("configuration"));

// API version pattern
const route_pattern version = make_route_pattern(U("version"), U("v[0-9]+\\.[0-9]+"));
Expand Down Expand Up @@ -87,6 +89,11 @@ namespace nmos
const route_pattern outputSubroute = make_route_pattern(U("outputSubroute"), U("properties|sourceid|channels|caps"));
const route_pattern activationId = make_route_pattern(U("activationId"), U("[a-zA-Z0-9\\-_]+"));

// Configuration API
const route_pattern rolePath = make_route_pattern(U("rolePath"), U("root|root\\.[a-zA-Z0-9\\-_\\.]+"));
const route_pattern propertyId = make_route_pattern(U("propertyId"), U("[0-9]+p[0-9]+"));
const route_pattern methodId = make_route_pattern(U("methodId"), U("[0-9]+m[0-9]+"));

// Common patterns
const route_pattern resourceId = make_route_pattern(U("resourceId"), U("[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"));
}
Expand Down
Loading
Loading