Added a Qt window for output

This commit is contained in:
Michael Mandl 2017-10-17 22:08:05 +02:00
parent bc7521ac95
commit 9006032f27
8 changed files with 184 additions and 36 deletions

View file

@ -1,40 +1,12 @@
#include "rc-switch/RCSwitch.h"
#include <wiringPi.h>
#include <iostream>
#include <QApplication>
#include "mainwindow.h"
int main(int argc, char **argv)
{
std::cout << "qSniff" << std::endl;
QApplication app(argc, argv);
wiringPiSetup();
MainWindow mainWindow;
mainWindow.show();
RCSwitch mySwitch = RCSwitch();
mySwitch.enableReceive(6);
while (true)
{
if (mySwitch.available())
{
int value = mySwitch.getReceivedValue();
if (value == 0)
{
std::cout << "Unknown encoding" << std::endl;
}
else
{
std::cout << "Received " << value << " / ";
std::cout << mySwitch.getReceivedBitlength() << " bit ";
std::cout << "Protocol: " << mySwitch.getReceivedProtocol();
std::cout << std::endl;
}
mySwitch.resetAvailable();
}
delay(100);
}
return 0;
return app.exec();
}