Refactor classes

This commit is contained in:
2018-08-23 15:25:12 +02:00
parent 3798d18844
commit 09d8b7781f
13 changed files with 392 additions and 384 deletions

View File

@@ -1,4 +1,4 @@
package manage.FITBITData;
package device.FITBITData;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

View File

@@ -1,4 +1,4 @@
package manage.FITBITData;
package device.FITBITData;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

View File

@@ -1,4 +1,4 @@
package manage.FITBITData;
package device.FITBITData;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

View File

@@ -1,4 +1,4 @@
package manage.FITBITData;
package device.FITBITData;
import java.text.SimpleDateFormat;
import java.util.Date;

View File

@@ -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 {

View File

@@ -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";

View File

@@ -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());

View File

@@ -1,4 +1,4 @@
package manage;
package oauth;
import java.io.IOException;
import java.util.Arrays;

View File

@@ -1,4 +1,4 @@
package manage;
package oauth;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.util.Key;

View File

@@ -1,4 +1,4 @@
package manage;
package oauth;
public class OAuth2ClientCredentials {

View File

@@ -1,4 +1,4 @@
package manage;
package support;
import java.io.IOException;
import java.util.HashMap;

View File

@@ -1,4 +1,4 @@
package device;
package support;
import de.fh_zwickau.informatik.sensor.IZWayApiCallbacks;
import de.fh_zwickau.informatik.sensor.model.devicehistory.DeviceHistory;
@@ -17,6 +17,8 @@ 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;

View File

@@ -1,13 +1,17 @@
import manage.FITBITData.FitBit;
import org.junit.Test;
public class Main {
public static void main(String[] args) throws Exception {
FitBit fitBit = new FitBit();
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.");
}
}
}