20#ifndef SACN_CPP_MERGE_RECEIVER_H_
21#define SACN_CPP_MERGE_RECEIVER_H_
129 ETCPAL_UNUSED_ARG(
handle);
130 ETCPAL_UNUSED_ARG(universe);
247 if (context && merged_data)
257 if (context && source_addr && source_info && universe_data)
259 static_cast<MergeReceiver::NotifyHandler*
>(context)->HandleNonDmxData(MergeReceiver::Handle(receiver_handle),
260 *source_addr, *source_info, *universe_data);
264extern "C" inline void MergeReceiverCbSourceLimitExceeded(
sacn_merge_receiver_t handle, uint16_t universe,
269 static_cast<MergeReceiver::NotifyHandler*
>(context)->HandleSourceLimitExceeded(MergeReceiver::Handle(handle),
292 return (universe_id > 0) && (footprint.start_address >= 1) && (footprint.start_address <=
DMX_ADDRESS_COUNT) &&
293 (footprint.address_count >= 1) &&
303 :
handle(merge_receiver_handle)
332 return Startup(settings, notify_handler, netints);
483 size_t size_guess = 4u;
484 size_t num_netints = 0u;
488 netints.
resize(size_guess);
490 size_guess = num_netints + 4u;
491 }
while (num_netints > netints.
size());
493 netints.
resize(num_netints);
577 if (sys_netints.
empty())
617 netint_lists_c.
reserve(per_receiver_netint_lists.
size());
621 SacnMergeReceiverNetintList c_list = {
633 netint_lists_c.size());
646inline SacnMergeReceiverConfig MergeReceiver::TranslateConfig(
const Settings& settings, NotifyHandler& notify_handler)
652 internal::MergeReceiverCbMergedData,
653 internal::MergeReceiverCbNonDmx,
654 internal::MergeReceiverCbSourceLimitExceeded,
658 settings.source_count_max,
660 settings.ip_supported
T back_inserter(T... args)
ETCPAL_CONSTEXPR_14 void Clear()
ETCPAL_CONSTEXPR_14 void SetValue(const ValueType &new_value)
constexpr ValueType value() const
A base class for a class that receives notification callbacks from a sACN merge receiver.
Definition merge_receiver.h:71
virtual void HandleMergedData(Handle handle, const SacnRecvMergedData &merged_data)=0
Notify that a new data packet has been received and merged.
virtual void HandleSourceLimitExceeded(Handle handle, uint16_t universe)
Notify that more than the configured maximum number of sources are currently sending on the universe ...
Definition merge_receiver.h:127
virtual void HandleNonDmxData(Handle receiver_handle, const etcpal::SockAddr &source_addr, const SacnRemoteSource &source_info, const SacnRecvUniverseData &universe_data)=0
Notify that a non-data packet has been received.
An instance of sACN Merge Receiver functionality; see Using the sACN Merge Receiver API.
Definition merge_receiver.h:61
static etcpal::Error ResetNetworking()
Resets the underlying network sockets and packet receipt state for all sACN merge receivers.
Definition merge_receiver.h:546
std::vector< EtcPalMcastNetintId > GetNetworkInterfaces()
Obtain a vector of this merge receiver's network interfaces.
Definition merge_receiver.h:479
etcpal::Expected< uint16_t > GetUniverse() const
Get the universe this merge receiver is listening to.
Definition merge_receiver.h:397
etcpal::Error ChangeFootprint(const SacnRecvUniverseSubrange &new_footprint)
Change the footprint within the universe this merge receiver is listening to. TODO: Not yet implement...
Definition merge_receiver.h:453
MergeReceiver & operator=(MergeReceiver &&other)=default
constexpr Handle handle() const
Get the current handle to the underlying C merge receiver.
Definition merge_receiver.h:641
etcpal::Error ChangeUniverse(uint16_t new_universe_id)
Change the universe this class is listening to.
Definition merge_receiver.h:439
etcpal::Expected< SacnRecvUniverseSubrange > GetFootprint() const
Get the footprint within the universe this merge receiver is listening to.
Definition merge_receiver.h:414
etcpal::Expected< Source > GetSource(sacn_remote_source_t source_handle)
Gets a copy of the information for the specified merge receiver source.
Definition merge_receiver.h:507
etcpal::Error Startup(const Settings &settings, NotifyHandler ¬ify_handler)
Start listening for sACN data on a universe.
Definition merge_receiver.h:329
etcpal::Error ChangeUniverseAndFootprint(uint16_t new_universe_id, const SacnRecvUniverseSubrange &new_footprint)
Change the universe and footprint this merge receiver is listening to. TODO: Not yet implemented.
Definition merge_receiver.h:468
void Shutdown()
Stop listening for sACN data on a universe.
Definition merge_receiver.h:386
MergeReceiver(MergeReceiver &&other)=default
Definition merge_receiver.h:47
C++ wrapper for the sACN init/deinit functions.
sacn_ip_support_t
Definition common.h:71
uint16_t sacn_remote_source_t
Definition common.h:58
#define DMX_ADDRESS_COUNT
Definition common.h:55
@ kSacnIpV4AndIpV6
Definition common.h:77
etcpal_error_t sacn_merge_receiver_reset_networking(const SacnNetintConfig *sys_netint_config)
Resets underlying network sockets and packet receipt state, determines network interfaces for all mer...
Definition merge_receiver.c:376
size_t sacn_merge_receiver_get_network_interfaces(sacn_merge_receiver_t handle, EtcPalMcastNetintId *netints, size_t netints_size)
Obtain a list of a merge receiver's network interfaces.
Definition merge_receiver.c:472
etcpal_error_t sacn_merge_receiver_destroy(sacn_merge_receiver_t handle)
Destroy a sACN Merge Receiver instance.
Definition merge_receiver.c:182
etcpal_error_t sacn_merge_receiver_change_footprint(sacn_merge_receiver_t handle, const SacnRecvUniverseSubrange *new_footprint)
Change the footprint within the universe on which an sACN receiver is listening. TODO: Not yet implem...
Definition merge_receiver.c:322
etcpal_error_t sacn_merge_receiver_reset_networking_per_receiver(const SacnNetintConfig *sys_netint_config, const SacnMergeReceiverNetintList *per_receiver_netint_lists, size_t num_per_receiver_netint_lists)
Resets underlying network sockets and packet receipt state, determines network interfaces for each me...
Definition merge_receiver.c:413
etcpal_error_t sacn_merge_receiver_get_footprint(sacn_merge_receiver_t handle, SacnRecvUniverseSubrange *footprint)
Get the footprint within the universe on which a sACN Merge Receiver is currently listening.
Definition merge_receiver.c:245
etcpal_error_t sacn_merge_receiver_get_universe(sacn_merge_receiver_t handle, uint16_t *universe_id)
Get the universe on which a sACN Merge Receiver is currently listening.
Definition merge_receiver.c:226
etcpal_error_t sacn_merge_receiver_get_source(sacn_merge_receiver_t merge_receiver_handle, sacn_remote_source_t source_handle, SacnMergeReceiverSource *source_info)
Gets a copy of the information for the specified merge receiver source.
Definition merge_receiver.c:491
etcpal_error_t sacn_merge_receiver_change_universe(sacn_merge_receiver_t handle, uint16_t new_universe_id)
Change the universe on which a sACN Merge Receiver is listening.
Definition merge_receiver.c:268
etcpal_error_t sacn_merge_receiver_create(const SacnMergeReceiverConfig *config, sacn_merge_receiver_t *handle, const SacnNetintConfig *netint_config)
Create a new sACN Merge Receiver to listen and merge sACN data on a universe.
Definition merge_receiver.c:88
etcpal_error_t sacn_merge_receiver_change_universe_and_footprint(sacn_merge_receiver_t handle, uint16_t new_universe_id, const SacnRecvUniverseSubrange *new_footprint)
Change the universe and footprint on which an sACN merge receiver is listening. TODO: Not yet impleme...
Definition merge_receiver.c:342
int sacn_merge_receiver_t
Definition merge_receiver.h:53
#define SACN_MERGE_RECEIVER_INVALID
Definition merge_receiver.h:55
#define SACN_RECEIVER_INFINITE_SOURCES
Constant for "infinite" when listening or merging sACN universes.
Definition receiver.h:68
sACN Merge Receiver API definitions
A namespace which contains all C++ language definitions in the sACN library.
Definition common.h:50
Definition merge_receiver.h:158
uint16_t universe_id
Definition merge_receiver.h:162
Definition merge_receiver.h:206
EtcPalUuid cid
Definition merge_receiver.h:210
EtcPalSockAddr addr
Definition merge_receiver.h:214
char name[SACN_SOURCE_NAME_MAX_LEN]
Definition merge_receiver.h:212
sacn_remote_source_t handle
Definition merge_receiver.h:208
Definition merge_receiver.h:61
Definition receiver.h:124
A set of network interfaces for a particular merge receiver.
Definition merge_receiver.h:178
std::vector< SacnMcastInterface > netints
Definition merge_receiver.h:184
sacn_merge_receiver_t handle
Definition merge_receiver.h:180
A set of configuration settings that a merge receiver needs to initialize.
Definition merge_receiver.h:139
SacnRecvUniverseSubrange footprint
Definition merge_receiver.h:148
uint16_t universe_id
Definition merge_receiver.h:143
int source_count_max
Definition merge_receiver.h:151
sacn_ip_support_t ip_supported
Definition merge_receiver.h:160
bool IsValid() const
Definition merge_receiver.h:290
bool use_pap
Definition merge_receiver.h:157
Information about a remote sACN source being tracked by a merge receiver.
Definition merge_receiver.h:196
etcpal::SockAddr addr
Definition merge_receiver.h:204
std::string name
Definition merge_receiver.h:202
etcpal::Uuid cid
Definition merge_receiver.h:200
sacn_remote_source_t handle
Definition merge_receiver.h:198