Patch from Michael Smith for the OS456:

- adds SQL status and signal strength support
- fixes the signal strength scaling
- adds code to support get_ctcss_tone(), get_dcs_code() and rig_recv_dtmf()


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1436 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.4
Stéphane Fillod, F8CFE 2003-04-09 06:37:37 +00:00
rodzic e0b2a7b4ac
commit 524341a0f7
3 zmienionych plików z 121 dodań i 7 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib CI-V backend - main header * Hamlib CI-V backend - main header
* Copyright (c) 2000-2003 by Stephane Fillod * Copyright (c) 2000-2003 by Stephane Fillod
* *
* $Id: icom.h,v 1.54 2003-04-06 18:40:35 fillods Exp $ * $Id: icom.h,v 1.55 2003-04-09 06:37:37 fillods 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
@ -140,6 +140,9 @@ int icom_decode_event(RIG *rig);
int optoscan_open(RIG *rig); int optoscan_open(RIG *rig);
int optoscan_close(RIG *rig); int optoscan_close(RIG *rig);
const char* optoscan_get_info(RIG *rig); const char* optoscan_get_info(RIG *rig);
int optoscan_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone);
int optoscan_get_dcs_code(RIG * rig, vfo_t vfo, tone_t *code);
int optoscan_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length);
extern const struct confparams icom_cfg_params[]; extern const struct confparams icom_cfg_params[];

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib CI-V backend - OptoScan extensions * Hamlib CI-V backend - OptoScan extensions
* Copyright (c) 2000-2003 by Stephane Fillod * Copyright (c) 2000-2003 by Stephane Fillod
* *
* $Id: optoscan.c,v 1.3 2003-04-07 22:41:51 fillods Exp $ * $Id: optoscan.c,v 1.4 2003-04-09 06:37:37 fillods 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
@ -134,4 +134,111 @@ const char* optoscan_get_info(RIG *rig)
return info; return info;
} }
/*
* optoscan_get_ctcss_tone
* Assumes rig!=NULL, rig->state.priv!=NULL
*/
int optoscan_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
{
const struct rig_caps *caps;
unsigned char tonebuf[MAXFRAMELEN];
int tone_len, retval;
caps = rig->caps;
retval = icom_transaction(rig, C_CTL_MISC, S_OPTO_RDCTCSS, NULL, 0,
tonebuf, &tone_len);
if (retval != RIG_OK)
return retval;
if (tone_len != 4) {
rig_debug(RIG_DEBUG_ERR,"optoscan_get_ctcss_tone: ack NG (%#.2x), "
"len=%d\n", tonebuf[0], tone_len);
return -RIG_ERJCTED;
}
tone_len -= 2;
*tone = from_bcd_be(tonebuf+2, tone_len*2);
rig_debug(RIG_DEBUG_ERR,"optoscan_get_ctcss_tone: *tone=%d\n",*tone);
return RIG_OK;
}
/*
* optoscan_get_dcs_code
* Assumes rig!=NULL, rig->state.priv!=NULL
*/
int optoscan_get_dcs_code(RIG * rig, vfo_t vfo, tone_t *code)
{
const struct rig_caps *caps;
unsigned char tonebuf[MAXFRAMELEN];
int tone_len, retval;
caps = rig->caps;
retval = icom_transaction(rig, C_CTL_MISC, S_OPTO_RDDCS, NULL, 0,
tonebuf, &tone_len);
if (retval != RIG_OK)
return retval;
if (tone_len != 4) {
rig_debug(RIG_DEBUG_ERR,"optoscan_get_dcs_code: ack NG (%#.2x), "
"len=%d\n", tonebuf[0], tone_len);
return -RIG_ERJCTED;
}
tone_len -= 2;
*code = from_bcd_be(tonebuf+2, tone_len*2);
rig_debug(RIG_DEBUG_ERR,"optoscan_get_dcs_code: *code=%d\n",*code);
return RIG_OK;
}
int optoscan_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length)
{
const struct rig_caps *caps;
unsigned char dtmfbuf[MAXFRAMELEN],digit;
int len, retval, digitpos;
unsigned char xlate[] = {"0","1","2","3","4","5","6",
"7","8","9","A","B","C","D",
"*","#"};
caps = rig->caps;
digitpos=0;
do {
retval = icom_transaction(rig, C_CTL_MISC, S_OPTO_RDDTMF,
NULL,0,dtmfbuf, &len);
if (retval != RIG_OK)
return retval;
if (len != 3) {
rig_debug(RIG_DEBUG_ERR,"optoscan_recv_dtmf: ack NG (%#.2x), len=%d\n", dtmfbuf[0], len);
return -RIG_ERJCTED;
}
digit = dtmfbuf[2];
if( digit < 0x16 )
{
digits[digitpos] = xlate[digit];
digitpos++;
}
} while( (digit != 0x99) && (digitpos < *length) );
*length = digitpos;
digits[digitpos]=0;
if(*length > 0)
{
rig_debug(RIG_DEBUG_ERR,"optoscan_recv_dtmf: %d digits - %s\n",*length,digits);
}
else
{
rig_debug(RIG_DEBUG_ERR,"optoscan_recv_dtmf: no digits to read.\n");
}
return RIG_OK;
}

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib CI-V backend - description of the OptoScan456 * Hamlib CI-V backend - description of the OptoScan456
* Copyright (c) 2000-2002 by Stephane Fillod * Copyright (c) 2000-2002 by Stephane Fillod
* *
* $Id: os456.c,v 1.2 2002-08-16 17:43:01 fillods Exp $ * $Id: os456.c,v 1.3 2003-04-09 06:37:37 fillods 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
@ -33,7 +33,7 @@
#define OS456_VFO_ALL (RIG_VFO_A) #define OS456_VFO_ALL (RIG_VFO_A)
#define OS456_LEVELS (RIG_LEVEL_STRENGTH) #define OS456_LEVELS (RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH)
/* /*
* The signal strength data is in the form of two bytes, each consisting * The signal strength data is in the form of two bytes, each consisting
@ -44,8 +44,8 @@
*/ */
#define OS456_STR_CAL { 2, { \ #define OS456_STR_CAL { 2, { \
{ 125, -60 }, \
{ 0, 60 }, \ { 0, 60 }, \
{ 125, -60 }, \
} } /* TBC */ } } /* TBC */
/* /*
@ -86,7 +86,7 @@ const struct rig_caps os456_caps = {
.retry = 3, .retry = 3,
.has_get_func = RIG_FUNC_NONE, .has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE,
.has_get_level = RIG_LEVEL_NONE, .has_get_level = OS456_LEVELS,
.has_set_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE,
.has_get_parm = RIG_PARM_NONE, .has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE,
@ -157,5 +157,9 @@ const struct rig_caps os456_caps = {
.get_info = optoscan_get_info, .get_info = optoscan_get_info,
.get_ctcss_tone = optoscan_get_ctcss_tone,
.get_dcs_code = optoscan_get_dcs_code,
.recv_dtmf = optoscan_recv_dtmf,
}; };