Skip to content

Added function to allow for unicasting to specific IP address #23

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion artnet/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

AM_CFLAGS = -I$(top_builddir) -I$(top_srcdir) -Wall -Werror -Wformat -W
AM_CFLAGS = -I$(top_builddir) -I$(top_srcdir) -Wall -Wformat -W

EXTRA_DIST = tod.h misc.h

Expand Down
49 changes: 49 additions & 0 deletions artnet/artnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,55 @@ int artnet_send_poll_reply(artnet_node vn) {
return artnet_tx_poll_reply(n, FALSE);
}

int artnet_send_dmx_to_addr(artnet_node vn, int port_id, int16_t length, const uint8_t *data, uint32_t address) {
node n = vn;
artnet_packet_t p;
input_port_t *port;

check_nullnode(vn);

if (n->state.mode != ARTNET_ON) {
return ARTNET_EACTION;
}
if (port_id < 0 || port_id >= ARTNET_MAX_PORTS) {
artnet_error("%s : port index out of bounds (%i < 0 || %i > ARTNET_MAX_PORTS)", __FUNCTION__, port_id);
return ARTNET_EARG;
}
port = &n->ports.in[port_id];

if (length < 1 || length > ARTNET_DMX_LENGTH) {
artnet_error("%s : Length of dmx data out of bounds (%i < 1 || %i > ARTNET_MAX_DMX)", __FUNCTION__, length);
return ARTNET_EARG;
}

if (port->port_status & PORT_STATUS_DISABLED_MASK) {
artnet_error("%s : attempt to send on a disabled port (id:%i)", __FUNCTION__, port_id);
return ARTNET_EARG;
}

// ok we're going to send now, make sure we turn the activity bit on
port->port_status = port->port_status | PORT_STATUS_ACT_MASK;

p.length = sizeof(artnet_dmx_t) - (ARTNET_DMX_LENGTH - length);

// now build packet
memcpy(&p.data.admx.id, ARTNET_STRING, ARTNET_STRING_SIZE);
p.data.admx.opCode = htols(ARTNET_DMX);
p.data.admx.verH = 0;
p.data.admx.ver = ARTNET_VERSION;
p.data.admx.sequence = port->seq;
p.data.admx.physical = port_id;
p.data.admx.universe = htols(port->port_addr);

// set length
p.data.admx.lengthHi = short_get_high_byte(length);
p.data.admx.length = short_get_low_byte(length);
memcpy(&p.data.admx.data, data, length);

p.to.s_addr = address;
artnet_net_send(n, &p);
return ARTNET_EOK;
}

/*
* Sends some dmx data
Expand Down
2 changes: 2 additions & 0 deletions artnet/artnet.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ EXTERN int artnet_send_poll(artnet_node n,
const char *ip,
artnet_ttm_value_t talk_to_me);
EXTERN int artnet_send_poll_reply(artnet_node n);
EXTERN int artnet_send_dmx_to_addr(artnet_node n,
int port_id, int16_t length, const uint8_t *data, uint32_t address);
EXTERN int artnet_send_dmx(artnet_node n,
int port_id,
int16_t length,
Expand Down
2 changes: 1 addition & 1 deletion artnet/transmit.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ int artnet_tx_tod_data(node n, int id) {
bloc = 0;

while (remaining > 0) {
memset(&tod.data.toddata.tod,0x00, ARTNET_MAX_UID_COUNT);
memset(&tod.data.toddata.tod,0x00, ARTNET_MAX_UID_COUNT * ARTNET_RDM_UID_WIDTH);
lim = min(ARTNET_MAX_UID_COUNT, remaining);
tod.data.toddata.blockCount = bloc++;
tod.data.toddata.uidCount = lim;
Expand Down
9 changes: 9 additions & 0 deletions debian-preinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
echo "Installing autoconf and libtool"
apt update && apt install -y autoconf libtool
echo "Running autoreconf"
autoreconf -fi
echo "Running configure"
./configure
echo "Compiling libartnet"
make -j18
echo "Run make install to install library on system"