Some progress
This commit is contained in:
parent
52afc53660
commit
3bdb4ea043
14 changed files with 212 additions and 173 deletions
|
|
@ -42,7 +42,7 @@ public class SensorDataAggregationDeamonTest {
|
|||
System.out.println("Adding user to database");
|
||||
db.exec("INSERT INTO user(id, external, username) VALUES(222, 0, 'test')"); //adding user
|
||||
System.out.println("Adding sensor to database");
|
||||
db.exec("INSERT INTO sensor(id, user_id, external_id, type) VALUES(111, 222, 333, 'se.hal.plugin.tellstick.protocols.Oregon0x1A2D')"); //adding sensor
|
||||
db.exec("INSERT INTO sensor(id, user_id, external_id, type) VALUES(111, 222, 333, 'se.hal.plugin.tellstick.protocol.Oregon0x1A2DProtocol')"); //adding sensor
|
||||
System.out.println("Generating raw data and saving it to the database...");
|
||||
PreparedStatement stmt = db.getPreparedStatement("INSERT INTO sensor_data_raw (timestamp, sensor_id, data) VALUES(?, ?, ?)");
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package se.hal.plugin.tellstick;
|
||||
|
||||
import se.hal.plugin.tellstick.protocols.NexaSelfLearning;
|
||||
import se.hal.plugin.tellstick.protocol.NexaSelfLearningProtocol;
|
||||
|
||||
/**
|
||||
* Created by Ziver on 2015-11-19.
|
||||
|
|
@ -17,7 +17,7 @@ public class TelstickSerialCommNexaOnOffTest {
|
|||
|
||||
Thread.sleep(1000);
|
||||
|
||||
NexaSelfLearning nexa = new NexaSelfLearning();
|
||||
NexaSelfLearningProtocol nexa = new NexaSelfLearningProtocol();
|
||||
//nexa.setHouse(11772006);
|
||||
nexa.setHouse(14160770);
|
||||
nexa.setGroup(false);
|
||||
|
|
|
|||
|
|
@ -20,9 +20,8 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package se.hal.plugin.tellstick.protocols;
|
||||
package se.hal.plugin.tellstick.protocol;
|
||||
|
||||
import zutil.ByteUtil;
|
||||
import zutil.converter.Converter;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
|
@ -33,7 +32,7 @@ public class NexaSelfLearningTest {
|
|||
|
||||
@org.junit.Test
|
||||
public void testEncode() throws Exception {
|
||||
NexaSelfLearning nexa = new NexaSelfLearning();
|
||||
NexaSelfLearningProtocol nexa = new NexaSelfLearningProtocol();
|
||||
nexa.setHouse(11_772_006);
|
||||
nexa.setUnit(0);
|
||||
nexa.turnOn();
|
||||
|
|
@ -61,7 +60,7 @@ public class NexaSelfLearningTest {
|
|||
|
||||
@org.junit.Test
|
||||
public void decode_ON() throws Exception {
|
||||
NexaSelfLearning nexa = decode("0x2CE81990");
|
||||
NexaSelfLearningProtocol nexa = decode("0x2CE81990");
|
||||
|
||||
assertEquals("House Code", 11772006, nexa.getHouse());
|
||||
assertEquals("Unit Code", 0, nexa.getUnit());
|
||||
|
|
@ -70,15 +69,15 @@ public class NexaSelfLearningTest {
|
|||
|
||||
@org.junit.Test
|
||||
public void decode_OFF() throws Exception {
|
||||
NexaSelfLearning nexa = decode("0x2CE81980");
|
||||
NexaSelfLearningProtocol nexa = decode("0x2CE81980");
|
||||
|
||||
assertEquals("House Code", 11772006, nexa.getHouse());
|
||||
assertEquals("Unit Code", 0, nexa.getUnit());
|
||||
assertFalse("Enabled", nexa.isOn());
|
||||
}
|
||||
|
||||
private NexaSelfLearning decode(String data){
|
||||
NexaSelfLearning nexa = new NexaSelfLearning();
|
||||
private NexaSelfLearningProtocol decode(String data){
|
||||
NexaSelfLearningProtocol nexa = new NexaSelfLearningProtocol();
|
||||
nexa.decode(Converter.hexToByte(data));
|
||||
return nexa;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue