Hamlib
1.2.15
|
00001 /* 00002 * Hamlib Interface - API header 00003 * Copyright (c) 2000-2003 by Frank Singleton 00004 * Copyright (c) 2000-2012 by Stephane Fillod 00005 * 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 * 00021 */ 00022 00023 00024 #ifndef _RIG_H 00025 #define _RIG_H 1 00026 00027 #include <stdio.h> 00028 #include <stdarg.h> 00029 00030 #include <hamlib/riglist.h> /* list in another file to not mess up w/ this one */ 00031 00045 /* __BEGIN_DECLS should be used at the beginning of your declarations, 00046 * so that C++ compilers don't mangle their names. Use __END_DECLS at 00047 * the end of C declarations. */ 00048 #undef __BEGIN_DECLS 00049 #undef __END_DECLS 00050 #ifdef __cplusplus 00051 # define __BEGIN_DECLS extern "C" { 00052 # define __END_DECLS } 00053 #else 00054 # define __BEGIN_DECLS /* empty */ 00055 # define __END_DECLS /* empty */ 00056 #endif 00057 00058 /* HAMLIB_PARAMS is a macro used to wrap function prototypes, so that compilers 00059 * that don't understand ANSI C prototypes still work, and ANSI C 00060 * compilers can issue warnings about type mismatches. */ 00061 #undef HAMLIB_PARAMS 00062 #if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(__CYGWIN__) || defined(_WIN32) || defined(__cplusplus) 00063 # define HAMLIB_PARAMS(protos) protos 00064 # define rig_ptr_t void* 00065 #else 00066 # define HAMLIB_PARAMS(protos) () 00067 # define rig_ptr_t char* 00068 #endif 00069 00070 #include <hamlib/rig_dll.h> 00071 00072 00073 __BEGIN_DECLS 00074 00075 extern HAMLIB_EXPORT_VAR(const char) hamlib_version[]; 00076 extern HAMLIB_EXPORT_VAR(const char) hamlib_copyright[]; 00077 00084 enum rig_errcode_e { 00085 RIG_OK=0, 00086 RIG_EINVAL, 00087 RIG_ECONF, 00088 RIG_ENOMEM, 00089 RIG_ENIMPL, 00090 RIG_ETIMEOUT, 00091 RIG_EIO, 00092 RIG_EINTERNAL, 00093 RIG_EPROTO, 00094 RIG_ERJCTED, 00095 RIG_ETRUNC, 00096 RIG_ENAVAIL, 00097 RIG_ENTARGET, 00098 RIG_BUSERROR, 00099 RIG_BUSBUSY, 00100 RIG_EARG, 00101 RIG_EVFO, 00102 RIG_EDOM 00103 }; 00104 00106 #define NETRIGCTL_RET "RPRT " 00107 00115 enum rig_debug_level_e { 00116 RIG_DEBUG_NONE = 0, 00117 RIG_DEBUG_BUG, 00118 RIG_DEBUG_ERR, 00119 RIG_DEBUG_WARN, 00120 RIG_DEBUG_VERBOSE, 00121 RIG_DEBUG_TRACE 00122 }; 00123 00124 /* --------------- Rig capabilities -----------------*/ 00125 00126 /* Forward struct references */ 00127 00128 struct rig; 00129 struct rig_state; 00130 00134 typedef struct rig RIG; 00135 00136 #define RIGNAMSIZ 30 00137 #define RIGVERSIZ 8 00138 #define FILPATHLEN 100 00139 #define FRQRANGESIZ 30 00140 #define MAXCHANDESC 30 /* describe channel eg: "WWV 5Mhz" */ 00141 #define TSLSTSIZ 20 /* max tuning step list size, zero ended */ 00142 #define FLTLSTSIZ 42 /* max mode/filter list size, zero ended */ 00143 #define MAXDBLSTSIZ 8 /* max preamp/att levels supported, zero ended */ 00144 #define CHANLSTSIZ 16 /* max mem_list size, zero ended */ 00145 #define MAX_CAL_LENGTH 32 /* max calibration plots in cal_table_t */ 00146 00147 00158 typedef unsigned int tone_t; 00159 00163 typedef enum rig_port_e { 00164 RIG_PORT_NONE = 0, 00165 RIG_PORT_SERIAL, 00166 RIG_PORT_NETWORK, 00167 RIG_PORT_DEVICE, 00168 RIG_PORT_PACKET, 00169 RIG_PORT_DTMF, 00170 RIG_PORT_ULTRA, 00171 RIG_PORT_RPC, 00172 RIG_PORT_PARALLEL, 00173 RIG_PORT_USB, 00174 RIG_PORT_UDP_NETWORK, 00175 RIG_PORT_CM108 00176 } rig_port_t; 00177 00181 enum serial_parity_e { 00182 RIG_PARITY_NONE = 0, 00183 RIG_PARITY_ODD, 00184 RIG_PARITY_EVEN, 00185 RIG_PARITY_MARK, 00186 RIG_PARITY_SPACE 00187 }; 00188 00192 enum serial_handshake_e { 00193 RIG_HANDSHAKE_NONE = 0, 00194 RIG_HANDSHAKE_XONXOFF, 00195 RIG_HANDSHAKE_HARDWARE 00196 }; 00197 00198 00202 enum serial_control_state_e { 00203 RIG_SIGNAL_UNSET = 0, 00204 RIG_SIGNAL_ON, 00205 RIG_SIGNAL_OFF 00206 }; 00207 00209 typedef enum { 00210 RIG_FLAG_RECEIVER = (1<<1), 00211 RIG_FLAG_TRANSMITTER = (1<<2), 00212 RIG_FLAG_SCANNER = (1<<3), 00214 RIG_FLAG_MOBILE = (1<<4), 00215 RIG_FLAG_HANDHELD = (1<<5), 00216 RIG_FLAG_COMPUTER = (1<<6), 00217 RIG_FLAG_TRUNKING = (1<<7), 00218 RIG_FLAG_APRS = (1<<8), 00219 RIG_FLAG_TNC = (1<<9), 00220 RIG_FLAG_DXCLUSTER = (1<<10), 00221 RIG_FLAG_TUNER = (1<<11) 00222 } rig_type_t; 00223 00224 #define RIG_FLAG_TRANSCEIVER (RIG_FLAG_RECEIVER|RIG_FLAG_TRANSMITTER) 00225 #define RIG_TYPE_MASK (RIG_FLAG_TRANSCEIVER|RIG_FLAG_SCANNER|RIG_FLAG_MOBILE|RIG_FLAG_HANDHELD|RIG_FLAG_COMPUTER|RIG_FLAG_TRUNKING|RIG_FLAG_TUNER) 00226 00227 #define RIG_TYPE_OTHER 0 00228 #define RIG_TYPE_TRANSCEIVER RIG_FLAG_TRANSCEIVER 00229 #define RIG_TYPE_HANDHELD (RIG_FLAG_TRANSCEIVER|RIG_FLAG_HANDHELD) 00230 #define RIG_TYPE_MOBILE (RIG_FLAG_TRANSCEIVER|RIG_FLAG_MOBILE) 00231 #define RIG_TYPE_RECEIVER RIG_FLAG_RECEIVER 00232 #define RIG_TYPE_PCRECEIVER (RIG_FLAG_COMPUTER|RIG_FLAG_RECEIVER) 00233 #define RIG_TYPE_SCANNER (RIG_FLAG_SCANNER|RIG_FLAG_RECEIVER) 00234 #define RIG_TYPE_TRUNKSCANNER (RIG_TYPE_SCANNER|RIG_FLAG_TRUNKING) 00235 #define RIG_TYPE_COMPUTER (RIG_FLAG_TRANSCEIVER|RIG_FLAG_COMPUTER) 00236 #define RIG_TYPE_TUNER RIG_FLAG_TUNER 00237 00238 00242 enum rig_status_e { 00243 RIG_STATUS_ALPHA = 0, 00244 RIG_STATUS_UNTESTED, 00245 RIG_STATUS_BETA, 00246 RIG_STATUS_STABLE, 00247 RIG_STATUS_BUGGY 00248 /* RIG_STATUS_NEW * *!< Initial release of code 00249 * !! Use of RIG_STATUS_NEW is deprecated. Do not use it anymore */ 00250 }; 00251 00253 #define RIG_STATUS_NEW RIG_STATUS_UNTESTED 00254 00258 typedef enum { 00259 RIG_RPT_SHIFT_NONE = 0, 00260 RIG_RPT_SHIFT_MINUS, 00261 RIG_RPT_SHIFT_PLUS 00262 } rptr_shift_t; 00263 00267 typedef enum { 00268 RIG_SPLIT_OFF = 0, 00269 RIG_SPLIT_ON 00270 } split_t; 00271 00276 typedef double freq_t; 00278 #define PRIfreq "f" 00279 00280 #define SCNfreq "lf" 00281 #define FREQFMT SCNfreq 00282 00287 typedef signed long shortfreq_t; 00288 00289 #define Hz(f) ((freq_t)(f)) 00290 #define kHz(f) ((freq_t)((f)*(freq_t)1000)) 00291 #define MHz(f) ((freq_t)((f)*(freq_t)1000000)) 00292 #define GHz(f) ((freq_t)((f)*(freq_t)1000000000)) 00293 00294 #define s_Hz(f) ((shortfreq_t)(f)) 00295 #define s_kHz(f) ((shortfreq_t)((f)*(shortfreq_t)1000)) 00296 #define s_MHz(f) ((shortfreq_t)((f)*(shortfreq_t)1000000)) 00297 #define s_GHz(f) ((shortfreq_t)((f)*(shortfreq_t)1000000000)) 00298 00299 #define RIG_FREQ_NONE Hz(0) 00300 00301 00317 typedef int vfo_t; 00318 00320 #define RIG_VFO_NONE 0 00321 00322 #define RIG_VFO_TX_FLAG (1<<30) 00323 00325 #define RIG_VFO_CURR (1<<29) 00326 00328 #define RIG_VFO_MEM (1<<28) 00329 00331 #define RIG_VFO_VFO (1<<27) 00332 00333 #define RIG_VFO_TX_VFO(v) ((v)|RIG_VFO_TX_FLAG) 00334 00336 #define RIG_VFO_TX RIG_VFO_TX_VFO(RIG_VFO_CURR) 00337 00339 #define RIG_VFO_RX RIG_VFO_CURR 00340 00342 #define RIG_VFO_MAIN (1<<26) 00343 00344 #define RIG_VFO_SUB (1<<25) 00345 00346 #define RIG_VFO_N(n) (1<<(n)) 00347 00349 #define RIG_VFO_A RIG_VFO_N(0) 00350 00351 #define RIG_VFO_B RIG_VFO_N(1) 00352 00353 #define RIG_VFO_C RIG_VFO_N(2) 00354 00355 00356 /* 00357 * targetable bitfields, for internal use. 00358 * RIG_TARGETABLE_PURE means a pure targetable radio on every command 00359 */ 00360 #define RIG_TARGETABLE_NONE 0 00361 #define RIG_TARGETABLE_FREQ (1<<0) 00362 #define RIG_TARGETABLE_MODE (1<<1) 00363 #define RIG_TARGETABLE_PURE (1<<2) 00364 #define RIG_TARGETABLE_TONE (1<<3) 00365 #define RIG_TARGETABLE_FUNC (1<<4) 00366 #define RIG_TARGETABLE_ALL 0x7fffffff 00367 00368 00369 #define RIG_PASSBAND_NORMAL s_Hz(0) 00370 00374 typedef shortfreq_t pbwidth_t; 00375 00376 00380 typedef enum dcd_e { 00381 RIG_DCD_OFF = 0, 00382 RIG_DCD_ON 00383 } dcd_t; 00384 00389 typedef enum { 00390 RIG_DCD_NONE = 0, 00391 RIG_DCD_RIG, 00392 RIG_DCD_SERIAL_DSR, 00393 RIG_DCD_SERIAL_CTS, 00394 RIG_DCD_SERIAL_CAR, 00395 RIG_DCD_PARALLEL, 00396 RIG_DCD_CM108 00397 } dcd_type_t; 00398 00399 00403 typedef enum { 00404 RIG_PTT_OFF = 0, 00405 RIG_PTT_ON, 00406 RIG_PTT_ON_MIC, 00407 RIG_PTT_ON_DATA 00408 } ptt_t; 00409 00414 typedef enum { 00415 RIG_PTT_NONE = 0, 00416 RIG_PTT_RIG, 00417 RIG_PTT_SERIAL_DTR, 00418 RIG_PTT_SERIAL_RTS, 00419 RIG_PTT_PARALLEL, 00420 RIG_PTT_RIG_MICDATA, 00421 RIG_PTT_CM108 00422 } ptt_type_t; 00423 00427 typedef enum { 00428 RIG_POWER_OFF = 0, 00429 RIG_POWER_ON = (1<<0), 00430 RIG_POWER_STANDBY = (1<<1) 00431 } powerstat_t; 00432 00436 typedef enum { 00437 RIG_RESET_NONE = 0, 00438 RIG_RESET_SOFT = (1<<0), 00439 RIG_RESET_VFO = (1<<1), 00440 RIG_RESET_MCALL = (1<<2), 00441 RIG_RESET_MASTER = (1<<3) 00442 } reset_t; 00443 00444 00460 typedef enum { 00461 RIG_OP_NONE = 0, 00462 RIG_OP_CPY = (1<<0), 00463 RIG_OP_XCHG = (1<<1), 00464 RIG_OP_FROM_VFO = (1<<2), 00465 RIG_OP_TO_VFO = (1<<3), 00466 RIG_OP_MCL = (1<<4), 00467 RIG_OP_UP = (1<<5), 00468 RIG_OP_DOWN = (1<<6), 00469 RIG_OP_BAND_UP = (1<<7), 00470 RIG_OP_BAND_DOWN = (1<<8), 00471 RIG_OP_LEFT = (1<<9), 00472 RIG_OP_RIGHT = (1<<10), 00473 RIG_OP_TUNE = (1<<11), 00474 RIG_OP_TOGGLE = (1<<12) 00475 } vfo_op_t; 00476 00477 00486 typedef enum { 00487 RIG_SCAN_NONE = 0, 00488 RIG_SCAN_STOP = RIG_SCAN_NONE, 00489 RIG_SCAN_MEM = (1<<0), 00490 RIG_SCAN_SLCT = (1<<1), 00491 RIG_SCAN_PRIO = (1<<2), 00492 RIG_SCAN_PROG = (1<<3), 00493 RIG_SCAN_DELTA = (1<<4), 00494 RIG_SCAN_VFO = (1<<5), 00495 RIG_SCAN_PLT = (1<<6) 00496 } scan_t; 00497 00501 typedef long token_t; 00502 00503 #define RIG_CONF_END 0 00504 00517 /* strongly inspired from soundmodem. Thanks Thomas! */ 00518 00519 enum rig_conf_e { 00520 RIG_CONF_STRING, 00521 RIG_CONF_COMBO, 00522 RIG_CONF_NUMERIC, 00523 RIG_CONF_CHECKBUTTON, 00524 RIG_CONF_BUTTON 00525 }; 00526 00527 #define RIG_COMBO_MAX 8 00528 00532 struct confparams { 00533 token_t token; 00534 const char *name; 00535 const char *label; 00536 const char *tooltip; 00537 const char *dflt; 00538 enum rig_conf_e type; 00539 union { 00540 struct { 00541 float min; 00542 float max; 00543 float step; 00544 } n; 00545 struct { 00546 const char *combostr[RIG_COMBO_MAX]; 00547 } c; 00548 } u; 00549 }; 00550 00555 typedef enum { 00556 RIG_ANN_NONE = 0, 00557 RIG_ANN_OFF = RIG_ANN_NONE, 00558 RIG_ANN_FREQ = (1<<0), 00559 RIG_ANN_RXMODE = (1<<1), 00560 RIG_ANN_CW = (1<<2), 00561 RIG_ANN_ENG = (1<<3), 00562 RIG_ANN_JAP = (1<<4) 00563 } ann_t; 00564 00565 00569 typedef int ant_t; 00570 00571 #define RIG_ANT_NONE 0 00572 #define RIG_ANT_N(n) ((ant_t)1<<(n)) 00573 #define RIG_ANT_1 RIG_ANT_N(0) 00574 #define RIG_ANT_2 RIG_ANT_N(1) 00575 #define RIG_ANT_3 RIG_ANT_N(2) 00576 #define RIG_ANT_4 RIG_ANT_N(3) 00577 #define RIG_ANT_5 RIG_ANT_N(4) 00578 00582 /* TODO: kill me, and replace by real AGC delay */ 00583 enum agc_level_e { 00584 RIG_AGC_OFF = 0, 00585 RIG_AGC_SUPERFAST, 00586 RIG_AGC_FAST, 00587 RIG_AGC_SLOW, 00588 RIG_AGC_USER, 00589 RIG_AGC_MEDIUM, 00590 RIG_AGC_AUTO 00591 }; 00592 00596 enum meter_level_e { 00597 RIG_METER_NONE = 0, /*< No display meter */ 00598 RIG_METER_SWR = (1<<0), /*< Stationary Wave Ratio */ 00599 RIG_METER_COMP = (1<<1), /*< Compression level */ 00600 RIG_METER_ALC = (1<<2), /*< ALC */ 00601 RIG_METER_IC = (1<<3), /*< IC */ 00602 RIG_METER_DB = (1<<4), /*< DB */ 00603 RIG_METER_PO = (1<<5), /*< Power Out */ 00604 RIG_METER_VDD = (1<<6) /*< Final Amp Voltage */ 00605 }; 00606 00611 typedef union { 00612 signed int i; 00613 float f; 00614 char *s; 00615 const char *cs; 00616 } value_t; 00617 00626 enum rig_level_e { 00627 RIG_LEVEL_NONE = 0, 00628 RIG_LEVEL_PREAMP = (1<<0), 00629 RIG_LEVEL_ATT = (1<<1), 00630 RIG_LEVEL_VOX = (1<<2), 00631 RIG_LEVEL_AF = (1<<3), 00632 RIG_LEVEL_RF = (1<<4), 00633 RIG_LEVEL_SQL = (1<<5), 00634 RIG_LEVEL_IF = (1<<6), 00635 RIG_LEVEL_APF = (1<<7), 00636 RIG_LEVEL_NR = (1<<8), 00637 RIG_LEVEL_PBT_IN = (1<<9), 00638 RIG_LEVEL_PBT_OUT = (1<<10), 00639 RIG_LEVEL_CWPITCH = (1<<11), 00640 RIG_LEVEL_RFPOWER = (1<<12), 00641 RIG_LEVEL_MICGAIN = (1<<13), 00642 RIG_LEVEL_KEYSPD = (1<<14), 00643 RIG_LEVEL_NOTCHF = (1<<15), 00644 RIG_LEVEL_COMP = (1<<16), 00645 RIG_LEVEL_AGC = (1<<17), 00646 RIG_LEVEL_BKINDL = (1<<18), 00647 RIG_LEVEL_BALANCE = (1<<19), 00648 RIG_LEVEL_METER = (1<<20), 00650 RIG_LEVEL_VOXGAIN = (1<<21), 00651 RIG_LEVEL_VOXDELAY = RIG_LEVEL_VOX, 00652 RIG_LEVEL_ANTIVOX = (1<<22), 00653 RIG_LEVEL_SLOPE_LOW = (1<<23), 00654 RIG_LEVEL_SLOPE_HIGH = (1<<24), 00655 RIG_LEVEL_BKIN_DLYMS = (1<<25), 00658 RIG_LEVEL_RAWSTR = (1<<26), 00659 RIG_LEVEL_SQLSTAT = (1<<27), 00660 RIG_LEVEL_SWR = (1<<28), 00661 RIG_LEVEL_ALC = (1<<29), 00662 RIG_LEVEL_STRENGTH =(1<<30) 00663 /*RIG_LEVEL_BWC = (1<<31)*/ 00664 }; 00665 00666 #define RIG_LEVEL_FLOAT_LIST (RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_APF|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_COMP|RIG_LEVEL_BALANCE|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX) 00667 00668 #define RIG_LEVEL_READONLY_LIST (RIG_LEVEL_SQLSTAT|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_STRENGTH|RIG_LEVEL_RAWSTR) 00669 00670 #define RIG_LEVEL_IS_FLOAT(l) ((l)&RIG_LEVEL_FLOAT_LIST) 00671 #define RIG_LEVEL_SET(l) ((l)&~RIG_LEVEL_READONLY_LIST) 00672 00673 00682 enum rig_parm_e { 00683 RIG_PARM_NONE = 0, 00684 RIG_PARM_ANN = (1<<0), 00685 RIG_PARM_APO = (1<<1), 00686 RIG_PARM_BACKLIGHT = (1<<2), 00687 RIG_PARM_BEEP = (1<<4), 00688 RIG_PARM_TIME = (1<<5), 00689 RIG_PARM_BAT = (1<<6), 00690 RIG_PARM_KEYLIGHT = (1<<7) 00691 }; 00692 00693 #define RIG_PARM_FLOAT_LIST (RIG_PARM_BACKLIGHT|RIG_PARM_BAT) 00694 #define RIG_PARM_READONLY_LIST (RIG_PARM_BAT) 00695 00696 #define RIG_PARM_IS_FLOAT(l) ((l)&RIG_PARM_FLOAT_LIST) 00697 #define RIG_PARM_SET(l) ((l)&~RIG_PARM_READONLY_LIST) 00698 00699 #define RIG_SETTING_MAX 32 00700 00706 typedef unsigned long setting_t; 00707 00708 /* 00709 * tranceive mode, ie. the rig notify the host of any event, 00710 * like freq changed, mode changed, etc. 00711 */ 00712 #define RIG_TRN_OFF 0 00713 #define RIG_TRN_RIG 1 00714 #define RIG_TRN_POLL 2 00715 00716 00725 enum rig_func_e { 00726 RIG_FUNC_NONE = 0, 00727 RIG_FUNC_FAGC = (1<<0), 00728 RIG_FUNC_NB = (1<<1), 00729 RIG_FUNC_COMP = (1<<2), 00730 RIG_FUNC_VOX = (1<<3), 00731 RIG_FUNC_TONE = (1<<4), 00732 RIG_FUNC_TSQL = (1<<5), 00733 RIG_FUNC_SBKIN = (1<<6), 00734 RIG_FUNC_FBKIN = (1<<7), 00735 RIG_FUNC_ANF = (1<<8), 00736 RIG_FUNC_NR = (1<<9), 00737 RIG_FUNC_AIP = (1<<10), 00738 RIG_FUNC_APF = (1<<11), 00739 RIG_FUNC_MON = (1<<12), 00740 RIG_FUNC_MN = (1<<13), 00741 RIG_FUNC_RF = (1<<14), 00742 RIG_FUNC_ARO = (1<<15), 00743 RIG_FUNC_LOCK = (1<<16), 00744 RIG_FUNC_MUTE = (1<<17), 00745 RIG_FUNC_VSC = (1<<18), 00746 RIG_FUNC_REV = (1<<19), 00747 RIG_FUNC_SQL = (1<<20), 00748 RIG_FUNC_ABM = (1<<21), 00749 RIG_FUNC_BC = (1<<22), 00750 RIG_FUNC_MBC = (1<<23), 00751 /* (1<<24), used to be RIG_FUNC_LMP, see RIG_PARM_BACKLIGHT instead) */ 00752 RIG_FUNC_AFC = (1<<25), 00753 RIG_FUNC_SATMODE = (1<<26), 00754 RIG_FUNC_SCOPE = (1<<27), 00755 RIG_FUNC_RESUME = (1<<28), 00756 RIG_FUNC_TBURST = (1<<29), 00757 RIG_FUNC_TUNER = (1<<30) 00758 }; 00759 00760 /* 00761 * power unit macros, converts to mW 00762 * This is limited to 2MW on 32 bits systems. 00763 */ 00764 #define mW(p) ((int)(p)) 00765 #define Watts(p) ((int)((p)*1000)) 00766 #define W(p) Watts(p) 00767 #define kW(p) ((int)((p)*1000000L)) 00768 00777 typedef enum { 00778 RIG_MODE_NONE = 0, 00779 RIG_MODE_AM = (1<<0), 00780 RIG_MODE_CW = (1<<1), 00781 RIG_MODE_USB = (1<<2), 00782 RIG_MODE_LSB = (1<<3), 00783 RIG_MODE_RTTY = (1<<4), 00784 RIG_MODE_FM = (1<<5), 00785 RIG_MODE_WFM = (1<<6), 00786 RIG_MODE_CWR = (1<<7), 00787 RIG_MODE_RTTYR = (1<<8), 00788 RIG_MODE_AMS = (1<<9), 00789 RIG_MODE_PKTLSB = (1<<10), 00790 RIG_MODE_PKTUSB = (1<<11), 00791 RIG_MODE_PKTFM = (1<<12), 00792 RIG_MODE_ECSSUSB = (1<<13), 00793 RIG_MODE_ECSSLSB = (1<<14), 00794 RIG_MODE_FAX = (1<<15), 00795 RIG_MODE_SAM = (1<<16), 00796 RIG_MODE_SAL = (1<<17), 00797 RIG_MODE_SAH = (1<<18), 00798 RIG_MODE_DSB = (1<<19), 00799 RIG_MODE_TESTS_MAX 00800 } rmode_t; 00801 00802 00804 #define RIG_MODE_SSB (RIG_MODE_USB|RIG_MODE_LSB) 00805 00807 #define RIG_MODE_ECSS (RIG_MODE_ECSSUSB|RIG_MODE_ECSSLSB) 00808 00809 00810 #define RIG_DBLST_END 0 /* end marker in a preamp/att level list */ 00811 #define RIG_IS_DBLST_END(d) ((d)==0) 00812 00819 typedef struct freq_range_list { 00820 freq_t start; 00821 freq_t end; 00822 rmode_t modes; 00823 int low_power; 00824 int high_power; 00825 vfo_t vfo; 00826 ant_t ant; 00827 } freq_range_t; 00828 00829 #define RIG_FRNG_END {Hz(0),Hz(0),RIG_MODE_NONE,0,0,RIG_VFO_NONE} 00830 #define RIG_IS_FRNG_END(r) ((r).start == Hz(0) && (r).end == Hz(0)) 00831 00832 #define RIG_ITU_REGION1 1 00833 #define RIG_ITU_REGION2 2 00834 #define RIG_ITU_REGION3 3 00835 00855 struct tuning_step_list { 00856 rmode_t modes; 00857 shortfreq_t ts; 00858 }; 00859 00860 #define RIG_TS_ANY 0 00861 #define RIG_TS_END {RIG_MODE_NONE,0} 00862 #define RIG_IS_TS_END(t) ((t).modes == RIG_MODE_NONE && (t).ts == 0) 00863 00890 struct filter_list { 00891 rmode_t modes; 00892 pbwidth_t width; 00893 }; 00894 00895 #define RIG_FLT_ANY 0 00896 #define RIG_FLT_END {RIG_MODE_NONE,0} 00897 #define RIG_IS_FLT_END(f) ((f).modes == RIG_MODE_NONE) 00898 00899 00901 #define RIG_CHFLAG_NONE 0 00902 00903 #define RIG_CHFLAG_SKIP (1<<0) 00904 00905 #define RIG_CHFLAG_DATA (1<<1) 00906 00911 struct ext_list { 00912 token_t token; 00913 value_t val; 00914 }; 00915 00916 #define RIG_EXT_END {0, {.i=0}} 00917 #define RIG_IS_EXT_END(x) ((x).token == 0) 00918 00926 struct channel { 00927 int channel_num; 00928 int bank_num; 00929 vfo_t vfo; 00930 int ant; 00931 freq_t freq; 00932 rmode_t mode; 00933 pbwidth_t width; 00935 freq_t tx_freq; 00936 rmode_t tx_mode; 00937 pbwidth_t tx_width; 00939 split_t split; 00940 vfo_t tx_vfo; 00942 rptr_shift_t rptr_shift; 00943 shortfreq_t rptr_offs; 00944 shortfreq_t tuning_step; 00945 shortfreq_t rit; 00946 shortfreq_t xit; 00947 setting_t funcs; 00948 value_t levels[RIG_SETTING_MAX]; 00949 tone_t ctcss_tone; 00950 tone_t ctcss_sql; 00951 tone_t dcs_code; 00952 tone_t dcs_sql; 00953 int scan_group; 00954 int flags; 00955 char channel_desc[MAXCHANDESC]; 00956 struct ext_list *ext_levels; 00957 }; 00959 typedef struct channel channel_t; 00960 00966 struct channel_cap { 00967 unsigned bank_num:1; 00968 unsigned vfo:1; 00969 unsigned ant:1; 00970 unsigned freq:1; 00971 unsigned mode:1; 00972 unsigned width:1; 00974 unsigned tx_freq:1; 00975 unsigned tx_mode:1; 00976 unsigned tx_width:1; 00978 unsigned split:1; 00979 unsigned tx_vfo:1; 00980 unsigned rptr_shift:1; 00981 unsigned rptr_offs:1; 00982 unsigned tuning_step:1; 00983 unsigned rit:1; 00984 unsigned xit:1; 00985 setting_t funcs; 00986 setting_t levels; 00987 unsigned ctcss_tone:1; 00988 unsigned ctcss_sql:1; 00989 unsigned dcs_code:1; 00990 unsigned dcs_sql:1; 00991 unsigned scan_group:1; 00992 unsigned flags:1; 00993 unsigned channel_desc:1; 00994 unsigned ext_levels:1; 00995 }; 00996 00998 typedef struct channel_cap channel_cap_t; 00999 01000 01011 typedef enum { 01012 RIG_MTYPE_NONE=0, 01013 RIG_MTYPE_MEM, 01014 RIG_MTYPE_EDGE, 01015 RIG_MTYPE_CALL, 01016 RIG_MTYPE_MEMOPAD, 01017 RIG_MTYPE_SAT, 01018 RIG_MTYPE_BAND, 01019 RIG_MTYPE_PRIO 01020 } chan_type_t; 01021 01035 struct chan_list { 01036 int start; 01037 int end; 01038 chan_type_t type; 01039 channel_cap_t mem_caps; 01040 }; 01041 01042 #define RIG_CHAN_END {0,0,RIG_MTYPE_NONE} 01043 #define RIG_IS_CHAN_END(c) ((c).type == RIG_MTYPE_NONE) 01044 01045 #define RIG_MEM_CAPS_ALL -1 01046 01048 typedef struct chan_list chan_t; 01049 01061 struct gran { 01062 value_t min; 01063 value_t max; 01064 value_t step; 01065 }; 01066 01068 typedef struct gran gran_t; 01069 01070 01072 struct cal_table { 01073 int size; 01074 struct { 01075 int raw; 01076 int val; 01077 } table[MAX_CAL_LENGTH]; 01078 }; 01079 01092 typedef struct cal_table cal_table_t; 01093 01094 #define EMPTY_STR_CAL { 0, { { 0, 0 }, } } 01095 01096 01097 typedef int (*chan_cb_t) (RIG *, channel_t**, int, const chan_t*, rig_ptr_t); 01098 typedef int (*confval_cb_t) (RIG *, const struct confparams *, value_t *, rig_ptr_t); 01099 01118 struct rig_caps { 01119 rig_model_t rig_model; 01120 const char *model_name; 01121 const char *mfg_name; 01122 const char *version; 01123 const char *copyright; 01124 enum rig_status_e status; 01126 int rig_type; 01127 ptt_type_t ptt_type; 01128 dcd_type_t dcd_type; 01129 rig_port_t port_type; 01131 int serial_rate_min; 01132 int serial_rate_max; 01133 int serial_data_bits; 01134 int serial_stop_bits; 01135 enum serial_parity_e serial_parity; 01136 enum serial_handshake_e serial_handshake; 01138 int write_delay; 01139 int post_write_delay; 01140 int timeout; 01141 int retry; 01143 setting_t has_get_func; 01144 setting_t has_set_func; 01145 setting_t has_get_level; 01146 setting_t has_set_level; 01147 setting_t has_get_parm; 01148 setting_t has_set_parm; 01150 gran_t level_gran[RIG_SETTING_MAX]; 01151 gran_t parm_gran[RIG_SETTING_MAX]; 01153 const struct confparams *extparms; 01154 const struct confparams *extlevels; 01156 const tone_t *ctcss_list; 01157 const tone_t *dcs_list; 01159 int preamp[MAXDBLSTSIZ]; 01160 int attenuator[MAXDBLSTSIZ]; 01161 shortfreq_t max_rit; 01162 shortfreq_t max_xit; 01163 shortfreq_t max_ifshift; 01165 ann_t announces; 01167 vfo_op_t vfo_ops; 01168 scan_t scan_ops; 01169 int targetable_vfo; 01170 int transceive; 01172 int bank_qty; 01173 int chan_desc_sz; 01175 chan_t chan_list[CHANLSTSIZ]; 01177 freq_range_t rx_range_list1[FRQRANGESIZ]; 01178 freq_range_t tx_range_list1[FRQRANGESIZ]; 01179 freq_range_t rx_range_list2[FRQRANGESIZ]; 01180 freq_range_t tx_range_list2[FRQRANGESIZ]; 01182 struct tuning_step_list tuning_steps[TSLSTSIZ]; 01183 struct filter_list filters[FLTLSTSIZ]; 01185 cal_table_t str_cal; 01187 const struct confparams *cfgparams; 01188 const rig_ptr_t priv; 01190 /* 01191 * Rig API 01192 * 01193 */ 01194 01195 int (*rig_init) (RIG * rig); 01196 int (*rig_cleanup) (RIG * rig); 01197 int (*rig_open) (RIG * rig); 01198 int (*rig_close) (RIG * rig); 01199 01200 /* 01201 * General API commands, from most primitive to least.. :() 01202 * List Set/Get functions pairs 01203 */ 01204 01205 int (*set_freq) (RIG * rig, vfo_t vfo, freq_t freq); 01206 int (*get_freq) (RIG * rig, vfo_t vfo, freq_t * freq); 01207 01208 int (*set_mode) (RIG * rig, vfo_t vfo, rmode_t mode, 01209 pbwidth_t width); 01210 int (*get_mode) (RIG * rig, vfo_t vfo, rmode_t * mode, 01211 pbwidth_t * width); 01212 01213 int (*set_vfo) (RIG * rig, vfo_t vfo); 01214 int (*get_vfo) (RIG * rig, vfo_t * vfo); 01215 01216 int (*set_ptt) (RIG * rig, vfo_t vfo, ptt_t ptt); 01217 int (*get_ptt) (RIG * rig, vfo_t vfo, ptt_t * ptt); 01218 int (*get_dcd) (RIG * rig, vfo_t vfo, dcd_t * dcd); 01219 01220 int (*set_rptr_shift) (RIG * rig, vfo_t vfo, 01221 rptr_shift_t rptr_shift); 01222 int (*get_rptr_shift) (RIG * rig, vfo_t vfo, 01223 rptr_shift_t * rptr_shift); 01224 01225 int (*set_rptr_offs) (RIG * rig, vfo_t vfo, shortfreq_t offs); 01226 int (*get_rptr_offs) (RIG * rig, vfo_t vfo, shortfreq_t * offs); 01227 01228 int (*set_split_freq) (RIG * rig, vfo_t vfo, freq_t tx_freq); 01229 int (*get_split_freq) (RIG * rig, vfo_t vfo, freq_t * tx_freq); 01230 int (*set_split_mode) (RIG * rig, vfo_t vfo, rmode_t tx_mode, 01231 pbwidth_t tx_width); 01232 int (*get_split_mode) (RIG * rig, vfo_t vfo, rmode_t * tx_mode, 01233 pbwidth_t * tx_width); 01234 01235 int (*set_split_vfo) (RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo); 01236 int (*get_split_vfo) (RIG * rig, vfo_t vfo, split_t * split, vfo_t *tx_vfo); 01237 01238 int (*set_rit) (RIG * rig, vfo_t vfo, shortfreq_t rit); 01239 int (*get_rit) (RIG * rig, vfo_t vfo, shortfreq_t * rit); 01240 int (*set_xit) (RIG * rig, vfo_t vfo, shortfreq_t xit); 01241 int (*get_xit) (RIG * rig, vfo_t vfo, shortfreq_t * xit); 01242 01243 int (*set_ts) (RIG * rig, vfo_t vfo, shortfreq_t ts); 01244 int (*get_ts) (RIG * rig, vfo_t vfo, shortfreq_t * ts); 01245 01246 int (*set_dcs_code) (RIG * rig, vfo_t vfo, tone_t code); 01247 int (*get_dcs_code) (RIG * rig, vfo_t vfo, tone_t * code); 01248 int (*set_tone) (RIG * rig, vfo_t vfo, tone_t tone); 01249 int (*get_tone) (RIG * rig, vfo_t vfo, tone_t * tone); 01250 int (*set_ctcss_tone) (RIG * rig, vfo_t vfo, tone_t tone); 01251 int (*get_ctcss_tone) (RIG * rig, vfo_t vfo, tone_t * tone); 01252 01253 int (*set_dcs_sql) (RIG * rig, vfo_t vfo, tone_t code); 01254 int (*get_dcs_sql) (RIG * rig, vfo_t vfo, tone_t * code); 01255 int (*set_tone_sql) (RIG * rig, vfo_t vfo, tone_t tone); 01256 int (*get_tone_sql) (RIG * rig, vfo_t vfo, tone_t * tone); 01257 int (*set_ctcss_sql) (RIG * rig, vfo_t vfo, tone_t tone); 01258 int (*get_ctcss_sql) (RIG * rig, vfo_t vfo, tone_t * tone); 01259 01260 int (*power2mW) (RIG * rig, unsigned int *mwpower, float power, 01261 freq_t freq, rmode_t mode); 01262 int (*mW2power) (RIG * rig, float *power, unsigned int mwpower, 01263 freq_t freq, rmode_t mode); 01264 01265 int (*set_powerstat) (RIG * rig, powerstat_t status); 01266 int (*get_powerstat) (RIG * rig, powerstat_t * status); 01267 int (*reset) (RIG * rig, reset_t reset); 01268 01269 int (*set_ant) (RIG * rig, vfo_t vfo, ant_t ant); 01270 int (*get_ant) (RIG * rig, vfo_t vfo, ant_t * ant); 01271 01272 int (*set_level) (RIG * rig, vfo_t vfo, setting_t level, 01273 value_t val); 01274 int (*get_level) (RIG * rig, vfo_t vfo, setting_t level, 01275 value_t * val); 01276 01277 int (*set_func) (RIG * rig, vfo_t vfo, setting_t func, int status); 01278 int (*get_func) (RIG * rig, vfo_t vfo, setting_t func, 01279 int *status); 01280 01281 int (*set_parm) (RIG * rig, setting_t parm, value_t val); 01282 int (*get_parm) (RIG * rig, setting_t parm, value_t * val); 01283 01284 int (*set_ext_level)(RIG *rig, vfo_t vfo, token_t token, value_t val); 01285 int (*get_ext_level)(RIG *rig, vfo_t vfo, token_t token, value_t *val); 01286 01287 int (*set_ext_parm)(RIG *rig, token_t token, value_t val); 01288 int (*get_ext_parm)(RIG *rig, token_t token, value_t *val); 01289 01290 int (*set_conf) (RIG * rig, token_t token, const char *val); 01291 int (*get_conf) (RIG * rig, token_t token, char *val); 01292 01293 int (*send_dtmf) (RIG * rig, vfo_t vfo, const char *digits); 01294 int (*recv_dtmf) (RIG * rig, vfo_t vfo, char *digits, int *length); 01295 int (*send_morse) (RIG * rig, vfo_t vfo, const char *msg); 01296 01297 int (*set_bank) (RIG * rig, vfo_t vfo, int bank); 01298 int (*set_mem) (RIG * rig, vfo_t vfo, int ch); 01299 int (*get_mem) (RIG * rig, vfo_t vfo, int *ch); 01300 int (*vfo_op) (RIG * rig, vfo_t vfo, vfo_op_t op); 01301 int (*scan) (RIG * rig, vfo_t vfo, scan_t scan, int ch); 01302 01303 int (*set_trn) (RIG * rig, int trn); 01304 int (*get_trn) (RIG * rig, int *trn); 01305 01306 int (*decode_event) (RIG * rig); 01307 01308 int (*set_channel) (RIG * rig, const channel_t * chan); 01309 int (*get_channel) (RIG * rig, channel_t * chan); 01310 01311 const char *(*get_info) (RIG * rig); 01312 01313 int (*set_chan_all_cb) (RIG * rig, chan_cb_t chan_cb, rig_ptr_t); 01314 int (*get_chan_all_cb) (RIG * rig, chan_cb_t chan_cb, rig_ptr_t); 01315 01316 int (*set_mem_all_cb) (RIG * rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t); 01317 int (*get_mem_all_cb) (RIG * rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t); 01318 01319 const char *clone_combo_set; 01320 const char *clone_combo_get; 01321 }; 01322 01328 typedef struct { 01329 union { 01330 rig_port_t rig; 01331 ptt_type_t ptt; 01332 dcd_type_t dcd; 01333 } type; 01334 int fd; 01335 void* handle; 01337 int write_delay; 01338 int post_write_delay; 01339 struct { int tv_sec,tv_usec; } post_write_date; 01340 int timeout; 01341 int retry; 01343 char pathname[FILPATHLEN]; 01344 union { 01345 struct { 01346 int rate; 01347 int data_bits; 01348 int stop_bits; 01349 enum serial_parity_e parity; 01350 enum serial_handshake_e handshake; 01351 enum serial_control_state_e rts_state; 01352 enum serial_control_state_e dtr_state; 01353 } serial; 01354 struct { 01355 int pin; 01356 } parallel; 01357 struct { 01358 int ptt_bitnum; /*< Bit number for CM108 GPIO PTT */ 01359 } cm108; 01360 struct { 01361 int vid; 01362 int pid; 01363 int conf; 01364 int iface; 01365 int alt; 01366 char *vendor_name; 01367 char *product; 01368 } usb; 01369 } parm; 01370 } hamlib_port_t; 01371 01372 #if !defined(__APPLE__) || !defined(__cplusplus) 01373 typedef hamlib_port_t port_t; 01374 #endif 01375 01376 01386 struct rig_state { 01387 /* 01388 * overridable fields 01389 */ 01390 hamlib_port_t rigport; 01391 hamlib_port_t pttport; 01392 hamlib_port_t dcdport; 01394 double vfo_comp; 01396 int itu_region; 01397 freq_range_t rx_range_list[FRQRANGESIZ]; 01398 freq_range_t tx_range_list[FRQRANGESIZ]; 01400 struct tuning_step_list tuning_steps[TSLSTSIZ]; 01402 struct filter_list filters[FLTLSTSIZ]; 01404 cal_table_t str_cal; 01406 chan_t chan_list[CHANLSTSIZ]; 01408 shortfreq_t max_rit; 01409 shortfreq_t max_xit; 01410 shortfreq_t max_ifshift; 01412 ann_t announces; 01414 int preamp[MAXDBLSTSIZ]; 01415 int attenuator[MAXDBLSTSIZ]; 01417 setting_t has_get_func; 01418 setting_t has_set_func; 01419 setting_t has_get_level; 01420 setting_t has_set_level; 01421 setting_t has_get_parm; 01422 setting_t has_set_parm; 01424 gran_t level_gran[RIG_SETTING_MAX]; 01425 gran_t parm_gran[RIG_SETTING_MAX]; 01428 /* 01429 * non overridable fields, internal use 01430 */ 01431 01432 int hold_decode; 01433 vfo_t current_vfo; 01434 int vfo_list; 01435 int comm_state; 01436 rig_ptr_t priv; 01437 rig_ptr_t obj; 01439 int transceive; 01440 int poll_interval; 01441 freq_t current_freq; 01442 rmode_t current_mode; 01443 pbwidth_t current_width; 01444 vfo_t tx_vfo; 01445 int mode_list; 01447 }; 01448 01449 01450 typedef int (*vprintf_cb_t) (enum rig_debug_level_e, rig_ptr_t, const char *, va_list); 01451 01452 typedef int (*freq_cb_t) (RIG *, vfo_t, freq_t, rig_ptr_t); 01453 typedef int (*mode_cb_t) (RIG *, vfo_t, rmode_t, pbwidth_t, rig_ptr_t); 01454 typedef int (*vfo_cb_t) (RIG *, vfo_t, rig_ptr_t); 01455 typedef int (*ptt_cb_t) (RIG *, vfo_t, ptt_t, rig_ptr_t); 01456 typedef int (*dcd_cb_t) (RIG *, vfo_t, dcd_t, rig_ptr_t); 01457 typedef int (*pltune_cb_t) (RIG *, vfo_t, freq_t *, rmode_t *, pbwidth_t *, rig_ptr_t); 01458 01476 struct rig_callbacks { 01477 freq_cb_t freq_event; 01478 rig_ptr_t freq_arg; 01479 mode_cb_t mode_event; 01480 rig_ptr_t mode_arg; 01481 vfo_cb_t vfo_event; 01482 rig_ptr_t vfo_arg; 01483 ptt_cb_t ptt_event; 01484 rig_ptr_t ptt_arg; 01485 dcd_cb_t dcd_event; 01486 rig_ptr_t dcd_arg; 01487 pltune_cb_t pltune; 01488 rig_ptr_t pltune_arg; 01489 /* etc.. */ 01490 }; 01491 01501 struct rig { 01502 struct rig_caps *caps; 01503 struct rig_state state; 01504 struct rig_callbacks callbacks; 01505 }; 01506 01507 01508 01509 /* --------------- API function prototypes -----------------*/ 01510 01511 extern HAMLIB_EXPORT(RIG *) rig_init HAMLIB_PARAMS((rig_model_t rig_model)); 01512 extern HAMLIB_EXPORT(int) rig_open HAMLIB_PARAMS((RIG *rig)); 01513 01514 /* 01515 * General API commands, from most primitive to least.. :() 01516 * List Set/Get functions pairs 01517 */ 01518 01519 extern HAMLIB_EXPORT(int) rig_set_freq HAMLIB_PARAMS((RIG *rig, vfo_t vfo, freq_t freq)); 01520 extern HAMLIB_EXPORT(int) rig_get_freq HAMLIB_PARAMS((RIG *rig, vfo_t vfo, freq_t *freq)); 01521 01522 extern HAMLIB_EXPORT(int) rig_set_mode HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)); 01523 extern HAMLIB_EXPORT(int) rig_get_mode HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)); 01524 01525 extern HAMLIB_EXPORT(int) rig_set_vfo HAMLIB_PARAMS((RIG *rig, vfo_t vfo)); 01526 extern HAMLIB_EXPORT(int) rig_get_vfo HAMLIB_PARAMS((RIG *rig, vfo_t *vfo)); 01527 01528 extern HAMLIB_EXPORT(int) rig_set_ptt HAMLIB_PARAMS((RIG *rig, vfo_t vfo, ptt_t ptt)); 01529 extern HAMLIB_EXPORT(int) rig_get_ptt HAMLIB_PARAMS((RIG *rig, vfo_t vfo, ptt_t *ptt)); 01530 01531 extern HAMLIB_EXPORT(int) rig_get_dcd HAMLIB_PARAMS((RIG *rig, vfo_t vfo, dcd_t *dcd)); 01532 01533 extern HAMLIB_EXPORT(int) rig_set_rptr_shift HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift)); 01534 extern HAMLIB_EXPORT(int) rig_get_rptr_shift HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift)); 01535 extern HAMLIB_EXPORT(int) rig_set_rptr_offs HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t rptr_offs)); 01536 extern HAMLIB_EXPORT(int) rig_get_rptr_offs HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs)); 01537 01538 extern HAMLIB_EXPORT(int) rig_set_ctcss_tone HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t tone)); 01539 extern HAMLIB_EXPORT(int) rig_get_ctcss_tone HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t *tone)); 01540 extern HAMLIB_EXPORT(int) rig_set_dcs_code HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t code)); 01541 extern HAMLIB_EXPORT(int) rig_get_dcs_code HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t *code)); 01542 01543 extern HAMLIB_EXPORT(int) rig_set_ctcss_sql HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t tone)); 01544 extern HAMLIB_EXPORT(int) rig_get_ctcss_sql HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t *tone)); 01545 extern HAMLIB_EXPORT(int) rig_set_dcs_sql HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t code)); 01546 extern HAMLIB_EXPORT(int) rig_get_dcs_sql HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t *code)); 01547 01548 extern HAMLIB_EXPORT(int) rig_set_split_freq HAMLIB_PARAMS((RIG *rig, vfo_t vfo, freq_t tx_freq)); 01549 extern HAMLIB_EXPORT(int) rig_get_split_freq HAMLIB_PARAMS((RIG *rig, vfo_t vfo, freq_t *tx_freq)); 01550 extern HAMLIB_EXPORT(int) rig_set_split_mode HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)); 01551 extern HAMLIB_EXPORT(int) rig_get_split_mode HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width)); 01552 extern HAMLIB_EXPORT(int) rig_set_split_vfo HAMLIB_PARAMS((RIG*, vfo_t rx_vfo, split_t split, vfo_t tx_vfo)); 01553 extern HAMLIB_EXPORT(int) rig_get_split_vfo HAMLIB_PARAMS((RIG*, vfo_t rx_vfo, split_t *split, vfo_t *tx_vfo)); 01554 #define rig_set_split(r,v,s) rig_set_split_vfo((r),(v),(s),RIG_VFO_CURR) 01555 #define rig_get_split(r,v,s) ({ vfo_t _tx_vfo; rig_get_split_vfo((r),(v),(s),&_tx_vfo); }) 01556 01557 extern HAMLIB_EXPORT(int) rig_set_rit HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t rit)); 01558 extern HAMLIB_EXPORT(int) rig_get_rit HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t *rit)); 01559 extern HAMLIB_EXPORT(int) rig_set_xit HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t xit)); 01560 extern HAMLIB_EXPORT(int) rig_get_xit HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t *xit)); 01561 01562 extern HAMLIB_EXPORT(int) rig_set_ts HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t ts)); 01563 extern HAMLIB_EXPORT(int) rig_get_ts HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t *ts)); 01564 01565 extern HAMLIB_EXPORT(int) rig_power2mW HAMLIB_PARAMS((RIG *rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode)); 01566 extern HAMLIB_EXPORT(int) rig_mW2power HAMLIB_PARAMS((RIG *rig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode)); 01567 01568 extern HAMLIB_EXPORT(shortfreq_t) rig_get_resolution HAMLIB_PARAMS((RIG *rig, rmode_t mode)); 01569 01570 extern HAMLIB_EXPORT(int) rig_set_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo, setting_t level, value_t val)); 01571 extern HAMLIB_EXPORT(int) rig_get_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo, setting_t level, value_t *val)); 01572 01573 #define rig_get_strength(r,v,s) rig_get_level((r),(v),RIG_LEVEL_STRENGTH, (value_t*)(s)) 01574 01575 extern HAMLIB_EXPORT(int) rig_set_parm HAMLIB_PARAMS((RIG *rig, setting_t parm, value_t val)); 01576 extern HAMLIB_EXPORT(int) rig_get_parm HAMLIB_PARAMS((RIG *rig, setting_t parm, value_t *val)); 01577 01578 extern HAMLIB_EXPORT(int) rig_set_conf HAMLIB_PARAMS((RIG *rig, token_t token, const char *val)); 01579 extern HAMLIB_EXPORT(int) rig_get_conf HAMLIB_PARAMS((RIG *rig, token_t token, char *val)); 01580 01581 extern HAMLIB_EXPORT(int) rig_set_powerstat HAMLIB_PARAMS((RIG *rig, powerstat_t status)); 01582 extern HAMLIB_EXPORT(int) rig_get_powerstat HAMLIB_PARAMS((RIG *rig, powerstat_t *status)); 01583 01584 extern HAMLIB_EXPORT(int) rig_reset HAMLIB_PARAMS((RIG *rig, reset_t reset)); /* dangerous! */ 01585 01586 extern HAMLIB_EXPORT(int) rig_set_ext_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo, 01587 token_t token, value_t val)); 01588 extern HAMLIB_EXPORT(int) rig_get_ext_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo, 01589 token_t token, value_t *val)); 01590 01591 extern HAMLIB_EXPORT(int) rig_set_ext_parm HAMLIB_PARAMS((RIG *rig, token_t token, value_t val)); 01592 extern HAMLIB_EXPORT(int) rig_get_ext_parm HAMLIB_PARAMS((RIG *rig, token_t token, value_t *val)); 01593 01594 extern HAMLIB_EXPORT(int) rig_ext_level_foreach HAMLIB_PARAMS((RIG *rig, int (*cfunc)(RIG*, const struct confparams *, rig_ptr_t), rig_ptr_t data)); 01595 extern HAMLIB_EXPORT(int) rig_ext_parm_foreach HAMLIB_PARAMS((RIG *rig, int (*cfunc)(RIG*, const struct confparams *, rig_ptr_t), rig_ptr_t data)); 01596 extern HAMLIB_EXPORT(const struct confparams*) rig_ext_lookup HAMLIB_PARAMS((RIG *rig, const char *name)); 01597 extern HAMLIB_EXPORT(const struct confparams *) rig_ext_lookup_tok HAMLIB_PARAMS((RIG *rig, token_t token)); 01598 extern HAMLIB_EXPORT(token_t) rig_ext_token_lookup HAMLIB_PARAMS((RIG *rig, const char *name)); 01599 01600 01601 extern HAMLIB_EXPORT(int) rig_token_foreach HAMLIB_PARAMS((RIG *rig, int (*cfunc)(const struct confparams *, rig_ptr_t), rig_ptr_t data)); 01602 extern HAMLIB_EXPORT(const struct confparams*) rig_confparam_lookup HAMLIB_PARAMS((RIG *rig, const char *name)); 01603 extern HAMLIB_EXPORT(token_t) rig_token_lookup HAMLIB_PARAMS((RIG *rig, const char *name)); 01604 01605 extern HAMLIB_EXPORT(int) rig_close HAMLIB_PARAMS((RIG *rig)); 01606 extern HAMLIB_EXPORT(int) rig_cleanup HAMLIB_PARAMS((RIG *rig)); 01607 01608 extern HAMLIB_EXPORT(int) rig_set_ant HAMLIB_PARAMS((RIG *rig, vfo_t vfo, ant_t ant)); /* antenna */ 01609 extern HAMLIB_EXPORT(int) rig_get_ant HAMLIB_PARAMS((RIG *rig, vfo_t vfo, ant_t *ant)); 01610 01611 extern HAMLIB_EXPORT(setting_t) rig_has_get_level HAMLIB_PARAMS((RIG *rig, setting_t level)); 01612 extern HAMLIB_EXPORT(setting_t) rig_has_set_level HAMLIB_PARAMS((RIG *rig, setting_t level)); 01613 01614 extern HAMLIB_EXPORT(setting_t) rig_has_get_parm HAMLIB_PARAMS((RIG *rig, setting_t parm)); 01615 extern HAMLIB_EXPORT(setting_t) rig_has_set_parm HAMLIB_PARAMS((RIG *rig, setting_t parm)); 01616 01617 extern HAMLIB_EXPORT(setting_t) rig_has_get_func HAMLIB_PARAMS((RIG *rig, setting_t func)); 01618 extern HAMLIB_EXPORT(setting_t) rig_has_set_func HAMLIB_PARAMS((RIG *rig, setting_t func)); 01619 01620 extern HAMLIB_EXPORT(int) rig_set_func HAMLIB_PARAMS((RIG *rig, vfo_t vfo, setting_t func, int status)); 01621 extern HAMLIB_EXPORT(int) rig_get_func HAMLIB_PARAMS((RIG *rig, vfo_t vfo, setting_t func, int *status)); 01622 01623 extern HAMLIB_EXPORT(int) rig_send_dtmf HAMLIB_PARAMS((RIG *rig, vfo_t vfo, const char *digits)); 01624 extern HAMLIB_EXPORT(int) rig_recv_dtmf HAMLIB_PARAMS((RIG *rig, vfo_t vfo, char *digits, int *length)); 01625 extern HAMLIB_EXPORT(int) rig_send_morse HAMLIB_PARAMS((RIG *rig, vfo_t vfo, const char *msg)); 01626 01627 extern HAMLIB_EXPORT(int) rig_set_bank HAMLIB_PARAMS((RIG *rig, vfo_t vfo, int bank)); 01628 extern HAMLIB_EXPORT(int) rig_set_mem HAMLIB_PARAMS((RIG *rig, vfo_t vfo, int ch)); 01629 extern HAMLIB_EXPORT(int) rig_get_mem HAMLIB_PARAMS((RIG *rig, vfo_t vfo, int *ch)); 01630 extern HAMLIB_EXPORT(int) rig_vfo_op HAMLIB_PARAMS((RIG *rig, vfo_t vfo, vfo_op_t op)); 01631 extern HAMLIB_EXPORT(vfo_op_t) rig_has_vfo_op HAMLIB_PARAMS((RIG *rig, vfo_op_t op)); 01632 extern HAMLIB_EXPORT(int) rig_scan HAMLIB_PARAMS((RIG *rig, vfo_t vfo, scan_t scan, int ch)); 01633 extern HAMLIB_EXPORT(scan_t) rig_has_scan HAMLIB_PARAMS((RIG *rig, scan_t scan)); 01634 01635 extern HAMLIB_EXPORT(int) rig_set_channel HAMLIB_PARAMS((RIG *rig, const channel_t *chan)); /* mem */ 01636 extern HAMLIB_EXPORT(int) rig_get_channel HAMLIB_PARAMS((RIG *rig, channel_t *chan)); 01637 01638 extern HAMLIB_EXPORT(int) rig_set_chan_all HAMLIB_PARAMS((RIG *rig, const channel_t chans[])); 01639 extern HAMLIB_EXPORT(int) rig_get_chan_all HAMLIB_PARAMS((RIG *rig, channel_t chans[])); 01640 extern HAMLIB_EXPORT(int) rig_set_chan_all_cb HAMLIB_PARAMS((RIG *rig, chan_cb_t chan_cb, rig_ptr_t)); 01641 extern HAMLIB_EXPORT(int) rig_get_chan_all_cb HAMLIB_PARAMS((RIG *rig, chan_cb_t chan_cb, rig_ptr_t)); 01642 01643 extern HAMLIB_EXPORT(int) rig_set_mem_all_cb HAMLIB_PARAMS((RIG *rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t)); 01644 extern HAMLIB_EXPORT(int) rig_get_mem_all_cb HAMLIB_PARAMS((RIG *rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t)); 01645 extern HAMLIB_EXPORT(int) rig_set_mem_all HAMLIB_PARAMS((RIG *rig, const channel_t *chan, const struct confparams *, const value_t *)); 01646 extern HAMLIB_EXPORT(int) rig_get_mem_all HAMLIB_PARAMS((RIG *rig, channel_t *chan, const struct confparams *, value_t *)); 01647 extern HAMLIB_EXPORT(const chan_t *) rig_lookup_mem_caps HAMLIB_PARAMS((RIG *rig, int ch)); 01648 extern HAMLIB_EXPORT(int) rig_mem_count HAMLIB_PARAMS((RIG *rig)); 01649 01650 01651 extern HAMLIB_EXPORT(int) rig_set_trn HAMLIB_PARAMS((RIG *rig, int trn)); 01652 extern HAMLIB_EXPORT(int) rig_get_trn HAMLIB_PARAMS((RIG *rig, int *trn)); 01653 extern HAMLIB_EXPORT(int) rig_set_freq_callback HAMLIB_PARAMS((RIG *, freq_cb_t, rig_ptr_t)); 01654 extern HAMLIB_EXPORT(int) rig_set_mode_callback HAMLIB_PARAMS((RIG *, mode_cb_t, rig_ptr_t)); 01655 extern HAMLIB_EXPORT(int) rig_set_vfo_callback HAMLIB_PARAMS((RIG *, vfo_cb_t, rig_ptr_t)); 01656 extern HAMLIB_EXPORT(int) rig_set_ptt_callback HAMLIB_PARAMS((RIG *, ptt_cb_t, rig_ptr_t)); 01657 extern HAMLIB_EXPORT(int) rig_set_dcd_callback HAMLIB_PARAMS((RIG *, dcd_cb_t, rig_ptr_t)); 01658 extern HAMLIB_EXPORT(int) rig_set_pltune_callback HAMLIB_PARAMS((RIG *, pltune_cb_t, rig_ptr_t)); 01659 01660 extern HAMLIB_EXPORT(const char *) rig_get_info HAMLIB_PARAMS((RIG *rig)); 01661 01662 extern HAMLIB_EXPORT(const struct rig_caps *) rig_get_caps HAMLIB_PARAMS((rig_model_t rig_model)); 01663 extern HAMLIB_EXPORT(const freq_range_t *) rig_get_range HAMLIB_PARAMS((const freq_range_t range_list[], freq_t freq, rmode_t mode)); 01664 01665 extern HAMLIB_EXPORT(pbwidth_t) rig_passband_normal HAMLIB_PARAMS((RIG *rig, rmode_t mode)); 01666 extern HAMLIB_EXPORT(pbwidth_t) rig_passband_narrow HAMLIB_PARAMS((RIG *rig, rmode_t mode)); 01667 extern HAMLIB_EXPORT(pbwidth_t) rig_passband_wide HAMLIB_PARAMS((RIG *rig, rmode_t mode)); 01668 01669 extern HAMLIB_EXPORT(const char *) rigerror HAMLIB_PARAMS((int errnum)); 01670 01671 extern HAMLIB_EXPORT(int) rig_setting2idx HAMLIB_PARAMS((setting_t s)); 01672 #define rig_idx2setting(i) (1UL<<(i)) 01673 01674 /* 01675 * Even if these functions are prefixed with "rig_", they are not rig specific 01676 * Maybe "hamlib_" would have been better. Let me know. --SF 01677 */ 01678 extern HAMLIB_EXPORT(void) rig_set_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level)); 01679 #define rig_set_debug_level(level) rig_set_debug(level) 01680 extern HAMLIB_EXPORT(int) rig_need_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level)); 01681 extern HAMLIB_EXPORT(void) rig_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level, const char *fmt, ...)); 01682 extern HAMLIB_EXPORT(vprintf_cb_t) rig_set_debug_callback HAMLIB_PARAMS((vprintf_cb_t cb, rig_ptr_t arg)); 01683 extern HAMLIB_EXPORT(FILE*) rig_set_debug_file HAMLIB_PARAMS((FILE *stream)); 01684 01685 extern HAMLIB_EXPORT(int) rig_register HAMLIB_PARAMS((const struct rig_caps *caps)); 01686 extern HAMLIB_EXPORT(int) rig_unregister HAMLIB_PARAMS((rig_model_t rig_model)); 01687 extern HAMLIB_EXPORT(int) rig_list_foreach HAMLIB_PARAMS((int (*cfunc)(const struct rig_caps*, rig_ptr_t), rig_ptr_t data)); 01688 extern HAMLIB_EXPORT(int) rig_load_backend HAMLIB_PARAMS((const char *be_name)); 01689 extern HAMLIB_EXPORT(int) rig_check_backend HAMLIB_PARAMS((rig_model_t rig_model)); 01690 extern HAMLIB_EXPORT(int) rig_load_all_backends HAMLIB_PARAMS((void)); 01691 01692 typedef int (*rig_probe_func_t)(const hamlib_port_t *, rig_model_t, rig_ptr_t); 01693 extern HAMLIB_EXPORT(int) rig_probe_all HAMLIB_PARAMS((hamlib_port_t *p, rig_probe_func_t, rig_ptr_t)); 01694 extern HAMLIB_EXPORT(rig_model_t) rig_probe HAMLIB_PARAMS((hamlib_port_t *p)); 01695 01696 01697 /* Misc calls */ 01698 extern HAMLIB_EXPORT(const char *) rig_strrmode(rmode_t mode); 01699 extern HAMLIB_EXPORT(const char *) rig_strvfo(vfo_t vfo); 01700 extern HAMLIB_EXPORT(const char *) rig_strfunc(setting_t); 01701 extern HAMLIB_EXPORT(const char *) rig_strlevel(setting_t); 01702 extern HAMLIB_EXPORT(const char *) rig_strparm(setting_t); 01703 extern HAMLIB_EXPORT(const char *) rig_strptrshift(rptr_shift_t); 01704 extern HAMLIB_EXPORT(const char *) rig_strvfop(vfo_op_t op); 01705 extern HAMLIB_EXPORT(const char *) rig_strscan(scan_t scan); 01706 extern HAMLIB_EXPORT(const char *) rig_strstatus(enum rig_status_e status); 01707 extern HAMLIB_EXPORT(const char *) rig_strmtype(chan_type_t mtype); 01708 01709 extern HAMLIB_EXPORT(rmode_t) rig_parse_mode(const char *s); 01710 extern HAMLIB_EXPORT(vfo_t) rig_parse_vfo(const char *s); 01711 extern HAMLIB_EXPORT(setting_t) rig_parse_func(const char *s); 01712 extern HAMLIB_EXPORT(setting_t) rig_parse_level(const char *s); 01713 extern HAMLIB_EXPORT(setting_t) rig_parse_parm(const char *s); 01714 extern HAMLIB_EXPORT(vfo_op_t) rig_parse_vfo_op(const char *s); 01715 extern HAMLIB_EXPORT(scan_t) rig_parse_scan(const char *s); 01716 extern HAMLIB_EXPORT(rptr_shift_t) rig_parse_rptr_shift(const char *s); 01717 extern HAMLIB_EXPORT(chan_type_t) rig_parse_mtype(const char *s); 01718 01719 01720 __END_DECLS 01721 01722 #endif /* _RIG_H */ 01723
Hamlib documentation for version 1.2.15 -- Thu Feb 2 2012 21:37:28
Project page: http://www.hamlib.org