MCPcopy Index your code
hub / github.com/cansik/artnet4j

github.com/cansik/artnet4j @0.6.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.6.2 ↗ · + Follow
281 symbols 479 edges 30 files 64 documented · 23%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ArtNet for Java & Processing Build Status Build status

Art-Net DMX over IP library for Java and Processing. This library adds a lot of features to the existing artnet4j project. Including support to read dmx data.

Features

  • Bind server to a custom network interface
  • Reuse of the socket address
  • Added ability to receive OpDmx packages
  • Send and receive via UDP broadcast.
  • Support for Art-Ext packages.
  • Support for OpTimeCode packages (thanks to @MrExplode)
  • Port selection of the UDP services
  • Supports java version 8 and 11 (oracle and openjdk)

Installation

I recommend to install it from maven central. Otherwise it is also possible to use github packages, jitpack.io or just the binary download.

Maven

<dependency>
  <groupId>ch.bildspur</groupId>
  <artifactId>artnet4j</artifactId>
  <version>0.6.2</version>
</dependency>

Gradle

repositories {
    mavenCentral()
}

dependencies {
    compile 'ch.bildspur:artnet4j:0.6.2'
}

Examples

The library adds a new class called ArtNetClient, which contains easy access to the underlaying Art-Net implementation.

Send Dmx Data

To send dmx data you have to create a new client. It is possible to skip the buffer creation by passing null to the constructor.

byte[] dmxData = new byte[512];
ArtNetClient artnet = new ArtNetClient();
artnet.start();

// set data
dmxData[0] = 128;

// send data to localhost
artnet.unicastDmx("127.0.0.1", 0, 0, dmxData);

artnet.stop();

Based on SendDmxData

It is also possible to send the data via broadcast.

// to broad cast data
artnet.broadcastDmx(0, 0, dmxData);

Read Dmx Data

To read data you have to create a new client and read the bytes from the buffer. Please be aware that you have to mask the bytes with 0xFF (because they are signed).

ArtNetClient artnet = new ArtNetClient();
artnet.start();

byte[] data = artnet.readDmxData(0, 0);
System.out.println("First Byte: " + data[0] & 0xFF);
artnet.start.stop();

Based on ReceiveDmxData

Select Port

While creating the ArtNetClient, it is possible to select the specific ports for the server (incoming) and the client (outgoing).

ArtNetClient artnet = new ArtNetClient(new ArtNetBuffer(), 8000, 8000);

Based on SendOnSpecificPort

Bind Custom Network Interface

It is also possible to set a custom network interface. Here you see how to bind a custom network interface en5 to the ArtNet server:

NetworkInterface ni = NetworkInterface.getByName("en5");
InetAddress address = ni.getInetAddresses().nextElement();

artnet.start(address);

Receive Packet Events

Sometimes it is necessary to receive events when a new package was received. For this prupose you can get the underlaying ArtNetServer and add a new listener to it.

artnet = new ArtNetClient();

// add packet listener to server
artnet.getArtNetServer().addListener(
 new ArtNetServerEventAdapter() {
  @Override public void artNetPacketReceived(ArtNetPacket packet) {
   println("new packet received!");
  }
});

artnet.start();

About

The library is based on then artnet4j project.

Art-Net by Artistic Licence allows for broadcasting DMX data via IP/UDP. This library is implementing the basic protocol for Java applications.

Currently supported core features are:

  • Device/node discovery & automatic updating of node configurations
  • Java typed descriptors of nodes & node properties
  • Abstracted DmxUniverse allowing direct pixel/channel access without having to deal with packets
  • JAXB configuration support for storing universe/node descriptions as XML
  • Listener support for various events
  • Sending of DMX512 data via UDP broadcast or unicast

This project is currently still in pre-alpha stage, so currently only source access via hg. Be also aware that large parts of the codebase are still undergoing major changes.

New features are developed by Florian.

Extension points exported contracts — how you extend this code

ArtNetServerListener (Interface)
(no doc) [2 implementers]
src/main/java/ch/bildspur/artnet/events/ArtNetServerListener.java
ArtNetDiscoveryListener (Interface)
(no doc) [2 implementers]
src/main/java/ch/bildspur/artnet/events/ArtNetDiscoveryListener.java

Core symbols most depended-on inside this repo

getInt8
called by 12
src/main/java/ch/bildspur/artnet/packets/ByteUtils.java
setInt8
called by 12
src/main/java/ch/bildspur/artnet/packets/ByteUtils.java
setByteChunk
called by 10
src/main/java/ch/bildspur/artnet/packets/ByteUtils.java
getBytes
called by 9
src/main/java/ch/bildspur/artnet/packets/ByteUtils.java
setData
called by 8
src/main/java/ch/bildspur/artnet/packets/ArtNetPacket.java
hex
called by 7
src/main/java/ch/bildspur/artnet/packets/ByteUtils.java
getByteChunk
called by 7
src/main/java/ch/bildspur/artnet/packets/ByteUtils.java
getIPAddress
called by 6
src/main/java/ch/bildspur/artnet/ArtNetNode.java

Shape

Method 251
Class 24
Enum 4
Interface 2

Languages

Java100%

Modules by API surface

src/main/java/ch/bildspur/artnet/packets/ArtPollReplyPacket.java37 symbols
src/main/java/ch/bildspur/artnet/ArtNetNode.java18 symbols
src/main/java/ch/bildspur/artnet/packets/ByteUtils.java16 symbols
src/main/java/ch/bildspur/artnet/packets/ArtTimePacket.java15 symbols
src/main/java/ch/bildspur/artnet/packets/ArtDmxPacket.java15 symbols
src/main/java/ch/bildspur/artnet/DmxUniverse.java15 symbols
src/main/java/ch/bildspur/artnet/ArtNet.java15 symbols
src/main/java/ch/bildspur/artnet/ArtNetServer.java14 symbols
src/main/java/ch/bildspur/artnet/ArtNetClient.java14 symbols
src/main/java/ch/bildspur/artnet/packets/ArtNetPacket.java10 symbols
src/main/java/ch/bildspur/artnet/PortDescriptor.java10 symbols
src/test/java/ch/bildspur/artnet.test/ArtNetViewerSketch.java9 symbols

For agents

$ claude mcp add artnet4j \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page