2013-04-28 10:47:45 -04:00
|
|
|
/*
|
|
|
|
* Hamlib C++ bindings - API header
|
|
|
|
* Copyright (c) 2001-2002 by Stephane Fillod
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _RIGCLASS_H
|
|
|
|
#define _RIGCLASS_H 1
|
|
|
|
|
|
|
|
#include <hamlib/rig.h>
|
|
|
|
#include <iostream>
|
2013-05-21 15:49:41 -04:00
|
|
|
#include <QString>
|
2013-07-08 09:17:22 -04:00
|
|
|
#include <QTcpSocket>
|
|
|
|
|
|
|
|
extern QTcpSocket* socket;
|
2013-04-28 10:47:45 -04:00
|
|
|
|
|
|
|
class BACKEND_IMPEXP Rig {
|
|
|
|
private:
|
|
|
|
RIG* theRig; // Global ref. to the rig
|
2013-05-21 15:49:41 -04:00
|
|
|
bool m_hrd;
|
2013-07-08 09:17:22 -04:00
|
|
|
bool m_cmndr;
|
2013-05-21 15:49:41 -04:00
|
|
|
QString m_context;
|
2013-04-28 10:47:45 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2013-04-28 10:47:45 -04:00
|
|
|
protected:
|
|
|
|
public:
|
2013-05-01 08:21:19 -04:00
|
|
|
Rig();
|
2013-04-28 10:47:45 -04:00
|
|
|
virtual ~Rig();
|
|
|
|
|
|
|
|
const struct rig_caps *caps;
|
|
|
|
|
2013-05-01 08:21:19 -04:00
|
|
|
// Initialize rig
|
|
|
|
int init(rig_model_t rig_model);
|
|
|
|
|
2013-04-28 10:47:45 -04:00
|
|
|
// This method open the communication port to the rig
|
2013-05-21 15:49:41 -04:00
|
|
|
int open(int n);
|
2013-04-28 10:47:45 -04:00
|
|
|
|
|
|
|
// This method close the communication port to the rig
|
2013-04-30 14:54:11 -04:00
|
|
|
int close(void);
|
2013-04-28 10:47:45 -04:00
|
|
|
|
2013-04-30 14:54:11 -04:00
|
|
|
int setConf(const char *name, const char *val);
|
2013-04-28 10:47:45 -04:00
|
|
|
token_t tokenLookup(const char *name);
|
|
|
|
|
2013-04-30 15:55:13 -04:00
|
|
|
int setFreq(freq_t freq, vfo_t vfo = RIG_VFO_CURR);
|
|
|
|
freq_t getFreq(vfo_t vfo = RIG_VFO_CURR);
|
|
|
|
int setMode(rmode_t, pbwidth_t width = RIG_PASSBAND_NORMAL, vfo_t vfo = RIG_VFO_CURR);
|
2013-04-28 10:47:45 -04:00
|
|
|
rmode_t getMode(pbwidth_t&, vfo_t vfo = RIG_VFO_CURR);
|
2013-04-30 15:55:13 -04:00
|
|
|
int setVFO(vfo_t);
|
2013-04-28 10:47:45 -04:00
|
|
|
vfo_t getVFO();
|
2013-07-08 09:17:22 -04:00
|
|
|
int setXit(shortfreq_t xit, vfo_t vfo);
|
|
|
|
int setSplitFreq(freq_t tx_freq, vfo_t vfo = RIG_VFO_CURR);
|
2013-04-30 15:55:13 -04:00
|
|
|
int setPTT (ptt_t ptt, vfo_t vfo = RIG_VFO_CURR);
|
2013-04-28 10:47:45 -04:00
|
|
|
ptt_t getPTT (vfo_t vfo = RIG_VFO_CURR);
|
|
|
|
|
|
|
|
// callbacks available in your derived object
|
|
|
|
virtual int FreqEvent(vfo_t, freq_t, rig_ptr_t) const {
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
|
|
|
virtual int ModeEvent(vfo_t, rmode_t, pbwidth_t, rig_ptr_t) const {
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
|
|
|
virtual int VFOEvent(vfo_t, rig_ptr_t) const {
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
|
|
|
virtual int PTTEvent(vfo_t, ptt_t, rig_ptr_t) const {
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
|
|
|
virtual int DCDEvent(vfo_t, dcd_t, rig_ptr_t) const {
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-05-21 21:02:07 -04:00
|
|
|
#ifdef WIN32
|
2013-05-21 15:49:41 -04:00
|
|
|
extern "C" {
|
2013-05-23 13:25:52 -04:00
|
|
|
bool HRDInterfaceConnect(const wchar_t *host, const ushort);
|
2013-05-21 15:49:41 -04:00
|
|
|
void HRDInterfaceDisconnect();
|
2013-05-23 13:25:52 -04:00
|
|
|
bool HRDInterfaceIsConnected();
|
|
|
|
wchar_t* HRDInterfaceSendMessage(const wchar_t *msg);
|
2013-05-21 15:49:41 -04:00
|
|
|
void HRDInterfaceFreeString(const wchar_t *lstring);
|
|
|
|
}
|
2013-05-21 21:02:07 -04:00
|
|
|
#endif
|
2013-04-30 15:55:13 -04:00
|
|
|
|
2013-04-28 10:47:45 -04:00
|
|
|
#endif // _RIGCLASS_H
|