diff --git a/src/main/java/manage/FITBITData/Device.java b/src/main/java/device/FITBITData/Device.java
similarity index 95%
rename from src/main/java/manage/FITBITData/Device.java
rename to src/main/java/device/FITBITData/Device.java
index cdfe9ea..b03a95a 100644
--- a/src/main/java/manage/FITBITData/Device.java
+++ b/src/main/java/device/FITBITData/Device.java
@@ -1,4 +1,4 @@
-package manage.FITBITData;
+package device.FITBITData;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
diff --git a/src/main/java/manage/FITBITData/HeartRate.java b/src/main/java/device/FITBITData/HeartRate.java
similarity index 97%
rename from src/main/java/manage/FITBITData/HeartRate.java
rename to src/main/java/device/FITBITData/HeartRate.java
index 584544a..867416f 100644
--- a/src/main/java/manage/FITBITData/HeartRate.java
+++ b/src/main/java/device/FITBITData/HeartRate.java
@@ -1,4 +1,4 @@
-package manage.FITBITData;
+package device.FITBITData;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
diff --git a/src/main/java/manage/FITBITData/Sleep.java b/src/main/java/device/FITBITData/Sleep.java
similarity index 94%
rename from src/main/java/manage/FITBITData/Sleep.java
rename to src/main/java/device/FITBITData/Sleep.java
index 8e4eecc..ea535df 100644
--- a/src/main/java/manage/FITBITData/Sleep.java
+++ b/src/main/java/device/FITBITData/Sleep.java
@@ -1,4 +1,4 @@
-package manage.FITBITData;
+package device.FITBITData;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/manage/FITBITData/Steps.java b/src/main/java/device/FITBITData/Steps.java
similarity index 96%
rename from src/main/java/manage/FITBITData/Steps.java
rename to src/main/java/device/FITBITData/Steps.java
index 7d92a82..ac01984 100644
--- a/src/main/java/manage/FITBITData/Steps.java
+++ b/src/main/java/device/FITBITData/Steps.java
@@ -1,4 +1,4 @@
-package manage.FITBITData;
+package device.FITBITData;
import java.text.SimpleDateFormat;
import java.util.Date;
diff --git a/src/main/java/manage/FITBITData/FitBit.java b/src/main/java/device/FitBit.java
similarity index 95%
rename from src/main/java/manage/FITBITData/FitBit.java
rename to src/main/java/device/FitBit.java
index 86666ee..a34dc02 100644
--- a/src/main/java/manage/FITBITData/FitBit.java
+++ b/src/main/java/device/FitBit.java
@@ -1,11 +1,14 @@
-package manage.FITBITData;
+package device;
import java.io.IOException;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
-import manage.AuthFITBIT;
+import device.FITBITData.HeartRate;
+import device.FITBITData.Sleep;
+import device.FITBITData.Steps;
+import oauth.AuthFITBIT;
public class FitBit {
diff --git a/src/main/java/device/Hue.java b/src/main/java/device/Hue.java
index 7257150..d035413 100644
--- a/src/main/java/device/Hue.java
+++ b/src/main/java/device/Hue.java
@@ -3,7 +3,7 @@ package device;
import java.util.Map;
import java.util.Set;
-import manage.Rest;
+import support.Rest;
public class Hue {
//private String baseURL = "192.168.0.2";
diff --git a/src/main/java/device/Sensor.java b/src/main/java/device/Sensor.java
index 0aa2c8b..2b84eb0 100644
--- a/src/main/java/device/Sensor.java
+++ b/src/main/java/device/Sensor.java
@@ -4,6 +4,8 @@ import de.fh_zwickau.informatik.sensor.IZWayApi;
import de.fh_zwickau.informatik.sensor.ZWayApiHttp;
import de.fh_zwickau.informatik.sensor.model.devices.Device;
import de.fh_zwickau.informatik.sensor.model.devices.DeviceList;
+import support.ZWaySimpleCallback;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -21,15 +23,12 @@ public class Sensor {
public IZWayApi zwayApi;
private DeviceList allZWaveDevices;
private DeviceList devices;
- private Integer nodeId;
public Sensor() {
this(null);
}
public Sensor (Integer nodeId) {
- this.nodeId = nodeId;
-
// create an instance of the Z-Way library; all the params are mandatory (we are not going to use the remote service/id)
zwayApi = new ZWayApiHttp(ipAddress, 8083, "http", username, password, 0, false, new ZWaySimpleCallback());
diff --git a/src/main/java/manage/AuthFITBIT.java b/src/main/java/oauth/AuthFITBIT.java
similarity index 99%
rename from src/main/java/manage/AuthFITBIT.java
rename to src/main/java/oauth/AuthFITBIT.java
index bf6e266..ebdbd4e 100644
--- a/src/main/java/manage/AuthFITBIT.java
+++ b/src/main/java/oauth/AuthFITBIT.java
@@ -1,4 +1,4 @@
-package manage;
+package oauth;
import java.io.IOException;
import java.util.Arrays;
diff --git a/src/main/java/manage/FITBITUrl.java b/src/main/java/oauth/FITBITUrl.java
similarity index 91%
rename from src/main/java/manage/FITBITUrl.java
rename to src/main/java/oauth/FITBITUrl.java
index d3de6bb..b29bacd 100644
--- a/src/main/java/manage/FITBITUrl.java
+++ b/src/main/java/oauth/FITBITUrl.java
@@ -1,28 +1,28 @@
-package manage;
-
-import com.google.api.client.http.GenericUrl;
-import com.google.api.client.util.Key;
-
-public class FITBITUrl extends GenericUrl {
-
- @Key
- private String fields;
-
- public FITBITUrl(String encodedUrl) {
- super(encodedUrl);
- }
-
- /**
- * @return the fields
- */
- public String getFields() {
- return fields;
- }
-
- /**
- * @param fields the fields to set
- */
- public void setFields(String fields) {
- this.fields = fields;
- }
-}
+package oauth;
+
+import com.google.api.client.http.GenericUrl;
+import com.google.api.client.util.Key;
+
+public class FITBITUrl extends GenericUrl {
+
+ @Key
+ private String fields;
+
+ public FITBITUrl(String encodedUrl) {
+ super(encodedUrl);
+ }
+
+ /**
+ * @return the fields
+ */
+ public String getFields() {
+ return fields;
+ }
+
+ /**
+ * @param fields the fields to set
+ */
+ public void setFields(String fields) {
+ this.fields = fields;
+ }
+}
diff --git a/src/main/java/manage/OAuth2ClientCredentials.java b/src/main/java/oauth/OAuth2ClientCredentials.java
similarity index 94%
rename from src/main/java/manage/OAuth2ClientCredentials.java
rename to src/main/java/oauth/OAuth2ClientCredentials.java
index ccbf967..12db501 100644
--- a/src/main/java/manage/OAuth2ClientCredentials.java
+++ b/src/main/java/oauth/OAuth2ClientCredentials.java
@@ -1,17 +1,17 @@
-package manage;
-
-public class OAuth2ClientCredentials {
-
- /** Value of the "API Key". */
- public static final String API_KEY = "22CSTL"; //maybe togliere le virgolette
-
- /** Value of the "API Secret". */
- 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 = "127.0.0.1";
- }
-
+package oauth;
+
+public class OAuth2ClientCredentials {
+
+ /** Value of the "API Key". */
+ public static final String API_KEY = "22CSTL"; //maybe togliere le virgolette
+
+ /** Value of the "API Secret". */
+ 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 = "127.0.0.1";
+ }
+
diff --git a/src/main/java/manage/Rest.java b/src/main/java/support/Rest.java
similarity index 96%
rename from src/main/java/manage/Rest.java
rename to src/main/java/support/Rest.java
index f7884af..fc9b03d 100644
--- a/src/main/java/manage/Rest.java
+++ b/src/main/java/support/Rest.java
@@ -1,84 +1,84 @@
-package manage;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import com.google.gson.Gson;
-
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPut;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.util.EntityUtils;
-/**
- * A generic class to perform HTTP calls and parse the resulting JSON.
- *
- * @author Luigi De Russis
- * @version 1.0 (18/05/2017)
- */
-public class Rest {
-
- // init gson
- private static final Gson gson = new Gson();
-
- /**
- * Perform a GET request towards a server
- *
- * @param URL the @link{URL} to call
- * @return the response, parsed from JSON
- */
- public static Map get(String URL) {
- // init
- Map response = new HashMap<>();
-
- CloseableHttpClient httpclient = HttpClients.createDefault();
- HttpGet request = new HttpGet(URL);
-
- CloseableHttpResponse result = null;
-
- try {
- result = httpclient.execute(request);
- String json = EntityUtils.toString(result.getEntity());
- // do something useful with the response body
- response = gson.fromJson(json, Map.class);
- // should be inside a finally...
- result.close();
- httpclient.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- return response;
- }
-
- /**
- * Perform a PUT request towards a server
- *
- * @param URL the @link{URL} to call
- * @param contentBody the content body of the request
- * @param contentType the content type of the request
- */
- public static void put(String URL, String contentBody, String contentType) {
- // init
- CloseableHttpClient httpclient = HttpClients.createDefault();
- HttpPut request = new HttpPut(URL);
- StringEntity params = null;
-
- try {
- params = new StringEntity(contentBody);
- request.addHeader("content-type", contentType);
- request.setEntity(params);
- // I don't really care about the response
- HttpResponse result = httpclient.execute(request);
- // should be in finally...
- httpclient.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
+package support;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import com.google.gson.Gson;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+/**
+ * A generic class to perform HTTP calls and parse the resulting JSON.
+ *
+ * @author Luigi De Russis
+ * @version 1.0 (18/05/2017)
+ */
+public class Rest {
+
+ // init gson
+ private static final Gson gson = new Gson();
+
+ /**
+ * Perform a GET request towards a server
+ *
+ * @param URL the @link{URL} to call
+ * @return the response, parsed from JSON
+ */
+ public static Map get(String URL) {
+ // init
+ Map response = new HashMap<>();
+
+ CloseableHttpClient httpclient = HttpClients.createDefault();
+ HttpGet request = new HttpGet(URL);
+
+ CloseableHttpResponse result = null;
+
+ try {
+ result = httpclient.execute(request);
+ String json = EntityUtils.toString(result.getEntity());
+ // do something useful with the response body
+ response = gson.fromJson(json, Map.class);
+ // should be inside a finally...
+ result.close();
+ httpclient.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return response;
+ }
+
+ /**
+ * Perform a PUT request towards a server
+ *
+ * @param URL the @link{URL} to call
+ * @param contentBody the content body of the request
+ * @param contentType the content type of the request
+ */
+ public static void put(String URL, String contentBody, String contentType) {
+ // init
+ CloseableHttpClient httpclient = HttpClients.createDefault();
+ HttpPut request = new HttpPut(URL);
+ StringEntity params = null;
+
+ try {
+ params = new StringEntity(contentBody);
+ request.addHeader("content-type", contentType);
+ request.setEntity(params);
+ // I don't really care about the response
+ HttpResponse result = httpclient.execute(request);
+ // should be in finally...
+ httpclient.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/device/ZWaySimpleCallback.java b/src/main/java/support/ZWaySimpleCallback.java
similarity index 96%
rename from src/main/java/device/ZWaySimpleCallback.java
rename to src/main/java/support/ZWaySimpleCallback.java
index 44a8d09..42b2f0b 100644
--- a/src/main/java/device/ZWaySimpleCallback.java
+++ b/src/main/java/support/ZWaySimpleCallback.java
@@ -1,233 +1,235 @@
-package device;
-
-import de.fh_zwickau.informatik.sensor.IZWayApiCallbacks;
-import de.fh_zwickau.informatik.sensor.model.devicehistory.DeviceHistory;
-import de.fh_zwickau.informatik.sensor.model.devicehistory.DeviceHistoryList;
-import de.fh_zwickau.informatik.sensor.model.devices.Device;
-import de.fh_zwickau.informatik.sensor.model.devices.DeviceList;
-import de.fh_zwickau.informatik.sensor.model.instances.Instance;
-import de.fh_zwickau.informatik.sensor.model.instances.InstanceList;
-import de.fh_zwickau.informatik.sensor.model.locations.Location;
-import de.fh_zwickau.informatik.sensor.model.locations.LocationList;
-import de.fh_zwickau.informatik.sensor.model.modules.ModuleList;
-import de.fh_zwickau.informatik.sensor.model.namespaces.NamespaceList;
-import de.fh_zwickau.informatik.sensor.model.notifications.Notification;
-import de.fh_zwickau.informatik.sensor.model.notifications.NotificationList;
-import de.fh_zwickau.informatik.sensor.model.profiles.Profile;
-import de.fh_zwickau.informatik.sensor.model.profiles.ProfileList;
-import de.fh_zwickau.informatik.sensor.model.zwaveapi.controller.ZWaveController;
-import de.fh_zwickau.informatik.sensor.model.zwaveapi.devices.ZWaveDevice;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Mandatory callback class for the Z-Way Library in use.
- * Really trivial implementation: log all the responses at debug level.
- *
- * @author Luigi De Russis
- * @version 1.0 (24/05/2017)
- * @see Z-Way Library on GitHub for documentation about the used library
- */
-public class ZWaySimpleCallback implements IZWayApiCallbacks {
-
- @Override
- public void getStatusResponse(String s) {
- this.logMessage("Status response: " + s);
- }
-
- @Override
- public void getRestartResponse(Boolean aBoolean) {
- this.logMessage("Restart response: " + aBoolean);
- }
-
- @Override
- public void getLoginResponse(String s) {
- this.logMessage("Login response: " + s);
- }
-
- @Override
- public void getNamespacesResponse(NamespaceList namespaceList) {
- this.logMessage("Namespaces are: " + namespaceList);
- }
-
- @Override
- public void getModulesResponse(ModuleList moduleList) {
- this.logMessage("Modules are: " + moduleList);
- }
-
- @Override
- public void getInstancesResponse(InstanceList instanceList) {
- this.logMessage("Instances are: " + instanceList);
- }
-
- @Override
- public void postInstanceResponse(Instance instance) {
- this.logMessage("Received a POST for the instance: " + instance);
- }
-
- @Override
- public void getInstanceResponse(Instance instance) {
- this.logMessage("The instance is: " + instance);
- }
-
- @Override
- public void putInstanceResponse(Instance instance) {
- this.logMessage("Received a PUT for the instance: " + instance);
- }
-
- @Override
- public void deleteInstanceResponse(boolean b) {
- this.logMessage("The instance has been deleted? " + String.valueOf(b));
- }
-
- @Override
- public void getDevicesResponse(DeviceList deviceList) {
- this.logMessage("Devices are: " + deviceList);
- }
-
- @Override
- public void putDeviceResponse(Device device) {
- this.logMessage("Received a PUT for device: " + device);
- }
-
- @Override
- public void getDeviceResponse(Device device) {
- this.logMessage("The device is: " + device);
- }
-
- @Override
- public void getDeviceCommandResponse(String s) {
- this.logMessage("The device command is: " + s);
- }
-
- @Override
- public void getLocationsResponse(LocationList locationList) {
- this.logMessage("Locations are: " + locationList);
- }
-
- @Override
- public void postLocationResponse(Location location) {
- this.logMessage("Received a POST for location: " + location);
- }
-
- @Override
- public void getLocationResponse(Location location) {
- this.logMessage("The location is: " + location);
- }
-
- @Override
- public void putLocationResponse(Location location) {
- this.logMessage("Received a PUT for location: " + location);
- }
-
- @Override
- public void deleteLocationResponse(boolean b) {
- this.logMessage("Location has been deleted? " + b);
- }
-
- @Override
- public void getProfilesResponse(ProfileList profileList) {
- this.logMessage("Profiles are: " + profileList);
- }
-
- @Override
- public void postProfileResponse(Profile profile) {
- this.logMessage("Received a POST for profile: " + profile);
- }
-
- @Override
- public void getProfileResponse(Profile profile) {
- this.logMessage("The profile is: " + profile);
- }
-
- @Override
- public void putProfileResponse(Profile profile) {
- this.logMessage("Received a PUT for profile: " + profile);
- }
-
- @Override
- public void deleteProfileResponse(boolean b) {
- this.logMessage("Profile has been deleted? " + b);
- }
-
- @Override
- public void getNotificationsResponse(NotificationList notificationList) {
- this.logMessage("Notifications are: " + notificationList);
- }
-
- @Override
- public void getNotificationResponse(Notification notification) {
- this.logMessage("The notification is: " + notification);
- }
-
- @Override
- public void putNotificationResponse(Notification notification) {
- this.logMessage("Received a PUT for notification: " + notification);
- }
-
- @Override
- public void getDeviceHistoriesResponse(DeviceHistoryList deviceHistoryList) {
- this.logMessage("Device histories are: " + deviceHistoryList);
- }
-
- @Override
- public void getDeviceHistoryResponse(DeviceHistory deviceHistory) {
- this.logMessage("The device history is: " + deviceHistory);
- }
-
- @Override
- public void getZWaveDeviceResponse(ZWaveDevice zWaveDevice) {
- this.logMessage("The Z-Wave device is: " + zWaveDevice);
- }
-
- @Override
- public void getZWaveControllerResponse(ZWaveController zWaveController) {
- this.logMessage("The Z-Wave controller is: " + zWaveController);
- }
-
- @Override
- public void apiError(String s, boolean b) {
- this.logError("API Error: " + s);
- }
-
- @Override
- public void httpStatusError(int i, String s, boolean b) {
- this.logError("HTTP Status Error: " + i + s);
- }
-
- @Override
- public void authenticationError() {
- this.logError("Authentication Error");
- }
-
- @Override
- public void responseFormatError(String s, boolean b) {
- this.logError("Wrong format: " + s);
- }
-
- @Override
- public void message(int i, String s) {
- this.logMessage("You've got a message: " + i + " " + s);
- }
-
- /**
- * Utility method to print the log messages of this class.
- *
- * @param message the {@link String} to print
- */
- private void logMessage(String message) {
- Logger logger = LoggerFactory.getLogger(Sensor.class);
- logger.debug(message);
- }
-
- /**
- * Utility method to print the error messages of this class.
- *
- * @param error the {@link String} to print
- */
- private void logError(String error) {
- Logger logger = LoggerFactory.getLogger(Sensor.class);
- logger.error(error);
- }
+package support;
+
+import de.fh_zwickau.informatik.sensor.IZWayApiCallbacks;
+import de.fh_zwickau.informatik.sensor.model.devicehistory.DeviceHistory;
+import de.fh_zwickau.informatik.sensor.model.devicehistory.DeviceHistoryList;
+import de.fh_zwickau.informatik.sensor.model.devices.Device;
+import de.fh_zwickau.informatik.sensor.model.devices.DeviceList;
+import de.fh_zwickau.informatik.sensor.model.instances.Instance;
+import de.fh_zwickau.informatik.sensor.model.instances.InstanceList;
+import de.fh_zwickau.informatik.sensor.model.locations.Location;
+import de.fh_zwickau.informatik.sensor.model.locations.LocationList;
+import de.fh_zwickau.informatik.sensor.model.modules.ModuleList;
+import de.fh_zwickau.informatik.sensor.model.namespaces.NamespaceList;
+import de.fh_zwickau.informatik.sensor.model.notifications.Notification;
+import de.fh_zwickau.informatik.sensor.model.notifications.NotificationList;
+import de.fh_zwickau.informatik.sensor.model.profiles.Profile;
+import de.fh_zwickau.informatik.sensor.model.profiles.ProfileList;
+import de.fh_zwickau.informatik.sensor.model.zwaveapi.controller.ZWaveController;
+import de.fh_zwickau.informatik.sensor.model.zwaveapi.devices.ZWaveDevice;
+import device.Sensor;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Mandatory callback class for the Z-Way Library in use.
+ * Really trivial implementation: log all the responses at debug level.
+ *
+ * @author Luigi De Russis
+ * @version 1.0 (24/05/2017)
+ * @see Z-Way Library on GitHub for documentation about the used library
+ */
+public class ZWaySimpleCallback implements IZWayApiCallbacks {
+
+ @Override
+ public void getStatusResponse(String s) {
+ this.logMessage("Status response: " + s);
+ }
+
+ @Override
+ public void getRestartResponse(Boolean aBoolean) {
+ this.logMessage("Restart response: " + aBoolean);
+ }
+
+ @Override
+ public void getLoginResponse(String s) {
+ this.logMessage("Login response: " + s);
+ }
+
+ @Override
+ public void getNamespacesResponse(NamespaceList namespaceList) {
+ this.logMessage("Namespaces are: " + namespaceList);
+ }
+
+ @Override
+ public void getModulesResponse(ModuleList moduleList) {
+ this.logMessage("Modules are: " + moduleList);
+ }
+
+ @Override
+ public void getInstancesResponse(InstanceList instanceList) {
+ this.logMessage("Instances are: " + instanceList);
+ }
+
+ @Override
+ public void postInstanceResponse(Instance instance) {
+ this.logMessage("Received a POST for the instance: " + instance);
+ }
+
+ @Override
+ public void getInstanceResponse(Instance instance) {
+ this.logMessage("The instance is: " + instance);
+ }
+
+ @Override
+ public void putInstanceResponse(Instance instance) {
+ this.logMessage("Received a PUT for the instance: " + instance);
+ }
+
+ @Override
+ public void deleteInstanceResponse(boolean b) {
+ this.logMessage("The instance has been deleted? " + String.valueOf(b));
+ }
+
+ @Override
+ public void getDevicesResponse(DeviceList deviceList) {
+ this.logMessage("Devices are: " + deviceList);
+ }
+
+ @Override
+ public void putDeviceResponse(Device device) {
+ this.logMessage("Received a PUT for device: " + device);
+ }
+
+ @Override
+ public void getDeviceResponse(Device device) {
+ this.logMessage("The device is: " + device);
+ }
+
+ @Override
+ public void getDeviceCommandResponse(String s) {
+ this.logMessage("The device command is: " + s);
+ }
+
+ @Override
+ public void getLocationsResponse(LocationList locationList) {
+ this.logMessage("Locations are: " + locationList);
+ }
+
+ @Override
+ public void postLocationResponse(Location location) {
+ this.logMessage("Received a POST for location: " + location);
+ }
+
+ @Override
+ public void getLocationResponse(Location location) {
+ this.logMessage("The location is: " + location);
+ }
+
+ @Override
+ public void putLocationResponse(Location location) {
+ this.logMessage("Received a PUT for location: " + location);
+ }
+
+ @Override
+ public void deleteLocationResponse(boolean b) {
+ this.logMessage("Location has been deleted? " + b);
+ }
+
+ @Override
+ public void getProfilesResponse(ProfileList profileList) {
+ this.logMessage("Profiles are: " + profileList);
+ }
+
+ @Override
+ public void postProfileResponse(Profile profile) {
+ this.logMessage("Received a POST for profile: " + profile);
+ }
+
+ @Override
+ public void getProfileResponse(Profile profile) {
+ this.logMessage("The profile is: " + profile);
+ }
+
+ @Override
+ public void putProfileResponse(Profile profile) {
+ this.logMessage("Received a PUT for profile: " + profile);
+ }
+
+ @Override
+ public void deleteProfileResponse(boolean b) {
+ this.logMessage("Profile has been deleted? " + b);
+ }
+
+ @Override
+ public void getNotificationsResponse(NotificationList notificationList) {
+ this.logMessage("Notifications are: " + notificationList);
+ }
+
+ @Override
+ public void getNotificationResponse(Notification notification) {
+ this.logMessage("The notification is: " + notification);
+ }
+
+ @Override
+ public void putNotificationResponse(Notification notification) {
+ this.logMessage("Received a PUT for notification: " + notification);
+ }
+
+ @Override
+ public void getDeviceHistoriesResponse(DeviceHistoryList deviceHistoryList) {
+ this.logMessage("Device histories are: " + deviceHistoryList);
+ }
+
+ @Override
+ public void getDeviceHistoryResponse(DeviceHistory deviceHistory) {
+ this.logMessage("The device history is: " + deviceHistory);
+ }
+
+ @Override
+ public void getZWaveDeviceResponse(ZWaveDevice zWaveDevice) {
+ this.logMessage("The Z-Wave device is: " + zWaveDevice);
+ }
+
+ @Override
+ public void getZWaveControllerResponse(ZWaveController zWaveController) {
+ this.logMessage("The Z-Wave controller is: " + zWaveController);
+ }
+
+ @Override
+ public void apiError(String s, boolean b) {
+ this.logError("API Error: " + s);
+ }
+
+ @Override
+ public void httpStatusError(int i, String s, boolean b) {
+ this.logError("HTTP Status Error: " + i + s);
+ }
+
+ @Override
+ public void authenticationError() {
+ this.logError("Authentication Error");
+ }
+
+ @Override
+ public void responseFormatError(String s, boolean b) {
+ this.logError("Wrong format: " + s);
+ }
+
+ @Override
+ public void message(int i, String s) {
+ this.logMessage("You've got a message: " + i + " " + s);
+ }
+
+ /**
+ * Utility method to print the log messages of this class.
+ *
+ * @param message the {@link String} to print
+ */
+ private void logMessage(String message) {
+ Logger logger = LoggerFactory.getLogger(Sensor.class);
+ logger.debug(message);
+ }
+
+ /**
+ * Utility method to print the error messages of this class.
+ *
+ * @param error the {@link String} to print
+ */
+ private void logError(String error) {
+ Logger logger = LoggerFactory.getLogger(Sensor.class);
+ logger.error(error);
+ }
}
\ No newline at end of file
diff --git a/src/main/java/Main.java b/src/test/java/TestFitbit.java
similarity index 63%
rename from src/main/java/Main.java
rename to src/test/java/TestFitbit.java
index bc2c900..88b1261 100644
--- a/src/main/java/Main.java
+++ b/src/test/java/TestFitbit.java
@@ -1,13 +1,17 @@
-import manage.FITBITData.FitBit;
-
-public class Main {
- public static void main(String[] args) throws Exception {
- FitBit fitBit = new FitBit();
- fitBit.getHoursSleep();
-
- System.out.println("Today's average heart-rate: "+fitBit.getHeartRate());
- System.out.println("Today's hours of sleep: "+fitBit.getHoursSleep());
- System.out.println("Today's steps: "+fitBit.getSteps());
- System.out.println("Fine.");
- }
-}
+import org.junit.Test;
+
+import device.FitBit;
+
+public class TestFitbit {
+
+ @Test
+ public void test01() throws Exception {
+ FitBit fitBit = new FitBit();
+ fitBit.getHoursSleep();
+
+ System.out.println("Today's average heart-rate: "+fitBit.getHeartRate());
+ System.out.println("Today's hours of sleep: "+fitBit.getHoursSleep());
+ System.out.println("Today's steps: "+fitBit.getSteps());
+ System.out.println("Fine.");
+ }
+}