- added Mainfest for exporting in .jar
- Fixed fitbit getHeartRate
- Classes now throws exceptions if not initialized properly
- Added arguments for main
- Added try and catch system in main
- Todos now are more clear
- Added Log in Rest for errors
This commit is contained in:
2018-09-05 20:46:57 +02:00
parent db1c6e0801
commit 4ab578226c
6 changed files with 183 additions and 45 deletions

View File

@@ -42,22 +42,25 @@ public class Sensor {
/**
* Crea un sensore contenente tutti i nodi
* @throws NullPointerException se non trova nessun sensore
*/
public Sensor() {
this(null);
}
public Sensor() throws NullPointerException { this(null); }
/**
* Si connette ad un sensore che ha il nodeId selezioniato
* @param nodeId nodo che viene selezionato
* @throws NullPointerException se non trova nessun sensore
*/
public Sensor (Integer nodeId) {
public Sensor (Integer nodeId) throws NullPointerException {
// create an instance of the Z-Way library; all the params are mandatory (we are not going to use the remote service/id)
IZWayApi zwayApi = new ZWayApiHttp(IP_ADDRESS, PORT, "http", USERNAME, PASSWORD, 0, false, new ZWaySimpleCallback());
// get all the Z-Wave devices
allZWaveDevices = zwayApi.getDevices();
if(allZWaveDevices == null)
throw new NullPointerException("I sensori non sono stati trovati");
if(nodeId != null)
useNode(nodeId);
else
@@ -94,7 +97,10 @@ public class Sensor {
synchronized public void update(int timeout) throws InterruptedException {
wait(timeout);
for (Device device : devices.getAllDevices())
device.update();
try {
device.update();
} catch (Exception e) {}
wait(timeout);
}
/*