2017-01-02 21:07:43 -05:00
|
|
|
// Copyright (c) Charles J. Cliffe
|
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
2015-04-13 19:58:34 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <wx/stdpaths.h>
|
|
|
|
#include <wx/dir.h>
|
|
|
|
#include <wx/filename.h>
|
2015-07-15 00:32:36 -04:00
|
|
|
#include <wx/panel.h>
|
2015-07-08 18:54:52 -04:00
|
|
|
#include <atomic>
|
|
|
|
#include <mutex>
|
2015-04-13 19:58:34 -04:00
|
|
|
|
|
|
|
#include "DataTree.h"
|
2016-01-22 00:40:00 -05:00
|
|
|
#include "CubicSDRDefs.h"
|
|
|
|
#include "SDRDeviceInfo.h"
|
2015-04-13 19:58:34 -04:00
|
|
|
|
2015-12-06 00:32:32 -05:00
|
|
|
typedef std::map<std::string, std::string> ConfigSettings;
|
2016-05-11 22:37:25 -04:00
|
|
|
typedef std::map<std::string, float> ConfigGains;
|
2015-12-06 00:32:32 -05:00
|
|
|
|
2015-04-21 23:19:45 -04:00
|
|
|
class DeviceConfig {
|
2015-04-13 19:58:34 -04:00
|
|
|
public:
|
2015-04-21 23:19:45 -04:00
|
|
|
DeviceConfig();
|
|
|
|
DeviceConfig(std::string deviceId);
|
|
|
|
|
|
|
|
void setPPM(int ppm);
|
|
|
|
int getPPM();
|
2015-07-08 01:07:39 -04:00
|
|
|
|
|
|
|
void setOffset(long long offset);
|
|
|
|
long long getOffset();
|
|
|
|
|
2016-05-11 22:37:25 -04:00
|
|
|
void setSampleRate(long srate);
|
|
|
|
long getSampleRate();
|
|
|
|
|
2017-08-23 17:27:49 -04:00
|
|
|
void setAntennaName(const std::string& name);
|
|
|
|
const std::string& getAntennaName();
|
|
|
|
|
2016-05-11 22:37:25 -04:00
|
|
|
void setAGCMode(bool agcMode);
|
|
|
|
bool getAGCMode();
|
|
|
|
|
2015-04-21 23:19:45 -04:00
|
|
|
void setDeviceId(std::string deviceId);
|
|
|
|
std::string getDeviceId();
|
|
|
|
|
2016-01-18 20:46:56 -05:00
|
|
|
void setDeviceName(std::string deviceName);
|
|
|
|
std::string getDeviceName();
|
|
|
|
|
2015-12-06 00:32:32 -05:00
|
|
|
void setStreamOpts(ConfigSettings opts);
|
|
|
|
ConfigSettings getStreamOpts();
|
|
|
|
void setStreamOpt(std::string key, std::string value);
|
|
|
|
std::string getStreamOpt(std::string key, std::string defaultValue);
|
|
|
|
|
|
|
|
void setSettings(ConfigSettings settings);
|
|
|
|
ConfigSettings getSettings();
|
|
|
|
void setSetting(std::string key, std::string value);
|
|
|
|
std::string getSetting(std::string key, std::string defaultValue);
|
2016-05-11 22:37:25 -04:00
|
|
|
|
|
|
|
void setGains(ConfigGains gains);
|
|
|
|
ConfigGains getGains();
|
|
|
|
void setGain(std::string key, float value);
|
|
|
|
float getGain(std::string key, float defaultValue);
|
|
|
|
|
2016-01-09 00:09:46 -05:00
|
|
|
void setRigIF(int rigType, long long freq);
|
|
|
|
long long getRigIF(int rigType);
|
2016-01-22 00:40:00 -05:00
|
|
|
|
2015-04-21 23:19:45 -04:00
|
|
|
void save(DataNode *node);
|
|
|
|
void load(DataNode *node);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string deviceId;
|
2016-01-18 20:46:56 -05:00
|
|
|
std::string deviceName;
|
2017-08-23 17:27:49 -04:00
|
|
|
|
2015-07-08 18:54:52 -04:00
|
|
|
std::mutex busy_lock;
|
|
|
|
|
2015-11-02 19:02:45 -05:00
|
|
|
std::atomic_int ppm;
|
2015-07-14 19:44:19 -04:00
|
|
|
std::atomic_llong offset;
|
2016-05-11 22:37:25 -04:00
|
|
|
std::atomic_bool agcMode;
|
|
|
|
std::atomic_long sampleRate;
|
2017-08-23 17:27:49 -04:00
|
|
|
std::string antennaName;
|
2015-12-06 00:32:32 -05:00
|
|
|
ConfigSettings streamOpts;
|
2016-05-11 22:37:25 -04:00
|
|
|
ConfigGains gains;
|
2015-12-06 00:32:32 -05:00
|
|
|
std::map<std::string, std::string> settings;
|
2016-01-09 00:09:46 -05:00
|
|
|
std::map<int, long long> rigIF;
|
2015-04-21 23:19:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class AppConfig {
|
|
|
|
public:
|
2018-05-17 11:12:29 -04:00
|
|
|
|
|
|
|
enum PerfModeEnum {
|
|
|
|
PERF_LOW = 0,
|
|
|
|
PERF_NORMAL = 1,
|
|
|
|
PERF_HIGH = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-07-16 18:57:03 -04:00
|
|
|
AppConfig();
|
2015-04-13 19:58:34 -04:00
|
|
|
std::string getConfigDir();
|
2015-04-21 23:19:45 -04:00
|
|
|
DeviceConfig *getDevice(std::string deviceId);
|
2015-04-13 19:58:34 -04:00
|
|
|
|
2015-07-15 00:32:36 -04:00
|
|
|
void setWindow(wxPoint winXY, wxSize winWH);
|
|
|
|
wxRect *getWindow();
|
|
|
|
|
2015-07-16 18:57:03 -04:00
|
|
|
void setWindowMaximized(bool max);
|
|
|
|
bool getWindowMaximized();
|
|
|
|
|
2016-07-28 22:50:02 -04:00
|
|
|
void setModemPropsCollapsed(bool collapse);
|
|
|
|
bool getModemPropsCollapsed();
|
|
|
|
|
2016-02-08 22:43:11 -05:00
|
|
|
void setShowTips(bool show);
|
|
|
|
bool getShowTips();
|
|
|
|
|
2018-05-17 11:12:29 -04:00
|
|
|
void setPerfMode(PerfModeEnum mode);
|
|
|
|
PerfModeEnum getPerfMode();
|
2016-03-31 21:32:50 -04:00
|
|
|
|
2015-07-15 00:32:36 -04:00
|
|
|
void setTheme(int themeId);
|
|
|
|
int getTheme();
|
2015-07-18 21:49:53 -04:00
|
|
|
|
2016-06-20 13:28:26 -04:00
|
|
|
void setFontScale(int scaleValue);
|
|
|
|
int getFontScale();
|
|
|
|
|
2015-07-18 21:49:53 -04:00
|
|
|
void setSnap(long long snapVal);
|
|
|
|
long long getSnap();
|
2015-07-20 22:51:19 -04:00
|
|
|
|
|
|
|
void setCenterFreq(long long freqVal);
|
|
|
|
long long getCenterFreq();
|
2015-08-13 22:00:05 -04:00
|
|
|
|
|
|
|
void setWaterfallLinesPerSec(int lps);
|
|
|
|
int getWaterfallLinesPerSec();
|
|
|
|
|
|
|
|
void setSpectrumAvgSpeed(float avgSpeed);
|
|
|
|
float getSpectrumAvgSpeed();
|
|
|
|
|
2016-10-20 21:44:33 -04:00
|
|
|
void setDBOffset(int offset);
|
|
|
|
int getDBOffset();
|
|
|
|
|
2016-01-22 00:40:00 -05:00
|
|
|
void setManualDevices(std::vector<SDRManualDef> manuals);
|
|
|
|
std::vector<SDRManualDef> getManualDevices();
|
|
|
|
|
2016-12-18 12:00:53 -05:00
|
|
|
void setMainSplit(float value);
|
|
|
|
float getMainSplit();
|
|
|
|
|
|
|
|
void setVisSplit(float value);
|
|
|
|
float getVisSplit();
|
|
|
|
|
|
|
|
void setBookmarkSplit(float value);
|
|
|
|
float getBookmarkSplit();
|
|
|
|
|
2016-12-27 15:36:33 -05:00
|
|
|
void setBookmarksVisible(bool state);
|
|
|
|
bool getBookmarksVisible();
|
|
|
|
|
2018-01-13 05:50:08 -05:00
|
|
|
//Recording settings:
|
2017-09-24 23:50:08 -04:00
|
|
|
void setRecordingPath(std::string recPath);
|
|
|
|
std::string getRecordingPath();
|
2018-01-13 05:50:08 -05:00
|
|
|
bool verifyRecordingPath();
|
|
|
|
|
|
|
|
void setRecordingSquelchOption(int enumChoice);
|
|
|
|
int getRecordingSquelchOption();
|
2016-12-18 12:00:53 -05:00
|
|
|
|
2018-01-13 05:50:08 -05:00
|
|
|
void setRecordingFileTimeLimit(int nbSeconds);
|
|
|
|
int getRecordingFileTimeLimit();
|
2017-12-04 22:44:47 -05:00
|
|
|
|
2016-01-03 19:00:26 -05:00
|
|
|
#if USE_HAMLIB
|
|
|
|
int getRigModel();
|
|
|
|
void setRigModel(int rigModel);
|
|
|
|
|
|
|
|
int getRigRate();
|
|
|
|
void setRigRate(int rigRate);
|
|
|
|
|
|
|
|
std::string getRigPort();
|
|
|
|
void setRigPort(std::string rigPort);
|
2016-02-16 01:13:26 -05:00
|
|
|
|
|
|
|
void setRigControlMode(bool cMode);
|
|
|
|
bool getRigControlMode();
|
|
|
|
|
|
|
|
void setRigFollowMode(bool fMode);
|
|
|
|
bool getRigFollowMode();
|
2016-02-29 23:14:23 -05:00
|
|
|
|
|
|
|
void setRigCenterLock(bool cLock);
|
|
|
|
bool getRigCenterLock();
|
|
|
|
|
|
|
|
void setRigFollowModem(bool fMode);
|
|
|
|
bool getRigFollowModem();
|
2016-02-16 01:13:26 -05:00
|
|
|
|
|
|
|
void setRigEnabled(bool enabled);
|
|
|
|
bool getRigEnabled();
|
2016-01-03 19:00:26 -05:00
|
|
|
#endif
|
|
|
|
|
2015-07-20 18:39:45 -04:00
|
|
|
void setConfigName(std::string configName);
|
2015-07-20 22:09:36 -04:00
|
|
|
std::string getConfigFileName(bool ignoreName=false);
|
2015-04-13 19:58:34 -04:00
|
|
|
bool save();
|
|
|
|
bool load();
|
|
|
|
bool reset();
|
2015-04-21 23:19:45 -04:00
|
|
|
|
2015-04-13 19:58:34 -04:00
|
|
|
private:
|
2015-07-20 18:39:45 -04:00
|
|
|
std::string configName;
|
2015-07-14 19:44:19 -04:00
|
|
|
std::map<std::string, DeviceConfig *> deviceConfig;
|
2015-07-15 00:32:36 -04:00
|
|
|
std::atomic_int winX,winY,winW,winH;
|
2018-05-17 11:12:29 -04:00
|
|
|
std::atomic_bool winMax, showTips, modemPropsCollapsed;
|
2015-07-15 00:32:36 -04:00
|
|
|
std::atomic_int themeId;
|
2016-06-20 13:28:26 -04:00
|
|
|
std::atomic_int fontScale;
|
2015-07-18 21:49:53 -04:00
|
|
|
std::atomic_llong snap;
|
2015-07-20 22:51:19 -04:00
|
|
|
std::atomic_llong centerFreq;
|
2015-08-13 22:00:05 -04:00
|
|
|
std::atomic_int waterfallLinesPerSec;
|
2016-12-18 12:00:53 -05:00
|
|
|
std::atomic<float> spectrumAvgSpeed, mainSplit, visSplit, bookmarkSplit;
|
2016-10-20 21:44:33 -04:00
|
|
|
std::atomic_int dbOffset;
|
2016-01-22 00:40:00 -05:00
|
|
|
std::vector<SDRManualDef> manualDevices;
|
2017-01-03 12:41:38 -05:00
|
|
|
std::atomic_bool bookmarksVisible;
|
2018-01-13 05:50:08 -05:00
|
|
|
|
2018-05-18 11:04:39 -04:00
|
|
|
std::atomic<PerfModeEnum> perfMode;
|
|
|
|
|
2018-01-13 05:50:08 -05:00
|
|
|
std::string recordingPath = "";
|
|
|
|
int recordingSquelchOption = 0;
|
|
|
|
int recordingFileTimeLimitSeconds = 0;
|
2016-01-03 19:00:26 -05:00
|
|
|
#if USE_HAMLIB
|
|
|
|
std::atomic_int rigModel, rigRate;
|
|
|
|
std::string rigPort;
|
2017-01-03 12:41:38 -05:00
|
|
|
std::atomic_bool rigEnabled, rigFollowMode, rigControlMode, rigCenterLock, rigFollowModem;
|
2016-01-03 19:00:26 -05:00
|
|
|
#endif
|
2015-04-13 19:58:34 -04:00
|
|
|
};
|