Updated Tellstick drivers and Switched from System.ou.print to Logger

Former-commit-id: 62d5bf468e366ecf4056602de469c151311c9a12
This commit is contained in:
Ziver Koc 2015-11-20 21:29:55 +01:00
parent c2138902f0
commit aa656cdc05
27 changed files with 125 additions and 199 deletions

View file

@ -0,0 +1,56 @@
package se.koc.hal.plugin.tellstick;
import se.koc.hal.plugin.tellstick.protocols.NexaSelfLearning;
import se.koc.hal.plugin.tellstick.protocols.Oregon0x1A2D;
import zutil.db.DBConnection;
import zutil.log.LogUtil;
import java.sql.SQLException;
import java.util.logging.Logger;
/**
* Created by Ziver on 2015-11-19.
*/
public class TelstickSerialCommNexaOnOffTest {
public static void main(String[] args) {
try {
System.out.println("Connecting to db...");
TellstickSerialComm comm = new TellstickSerialComm();
// http://developer.telldus.com/doxygen/TellStick.html
System.out.println("Connecting to com port...");
//comm.connect("COM5");
comm.connect("/dev/ttyUSB1");
Thread.sleep(1000);
NexaSelfLearning nexa = new NexaSelfLearning();
//nexa.setHouse(11772006);
nexa.setHouse(15087918);
nexa.setGroup(0);
nexa.setUnit(0);
System.out.println("Up and Running");
while(true) {
Thread.sleep(2000);
nexa.setEnable(true);
nexa.setUnit(0);
comm.write(nexa);
Thread.sleep(2000);
nexa.setUnit(1);
comm.write(nexa);
Thread.sleep(2000);
nexa.setEnable(false);
nexa.setUnit(0);
comm.write(nexa);
Thread.sleep(2000);
nexa.setUnit(1);
comm.write(nexa);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}