2018-10-30 15:31:16 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
2019-04-11 00:39:30 -04:00
|
|
|
// (at your option) any later version. //
|
2018-10-30 15:31:16 -04:00
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef DEVICES_SOAPYSDR_DEVICESOAPYSDRSHARED_H_
|
|
|
|
#define DEVICES_SOAPYSDR_DEVICESOAPYSDRSHARED_H_
|
|
|
|
|
2018-11-11 19:10:51 -05:00
|
|
|
#include <QMap>
|
|
|
|
#include <QVariant>
|
|
|
|
|
2018-10-30 15:31:16 -04:00
|
|
|
#include <SoapySDR/Device.hpp>
|
|
|
|
|
2018-11-01 21:33:04 -04:00
|
|
|
#include "util/message.h"
|
2018-10-30 15:31:16 -04:00
|
|
|
#include "export.h"
|
2018-10-31 07:22:46 -04:00
|
|
|
#include "devicesoapysdrparams.h"
|
2018-10-30 15:31:16 -04:00
|
|
|
|
|
|
|
class SoapySDRInput;
|
|
|
|
class SoapySDROutput;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Structure shared by a buddy with other buddies
|
|
|
|
*/
|
|
|
|
class DEVICES_API DeviceSoapySDRShared
|
|
|
|
{
|
|
|
|
public:
|
2018-11-15 13:07:15 -05:00
|
|
|
class DEVICES_API MsgReportBuddyChange : public Message {
|
2018-11-01 21:33:04 -04:00
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
uint64_t getCenterFrequency() const { return m_centerFrequency; }
|
|
|
|
int getLOppmTenths() const { return m_LOppmTenths; }
|
|
|
|
int getFcPos() const { return m_fcPos; }
|
|
|
|
int getDevSampleRate() const { return m_devSampleRate; }
|
|
|
|
bool getRxElseTx() const { return m_rxElseTx; }
|
|
|
|
|
|
|
|
static MsgReportBuddyChange* create(
|
|
|
|
uint64_t centerFrequency,
|
|
|
|
int LOppmTenths,
|
|
|
|
int fcPos,
|
|
|
|
int devSampleRate,
|
|
|
|
bool rxElseTx)
|
|
|
|
{
|
|
|
|
return new MsgReportBuddyChange(
|
|
|
|
centerFrequency,
|
|
|
|
LOppmTenths,
|
|
|
|
fcPos,
|
|
|
|
devSampleRate,
|
|
|
|
rxElseTx);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint64_t m_centerFrequency; //!< Center frequency
|
|
|
|
int m_LOppmTenths; //!< LO soft correction in tenths of ppm
|
|
|
|
int m_fcPos; //!< Center frequency position
|
|
|
|
int m_devSampleRate; //!< device/host sample rate
|
|
|
|
bool m_rxElseTx; //!< tells which side initiated the message
|
|
|
|
|
|
|
|
MsgReportBuddyChange(
|
|
|
|
uint64_t centerFrequency,
|
|
|
|
int LOppmTenths,
|
|
|
|
int fcPos,
|
|
|
|
int devSampleRate,
|
|
|
|
bool rxElseTx) :
|
|
|
|
Message(),
|
|
|
|
m_centerFrequency(centerFrequency),
|
|
|
|
m_LOppmTenths(LOppmTenths),
|
|
|
|
m_fcPos(fcPos),
|
|
|
|
m_devSampleRate(devSampleRate),
|
|
|
|
m_rxElseTx(rxElseTx)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2018-11-15 13:07:15 -05:00
|
|
|
class DEVICES_API MsgReportDeviceArgsChange : public Message {
|
2018-11-11 19:10:51 -05:00
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
const QMap<QString, QVariant>& getDeviceArgSettings() const { return m_deviceArgSettings; }
|
|
|
|
|
|
|
|
static MsgReportDeviceArgsChange* create(const QMap<QString, QVariant>& deviceArgSettings) {
|
|
|
|
return new MsgReportDeviceArgsChange(deviceArgSettings);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
QMap<QString, QVariant> m_deviceArgSettings;
|
|
|
|
|
|
|
|
MsgReportDeviceArgsChange(const QMap<QString, QVariant>& deviceArgSettings) :
|
|
|
|
m_deviceArgSettings(deviceArgSettings)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2018-10-30 15:31:16 -04:00
|
|
|
DeviceSoapySDRShared();
|
|
|
|
~DeviceSoapySDRShared();
|
|
|
|
|
|
|
|
SoapySDR::Device *m_device;
|
2018-10-31 07:22:46 -04:00
|
|
|
DeviceSoapySDRParams *m_deviceParams;
|
2018-10-30 15:31:16 -04:00
|
|
|
int m_channel; //!< allocated channel (-1 if none)
|
|
|
|
SoapySDRInput *m_source;
|
|
|
|
SoapySDROutput *m_sink;
|
2018-11-04 12:56:57 -05:00
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
static const unsigned int m_sampleFifoMinRate;
|
2018-10-30 15:31:16 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* DEVICES_SOAPYSDR_DEVICESOAPYSDRSHARED_H_ */
|