RAVENNAKIT
Loading...
Searching...
No Matches
rav::nmos::Node Class Reference

Implements the NMOS node as defined in the NMOS specifications. More...

#include <nmos_node.hpp>

Inheritance diagram for rav::nmos::Node:
rav::ptp::Instance::Subscriber

Classes

struct  Configuration
 The configuration of the NMOS node. More...
struct  StatusInfo

Public Types

enum class  Status {
  disabled , discovering , connecting , connected ,
  registered , p2p , error
}

Public Member Functions

 Node (boost::asio::io_context &io_context, ptp::Instance &ptp_instance, std::unique_ptr< RegistryBrowserBase > registry_browser=nullptr, std::unique_ptr< HttpClientBase > http_client=nullptr)
 ~Node () override
boost::system::result< void, Error > start ()
 Starts the services of this node (HTTP server, advertisements, etc.).
void stop ()
 Stops all the operations of this node (HTTP server, advertisements, etc.).
tl::expected< void, Error > set_configuration (Configuration new_configuration, bool force_update=false)
 Sets the configuration of the NMOS node.
const Configuration & get_configuration () const
boost::asio::ip::tcp::endpoint get_local_endpoint () const
bool add_or_update_device (Device *device)
 Adds the given device to the node or updates an existing device if it already exists (based on the uuid).
const Device * find_device (const boost::uuids::uuid &uuid) const
 Finds a device by its uuid.
bool remove_device (Device *device)
 Removes a device from the node by its uuid.
bool add_or_update_flow (FlowAudioRaw *flow)
 Adds the given flow to the node or updates an existing flow if it already exists (based on the uuid).
const FlowAudioRaw * find_flow (const boost::uuids::uuid &uuid) const
 Finds a flow by its uuid.
bool remove_flow (FlowAudioRaw *flow)
 Removes a flow from the node by its uuid.
bool add_or_update_receiver (ReceiverAudio *receiver)
 Adds the given receiver to the node or updates an existing receiver if it already exists (based on the uuid).
const ReceiverAudio * find_receiver (const boost::uuids::uuid &uuid) const
 Finds a receiver by its uuid.
bool remove_receiver (ReceiverAudio *receiver)
 Removes a receiver from the node by its uuid.
bool add_or_update_sender (Sender *sender)
 Adds the given sender to the node or updates an existing sender if it already exists (based on the uuid).
Sender * find_sender (const boost::uuids::uuid &uuid) const
 Finds a sender by its uuid.
bool remove_sender (Sender *sender)
 Removes a sender from the node by its uuid.
bool add_or_update_source (SourceAudio *source)
 Adds the given source to the node or updates an existing source if it already exists (based on the uuid).
const SourceAudio * find_source (const boost::uuids::uuid &uuid) const
 Finds a source by its uuid.
bool remove_source (SourceAudio *source)
 Removes a source from the node by its uuid.
const boost::uuids::uuid & get_uuid () const
const std::vector< Device * > & get_devices () const
const std::vector< FlowAudioRaw * > & get_flows () const
const std::vector< ReceiverAudio * > & get_receivers () const
const std::vector< Sender * > & get_senders () const
const std::vector< SourceAudio * > & get_sources () const
const Status & get_status () const
const StatusInfo & get_registry_info () const
void set_network_interface_config (NetworkInterfaceConfig config)
 Updates the node based on given network interface configuration.
void ptp_parent_changed (const ptp::ParentDs &parent) override
 Called when the parent of the PTP instance changes.
void ptp_port_changed_state (const ptp::Port &port) override
 Called when the state of a port changes.
Public Member Functions inherited from rav::ptp::Instance::Subscriber
virtual ~Subscriber ()=default
virtual void ptp_port_removed (const uint16_t port_number)
 Called when a port was removed.
virtual void ptp_configuration_updated (const Configuration &config)
 Called when the configuration was updated.
virtual void ptp_stats_updated (const Stats &ptp_stats)
 Called at a regular interval when the PTP stats are updated.
const LocalClock & get_local_clock ()

Static Public Member Functions

static std::optional< size_t > index_of_supported_api_version (const ApiVersion &version)

Public Attributes

SafeFunction< void(const Status &status, const StatusInfo &status_info)> on_status_changed
SafeFunction< void(const Configuration &config)> on_configuration_changed

Static Public Attributes

static std::array< ApiVersion, 2 > k_node_api_versions
static std::array< ApiVersion, 2 > k_connection_api_versions
static constexpr auto k_default_timeout = std::chrono::milliseconds(2000)
static constexpr auto k_internal_clock_name = "clk0"
static constexpr auto k_ptp_clock_name = "clk1"

Detailed Description

Implements the NMOS node as defined in the NMOS specifications.

https://specs.amwa.tv/nmos/branches/main/docs/Technical_Overview.html#nmos-model-and-terminology

Definition at line 55 of file nmos_node.hpp.

Member Enumeration Documentation

◆ Status

enum class rav::nmos::Node::Status
strong
Enumerator
disabled 
discovering 
connecting 
connected 
registered 
p2p 
error 

Definition at line 113 of file nmos_node.hpp.

Constructor & Destructor Documentation

◆ Node()

rav::nmos::Node::Node ( boost::asio::io_context & io_context,
ptp::Instance & ptp_instance,
std::unique_ptr< RegistryBrowserBase > registry_browser = nullptr,
std::unique_ptr< HttpClientBase > http_client = nullptr )
explicit

◆ ~Node()

rav::nmos::Node::~Node ( )
override

Member Function Documentation

◆ add_or_update_device()

bool rav::nmos::Node::add_or_update_device ( Device * device)
nodiscard

Adds the given device to the node or updates an existing device if it already exists (based on the uuid).

The node if of the device is set to the node's uuid.

Parameters
deviceThe device to set or update.

◆ add_or_update_flow()

bool rav::nmos::Node::add_or_update_flow ( FlowAudioRaw * flow)
nodiscard

Adds the given flow to the node or updates an existing flow if it already exists (based on the uuid).

Parameters
flowThe flow to set.
Returns
True if the flow was set successfully, false otherwise.

◆ add_or_update_receiver()

bool rav::nmos::Node::add_or_update_receiver ( ReceiverAudio * receiver)
nodiscard

Adds the given receiver to the node or updates an existing receiver if it already exists (based on the uuid).

Parameters
receiverThe receiver to set.
Returns
True if the receiver was set successfully, false otherwise.

◆ add_or_update_sender()

bool rav::nmos::Node::add_or_update_sender ( Sender * sender)
nodiscard

Adds the given sender to the node or updates an existing sender if it already exists (based on the uuid).

Parameters
senderThe sender to set.
Returns
True if the sender was set successfully, false otherwise.

◆ add_or_update_source()

bool rav::nmos::Node::add_or_update_source ( SourceAudio * source)
nodiscard

Adds the given source to the node or updates an existing source if it already exists (based on the uuid).

Parameters
sourceThe source to set.
Returns
True if the source was set successfully, false otherwise.

◆ find_device()

const Device * rav::nmos::Node::find_device ( const boost::uuids::uuid & uuid) const
nodiscard

Finds a device by its uuid.

Parameters
uuidThe uuid of the device to find.
Returns
A pointer to the device if found, or nullptr if not found.

◆ find_flow()

const FlowAudioRaw * rav::nmos::Node::find_flow ( const boost::uuids::uuid & uuid) const
nodiscard

Finds a flow by its uuid.

Parameters
uuidThe uuid of the flow to find.
Returns
A pointer to the flow if found, or nullptr if not found.

◆ find_receiver()

const ReceiverAudio * rav::nmos::Node::find_receiver ( const boost::uuids::uuid & uuid) const
nodiscard

Finds a receiver by its uuid.

Parameters
uuidThe uuid of the receiver to find.
Returns
A pointer to the receiver if found, or nullptr if not found.

◆ find_sender()

Sender * rav::nmos::Node::find_sender ( const boost::uuids::uuid & uuid) const
nodiscard

Finds a sender by its uuid.

Parameters
uuidThe uuid of the sender to find.
Returns
A pointer to the sender if found, or nullptr if not found.

◆ find_source()

const SourceAudio * rav::nmos::Node::find_source ( const boost::uuids::uuid & uuid) const
nodiscard

Finds a source by its uuid.

Parameters
uuidThe uuid of the source to find.
Returns
A pointer to the source if found, or nullptr if not found.

◆ get_configuration()

const Configuration & rav::nmos::Node::get_configuration ( ) const
nodiscard
Returns
The current configuration of the NMOS node.

◆ get_devices()

const std::vector< Device * > & rav::nmos::Node::get_devices ( ) const
nodiscard
Returns
The list of devices in the node.

◆ get_flows()

const std::vector< FlowAudioRaw * > & rav::nmos::Node::get_flows ( ) const
nodiscard
Returns
The list of flows in the node.

◆ get_local_endpoint()

boost::asio::ip::tcp::endpoint rav::nmos::Node::get_local_endpoint ( ) const
nodiscard
Returns
The local (listening) endpoint of the server.

◆ get_receivers()

const std::vector< ReceiverAudio * > & rav::nmos::Node::get_receivers ( ) const
nodiscard
Returns
The list of receivers in the node.

◆ get_registry_info()

const StatusInfo & rav::nmos::Node::get_registry_info ( ) const
nodiscard
Returns
The current registry information.

◆ get_senders()

const std::vector< Sender * > & rav::nmos::Node::get_senders ( ) const
nodiscard
Returns
The list of senders in the node.

◆ get_sources()

const std::vector< SourceAudio * > & rav::nmos::Node::get_sources ( ) const
nodiscard
Returns
The list of sources in the node.

◆ get_status()

const Status & rav::nmos::Node::get_status ( ) const
nodiscard
Returns
The current state.

◆ get_uuid()

const boost::uuids::uuid & rav::nmos::Node::get_uuid ( ) const
nodiscard
Returns
The uuid of the node.

◆ index_of_supported_api_version()

std::optional< size_t > rav::nmos::Node::index_of_supported_api_version ( const ApiVersion & version)
staticnodiscard
Parameters
versionThe API version to check.
Returns
The index of the supported API version if it exists, or std::nullopt if not found.

◆ ptp_parent_changed()

void rav::nmos::Node::ptp_parent_changed ( const ptp::ParentDs & parent)
overridevirtual

Called when the parent of the PTP instance changes.

Parameters
parentThe new parent data set.

Reimplemented from rav::ptp::Instance::Subscriber.

◆ ptp_port_changed_state()

void rav::nmos::Node::ptp_port_changed_state ( const ptp::Port & port)
overridevirtual

Called when the state of a port changes.

Parameters
portThe port that changed state.

Reimplemented from rav::ptp::Instance::Subscriber.

◆ remove_device()

bool rav::nmos::Node::remove_device ( Device * device)
nodiscard

Removes a device from the node by its uuid.

Resources associated with the device will be removed as well.

Parameters
deviceThe uuid of the device to remove.
Returns
True if the device was removed successfully, false otherwise.

◆ remove_flow()

bool rav::nmos::Node::remove_flow ( FlowAudioRaw * flow)
nodiscard

Removes a flow from the node by its uuid.

Parameters
flowThe uuid of the flow to remove.
Returns
True if the flow was removed successfully, false otherwise.

◆ remove_receiver()

bool rav::nmos::Node::remove_receiver ( ReceiverAudio * receiver)
nodiscard

Removes a receiver from the node by its uuid.

Parameters
receiverThe uuid of the receiver to remove.
Returns
True if the device was removed successfully, false otherwise.

◆ remove_sender()

bool rav::nmos::Node::remove_sender ( Sender * sender)
nodiscard

Removes a sender from the node by its uuid.

Parameters
senderThe uuid of the sender to remove.
Returns
True if the sender was removed successfully, false otherwise.

◆ remove_source()

bool rav::nmos::Node::remove_source ( SourceAudio * source)
nodiscard

Removes a source from the node by its uuid.

Parameters
sourceThe uuid of the source to remove.
Returns
True if the source was removed successfully, false otherwise.

◆ set_configuration()

tl::expected< void, Error > rav::nmos::Node::set_configuration ( Configuration new_configuration,
bool force_update = false )
nodiscard

Sets the configuration of the NMOS node.

Parameters
new_configurationThe configuration to update.
force_updateWhether to force the update even if the configuration didn't change.

◆ set_network_interface_config()

void rav::nmos::Node::set_network_interface_config ( NetworkInterfaceConfig config)

Updates the node based on given network interface configuration.

Parameters
configThe network interface configuration to apply.

◆ start()

boost::system::result< void, Error > rav::nmos::Node::start ( )
nodiscard

Starts the services of this node (HTTP server, advertisements, etc.).

Returns
An error code if the node fails to start, or an empty result if it succeeds.

◆ stop()

void rav::nmos::Node::stop ( )

Stops all the operations of this node (HTTP server, advertisements, etc.).

Member Data Documentation

◆ k_connection_api_versions

std::array<ApiVersion, 2> rav::nmos::Node::k_connection_api_versions
static

Definition at line 58 of file nmos_node.hpp.

◆ k_default_timeout

auto rav::nmos::Node::k_default_timeout = std::chrono::milliseconds(2000)
staticconstexpr

Definition at line 59 of file nmos_node.hpp.

◆ k_internal_clock_name

auto rav::nmos::Node::k_internal_clock_name = "clk0"
staticconstexpr

Definition at line 60 of file nmos_node.hpp.

◆ k_node_api_versions

std::array<ApiVersion, 2> rav::nmos::Node::k_node_api_versions
static

Definition at line 57 of file nmos_node.hpp.

◆ k_ptp_clock_name

auto rav::nmos::Node::k_ptp_clock_name = "clk1"
staticconstexpr

Definition at line 61 of file nmos_node.hpp.

◆ on_configuration_changed

SafeFunction<void(const Configuration& config)> rav::nmos::Node::on_configuration_changed

Definition at line 116 of file nmos_node.hpp.

◆ on_status_changed

SafeFunction<void(const Status& status, const StatusInfo& status_info)> rav::nmos::Node::on_status_changed

Definition at line 115 of file nmos_node.hpp.


The documentation for this class was generated from the following file: