Sniff 433MHz data packages using rc-switch
parent
5072921182
commit
bc7521ac95
|
@ -0,0 +1,3 @@
|
|||
[submodule "source/rc-switch"]
|
||||
path = source/rc-switch
|
||||
url = git@github.com:sui77/rc-switch.git
|
|
@ -1,6 +1,15 @@
|
|||
project(qSniff)
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
|
||||
add_definitions(-DRPI)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
qSniff.cpp
|
||||
add_library(rc-switch
|
||||
rc-switch/RCSwitch.cpp
|
||||
rc-switch/RCSwitch.h
|
||||
)
|
||||
|
||||
add_executable(qSniff
|
||||
qsniff.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(qSniff rc-switch wiringPi)
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#include <iostream>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::cout << "qSniff" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
#include "rc-switch/RCSwitch.h"
|
||||
#include <wiringPi.h>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::cout << "qSniff" << std::endl;
|
||||
|
||||
wiringPiSetup();
|
||||
|
||||
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;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Subproject commit cf4b0053d72bbfa6831d6ff636dbd249ec385cff
|
Loading…
Reference in New Issue