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

View File

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

View File

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