Copy SoapySDR::ArgInfo to bootstrap ModemArgInfo

This commit is contained in:
Charles J. Cliffe 2015-11-23 18:41:10 -05:00
parent 407abac8e8
commit de1264fe17
4 changed files with 93 additions and 3 deletions

View File

@ -3,7 +3,6 @@
#include <map>
#include <vector>
#include "SDRDevices.h"
#include "SDRDevicesForm.h"
#include "SoapySDRThread.h"
#include "SDREnumerator.h"

View File

@ -18,6 +18,20 @@ Modem *Modem::makeModem(std::string modemType) {
return nullptr;
}
ModemArgInfoList Modem::getSettings() {
ModemArgInfoList args;
return args;
}
void Modem::writeSetting(std::string setting, std::string value) {
// ...
}
std::string Modem::readSetting(std::string setting) {
return "";
}
Modem::Modem() {
}

View File

@ -29,6 +29,80 @@ public:
}
};
// Copy of SoapySDR::Range, original comments
class ModemRange
{
public:
//! Create an empty range (0.0, 0.0)
ModemRange(void);
//! Create a min/max range
ModemRange(const double minimum, const double maximum);
//! Get the range minimum
double minimum(void) const;
//! Get the range maximum
double maximum(void) const;
private:
double _min, _max;
};
// Modified version of SoapySDR::ArgInfo, original comments
class ModemArgInfo
{
public:
//! Default constructor
ModemArgInfo(void);
//! The key used to identify the argument (required)
std::string key;
/*!
* The default value of the argument when not specified (required)
* Numbers should use standard floating point and integer formats.
* Boolean values should be represented as "true" and "false".
*/
std::string value;
//! The displayable name of the argument (optional, use key if empty)
std::string name;
//! A brief description about the argument (optional)
std::string description;
//! The units of the argument: dB, Hz, etc (optional)
std::string units;
//! The data type of the argument (required)
enum Type { BOOL, INT, FLOAT, STRING, PATH_DIR, PATH_FILE, COLOR } type;
/*!
* The range of possible numeric values (optional)
* When specified, the argument should be restricted to this range.
* The range is only applicable to numeric argument types.
*/
ModemRange range;
/*!
* A discrete list of possible values (optional)
* When specified, the argument should be restricted to this options set.
*/
std::vector<std::string> options;
/*!
* A discrete list of displayable names for the enumerated options (optional)
* When not specified, the option value itself can be used as a display name.
*/
std::vector<std::string> optionNames;
};
typedef std::vector<ModemArgInfo> ModemArgInfoList;
class Modem;
typedef std::map<std::string,Modem *> ModemFactoryList;
@ -44,6 +118,9 @@ public:
Modem();
virtual ~Modem();
virtual ModemArgInfoList getSettings();
virtual void writeSetting(std::string setting, std::string value);
virtual std::string readSetting(std::string setting);
virtual int checkSampleRate(long long sampleRate, int audioSampleRate) = 0;
virtual ModemKit *buildKit(long long sampleRate, int audioSampleRate) = 0;
virtual void disposeKit(ModemKit *kit) = 0;