20#ifndef SACN_CPP_RECEIVER_H_
21#define SACN_CPP_RECEIVER_H_
120 ETCPAL_UNUSED_ARG(
handle);
121 ETCPAL_UNUSED_ARG(universe);
131 ETCPAL_UNUSED_ARG(
handle);
132 ETCPAL_UNUSED_ARG(universe);
143 ETCPAL_UNUSED_ARG(
handle);
144 ETCPAL_UNUSED_ARG(universe);
145 ETCPAL_UNUSED_ARG(source);
156 ETCPAL_UNUSED_ARG(
handle);
157 ETCPAL_UNUSED_ARG(universe);
257 if (source_addr && source_info && universe_data && context)
260 *source_info, *universe_data);
264extern "C" inline void ReceiverCbSourcesLost(
sacn_receiver_t handle, uint16_t universe,
265 const SacnLostSource* lost_sources,
size_t num_lost_sources,
void* context)
267 if (context && lost_sources && (num_lost_sources > 0))
270 static_cast<Receiver::NotifyHandler*
>(context)->HandleSourcesLost(Receiver::Handle(handle), universe, lost_vec);
274extern "C" inline void ReceiverCbSamplingPeriodStarted(
sacn_receiver_t handle, uint16_t universe,
void* context)
278 static_cast<Receiver::NotifyHandler*
>(context)->HandleSamplingPeriodStarted(Receiver::Handle(handle), universe);
282extern "C" inline void ReceiverCbSamplingPeriodEnded(
sacn_receiver_t handle, uint16_t universe,
void* context)
286 static_cast<Receiver::NotifyHandler*
>(context)->HandleSamplingPeriodEnded(Receiver::Handle(handle), universe);
293 if (context && source)
295 static_cast<Receiver::NotifyHandler*
>(context)->HandleSourcePapLost(Receiver::Handle(handle), universe, *source);
299extern "C" inline void ReceiverCbSourceLimitExceeded(
sacn_receiver_t handle, uint16_t universe,
void* context)
303 static_cast<Receiver::NotifyHandler*
>(context)->HandleSourceLimitExceeded(Receiver::Handle(handle), universe);
327 return (universe_id > 0) && (footprint.start_address >= 1) && (footprint.start_address <=
DMX_ADDRESS_COUNT) &&
328 (footprint.address_count >= 1) &&
366 return Startup(settings, notify_handler, netints);
525 size_t size_guess = 4u;
526 size_t num_netints = 0u;
530 netints.
resize(size_guess);
532 size_guess = num_netints + 4u;
533 }
while (num_netints > netints.
size());
535 netints.
resize(num_netints);
620 if (sys_netints.
empty())
659 netint_lists_c.
reserve(per_receiver_netint_lists.
size());
663 SacnReceiverNetintList c_list = {
673 SacnNetintConfig sys_netint_config = {sys_netints.data(), sys_netints.size()};
687inline SacnReceiverConfig Receiver::TranslateConfig(
const Settings& settings, NotifyHandler& notify_handler)
693 internal::ReceiverCbUniverseData,
694 internal::ReceiverCbSourcesLost,
695 internal::ReceiverCbSamplingPeriodStarted,
696 internal::ReceiverCbSamplingPeriodEnded,
697 internal::ReceiverCbPapLost,
698 internal::ReceiverCbSourceLimitExceeded,
702 settings.source_count_max,
704 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 receiver.
Definition receiver.h:72
virtual void HandleUniverseData(Handle receiver_handle, const etcpal::SockAddr &source_addr, const SacnRemoteSource &source_info, const SacnRecvUniverseData &universe_data)=0
Notify that new universe data within the configured footprint has been received.
virtual void HandleSamplingPeriodStarted(Handle handle, uint16_t universe)
Notify that a receiver's sampling period has begun.
Definition receiver.h:118
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 receiver.h:154
virtual void HandleSourcesLost(Handle handle, uint16_t universe, const std::vector< SacnLostSource > &lost_sources)=0
Notify that one or more sources have entered a source loss state.
virtual void HandleSamplingPeriodEnded(Handle handle, uint16_t universe)
Notify that a receiver's sampling period has ended.
Definition receiver.h:129
virtual void HandleSourcePapLost(Handle handle, uint16_t universe, const SacnRemoteSource &source)
Notify that a source has stopped transmission of per-address priority packets.
Definition receiver.h:141
An instance of sACN Receiver functionality; see Using the sACN Receiver API.
Definition receiver.h:62
static uint32_t GetExpiredWait()
Get the current value of the expired notification wait time.
Definition receiver.h:562
static void SetExpiredWait(uint32_t wait_ms)
Set the expired notification wait time.
Definition receiver.h:548
static etcpal::Error ResetNetworking()
Resets the underlying network sockets and packet receipt state for all sACN receivers.
Definition receiver.h:589
std::vector< EtcPalMcastNetintId > GetNetworkInterfaces()
Obtain a vector of this receiver's network interfaces.
Definition receiver.h:521
etcpal::Expected< uint16_t > GetUniverse() const
Get the universe this receiver is listening to.
Definition receiver.h:435
Receiver & operator=(Receiver &&other)=default
etcpal::Error ChangeFootprint(const SacnRecvUniverseSubrange &new_footprint)
Change the footprint within the universe this receiver is listening to. TODO: Not yet implemented.
Definition receiver.h:494
Receiver(Receiver &&other)=default
etcpal::Error ChangeUniverse(uint16_t new_universe_id)
Change the universe this receiver is listening to.
Definition receiver.h:479
etcpal::Expected< SacnRecvUniverseSubrange > GetFootprint() const
Get the footprint within the universe this receiver is listening to.
Definition receiver.h:452
etcpal::Error Startup(const Settings &settings, NotifyHandler ¬ify_handler)
Start listening for sACN data on a universe.
Definition receiver.h:363
etcpal::Error ChangeUniverseAndFootprint(uint16_t new_universe_id, const SacnRecvUniverseSubrange &new_footprint)
Change the universe and footprint this receiver is listening to. TODO: Not yet implemented.
Definition receiver.h:510
void Shutdown()
Stop listening for sACN data on a universe.
Definition receiver.h:424
constexpr Handle handle() const
Get the current handle to the underlying C receiver.
Definition receiver.h:682
C++ wrapper for the sACN init/deinit functions.
sacn_ip_support_t
Definition common.h:71
#define DMX_ADDRESS_COUNT
Definition common.h:55
@ kSacnIpV4AndIpV6
Definition common.h:77
etcpal_error_t sacn_receiver_reset_networking_per_receiver(const SacnNetintConfig *sys_netint_config, const SacnReceiverNetintList *per_receiver_netint_lists, size_t num_per_receiver_netint_lists)
Resets underlying network sockets and packet receipt state, determines network interfaces for each re...
Definition receiver.c:418
etcpal_error_t sacn_receiver_get_footprint(sacn_receiver_t handle, SacnRecvUniverseSubrange *footprint)
Get the footprint within the universe on which a sACN receiver is currently listening.
Definition receiver.c:216
etcpal_error_t sacn_receiver_destroy(sacn_receiver_t handle)
Destroy a sACN receiver instance.
Definition receiver.c:139
etcpal_error_t sacn_receiver_reset_networking(const SacnNetintConfig *sys_netint_config)
Resets underlying network sockets and packet receipt state, determines network interfaces for all rec...
Definition receiver.c:345
size_t sacn_receiver_get_network_interfaces(sacn_receiver_t handle, EtcPalMcastNetintId *netints, size_t netints_size)
Obtain a list of a receiver's network interfaces.
Definition receiver.c:505
#define SACN_RECEIVER_INVALID
Definition receiver.h:60
etcpal_error_t sacn_receiver_change_footprint(sacn_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 receiver.c:291
etcpal_error_t sacn_receiver_change_universe(sacn_receiver_t handle, uint16_t new_universe_id)
Change the universe on which an sACN receiver is listening.
Definition receiver.c:255
uint32_t sacn_receiver_get_expired_wait()
Get the current value of the expired notification wait time.
Definition receiver.c:551
void sacn_receiver_set_expired_wait(uint32_t wait_ms)
Set the expired notification wait time.
Definition receiver.c:530
etcpal_error_t sacn_receiver_create(const SacnReceiverConfig *config, sacn_receiver_t *handle, const SacnNetintConfig *netint_config)
Create a new sACN receiver to listen for sACN data on a universe.
Definition receiver.c:92
#define SACN_RECEIVER_INFINITE_SOURCES
Constant for "infinite" when listening or merging sACN universes.
Definition receiver.h:68
etcpal_error_t sacn_receiver_get_universe(sacn_receiver_t handle, uint16_t *universe_id)
Get the universe on which a sACN receiver is currently listening.
Definition receiver.c:173
etcpal_error_t sacn_receiver_change_universe_and_footprint(sacn_receiver_t handle, uint16_t new_universe_id, const SacnRecvUniverseSubrange *new_footprint)
Change the universe and footprint on which an sACN receiver is listening. TODO: Not yet implemented.
Definition receiver.c:311
int sacn_receiver_t
Definition receiver.h:58
A namespace which contains all C++ language definitions in the sACN library.
Definition common.h:50
sACN Receiver API definitions
Definition receiver.h:135
Definition receiver.h:276
uint16_t universe_id
Definition receiver.h:280
Definition receiver.h:124
A set of network interfaces for a particular receiver.
Definition receiver.h:200
sacn_receiver_t handle
Definition receiver.h:202
std::vector< SacnMcastInterface > netints
Definition receiver.h:206
A set of configuration settings that a receiver needs to initialize.
Definition receiver.h:166
SacnRecvUniverseSubrange footprint
Definition receiver.h:174
uint16_t universe_id
Definition receiver.h:169
int source_count_max
Definition receiver.h:179
sacn_ip_support_t ip_supported
Definition receiver.h:182
bool IsValid() const
Definition receiver.h:325
unsigned int flags
Definition receiver.h:180