diff --git a/airspy_source/CMakeLists.txt b/airspy_source/CMakeLists.txt index 43c9131e..cb6aa9fe 100644 --- a/airspy_source/CMakeLists.txt +++ b/airspy_source/CMakeLists.txt @@ -28,6 +28,7 @@ else (MSVC) pkg_check_modules(LIBAIRSPY REQUIRED libairspy) target_include_directories(airspy_source PUBLIC ${LIBAIRSPY_INCLUDE_DIRS}) + target_link_directories(airspyhf_source PUBLIC ${LIBAIRSPY_LIBRARY_DIRS}) target_link_libraries(airspy_source PUBLIC ${LIBAIRSPY_LIBRARIES}) endif () diff --git a/airspyhf_source/CMakeLists.txt b/airspyhf_source/CMakeLists.txt index a69b31b6..5e8ba4b7 100644 --- a/airspyhf_source/CMakeLists.txt +++ b/airspyhf_source/CMakeLists.txt @@ -28,6 +28,7 @@ else (MSVC) pkg_check_modules(LIBAIRSPYHF REQUIRED libairspyhf) target_include_directories(airspyhf_source PUBLIC ${LIBAIRSPYHF_INCLUDE_DIRS}) + target_link_directories(airspyhf_source PUBLIC ${LIBAIRSPYHF_LIBRARY_DIRS}) target_link_libraries(airspyhf_source PUBLIC ${LIBAIRSPYHF_LIBRARIES}) endif () diff --git a/audio_sink/CMakeLists.txt b/audio_sink/CMakeLists.txt index dad1a828..d391e1a2 100644 --- a/audio_sink/CMakeLists.txt +++ b/audio_sink/CMakeLists.txt @@ -31,7 +31,7 @@ else (MSVC) pkg_check_modules(RTAUDIO REQUIRED rtaudio) target_include_directories(audio_sink PUBLIC ${RTAUDIO_INCLUDE_DIRS}) - + target_link_directories(audio_sink PUBLIC ${RTAUDIO_LIBRARY_DIRS}) target_link_libraries(audio_sink PUBLIC ${RTAUDIO_LIBRARIES}) endif () diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 5ac25ef4..693f4628 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -64,6 +64,13 @@ else() ${VOLK_INCLUDE_DIRS} ) + target_link_directories(sdrpp_core PUBLIC + ${GLEW_LIBRARY_DIRS} + ${FFTW3_LIBRARY_DIRS} + ${GLFW3_LIBRARY_DIRS} + ${VOLK_LIBRARY_DIRS} + ) + target_link_libraries(sdrpp_core PUBLIC ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} diff --git a/core/src/utils/networking.cpp b/core/src/utils/networking.cpp new file mode 100644 index 00000000..efd1f31b --- /dev/null +++ b/core/src/utils/networking.cpp @@ -0,0 +1,2 @@ +#include + diff --git a/core/src/utils/networking.h b/core/src/utils/networking.h new file mode 100644 index 00000000..b7486d6d --- /dev/null +++ b/core/src/utils/networking.h @@ -0,0 +1,66 @@ +#pragma once +#include +#include +#include +#include +#include + +struct TCPAsyncRead { + int timeout; + int count; + void (*handler)(int count, char* data, void* ctx); + void* ctx; +}; + +struct TCPAsyncWrite { + int timeoutMs; + int count; + char* data; +}; + +enum { + NET_ERR_OK = 0, + NET_ERR_TIMEOUT = -1, + NET_ERR_SYSTEM = -2 +}; + +class TCPClient { +public: + TCPClient(); + ~TCPClient(); + + bool connect(std::string host, int port); + bool disconnect(); + + int enableAsync(); + int disableAsync(); + + bool isAsync(); + + int read(char* data, int count, int timeout = -1); + int write(char* data, int count, int timeout = -1); + + int asyncRead(int count, void (*handler)(int count, char* data, void* ctx), int timeout = -1); + int asyncWrite(char* data, int count, int timeout = -1); + + bool isOpen(); + + int close(); + +private: + void readWorker(); + void writeWorker(); + + std::mutex readQueueMtx; + std::vector readQueue; + + std::mutex writeQueueMtx; + std::vector writeQueue; + + std::thread readWorkerThread; + std::thread writeWorkerThread; + + bool open = false; + bool async = false; + +}; \ No newline at end of file diff --git a/hackrf_source/CMakeLists.txt b/hackrf_source/CMakeLists.txt index 29433196..ebee7b68 100644 --- a/hackrf_source/CMakeLists.txt +++ b/hackrf_source/CMakeLists.txt @@ -28,6 +28,7 @@ else (MSVC) pkg_check_modules(LIBHACKRF REQUIRED libhackrf) target_include_directories(hackrf_source PUBLIC ${LIBHACKRF_INCLUDE_DIRS}) + target_link_directories(hackrf_source PUBLIC ${LIBHACKRF_LIBRARY_DIRS}) target_link_libraries(hackrf_source PUBLIC ${LIBHACKRF_LIBRARIES}) endif () diff --git a/plutosdr_source/CMakeLists.txt b/plutosdr_source/CMakeLists.txt index 33ac123f..c6f62ced 100644 --- a/plutosdr_source/CMakeLists.txt +++ b/plutosdr_source/CMakeLists.txt @@ -31,9 +31,11 @@ else (MSVC) pkg_check_modules(LIBAD9361 REQUIRED libad9361) target_include_directories(plutosdr_source PUBLIC ${LIBIIO_INCLUDE_DIRS}) + target_link_directories(plutosdr_source PUBLIC ${LIBIIO_LIBRARY_DIRS}) target_link_libraries(plutosdr_source PUBLIC ${LIBIIO_LIBRARIES}) target_include_directories(plutosdr_source PUBLIC ${LIBAD9361_INCLUDE_DIRS}) + target_link_directories(plutosdr_source PUBLIC ${LIBAD9361_LIBRARY_DIRS}) target_link_libraries(plutosdr_source PUBLIC ${LIBAD9361_LIBRARIES}) endif () diff --git a/rtl_sdr_source/CMakeLists.txt b/rtl_sdr_source/CMakeLists.txt index 6d6ac6bc..61521c33 100644 --- a/rtl_sdr_source/CMakeLists.txt +++ b/rtl_sdr_source/CMakeLists.txt @@ -28,6 +28,7 @@ else (MSVC) pkg_check_modules(LIBRTLSDR REQUIRED librtlsdr) target_include_directories(rtl_sdr_source PUBLIC ${LIBRTLSDR_INCLUDE_DIRS}) + target_link_directories(rtl_sdr_source PUBLIC ${LIBRTLSDR_LIBRARY_DIRS}) target_link_libraries(rtl_sdr_source PUBLIC ${LIBRTLSDR_LIBRARIES}) endif () diff --git a/soapy_source/CMakeLists.txt b/soapy_source/CMakeLists.txt index fda01301..7b08d715 100644 --- a/soapy_source/CMakeLists.txt +++ b/soapy_source/CMakeLists.txt @@ -29,6 +29,7 @@ else (MSVC) pkg_check_modules(SOAPY REQUIRED SoapySDR) target_include_directories(soapy_source PUBLIC ${SOAPY_INCLUDE_DIRS}) + target_link_directories(soapy_source PUBLIC ${SOAPY_LIBRARY_DIRS}) target_link_libraries(soapy_source PUBLIC ${SOAPY_LIBRARIES}) endif ()