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-12 support #330

Merged
merged 117 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 93 commits
Commits
Show all changes
117 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
2fd6bdd
Update comments
lo-simon Jan 12, 2024
3911889
Return parameter_error (417) instead of bad_oid (404) in event of bad…
lo-simon Jan 12, 2024
2fbd8e1
Add non-standard class method with the necessary parameters
lo-simon Jan 15, 2024
cb6aec7
Merge branch 'master' into is-12
lo-simon Feb 9, 2024
0b1191d
Merge branch 'master' into is-12
lo-simon Feb 15, 2024
6f025a8
Update node config JSON to include is12_versions
lo-simon Feb 15, 2024
89ee998
Apply suggestions from code review
lo-simon Feb 23, 2024
82b91ed
Merge branch 'master' into is-12
lo-simon Feb 23, 2024
c0244ad
Update Development/nmos-cpp-node/node_implementation.cpp
lo-simon Feb 26, 2024
1c5fe14
Remove commented out code
lo-simon Feb 26, 2024
9c27c40
Update comments
lo-simon Feb 26, 2024
9406d81
Added Receiver Monitor Protected and Ident Beacon workers to control_…
jonathan-r-thorpe Feb 26, 2024
8794dd4
Apply suggestions from code review
lo-simon Feb 27, 2024
60f6204
Typo
lo-simon Feb 27, 2024
af5dce0
Fix example_control to use the number within the level 2 runtime cons…
lo-simon Feb 27, 2024
201374d
Add nc_ident_beacon resource type
lo-simon Feb 27, 2024
64e2187
Tidy up receiver_monitor, receiver_monitor_protected and ident_beacon…
lo-simon Feb 27, 2024
2484b29
Update Development/nmos/control_protocol_ws_api.cpp
lo-simon Feb 28, 2024
2bdb171
Update Development/nmos/json_fields.h
lo-simon Feb 28, 2024
bb4480a
Change varaible names and function names for better description
lo-simon Feb 29, 2024
c17ade3
Update IS-12 Readme
lo-simon Feb 29, 2024
ce176cd
Merge remote-tracking branch 'origin/master' into is-12
lo-simon Mar 1, 2024
f80caad
Update IS-12 Readme
lo-simon Mar 1, 2024
f41032a
Update Development/nmos/control_protocol_handlers.h
lo-simon Mar 5, 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
95 changes: 94 additions & 1 deletion Development/cmake/NmosCppLibraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,80 @@ target_include_directories(nmos_is10_schemas PUBLIC
list(APPEND NMOS_CPP_TARGETS nmos_is10_schemas)
add_library(nmos-cpp::nmos_is10_schemas ALIAS nmos_is10_schemas)

# nmos_is12_schemas library

set(NMOS_IS12_SCHEMAS_HEADERS
nmos/is12_schemas/is12_schemas.h
)

set(NMOS_IS12_V1_0_TAG v1.0.x)

set(NMOS_IS12_V1_0_SCHEMAS_JSON
third_party/is-12/${NMOS_IS12_V1_0_TAG}/APIs/schemas/base-message.json
third_party/is-12/${NMOS_IS12_V1_0_TAG}/APIs/schemas/command-message.json
third_party/is-12/${NMOS_IS12_V1_0_TAG}/APIs/schemas/command-response-message.json
third_party/is-12/${NMOS_IS12_V1_0_TAG}/APIs/schemas/error-message.json
third_party/is-12/${NMOS_IS12_V1_0_TAG}/APIs/schemas/event-data.json
third_party/is-12/${NMOS_IS12_V1_0_TAG}/APIs/schemas/notification-message.json
third_party/is-12/${NMOS_IS12_V1_0_TAG}/APIs/schemas/property-changed-event-data.json
third_party/is-12/${NMOS_IS12_V1_0_TAG}/APIs/schemas/subscription-message.json
third_party/is-12/${NMOS_IS12_V1_0_TAG}/APIs/schemas/subscription-response-message.json
)

set(NMOS_IS12_SCHEMAS_JSON_MATCH "third_party/is-12/([^/]+)/APIs/schemas/([^;]+)\\.json")
set(NMOS_IS12_SCHEMAS_SOURCE_REPLACE "${CMAKE_CURRENT_BINARY_DIR_REPLACE}/nmos/is12_schemas/\\1/\\2.cpp")
string(REGEX REPLACE "${NMOS_IS12_SCHEMAS_JSON_MATCH}(;|$)" "${NMOS_IS12_SCHEMAS_SOURCE_REPLACE}\\3" NMOS_IS12_V1_0_SCHEMAS_SOURCES "${NMOS_IS12_V1_0_SCHEMAS_JSON}")

foreach(JSON ${NMOS_IS12_V1_0_SCHEMAS_JSON})
string(REGEX REPLACE "${NMOS_IS12_SCHEMAS_JSON_MATCH}" "${NMOS_IS12_SCHEMAS_SOURCE_REPLACE}" SOURCE "${JSON}")
string(REGEX REPLACE "${NMOS_IS12_SCHEMAS_JSON_MATCH}" "\\1" NS "${JSON}")
string(REGEX REPLACE "${NMOS_IS12_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 is12_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_is12_schemas STATIC
${NMOS_IS12_SCHEMAS_HEADERS}
${NMOS_IS12_V1_0_SCHEMAS_SOURCES}
)

source_group("nmos\\is12_schemas\\Header Files" FILES ${NMOS_IS12_SCHEMAS_HEADERS})
source_group("nmos\\is12_schemas\\${NMOS_IS12_V1_0_TAG}\\Source Files" FILES ${NMOS_IS12_V1_0_SCHEMAS_SOURCES})

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

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

# nmos-cpp library

set(NMOS_CPP_BST_SOURCES
Expand Down Expand Up @@ -851,6 +925,13 @@ set(NMOS_CPP_NMOS_SOURCES
nmos/connection_api.cpp
nmos/connection_events_activation.cpp
nmos/connection_resources.cpp
nmos/control_protocol_handlers.cpp
nmos/control_protocol_methods.cpp
nmos/control_protocol_resource.cpp
nmos/control_protocol_resources.cpp
nmos/control_protocol_state.cpp
nmos/control_protocol_utils.cpp
nmos/control_protocol_ws_api.cpp
nmos/did_sdid.cpp
nmos/events_api.cpp
nmos/events_resources.cpp
Expand Down Expand Up @@ -937,6 +1018,16 @@ set(NMOS_CPP_NMOS_HEADERS
nmos/connection_api.h
nmos/connection_events_activation.h
nmos/connection_resources.h
nmos/control_protocol_handlers.h
nmos/control_protocol_methods.h
nmos/control_protocol_nmos_channel_mapping_resource_type.h
nmos/control_protocol_nmos_resource_type.h
nmos/control_protocol_resource.h
nmos/control_protocol_resources.h
nmos/control_protocol_state.h
nmos/control_protocol_typedefs.h
nmos/control_protocol_utils.h
nmos/control_protocol_ws_api.h
nmos/device_type.h
nmos/did_sdid.h
nmos/event_type.h
Expand All @@ -956,6 +1047,7 @@ set(NMOS_CPP_NMOS_HEADERS
nmos/is08_versions.h
nmos/is09_versions.h
nmos/is10_versions.h
nmos/is12_versions.h
nmos/issuers.h
nmos/json_fields.h
nmos/json_schema.h
Expand Down Expand Up @@ -1105,12 +1197,13 @@ target_link_libraries(
nmos-cpp::nmos_is08_schemas
nmos-cpp::nmos_is09_schemas
nmos-cpp::nmos_is10_schemas
nmos-cpp::nmos_is12_schemas
nmos-cpp::mdns
nmos-cpp::slog
nmos-cpp::OpenSSL
nmos-cpp::cpprestsdk
nmos-cpp::Boost
nmos-cpp::jwt-cpp
nmos-cpp::jwt-cpp
)
target_link_libraries(
nmos-cpp PRIVATE
Expand Down
1 change: 1 addition & 0 deletions Development/cmake/NmosCppTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ set(NMOS_CPP_TEST_NMOS_TEST_SOURCES
nmos/test/api_utils_test.cpp
nmos/test/capabilities_test.cpp
nmos/test/channels_test.cpp
nmos/test/control_protocol_test.cpp
nmos/test/did_sdid_test.cpp
nmos/test/event_type_test.cpp
nmos/test/json_validator_test.cpp
Expand Down
16 changes: 16 additions & 0 deletions Development/nmos-cpp-node/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@
//"channelmapping_port": 3215,
// system_port [node]: used to construct request URLs for the System API (if not discovered via DNS-SD)
//"system_port": 10641,
// control_protocol_ws_port [node]: used to construct request URLs for the Control Protocol websocket, or negative to disable the control protocol features
//"control_protocol_ws_port": 3218,

// listen_backlog [registry, node]: the maximum length of the queue of pending connections, or zero for the implementation default (the implementation may not honour this value)
//"listen_backlog": 0,
Expand Down Expand Up @@ -367,5 +369,19 @@
// If the Resource Server fails to verify a token using all public keys available it MUST reject the token."
//"service_unavailable_retry_after": 5,

// manufacturer_name [node]: the manufacturer name of the NcDeviceManager used for NMOS Control Protocol
lo-simon marked this conversation as resolved.
Show resolved Hide resolved
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncdevicemanager
//"manufacturer_name": "",

// product_name/product_key/product_revision_level [node]: the product description of the NcDeviceManager used for NMOS Control Protocol
lo-simon marked this conversation as resolved.
Show resolved Hide resolved
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncproduct
//"product_name": "",
//"product_key": "",
//"product_revision_level": "",

// serial_number [node]: the serial number of the NcDeviceManager used for NMOS Control Protocol
lo-simon marked this conversation as resolved.
Show resolved Hide resolved
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncdevicemanager
//"serial_number": "",

"don't worry": "about trailing commas"
}
15 changes: 13 additions & 2 deletions Development/nmos-cpp-node/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "nmos/server_utils.h" // for make_http_listener_config
#include "node_implementation.h"

#include "nmos/control_protocol_state.h"

int main(int argc, char* argv[])
{
// Construct our data models including mutexes to protect them
Expand Down Expand Up @@ -116,7 +118,7 @@ int main(int argc, char* argv[])
#endif

// only implement communication with Authorization server if IS-10/BCP-003-02 is required
// cf. preprocessor conditions in nmos::make_node_api, nmos::make_connection_api, nmos::make_events_api, nmos::make_channelmapping_api, make_events_ws_validate_handler
// cf. preprocessor conditions in nmos::make_node_api, nmos::make_connection_api, nmos::make_events_api, nmos::make_channelmapping_api, make_events_ws_validate_handler, make_control_protocol_ws_validate_handler
nmos::experimental::authorization_state authorization_state;
if (nmos::experimental::fields::server_authorization(node_model.settings))
{
Expand All @@ -134,13 +136,22 @@ 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;
if (0 <= nmos::fields::control_protocol_ws_port(node_model.settings))
{
node_implementation
.on_get_control_class(nmos::make_get_control_protocol_class_handler(control_protocol_state))
.on_get_control_datatype(nmos::make_get_control_protocol_datatype_handler(control_protocol_state))
.on_get_control_protocol_method(nmos::make_get_control_protocol_method_handler(control_protocol_state));
}

// Set up the node server

auto node_server = nmos::experimental::make_node_server(node_model, node_implementation, log_model, gate);

// Add the underlying implementation, which will set up the node resources, etc.

node_server.thread_functions.push_back([&] { node_implementation_thread(node_model, gate); });
node_server.thread_functions.push_back([&] { node_implementation_thread(node_model, control_protocol_state, gate); });

// only implement communication with OCSP server if http_listener supports OCSP stapling
// cf. preprocessor conditions in nmos::make_http_listener_config
Expand Down
Loading
Loading