1 // ---------------------------------------------------------------------------- 2 // Copyright (C) 2014 3 // David Freese, W1HKJ 4 // 5 // This file is part of flrig. 6 // 7 // flrig is free software; you can redistribute it and/or modify 8 // it under the terms of the GNU General Public License as published by 9 // the Free Software Foundation; either version 3 of the License, or 10 // (at your option) any later version. 11 // 12 // flrig is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // GNU General Public License for more details. 16 // 17 // You should have received a copy of the GNU General Public License 18 // aunsigned long int with this program. If not, see <http://www.gnu.org/licenses/>. 19 // ---------------------------------------------------------------------------- 20 21 #ifndef _PCR1000_H 22 #define _PCR1000_H 23 24 #include "rigbase.h" 25 26 class RIG_PCR1000 : public rigbase { 27 28 public: 29 30 private: 31 32 static const char get_smeter_command[] ; 33 static char volume_command[] ; 34 static char squelch_command[] ; 35 static char if_shift_command[] ; 36 static char check_power_command[] ; 37 static char power_on_command[] ; 38 static char power_off_command[] ; 39 static const char att_off_command[] ; 40 static const char att_on_command[] ; 41 static const char noise_off_command[] ; 42 static const char noise_on_command[] ; 43 44 static const char name[] ; 45 46 static const char *modes[] ; 47 static const char mode_chr[] ; 48 static const char mode_type[] ; 49 static const char *band_widths[] ; 50 51 int current_volume ; 52 53 struct freq_cmd { 54 char command[2] ; // The command will always be 'K0' 55 char frequency[10] ; // 10 digit frequency in Hertz 56 char mode[2] ; // Mode code, 00=LSB, 01=USB, 02=AM, 03=CW, 05=NFM, 06=WFM, 04 is NOT USED! 57 char band_width[2] ; // Band width setting 00=2.8kHz, 01=6kHz, 02=15kHz, 03=50kHz, 04=230kHz 58 char pad[5] ; // Always '00\0' 59 } ; 60 61 static freq_cmd freq_cmds[] ; 62 static const char hex_chars[] ; 63 64 bool notch_on; 65 int att_level; 66 int nb_level; 67 int active_bandwidth; 68 int active_mode; 69 int sql ; 70 int if_shift ; 71 int attenuator ; 72 int noise ; 73 74 bool att_on; 75 bool is_PCR1000; 76 77 XCVR_STATE& current_vfo ; 78 79 // Internal methods 80 /* 81 * Since the same command is used for frequency, mode, and bandwidth we'll 82 * use a single private method that is called whenever any of the three is 83 * changed. 84 */ 85 86 void setFreqModeBW(XCVR_STATE &freqMode) ; // Set the frequency in the current mode 87 int hexTo(const char c) const ; // Returns int value of c, i.e '2' returns 2, 'A' returns 10, etc. 88 void set2Hex(int ival, char *cptr) ; // Set the hex value of ival into the first 2 chars of cptr 89 90 public: 91 RIG_PCR1000(); ~RIG_PCR1000()92 ~RIG_PCR1000(){}; 93 94 void initialize(); 95 void shutdown() ; 96 97 void set_volume_control(int val); 98 int get_volume_control(); 99 100 bool check(); 101 102 unsigned long int get_vfoA(); 103 void set_vfoA(unsigned long int); 104 unsigned long int get_vfoB(); 105 void set_vfoB(unsigned long int); 106 107 void selectA() ; 108 void selectB() ; 109 void A2B() ; 110 void swapAB() ; 111 112 int get_modetype(int n); 113 void set_modeA(int val); 114 int get_modeA(); 115 void set_modeB(int val); 116 int get_modeB(); 117 118 void set_bwA(int val) ; 119 int get_bwA() ; 120 void set_bwB(int val) ; 121 int get_bwB() ; 122 123 int get_smeter(); 124 125 void set_squelch(int val) ; 126 int get_squelch() ; get_squelch_min_max_step(int & min,int & max,int & step)127 void get_squelch_min_max_step(int &min, int &max, int &step) { 128 min = 0; max = 255; step = 1; } 129 130 void set_if_shift(int val) ; 131 bool get_if_shift(int &val) ; get_if_min_max_step(int & min,int & max,int & step)132 void get_if_min_max_step(int &min, int &max, int &step) { 133 if_shift_min = min = -800; if_shift_max = max = 800; if_shift_step = step = 10; } get_if_mid()134 void get_if_mid() {if_shift_mid = 0; } 135 136 137 void set_attenuator(int val) ; 138 int get_attenuator() ; 139 140 void set_noise(bool on) ; 141 int get_noise() ; 142 143 }; 144 145 146 #endif 147