hey..
first of all really cool project!!!!! and thx for uploading it!!!!
im very interested in using the artnet4j lib in my project!!!!
ive checked your repository and i found the artnet4j.jar file in the lib folder!
i couldnt find that file in the
artnet4j lib repository! did you generate it yourself or am i just missing sth here!
im trying to use the artnet4j lib in processing and im having some troubles with it! i have problems with the
ArtNetDiscoveryListener... i have an enttec datagate mk2 connected via ethernet cable and i get following message:
Jun 4, 2012 2:33:57 PM artnet4j.ArtNet <init>
INFO: Art-Net v0001-20091119
Jun 4, 2012 2:33:57 PM artnet4j.ArtNetServer start
INFO: Art-Net server started at port: 6454
Jun 4, 2012 2:33:57 PM artnet4j.ArtNetNodeDiscovery discoverNode
INFO: discovered new node: /2.7.93.177
Exception in thread "Thread-3" java.lang.NullPointerException
at artnet4j.ArtNetNodeDiscovery.discoverNode(Unknown Source)
at artnet4j.ArtNet$1.artNetPacketReceived(Unknown Source)
at artnet4j.ArtNetServer.run(Unknown Source)
at java.lang.Thread.run(Thread.java:680)
0 nodes found:
running this code:
- import artnet4j.events.*;
- import artnet4j.packets.*;
- import artnet4j.*;
- ArtNetManager artnet;
- void setup(){
- artnet = new ArtNetManager();
- artnet.test();
- size(500,350);
- }
- void draw(){
- background(220);
- }
- String ip = "2.7.93.177";
- class ArtNetManager implements ArtNetDiscoveryListener{
-
- ArtNetNode openDMX;
- int sequenceID=0;
-
- public void discoveredNewNode(ArtNetNode node) {
- if (openDMX == null) {
- openDMX = node;
- println("found openDMX");
- }
- println("New Nodes added: " + node.getIPAddress());
- }
-
- void discoveredNodeDisconnected(ArtNetNode node) {
- println("node disconnected: " + node);
- if (node == openDMX) {
- openDMX = null;
- }
- }
-
- void discoveryCompleted(List<ArtNetNode> nodes) {
- println(nodes.size() + " nodes found:");
- for (ArtNetNode n : nodes) {
- println(n);
- }
- }
-
- void discoveryFailed(Throwable t) {
- println("discovery failed");
- }
-
- void update(){
- }
-
- /** start artnet server and set buffer to light state */
-
- public void test(){
- ArtNet artnet = new ArtNet();
- try {
- artnet.start();
- ArtNetNodeDiscovery discovery = artnet.getNodeDiscovery();
- discovery.addListener(this);
- discovery.setInterval(6000);
- discovery.start();
- while (true) {
- //println(openDMX);
- if (openDMX != null) {
- ArtDmxPacket dmx = new ArtDmxPacket();
- dmx.setUniverse(openDMX.getSubNet(),
- openDMX.getDmxOuts()[0]);
- dmx.setSequenceID(sequenceID % 255);
- byte[] buffer = new byte[510];
- for (int i = 0; i < buffer.length; i++) {
- buffer[i] =
- (byte) (Math.sin(sequenceID * 0.05 + i * 0.8) * 127 + 128);
- }
- dmx.setDMX(buffer, buffer.length);
- artnet.unicastPacket(dmx, openDMX.getIPAddress());
- dmx.setUniverse(openDMX.getSubNet(),
- openDMX.getDmxOuts()[1]);
- artnet.unicastPacket(dmx, openDMX.getIPAddress());
- sequenceID++;
- }
- Thread.sleep(30);
- }
- } catch (SocketException e) {
- e.printStackTrace();
- } catch (ArtNetException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- }