|
|
|
|
@ -1,13 +1,15 @@
|
|
|
|
|
package de.games.nanoleaf.server;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.Hashtable;
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
import io.github.rowak.nanoleafapi.Aurora;
|
|
|
|
|
import io.github.rowak.nanoleafapi.Canvas;
|
|
|
|
|
import io.github.rowak.nanoleafapi.Color;
|
|
|
|
|
import io.github.rowak.nanoleafapi.NanoleafDevice;
|
|
|
|
|
import io.github.rowak.nanoleafapi.Panel;
|
|
|
|
|
import io.github.rowak.nanoleafapi.event.DetailedTouchEvent;
|
|
|
|
|
@ -44,6 +46,13 @@ public class NanoleafServer {
|
|
|
|
|
// Verbinde mit dem Gerät
|
|
|
|
|
NanoleafDevice device = NanoleafDevice.createDevice(host, port, accessToken);
|
|
|
|
|
|
|
|
|
|
// List<Panel> panelList = device.getPanels();
|
|
|
|
|
//
|
|
|
|
|
// for (Panel panel: panelList) {
|
|
|
|
|
// System.out.println("Panel: " + panel.getId());
|
|
|
|
|
// }
|
|
|
|
|
device.setColor(Color.WHITE);
|
|
|
|
|
|
|
|
|
|
device.enableTouchEventStreaming(port); // You need to specify a port to listen on
|
|
|
|
|
device.registerTouchEventStreamingListener(new NanoleafTouchEventListener() {
|
|
|
|
|
@Override
|
|
|
|
|
@ -83,6 +92,17 @@ public class NanoleafServer {
|
|
|
|
|
lastIDSet.clear();
|
|
|
|
|
lastIDSet.add(lastID);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
int panelID = event.getInitialPanelId();
|
|
|
|
|
|
|
|
|
|
//device.setPanelColor(panelID, "#ff0000", 2);
|
|
|
|
|
|
|
|
|
|
device.setPanelExternalStreaming(panelID, Color.RED, 1);
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("ID: " + event.getPanelId());
|
|
|
|
|
|