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"
|
|
|
|
|
2015-12-06 00:32:32 -05:00
|
|
|
typedef std::map<std::string, std::string> ConfigSettings;
|
|
|
|
|
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();
|
|
|
|
|
2015-04-21 23:19:45 -04:00
|
|
|
void setDeviceId(std::string deviceId);
|
|
|
|
std::string getDeviceId();
|
|
|
|
|
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-01-09 00:09:46 -05:00
|
|
|
void setRigIF(int rigType, long long freq);
|
|
|
|
long long getRigIF(int rigType);
|
|
|
|
|
2015-04-21 23:19:45 -04:00
|
|
|
void save(DataNode *node);
|
|
|
|
void load(DataNode *node);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string deviceId;
|
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;
|
2015-12-06 00:32:32 -05:00
|
|
|
ConfigSettings streamOpts;
|
|
|
|
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:
|
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();
|
|
|
|
|
2015-07-15 00:32:36 -04:00
|
|
|
void setTheme(int themeId);
|
|
|
|
int getTheme();
|
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-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);
|
|
|
|
#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;
|
2015-07-16 18:57:03 -04:00
|
|
|
std::atomic_bool winMax;
|
2015-07-15 00:32:36 -04:00
|
|
|
std::atomic_int themeId;
|
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;
|
|
|
|
std::atomic<float> spectrumAvgSpeed;
|
2016-01-03 19:00:26 -05:00
|
|
|
#if USE_HAMLIB
|
|
|
|
std::atomic_int rigModel, rigRate;
|
|
|
|
std::string rigPort;
|
|
|
|
#endif
|
2015-04-13 19:58:34 -04:00
|
|
|
};
|