diff --git a/.ccEclipseSynch b/.ccEclipseSynch new file mode 100644 index 0000000..033a451 --- /dev/null +++ b/.ccEclipseSynch @@ -0,0 +1 @@ +Src changed \ No newline at end of file diff --git a/.ccproject b/.ccproject index 68de72a..98db8f5 100644 --- a/.ccproject +++ b/.ccproject @@ -12,5 +12,4 @@ webhostport="localhost:${deploytomcatport}"> - diff --git a/.classpath b/.classpath index fc78a1d..f3bce31 100644 --- a/.classpath +++ b/.classpath @@ -1,41 +1,40 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index e27eab0..c3b983f 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,12 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=21 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index eb90136..79c4e85 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,10 +1,20 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 75d2adc..1cfd457 100644 --- a/pom.xml +++ b/pom.xml @@ -31,11 +31,28 @@ + + + + + io.github.rowak + nanoleaf-api + 0.1.2 + - io.github.rowak - nanoleaf-api - 0.1.2 + io.github.rowak + nanoleaf-aurora + 1.5.2 + + org.eclnt eclntjsfserverRISC_jakarta diff --git a/src/main/java/de/games/nanoleaf/server/NanoleafEventServer.java b/src/main/java/de/games/nanoleaf/server/NanoleafEventServer.java new file mode 100644 index 0000000..ab3cac2 --- /dev/null +++ b/src/main/java/de/games/nanoleaf/server/NanoleafEventServer.java @@ -0,0 +1,26 @@ +package de.games.nanoleaf.server; + +import java.util.List; + +import io.github.rowak.nanoleafapi.NanoleafDevice; +import io.github.rowak.nanoleafapi.util.NanoleafDeviceMeta; +import io.github.rowak.nanoleafapi.util.NanoleafSetup; + +public class NanoleafEventServer { + + + public static void main(String[] args) { + int timeout = 2000; +// List devices = NanoleafSetup.findNanoleafDevices(timeout); +// NanoleafDeviceMeta meta = devices.get(0); // Beispiel: Erster Gerät in der Liste +// String accessToken = NanoleafSetup.createAccessToken(meta.getHostName(), meta.getPort()); +// NanoleafDevice device = NanoleafSetup.createDevice(meta, accessToken); +// +// // Event Handling +// device.setOnStateChangedListener(state -> { +// System.out.println("State changed: " + state.isOn()); +// }); + + // Weitere Event-Listener hinzufügen, falls erforderlich + } +} diff --git a/src/main/java/de/games/nanoleaf/server/NanoleafServer.java b/src/main/java/de/games/nanoleaf/server/NanoleafServer.java index 893a108..14ecd08 100644 --- a/src/main/java/de/games/nanoleaf/server/NanoleafServer.java +++ b/src/main/java/de/games/nanoleaf/server/NanoleafServer.java @@ -1,7 +1,10 @@ package de.games.nanoleaf.server; +import java.util.Iterator; import java.util.List; +import io.github.rowak.nanoleafapi.Aurora; +import io.github.rowak.nanoleafapi.Panel; import io.github.rowak.nanoleafapi.util.NanoleafDeviceMeta; import io.github.rowak.nanoleafapi.util.NanoleafSetup; @@ -16,13 +19,66 @@ public class NanoleafServer { public List getNanoleafDeviceList() { return m_nanoleafDeviceList; } public NanoleafServer() { + + String host = "Canvas-72FA.fritz.box"; + int port = 16021; + String apiLevel = "v1"; + String accessToken = "LAG28BQWrXK2p79NbHMQsvcYYCN1TcD4"; + + Aurora aurora = null; + try { + aurora = new Aurora(host, port, accessToken); + + boolean isOn = aurora.getOn(); + + if (isOn) { + System.out.println("Nanoleaf ist an!!!"); + + int brightness = aurora.getBrightness(); + + System.out.println("Helligkeit: " + brightness); + + List panelList = aurora.getPanels(); + + for (Iterator iterator = panelList.iterator(); iterator.hasNext();) { + Panel panel = (Panel) iterator.next(); + + System.out.println("Panel ID: " + panel.getId()); + } + + + + } else { + System.out.println("Nanoleaf ist off!!!"); + } + + + + } catch (Exception e) { + e.printStackTrace(); + } + + } + + + public void checkAdressToken() { + int timeout = 2000; /* * 192.168.178.138 Nanoleaf 4D * - * 192.168.178.139 Nanoleaf Canvas P17 + * 192.168.178.141 Nanoleaf Canvas P17 + * Canvas-72FA.fritz.box + * + * Nano Devices: 1 + * Host: Canvas-72FA.fritz.box + * DevID: 192.168.178.141 + * Port: 16021 + * accessToken: LAG28BQWrXK2p79NbHMQsvcYYCN1TcD4 + * + * */ try { @@ -34,6 +90,10 @@ public class NanoleafServer { if (getNanoleafDeviceList().size() > 0) { meta = getNanoleafDeviceList().get(0); + System.out.println("Host: " + meta.getHostName()); + System.out.println("DevID: " + meta.getDeviceId()); + System.out.println("Port: " + meta.getPort()); + String accessToken = NanoleafSetup.createAccessToken(meta.getHostName(), meta.getPort()); System.out.println("accessToken: " + accessToken); @@ -42,9 +102,9 @@ public class NanoleafServer { } catch (Exception e) { e.printStackTrace(); } - - } + + public static void main(String[] args) { new NanoleafServer(); diff --git a/src/main/webapp/eclntjsfserver/config/hotdeploy.xml b/src/main/webapp/eclntjsfserver/config/hotdeploy.xml deleted file mode 100644 index b2c3612..0000000 --- a/src/main/webapp/eclntjsfserver/config/hotdeploy.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/main/webapp/main.xml b/src/main/webapp/main.xml index 9a9b528..a43e34c 100644 --- a/src/main/webapp/main.xml +++ b/src/main/webapp/main.xml @@ -1,7 +1,7 @@ - - - - - - + + + + + + \ No newline at end of file