Split switch event data into multiple classes

This commit is contained in:
Ziver Koc 2021-01-02 04:25:04 +01:00
parent 4499824965
commit 6214c01157
23 changed files with 259 additions and 96 deletions

View file

@ -4,8 +4,6 @@ import org.junit.Before;
import org.junit.Test;
import se.hal.intf.*;
import se.hal.struct.devicedata.DimmerEventData;
import se.hal.struct.devicedata.SwitchEventData;
import se.hal.struct.devicedata.TemperatureSensorData;
import zutil.converter.Converter;
import java.util.ArrayList;

View file

@ -1,8 +1,7 @@
package se.hal.plugin.tellstick;
import se.hal.plugin.tellstick.device.NexaSelfLearning;
import se.hal.plugin.tellstick.protocol.NexaSelfLearningProtocol;
import se.hal.struct.devicedata.SwitchEventData;
import se.hal.struct.devicedata.OnOffEventData;
/**
* Created by Ziver on 2015-11-19.
@ -25,7 +24,7 @@ public class TelstickSerialCommNexaOnOffTest {
nexaDevice.setGroup(false);
nexaDevice.setUnit(1);
SwitchEventData nexaData = new SwitchEventData();
OnOffEventData nexaData = new OnOffEventData();
System.out.println("Up and Running");
while(true) {

View file

@ -3,7 +3,6 @@ package se.hal.plugin.tellstick;
import org.junit.Before;
import org.junit.Test;
import se.hal.intf.*;
import se.hal.struct.devicedata.SwitchEventData;
import se.hal.struct.devicedata.TemperatureSensorData;
import zutil.converter.Converter;
@ -21,7 +20,7 @@ public class TelstickSerialCommSensorTest {
public void init(){
TellstickParser.registerProtocol(TestSensor.class);
}
//############ Normal TCs

View file

@ -22,12 +22,11 @@
package se.hal.plugin.tellstick.protocol;
import se.hal.plugin.tellstick.TellstickProtocol;
import se.hal.plugin.tellstick.TellstickProtocol.TellstickDecodedEntry;
import se.hal.plugin.tellstick.device.NexaSelfLearning;
import se.hal.plugin.tellstick.device.NexaSelfLearningDimmer;
import se.hal.struct.devicedata.DimmerEventData;
import se.hal.struct.devicedata.SwitchEventData;
import se.hal.struct.devicedata.OnOffEventData;
import zutil.converter.Converter;
import java.nio.charset.StandardCharsets;
@ -42,7 +41,7 @@ public class NexaSelfLearningTest {
NexaSelfLearning nexaDevice = new NexaSelfLearning();
nexaDevice.setHouse(11_772_006);
nexaDevice.setUnit(3);
SwitchEventData nexaData = new SwitchEventData(true, System.currentTimeMillis());
OnOffEventData nexaData = new OnOffEventData(true, System.currentTimeMillis());
byte[] expected = Converter.toBytes(new char[]{
84, // T
@ -99,7 +98,7 @@ public class NexaSelfLearningTest {
assertEquals("House Code", 11772006, ((NexaSelfLearning)nexa.getDevice()).getHouse());
assertEquals("Unit Code", 0, ((NexaSelfLearning)nexa.getDevice()).getUnit());
assertTrue("Enabled", ((SwitchEventData)nexa.getData()).isOn());
assertTrue("Enabled", ((OnOffEventData)nexa.getData()).isOn());
}
@org.junit.Test
@ -108,7 +107,7 @@ public class NexaSelfLearningTest {
assertEquals("House Code", 11772006, ((NexaSelfLearning)nexa.getDevice()).getHouse());
assertEquals("Unit Code", 0, ((NexaSelfLearning)nexa.getDevice()).getUnit());
assertFalse("Enabled", ((SwitchEventData)nexa.getData()).isOn());
assertFalse("Enabled", ((OnOffEventData)nexa.getData()).isOn());
}
private TellstickDecodedEntry decode(String data){