kopia lustrzana https://github.com/Hamlib/Hamlib
Support for pipelined tuning, including DCD on CD line.
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1510 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.0
rodzic
0dced917ad
commit
343deb6f59
|
@ -132,6 +132,7 @@
|
|||
%ignore rig_set_vfo_callback;
|
||||
%ignore rig_set_ptt_callback;
|
||||
%ignore rig_set_dcd_callback;
|
||||
%ignore rig_set_pltune_callback;
|
||||
%ignore rig_get_info;
|
||||
%ignore rig_passband_normal;
|
||||
%ignore rig_passband_narrow;
|
||||
|
|
|
@ -6,6 +6,7 @@ ICOMSRCLIST = ic706.c icr8500.c ic735.c ic775.c ic756.c \
|
|||
lib_LTLIBRARIES = hamlib-icom.la
|
||||
hamlib_icom_la_SOURCES = $(ICOMSRCLIST) icom.c frame.c optoscan.c
|
||||
hamlib_icom_la_LDFLAGS = -no-undefined -module -avoid-version
|
||||
hamlib_icom_la_LIBADD = $(top_builddir)/src/libhamlib.la
|
||||
hamlib_icom_la_LIBADD = $(top_builddir)/lib/libmisc.la \
|
||||
$(top_builddir)/src/libhamlib.la
|
||||
|
||||
noinst_HEADERS = frame.h icom.h icom_defs.h optoscan.h
|
||||
|
|
11
icom/frame.c
11
icom/frame.c
|
@ -2,7 +2,7 @@
|
|||
* Hamlib CI-V backend - low level communication routines
|
||||
* Copyright (c) 2000-2003 by Stephane Fillod
|
||||
*
|
||||
* $Id: frame.c,v 1.22 2003-05-03 13:34:16 fillods Exp $
|
||||
* $Id: frame.c,v 1.23 2003-08-17 22:39:07 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
|
||||
|
@ -83,6 +83,7 @@ int make_cmd_frame(char frame[], char re_id, char cmd, int subcmd, const char *d
|
|||
* Otherwise, you'll get a nice seg fault. You've been warned!
|
||||
* payload can be NULL if payload_len == 0
|
||||
* subcmd can be equal to -1 (no subcmd wanted)
|
||||
* if no answer is to be expected, data_len must be set to NULL to tell so
|
||||
*
|
||||
* return RIG_OK if transaction completed,
|
||||
* or a negative value otherwise indicating the error.
|
||||
|
@ -170,6 +171,14 @@ int icom_one_transaction (RIG *rig, int cmd, int subcmd, const char *payload, in
|
|||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
/*
|
||||
* expect an answer?
|
||||
*/
|
||||
if (data_len == NULL) {
|
||||
Unhold_Decode(rig);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* wait for ACK ...
|
||||
* FIXME: handle pading/collisions
|
||||
|
|
19
icom/icom.h
19
icom/icom.h
|
@ -2,7 +2,7 @@
|
|||
* Hamlib CI-V backend - main header
|
||||
* Copyright (c) 2000-2003 by Stephane Fillod
|
||||
*
|
||||
* $Id: icom.h,v 1.57 2003-05-19 06:57:44 fillods Exp $
|
||||
* $Id: icom.h,v 1.58 2003-08-17 22:39:07 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
|
||||
|
@ -69,11 +69,27 @@ struct ts_sc_list {
|
|||
unsigned char sc; /* sub command */
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Pipelined tuning state data structure.
|
||||
*/
|
||||
typedef struct rig_pltstate {
|
||||
freq_t freq;
|
||||
freq_t next_freq;
|
||||
rmode_t mode;
|
||||
rmode_t next_mode;
|
||||
pbwidth_t width;
|
||||
pbwidth_t next_width;
|
||||
struct timeval timer_start;
|
||||
struct timeval timer_current;
|
||||
int usleep_time; /* dependent on radio module & serial data rate */
|
||||
} pltstate_t;
|
||||
|
||||
struct icom_priv_caps {
|
||||
unsigned char re_civ_addr; /* the remote dlft equipment's CI-V address*/
|
||||
int civ_731_mode; /* Off: freqs on 10 digits, On: freqs on 8 digits */
|
||||
const struct ts_sc_list *ts_sc_list;
|
||||
cal_table_t str_cal;
|
||||
int settle_time; /*!< Receiver settle time, in ms */
|
||||
};
|
||||
|
||||
|
||||
|
@ -81,6 +97,7 @@ struct icom_priv_data {
|
|||
unsigned char re_civ_addr; /* the remote equipment's CI-V address*/
|
||||
int civ_731_mode; /* Off: freqs on 10 digits, On: freqs on 8 digits */
|
||||
cal_table_t str_cal;
|
||||
pltstate_t *pltstate; /* only on optoscan */
|
||||
};
|
||||
|
||||
extern const struct ts_sc_list r8500_ts_sc_list[];
|
||||
|
|
205
icom/optoscan.c
205
icom/optoscan.c
|
@ -2,7 +2,7 @@
|
|||
* Hamlib CI-V backend - OptoScan extensions
|
||||
* Copyright (c) 2000-2003 by Stephane Fillod
|
||||
*
|
||||
* $Id: optoscan.c,v 1.6 2003-05-19 06:57:44 fillods Exp $
|
||||
* $Id: optoscan.c,v 1.7 2003-08-17 22:39:07 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
|
||||
|
@ -28,6 +28,7 @@
|
|||
#include <string.h> /* String function definitions */
|
||||
#include <unistd.h> /* UNIX standard function definitions */
|
||||
#include <math.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "hamlib/rig.h"
|
||||
#include "serial.h"
|
||||
|
@ -54,6 +55,10 @@ const struct confparams opto_ext_parms[] = {
|
|||
};
|
||||
|
||||
static int optoscan_get_status_block(RIG *rig, struct optostat *status_block);
|
||||
static int optoscan_send_freq(RIG *rig,pltstate_t *state);
|
||||
static int optoscan_RTS_toggle(RIG *rig);
|
||||
static int optoscan_start_timer(RIG *rig, pltstate_t *state);
|
||||
static int optoscan_wait_timer(RIG *rig, pltstate_t *state);
|
||||
|
||||
/*
|
||||
* optoscan_open
|
||||
|
@ -63,21 +68,32 @@ int optoscan_open(RIG *rig)
|
|||
{
|
||||
struct icom_priv_data *priv;
|
||||
struct rig_state *rs;
|
||||
pltstate_t *pltstate;
|
||||
unsigned char ackbuf[16];
|
||||
int ack_len, retval;
|
||||
|
||||
rs = &rig->state;
|
||||
priv = (struct icom_priv_data*)rs->priv;
|
||||
|
||||
pltstate = malloc(sizeof(pltstate_t));
|
||||
if (!pltstate) {
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
memset(pltstate, 0, sizeof(pltstate_t));
|
||||
priv->pltstate = pltstate;
|
||||
|
||||
/* select REMOTE control */
|
||||
retval = icom_transaction (rig, C_CTL_MISC, S_OPTO_REMOTE,
|
||||
NULL, 0, ackbuf, &ack_len);
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
if (retval != RIG_OK) {
|
||||
free(pltstate);
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (ack_len != 1 || ackbuf[0] != ACK) {
|
||||
rig_debug(RIG_DEBUG_ERR,"optoscan_open: ack NG (%#.2x), "
|
||||
"len=%d\n", ackbuf[0], ack_len);
|
||||
free(pltstate);
|
||||
return -RIG_ERJCTED;
|
||||
}
|
||||
|
||||
|
@ -110,6 +126,8 @@ int optoscan_close(RIG *rig)
|
|||
return -RIG_ERJCTED;
|
||||
}
|
||||
|
||||
free(priv->pltstate);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
@ -510,6 +528,95 @@ int optoscan_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* OS456 Pipeline tuning algorithm:
|
||||
* Step 2: Send the next frequency and mode to the receiver using the
|
||||
* TRANSFER NEXT FREQUENCY/MODE command.
|
||||
*
|
||||
* Step 3: Change the state of the RTS interface signal to cause the
|
||||
* next frequency and mode to become the current frequency and
|
||||
* mode, and the receiver to begin settling.
|
||||
*
|
||||
* Step 4: While the receiver is still settling on the current
|
||||
* frequency and mode, send the next frequency and mode to the
|
||||
* receiver using the TRANSFER NEXT FREQUENCY/MODE command.
|
||||
*
|
||||
* Step 5: Wait for the receiver to finish settling. The total
|
||||
* settling time, including sending the next frequency and
|
||||
* mode, is 20 milliseconds (0.02 seconds).
|
||||
*
|
||||
* Step 6: Check the squelch status by reading the DCD interface
|
||||
* signal. If the squelch is open, scanning is stopped.
|
||||
* Otherwise, scanning continues. Optionally, the status of
|
||||
* the CTCSS/DCS/DTMF decoder can be checked, and the
|
||||
* appropriate action taken.
|
||||
*
|
||||
* Step 7: Continuously repeat steps 3 through 6 above.
|
||||
*/
|
||||
int optoscan_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
|
||||
{
|
||||
pltstate_t *state;
|
||||
pltune_cb_t cb;
|
||||
int rc, pin_state;
|
||||
struct rig_state *rs;
|
||||
int status;
|
||||
unsigned char y;
|
||||
port_t *p;
|
||||
|
||||
if(scan != RIG_SCAN_PLT)
|
||||
return -RIG_ENAVAIL;
|
||||
|
||||
rs=&rig->state;
|
||||
cb = rig->callbacks.pltune;
|
||||
state = ((struct icom_priv_data*)rs->priv)->pltstate;
|
||||
|
||||
if(state==NULL)
|
||||
return -RIG_EINTERNAL;
|
||||
|
||||
if(state->freq==0) /* pltstate_t is not initialized - perform setup */
|
||||
{
|
||||
/* time for CIV command to be sent. this is subtracted from */
|
||||
/* rcvr settle time */
|
||||
state->usleep_time = (1000000 / (rig->state.rigport.parm.serial.rate))
|
||||
* 13 * 9;
|
||||
|
||||
rc=cb(rig,vfo,&(state->next_freq),&(state->next_mode),
|
||||
&(state->next_width),rig->callbacks.pltune_arg);
|
||||
if(rc==RIG_SCAN_STOP)
|
||||
return RIG_OK; /* callback halted loop */
|
||||
|
||||
/* Step 1 is implicit, since hamlib does this when it opens the device */
|
||||
optoscan_send_freq(rig,state); /*Step 2*/
|
||||
}
|
||||
|
||||
rc=!RIG_SCAN_STOP;
|
||||
while(rc!=RIG_SCAN_STOP)
|
||||
{
|
||||
optoscan_RTS_toggle(rig); /*Step 3*/
|
||||
|
||||
state->freq = state->next_freq;
|
||||
state->mode = state->next_mode;
|
||||
|
||||
optoscan_start_timer(rig,state);
|
||||
|
||||
rc=cb(rig,vfo,&(state->next_freq),&(state->next_mode),
|
||||
&(state->next_width),rig->callbacks.pltune_arg);
|
||||
if(rc!=RIG_SCAN_STOP)
|
||||
{
|
||||
optoscan_send_freq(rig,state); /*Step 4*/
|
||||
}
|
||||
|
||||
optoscan_wait_timer(rig,state); /*Step 5*/
|
||||
|
||||
ser_get_dcd(&rs->rigport,&pin_state);
|
||||
if( pin_state ) /*Step 6*/
|
||||
{
|
||||
return RIG_OK; /* we've broken squelch - return(). caller can */
|
||||
/* get current freq & mode out of state str */
|
||||
}
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assumes rig!=NULL, status_block !=NULL
|
||||
|
@ -558,3 +665,95 @@ static int optoscan_get_status_block(RIG *rig, struct optostat *status_block)
|
|||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
static int optoscan_send_freq(RIG *rig,pltstate_t *state)
|
||||
{
|
||||
unsigned char buff[OPTO_BUFF_SIZE];
|
||||
struct icom_priv_data *priv;
|
||||
struct rig_state *rs;
|
||||
const port_t *port;
|
||||
int fd,i;
|
||||
char md,pd;
|
||||
freq_t freq;
|
||||
rmode_t mode;
|
||||
|
||||
port = &(rig->state.rigport);
|
||||
fd = port->fd;
|
||||
rs = &rig->state;
|
||||
priv = (struct icom_priv_data*)rs->priv;
|
||||
freq=state->next_freq;
|
||||
mode=state->next_mode;
|
||||
|
||||
memset(buff,0,OPTO_BUFF_SIZE);
|
||||
|
||||
to_bcd(buff,freq,5*2); /* to_bcd requires nibble len */
|
||||
|
||||
rig2icom_mode(rig,mode,0,&md,&pd);
|
||||
buff[5]=md;
|
||||
|
||||
/* read echo'd chars only...there will be no ACK from this command
|
||||
*
|
||||
* Note:
|
||||
* It may have waited fro pltstate->usleep_time before reading the echo'd
|
||||
* chars, but the read will be blocking anyway. --SF
|
||||
* */
|
||||
return icom_transaction (rig, C_CTL_MISC, S_OPTO_NXT, buff, 6, NULL, NULL);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int optoscan_RTS_toggle(RIG *rig)
|
||||
{
|
||||
struct rig_state *rs;
|
||||
int state=0;
|
||||
port_t *p;
|
||||
int status;
|
||||
unsigned char y;
|
||||
|
||||
rs=&rig->state;
|
||||
ser_get_rts(&rs->rigport,&state);
|
||||
ser_set_rts(&rs->rigport,!state);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int optoscan_start_timer(RIG *rig, pltstate_t *state)
|
||||
{
|
||||
gettimeofday(&(state->timer_start),NULL);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int optoscan_wait_timer(RIG *rig, pltstate_t *state)
|
||||
{
|
||||
struct icom_priv_caps *priv_caps;
|
||||
int usec_diff;
|
||||
int settle_usec;
|
||||
|
||||
priv_caps = (struct icom_priv_caps *)rig->caps->priv;
|
||||
settle_usec = priv_caps->settle_time * 1000; /*convert settle time (ms) to */
|
||||
/* settle time (usec) */
|
||||
|
||||
gettimeofday(&(state->timer_current),NULL);
|
||||
|
||||
usec_diff = abs( (state->timer_current.tv_usec) -
|
||||
(state->timer_start.tv_usec) );
|
||||
|
||||
if( usec_diff < settle_usec )
|
||||
{
|
||||
usleep( settle_usec - usec_diff ); /* sleep balance of settle_time */
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
void static dump_state(char *str, pltstate_t *state)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE,"%s:\n",str);
|
||||
rig_debug(RIG_DEBUG_VERBOSE,"freq: %d\n",state->freq);
|
||||
rig_debug(RIG_DEBUG_VERBOSE,"mode: %d\n",state->mode);
|
||||
rig_debug(RIG_DEBUG_VERBOSE,"next freq: %d\n",state->next_freq);
|
||||
rig_debug(RIG_DEBUG_VERBOSE,"next mode: %d\n",state->next_mode);
|
||||
rig_debug(RIG_DEBUG_VERBOSE,"usleep time:%d\n",state->usleep_time);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Hamlib CI-V backend - main header
|
||||
* Copyright (c) 2000-2003 by Stephane Fillod
|
||||
*
|
||||
* $Id: optoscan.h,v 1.1 2003-05-20 07:01:18 fillods Exp $
|
||||
* $Id: optoscan.h,v 1.2 2003-08-17 22:39:07 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
|
||||
|
@ -36,6 +36,8 @@
|
|||
#define TOK_CTCSSACT TOKEN_BACKEND(7)
|
||||
#define TOK_DCSACT TOKEN_BACKEND(8)
|
||||
|
||||
#define OPTO_BUFF_SIZE 64
|
||||
|
||||
int optoscan_open(RIG *rig);
|
||||
int optoscan_close(RIG *rig);
|
||||
const char* optoscan_get_info(RIG *rig);
|
||||
|
@ -46,6 +48,7 @@ int optoscan_set_ext_parm(RIG *rig, token_t token, value_t val);
|
|||
int optoscan_get_ext_parm(RIG *rig, token_t token, value_t *val);
|
||||
int optoscan_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val);
|
||||
int optoscan_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
|
||||
int optoscan_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch);
|
||||
|
||||
struct optostat {
|
||||
int remote_control;
|
||||
|
@ -60,6 +63,4 @@ struct optostat {
|
|||
int audio_present;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* _OPTOSCAN_H */
|
||||
|
|
15
icom/os456.c
15
icom/os456.c
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Hamlib CI-V backend - description of the OptoScan456
|
||||
* Copyright (c) 2000-2003 by Stephane Fillod
|
||||
* Copyright (c) 2000-2003 by Stephane Fillod and Michael Smith
|
||||
*
|
||||
* $Id: os456.c,v 1.5 2003-05-19 06:57:44 fillods Exp $
|
||||
* $Id: os456.c,v 1.6 2003-08-17 22:39:07 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
|
||||
|
@ -35,7 +35,7 @@ extern struct confparams opto_ext_parms[];
|
|||
#define OS456_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM)
|
||||
#define OS456_VFO_ALL (RIG_VFO_A)
|
||||
#define OS456_LEVELS (RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH|RIG_LEVEL_AF)
|
||||
|
||||
#define OS456_SCAN_OPS (RIG_SCAN_PLT)
|
||||
/*
|
||||
* The signal strength data is in the form of two bytes, each consisting
|
||||
* of two BCD digits. The signal strength is reported in units of absolute
|
||||
|
@ -61,7 +61,8 @@ static const struct icom_priv_caps os456_priv_caps = {
|
|||
0x80, /* default address */
|
||||
0, /* 731 mode */
|
||||
NULL,
|
||||
OS456_STR_CAL
|
||||
OS456_STR_CAL,
|
||||
.settle_time = 20,
|
||||
};
|
||||
|
||||
const struct rig_caps os456_caps = {
|
||||
|
@ -73,7 +74,7 @@ const struct rig_caps os456_caps = {
|
|||
.status = RIG_STATUS_BETA,
|
||||
.rig_type = RIG_TYPE_SCANNER,
|
||||
.ptt_type = RIG_PTT_NONE,
|
||||
.dcd_type = RIG_DCD_NONE,
|
||||
.dcd_type = RIG_DCD_SERIAL_CAR,
|
||||
.port_type = RIG_PORT_SERIAL,
|
||||
.serial_rate_min = 300,
|
||||
.serial_rate_max = 38400,
|
||||
|
@ -102,7 +103,7 @@ const struct rig_caps os456_caps = {
|
|||
.max_ifshift = Hz(0),
|
||||
.targetable_vfo = 0,
|
||||
.vfo_ops = RIG_OP_NONE,
|
||||
.scan_ops = RIG_SCAN_NONE,
|
||||
.scan_ops = OS456_SCAN_OPS,
|
||||
.transceive = RIG_TRN_RIG,
|
||||
.bank_qty = 0,
|
||||
.chan_desc_sz = 0,
|
||||
|
@ -168,5 +169,7 @@ const struct rig_caps os456_caps = {
|
|||
.set_level = optoscan_set_level,
|
||||
.get_level = optoscan_get_level,
|
||||
|
||||
.scan = optoscan_scan,
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Hamlib Interface - API header
|
||||
* Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton
|
||||
*
|
||||
* $Id: rig.h,v 1.83 2003-07-03 06:47:31 fillods Exp $
|
||||
* $Id: rig.h,v 1.84 2003-08-17 22:39:07 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
|
||||
|
@ -357,6 +357,7 @@ typedef enum {
|
|||
RIG_DCD_RIG, /*!< Rig has DCD status support, i.e. rig has get_dcd cap */
|
||||
RIG_DCD_SERIAL_DSR, /*!< DCD status from serial DSR signal */
|
||||
RIG_DCD_SERIAL_CTS, /*!< DCD status from serial CTS signal */
|
||||
RIG_DCD_SERIAL_CAR, /*!< DCD status from serial CD signal */
|
||||
RIG_DCD_PARALLEL /*!< DCD status from parallel port pin */
|
||||
} dcd_type_t;
|
||||
|
||||
|
@ -441,7 +442,8 @@ typedef enum {
|
|||
RIG_SCAN_PRIO = (1<<2), /*!< Priority watch (mem or call channel) */
|
||||
RIG_SCAN_PROG = (1<<3), /*!< Programmed(edge) scan */
|
||||
RIG_SCAN_DELTA = (1<<4), /*!< delta-f scan */
|
||||
RIG_SCAN_VFO = (1<<5) /*!< most basic scan */
|
||||
RIG_SCAN_VFO = (1<<5), /*!< most basic scan */
|
||||
RIG_SCAN_PLT = (1<<6) /*!< Scan using pipelined tuning */
|
||||
} scan_t;
|
||||
|
||||
/**
|
||||
|
@ -1265,6 +1267,7 @@ typedef int (*mode_cb_t) (RIG *, vfo_t, rmode_t, pbwidth_t, rig_ptr_t);
|
|||
typedef int (*vfo_cb_t) (RIG *, vfo_t, rig_ptr_t);
|
||||
typedef int (*ptt_cb_t) (RIG *, vfo_t, ptt_t, rig_ptr_t);
|
||||
typedef int (*dcd_cb_t) (RIG *, vfo_t, dcd_t, rig_ptr_t);
|
||||
typedef int (*pltune_cb_t) (RIG *, vfo_t, freq_t *, rmode_t *, pbwidth_t *, rig_ptr_t);
|
||||
|
||||
/**
|
||||
* \brief Callback functions and args for rig event.
|
||||
|
@ -1294,6 +1297,8 @@ struct rig_callbacks {
|
|||
rig_ptr_t ptt_arg; /*!< PTT change argument */
|
||||
dcd_cb_t dcd_event; /*!< DCD change event */
|
||||
rig_ptr_t dcd_arg; /*!< DCD change argument */
|
||||
pltune_cb_t pltune; /*!< Pipeline tuning module freq/mode/width callback */
|
||||
rig_ptr_t pltune_arg; /*!< Pipeline tuning argument */
|
||||
/* etc.. */
|
||||
};
|
||||
|
||||
|
@ -1449,6 +1454,7 @@ extern HAMLIB_EXPORT(int) rig_set_mode_callback HAMLIB_PARAMS((RIG *, mode_cb_t,
|
|||
extern HAMLIB_EXPORT(int) rig_set_vfo_callback HAMLIB_PARAMS((RIG *, vfo_cb_t, rig_ptr_t));
|
||||
extern HAMLIB_EXPORT(int) rig_set_ptt_callback HAMLIB_PARAMS((RIG *, ptt_cb_t, rig_ptr_t));
|
||||
extern HAMLIB_EXPORT(int) rig_set_dcd_callback HAMLIB_PARAMS((RIG *, dcd_cb_t, rig_ptr_t));
|
||||
extern HAMLIB_EXPORT(int) rig_set_pltune_callback HAMLIB_PARAMS((RIG *, pltune_cb_t, rig_ptr_t));
|
||||
|
||||
extern HAMLIB_EXPORT(const char *) rig_get_info HAMLIB_PARAMS((RIG *rig));
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ Supported types are RIG, DTR, RTS, PARALLEL, NONE.
|
|||
.B \-d, --dcd-type=type
|
||||
Use \fBtype\fP device as the kind of the Data Carrier Detect device
|
||||
to operate on.
|
||||
Supported types are RIG, DSR, CTS, PARALLEL, NONE.
|
||||
Supported types are RIG, DSR, CTS, CD, PARALLEL, NONE.
|
||||
.TP
|
||||
.B \-s, --serial-speed=baud
|
||||
Set serial speed to \fBbaud\fP rate. Uses maximal rig speed as default.
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* rpcrigd - (C) Stephane Fillod 2001-2002
|
||||
* rpcrigd - (C) Stephane Fillod 2001-2003
|
||||
*
|
||||
* This program let programs control a radio through
|
||||
* the mean of RPC services using Hamlib.
|
||||
*
|
||||
* $Id: rpcrigd.c,v 1.6 2002-12-16 22:06:54 fillods Exp $
|
||||
* $Id: rpcrigd.c,v 1.7 2003-08-17 22:39:07 fillods Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -218,6 +218,8 @@ main (int argc, char *argv[])
|
|||
dcd_type = RIG_DCD_SERIAL_DSR;
|
||||
else if (!strcmp(optarg, "CTS"))
|
||||
dcd_type = RIG_DCD_SERIAL_CTS;
|
||||
else if (!strcmp(optarg, "CD"))
|
||||
dcd_type = RIG_DCD_SERIAL_CAR;
|
||||
else if (!strcmp(optarg, "PARALLEL"))
|
||||
dcd_type = RIG_DCD_PARALLEL;
|
||||
else if (!strcmp(optarg, "NONE"))
|
||||
|
|
32
src/event.c
32
src/event.c
|
@ -2,7 +2,7 @@
|
|||
* Hamlib Interface - event handling
|
||||
* Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton
|
||||
*
|
||||
* $Id: event.c,v 1.19 2003-08-15 01:25:26 fillods Exp $
|
||||
* $Id: event.c,v 1.20 2003-08-17 22:39:07 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
|
||||
|
@ -489,6 +489,36 @@ int rig_set_dcd_callback(RIG *rig, dcd_cb_t cb, rig_ptr_t arg)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief set the callback for pipelined tuning module
|
||||
* \param rig The rig handle
|
||||
* \param cb The callback to install
|
||||
* \param arg A Pointer to some private data to pass later on to the callback
|
||||
* used to maintain state during pipelined tuning.
|
||||
*
|
||||
* Install a callback for pipelined tuning module, to be called when the
|
||||
* rig_scan( SCAN_PLT ) loop needs a new frequency, mode and width.
|
||||
*
|
||||
* \return RIG_OK if the operation has been sucessful, otherwise
|
||||
* a negative value if an error occured (in which case, cause is
|
||||
* set appropriately).
|
||||
*
|
||||
* \sa rig_set_trn()
|
||||
*/
|
||||
|
||||
int rig_set_pltune_callback(RIG *rig, pltune_cb_t cb, rig_ptr_t arg)
|
||||
{
|
||||
if (CHECK_RIG_ARG(rig))
|
||||
return -RIG_EINVAL;
|
||||
if(arg==NULL)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
rig->callbacks.pltune = cb;
|
||||
rig->callbacks.pltune_arg = arg;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief control the transceive mode
|
||||
* \param rig The rig handle
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Hamlib Interface - event handling header
|
||||
* Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton
|
||||
* Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton
|
||||
*
|
||||
* $Id: event.h,v 1.2 2001-07-13 19:08:15 f4cfe Exp $
|
||||
* $Id: event.h,v 1.3 2003-08-17 22:39:07 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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Hamlib Interface - toolbox
|
||||
* Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton
|
||||
*
|
||||
* $Id: misc.c,v 1.26 2003-06-22 19:39:31 fillods Exp $
|
||||
* $Id: misc.c,v 1.27 2003-08-17 22:39:07 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
|
||||
|
@ -708,6 +708,7 @@ static struct {
|
|||
{ RIG_SCAN_PROG, "PROG" },
|
||||
{ RIG_SCAN_DELTA, "DELTA" },
|
||||
{ RIG_SCAN_VFO, "VFO" },
|
||||
{ RIG_SCAN_PLT, "PLT" },
|
||||
{ RIG_SCAN_NONE, NULL },
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Hamlib Interface - main file
|
||||
* Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton
|
||||
*
|
||||
* $Id: rig.c,v 1.74 2003-06-22 21:37:42 fillods Exp $
|
||||
* $Id: rig.c,v 1.75 2003-08-17 22:39:07 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
|
||||
|
@ -466,6 +466,7 @@ int rig_open(RIG *rig)
|
|||
break;
|
||||
case RIG_DCD_SERIAL_DSR:
|
||||
case RIG_DCD_SERIAL_CTS:
|
||||
case RIG_DCD_SERIAL_CAR:
|
||||
rs->dcdport.fd = ser_open(&rs->dcdport);
|
||||
if (rs->dcdport.fd < 0)
|
||||
rig_debug(RIG_DEBUG_ERR, "Cannot open DCD device \"%s\"\n",
|
||||
|
@ -583,6 +584,7 @@ int rig_close(RIG *rig)
|
|||
break;
|
||||
case RIG_DCD_SERIAL_DSR:
|
||||
case RIG_DCD_SERIAL_CTS:
|
||||
case RIG_DCD_SERIAL_CAR:
|
||||
ser_close(&rs->dcdport);
|
||||
break;
|
||||
case RIG_DCD_PARALLEL:
|
||||
|
@ -1247,6 +1249,7 @@ int rig_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
|
|||
|
||||
case RIG_DCD_SERIAL_CTS:
|
||||
case RIG_DCD_SERIAL_DSR:
|
||||
case RIG_DCD_SERIAL_CAR:
|
||||
ser_dcd_get(&rig->state.dcdport, dcd);
|
||||
break;
|
||||
case RIG_DCD_PARALLEL:
|
||||
|
|
81
src/serial.c
81
src/serial.c
|
@ -4,7 +4,7 @@
|
|||
* Parts of the PTT handling are derived from soundmodem, an excellent
|
||||
* ham packet softmodem written by Thomas Sailer, HB9JNX.
|
||||
*
|
||||
* $Id: serial.c,v 1.33 2003-08-15 01:25:26 fillods Exp $
|
||||
* $Id: serial.c,v 1.34 2003-08-17 22:39:07 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
|
||||
|
@ -436,7 +436,7 @@ int ser_close(port_t *p)
|
|||
#endif
|
||||
}
|
||||
|
||||
int ser_set_rts(const port_t *p, int state)
|
||||
int ser_set_rts(port_t *p, int state)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
/*
|
||||
|
@ -449,7 +449,25 @@ int ser_set_rts(const port_t *p, int state)
|
|||
#endif
|
||||
}
|
||||
|
||||
int ser_set_dtr(const port_t *p, int state)
|
||||
/*
|
||||
* assumes state not NULL
|
||||
* p is supposed to be &rig->state.rigport
|
||||
*/
|
||||
int ser_get_rts(port_t *p, int *state)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
/* TODO... */
|
||||
return -RIG_ENIMPL;
|
||||
#else
|
||||
int status;
|
||||
unsigned int y;
|
||||
status = ioctl(p->fd, TIOCMGET, &y);
|
||||
*state = (y & TIOCM_RTS) ? RIG_PTT_ON:RIG_PTT_OFF;
|
||||
return RIG_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
int ser_set_dtr(port_t *p, int state)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
return !EscapeCommFunction(p->handle, state ? SETDTR : CLRDTR);
|
||||
|
@ -459,6 +477,38 @@ int ser_set_dtr(const port_t *p, int state)
|
|||
#endif
|
||||
}
|
||||
|
||||
int ser_get_dtr(port_t *p, int *state)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
/* TODO... */
|
||||
return -RIG_ENIMPL;
|
||||
#else
|
||||
int status;
|
||||
unsigned char y;
|
||||
status = ioctl(p->fd, TIOCMGET, &y);
|
||||
*state = (y & TIOCM_DTR) ? RIG_PTT_ON:RIG_PTT_OFF;
|
||||
return status;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* assumes state not NULL
|
||||
* p is supposed to be &rig->state.rigport
|
||||
*/
|
||||
int ser_get_dcd(port_t *p, int *state)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
/* TODO... */
|
||||
return -RIG_ENIMPL;
|
||||
#else
|
||||
int status;
|
||||
unsigned int y;
|
||||
status = ioctl(p->fd, TIOCMGET, &y);
|
||||
*state = (y & TIOCM_CAR) ? RIG_DCD_ON:RIG_DCD_OFF;
|
||||
return RIG_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* p is supposed to be &rig->state.pttport
|
||||
*/
|
||||
|
@ -484,29 +534,10 @@ int ser_ptt_get(port_t *p, ptt_t *pttx)
|
|||
{
|
||||
|
||||
switch(p->type.ptt) {
|
||||
#if defined(WIN32)
|
||||
/* TODO... */
|
||||
#else
|
||||
case RIG_PTT_SERIAL_RTS:
|
||||
{
|
||||
unsigned char y;
|
||||
int status;
|
||||
|
||||
status = ioctl(p->fd, TIOCMGET, &y);
|
||||
*pttx = y & TIOCM_RTS ? RIG_PTT_ON:RIG_PTT_OFF;
|
||||
return status;
|
||||
}
|
||||
|
||||
return ser_get_rts(p, &pttx);
|
||||
case RIG_PTT_SERIAL_DTR:
|
||||
{
|
||||
unsigned char y;
|
||||
int status;
|
||||
|
||||
status = ioctl(p->fd, TIOCMGET, &y);
|
||||
*pttx = y & TIOCM_DTR ? RIG_PTT_ON:RIG_PTT_OFF;
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
return ser_get_dtr(p, &pttx);
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"Unsupported PTT type %d\n",
|
||||
p->type.ptt);
|
||||
|
@ -546,6 +577,8 @@ int ser_dcd_get(port_t *p, dcd_t *dcdx)
|
|||
return status;
|
||||
}
|
||||
#endif
|
||||
case RIG_DCD_SERIAL_CAR:
|
||||
return ser_get_dcd(p, &dcdx);
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"Unsupported DCD type %d\n",
|
||||
p->type.dcd);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Hamlib Interface - serial communication header
|
||||
* Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton
|
||||
*
|
||||
* $Id: serial.h,v 1.19 2003-06-22 19:50:36 fillods Exp $
|
||||
* $Id: serial.h,v 1.20 2003-08-17 22:39:07 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
|
||||
|
@ -37,8 +37,11 @@ int ser_close(port_t *p);
|
|||
int ser_ptt_set(port_t *p, ptt_t pttx);
|
||||
int ser_ptt_get(port_t *p, ptt_t *pttx);
|
||||
int ser_dcd_get(port_t *p, dcd_t *dcdx);
|
||||
int ser_set_rts(const port_t *p, int state);
|
||||
int ser_set_dtr(const port_t *p, int state);
|
||||
extern HAMLIB_EXPORT(int) ser_set_rts(port_t *p, int state);
|
||||
extern HAMLIB_EXPORT(int) ser_get_rts(port_t *p, int *state);
|
||||
int ser_set_dtr(port_t *p, int state);
|
||||
int ser_get_dtr(port_t *p, int *state);
|
||||
extern HAMLIB_EXPORT(int) ser_get_dcd(port_t *p, int *state);
|
||||
int par_open(port_t *p);
|
||||
int par_close(port_t *p);
|
||||
int par_ptt_set(port_t *p, ptt_t pttx);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* This programs dumps the capabilities of a backend rig.
|
||||
*
|
||||
*
|
||||
* $Id: dumpcaps.c,v 1.37 2003-04-06 18:40:35 fillods Exp $
|
||||
* $Id: dumpcaps.c,v 1.38 2003-08-17 22:39:07 fillods Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -132,6 +132,9 @@ int dumpcaps (RIG* rig)
|
|||
case RIG_DCD_SERIAL_DSR:
|
||||
printf("thru serial port (DTR/DSR)\n");
|
||||
break;
|
||||
case RIG_DCD_SERIAL_CAR:
|
||||
printf("thru serial port (CD)\n");
|
||||
break;
|
||||
case RIG_DCD_NONE:
|
||||
printf("None\n");
|
||||
break;
|
||||
|
|
|
@ -57,7 +57,7 @@ Supported types are RIG, DTR, RTS, PARALLEL, NONE.
|
|||
.B \-d, --dcd-type=type
|
||||
Use \fBtype\fP device as the kind of the Data Carrier Detect device
|
||||
to operate on.
|
||||
Supported types are RIG, DSR, CTS, PARALLEL, NONE.
|
||||
Supported types are RIG, DSR, CTS, CD, PARALLEL, NONE.
|
||||
.TP
|
||||
.B \-s, --serial-speed=baud
|
||||
Set serial speed to \fBbaud\fP rate. Uses maximal rig speed as default.
|
||||
|
@ -236,7 +236,7 @@ Perform VFO operation:
|
|||
CPY, XCHG, FROM_VFO, TO_VFO, MCL, UP, DOWN, BAND_UP, BAND_DOWN, LEFT, RIGHT, TUNER.
|
||||
.TP
|
||||
.B g, scan_op
|
||||
Perform scan operation/channel: STOP, MEM, SLCT, PRIO, DELTA.
|
||||
Perform scan operation/channel: STOP, MEM, SLCT, PRIO, DELTA, VFO, PLT.
|
||||
.TP
|
||||
.B H, set_channel
|
||||
Set memory channel data. Not implemented yet.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* It takes commands in interactive mode as well as
|
||||
* from command line options.
|
||||
*
|
||||
* $Id: rigctl.c,v 1.43 2003-05-03 13:17:25 fillods Exp $
|
||||
* $Id: rigctl.c,v 1.44 2003-08-17 22:39:07 fillods Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -369,6 +369,8 @@ int main (int argc, char *argv[])
|
|||
dcd_type = RIG_DCD_SERIAL_DSR;
|
||||
else if (!strcmp(optarg, "CTS"))
|
||||
dcd_type = RIG_DCD_SERIAL_CTS;
|
||||
else if (!strcmp(optarg, "CD"))
|
||||
dcd_type = RIG_DCD_SERIAL_CAR;
|
||||
else if (!strcmp(optarg, "PARALLEL"))
|
||||
dcd_type = RIG_DCD_PARALLEL;
|
||||
else if (!strcmp(optarg, "NONE"))
|
||||
|
|
Ładowanie…
Reference in New Issue