2014-12-11 23:35:06 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <thread>
|
|
|
|
|
|
|
|
#include "DemodulatorThread.h"
|
2014-12-16 18:27:02 -05:00
|
|
|
#include "DemodulatorPreThread.h"
|
2014-12-11 23:35:06 -05:00
|
|
|
|
2015-11-18 23:40:30 -05:00
|
|
|
#include "ModemDigital.h"
|
|
|
|
#include "ModemAnalog.h"
|
|
|
|
|
2014-12-11 23:35:06 -05:00
|
|
|
class DemodulatorInstance {
|
|
|
|
public:
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
2014-12-16 18:27:02 -05:00
|
|
|
pthread_t t_PreDemod;
|
2014-12-11 23:35:06 -05:00
|
|
|
pthread_t t_Demod;
|
|
|
|
#else
|
2014-12-16 18:27:02 -05:00
|
|
|
std::thread *t_PreDemod;
|
2014-12-11 23:35:06 -05:00
|
|
|
std::thread *t_Demod;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
AudioThread *audioThread;
|
|
|
|
std::thread *t_Audio;
|
|
|
|
|
|
|
|
DemodulatorInstance();
|
|
|
|
~DemodulatorInstance();
|
|
|
|
|
|
|
|
void setVisualOutputQueue(DemodulatorThreadOutputQueue *tQueue);
|
|
|
|
|
|
|
|
DemodulatorThreadCommandQueue *getCommandQueue();
|
|
|
|
|
|
|
|
void run();
|
|
|
|
void terminate();
|
|
|
|
std::string getLabel();
|
|
|
|
void setLabel(std::string labelStr);
|
|
|
|
|
|
|
|
bool isTerminated();
|
2015-01-04 17:11:20 -05:00
|
|
|
void updateLabel(long long freq);
|
2014-12-11 23:35:06 -05:00
|
|
|
|
2014-12-18 20:11:25 -05:00
|
|
|
bool isActive();
|
|
|
|
void setActive(bool state);
|
|
|
|
|
2014-12-31 19:45:01 -05:00
|
|
|
void squelchAuto();
|
|
|
|
bool isSquelchEnabled();
|
2014-12-21 16:08:32 -05:00
|
|
|
void setSquelchEnabled(bool state);
|
|
|
|
|
2014-12-31 19:45:01 -05:00
|
|
|
float getSignalLevel();
|
|
|
|
void setSquelchLevel(float signal_level_in);
|
|
|
|
float getSquelchLevel();
|
|
|
|
|
2014-12-31 21:31:37 -05:00
|
|
|
void setOutputDevice(int device_id);
|
|
|
|
int getOutputDevice();
|
|
|
|
|
2015-11-17 18:57:42 -05:00
|
|
|
void setDemodulatorType(std::string demod_type_in);
|
|
|
|
std::string getDemodulatorType();
|
2015-06-05 03:51:46 -04:00
|
|
|
|
|
|
|
void setDemodulatorLock(bool demod_lock_in);
|
|
|
|
int getDemodulatorLock();
|
2015-01-01 03:48:32 -05:00
|
|
|
|
2015-01-04 13:20:31 -05:00
|
|
|
void setBandwidth(int bw);
|
|
|
|
int getBandwidth();
|
|
|
|
|
2015-01-10 20:33:30 -05:00
|
|
|
void setGain(float gain_in);
|
|
|
|
float getGain();
|
|
|
|
|
2015-01-04 17:11:20 -05:00
|
|
|
void setFrequency(long long freq);
|
|
|
|
long long getFrequency();
|
2015-03-15 21:02:26 -04:00
|
|
|
|
|
|
|
void setAudioSampleRate(int sampleRate);
|
|
|
|
int getAudioSampleRate();
|
2015-11-22 23:25:45 -05:00
|
|
|
|
2015-03-26 22:45:52 -04:00
|
|
|
bool isFollow();
|
|
|
|
void setFollow(bool follow);
|
2015-03-15 21:02:26 -04:00
|
|
|
|
2015-04-23 19:38:44 -04:00
|
|
|
bool isTracking();
|
|
|
|
void setTracking(bool tracking);
|
2015-08-17 00:59:38 -04:00
|
|
|
|
|
|
|
bool isMuted();
|
|
|
|
void setMuted(bool muted);
|
2015-07-30 20:36:06 -04:00
|
|
|
|
|
|
|
DemodulatorThreadInputQueue *getIQInputDataPipe();
|
|
|
|
|
2015-11-23 22:16:09 -05:00
|
|
|
ModemArgInfoList getModemArgs();
|
|
|
|
std::string readModemSetting(std::string setting);
|
2015-11-26 01:54:54 -05:00
|
|
|
ModemSettings readModemSettings();
|
2015-11-23 22:16:09 -05:00
|
|
|
void writeModemSetting(std::string setting, std::string value);
|
2015-11-26 01:54:54 -05:00
|
|
|
void writeModemSettings(ModemSettings settings);
|
2015-11-23 22:16:09 -05:00
|
|
|
|
2015-11-26 01:54:54 -05:00
|
|
|
bool isModemInitialized();
|
2015-11-26 22:06:29 -05:00
|
|
|
ModemSettings getLastModemSettings(std::string demodType);
|
|
|
|
|
2015-07-30 20:36:06 -04:00
|
|
|
protected:
|
|
|
|
DemodulatorThreadInputQueue* pipeIQInputData;
|
|
|
|
DemodulatorThreadPostInputQueue* pipeIQDemodData;
|
2015-08-01 11:03:00 -04:00
|
|
|
AudioThreadInputQueue *pipeAudioData;
|
2015-07-30 20:36:06 -04:00
|
|
|
DemodulatorThreadCommandQueue* pipeDemodNotify;
|
|
|
|
DemodulatorPreThread *demodulatorPreThread;
|
|
|
|
DemodulatorThread *demodulatorThread;
|
|
|
|
DemodulatorThreadControlCommandQueue *threadQueueControl;
|
|
|
|
|
2014-12-11 23:35:06 -05:00
|
|
|
private:
|
2015-01-04 13:20:31 -05:00
|
|
|
|
2014-12-31 19:45:01 -05:00
|
|
|
std::atomic<std::string *> label; //
|
2015-07-19 15:34:06 -04:00
|
|
|
std::atomic_bool terminated; //
|
|
|
|
std::atomic_bool demodTerminated; //
|
|
|
|
std::atomic_bool audioTerminated; //
|
|
|
|
std::atomic_bool preDemodTerminated;
|
|
|
|
std::atomic_bool active;
|
|
|
|
std::atomic_bool squelch;
|
2015-08-17 00:59:38 -04:00
|
|
|
std::atomic_bool muted;
|
2015-07-19 15:34:06 -04:00
|
|
|
|
|
|
|
std::atomic_int currentOutputDevice;
|
|
|
|
std::atomic<float> currentAudioGain;
|
|
|
|
std::atomic_bool follow, tracking;
|
2015-11-26 22:06:29 -05:00
|
|
|
std::map<std::string, ModemSettings> lastModemSettings;
|
2015-01-04 13:20:31 -05:00
|
|
|
};
|