cleaned debug messages

This commit is contained in:
Simon Stürz 2014-01-04 04:25:59 +01:00
parent 7b1a9cb19d
commit cb12231c44
3 changed files with 31 additions and 22 deletions

View File

@ -19,6 +19,7 @@ QList<DeviceClass> DevicePluginElro::supportedDevices() const
// TODO: load list from config with static uuid
QList<DeviceClass> ret;
// =======================================
// Remote
DeviceClass deviceClassElroRemote(pluginId(), elroRemoteId);
deviceClassElroRemote.setName("Elro Remote");
@ -79,6 +80,7 @@ QList<DeviceClass> DevicePluginElro::supportedDevices() const
deviceClassElroRemote.setTriggers(buttonTriggers);
ret.append(deviceClassElroRemote);
// =======================================
// Switch
DeviceClass deviceClassElroSwitch(pluginId(), elroSwitchId);
deviceClassElroSwitch.setName("Elro Power Switch");
@ -187,6 +189,7 @@ void DevicePluginElro::executeAction(Device *device, const Action &action)
binCode.append("01");
}
// =======================================
// Buttons
if(device->params().value("A").toBool()){
binCode.append("00");
@ -219,7 +222,7 @@ void DevicePluginElro::executeAction(Device *device, const Action &action)
}else{
binCode.append("0100");
}
qDebug() << "bin code:" << binCode;
// =======================================
//create rawData timings list
int delay = 350;
@ -241,7 +244,8 @@ void DevicePluginElro::executeAction(Device *device, const Action &action)
// =======================================
// send data to driver
qDebug() << "rawData" << rawData;
//qDebug() << "rawData" << rawData;
qDebug() << "transmit" << pluginName() << action.params().value("power").toBool();
transmitData(rawData);
}
@ -275,11 +279,13 @@ void DevicePluginElro::receiveData(QList<int> rawData)
divNext = 3;
}
// _
// if we have | |___ = 0 -> in 4 delays => 1000
// _
// if we have ___| | = 1 -> in 4 delays => 0001
/*
* _
* | |___ = 0 -> in 4 delays => 1000
* _
* ___| | = 1 -> in 4 delays => 0001
*/
if(div == 1 && divNext == 3){
binCode.append('0');
}else if(div == 3 && divNext == 1){

View File

@ -18,6 +18,7 @@ QList<DeviceClass> DevicePluginIntertechno::supportedDevices() const
{
QList<DeviceClass> ret;
// =======================================
// Remote
DeviceClass deviceClassIntertechnoRemote(pluginId(), intertechnoRemote);
deviceClassIntertechnoRemote.setName("Intertechno Remote");
@ -137,6 +138,7 @@ QList<DeviceClass> DevicePluginIntertechno::supportedDevices() const
ret.append(deviceClassIntertechnoRemote);
// =======================================
// Switch
DeviceClass deviceClassIntertechnoSwitch(pluginId(), intertechnoSwitch);
deviceClassIntertechnoSwitch.setName("Intertechno Switch");
@ -286,7 +288,7 @@ void DevicePluginIntertechno::executeAction(Device *device, const Action &action
}else{
binCode.append("0100");
}
qDebug() << "bin code:" << binCode;
//qDebug() << "bin code:" << binCode;
// =======================================
//create rawData timings list
int delay = 350;
@ -308,7 +310,7 @@ void DevicePluginIntertechno::executeAction(Device *device, const Action &action
// =======================================
// send data to driver
qDebug() << "rawData" << rawData;
qDebug() << "transmit" << pluginName() << familyCode << buttonCode << action.params().value("power").toBool();
transmitData(rawData);
}
@ -330,6 +332,7 @@ void DevicePluginIntertechno::receiveData(QList<int> rawData)
int delay = rawData.first()/31;
QByteArray binCode;
// =======================================
// average 314
if(delay > 300 && delay < 400){
// go trough all 48 timings (without sync signal)
@ -367,11 +370,13 @@ void DevicePluginIntertechno::receiveData(QList<int> rawData)
return;
}
// =======================================
// Check nibble 16-19, must be 0001
if(binCode.mid(16,4) != "0001"){
return;
}
// =======================================
// Get family code
QString familyCode;
bool ok;
@ -435,6 +440,7 @@ void DevicePluginIntertechno::receiveData(QList<int> rawData)
return;
}
// =======================================
// Get button code
QString buttonCode;
QByteArray buttonCodeBin = binCode.mid(8,8);
@ -497,6 +503,7 @@ void DevicePluginIntertechno::receiveData(QList<int> rawData)
return;
}
// =======================================
// get power status -> On = 0100, Off = 0001
bool power;
if(binCode.right(4).toInt(0,2) == 5){
@ -507,7 +514,7 @@ void DevicePluginIntertechno::receiveData(QList<int> rawData)
return;
}
//qDebug() << "family code = " << familyCode << "button code =" << buttonCode << power;
qDebug() << "family code = " << familyCode << "button code =" << buttonCode << power;
// ===================================================
Device *device = 0;

View File

@ -155,6 +155,14 @@ void DevicePluginMeisterAnker::receiveData(QList<int> rawData)
return;
}
// check if the battery is low
bool batteryStatus;
if(batteryBin.toInt(0,2) == 0){
batteryStatus = true;
}else{
batteryStatus = false;
}
// check sign of temperature -> if first bit of temperature byte is 1 -> temp is negativ
int sign = 0;
if(temperatureBin.left(1).toInt() == 1){
@ -166,19 +174,7 @@ void DevicePluginMeisterAnker::receiveData(QList<int> rawData)
// calc temperature
float temperature = sign*(temperatureBin.right(7).toInt(0,2) + (float)temperatureTenthBin.toInt(0,2)/10);
// check if the battery is low
bool batteryStatus;
if(batteryBin.toInt(0,2) == 0){
batteryStatus = true;
}else{
batteryStatus = false;
}
// TODO: check if it is the same temperature than the last time
// QString timeStamp = QDateTime::currentDateTime().toString("dd.MM.yyyy, hh:mm:ss");
}