qSniff/source/sniffer.cpp

23 lines
308 B
C++
Raw Normal View History

2017-10-18 20:31:39 +00:00
#include "sniffer.h"
Sniffer::Sniffer(unsigned int pin)
{
wiringPiSetup();
m_switch.enableReceive(pin);
}
unsigned int Sniffer::receive()
{
if (m_switch.available())
{
unsigned int receivedValue = m_switch.getReceivedValue();
m_switch.resetAvailable();
return receivedValue;
}
return 0;
}