sACN  2.0.2
Implementation of ANSI E1.31 (Streaming ACN)
View other versions:
Loading...
Searching...
No Matches
source.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright 2022 ETC Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 ******************************************************************************
16 * This file is a part of sACN. For more information, go to:
17 * https://github.com/ETCLabs/sACN
18 *****************************************************************************/
19
28#ifndef SACN_SOURCE_H_
29#define SACN_SOURCE_H_
30
31#include <stdbool.h>
32#include <stddef.h>
33#include <stdint.h>
34#include "etcpal/error.h"
35#include "etcpal/inet.h"
36#include "etcpal/uuid.h"
37#include "sacn/common.h"
38
51#ifdef __cplusplus
52extern "C" {
53#endif
54
56typedef int sacn_source_t;
58#define SACN_SOURCE_INVALID -1
59
66#define SACN_SOURCE_INFINITE_UNIVERSES 0
67
69#define SACN_SOURCE_KEEP_ALIVE_INTERVAL_DEFAULT 800
70
72typedef struct SacnSourceConfig
73{
74 /********* Required values **********/
75
79 const char* name;
80
81 /********* Optional values **********/
82
87
92
95
100
102#define SACN_SOURCE_CONFIG_DEFAULT_INIT \
103 { \
104 kEtcPalNullUuid, NULL, SACN_SOURCE_INFINITE_UNIVERSES, false, kSacnIpV4AndIpV6, \
105 SACN_SOURCE_KEEP_ALIVE_INTERVAL_DEFAULT \
106 }
107
109
112{
113 /********* Required values **********/
114
117 uint16_t universe;
118
119 /********* Optional values **********/
120
123 uint8_t priority;
124
127
130
136
140
142
144#define SACN_SOURCE_UNIVERSE_CONFIG_DEFAULT_INIT \
145 { \
146 0, 100, false, false, NULL, 0, 0 \
147 }
148
150
165
168
169etcpal_error_t sacn_source_change_name(sacn_source_t handle, const char* new_name);
170
172 const SacnNetintConfig* netint_config);
173void sacn_source_remove_universe(sacn_source_t handle, uint16_t universe);
174size_t sacn_source_get_universes(sacn_source_t handle, uint16_t* universes, size_t universes_size);
175
177void sacn_source_remove_unicast_destination(sacn_source_t handle, uint16_t universe, const EtcPalIpAddr* dest);
178size_t sacn_source_get_unicast_destinations(sacn_source_t handle, uint16_t universe, EtcPalIpAddr* destinations,
179 size_t destinations_size);
180
181etcpal_error_t sacn_source_change_priority(sacn_source_t handle, uint16_t universe, uint8_t new_priority);
182etcpal_error_t sacn_source_change_preview_flag(sacn_source_t handle, uint16_t universe, bool new_preview_flag);
184 uint16_t new_sync_universe);
185
186etcpal_error_t sacn_source_send_now(sacn_source_t handle, uint16_t universe, uint8_t start_code, const uint8_t* buffer,
187 size_t buflen);
189
190void sacn_source_update_levels(sacn_source_t handle, uint16_t universe, const uint8_t* new_levels,
191 size_t new_levels_size);
192void sacn_source_update_levels_and_pap(sacn_source_t handle, uint16_t universe, const uint8_t* new_levels,
193 size_t new_levels_size, const uint8_t* new_priorities,
194 size_t new_priorities_size);
195void sacn_source_update_levels_and_force_sync(sacn_source_t handle, uint16_t universe, const uint8_t* new_levels,
196 size_t new_levels_size);
198 const uint8_t* new_levels, size_t new_levels_size,
199 const uint8_t* new_priorities, size_t new_priorities_size);
200
202
205 const SacnSourceUniverseNetintList* per_universe_netint_lists,
206 size_t num_per_universe_netint_lists);
207
208size_t sacn_source_get_network_interfaces(sacn_source_t handle, uint16_t universe, EtcPalMcastNetintId* netints,
209 size_t netints_size);
210
211#ifdef __cplusplus
212}
213#endif
214
219#endif /* SACN_SOURCE_H_ */
Common definitions for sACN.
etcpal_error_t
sacn_ip_support_t
Definition common.h:71
int sacn_source_process_manual(void)
Trigger the transmission of sACN packets for all universes of sources that were created with manually...
Definition source.c:990
etcpal_error_t sacn_source_change_name(sacn_source_t handle, const char *new_name)
Change the name of an sACN source.
Definition source.c:168
etcpal_error_t sacn_source_send_synchronization(sacn_source_t handle, uint16_t universe)
Indicate that a new synchronization packet should be sent on the given synchronization universe.
Definition source.c:780
etcpal_error_t sacn_source_change_priority(sacn_source_t handle, uint16_t universe, uint8_t new_priority)
Change the priority of a universe on a sACN source.
Definition source.c:554
struct SacnSourceUniverseNetintList SacnSourceUniverseNetintList
size_t sacn_source_get_unicast_destinations(sacn_source_t handle, uint16_t universe, EtcPalIpAddr *destinations, size_t destinations_size)
Obtain a list of a universe's unicast destinations.
Definition source.c:516
etcpal_error_t sacn_source_add_universe(sacn_source_t handle, const SacnSourceUniverseConfig *config, const SacnNetintConfig *netint_config)
Add a universe to an sACN source.
Definition source.c:261
void sacn_source_update_levels(sacn_source_t handle, uint16_t universe, const uint8_t *new_levels, size_t new_levels_size)
Copies the universe's DMX levels into the packet to be sent on the next threaded or manual update.
Definition source.c:804
etcpal_error_t sacn_source_add_unicast_destination(sacn_source_t handle, uint16_t universe, const EtcPalIpAddr *dest)
Add a unicast destination for a source's universe.
Definition source.c:406
etcpal_error_t sacn_source_reset_networking(const SacnNetintConfig *sys_netint_config)
Resets the underlying network sockets for all universes of all sources.
Definition source.c:1020
etcpal_error_t sacn_source_create(const SacnSourceConfig *config, sacn_source_t *handle)
Create a new sACN source to send sACN data.
Definition source.c:103
struct SacnSourceUniverseConfig SacnSourceUniverseConfig
void sacn_source_config_init(SacnSourceConfig *config)
Initialize an sACN Source Config struct to default values.
Definition source.c:53
void sacn_source_remove_unicast_destination(sacn_source_t handle, uint16_t universe, const EtcPalIpAddr *dest)
Remove a unicast destination on a source's universe.
Definition source.c:481
void sacn_source_update_levels_and_force_sync(sacn_source_t handle, uint16_t universe, const uint8_t *new_levels, size_t new_levels_size)
Like sacn_source_update_levels(), but also sets the force_sync flag on the packet.
Definition source.c:895
void sacn_source_update_levels_and_pap(sacn_source_t handle, uint16_t universe, const uint8_t *new_levels, size_t new_levels_size, const uint8_t *new_priorities, size_t new_priorities_size)
Copies the universe's DMX levels and per-address priorities into packets that are sent on the next th...
Definition source.c:852
etcpal_error_t sacn_source_send_now(sacn_source_t handle, uint16_t universe, uint8_t start_code, const uint8_t *buffer, size_t buflen)
Immediately sends the provided sACN start code & data.
Definition source.c:707
void sacn_source_universe_config_init(SacnSourceUniverseConfig *config)
Initialize an sACN Source Universe Config struct to default values.
Definition source.c:71
void sacn_source_remove_universe(sacn_source_t handle, uint16_t universe)
Remove a universe from a source.
Definition source.c:349
size_t sacn_source_get_universes(sacn_source_t handle, uint16_t *universes, size_t universes_size)
Obtain a list of a source's universes.
Definition source.c:373
etcpal_error_t sacn_source_change_preview_flag(sacn_source_t handle, uint16_t universe, bool new_preview_flag)
Change the send_preview option on a universe of a sACN source.
Definition source.c:615
void sacn_source_update_levels_and_pap_and_force_sync(sacn_source_t handle, uint16_t universe, const uint8_t *new_levels, size_t new_levels_size, const uint8_t *new_priorities, size_t new_priorities_size)
Like sacn_source_update_levels_and_pap(), but also sets the force_sync flag on the packet.
Definition source.c:948
etcpal_error_t sacn_source_change_synchronization_universe(sacn_source_t handle, uint16_t universe, uint16_t new_sync_universe)
Changes the synchronization universe for a universe of a sACN source.
Definition source.c:677
etcpal_error_t sacn_source_reset_networking_per_universe(const SacnNetintConfig *sys_netint_config, const SacnSourceUniverseNetintList *per_universe_netint_lists, size_t num_per_universe_netint_lists)
Resets the underlying network sockets and determines network interfaces for each universe of each sou...
Definition source.c:1084
int sacn_source_t
Definition source.h:56
size_t sacn_source_get_network_interfaces(sacn_source_t handle, uint16_t universe, EtcPalMcastNetintId *netints, size_t netints_size)
Obtain a list of a universe's network interfaces.
Definition source.c:1176
void sacn_source_destroy(sacn_source_t handle)
Destroy an sACN source instance.
Definition source.c:218
struct SacnSourceConfig SacnSourceConfig
Definition common.h:85
Definition common.h:102
Definition source.h:73
bool manually_process_source
Definition source.h:91
EtcPalUuid cid
Definition source.h:77
const char * name
Definition source.h:79
int keep_alive_interval
Definition source.h:98
sacn_ip_support_t ip_supported
Definition source.h:94
size_t universe_count_max
Definition source.h:86
Definition source.h:112
uint8_t priority
Definition source.h:123
uint16_t universe
Definition source.h:117
const EtcPalIpAddr * unicast_destinations
Definition source.h:133
bool send_preview
Definition source.h:126
uint16_t sync_universe
Definition source.h:139
size_t num_unicast_destinations
Definition source.h:135
bool send_unicast_only
Definition source.h:129
Definition source.h:153
uint16_t universe
Definition source.h:157
size_t num_netints
Definition source.h:163
SacnMcastInterface * netints
Definition source.h:161
sacn_source_t handle
Definition source.h:155