#pragma once #include #include "wx/wxprec.h" #include "rtl-sdr.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "wx/thread.h" #include "ThreadQueue.h" #include "DemodulatorMgr.h" class SDRThreadCommand { public: enum SDRThreadCommandEnum { SDR_THREAD_CMD_NULL, SDR_THREAD_CMD_TUNE }; SDRThreadCommand() : cmd(SDR_THREAD_CMD_NULL), int_value(0) { } SDRThreadCommand(SDRThreadCommandEnum cmd) : cmd(cmd), int_value(0) { } SDRThreadCommandEnum cmd; int int_value; }; class SDRThreadIQData { public: unsigned int frequency; unsigned int bandwidth; std::vector data; SDRThreadIQData(): frequency(0), bandwidth(0) { } SDRThreadIQData(unsigned int bandwidth, unsigned int frequency, std::vector data) : data(data), frequency(frequency), bandwidth(bandwidth) { } ~SDRThreadIQData() { } }; typedef ThreadQueue SDRThreadCommandQueue; typedef ThreadQueue SDRThreadIQDataQueue; class SDRThread { public: rtlsdr_dev_t *dev; SDRThread(SDRThreadCommandQueue* pQueue); ~SDRThread(); int enumerate_rtl(); void threadMain(); void setIQDataOutQueue(SDRThreadIQDataQueue* iqDataQueue) { iqDataOutQueue = iqDataQueue; } void terminate(); protected: uint32_t sample_rate; std::atomic m_pQueue; std::atomic iqDataOutQueue; std::atomic terminated; };