~ubuntu-branches/ubuntu/wily/flrig/wily

« back to all changes in this revision

Viewing changes to .pc/0001-License-Declaration.patch/src/rigs/IC706MKIIG.cxx

  • Committer: Package Import Robot
  • Author(s): Kamal Mostafa
  • Date: 2014-06-07 11:28:52 UTC
  • Revision ID: package-import@ubuntu.com-20140607112852-pj9xhtlvwpgqjy5x
Tags: 1.3.15-1
* Initial release (Closes: #750861)
  flrig version 1.3.15 plus the following upstream commits:
  - 0001-License-Declaration.patch
  - 0002-FL_APPS-folder.patch
  - 0003-rig-home-dir.patch
  - 0004-RTS-DTR-restore.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Icom IC-706MKIIG
 
3
 * 
 
4
 * a part of flrig
 
5
 * 
 
6
 * Copyright 2009, Dave Freese, W1HKJ
 
7
 * 
 
8
 */
 
9
 
 
10
#include "IC706MKIIG.h"
 
11
 
 
12
//=============================================================================
 
13
// IC-706MKIIG
 
14
//
 
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};
 
21
 
 
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;
 
28
        stopbits = 1;
 
29
        comm_retries = 2;
 
30
        comm_wait = 5;
 
31
        comm_timeout = 50;
 
32
        comm_echo = true;
 
33
        comm_rtscts = false;
 
34
        comm_rtsplus = true;
 
35
        comm_dtrplus = true;
 
36
        comm_catptt = false;
 
37
        comm_rtsptt = false;
 
38
        comm_dtrptt = false;
 
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;
 
42
 
 
43
        has_smeter =
 
44
        has_mode_control =
 
45
        has_attenuator_control = true;
 
46
 
 
47
        defaultCIV = 0x58;
 
48
        adjustCIV(defaultCIV);
 
49
 
 
50
        precision = 1;
 
51
        ndigits = 9;
 
52
 
 
53
};
 
54
 
 
55
//=============================================================================
 
56
 
 
57
void RIG_IC706MKIIG::selectA()
 
58
{
 
59
        cmd = pre_to;
 
60
        cmd += '\x07';
 
61
        cmd += '\x00';
 
62
        cmd.append(post);
 
63
        waitFB("select A");
 
64
}
 
65
 
 
66
void RIG_IC706MKIIG::selectB()
 
67
{
 
68
        cmd = pre_to;
 
69
        cmd += '\x07';
 
70
        cmd += '\x01';
 
71
        cmd.append(post);
 
72
        waitFB("select B");
 
73
}
 
74
 
 
75
long RIG_IC706MKIIG::get_vfoA ()
 
76
{
 
77
        cmd = pre_to;
 
78
        cmd += '\x03';
 
79
        cmd.append( post );
 
80
        string resp = pre_fm;
 
81
        resp += '\x03';
 
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);
 
86
        }
 
87
        return freqA;
 
88
}
 
89
 
 
90
void RIG_IC706MKIIG::set_vfoA (long freq)
 
91
{
 
92
        freqA = freq;
 
93
        cmd = pre_to;
 
94
        cmd += '\x05';
 
95
        cmd.append( to_bcd_be( freq, 10 ) );
 
96
        cmd.append( post );
 
97
        waitFB("set vfo A");
 
98
}
 
99
 
 
100
long RIG_IC706MKIIG::get_vfoB ()
 
101
{
 
102
        cmd = pre_to;
 
103
        cmd += '\x03';
 
104
        cmd.append( post );
 
105
        string resp = pre_fm;
 
106
        resp += '\x03';
 
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);
 
111
        }
 
112
        return freqB;
 
113
}
 
114
 
 
115
void RIG_IC706MKIIG::set_vfoB (long freq)
 
116
{
 
117
        freqB = freq;
 
118
        cmd = pre_to;
 
119
        cmd += '\x05';
 
120
        cmd.append( to_bcd_be( freq, 10 ) );
 
121
        cmd.append( post );
 
122
        waitFB("set vfo B");
 
123
}
 
124
 
 
125
void RIG_IC706MKIIG::set_split(bool b)
 
126
{
 
127
        cmd = pre_to;
 
128
        cmd += '\x0F';
 
129
        cmd += b ? '\x01' : '\x00';
 
130
        cmd.append( post );
 
131
        waitFB("set split");
 
132
}
 
133
 
 
134
void RIG_IC706MKIIG::set_modeA(int val)
 
135
{
 
136
        modeA = val;
 
137
        cmd = pre_to;
 
138
        cmd += '\x06';
 
139
        cmd += val > 5 ? val + 2 : val;
 
140
        cmd += bwA;
 
141
        cmd.append( post );
 
142
        waitFB("set mode A");
 
143
}
 
144
 
 
145
int RIG_IC706MKIIG::get_modeA()
 
146
{
 
147
        cmd = pre_to;
 
148
        cmd += '\x04';
 
149
        cmd.append(post);
 
150
        string resp = pre_fm;
 
151
        resp += '\x04';
 
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];
 
158
                }
 
159
        }
 
160
        return modeA;
 
161
}
 
162
 
 
163
int RIG_IC706MKIIG::get_modetype(int n)
 
164
{
 
165
        return _mode_type[n];
 
166
}
 
167
 
 
168
/*
 
169
void RIG_IC706MKIIG::set_bwA(int val)
 
170
{
 
171
        bwA = val;
 
172
        set_modeA(modeA);
 
173
}
 
174
 
 
175
int  RIG_IC706MKIIG::get_bwA()
 
176
{
 
177
        return bwA;
 
178
}
 
179
*/
 
180
 
 
181
void RIG_IC706MKIIG::set_attenuator(int val)
 
182
{
 
183
        cmd = pre_to;
 
184
        cmd += '\x11';
 
185
        cmd += val ? '\x20' : '\x00';
 
186
        cmd.append( post );
 
187
        waitFB("set att");
 
188
}
 
189
 
 
190
int RIG_IC706MKIIG::get_smeter()
 
191
{
 
192
        cmd = pre_to;
 
193
        cmd.append("\x15\x02");
 
194
        cmd.append( post );
 
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);
 
201
        }
 
202
        return -1;
 
203
}