1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-03 06:24:48 -04:00

RTL-SDR: refactoring: device open close moved in the constructor and destructor respectively of the input object

This commit is contained in:
f4exb
2017-04-13 01:21:25 +02:00
parent 934e73f7a7
commit bb5fd95f33
5 changed files with 216 additions and 139 deletions
+29 -10
View File
@@ -49,26 +49,41 @@ public:
{ }
};
class MsgReportRTLSDR : public Message {
class MsgQueryRTLSDR : public Message {
MESSAGE_CLASS_DECLARATION
public:
const std::vector<int>& getGains() const { return m_gains; }
static MsgReportRTLSDR* create(const std::vector<int>& gains)
static MsgQueryRTLSDR* create()
{
return new MsgReportRTLSDR(gains);
return new MsgQueryRTLSDR();
}
protected:
std::vector<int> m_gains;
MsgReportRTLSDR(const std::vector<int>& gains) :
Message(),
m_gains(gains)
MsgQueryRTLSDR() :
Message()
{ }
};
class MsgReportRTLSDR : public Message {
MESSAGE_CLASS_DECLARATION
public:
const std::vector<int>& getGains() const { return m_gains; }
static MsgReportRTLSDR* create(const std::vector<int>& gains)
{
return new MsgReportRTLSDR(gains);
}
protected:
std::vector<int> m_gains;
MsgReportRTLSDR(const std::vector<int>& gains) :
Message(),
m_gains(gains)
{ }
};
RTLSDRInput(DeviceSourceAPI *deviceAPI);
virtual ~RTLSDRInput();
@@ -81,6 +96,7 @@ public:
virtual bool handleMessage(const Message& message);
const std::vector<int>& getGains() const { return m_gains; }
void set_ds_mode(int on);
private:
@@ -91,7 +107,10 @@ private:
RTLSDRThread* m_rtlSDRThread;
QString m_deviceDescription;
std::vector<int> m_gains;
bool m_running;
bool openDevice();
void closeDevice();
bool applySettings(const RTLSDRSettings& settings, bool force);
};