6
* Copyright 2009, Dave Freese, W1HKJ
10
#include "IC706MKIIG.h"
12
//=============================================================================
15
const char IC706MKIIGname_[] = "IC-706MKIIG";
16
const char *IC706MKIIGmodes_[] = { "LSB", "USB", "AM", "CW", "RTTY", "FM", "WFM", NULL};
17
const char IC706MKIIG_mode_type[] =
18
{ 'L', 'U', 'U', 'L', 'L', 'U', 'U'};
19
//const char *IC706MKIIG_widths[] = { "WIDE", "NARR", NULL};
20
const char *IC706MKIIG_widths[] = { "n/a", NULL};
22
RIG_IC706MKIIG::RIG_IC706MKIIG() {
23
name_ = IC706MKIIGname_;
24
modes_ = IC706MKIIGmodes_;
25
bandwidths_ = IC706MKIIG_widths;
26
_mode_type = IC706MKIIG_mode_type;
27
comm_baudrate = BR19200;
39
def_freq = freqA = freqB = A.freq = B.imode = 14070000;
40
def_mode = modeA = modeB = A.imode = B.imode = 1;
41
def_bw = bwA = bwB = A.iBW = B.iBW = 0;
45
has_attenuator_control = true;
48
adjustCIV(defaultCIV);
55
//=============================================================================
57
void RIG_IC706MKIIG::selectA()
66
void RIG_IC706MKIIG::selectB()
75
long RIG_IC706MKIIG::get_vfoA ()
82
if (waitFOR(11, "get vfo A")) {
83
size_t p = replystr.rfind(resp);
84
if (p != string::npos)
85
freqA = fm_bcd_be(&replystr[p+5], 10);
90
void RIG_IC706MKIIG::set_vfoA (long freq)
95
cmd.append( to_bcd_be( freq, 10 ) );
100
long RIG_IC706MKIIG::get_vfoB ()
105
string resp = pre_fm;
107
if (waitFOR(11, "get vfo B")) {
108
size_t p = replystr.rfind(resp);
109
if (p != string::npos)
110
freqB = fm_bcd_be(&replystr[p+5], 10);
115
void RIG_IC706MKIIG::set_vfoB (long freq)
120
cmd.append( to_bcd_be( freq, 10 ) );
125
void RIG_IC706MKIIG::set_split(bool b)
129
cmd += b ? '\x01' : '\x00';
134
void RIG_IC706MKIIG::set_modeA(int val)
139
cmd += val > 5 ? val + 2 : val;
142
waitFB("set mode A");
145
int RIG_IC706MKIIG::get_modeA()
150
string resp = pre_fm;
152
if (waitFOR(8, "get mode A")) {
153
size_t p = replystr.rfind(resp);
154
if (p != string::npos) {
155
modeA = replystr[p+5];
156
if (modeA > 6) modeA -= 2;
157
// bwA = replystr[p+6];
163
int RIG_IC706MKIIG::get_modetype(int n)
165
return _mode_type[n];
169
void RIG_IC706MKIIG::set_bwA(int val)
175
int RIG_IC706MKIIG::get_bwA()
181
void RIG_IC706MKIIG::set_attenuator(int val)
185
cmd += val ? '\x20' : '\x00';
190
int RIG_IC706MKIIG::get_smeter()
193
cmd.append("\x15\x02");
195
string resp = pre_fm;
196
resp.append("\x15\x02");
197
if (waitFOR(9, "get smeter")) {
198
size_t p = replystr.rfind(resp);
199
if (p != string::npos)
200
return (int)ceil(fm_bcd(&replystr[p+6], 3) / 2.55);