File: RigThread.h

package info (click to toggle)
soapyaudio 0~git20160607-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 652 kB
  • ctags: 823
  • sloc: cpp: 9,786; makefile: 10
file content (49 lines) | stat: -rw-r--r-- 1,015 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once

#include <hamlib/rig.h>
#include <hamlib/riglist.h>

#ifdef USE_HAMLIB
struct rigGreater
{
    bool operator()( const struct rig_caps *lx, const struct rig_caps *rx ) const {
        std::string ln(std::string(std::string(lx->mfg_name) + " " + std::string(lx->model_name)));
        std::string rn(std::string(std::string(rx->mfg_name) + " " + std::string(rx->model_name)));
    	return ln.compare(rn)<0;
    }
};

class RigThread {
public:
    RigThread();
    ~RigThread();

    void *pthread_helper(void *context);

#ifdef __APPLE__
    void *threadMain();
#else
    void threadMain();
#endif

    void setup(rig_model_t rig_model, std::string rig_file, int serial_rate);
    void run();

    void terminate();
    bool isTerminated();

    freq_t getFrequency();
    void setFrequency(freq_t new_freq);
    
private:
	RIG *rig;
    rig_model_t rigModel;
    std::string rigFile;
    int serialRate;
    
    freq_t freq;
    freq_t newFreq;
    std::atomic_bool terminated, freqChanged;
};

#endif