kopia lustrzana https://github.com/Hamlib/Hamlib
Added PRO-2052, big improvement of uniden backend
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2341 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.8
rodzic
e3d772a8b5
commit
bd0bf5112b
|
@ -1,4 +1,4 @@
|
|||
UNIDENSRC = bc895.c bc245.c
|
||||
UNIDENSRC = bc895.c bc245.c pro2052.c
|
||||
|
||||
lib_LTLIBRARIES = hamlib-uniden.la
|
||||
hamlib_uniden_la_SOURCES = $(UNIDENSRC) uniden.c
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Hamlib Uniden backend - BC245 description
|
||||
* Copyright (c) 2001-2004 by Stephane Fillod
|
||||
* Copyright (c) 2001-2008 by Stephane Fillod
|
||||
*
|
||||
* $Id: bc245.c,v 1.2 2005-04-03 20:23:19 fillods Exp $
|
||||
* $Id: bc245.c,v 1.3 2008-05-04 14:23:54 fillods Exp $
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
|
@ -32,9 +32,9 @@
|
|||
|
||||
#define BC245_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM)
|
||||
|
||||
#define BC245_FUNC (RIG_FUNC_SQL)
|
||||
#define BC245_FUNC (RIG_FUNC_MUTE)
|
||||
|
||||
#define BC245_LEVEL_ALL (RIG_LEVEL_NONE)
|
||||
#define BC245_LEVEL_ALL (RIG_LEVEL_ATT)
|
||||
|
||||
#define BC245_PARM_ALL (RIG_PARM_NONE)
|
||||
|
||||
|
@ -54,10 +54,10 @@ const struct rig_caps bc245_caps = {
|
|||
.status = RIG_STATUS_UNTESTED,
|
||||
.rig_type = RIG_TYPE_TRUNKSCANNER,
|
||||
.ptt_type = RIG_PTT_NONE,
|
||||
.dcd_type = RIG_DCD_NONE,
|
||||
.dcd_type = RIG_DCD_RIG,
|
||||
.port_type = RIG_PORT_SERIAL,
|
||||
.serial_rate_min = 9600,
|
||||
.serial_rate_max = 9600,
|
||||
.serial_rate_min = 2400,
|
||||
.serial_rate_max = 19200,
|
||||
.serial_data_bits = 8,
|
||||
.serial_stop_bits = 1,
|
||||
.serial_parity = RIG_PARITY_NONE,
|
||||
|
@ -115,7 +115,17 @@ const struct rig_caps bc245_caps = {
|
|||
.priv = NULL,
|
||||
|
||||
.set_freq = uniden_set_freq,
|
||||
.get_freq = uniden_get_freq,
|
||||
.set_mode = uniden_set_mode,
|
||||
.get_mode = uniden_get_mode,
|
||||
.set_mem = uniden_set_mem,
|
||||
.get_mem = uniden_get_mem,
|
||||
.get_dcd = uniden_get_dcd,
|
||||
.get_info = uniden_get_info,
|
||||
.get_level = uniden_get_level,
|
||||
.set_level = uniden_set_level,
|
||||
.get_channel = uniden_get_channel,
|
||||
.set_channel = uniden_set_channel,
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Hamlib Uniden backend - BC895 description
|
||||
* Copyright (c) 2001-2003 by Stephane Fillod
|
||||
* Copyright (c) 2001-2008 by Stephane Fillod
|
||||
*
|
||||
* $Id: bc895.c,v 1.5 2005-04-03 20:23:19 fillods Exp $
|
||||
* $Id: bc895.c,v 1.6 2008-05-04 14:23:54 fillods Exp $
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
|
@ -32,14 +32,29 @@
|
|||
|
||||
#define BC895_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM)
|
||||
|
||||
#define BC895_FUNC (RIG_FUNC_SQL)
|
||||
#define BC895_FUNC (RIG_FUNC_MUTE)
|
||||
|
||||
#define BC895_LEVEL_ALL (RIG_LEVEL_NONE)
|
||||
#define BC895_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_RAWSTR)
|
||||
|
||||
#define BC895_PARM_ALL (RIG_PARM_NONE)
|
||||
|
||||
#define BC895_VFO RIG_VFO_A
|
||||
|
||||
#define BC895_CHANNEL_CAPS \
|
||||
UNIDEN_CHANNEL_CAPS \
|
||||
.ctcss_sql=1, \
|
||||
.dcs_sql=1
|
||||
|
||||
/* The BC895 seems to max out at 32 while 12 seems to be about minimum. */
|
||||
#define BC895_STR_CAL { 4, \
|
||||
{ \
|
||||
{ 0, -54 }, \
|
||||
{ 12, -20 }, /* TBC */ \
|
||||
{ 32, 4 }, /* TBC */ \
|
||||
{ 255, 60 }, \
|
||||
} }
|
||||
|
||||
|
||||
/*
|
||||
* bc895 rig capabilities.
|
||||
*
|
||||
|
@ -54,9 +69,9 @@ const struct rig_caps bc895_caps = {
|
|||
.status = RIG_STATUS_UNTESTED,
|
||||
.rig_type = RIG_TYPE_TRUNKSCANNER,
|
||||
.ptt_type = RIG_PTT_NONE,
|
||||
.dcd_type = RIG_DCD_NONE,
|
||||
.dcd_type = RIG_DCD_RIG,
|
||||
.port_type = RIG_PORT_SERIAL,
|
||||
.serial_rate_min = 9600,
|
||||
.serial_rate_min = 2400,
|
||||
.serial_rate_max = 9600,
|
||||
.serial_data_bits = 8,
|
||||
.serial_stop_bits = 1,
|
||||
|
@ -75,8 +90,8 @@ const struct rig_caps bc895_caps = {
|
|||
.has_set_parm = RIG_PARM_SET(BC895_PARM_ALL),
|
||||
.level_gran = {}, /* FIXME: granularity */
|
||||
.parm_gran = {},
|
||||
.ctcss_list = NULL, /* FIXME: CTCSS list? */
|
||||
.dcs_list = NULL,
|
||||
.ctcss_list = uniden_ctcss_list,
|
||||
.dcs_list = uniden_dcs_list,
|
||||
.preamp = { RIG_DBLST_END },
|
||||
.attenuator = { RIG_DBLST_END },
|
||||
.max_rit = Hz(0),
|
||||
|
@ -84,11 +99,12 @@ const struct rig_caps bc895_caps = {
|
|||
.max_ifshift = Hz(0),
|
||||
.targetable_vfo = 0,
|
||||
.transceive = RIG_TRN_OFF,
|
||||
.bank_qty = 0,
|
||||
.bank_qty = 10, /* A..J */
|
||||
.chan_desc_sz = 0,
|
||||
.str_cal = BC895_STR_CAL,
|
||||
|
||||
.chan_list = {
|
||||
{ 1, 300, RIG_MTYPE_MEM },
|
||||
{ 1, 300, RIG_MTYPE_MEM, {BC895_CHANNEL_CAPS} },
|
||||
RIG_CHAN_END,
|
||||
},
|
||||
|
||||
|
@ -100,7 +116,13 @@ const struct rig_caps bc895_caps = {
|
|||
},
|
||||
.tx_range_list2 = { RIG_FRNG_END, },
|
||||
.tuning_steps = {
|
||||
{BC895_MODES,10}, /* FIXME: add other ts */
|
||||
{BC895_MODES,kHz(5)},
|
||||
{BC895_MODES,kHz(7.5)},
|
||||
{BC895_MODES,kHz(10)},
|
||||
{BC895_MODES,kHz(12.5)},
|
||||
{BC895_MODES,kHz(25)},
|
||||
{BC895_MODES,kHz(50)},
|
||||
RIG_TS_END,
|
||||
RIG_TS_END,
|
||||
},
|
||||
/* mode/filter list, remember: order matters! */
|
||||
|
@ -112,7 +134,18 @@ const struct rig_caps bc895_caps = {
|
|||
.priv = NULL,
|
||||
|
||||
.set_freq = uniden_set_freq,
|
||||
.get_freq = uniden_get_freq,
|
||||
.set_mode = uniden_set_mode,
|
||||
.get_mode = uniden_get_mode,
|
||||
.set_mem = uniden_set_mem,
|
||||
.get_mem = uniden_get_mem,
|
||||
.get_dcd = uniden_get_dcd,
|
||||
.get_info = uniden_get_info,
|
||||
.get_level = uniden_get_level,
|
||||
.set_level = uniden_set_level,
|
||||
.get_channel = uniden_get_channel,
|
||||
.set_channel = uniden_set_channel,
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* Hamlib Uniden backend - Radio Shack PRO-2052 description
|
||||
* Copyright (c) 2001-2008 by Stephane Fillod
|
||||
*
|
||||
* $Id: pro2052.c,v 1.1 2008-05-04 14:23:54 fillods Exp $
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <hamlib/rig.h>
|
||||
#include "uniden.h"
|
||||
|
||||
|
||||
#define PRO2052_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM)
|
||||
|
||||
#define PRO2052_FUNC (RIG_FUNC_MUTE)
|
||||
|
||||
#define PRO2052_LEVEL_ALL (RIG_LEVEL_NONE)
|
||||
|
||||
#define PRO2052_PARM_ALL (RIG_PARM_NONE)
|
||||
|
||||
#define PRO2052_VFO RIG_VFO_A
|
||||
|
||||
#define PRO2052_CHANNEL_CAPS \
|
||||
UNIDEN_CHANNEL_CAPS
|
||||
|
||||
/*
|
||||
* PRO-2052 rig capabilities.
|
||||
*
|
||||
* From http://www.cantonmaine.com/pro2052.htm:
|
||||
* After connecting the cable, turn on the computer and the scanner and then
|
||||
* press and hold the Remote/Hold button on the scanner until you see "SFT"
|
||||
* flashing on the right side of the LCD. You should now be communicating
|
||||
* with the scanner. If it doesn't work, check all the normal stuff for
|
||||
* whatever it was you overlooked. NOTE: You can change the scanner's
|
||||
* default * baud rate by holding down the Remote/Hold button while turning
|
||||
* on the scanner.)
|
||||
*
|
||||
* TODO: check this with manual or web site.
|
||||
*/
|
||||
const struct rig_caps pro2052_caps = {
|
||||
.rig_model = RIG_MODEL_PRO2052,
|
||||
.model_name = "PRO-2052",
|
||||
.mfg_name = "Radio Shack",
|
||||
.version = BACKEND_VER,
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_UNTESTED,
|
||||
.rig_type = RIG_TYPE_TRUNKSCANNER,
|
||||
.ptt_type = RIG_PTT_NONE,
|
||||
.dcd_type = RIG_DCD_RIG,
|
||||
.port_type = RIG_PORT_SERIAL,
|
||||
.serial_rate_min = 2400,
|
||||
.serial_rate_max = 19200,
|
||||
.serial_data_bits = 8,
|
||||
.serial_stop_bits = 1,
|
||||
.serial_parity = RIG_PARITY_NONE,
|
||||
.serial_handshake = RIG_HANDSHAKE_NONE,
|
||||
.write_delay = 0,
|
||||
.post_write_delay = 1,
|
||||
.timeout = 200,
|
||||
.retry = 3,
|
||||
|
||||
.has_get_func = PRO2052_FUNC,
|
||||
.has_set_func = PRO2052_FUNC,
|
||||
.has_get_level = PRO2052_LEVEL_ALL,
|
||||
.has_set_level = RIG_LEVEL_SET(PRO2052_LEVEL_ALL),
|
||||
.has_get_parm = PRO2052_PARM_ALL,
|
||||
.has_set_parm = RIG_PARM_SET(PRO2052_PARM_ALL),
|
||||
.level_gran = {}, /* FIXME: granularity */
|
||||
.parm_gran = {},
|
||||
.ctcss_list = NULL, /* FIXME: CTCSS list? */
|
||||
.dcs_list = NULL,
|
||||
.preamp = { RIG_DBLST_END },
|
||||
.attenuator = { RIG_DBLST_END },
|
||||
.max_rit = Hz(0),
|
||||
.max_xit = Hz(0),
|
||||
.max_ifshift = Hz(0),
|
||||
.targetable_vfo = 0,
|
||||
.transceive = RIG_TRN_OFF,
|
||||
.bank_qty = 10, /* A..J */
|
||||
.chan_desc_sz = 0,
|
||||
|
||||
.chan_list = {
|
||||
{ 0, 999, RIG_MTYPE_MEM, {PRO2052_CHANNEL_CAPS} },
|
||||
RIG_CHAN_END,
|
||||
},
|
||||
|
||||
.rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */
|
||||
.tx_range_list1 = { RIG_FRNG_END, },
|
||||
|
||||
.rx_range_list2 = {
|
||||
{MHz(29),MHz(54),PRO2052_MODES,-1,-1,PRO2052_VFO},
|
||||
{MHz(108),MHz(174),PRO2052_MODES,-1,-1,PRO2052_VFO},
|
||||
{MHz(179.75),MHz(512),PRO2052_MODES,-1,-1,PRO2052_VFO},
|
||||
{MHz(806),MHz(823.9375),PRO2052_MODES,-1,-1,PRO2052_VFO},
|
||||
{MHz(851),MHz(868.9875),PRO2052_MODES,-1,-1,PRO2052_VFO},
|
||||
{MHz(896.1125),MHz(956),PRO2052_MODES,-1,-1,PRO2052_VFO},
|
||||
{MHz(1240),MHz(1300),PRO2052_MODES,-1,-1,PRO2052_VFO},
|
||||
RIG_FRNG_END,
|
||||
},
|
||||
.tx_range_list2 = { RIG_FRNG_END, },
|
||||
|
||||
.tuning_steps = {
|
||||
{PRO2052_MODES,kHz(5)},
|
||||
{PRO2052_MODES,kHz(7.5)},
|
||||
{PRO2052_MODES,kHz(10)},
|
||||
{PRO2052_MODES,kHz(12.5)},
|
||||
{PRO2052_MODES,kHz(25)},
|
||||
{PRO2052_MODES,kHz(50)},
|
||||
RIG_TS_END,
|
||||
},
|
||||
/* mode/filter list, remember: order matters! */
|
||||
.filters = {
|
||||
{RIG_MODE_AM|RIG_MODE_FM, kHz(8)},
|
||||
{RIG_MODE_WFM, kHz(230)},
|
||||
RIG_FLT_END,
|
||||
},
|
||||
.priv = NULL,
|
||||
|
||||
.set_freq = uniden_set_freq,
|
||||
.get_freq = uniden_get_freq,
|
||||
.set_mode = uniden_set_mode,
|
||||
.get_mode = uniden_get_mode,
|
||||
.set_mem = uniden_set_mem,
|
||||
.get_mem = uniden_get_mem,
|
||||
.get_dcd = uniden_get_dcd,
|
||||
.get_info = uniden_get_info,
|
||||
.get_level = uniden_get_level,
|
||||
.set_level = uniden_set_level,
|
||||
.get_channel = uniden_get_channel,
|
||||
.set_channel = uniden_set_channel,
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Function definitions below
|
||||
*/
|
||||
|
666
uniden/uniden.c
666
uniden/uniden.c
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Hamlib Uniden backend - main file
|
||||
* Copyright (c) 2001-2005 by Stephane Fillod
|
||||
* Copyright (c) 2001-2008 by Stephane Fillod
|
||||
*
|
||||
* $Id: uniden.c,v 1.11 2005-04-10 21:47:14 fillods Exp $
|
||||
* $Id: uniden.c,v 1.12 2008-05-04 14:23:54 fillods Exp $
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
|
@ -34,54 +34,196 @@
|
|||
#include "serial.h"
|
||||
#include "misc.h"
|
||||
#include "register.h"
|
||||
#include "idx_builtin.h"
|
||||
|
||||
#include "uniden.h"
|
||||
|
||||
|
||||
static const struct { rig_model_t model; const char *id; }
|
||||
uniden_id_string_list[] = {
|
||||
{ RIG_MODEL_BC780, "BC780" },
|
||||
{ RIG_MODEL_BC245, "BC245XLT" },
|
||||
{ RIG_MODEL_BC250, "BC250D" },
|
||||
{ RIG_MODEL_BC895, "BC895" },
|
||||
{ RIG_MODEL_BC235, "BC235XLT" },
|
||||
{ RIG_MODEL_BC785, "BC785" },
|
||||
{ RIG_MODEL_BC786, "BC786D" },
|
||||
{ RIG_MODEL_PRO2052,"PRO2052" }, /* ?? */
|
||||
{ RIG_MODEL_BCT8, "BCT8" }, /* ?? */
|
||||
{ RIG_MODEL_NONE, NULL }, /* end marker */
|
||||
};
|
||||
|
||||
|
||||
const tone_t uniden_ctcss_list[] = {
|
||||
670, 719, 744, 770, 797, 825, 854, 885, 915,
|
||||
948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230,
|
||||
1273, 1318, 1365, 1413, 1462, 1514, 1567, 1622, 1679,
|
||||
1738, 1799, 1862, 1928, 2035, 2107, 2181, 2257, 2336,
|
||||
2418, 2503
|
||||
};
|
||||
|
||||
const tone_t uniden_dcs_list[] = {
|
||||
23, 25, 26, 31, 32, 36, 43, 47, 51, 53,
|
||||
54, 65, 71, 72, 73, 74, 114, 115, 116, 122,
|
||||
125, 131, 132, 134, 143, 145, 152, 155, 156, 162,
|
||||
165, 172, 174, 205, 212, 223, 225, 226, 243, 244,
|
||||
245, 246, 251, 252, 255, 261, 263, 265, 266, 271,
|
||||
274, 306, 311, 315, 325, 331, 332, 343, 346, 351,
|
||||
356, 364, 365, 371, 411, 412, 413, 423, 431, 432,
|
||||
445, 446, 452, 454, 455, 462, 464, 465, 466, 503,
|
||||
506, 516, 523, 526, 532, 546, 565, 606, 612, 624,
|
||||
627, 631, 632, 654, 662, 664, 703, 712, 723, 731,
|
||||
732, 734, 743, 754
|
||||
};
|
||||
|
||||
/*
|
||||
* Uniden backend: should work for BC895xlt, also for BC235xlt
|
||||
* and most probably for the RadioShack PRO-2042, which is RadioShack's
|
||||
* version of the Uniden BC235xlt.
|
||||
* Protocol information available at http://www.cantonmaine.com/pro2052.htm
|
||||
* Uniden backend: should work for:
|
||||
* BC235XLT, BC895XLT, BC245XLT, BC780XLT, BC250D, BC785D and BCT8
|
||||
* and most probably for the RadioShack PRO-2052.
|
||||
*
|
||||
* It seems like this rig has no VFO, I mean only mem channels.
|
||||
* Protocol information available at http://www.cantonmaine.com/pro2052.htm
|
||||
* and http://www.freqofnature.com/software/protocols.html
|
||||
*
|
||||
* It seems like these rigs have no VFO, I mean only mem channels.
|
||||
* Is that correct? --SF
|
||||
*/
|
||||
|
||||
#define EOM "\r"
|
||||
|
||||
#define BUFSZ 32
|
||||
#define BUFSZ 64
|
||||
|
||||
/*
|
||||
/**
|
||||
* uniden_transaction
|
||||
* We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL
|
||||
* Otherwise, you'll get a nice seg fault. You've been warned!
|
||||
* Assumes rig!=NULL rig->state!=NULL rig->caps!=NULL
|
||||
*
|
||||
* cmdstr - Command to be sent to the rig. Cmdstr can also be NULL, indicating
|
||||
* that only a reply is needed (nothing will be send).
|
||||
* replystr - Reply prefix to be expected. Replystr can also be NULL, indicating
|
||||
* that the prefix is either the cmdstr prefix or OK.
|
||||
* data - Buffer for reply string. Can be NULL, indicating that no reply is
|
||||
* is needed and will return with RIG_OK after command was sent.
|
||||
* datasize - in: Size of buffer. It is the caller's responsibily to provide
|
||||
* a large enough buffer for all possible replies for a command.
|
||||
* out: location where to store number of bytes read.
|
||||
*
|
||||
* returns:
|
||||
* RIG_OK - if no error occured.
|
||||
* RIG_EIO - if an I/O error occured while sending/receiving data.
|
||||
* RIG_ETIMEOUT - if timeout expires without any characters received.
|
||||
* RIG_REJECTED - if a negative acknowledge was received or command not
|
||||
* recognized by rig.
|
||||
*/
|
||||
static int uniden_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len)
|
||||
int
|
||||
uniden_transaction (RIG *rig, const char *cmdstr, int cmd_len, const char *replystr,
|
||||
char *data, size_t *datasize)
|
||||
{
|
||||
int retval;
|
||||
struct rig_state *rs;
|
||||
struct rig_state *rs;
|
||||
int retval;
|
||||
int retry_read = 0;
|
||||
char replybuf[BUFSZ];
|
||||
size_t reply_len=BUFSZ;
|
||||
|
||||
rs = &rig->state;
|
||||
rs = &rig->state;
|
||||
rs->hold_decode = 1;
|
||||
|
||||
serial_flush(&rs->rigport);
|
||||
transaction_write:
|
||||
|
||||
retval = write_block(&rs->rigport, cmd, cmd_len);
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
serial_flush(&rs->rigport);
|
||||
|
||||
if (cmdstr) {
|
||||
retval = write_block(&rs->rigport, cmdstr, strlen(cmdstr));
|
||||
if (retval != RIG_OK)
|
||||
goto transaction_quit;
|
||||
}
|
||||
|
||||
/* no data expected, TODO: flush input? */
|
||||
if (!data || !data_len)
|
||||
return 0;
|
||||
/* Always read the reply to known if it went OK */
|
||||
if (!data)
|
||||
data = replybuf;
|
||||
if (!datasize)
|
||||
datasize = &reply_len;
|
||||
|
||||
retval = read_string(&rs->rigport, data, BUFSZ, "\x0a", 1);
|
||||
if (retval == -RIG_ETIMEOUT)
|
||||
retval = 0;
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
*data_len = retval;
|
||||
memset(data,0,*datasize);
|
||||
retval = read_string(&rs->rigport, data, *datasize, EOM, strlen(EOM));
|
||||
if (retval < 0) {
|
||||
if (retry_read++ < rig->state.rigport.retry)
|
||||
goto transaction_write;
|
||||
goto transaction_quit;
|
||||
} else
|
||||
*datasize = retval;
|
||||
|
||||
return RIG_OK;
|
||||
/* Check that command termination is correct */
|
||||
if (strchr(EOM, data[strlen(data)-1])==NULL) {
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __FUNCTION__, data);
|
||||
if (retry_read++ < rig->state.rigport.retry)
|
||||
goto transaction_write;
|
||||
retval = -RIG_EPROTO;
|
||||
goto transaction_quit;
|
||||
}
|
||||
|
||||
if (strcmp(data, "OK"EOM)) {
|
||||
/* everything is fine */
|
||||
retval = RIG_OK;
|
||||
goto transaction_quit;
|
||||
}
|
||||
|
||||
/* Any syntax returning NG indicates a VALID Command but not entered
|
||||
* in the right mode or using the correct parameters. ERR indicates
|
||||
* an INVALID Command.
|
||||
*/
|
||||
if (strcmp(data, "NG"EOM) || strcmp(data, "ORER"EOM)) {
|
||||
/* Invalid command */
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: NG/Overflow for '%s'\n", __FUNCTION__, cmdstr);
|
||||
retval = -RIG_EPROTO;
|
||||
goto transaction_quit;
|
||||
}
|
||||
|
||||
if (strcmp(data, "ERR"EOM)) {
|
||||
/* Command format error */
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: Error for '%s'\n", __FUNCTION__, cmdstr);
|
||||
retval = -RIG_EINVAL;
|
||||
goto transaction_quit;
|
||||
}
|
||||
|
||||
#define CONFIG_STRIP_CMDTRM 1
|
||||
#ifdef CONFIG_STRIP_CMDTRM
|
||||
if (strlen(data) > 0)
|
||||
data[strlen(data)-1] = '\0'; /* not very elegant, but should work. */
|
||||
else
|
||||
data[0] = '\0';
|
||||
#endif
|
||||
|
||||
/* Special case for SQuelch */
|
||||
if (!memcmp(cmdstr,"SQ",2) && (replystr[0] == '-' || replystr[0] == '+')) {
|
||||
retval = RIG_OK;
|
||||
goto transaction_quit;
|
||||
}
|
||||
|
||||
/* Command prefix if no replystr supplied */
|
||||
if (!replystr)
|
||||
replystr = cmdstr;
|
||||
/*
|
||||
* Check that received the correct reply. The first two characters
|
||||
* should be the same as command.
|
||||
*/
|
||||
if (replystr && replystr[0] && (data[0] != replystr[0] ||
|
||||
(replystr[1] && data[1] != replystr[1]))) {
|
||||
/*
|
||||
* TODO: When RIG_TRN is enabled, we can pass the string
|
||||
* to the decoder for callback. That way we don't ignore
|
||||
* any commands.
|
||||
*/
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __FUNCTION__, data);
|
||||
if (retry_read++ < rig->state.rigport.retry)
|
||||
goto transaction_write;
|
||||
|
||||
retval = -RIG_EPROTO;
|
||||
goto transaction_quit;
|
||||
}
|
||||
|
||||
retval = RIG_OK;
|
||||
transaction_quit:
|
||||
rs->hold_decode = 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -90,17 +232,193 @@ static int uniden_transaction(RIG *rig, const char *cmd, int cmd_len, char *data
|
|||
*/
|
||||
int uniden_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
char freqbuf[BUFSZ];
|
||||
int freq_len;
|
||||
char freqbuf[BUFSZ];
|
||||
size_t freq_len=BUFSZ;
|
||||
|
||||
/* max 8 digits */
|
||||
if (freq >= GHz(1))
|
||||
return -RIG_EINVAL;
|
||||
/* freq in hundreds of Hz */
|
||||
freq /= 100;
|
||||
|
||||
/* exactly 8 digits */
|
||||
freq_len = sprintf(freqbuf, "RF%08"PRIll EOM, (long long)freq);
|
||||
/* exactly 8 digits */
|
||||
freq_len = sprintf(freqbuf, "RF%08u" EOM, (unsigned)freq);
|
||||
|
||||
return uniden_transaction (rig, freqbuf, freq_len, NULL, NULL);
|
||||
return uniden_transaction (rig, freqbuf, freq_len, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* uniden_get_freq
|
||||
* Assumes rig!=NULL
|
||||
*/
|
||||
int uniden_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
char freqbuf[BUFSZ];
|
||||
size_t freq_len=BUFSZ;
|
||||
int ret;
|
||||
|
||||
ret = uniden_transaction (rig, "RF" EOM, 3, NULL, freqbuf, &freq_len);
|
||||
if (ret != RIG_OK)
|
||||
return ret;
|
||||
|
||||
if (freq_len < 10)
|
||||
return -RIG_EPROTO;
|
||||
|
||||
sscanf(freqbuf+2, "%"SCNfreq, freq);
|
||||
/* returned freq in hundreds of Hz */
|
||||
*freq *= 100;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
int uniden_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
{
|
||||
const char *modebuf;
|
||||
|
||||
switch (mode) {
|
||||
case RIG_MODE_AM:
|
||||
modebuf = "RM AM"EOM;
|
||||
break;
|
||||
case RIG_MODE_FM:
|
||||
if (width > 0 && width < rig_passband_normal(rig, mode))
|
||||
modebuf = "RM NFM"EOM;
|
||||
else
|
||||
modebuf = "RM FM"EOM;
|
||||
break;
|
||||
case RIG_MODE_WFM:
|
||||
modebuf = "RM WFM"EOM;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
return uniden_transaction (rig, modebuf, strlen(modebuf), NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
int uniden_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
||||
{
|
||||
char modebuf[BUFSZ];
|
||||
size_t mode_len=BUFSZ;
|
||||
int ret;
|
||||
|
||||
ret = uniden_transaction (rig, "RM" EOM, 3, NULL, modebuf, &mode_len);
|
||||
if (ret != RIG_OK)
|
||||
return ret;
|
||||
|
||||
if (mode_len < 4)
|
||||
return -RIG_EPROTO;
|
||||
|
||||
*width = 0;
|
||||
if (!strcmp(modebuf+3, "AM"))
|
||||
*mode = RIG_MODE_AM;
|
||||
else if (!strcmp(modebuf+3, "WFM"))
|
||||
*mode = RIG_MODE_AM;
|
||||
else if (!strcmp(modebuf+3, "FM"))
|
||||
*mode = RIG_MODE_FM;
|
||||
else if (!strcmp(modebuf+3, "NFM")) {
|
||||
*mode = RIG_MODE_FM;
|
||||
*width = rig_passband_narrow(rig, RIG_MODE_FM);
|
||||
}
|
||||
|
||||
if (*width == 0)
|
||||
*width = rig_passband_normal(rig, *mode);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
int uniden_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
||||
{
|
||||
char levelbuf[16];
|
||||
size_t level_len=16;
|
||||
int retval;
|
||||
|
||||
switch (level) {
|
||||
case RIG_LEVEL_ATT:
|
||||
if (rig->state.attenuator[0] == 0)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
level_len = sprintf(levelbuf, "AT%c"EOM,
|
||||
val.i != 0 ? 'N':'F');
|
||||
break;
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"Unsupported set_level %d", level);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
retval = uniden_transaction (rig, levelbuf, level_len, NULL, NULL, NULL);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* uniden_get_level
|
||||
* Assumes rig!=NULL, val!=NULL
|
||||
*/
|
||||
int uniden_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||
{
|
||||
char lvlbuf[BUFSZ];
|
||||
int retval;
|
||||
size_t lvl_len=BUFSZ;
|
||||
|
||||
switch (level) {
|
||||
case RIG_LEVEL_RAWSTR:
|
||||
retval = uniden_transaction (rig, "SG"EOM, 3, "S", lvlbuf, &lvl_len);
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
|
||||
if (lvl_len < 4) {
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: wrong answer len=%d\n",
|
||||
__FUNCTION__, lvl_len);
|
||||
return -RIG_ERJCTED;
|
||||
}
|
||||
|
||||
/* S182 F08594375 */
|
||||
sscanf(lvlbuf+1, "%d", &val->i); /* rawstr */
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_ATT:
|
||||
retval = uniden_transaction (rig, "AT"EOM, 3, NULL, lvlbuf, &lvl_len);
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
|
||||
if (lvl_len < 3) {
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer len=%d\n",
|
||||
__FUNCTION__, lvl_len);
|
||||
return -RIG_ERJCTED;
|
||||
}
|
||||
|
||||
val->i = lvlbuf[2] == 'N' ? rig->state.attenuator[0] : 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d", level);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* uniden_get_dcd
|
||||
* Assumes rig!=NULL
|
||||
*/
|
||||
int uniden_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
|
||||
{
|
||||
char dcdbuf[BUFSZ];
|
||||
size_t dcd_len=BUFSZ;
|
||||
int ret;
|
||||
|
||||
ret = uniden_transaction (rig, "SQ" EOM, 3, NULL, dcdbuf, &dcd_len);
|
||||
if (ret != RIG_OK)
|
||||
return ret;
|
||||
|
||||
if (dcd_len < 1 || (dcdbuf[0] != '+' && dcdbuf[0] != '-'))
|
||||
return -RIG_EPROTO;
|
||||
|
||||
*dcd = (dcdbuf[0] == '-') ? RIG_DCD_OFF : RIG_DCD_ON;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -109,12 +427,266 @@ int uniden_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
*/
|
||||
int uniden_set_mem(RIG *rig, vfo_t vfo, int ch)
|
||||
{
|
||||
char cmdbuf[BUFSZ];
|
||||
int cmd_len;
|
||||
char cmdbuf[BUFSZ];
|
||||
size_t cmd_len=BUFSZ;
|
||||
|
||||
cmd_len = sprintf(cmdbuf, "MA%03d" EOM, ch);
|
||||
cmd_len = sprintf(cmdbuf, "MA%03d" EOM, ch);
|
||||
|
||||
return uniden_transaction (rig, cmdbuf, cmd_len, NULL, NULL);
|
||||
return uniden_transaction (rig, cmdbuf, cmd_len, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* uniden_get_mem
|
||||
* Assumes rig!=NULL
|
||||
*/
|
||||
int uniden_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
||||
{
|
||||
char membuf[BUFSZ];
|
||||
size_t mem_len=BUFSZ;
|
||||
int ret;
|
||||
|
||||
ret = uniden_transaction (rig, "MA" EOM, 3, "C", membuf, &mem_len);
|
||||
if (ret != RIG_OK)
|
||||
return ret;
|
||||
|
||||
if (mem_len < 4)
|
||||
return -RIG_EPROTO;
|
||||
|
||||
sscanf(membuf+1, "%d", ch);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* uniden_get_channel
|
||||
* Assumes rig!=NULL
|
||||
*/
|
||||
int uniden_get_channel(RIG *rig, channel_t *chan)
|
||||
{
|
||||
char cmdbuf[BUFSZ], membuf[BUFSZ];
|
||||
size_t cmd_len=BUFSZ,mem_len=BUFSZ;
|
||||
int ret;
|
||||
int tone;
|
||||
|
||||
if (chan->vfo == RIG_VFO_MEM)
|
||||
cmd_len = sprintf(cmdbuf, "PM%03d" EOM, chan->channel_num);
|
||||
else
|
||||
cmd_len = sprintf(cmdbuf, "MA" EOM);
|
||||
|
||||
ret = uniden_transaction (rig, cmdbuf, cmd_len, "C", membuf, &mem_len);
|
||||
if (ret != RIG_OK)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* 0123456789012345678901234567890123456789
|
||||
* C089 F08511625 TN DN LF AF RF N000
|
||||
*/
|
||||
if (mem_len < 30 ||
|
||||
membuf[5] != 'F' ||
|
||||
membuf[25] != 'T' ||
|
||||
membuf[28] != 'D' ||
|
||||
membuf[31] != 'L' ||
|
||||
membuf[34] != 'A' ||
|
||||
membuf[37] != 'R' ||
|
||||
membuf[40] != 'N')
|
||||
return -RIG_EPROTO;
|
||||
|
||||
sscanf(membuf+1, "%d", &chan->channel_num);
|
||||
sscanf(membuf+6, "%"SCNfreq, &chan->freq);
|
||||
/* returned freq in hundreds of Hz */
|
||||
chan->freq *= 100;
|
||||
|
||||
/* TODO: Trunk, Delay, Recording */
|
||||
|
||||
chan->flags = (membuf[22] == 'N') ? RIG_CHFLAG_SKIP : 0;
|
||||
chan->levels[LVL_ATT].i = (membuf[25] == 'N') ? rig->state.attenuator[0] : 0;
|
||||
sscanf(membuf+41, "%d", &tone);
|
||||
if (tone >= 1 && tone <= 38)
|
||||
chan->ctcss_sql = rig->caps->ctcss_list[tone-1]; /* 1..38 */
|
||||
else if (tone > 38)
|
||||
chan->dcs_sql = rig->caps->dcs_list[tone-39]; /* 39..142 */
|
||||
|
||||
if (chan->vfo == RIG_VFO_MEM && rig->caps->chan_desc_sz != 0)
|
||||
{
|
||||
/* only BC780 BC250 BC785 */
|
||||
cmd_len = sprintf(cmdbuf, "TA C %03d" EOM, chan->channel_num);
|
||||
|
||||
ret = uniden_transaction (rig, cmdbuf, cmd_len, NULL, membuf, &mem_len);
|
||||
if (ret != RIG_OK)
|
||||
return ret;
|
||||
if (mem_len < 10 || memcmp(membuf, cmdbuf, 8))
|
||||
return -RIG_EPROTO;
|
||||
/* TA C 001 My Alpha Tag */
|
||||
strncpy(chan->channel_desc, membuf+9, rig->caps->chan_desc_sz);
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* uniden_set_channel
|
||||
*
|
||||
* Only freq can be set?
|
||||
*/
|
||||
int uniden_set_channel(RIG *rig, const channel_t *chan)
|
||||
{
|
||||
char cmdbuf[BUFSZ], membuf[BUFSZ];
|
||||
size_t cmd_len=BUFSZ,mem_len=BUFSZ;
|
||||
int ret;
|
||||
int trunked = 0;
|
||||
|
||||
if (chan->vfo != RIG_VFO_MEM)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
/* PM089T08511625 */
|
||||
cmd_len = sprintf(cmdbuf, "PM%03d%c%08u" EOM, chan->channel_num,
|
||||
trunked ? 'T' : ' ',
|
||||
(unsigned)(chan->freq / 100));
|
||||
|
||||
ret = uniden_transaction (rig, cmdbuf, cmd_len, NULL, membuf, &mem_len);
|
||||
if (ret != RIG_OK)
|
||||
return ret;
|
||||
|
||||
if (chan->vfo == RIG_VFO_MEM && rig->caps->chan_desc_sz != 0)
|
||||
{
|
||||
/* only BC780 BC250 BC785 */
|
||||
cmd_len = sprintf(cmdbuf, "TA C %03d %s" EOM,
|
||||
chan->channel_num, chan->channel_desc);
|
||||
|
||||
ret = uniden_transaction (rig, cmdbuf, cmd_len, NULL, NULL, NULL);
|
||||
if (ret != RIG_OK)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* uniden_get_info
|
||||
* Assumes rig!=NULL
|
||||
*/
|
||||
const char * uniden_get_info(RIG *rig)
|
||||
{
|
||||
static char infobuf[BUFSZ];
|
||||
size_t info_len=BUFSZ/2, vrinfo_len=BUFSZ/2;
|
||||
int ret;
|
||||
|
||||
ret = uniden_transaction (rig, "SI" EOM, 3, NULL, infobuf, &info_len);
|
||||
if (ret != RIG_OK)
|
||||
return NULL;
|
||||
|
||||
/* SI BC250D,0000000000,104 */
|
||||
|
||||
if (info_len < 4)
|
||||
return NULL;
|
||||
|
||||
if (info_len >= BUFSZ)
|
||||
info_len = BUFSZ-1;
|
||||
infobuf[info_len] = '\0';
|
||||
|
||||
/* VR not on every rig */
|
||||
/* VR1.00 */
|
||||
ret = uniden_transaction (rig, "VR" EOM, 3, NULL, infobuf+info_len, &vrinfo_len);
|
||||
if (ret == RIG_OK)
|
||||
{
|
||||
/* overwrite "VR" */
|
||||
infobuf[info_len] = ',';
|
||||
infobuf[info_len+1] = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
infobuf[info_len] = '\0';
|
||||
}
|
||||
|
||||
/* skip "SI " */
|
||||
return infobuf+3;
|
||||
}
|
||||
|
||||
|
||||
#define IDBUFSZ 32
|
||||
|
||||
/*
|
||||
* proberigs_uniden
|
||||
*
|
||||
* Notes:
|
||||
* There's only one rig possible per port.
|
||||
*
|
||||
* rig_model_t probeallrigs_uniden(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data)
|
||||
*/
|
||||
DECLARE_PROBERIG_BACKEND(uniden)
|
||||
{
|
||||
char idbuf[IDBUFSZ];
|
||||
int id_len=-1, i;
|
||||
int retval=-1;
|
||||
int rates[] = { 9600, 19200, 0 }; /* possible baud rates */
|
||||
int rates_idx;
|
||||
|
||||
if (!port)
|
||||
return RIG_MODEL_NONE;
|
||||
|
||||
if (port->type.rig != RIG_PORT_SERIAL)
|
||||
return RIG_MODEL_NONE;
|
||||
|
||||
port->write_delay = port->post_write_delay = 0;
|
||||
port->parm.serial.stop_bits = 1;
|
||||
port->retry = 1;
|
||||
|
||||
/*
|
||||
* try for all different baud rates
|
||||
*/
|
||||
for (rates_idx = 0; rates[rates_idx]; rates_idx++) {
|
||||
port->parm.serial.rate = rates[rates_idx];
|
||||
port->timeout = 2*1000/rates[rates_idx] + 50;
|
||||
|
||||
retval = serial_open(port);
|
||||
if (retval != RIG_OK)
|
||||
return RIG_MODEL_NONE;
|
||||
|
||||
retval = write_block(port, "SI"EOM, 3);
|
||||
id_len = read_string(port, idbuf, IDBUFSZ, EOM, 1);
|
||||
close(port->fd);
|
||||
|
||||
if (retval != RIG_OK || id_len < 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (retval != RIG_OK || id_len < 0 || memcmp(idbuf, "SI ", 3))
|
||||
return RIG_MODEL_NONE;
|
||||
|
||||
/*
|
||||
* reply should be something like 'SI xxx,xx,xx\x0d'
|
||||
*/
|
||||
if (id_len < 4) {
|
||||
idbuf[id_len] = '\0';
|
||||
rig_debug(RIG_DEBUG_VERBOSE,"probe_uniden: protocol error,"
|
||||
" received %d: '%s'\n",
|
||||
id_len, idbuf);
|
||||
return RIG_MODEL_NONE;
|
||||
}
|
||||
|
||||
|
||||
/* search ID string */
|
||||
for (i=0; uniden_id_string_list[i].model != RIG_MODEL_NONE; i++) {
|
||||
if (!memcmp(uniden_id_string_list[i].id, idbuf+3,
|
||||
strlen(uniden_id_string_list[i].id))) {
|
||||
rig_debug(RIG_DEBUG_VERBOSE,"probe_uniden: "
|
||||
"found '%s'\n", idbuf+3);
|
||||
if (cfunc)
|
||||
(*cfunc)(port, uniden_id_string_list[i].model, data);
|
||||
return uniden_id_string_list[i].model;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* not found in known table....
|
||||
* update uniden_id_list[]!
|
||||
*/
|
||||
rig_debug(RIG_DEBUG_WARN,"probe_uniden: found unknown device "
|
||||
"with ID '%s', please report to Hamlib "
|
||||
"developers.\n", idbuf+3);
|
||||
|
||||
return RIG_MODEL_NONE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -122,11 +694,15 @@ int uniden_set_mem(RIG *rig, vfo_t vfo, int ch)
|
|||
*/
|
||||
DECLARE_INITRIG_BACKEND(uniden)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "uniden: _init called\n");
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "uniden: _init called\n");
|
||||
|
||||
rig_register(&bc895_caps);
|
||||
rig_register(&bc245_caps);
|
||||
rig_register(&bc895_caps);
|
||||
rig_register(&bc245_caps);
|
||||
|
||||
return RIG_OK;
|
||||
rig_register(&pro2052_caps);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Hamlib Uniden backend - main header
|
||||
* Copyright (c) 2001-2004 by Stephane Fillod
|
||||
* Copyright (c) 2001-2008 by Stephane Fillod
|
||||
*
|
||||
* $Id: uniden.h,v 1.6 2005-04-03 20:23:18 fillods Exp $
|
||||
* $Id: uniden.h,v 1.7 2008-05-04 14:23:54 fillods Exp $
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
|
@ -26,13 +26,52 @@
|
|||
#include <hamlib/rig.h>
|
||||
#include <cal.h>
|
||||
|
||||
#define BACKEND_VER "0.2"
|
||||
#define BACKEND_VER "0.3"
|
||||
|
||||
/* TODO: Trunk, Delay, Recording
|
||||
*
|
||||
* .channel_desc=1 is only on BC780 BC250 BC785
|
||||
* .ctcss_sql=1,
|
||||
* .dcs_sql=1,
|
||||
*/
|
||||
#define UNIDEN_CHANNEL_CAPS \
|
||||
.freq=1,\
|
||||
.levels=RIG_LEVEL_ATT,\
|
||||
.flags=1, /* L/O */
|
||||
|
||||
/* Calibration, actually from the BC785D */
|
||||
#define UNIDEN_STR_CAL { 8, \
|
||||
{ \
|
||||
{ 0, -54 }, \
|
||||
{ 134, -20 }, /* < 0.50uV */ \
|
||||
{ 157, -12 }, \
|
||||
{ 173, -9 }, \
|
||||
{ 189, -5 }, \
|
||||
{ 204, -1 }, \
|
||||
{ 221, 4 }, /* < 7.50uV */ \
|
||||
{ 255, 60 }, \
|
||||
} }
|
||||
|
||||
extern const tone_t uniden_ctcss_list[];
|
||||
extern const tone_t uniden_dcs_list[];
|
||||
|
||||
int uniden_transaction (RIG *rig, const char *cmdstr, int cmd_len,
|
||||
const char *replystr, char *data, size_t *datasize);
|
||||
int uniden_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
||||
int uniden_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
|
||||
int uniden_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
|
||||
int uniden_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
|
||||
int uniden_set_mem(RIG *rig, vfo_t vfo, int ch);
|
||||
int uniden_get_mem(RIG *rig, vfo_t vfo, int *ch);
|
||||
int uniden_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd);
|
||||
int uniden_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val);
|
||||
int uniden_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
|
||||
int uniden_get_channel(RIG *rig, channel_t *chan);
|
||||
int uniden_set_channel(RIG *rig, const channel_t *chan);
|
||||
const char* uniden_get_info(RIG *rig);
|
||||
|
||||
extern const struct rig_caps bc895_caps;
|
||||
extern const struct rig_caps bc245_caps;
|
||||
|
||||
extern const struct rig_caps pro2052_caps;
|
||||
|
||||
#endif /* _UNIDEN_H */
|
||||
|
|
Ładowanie…
Reference in New Issue