Added a Qt window for output
This commit is contained in:
parent
bc7521ac95
commit
9006032f27
8 changed files with 184 additions and 36 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue