Neu Version

master
VogelT 1 year ago
parent 7352b6809b
commit c30ccc4944

@ -0,0 +1,54 @@
package de.games.nanoleaf.server;
import java.util.List;
import io.github.rowak.nanoleafapi.util.NanoleafDeviceMeta;
import io.github.rowak.nanoleafapi.util.NanoleafSetup;
/**
* https://github.com/amybytes/nanoleaf-api
*
*/
public class NanoleafServer {
List<NanoleafDeviceMeta> m_nanoleafDeviceList = null;
public List<NanoleafDeviceMeta> getNanoleafDeviceList() { return m_nanoleafDeviceList; }
public NanoleafServer() {
int timeout = 2000;
/*
* 192.168.178.138 Nanoleaf 4D
*
* 192.168.178.139 Nanoleaf Canvas P17
*/
try {
m_nanoleafDeviceList = NanoleafSetup.findNanoleafDevices(timeout);
System.out.println("Nano Devices: " + m_nanoleafDeviceList.size());
NanoleafDeviceMeta meta = null;
if (getNanoleafDeviceList().size() > 0) {
meta = getNanoleafDeviceList().get(0);
String accessToken = NanoleafSetup.createAccessToken(meta.getHostName(), meta.getPort());
System.out.println("accessToken: " + accessToken);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
new NanoleafServer();
}
}
Loading…
Cancel
Save