kopia lustrzana https://github.com/Hamlib/Hamlib
style fixes
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2631 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.9
rodzic
3f0cb61586
commit
f3c47c5864
|
@ -3,7 +3,7 @@
|
||||||
* Copyright (c) 2000-2009 by Stephane Fillod
|
* Copyright (c) 2000-2009 by Stephane Fillod
|
||||||
* Copyright (C) 2009 Alessandro Zummo <a.zummo@towertech.it>
|
* Copyright (C) 2009 Alessandro Zummo <a.zummo@towertech.it>
|
||||||
*
|
*
|
||||||
* $Id: kenwood.c,v 1.116 2009-02-10 22:48:24 fillods Exp $
|
* $Id: kenwood.c,v 1.117 2009-02-13 19:29:16 azummo Exp $
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Library General Public License as
|
* it under the terms of the GNU Library General Public License as
|
||||||
|
@ -236,13 +236,14 @@ transaction_write:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONFIG_STRIP_CMDTRM 1
|
/* always give back a null terminated string without
|
||||||
#ifdef CONFIG_STRIP_CMDTRM
|
* the command terminator.
|
||||||
|
*/
|
||||||
|
|
||||||
if (strlen(data) > 0)
|
if (strlen(data) > 0)
|
||||||
data[strlen(data)-1] = '\0'; /* not very elegant, but should work. */
|
data[strlen(data) - 1] = '\0'; /* not elegant, but works */
|
||||||
else
|
else
|
||||||
data[0] = '\0';
|
data[0] = '\0';
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* Check that received the correct reply. The first two characters
|
* Check that received the correct reply. The first two characters
|
||||||
* should be the same as command.
|
* should be the same as command.
|
||||||
|
@ -413,10 +414,8 @@ static int kenwood_get_if(RIG *rig)
|
||||||
{
|
{
|
||||||
struct kenwood_priv_data *priv = rig->state.priv;
|
struct kenwood_priv_data *priv = rig->state.priv;
|
||||||
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
||||||
char cmdbuf[4] = "IF;";
|
|
||||||
|
|
||||||
cmdbuf[2] = caps->cmdtrm;
|
return kenwood_safe_transaction(rig, "IF", priv->info,
|
||||||
return kenwood_safe_transaction (rig, cmdbuf, priv->info,
|
|
||||||
KENWOOD_MAX_BUF_LEN, caps->if_len);
|
KENWOOD_MAX_BUF_LEN, caps->if_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,7 +425,7 @@ static int kenwood_get_if(RIG *rig)
|
||||||
*/
|
*/
|
||||||
int kenwood_set_vfo(RIG *rig, vfo_t vfo)
|
int kenwood_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
{
|
{
|
||||||
char cmdbuf[16];
|
char cmdbuf[6];
|
||||||
int retval;
|
int retval;
|
||||||
char vfo_function;
|
char vfo_function;
|
||||||
|
|
||||||
|
@ -462,9 +461,7 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
|
|
||||||
/* set TX VFO */
|
/* set TX VFO */
|
||||||
cmdbuf[1] = 'T';
|
cmdbuf[1] = 'T';
|
||||||
retval = kenwood_simple_cmd(rig, cmdbuf);
|
return kenwood_simple_cmd(rig, cmdbuf);
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
|
int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
|
||||||
|
@ -480,7 +477,7 @@ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
|
||||||
case RIG_VFO_B: vfo_function = '1'; break;
|
case RIG_VFO_B: vfo_function = '1'; break;
|
||||||
case RIG_VFO_MEM: vfo_function = '2'; break;
|
case RIG_VFO_MEM: vfo_function = '2'; break;
|
||||||
default:
|
default:
|
||||||
rig_debug(RIG_DEBUG_ERR,"kenwood_set_split_vfo: unsupported VFO %d\n",
|
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__,
|
||||||
vfo);
|
vfo);
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -499,7 +496,8 @@ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
|
||||||
case RIG_VFO_B: vfo_function = '1'; break;
|
case RIG_VFO_B: vfo_function = '1'; break;
|
||||||
case RIG_VFO_MEM: vfo_function = '2'; break;
|
case RIG_VFO_MEM: vfo_function = '2'; break;
|
||||||
default:
|
default:
|
||||||
rig_debug(RIG_DEBUG_ERR,"kenwood_set_split_vfo: unsupported VFO %d\n", txvfo);
|
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n",
|
||||||
|
__func__, txvfo);
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
/* set TX VFO */
|
/* set TX VFO */
|
||||||
|
@ -509,7 +507,8 @@ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
|
||||||
return retval;
|
return retval;
|
||||||
} else
|
} else
|
||||||
if(vfo==RIG_VFO_CURR)
|
if(vfo==RIG_VFO_CURR)
|
||||||
rig_debug(RIG_DEBUG_ERR,"kenwood_set_split_vfo: unsupported VFO %d\n", vfo);
|
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n",
|
||||||
|
__func__, vfo);
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
@ -687,21 +686,18 @@ int kenwood_get_rit(RIG *rig, vfo_t vfo, shortfreq_t * rit)
|
||||||
*/
|
*/
|
||||||
int kenwood_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit)
|
int kenwood_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit)
|
||||||
{
|
{
|
||||||
char buf[6];
|
char buf[4];
|
||||||
unsigned char c;
|
|
||||||
int retval, i;
|
int retval, i;
|
||||||
|
|
||||||
if (rit == 0)
|
if (rit == 0)
|
||||||
return kenwood_simple_cmd(rig, "RC");
|
return kenwood_simple_cmd(rig, "RC");
|
||||||
|
|
||||||
if (rit > 0)
|
sprintf(buf, "R%c", (rit > 0) ? 'U' : 'D');
|
||||||
c = 'U';
|
|
||||||
else
|
|
||||||
c = 'D';
|
|
||||||
|
|
||||||
sprintf(buf, "R%c", c);
|
|
||||||
|
|
||||||
retval = kenwood_simple_cmd(rig, "RC");
|
retval = kenwood_simple_cmd(rig, "RC");
|
||||||
|
if (retval != RIG_OK)
|
||||||
|
return retval;
|
||||||
|
|
||||||
for (i = 0; i < abs(rint(rit/10)); i++)
|
for (i = 0; i < abs(rint(rit/10)); i++)
|
||||||
retval = kenwood_simple_cmd(rig, buf);
|
retval = kenwood_simple_cmd(rig, buf);
|
||||||
|
|
||||||
|
@ -727,6 +723,17 @@ int kenwood_scan(RIG * rig, vfo_t vfo, scan_t scan, int ch)
|
||||||
scan == RIG_SCAN_STOP ? "SC0" : "SC1");
|
scan == RIG_SCAN_STOP ? "SC0" : "SC1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 000 No select
|
||||||
|
* 002 FM Wide
|
||||||
|
* 003 FM Narrow
|
||||||
|
* 005 AM
|
||||||
|
* 007 SSB
|
||||||
|
* 009 CW
|
||||||
|
* 010 CW NARROW
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* XXX revise */
|
||||||
static int kenwood_set_filter(RIG *rig, pbwidth_t width)
|
static int kenwood_set_filter(RIG *rig, pbwidth_t width)
|
||||||
{
|
{
|
||||||
char *cmd;
|
char *cmd;
|
||||||
|
@ -837,7 +844,7 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
||||||
|
|
||||||
*mode = kenwood2rmode(modebuf[2] - '0', caps->mode_table);
|
*mode = kenwood2rmode(modebuf[2] - '0', caps->mode_table);
|
||||||
|
|
||||||
/* XXX */
|
/* XXX ? */
|
||||||
*width = rig_passband_normal(rig, *mode);
|
*width = rig_passband_normal(rig, *mode);
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
|
@ -983,9 +990,7 @@ int get_kenwood_level(RIG *rig, const char *cmd, int cmd_len, float *f)
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
/*
|
/* 000..255 */
|
||||||
* 000..255
|
|
||||||
*/
|
|
||||||
sscanf(lvlbuf+2, "%d", &lvl);
|
sscanf(lvlbuf+2, "%d", &lvl);
|
||||||
*f = (float)lvl/255.0;
|
*f = (float)lvl/255.0;
|
||||||
|
|
||||||
|
@ -1159,7 +1164,7 @@ int kenwood_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||||
|
|
||||||
int kenwood_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
int kenwood_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
||||||
{
|
{
|
||||||
char buf[6];
|
char buf[6]; /* longest cmd is GTxxx */
|
||||||
|
|
||||||
switch (func) {
|
switch (func) {
|
||||||
case RIG_FUNC_NB:
|
case RIG_FUNC_NB:
|
||||||
|
@ -1187,7 +1192,7 @@ int kenwood_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
||||||
return kenwood_simple_cmd(rig, buf);
|
return kenwood_simple_cmd(rig, buf);
|
||||||
|
|
||||||
case RIG_FUNC_FAGC:
|
case RIG_FUNC_FAGC:
|
||||||
sprintf(buf, "GT00%c", (0==status)? '4':'2');
|
sprintf(buf, "GT00%c", (status == 0) ? '4' : '2');
|
||||||
return kenwood_simple_cmd(rig, buf);
|
return kenwood_simple_cmd(rig, buf);
|
||||||
|
|
||||||
case RIG_FUNC_NR:
|
case RIG_FUNC_NR:
|
||||||
|
@ -1380,8 +1385,8 @@ int kenwood_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
|
||||||
/* check this tone exists. That's better than nothing. */
|
/* check this tone exists. That's better than nothing. */
|
||||||
for (i = 0; i<tone_idx; i++) {
|
for (i = 0; i<tone_idx; i++) {
|
||||||
if (caps->ctcss_list[i] == 0) {
|
if (caps->ctcss_list[i] == 0) {
|
||||||
rig_debug(RIG_DEBUG_ERR,"kenwood_get_ctcss_tone: CTCSS NG "
|
rig_debug(RIG_DEBUG_ERR, "%s: CTCSS NG (%04d)\n",
|
||||||
"(%04d)\n", tone_idx);
|
__func__, tone_idx);
|
||||||
return -RIG_EPROTO;
|
return -RIG_EPROTO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1458,7 +1463,7 @@ int kenwood_get_ant (RIG * rig, vfo_t vfo, ant_t * ant)
|
||||||
|
|
||||||
*ant = RIG_ANT_N(ackbuf[2]-'1');
|
*ant = RIG_ANT_N(ackbuf[2]-'1');
|
||||||
|
|
||||||
/* XXX check that the returned antenna can be found on the rig */
|
/* XXX check that the returned antenna is valid for the current rig */
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
@ -1659,32 +1664,24 @@ int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg)
|
||||||
*/
|
*/
|
||||||
int kenwood_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
|
int kenwood_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
|
||||||
{
|
{
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
switch(op) {
|
switch(op) {
|
||||||
case RIG_OP_UP:
|
case RIG_OP_UP:
|
||||||
cmd="UP";
|
return kenwood_simple_cmd(rig, "UP");
|
||||||
break;
|
|
||||||
|
|
||||||
case RIG_OP_DOWN:
|
case RIG_OP_DOWN:
|
||||||
cmd="DN";
|
return kenwood_simple_cmd(rig, "DN");
|
||||||
break;
|
|
||||||
|
|
||||||
case RIG_OP_BAND_UP:
|
case RIG_OP_BAND_UP:
|
||||||
cmd="BD";
|
return kenwood_simple_cmd(rig, "BD");
|
||||||
break;
|
|
||||||
|
|
||||||
case RIG_OP_BAND_DOWN:
|
case RIG_OP_BAND_DOWN:
|
||||||
cmd="BU";
|
return kenwood_simple_cmd(rig, "BU");
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
rig_debug(RIG_DEBUG_ERR, "%s: unsupported op %#x\n",
|
rig_debug(RIG_DEBUG_ERR, "%s: unsupported op %#x\n",
|
||||||
__func__, op);
|
__func__, op);
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return kenwood_simple_cmd(rig, cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Hamlib Kenwood backend - TH handheld primitives
|
* Hamlib Kenwood backend - TH handheld primitives
|
||||||
* Copyright (c) 2001-2008 by Stephane Fillod
|
* Copyright (c) 2001-2008 by Stephane Fillod
|
||||||
*
|
*
|
||||||
* $Id: th.c,v 1.38 2009-02-03 23:22:58 azummo Exp $
|
* $Id: th.c,v 1.39 2009-02-13 19:29:16 azummo Exp $
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Library General Public License as
|
* it under the terms of the GNU Library General Public License as
|
||||||
|
@ -35,9 +35,6 @@
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
static struct kenwood_priv_caps th_priv_caps = {
|
|
||||||
.cmdtrm = EOM_TH,
|
|
||||||
};
|
|
||||||
/* Note: Currently the code assumes the command termination is a
|
/* Note: Currently the code assumes the command termination is a
|
||||||
* single character.
|
* single character.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Hamlib Kenwood backend - TS680 description
|
* Hamlib Kenwood backend - TS680 description
|
||||||
* Copyright (c) 2000-2008 by Stephane Fillod
|
* Copyright (c) 2000-2008 by Stephane Fillod
|
||||||
*
|
*
|
||||||
* $Id: ts680.c,v 1.12 2009-02-03 22:56:06 azummo Exp $
|
* $Id: ts680.c,v 1.13 2009-02-13 19:29:16 azummo Exp $
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Library General Public License as
|
* it under the terms of the GNU Library General Public License as
|
||||||
|
@ -52,7 +52,6 @@ static struct kenwood_priv_caps ts680_priv_caps = {
|
||||||
static int ts680_set_vfo(RIG *rig, vfo_t vfo)
|
static int ts680_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
{
|
{
|
||||||
char cmdbuf[16];
|
char cmdbuf[16];
|
||||||
int retval;
|
|
||||||
char vfo_function;
|
char vfo_function;
|
||||||
|
|
||||||
switch (vfo) {
|
switch (vfo) {
|
||||||
|
|
Ładowanie…
Reference in New Issue