Merge branch 'master' of https://gitea.raspi-developer.de/Webmaster/webportal.git
commit
f1d1a2f038
@ -0,0 +1,39 @@
|
||||
package de.games.nanoleaf.server;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
public class NanoLiefAPIExample {
|
||||
private static final String API_URL = "https://api.nanolief.com/v1/data";
|
||||
private static final String API_KEY = "DEIN_API_KEY"; // Ersetze dies mit deinem tatsächlichen API-Schlüssel
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
URL url = new URL(API_URL);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setRequestProperty("Authorization", "Bearer " + API_KEY);
|
||||
|
||||
int responseCode = connection.getResponseCode();
|
||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String inputLine;
|
||||
StringBuilder response = new StringBuilder();
|
||||
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
|
||||
// Antwort verarbeiten
|
||||
System.out.println("Response: " + response.toString());
|
||||
} else {
|
||||
System.out.println("GET request not worked. Response Code: " + responseCode);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package de.games.nanoleaf.server;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.github.rowak.nanoleafapi.Aurora;
|
||||
|
||||
public class NanoleafMonitoring {
|
||||
public static void main(String[] args) {
|
||||
// Ersetze die IP-Adresse und den API-Schlüssel durch deine eigenen Werte
|
||||
String ip = "DEINE_AURORA_IP";
|
||||
int port = 16021;
|
||||
String accessToken = "DEIN_API_KEY";
|
||||
|
||||
// Verbindung zur Aurora-Instanz herstellen
|
||||
try {
|
||||
Aurora aurora = new Aurora(ip, port, accessToken);
|
||||
|
||||
// Panels abrufen
|
||||
// List<Integer> panelIds = Aurora.getPanelIds();
|
||||
// System.out.println("Panel IDs: " + panelIds);
|
||||
//
|
||||
// // Überwache den Zustand jedes Panels
|
||||
// for (int panelId : panelIds) {
|
||||
// // Abrufen der Farbe des Panels
|
||||
// int[] color = aurora.getPanelColor(panelId);
|
||||
// System.out.println("Panel " + panelId + " Farbe: " + "Rot: " + color[0] + " Grün: " + color[1] + " Blau: " + color[2]);
|
||||
//
|
||||
// // Hier kannst du weitere Eigenschaften des Panels überwachen und abrufen
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package de.games.nanoleaf.server;
|
||||
|
||||
import io.github.rowak.nanoleafapi.Aurora;
|
||||
|
||||
public class NanoleafPanelExample {
|
||||
public static void main(String[] args) {
|
||||
// Ersetze die IP-Adresse und den API-Schlüssel durch deine eigenen Werte
|
||||
String ip = "DEINE_AURORA_IP";
|
||||
int port = 16021;
|
||||
String accessToken = "DEIN_API_KEY";
|
||||
|
||||
try {
|
||||
// Verbindung zur Aurora-Instanz herstellen
|
||||
Aurora aurora = new Aurora(ip, port, accessToken);
|
||||
|
||||
// Panel 1 auf Rot setzen
|
||||
aurora.setPanelColor(1, 255, 0, 0, 1); // r, g, b, alpha
|
||||
|
||||
// Panel 2 auf Grün setzen
|
||||
aurora.setPanelColor(2, 0, 255, 0, 1); // r, g, b, alpha
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
<system>
|
||||
<httpheaderattributesforpages/>
|
||||
<sessionmanagement type="COOKIE"/>
|
||||
</system>
|
||||
|
||||
Loading…
Reference in new issue