Ham Radio Deluxe is inside ifdef WIN32 conditionals

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3315 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
John T Nogatch 2013-05-27 20:27:36 +00:00
parent 8ab7c01e16
commit 471f4352d7
2 changed files with 19 additions and 15 deletions

View File

@ -78,8 +78,8 @@ int Rig::init(rig_model_t rig_model)
} }
int Rig::open(int n) { int Rig::open(int n) {
#ifdef WIN32 // Ham radio Deluxe only on Windows
m_hrd=(n==9999); m_hrd=(n==9999);
#ifdef WIN32
if(m_hrd) { if(m_hrd) {
bool bConnect=false; bool bConnect=false;
bConnect = HRDInterfaceConnect(L"localhost",7809); bConnect = HRDInterfaceConnect(L"localhost",7809);
@ -92,21 +92,21 @@ int Rig::open(int n) {
m_hrd=false; m_hrd=false;
return -1; return -1;
} }
} else { } else
#endif
{
return rig_open(theRig); return rig_open(theRig);
} }
#else
return rig_open(theRig);
#endif
} }
int Rig::close(void) { int Rig::close(void) {
#ifdef WIN32 // Ham Radio Deluxe only on Windows
if(m_hrd) { if(m_hrd) {
#ifdef WIN32
HRDInterfaceDisconnect(); HRDInterfaceDisconnect();
return 0; return 0;
} else
#endif #endif
} else { {
return rig_close(theRig); return rig_close(theRig);
} }
} }
@ -117,8 +117,8 @@ int Rig::setConf(const char *name, const char *val)
} }
int Rig::setFreq(freq_t freq, vfo_t vfo) { int Rig::setFreq(freq_t freq, vfo_t vfo) {
#ifdef WIN32 // Ham Radio Deluxe only on Windows
if(m_hrd) { if(m_hrd) {
#ifdef WIN32
QString t; QString t;
int nhz=(int)freq; int nhz=(int)freq;
t=m_context + "Set Frequency-Hz " + QString::number(nhz); t=m_context + "Set Frequency-Hz " + QString::number(nhz);
@ -131,8 +131,9 @@ int Rig::setFreq(freq_t freq, vfo_t vfo) {
} else { } else {
return -1; return -1;
} }
} else
#endif #endif
} else { {
return rig_set_freq(theRig, vfo, freq); return rig_set_freq(theRig, vfo, freq);
} }
} }
@ -140,16 +141,17 @@ int Rig::setFreq(freq_t freq, vfo_t vfo) {
freq_t Rig::getFreq(vfo_t vfo) freq_t Rig::getFreq(vfo_t vfo)
{ {
freq_t freq; freq_t freq;
#ifdef WIN32 // Ham Radio Deluxe only on Windows
if(m_hrd) { if(m_hrd) {
#ifdef WIN32
const wchar_t* cmnd = (const wchar_t*) (m_context+"Get Frequency").utf16(); const wchar_t* cmnd = (const wchar_t*) (m_context+"Get Frequency").utf16();
const wchar_t* freqString=HRDInterfaceSendMessage(cmnd); const wchar_t* freqString=HRDInterfaceSendMessage(cmnd);
QString t2=QString::fromWCharArray (freqString,-1); QString t2=QString::fromWCharArray (freqString,-1);
HRDInterfaceFreeString(freqString); HRDInterfaceFreeString(freqString);
freq=t2.toDouble(); freq=t2.toDouble();
return freq; return freq;
} else
#endif #endif
} else { {
rig_get_freq(theRig, vfo, &freq); rig_get_freq(theRig, vfo, &freq);
return freq; return freq;
} }
@ -179,10 +181,10 @@ vfo_t Rig::getVFO()
int Rig::setPTT(ptt_t ptt, vfo_t vfo) int Rig::setPTT(ptt_t ptt, vfo_t vfo)
{ {
#ifdef WIN32 // Ham Radio Deluxe only on Windows
if(m_hrd) { if(m_hrd) {
#ifdef WIN32
wchar_t* cmnd; wchar_t* cmnd;
if(ptt==0) { if(ptt==0) {
cmnd = (wchar_t*) (m_context + cmnd = (wchar_t*) (m_context +
"Set Button-Select TX 0").utf16(); "Set Button-Select TX 0").utf16();
@ -198,9 +200,9 @@ int Rig::setPTT(ptt_t ptt, vfo_t vfo)
} else { } else {
return -1; return -1;
} }
} else
#endif #endif
{
} else {
return rig_set_ptt(theRig, vfo, ptt); return rig_set_ptt(theRig, vfo, ptt);
} }
} }

View File

@ -29,7 +29,9 @@
class BACKEND_IMPEXP Rig { class BACKEND_IMPEXP Rig {
private: private:
RIG* theRig; // Global ref. to the rig RIG* theRig; // Global ref. to the rig
#ifdef WIN32 // Ham Radio Deluxe only on Windows
bool m_hrd; bool m_hrd;
#endif
QString m_context; QString m_context;
protected: protected: