- aggiunte librerie SWT
- modificato main per dialogflow
This commit is contained in:
20015091
2018-09-13 15:53:36 +02:00
parent e1efbafe45
commit dd708201c1
7 changed files with 28 additions and 10 deletions

View File

@@ -49,8 +49,12 @@ dependencies {
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.5' // maybe duplicate in google-api compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.5' // maybe duplicate in google-api
// YOUTUBE VIDEO // YOUTUBE VIDEO
compile 'org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:4.3' //Winzozz
// compile 'org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:4.3' //Linuzuzz //compile 'org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:4.3' //Winzozz 64
//compile 'org.eclipse.swt:org.eclipse.swt.gtk.linux.x86:4.3' //Linuzuzz 32
//compile files('lib/SWT_linux32.jar')
compile files('lib/SWT_linux64.jar')
//compile files('lib/SWT_win64.jar')
compile group: 'com.hynnet', name: 'DJNativeSwing', version: '1.0.0' compile group: 'com.hynnet', name: 'DJNativeSwing', version: '1.0.0'
compile group: 'com.hynnet', name: 'DJNativeSwing-SWT', version: '1.0.0' compile group: 'com.hynnet', name: 'DJNativeSwing-SWT', version: '1.0.0'
} }

BIN
lib/SWT_linux32.jar Normal file

Binary file not shown.

BIN
lib/SWT_linux64.jar Normal file

Binary file not shown.

BIN
lib/SWT_win64.jar Normal file

Binary file not shown.

View File

@@ -31,7 +31,7 @@ public class Main {
private static Fitbit fitbit = null; private static Fitbit fitbit = null;
private static Sensor sensor = null; private static Sensor sensor = null;
private static Database database = null; private static Database database = null;
private static Musich musich = null; private static Musich musich = new Musich();
/** /**
* Funzione principale, qui si creano tutte le classi che verranno utilizzate.<br> * Funzione principale, qui si creano tutte le classi che verranno utilizzate.<br>
@@ -48,6 +48,7 @@ public class Main {
* @param args * @param args
*/ */
public static void main(String[] args) { public static void main(String[] args) {
System.getProperty("sun.arch.data.model");
Map<String, String> arguments = getArgsMap(args); Map<String, String> arguments = getArgsMap(args);
// list of arguments to use in the classes // list of arguments to use in the classes
@@ -100,11 +101,17 @@ public class Main {
private static void startWebhook() { private static void startWebhook() {
DialogFlowWebHook df = new DialogFlowWebHook(); DialogFlowWebHook df = new DialogFlowWebHook();
df.addOnAction("LightsON", (params) -> {lights.turnOn(); return null;}); df.addOnAction("LightsON", (params) -> { lights.turnOn(); return null; });
df.addOnAction("LightsOFF", (params) -> {lights.turnOff(); return null;}); df.addOnAction("LightsOFF", (params) -> { lights.turnOff(); return null; });
df.addOnAction("ColorLoop", (params) -> {lights.colorLoop(); return null;}); df.addOnAction("ColorLoop", (params) -> { lights.colorLoop(); return null; });
df.addOnAction("ChangeColor", (params) -> {lights.changeColor(params.get("color").getAsString()); return null;}); df.addOnAction("ChangeColor", (params) -> {
df.addOnAction("SetLights", (params) -> {lights.setBrightness(params.get("intensity").getAsInt()); return null;}); lights.changeColor(params.get("color").getAsString());
return null;
});
df.addOnAction("SetLights", (params) -> {
lights.setBrightness(params.get("intensity").getAsInt());
return null;
});
df.addOnAction("LightsDOWN", (params) -> { df.addOnAction("LightsDOWN", (params) -> {
if(params.get("intensity").getAsString().equals("")) if(params.get("intensity").getAsString().equals(""))
lights.decreaseBrightness(); lights.decreaseBrightness();
@@ -119,6 +126,12 @@ public class Main {
lights.increaseBrightness(params.get("intensity").getAsInt()); lights.increaseBrightness(params.get("intensity").getAsInt());
return null; return null;
}); });
df.addOnAction("SetMusic", (param) -> {
musich.playRandom(param.get("musicType").getAsString(),10);
return null;
});
df.addOnAction("StopMusic", (params) -> { musich.stop(); return null; });
//TODO aggiungere una azione che faccia in modo di richiedere dei dati in particolare //TODO aggiungere una azione che faccia in modo di richiedere dei dati in particolare
//TODO aggiungere una azione su DialogFlow che riconosca di impostare una playlist (Rilassante, Antica...) //TODO aggiungere una azione su DialogFlow che riconosca di impostare una playlist (Rilassante, Antica...)

View File

@@ -22,10 +22,10 @@ public class Musich {
*/ */
private static final String API_URL = "https://www.googleapis.com/youtube/v3/search?"; private static final String API_URL = "https://www.googleapis.com/youtube/v3/search?";
/** /**
* La key necessaria per prendere i dati da youtube, (per ora abbiamo usato la key di Dawit di SeniorAssistant)<br> * La key necessaria per prendere i dati da youtube<br>
* Tra l'altro l'ho presa a caso... quindi boh. * Tra l'altro l'ho presa a caso... quindi boh.
*/ */
private static final String KEY = "AIzaSyCtCK0EPR3k_hEEyar0PeY5v9E9UyTX4TM"; private static final String KEY = "AIzaSyAYcQcX9P5btBTfgdwWwETNh_7jV20cQp0";
/** /**
* IL thread che ha fatto partire il frame corrente * IL thread che ha fatto partire il frame corrente

View File

@@ -53,6 +53,7 @@ public class Rest {
// should be inside a finally... // should be inside a finally...
result.close(); result.close();
httpclient.close(); httpclient.close();
LOG.debug("GET response: " + json);
} catch (IOException e) { } catch (IOException e) {
LOG.error("GET: " + e.getMessage()); LOG.error("GET: " + e.getMessage());
} }