Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
d610efa5f1 | |||
2dcae04869 | |||
bbd03b56bb | |||
823ebbe42d | |||
35d3428321 | |||
fa85202c3d | |||
1d2084a017 | |||
bb82ff8317 |
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,3 +1,3 @@
|
||||
[submodule "source/rc-switch"]
|
||||
path = source/rc-switch
|
||||
[submodule "source/RCSwitch/rc-switch"]
|
||||
path = source/RCSwitch/rc-switch
|
||||
url = git@github.com:sui77/rc-switch.git
|
||||
|
@ -1,37 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
|
||||
find_package(Qt5Widgets)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
add_definitions(-DRPI)
|
||||
|
||||
add_library(rc-switch
|
||||
rc-switch/RCSwitch.cpp
|
||||
rc-switch/RCSwitch.h
|
||||
)
|
||||
|
||||
add_executable(qSniff
|
||||
qsniff.cpp
|
||||
mainwindow.cpp
|
||||
mainwindow.h
|
||||
mainwindow.ui
|
||||
sniffthread.cpp
|
||||
sniffthread.h
|
||||
sniffer.cpp
|
||||
sniffer.h
|
||||
)
|
||||
|
||||
target_link_libraries(qSniff rc-switch wiringPi Qt5::Widgets)
|
||||
|
||||
add_executable(Sniff
|
||||
sniff.cpp
|
||||
sniffer.cpp
|
||||
sniffer.h
|
||||
)
|
||||
|
||||
target_link_libraries(Sniff rc-switch wiringPi)
|
||||
add_subdirectory(RCSwitch)
|
||||
add_subdirectory(sniffer)
|
||||
add_subdirectory(qsniff)
|
||||
add_subdirectory(sniff)
|
||||
add_subdirectory(sender)
|
||||
add_subdirectory(send)
|
||||
|
||||
|
21
source/RCSwitch/CMakeLists.txt
Normal file
21
source/RCSwitch/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
||||
project(rc-switch)
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
|
||||
add_library(${PROJECT_NAME}
|
||||
rc-switch/RCSwitch.cpp
|
||||
rc-switch/RCSwitch.h
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
wiringPi
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC rc-switch
|
||||
)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PUBLIC RPI
|
||||
)
|
||||
|
||||
|
24
source/qsniff/CMakeLists.txt
Normal file
24
source/qsniff/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
||||
project(qSniff)
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
|
||||
find_package(Qt5Widgets)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
qsniff.cpp
|
||||
mainwindow.cpp
|
||||
mainwindow.h
|
||||
mainwindow.ui
|
||||
sniffthread.cpp
|
||||
sniffthread.h
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
sniffer
|
||||
Qt5::Widgets
|
||||
)
|
||||
|
13
source/send/CMakeLists.txt
Normal file
13
source/send/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
||||
project(Send)
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
send.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
sender
|
||||
)
|
||||
|
24
source/send/send.cpp
Normal file
24
source/send/send.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "sender.h"
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::cout << "Send" << std::endl;
|
||||
|
||||
Sender sender(27);
|
||||
|
||||
unsigned int data = 1;
|
||||
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
||||
std::cout << "Sending: " << data << std::endl;
|
||||
|
||||
sender.send(data++);
|
||||
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
18
source/sender/CMakeLists.txt
Normal file
18
source/sender/CMakeLists.txt
Normal file
@ -0,0 +1,18 @@
|
||||
project(sender)
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
add_library(${PROJECT_NAME}
|
||||
sender.cpp
|
||||
sender.h
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
rc-switch
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC .
|
||||
)
|
||||
|
14
source/sender/sender.cpp
Normal file
14
source/sender/sender.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "sender.h"
|
||||
|
||||
Sender::Sender(unsigned int pin)
|
||||
{
|
||||
wiringPiSetup();
|
||||
|
||||
m_switch.enableTransmit(pin);
|
||||
}
|
||||
|
||||
void Sender::send(unsigned int data)
|
||||
{
|
||||
m_switch.send(data, 32);
|
||||
}
|
||||
|
15
source/sender/sender.h
Normal file
15
source/sender/sender.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "RCSwitch.h"
|
||||
|
||||
class Sender
|
||||
{
|
||||
private:
|
||||
RCSwitch m_switch;
|
||||
|
||||
public:
|
||||
Sender() = delete;
|
||||
Sender(unsigned int pin);
|
||||
|
||||
void send(unsigned int data);
|
||||
};
|
13
source/sniff/CMakeLists.txt
Normal file
13
source/sniff/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
||||
project(Sniff)
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
sniff.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
sniffer
|
||||
)
|
||||
|
18
source/sniffer/CMakeLists.txt
Normal file
18
source/sniffer/CMakeLists.txt
Normal file
@ -0,0 +1,18 @@
|
||||
project(sniffer)
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
add_library(${PROJECT_NAME}
|
||||
sniffer.cpp
|
||||
sniffer.h
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
rc-switch
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC .
|
||||
)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "rc-switch/RCSwitch.h"
|
||||
#include "RCSwitch.h"
|
||||
|
||||
class Sniffer
|
||||
{
|
Reference in New Issue
Block a user