CubicSDR/src/AppConfig.h

55 lines
1021 B
C
Raw Normal View History

#pragma once
#include <wx/stdpaths.h>
#include <wx/dir.h>
#include <wx/filename.h>
#include <atomic>
#include <mutex>
#include "DataTree.h"
2015-04-21 23:19:45 -04:00
class DeviceConfig {
public:
2015-04-21 23:19:45 -04:00
DeviceConfig();
DeviceConfig(std::string deviceId);
void setPPM(int ppm);
int getPPM();
void setDirectSampling(int mode);
int getDirectSampling();
void setOffset(long long offset);
long long getOffset();
void setIQSwap(bool iqSwap);
bool getIQSwap();
2015-04-21 23:19:45 -04:00
void setDeviceId(std::string deviceId);
std::string getDeviceId();
void save(DataNode *node);
void load(DataNode *node);
private:
std::string deviceId;
std::mutex busy_lock;
std::atomic<int> ppm, directSampling;
std::atomic<bool> iqSwap;
std::atomic<long long> offset;
2015-04-21 23:19:45 -04:00
};
class AppConfig {
public:
std::string getConfigDir();
2015-04-21 23:19:45 -04:00
DeviceConfig *getDevice(std::string deviceId);
bool save();
bool load();
bool reset();
2015-04-21 23:19:45 -04:00
private:
2015-04-21 23:19:45 -04:00
std::map<std::string, DeviceConfig> deviceConfig;
};