diff --git a/.gradle/4.4/fileHashes/fileHashes.bin b/.gradle/4.4/fileHashes/fileHashes.bin
index 14b9b2d..642c384 100644
Binary files a/.gradle/4.4/fileHashes/fileHashes.bin and b/.gradle/4.4/fileHashes/fileHashes.bin differ
diff --git a/.gradle/4.4/fileHashes/fileHashes.lock b/.gradle/4.4/fileHashes/fileHashes.lock
index 9ce803b..69ec864 100644
Binary files a/.gradle/4.4/fileHashes/fileHashes.lock and b/.gradle/4.4/fileHashes/fileHashes.lock differ
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 267d99c..eddea76 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -3,6 +3,7 @@
-
-
+
+
-
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -119,6 +146,11 @@
+
+
+ flow
+
+
@@ -300,9 +332,9 @@
@@ -492,12 +524,14 @@
-
-
-
+
+
+
+
+
@@ -568,24 +602,48 @@
-
+
+
+
+
+
+
+
-
+
+
+
+
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -599,7 +657,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -702,9 +771,11 @@
+
+
@@ -724,7 +795,10 @@
1527511421271
-
+
+
+
+
1527518149240
@@ -740,7 +814,14 @@
1527522377670
-
+
+ 1527610693612
+
+
+
+ 1527610693612
+
+
@@ -758,7 +839,7 @@
-
+
@@ -773,12 +854,11 @@
-
-
+
+
-
-
+
@@ -787,13 +867,14 @@
-
+
+
-
+
@@ -805,9 +886,52 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -815,13 +939,10 @@
-
+
-
-
-
@@ -832,31 +953,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -864,24 +965,24 @@
-
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
@@ -890,43 +991,102 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No facets are configured
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 9
+
+
+
+
+
+
+
+
+
+
+
+ SeniorAssistant_test|SeniorAssistant
+
+
+
+
+
+
+
+
+
+
@@ -938,6 +1098,18 @@
+
+
+ Gradle: com.fasterxml.jackson.core:jackson-core:2.1.3
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index b6f218b..78f527d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -14,12 +14,22 @@ repositories {
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
// compile "com.sparkjava:spark-core:2.5.5"
- // compile "org.slf4j:slf4j-simple:1.7.21"
+ compile "org.slf4j:slf4j-simple:1.7.21"
compile "com.google.code.gson:gson:2.8.0"
// compile "org.xerial:sqlite-jdbc:3.15.1"
compile 'org.apache.httpcomponents:httpclient:4.5.3'
compile 'com.google.api-client:google-api-client:1.23.0'
compile group: 'com.google.oauth-client', name: 'google-oauth-client-jetty', version: '1.11.0-beta'
+ compile files('zway-lib-0.2.8-SNAPSHOT.jar')
+
+ compile 'org.apache.commons:commons-lang3:3.4'
+ compile 'org.eclipse.jetty:jetty-client:9.3.11.v20160721'
+ compile 'org.eclipse.jetty:jetty-http:9.3.11.v20160721'
+ compile 'org.eclipse.jetty:jetty-io:9.3.11.v20160721'
+ compile 'org.eclipse.jetty:jetty-util:9.3.11.v20160721'
+ compile 'org.eclipse.jetty.websocket:websocket-api:9.3.12.v20160915'
+ compile 'org.eclipse.jetty.websocket:websocket-client:9.3.12.v20160915'
+ compile 'org.eclipse.jetty.websocket:websocket-common:9.3.12.v20160915'
}
diff --git a/src/main/java/manage/AuthFITBIT.java b/src/main/java/manage/AuthFITBIT.java
index b2497a3..e4b223a 100644
--- a/src/main/java/manage/AuthFITBIT.java
+++ b/src/main/java/manage/AuthFITBIT.java
@@ -34,8 +34,8 @@ public class AuthFITBIT {
private static FileDataStoreFactory DATA_STORE_FACTORY;
/** OAuth 2 scope. */
- private static final String SCOPE = "read";
-
+ private static final String SCOPE = "activity";
+ //private static final String SCOPE[] = new String[]{"activity","heartrate","location","sleep"};
/** Global instance of the HTTP transport. */
private static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
@@ -63,7 +63,8 @@ public class AuthFITBIT {
// authorize
LocalServerReceiver receiver = new LocalServerReceiver.Builder().setHost(
OAuth2ClientCredentials.DOMAIN).setPort(OAuth2ClientCredentials.PORT).build();
- return new AuthorizationCodeInstalledApp(flow, receiver).authorize("user");
+
+ return new AuthorizationCodeInstalledApp(flow, receiver).authorize("user" );
}
private static void run(HttpRequestFactory requestFactory) throws IOException {
@@ -74,19 +75,19 @@ public class AuthFITBIT {
UserData data = request.execute().parseAs(UserData.class);
if (data.list.isEmpty()) {
System.out.println("Error in retrieve user data");
- } /*else {
+ } else/* {
if (data.hasMore) {
System.out.print("First ");
}*/ //i don't think is necessary
/* System.out.println(data.list.size() + " favorite videos found:");
- for (Data datas: data.list) {
- System.out.println();
+ */for (FITIBITData datas: data.list) {
+ System.out.println(datas.toString());/*
System.out.println("-----------------------------------------------");
System.out.println("ID: " + datas.id);
System.out.println("Title: " + datas.title);
System.out.println("Tags: " + datas.tags);
System.out.println("URL: " + datas.url);
- }
+ */ }/*
}*/ //neither this
}
diff --git a/src/main/java/manage/Data.java b/src/main/java/manage/Data.java
deleted file mode 100644
index 3ed39cf..0000000
--- a/src/main/java/manage/Data.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package manage;
-
-import com.google.api.client.util.Key;
-
-import java.util.List;
-
-//da modificare inserendo gli attributi del json (activity, heartrate, sleep, location)
-
-public class Data {
-
- @Key
- public String id;
-
- @Key
- public List tags;
-
- @Key
- public String title;
-
- @Key
- public String url;
-}
\ No newline at end of file
diff --git a/src/main/java/manage/FITIBITData.java b/src/main/java/manage/FITIBITData.java
new file mode 100644
index 0000000..374cbf7
--- /dev/null
+++ b/src/main/java/manage/FITIBITData.java
@@ -0,0 +1,21 @@
+package manage;
+
+import com.google.api.client.util.Key;
+
+import java.util.List;
+
+
+public class FITIBITData {
+
+ @Key
+ public String activity;
+
+ @Key
+ public String heartrate;
+
+ @Key
+ public String sleep;
+
+ @Key
+ public String location;
+}
\ No newline at end of file
diff --git a/src/main/java/manage/OAuth2ClientCredentials.java b/src/main/java/manage/OAuth2ClientCredentials.java
index 5c66572..0a77a40 100644
--- a/src/main/java/manage/OAuth2ClientCredentials.java
+++ b/src/main/java/manage/OAuth2ClientCredentials.java
@@ -3,16 +3,16 @@ package manage;
public class OAuth2ClientCredentials {
/** Value of the "API Key". */
- public static final String API_KEY = "22CSTL";
+ public static final String API_KEY = "22CSTL"; //maybe togliere le virgolette
/** Value of the "API Secret". */
- public static final String API_SECRET = "ea2452013abd35609940ce5601960a08";
+ public static final String API_SECRET = "ea2452013abd35609940ce5601960a08"; //maybe togliere le virgolette
/** Port in the "Callback URL". */
public static final int PORT = 8080;
/** Domain name in the "Callback URL". */
- public static final String DOMAIN = "http://127.0.0.1:8080/";
+ public static final String DOMAIN = "127.0.0.1";
public static void errorIfNotSpecified() {
if (API_KEY.startsWith("Enter ") || API_SECRET.startsWith("Enter ")) {
diff --git a/src/main/java/manage/UserData.java b/src/main/java/manage/UserData.java
index 14e52cd..68bc9cc 100644
--- a/src/main/java/manage/UserData.java
+++ b/src/main/java/manage/UserData.java
@@ -7,7 +7,7 @@ import java.util.List;
public class UserData {
@Key
- public List list;
+ public List list;
/*
@Key
public int limit;
diff --git a/src/main/java/tests/TestLights.java b/src/test/java/TestLights.java
similarity index 97%
rename from src/main/java/tests/TestLights.java
rename to src/test/java/TestLights.java
index e2699c9..7f0cb51 100644
--- a/src/main/java/tests/TestLights.java
+++ b/src/test/java/TestLights.java
@@ -1,5 +1,3 @@
-package tests;
-
import device.Hue;
import org.junit.Test;