From de1264fe1717f0a8447b48def0f707cebf34f5b6 Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Mon, 23 Nov 2015 18:41:10 -0500 Subject: [PATCH] Copy SoapySDR::ArgInfo to bootstrap ModemArgInfo --- CMakeLists.txt | 4 +- src/forms/SDRDevices/SDRDevices.h | 1 - src/modules/modem/Modem.cpp | 14 ++++++ src/modules/modem/Modem.h | 77 +++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e15696e..b89525f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -287,7 +287,7 @@ SET (cubicsdr_sources ) IF(ENABLE_DIGITAL_LAB) - SET (cubicsdr_sources + SET (cubicsdr_sources ${cubicsdr_sources} src/modules/modem/digital/ModemASK.cpp src/modules/modem/digital/ModemAPSK.cpp @@ -389,7 +389,7 @@ SET (cubicsdr_headers ) IF(ENABLE_DIGITAL_LAB) -SET(cubicsdr_headers +SET (cubicsdr_headers ${cubicsdr_headers} src/modules/modem/digital/ModemASK.h src/modules/modem/digital/ModemAPSK.h diff --git a/src/forms/SDRDevices/SDRDevices.h b/src/forms/SDRDevices/SDRDevices.h index 74441ae..c6052a1 100644 --- a/src/forms/SDRDevices/SDRDevices.h +++ b/src/forms/SDRDevices/SDRDevices.h @@ -3,7 +3,6 @@ #include #include -#include "SDRDevices.h" #include "SDRDevicesForm.h" #include "SoapySDRThread.h" #include "SDREnumerator.h" diff --git a/src/modules/modem/Modem.cpp b/src/modules/modem/Modem.cpp index 8a1ff0e..30ea605 100644 --- a/src/modules/modem/Modem.cpp +++ b/src/modules/modem/Modem.cpp @@ -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() { } diff --git a/src/modules/modem/Modem.h b/src/modules/modem/Modem.h index 51629e5..cda7a95 100644 --- a/src/modules/modem/Modem.h +++ b/src/modules/modem/Modem.h @@ -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 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 optionNames; +}; + +typedef std::vector ModemArgInfoList; + class Modem; typedef std::map 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;