Initial release of skeleton for Drake backend

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1106 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.4
Stéphane Fillod, F8CFE 2002-07-08 22:10:43 +00:00
rodzic 2bcabfe0fb
commit 4ef4a45099
4 zmienionych plików z 265 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,8 @@
DRAKESRC = r8b.c
lib_LTLIBRARIES = libhamlib-drake.la
libhamlib_drake_la_SOURCES = $(DRAKESRC) drake.c
libhamlib_drake_la_LDFLAGS = -no-undefined -module -version-info 0:0:0
libhamlib_drake_la_LIBADD = ../src/libhamlib.la
noinst_HEADERS = drake.h

101
drake/drake.c 100644
Wyświetl plik

@ -0,0 +1,101 @@
/*
* Hamlib Drake backend - main file
* Copyright (c) 2001,2002 by Stephane Fillod
*
* $Id: drake.c,v 1.1 2002-07-08 22:10:43 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 <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <sys/ioctl.h>
#include <math.h>
#include <hamlib/rig.h>
#include <serial.h>
#include <misc.h>
#include "drake.h"
/*
* This is a skeleton backend. Please fill in the gaps.
*/
#define BUFSZ 64
/*
* drake_transaction
* We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL
*
* FIXME: this is a skeleton, rewrite me for Drake protocol
*/
int drake_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len)
{
int retval;
struct rig_state *rs;
rs = &rig->state;
serial_flush(&rs->rigport);
retval = write_block(&rs->rigport, cmd, cmd_len);
if (retval != RIG_OK)
return retval;
/* no data expected, TODO: flush input? */
if (!data || !data_len)
return 0;
*data_len = read_string(&rs->rigport, data, BUFSZ, "\x0a", 1);
return RIG_OK;
}
/*
* drake_set_freq
* Assumes rig!=NULL
*/
int drake_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
return -RIG_ENIMPL;
}
/*
* initrigs_drake is called by rig_backend_load
*/
int initrigs_drake(void *be_handle)
{
rig_debug(RIG_DEBUG_VERBOSE, "drake: _init called\n");
rig_register(&r8b_caps);
return RIG_OK;
}

37
drake/drake.h 100644
Wyświetl plik

@ -0,0 +1,37 @@
/*
* Hamlib Drake backend - main header
* Copyright (c) 2001,2002 by Stephane Fillod
*
* $Id: drake.h,v 1.1 2002-07-08 22:10:43 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.
*
*/
#ifndef _DRAKE_H
#define _DRAKE_H 1
#include <hamlib/rig.h>
int drake_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
extern const struct rig_caps r8b_caps;
extern BACKEND_EXPORT(int) initrigs_drake(void *be_handle);
#endif /* _DRAKE_H */

119
drake/r8b.c 100644
Wyświetl plik

@ -0,0 +1,119 @@
/*
* Hamlib Drake backend - R-8B description
* Copyright (c) 2001 by Stephane Fillod
*
* $Id: r8b.c,v 1.1 2002-07-08 22:10:43 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 <hamlib/rig.h>
#include "drake.h"
/* FIXME! */
#define R8B_MODES (RIG_MODE_NONE)
#define R8B_FUNC (RIG_FUNC_NONE)
#define R8B_LEVEL_ALL (RIG_LEVEL_NONE)
#define R8B_PARM_ALL (RIG_PARM_NONE)
#define R8B_VFO RIG_VFO_A
/*
* R-8B rig capabilities.
*
* TODO: check this with manual or web site.
*/
const struct rig_caps r8b_caps = {
rig_model: RIG_MODEL_DKR8B,
model_name:"R-8B",
mfg_name: "Drake",
version: "0.1",
copyright: "LGPL",
status: RIG_STATUS_ALPHA,
rig_type: RIG_TYPE_RECEIVER,
ptt_type: RIG_PTT_NONE,
dcd_type: RIG_DCD_NONE,
port_type: RIG_PORT_SERIAL,
serial_rate_min: 9600,
serial_rate_max: 9600,
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: R8B_FUNC,
has_set_func: R8B_FUNC,
has_get_level: R8B_LEVEL_ALL,
has_set_level: RIG_LEVEL_SET(R8B_LEVEL_ALL),
has_get_parm: R8B_PARM_ALL,
has_set_parm: RIG_PARM_SET(R8B_PARM_ALL),
level_gran: {}, /* FIXME: granularity */
parm_gran: {},
ctcss_list: NULL,
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: 0,
chan_desc_sz: 0,
chan_list: {
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(956),R8B_MODES,-1,-1,R8B_VFO}, // FIXME
RIG_FRNG_END,
},
tx_range_list2: { RIG_FRNG_END, },
tuning_steps: {
{R8B_MODES,10}, /* FIXME: add other ts */
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: drake_set_freq,
};
/*
* Function definitions below
*/