-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqhamrotator.h
89 lines (76 loc) · 2.18 KB
/
qhamrotator.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef QHAMROTATOR_H
#define QHAMROTATOR_H
#include <QString>
#include <QStringList>
#include <hamlib/rotator.h>
#include <QException>
typedef QPair<azimuth_t,elevation_t> TRotatorPosition;
class QHamRotator
{
public:
QHamRotator();
QHamRotator(rot_model_t r_model);
QHamRotator(QString filename);
QHamRotator(QHamRotator &r);
virtual ~QHamRotator();
virtual QHamRotator *clone();
const struct rot_caps *caps;
QStringList get_cfg_params() const;
rot_model_t getModel() const;
int getPollingInterval() const;
void setPollingInterval(const int &i);
bool isOpened() const;
bool LoadSettings(QString filename);
bool SaveSettings(QString filename);
QString getConf(const QString &pname);
void setConf(const QString &pname, const QString &val);
void open();
void close();
void setPosition(azimuth_t az, elevation_t el);
void getPosition(azimuth_t& az, elevation_t& el);
void setPosition(TRotatorPosition pos);
TRotatorPosition getPosition();
void stop();
void park();
void reset(rot_reset_t reset);
void move(int direction, int speed);
private:
void list_params();
QStringList cfg_params;
rot_model_t rot_model;
int polling_interval;
bool portopened;
ROT *theRot;
const QStringList param_blacklist = {"flushx"};
};
class RotException: public QException
{
public:
const char* message;
int errorno;
RotException(const char *msg, int err) noexcept
: message(msg), errorno(err)
{}
RotException(int err) noexcept
: message(rigerror(err)), errorno(err)
{}
RotException(const char *msg) noexcept
: message(msg), errorno(-RIG_EINTERNAL)
{}
RotException(const RotException &re) noexcept
: message(re.message), errorno(re.errorno)
{}
virtual ~RotException() noexcept override
{}
virtual void raise() const override {throw *this;}
virtual RotException *clone() const override {return new RotException(*this);}
virtual const char* what() const noexcept override
{
return message;
}
virtual const char *classname() const
{
return "RotException";
}
};
#endif // QHAMROTATOR_H