Merge upstream changes and fix conflicts

pull/892/head
Mikael Nousiainen 2021-12-12 23:05:26 +02:00
commit 56c95b1529
134 zmienionych plików z 5815 dodań i 1639 usunięć

8
NEWS
Wyświetl plik

@ -6,14 +6,20 @@ Copyright (C) 2000-2021 Michael Black W9MDB, and others
Please send Hamlib bug reports to hamlib-developer@lists.sourceforge.net
Version 4.5
* 202?-??-??
Version 4.4
* 2021-??-??
* 2021-12-02
* Icom rigs now default filter 2 when setting PKTUSB but user can override
* Fix FTDX9000 meter readings
* Add Android sensor as a rotator
* Added rig_get_vfo to some Icom rigs that have XCHG or 0x25 command capability
* Added ability to build hamlib with docker
* Added M0NKA mcHF URP rig
* Faster serial i/o noticeable on higher baud rates
* IC7300/9700/7800/785x set_clock/get_clock routines added -- no auto set yet
* Yaesu FT1200/891/991/DX10/DX101/DX101MP set_clock/get_clock routines added
Version 4.3.1
* 2021-09-14

Wyświetl plik

@ -126,7 +126,7 @@ int kpa_transaction(AMP *amp, const char *cmd, char *response, int response_len)
if (err != RIG_OK) { return err; }
len = read_string(&rs->ampport, response, response_len, ";", 1, 0);
len = read_string(&rs->ampport, response, response_len, ";", 1, 0, 1);
if (len < 0) { return len; }
}
@ -140,7 +140,7 @@ int kpa_transaction(AMP *amp, const char *cmd, char *response, int response_len)
if (response) // if response expected get it
{
response[0] = 0;
len = read_string(&rs->ampport, response, response_len, ";", 1, 0);
len = read_string(&rs->ampport, response, response_len, ";", 1, 0, 1);
if (len < 0)
{
@ -166,7 +166,7 @@ int kpa_transaction(AMP *amp, const char *cmd, char *response, int response_len)
if (err != RIG_OK) { return err; }
len = read_string(&rs->ampport, responsebuf, KPABUFSZ, ";", 1, 0);
len = read_string(&rs->ampport, responsebuf, KPABUFSZ, ";", 1, 0, 1);
if (len < 0) { return len; }
}
@ -369,7 +369,8 @@ int kpa_get_level(AMP *amp, setting_t level, value_t *val)
//
do
{
retval = read_string(&rs->ampport, responsebuf, sizeof(responsebuf), ";", 1, 0);
retval = read_string(&rs->ampport, responsebuf, sizeof(responsebuf), ";", 1, 0,
1);
if (retval != RIG_OK) { return retval; }

Wyświetl plik

@ -14,7 +14,7 @@ dnl Please do not use '-' in the version number, as package managers will fail,
dnl however, the use of '~' should be fine as apt (others?) will treat
dnl it as an earlier version than the actual release. TNX KA6MAL
dnl PACKAGE_NAME + " " + PACKAGE_VERSION must not exceed 20 chars!
AC_INIT([Hamlib],[4.4~git],[hamlib-developer@lists.sourceforge.net],[hamlib],[http://www.hamlib.org])
AC_INIT([Hamlib],[4.5~git],[hamlib-developer@lists.sourceforge.net],[hamlib],[http://www.hamlib.org])
AC_CONFIG_SRCDIR([include/hamlib/rig.h])
AC_CONFIG_MACRO_DIR([macros])
@ -56,7 +56,7 @@ dnl See README.release on setting these values
# Values given to -version-info when linking. See libtool documentation.
# Set them here to keep c++/Makefile and src/Makefile in sync.
ABI_VERSION=4
ABI_REVISION=4
ABI_REVISION=5
ABI_AGE=0
AC_DEFINE_UNQUOTED([ABI_VERSION], [$ABI_VERSION], [Frontend ABI version])

Wyświetl plik

@ -80,7 +80,7 @@ CHECK="\
if test $# -eq 0 ; then
echo "See cppcheck.log when done"
echo "This takes a while to run"
cppcheck --inline-suppr \
strace -f cppcheck --inline-suppr \
-I src \
-I include \
--include=include/config.h \

Wyświetl plik

@ -1136,6 +1136,35 @@ option above, will terminate each command string sent to the radio. This
character should not be a part of the input string.
.
.TP
.BR set_clock " \(aq" \fIDateTime\fP \(aq
Set
.RI \(aq DateTime \(aq
.IP
Sets rig clock -- note that some rigs do not handle seconds or milliseconds.
If you try to set sec/msec and rig does not support it you will get a debug warning message.
Format is ISO8601,
.EX
Formats accepted
YYYY-MM-DDTHH:MM:SS.SSS+ZZ (where +ZZ is either -/+ UTC offset)
YYYY-MM-DDTHH:MM:SS+ZZ
YYYY-MM-DDTHH:MM+ZZ
YYYY-MM-DD (sets date only)
Note: Icom rigs expect you to set local time and the hours off to UTC.
So...4PM EST example would be 2021-12-01T16:00:00+05
But...if you want to display GMT you must set the clock for GMT with zero UTC offset.
Hopefully Icom will allow displaying either clock in the future
.EE
.
.TP
.BR get_clock
Get
.RI \(aq RigTime \(aq
.IP
Gets rig clock -- note that some rigs do not handle seconds or milliseconds.
Format is ISO8601 YYYY-MM-DDTHH:MM:SS.sss+ZZ where +ZZ is either -/+ UTC offset
.
.TP
.BR chk_vfo
Get
.RI \(aq Status \(aq

Wyświetl plik

@ -1077,6 +1077,29 @@ and
also need to be provided as output power may vary according to these values.
.IP
VFO parameter is not used in VFO mode.
.TP
.BR set_clock " \(aq" \fIDateTime\fP \(aq
Set
.RI \(aq DateTime \(aq
.IP
Sets rig clock -- note that some rigs do not handle seconds or milliseconds.
If you try to set that you will get a debug warning message.
Format is ISO8601.
.EX
Formats accepted
YYYY-MM-DDTHH:MM:SS.sss+ZZ (where +ZZ is either -/+ UTC offset)
YYYY-MM-DDTHH:MM:SS+ZZ
YYYY-MM-DDTHH:MM+ZZ
YYYY-MM-DD (sets date only)
.EE
.
.TP
.BR get_clock
Get
.RI \(aq RigTime \(aq
.IP
Gets rig clock -- note that some rigs do not handle seconds or milliseconds.
Format is ISO8601 YYYY-MM-DDTHH:MM:SS.sss+ZZ where +ZZ is either -/+ UTC offset
.
.TP
.B chk_vfo

Wyświetl plik

@ -905,7 +905,7 @@ typedef uint64_t rig_level_e;
#define RIG_LEVEL_AF CONSTANT_64BIT_FLAG(3) /*!< \c AF -- Volume, arg float [0.0 ... 1.0] */
#define RIG_LEVEL_RF CONSTANT_64BIT_FLAG(4) /*!< \c RF -- RF gain (not TX power) arg float [0.0 ... 1.0] */
#define RIG_LEVEL_SQL CONSTANT_64BIT_FLAG(5) /*!< \c SQL -- Squelch, arg float [0.0 ... 1.0] */
#define RIG_LEVEL_IF CONSTANT_64BIT_FLAG(6) /*!< \c IF -- IF, arg int (Hz) */
#define RIG_LEVEL_IF CONSTANT_64BIT_FLAG(6) /*!< \c IF shift -- IF, arg int (+/-Hz) */
#define RIG_LEVEL_APF CONSTANT_64BIT_FLAG(7) /*!< \c APF -- Audio Peak Filter, arg float [0.0 ... 1.0] */
#define RIG_LEVEL_NR CONSTANT_64BIT_FLAG(8) /*!< \c NR -- Noise Reduction, arg float [0.0 ... 1.0] */
#define RIG_LEVEL_PBT_IN CONSTANT_64BIT_FLAG(9) /*!< \c PBT_IN -- Twin PBT (inside) arg float [0.0 ... 1.0] */
@ -1986,6 +1986,8 @@ struct rig_caps {
rmode_t *mode,
pbwidth_t *width,
split_t *split);
int(*set_clock) (RIG *rig, int year, int month, int day, int hour, int min, int sec, double msec, int utc_offset);
int(*get_clock) (RIG *rig, int *year, int *month, int *day, int *hour, int *min, int *sec, double *msec, int *utc_offset);
const char *clone_combo_set; /*!< String describing key combination to enter load cloning mode */
const char *clone_combo_get; /*!< String describing key combination to enter save cloning mode */
@ -2223,6 +2225,8 @@ typedef hamlib_port_t port_t;
#define HAMLIB_ELAPSED_SET 1
#define HAMLIB_ELAPSED_INVALIDATE 2
#define HAMLIB_CACHE_ALWAYS -1 /*< value to set cache timeout to always use cache */
typedef enum {
HAMLIB_CACHE_ALL, // to set all cache timeouts at once
HAMLIB_CACHE_VFO,
@ -3126,6 +3130,11 @@ extern HAMLIB_EXPORT_VAR(char) debugmsgsave3[DEBUGMSGSAVE_SIZE]; // last-2 debu
#define rig_debug(debug_level,fmt,...) do { strncpy(debugmsgsave3, debugmsgsave2,sizeof(debugmsgsave3));strncpy(debugmsgsave2, debugmsgsave, sizeof(debugmsgsave2));snprintf(debugmsgsave,sizeof(debugmsgsave),fmt,__VA_ARGS__);rig_debug(debug_level,fmt,##__VA_ARGS__); } while(0);
#endif
#endif
// Measuring elapsed time -- local variable inside function when macro is used
#define ELAPSED1 struct timespec __begin; elapsed_ms(&__begin, HAMLIB_ELAPSED_SET);
#define ELAPSED2 rig_debug(RIG_DEBUG_TRACE, "%s: elapsed=%.0lfms\n", __func__, elapsed_ms(&__begin, HAMLIB_ELAPSED_GET));
extern HAMLIB_EXPORT(void)
rig_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level,
const char *fmt, ...));
@ -3210,16 +3219,14 @@ extern HAMLIB_EXPORT(int) rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rm
extern HAMLIB_EXPORT(int) rig_get_rig_info(RIG *rig, char *response, int max_response_len);
extern HAMLIB_EXPORT(int) rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int * cache_ms_freq, rmode_t *mode, int *cache_ms_mode, pbwidth_t *width, int *cache_ms_width);
extern HAMLIB_EXPORT(int) rig_set_clock(RIG *rig, int year, int month, int day, int hour, int min, int sec, double msec, int utc_offset);
extern HAMLIB_EXPORT(int) rig_get_clock(RIG *rig, int *year, int *month, int *day, int *hour, int *min, int *sec, double *msec, int *utc_offset);
typedef unsigned long rig_useconds_t;
extern HAMLIB_EXPORT(int) hl_usleep(rig_useconds_t msec);
extern HAMLIB_EXPORT(int) rig_cookie(RIG *rig, enum cookie_e cookie_cmd, char *cookie, int cookie_len);
// two functions globally accessible so rig backends can lock for an I/O transaction
void rig_lock();
void rig_unlock();
//! @endcond
__END_DECLS

Wyświetl plik

@ -70,6 +70,7 @@
#define RIG_MODEL_FLRIG RIG_MAKE_MODEL(RIG_DUMMY, 4)
#define RIG_MODEL_TRXMANAGER_RIG RIG_MAKE_MODEL(RIG_DUMMY, 5)
#define RIG_MODEL_DUMMY_NOVFO RIG_MAKE_MODEL(RIG_DUMMY, 6)
#define RIG_MODEL_TCI1X RIG_MAKE_MODEL(RIG_DUMMY, 7)
/*

Wyświetl plik

@ -1722,6 +1722,7 @@ int win32_serial_read(int fd, void *vb, int size)
return (total);
#if 0
if (size > 0)
{
now = GetTickCount();
@ -1923,6 +1924,7 @@ int win32_serial_read(int fd, void *vb, int size)
total += nBytes;
return (total);
#if 0
if (size > 0)
{
now = GetTickCount();

114
macros/ax_python_devel.m4 100644 → 100755
Wyświetl plik

@ -67,7 +67,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 21
#serial 23
AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
AC_DEFUN([AX_PYTHON_DEVEL],[
@ -109,7 +109,6 @@ to something else than an empty string.
fi
else
AC_MSG_RESULT([yes])
sysconfig="distutils.sysconfig"
fi
#
@ -133,41 +132,28 @@ variable to configure. See ``configure --help'' for reference.
fi
fi
#
#
# Check for a version of Python >= 3.0.0
#
AC_MSG_CHECKING([for a version of Python >= '3.0.0'])
ac_supports_python3_ver=`$PYTHON -c "import sys; \
ver = sys.version.split ()[[0]]; \
print (ver >= '3.0.0')"`
if test "$ac_supports_python3_ver" != "True"; then
if test -z "$PYTHON_NOVERSIONCHECK"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([skip at user request])
fi
else
sysconfig="sysconfig"
PYTHON_CPPFLAGS=`python3-config --includes`
PYTHON_EXTRA_LDFLAGS=`python3-config --ldflags`
AC_MSG_RESULT([yes])
fi
#
# Check if you have distutils, else fail
#
AC_MSG_CHECKING([for the distutils Python package])
ac_distutils_result=`$PYTHON -c "import $sysconfig" 2>&1`
AC_MSG_CHECKING([for the sysconfig Python package])
ac_sysconfig_result=`$PYTHON -c "import sysconfig" 2>&1`
if test $? -eq 0; then
AC_MSG_RESULT([yes])
IMPORT_SYSCONFIG="import sysconfig"
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([cannot import Python module "distutils".
AC_MSG_CHECKING([for the distutils Python package])
ac_sysconfig_result=`$PYTHON -c "from distutils import sysconfig" 2>&1`
if test $? -eq 0; then
AC_MSG_RESULT([yes])
IMPORT_SYSCONFIG="from distutils import sysconfig"
else
AC_MSG_ERROR([cannot import Python module "distutils".
Please check your Python installation. The error was:
$ac_distutils_result])
PYTHON_VERSION=""
$ac_sysconfig_result])
PYTHON_VERSION=""
fi
fi
#
@ -175,10 +161,19 @@ $ac_distutils_result])
#
AC_MSG_CHECKING([for Python include path])
if test -z "$PYTHON_CPPFLAGS"; then
python_path=`$PYTHON -c "import $sysconfig; \
print ($sysconfig.get_python_inc ());"`
plat_python_path=`$PYTHON -c "import $sysconfig; \
print ($sysconfig.get_python_inc (plat_specific=1));"`
if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
# sysconfig module has different functions
python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
print (sysconfig.get_path ('include'));"`
plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
print (sysconfig.get_path ('platinclude'));"`
else
# old distutils way
python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
print (sysconfig.get_python_inc ());"`
plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
print (sysconfig.get_python_inc (plat_specific=1));"`
fi
if test -n "${python_path}"; then
if test "${plat_python_path}" != "${python_path}"; then
python_path="-I$python_path -I$plat_python_path"
@ -202,7 +197,7 @@ $ac_distutils_result])
# join all versioning strings, on some systems
# major/minor numbers could be in different list elements
from $sysconfig import *
from sysconfig import *
e = get_config_var('VERSION')
if e is not None:
print(e)
@ -225,8 +220,8 @@ EOD`
ac_python_libdir=`cat<<EOD | $PYTHON -
# There should be only one
import $sysconfig
e = $sysconfig.get_config_var('LIBDIR')
$IMPORT_SYSCONFIG
e = sysconfig.get_config_var('LIBDIR')
if e is not None:
print (e)
EOD`
@ -234,8 +229,8 @@ EOD`
# Now, for the library:
ac_python_library=`cat<<EOD | $PYTHON -
import $sysconfig
c = $sysconfig.get_config_vars()
$IMPORT_SYSCONFIG
c = sysconfig.get_config_vars()
if 'LDVERSION' in c:
print ('python'+c[['LDVERSION']])
else:
@ -254,9 +249,9 @@ EOD`
else
# old way: use libpython from python_configdir
ac_python_libdir=`$PYTHON -c \
"from $sysconfig import get_python_lib as f; \
"from sysconfig import get_python_lib as f; \
import os; \
print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
print ('Using old way' + os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
PYTHON_LIBS="-L$ac_python_libdir -lpython$ac_python_version"
fi
@ -273,21 +268,46 @@ EOD`
#
# Check for site packages
#
AC_MSG_CHECKING([for Python site-packages path])
AC_MSG_CHECKING([for Python site-packages pathXX $PYTHON_SITE_PKG])
if test -z "$PYTHON_SITE_PKG"; then
PYTHON_SITE_PKG=`$PYTHON -c "import $sysconfig; \
print ($sysconfig.get_python_lib(0,0));"`
AC_MSG_CHECKING([Using PYTHON_SITE_PKG])
if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
print (sysconfig.get_path('purelib'));"`
else
AC_MSG_CHECKING([Using old way])
# distutils.sysconfig way
PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
print (sysconfig.get_python_lib(0,0));"`
fi
fi
AC_MSG_RESULT([$PYTHON_SITE_PKG])
AC_SUBST([PYTHON_SITE_PKG])
#
# Check for platform-specific site packages
#
AC_MSG_CHECKING([for Python platform specific site-packages path])
if test -z "$PYTHON_SITE_PKG"; then
if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
print (sysconfig.get_path('platlib'));"`
else
# distutils.sysconfig way
PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
print (sysconfig.get_python_lib(1,0));"`
fi
fi
AC_MSG_RESULT([$PYTHON_PLATFORM_SITE_PKG])
AC_SUBST([PYTHON_PLATFORM_SITE_PKG])
#
# libraries which must be linked in when embedding
#
AC_MSG_CHECKING(python extra libraries)
if test -z "$PYTHON_EXTRA_LIBS"; then
PYTHON_EXTRA_LIBS=`$PYTHON -c "import $sysconfig; \
conf = $sysconfig.get_config_var; \
PYTHON_EXTRA_LIBS=`$PYTHON -c "$IMPORT_SYSCONFIG; \
conf = sysconfig.get_config_var; \
print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
fi
AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
@ -298,8 +318,8 @@ EOD`
#
AC_MSG_CHECKING(python extra linking flags)
if test -z "$PYTHON_EXTRA_LDFLAGS"; then
PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import $sysconfig; \
conf = $sysconfig.get_config_var; \
PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "$IMPORT_SYSCONFIG; \
conf = sysconfig.get_config_var; \
print (conf('LINKFORSHARED'))"`
fi
AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])

Wyświetl plik

@ -1294,7 +1294,7 @@ int adat_receive(RIG *pRig,
"*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = %p\n",
gFnLevel, __func__, __FILE__, __LINE__, pRig);
nRC = read_string(&pRigState->rigport, pcData, ADAT_RESPSZ, ADAT_EOL, 1, 0);
nRC = read_string(&pRigState->rigport, pcData, ADAT_RESPSZ, ADAT_EOL, 1, 0, 1);
if (nRC > 0)
{
@ -3726,7 +3726,7 @@ DECLARE_PROBERIG_BACKEND(adat)
nRC = write_block(port,
ADAT_CMD_DEF_STRING_GET_ID_CODE,
strlen(ADAT_CMD_DEF_STRING_GET_ID_CODE));
nRead = read_string(port, acBuf, ADAT_RESPSZ, ADAT_EOM, 1, 0);
nRead = read_string(port, acBuf, ADAT_RESPSZ, ADAT_EOM, 1, 0, 1);
close(port->fd);
if ((nRC != RIG_OK || nRead < 0))

Wyświetl plik

@ -321,7 +321,7 @@ int dx77_transaction(RIG *rig,
* Transceiver sends an echo of cmd followed by a CR/LF
* TODO: check whether cmd and echobuf match (optional)
*/
retval = read_string(&rs->rigport, echobuf, BUFSZ, LF, strlen(LF), 0);
retval = read_string(&rs->rigport, echobuf, BUFSZ, LF, strlen(LF), 0, 1);
if (retval < 0)
{
@ -337,7 +337,7 @@ int dx77_transaction(RIG *rig,
/* no data expected, check for OK returned */
if (data == NULL)
{
retval = read_string(&rs->rigport, echobuf, BUFSZ, LF, strlen(LF), 0);
retval = read_string(&rs->rigport, echobuf, BUFSZ, LF, strlen(LF), 0, 1);
if (retval < 0)
{
@ -358,7 +358,7 @@ int dx77_transaction(RIG *rig,
}
}
retval = read_string(&rs->rigport, data, BUFSZ, LF, strlen(LF), 0);
retval = read_string(&rs->rigport, data, BUFSZ, LF, strlen(LF), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -264,7 +264,7 @@ int dxsr8_transaction(RIG *rig,
* Transceiver sends an echo of cmd followed by a CR/LF
* TODO: check whether cmd and echobuf match (optional)
*/
retval = read_string(&rs->rigport, replybuf, BUFSZ, LF, strlen(LF), 0);
retval = read_string(&rs->rigport, replybuf, BUFSZ, LF, strlen(LF), 0, 1);
if (retval < 0)
{
@ -272,7 +272,7 @@ int dxsr8_transaction(RIG *rig,
}
retval = read_string(&rs->rigport, replybuf, BUFSZ, LF, strlen(LF), 0);
retval = read_string(&rs->rigport, replybuf, BUFSZ, LF, strlen(LF), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -102,7 +102,7 @@ static int aor_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
/*
* Do wait for a reply
*/
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0);
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0, 1);
if (retval < 0)
{
@ -1428,7 +1428,8 @@ int aor_get_chan_all_cb(RIG *rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t arg)
/*
* get next line
*/
retval = read_string(&rig->state.rigport, chanbuf, BUFSZ, EOM, strlen(EOM), 0);
retval = read_string(&rig->state.rigport, chanbuf, BUFSZ, EOM, strlen(EOM), 0,
1);
if (retval < 0)
{

Wyświetl plik

@ -211,7 +211,7 @@ static int ar3k_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0);
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0, 1);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -247,7 +247,7 @@ static int ar3030_transaction(RIG *rig, const char *cmd, int cmd_len,
if (data)
{
/* expecting 0x0d0x0a on all commands so wait for the 0x0a */
retval = read_string(&rs->rigport, data, BUFSZ, "\x0a", 1, 0);
retval = read_string(&rs->rigport, data, BUFSZ, "\x0a", 1, 0, 1);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -307,7 +307,7 @@ static int sr2200_transaction(RIG *rig, const char *cmd, int cmd_len,
/*
* Do wait for a reply
*/
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0);
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -244,7 +244,7 @@ int barrett_transaction(RIG *rig, char *cmd, int expected, char **result)
{
// response format is 0x11,data...,0x0d,0x0a,0x13
retval = read_string(&rs->rigport, priv->ret_data, sizeof(priv->ret_data),
"\x11", 1, 0);
"\x11", 1, 0, 1);
rig_debug(RIG_DEBUG_VERBOSE, "%s: resultlen=%d\n", __func__,
(int)strlen(priv->ret_data));

Wyświetl plik

@ -60,7 +60,8 @@ struct dra818_priv
static int dra818_response(RIG *rig, const char *expected)
{
char response[80];
int r = read_string(&rig->state.rigport, response, sizeof(response), "\n", 1, 0);
int r = read_string(&rig->state.rigport, response, sizeof(response), "\n", 1, 0,
1);
if (r != strlen(expected))
{
@ -294,7 +295,7 @@ int dra818_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
(int)(priv->rx_freq / 1000000), (int)((priv->rx_freq % 1000000) / 100));
write_block(&rig->state.rigport, cmd, strlen(cmd));
r = read_string(&rig->state.rigport, response, sizeof(response), "\n", 1, 0);
r = read_string(&rig->state.rigport, response, sizeof(response), "\n", 1, 0, 1);
if (r != 5)
{

Wyświetl plik

@ -84,7 +84,7 @@ int drake_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, data, BUFSZ, LF, 1, 0);
retval = read_string(&rs->rigport, data, BUFSZ, LF, 1, 0, 1);
if (retval == -RIG_ETIMEOUT)
{
@ -1252,7 +1252,7 @@ DECLARE_PROBERIG_BACKEND(drake)
}
retval = write_block(port, "ID" EOM, 3);
id_len = read_string(port, idbuf, BUFSZ, LF, 1, 0);
id_len = read_string(port, idbuf, BUFSZ, LF, 1, 0, 1);
close(port->fd);

Wyświetl plik

@ -1,4 +1,4 @@
DUMMYSRC = dummy_common.c dummy_common.h dummy.c dummy.h rot_dummy.c rot_dummy.h netrigctl.c netrotctl.c flrig.c flrig.h trxmanager.c trxmanager.h amp_dummy.c amp_dummy.h netampctl.c
DUMMYSRC = dummy_common.c dummy_common.h dummy.c dummy.h rot_dummy.c rot_dummy.h netrigctl.c netrotctl.c flrig.c flrig.h trxmanager.c trxmanager.h amp_dummy.c amp_dummy.h netampctl.c tci1x.c
noinst_LTLIBRARIES = libhamlib-dummy.la
libhamlib_dummy_la_SOURCES = $(DUMMYSRC)

Wyświetl plik

@ -2140,6 +2140,55 @@ static int dummy_mW2power(RIG *rig, float *power, unsigned int mwpower,
RETURNFUNC(RIG_OK);
}
static int m_year, m_month, m_day, m_hour, m_min, m_sec, m_utc_offset;
static double m_msec;
int dummy_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
int sec, double msec, int utc_offset)
{
int retval = RIG_OK;
rig_debug(RIG_DEBUG_VERBOSE, "%s: %04d-%02d-%02dT%02d:%02d:%02d.%.03f%s%02d\n",
__func__, year,
month, day, hour, min, sec, msec, utc_offset >= 0 ? "+" : "-",
(unsigned)(abs(utc_offset)));
m_year = year;
m_month = month;
m_day = day;
if (hour >= 0)
{
m_hour = hour;
m_min = min;
m_sec = sec;
m_msec = msec;
m_utc_offset = utc_offset;
}
return retval;
}
int dummy_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int *min, int *sec, double *msec, int *utc_offset)
{
int retval = RIG_OK;
*year = m_year;
*month = m_month;
*day = m_day;
*hour = m_hour;
*min = m_min;
*sec = m_sec;
*msec = m_msec;
*utc_offset = m_utc_offset;
rig_debug(RIG_DEBUG_VERBOSE,
"%s: %02d-%02d-%02dT%02d:%02d:%02d:%0.3lf%s%02d\n'",
__func__, *year, *month, *day, *hour, *min, *sec, *msec,
*utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
return retval;
}
/*
* Dummy rig capabilities.
@ -2195,7 +2244,7 @@ struct rig_caps dummy_caps =
RIG_MODEL(RIG_MODEL_DUMMY),
.model_name = "Dummy",
.mfg_name = "Hamlib",
.version = "20210705.0",
.version = "20211130.0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_OTHER,
@ -2415,6 +2464,8 @@ struct rig_caps dummy_caps =
.get_trn = dummy_get_trn,
.power2mW = dummy_power2mW,
.mW2power = dummy_mW2power,
.set_clock = dummy_set_clock,
.get_clock = dummy_get_clock
};
struct rig_caps dummy_no_vfo_caps =
@ -2580,6 +2631,8 @@ struct rig_caps dummy_no_vfo_caps =
.get_trn = dummy_get_trn,
.power2mW = dummy_power2mW,
.mW2power = dummy_mW2power,
.set_clock = dummy_set_clock,
.get_clock = dummy_get_clock
};
DECLARE_INITRIG_BACKEND(dummy)
@ -2592,6 +2645,7 @@ DECLARE_INITRIG_BACKEND(dummy)
rig_register(&flrig_caps);
rig_register(&trxmanager_caps);
rig_register(&dummy_no_vfo_caps);
rig_register(&tci1x_caps);
RETURNFUNC(RIG_OK);
}

Wyświetl plik

@ -44,6 +44,7 @@ extern struct rig_caps dummy_no_vfo_caps;
extern struct rig_caps netrigctl_caps;
extern const struct rig_caps flrig_caps;
extern const struct rig_caps trxmanager_caps;
extern const struct rig_caps tci1x_caps;
int netrigctl_get_vfo_mode(RIG *);

Wyświetl plik

@ -144,7 +144,7 @@ const struct rig_caps flrig_caps =
RIG_MODEL(RIG_MODEL_FLRIG),
.model_name = "FLRig",
.mfg_name = "FLRig",
.version = "202101014.0",
.version = "20211206.0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -456,7 +456,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
}
int len = read_string(&rs->rigport, tmp_buf, sizeof(tmp_buf), delims,
strlen(delims), 0);
strlen(delims), 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: string='%s'\n", __func__, tmp_buf);
// if our first response we should see the HTTP header
@ -555,9 +555,10 @@ static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
int value_len)
{
char xml[MAXXMLLEN];
int retry = 5;
int retry = 3;
ENTERFUNC;
ELAPSED1;
if (value)
{
@ -569,7 +570,7 @@ static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
char *pxml;
int retval;
if (retry < 2)
if (retry != 3)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: cmd=%s, retry=%d\n", __func__, cmd, retry);
}
@ -601,8 +602,13 @@ static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
while (((value && strlen(value) == 0) || (strlen(xml) == 0))
&& retry--); // we'll do retries if needed
if (value && strlen(value) == 0) { RETURNFUNC(RIG_EPROTO); }
if (value && strlen(value) == 0)
{
rig_debug(RIG_DEBUG_ERR, "%s: no value returned\n", __func__);
RETURNFUNC(RIG_EPROTO);
}
ELAPSED2;
RETURNFUNC(RIG_OK);
}
@ -673,7 +679,8 @@ static const char *modeMapGetFLRig(rmode_t modeHamlib)
for (i = 0; modeMap[i].mode_hamlib != 0; ++i)
{
if (modeMap[i].mode_flrig == NULL) continue;
if (modeMap[i].mode_flrig == NULL) { continue; }
rig_debug(RIG_DEBUG_TRACE,
"%s: checking modeMap[%d]=%.0f to modeHamlib=%.0f, mode_flrig='%s'\n", __func__,
i, (double)modeMap[i].mode_hamlib, (double)modeHamlib, modeMap[i].mode_flrig);
@ -797,12 +804,13 @@ static int flrig_open(RIG *rig)
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: get_version failed: %s\nAssuming version < 1.3.54", __func__,
rig_debug(RIG_DEBUG_ERR,
"%s: get_version failed: %s\nAssuming version < 1.3.54", __func__,
rigerror(retval));
// we fall through and assume old version
}
int v1=0, v2=0, v3=0, v4=0;
int v1 = 0, v2 = 0, v3 = 0, v4 = 0;
sscanf(value, "%d.%d.%d.%d", &v1, &v2, &v3, &v4);
if (v1 >= 1 && v2 >= 3 && v3 >= 54)

Wyświetl plik

@ -52,7 +52,7 @@ static int netampctl_transaction(AMP *amp, char *cmd, int len, char *buf)
return ret;
}
ret = read_string(&amp->state.ampport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
ret = read_string(&amp->state.ampport, buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
if (ret < 0)
{
@ -95,7 +95,7 @@ static int netampctl_open(AMP *amp)
return -RIG_EPROTO;
}
ret = read_string(&amp->state.ampport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
ret = read_string(&amp->state.ampport, buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
if (ret <= 0)
{
@ -104,7 +104,7 @@ static int netampctl_open(AMP *amp)
do
{
ret = read_string(&amp->state.ampport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
ret = read_string(&amp->state.ampport, buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
if (ret > 0)
{

Wyświetl plik

@ -79,7 +79,7 @@ static int netrigctl_transaction(RIG *rig, char *cmd, int len, char *buf)
return ret;
}
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret < 0)
{
@ -122,8 +122,8 @@ static int netrigctl_vfostr(RIG *rig, char *vfostr, int len, vfo_t vfo)
if (vfo == RIG_VFO_NONE) { vfo = RIG_VFO_A; }
}
else if (vfo == RIG_VFO_RX) vfo = priv->rx_vfo;
else if (vfo == RIG_VFO_TX) vfo = priv->tx_vfo;
else if (vfo == RIG_VFO_RX) { vfo = priv->rx_vfo; }
else if (vfo == RIG_VFO_TX) { vfo = priv->tx_vfo; }
rig_debug(RIG_DEBUG_TRACE, "%s: vfo_opt=%d\n", __func__, rig->state.vfo_opt);
@ -274,6 +274,7 @@ static int netrigctl_open(RIG *rig)
if (sscanf(buf, "CHKVFO %d", &priv->rigctld_vfo_mode) == 1)
{
rig->state.vfo_opt = 1;
rig_debug(RIG_DEBUG_TRACE, "%s: chkvfo=%d\n", __func__, priv->rigctld_vfo_mode);
}
else if (ret == 2)
@ -311,14 +312,14 @@ static int netrigctl_open(RIG *rig)
return -RIG_EPROTO;
}
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
return (ret < 0) ? ret : -RIG_EPROTO;
}
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -329,7 +330,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
{
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -359,7 +360,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
{
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -401,7 +402,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_TSLSTSIZ; i++)
{
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -425,7 +426,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_FLTLSTSIZ; i++)
{
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -452,7 +453,7 @@ static int netrigctl_open(RIG *rig)
chan_t chan_list[HAMLIB_CHANLSTSIZ]; /*!< Channel list, zero ended */
#endif
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -461,7 +462,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->max_rit = rs->max_rit = atol(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -470,7 +471,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->max_xit = rs->max_xit = atol(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -479,7 +480,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->max_ifshift = rs->max_ifshift = atol(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -488,7 +489,7 @@ static int netrigctl_open(RIG *rig)
rs->announces = atoi(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -515,7 +516,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->preamp[ret] = rs->preamp[ret] = RIG_DBLST_END;
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -542,7 +543,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->attenuator[ret] = rs->attenuator[ret] = RIG_DBLST_END;
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -551,7 +552,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->has_get_func = rs->has_get_func = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -560,7 +561,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->has_set_func = rs->has_set_func = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -582,7 +583,7 @@ static int netrigctl_open(RIG *rig)
#endif
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -591,7 +592,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->has_set_level = rs->has_set_level = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -600,7 +601,7 @@ static int netrigctl_open(RIG *rig)
rs->has_get_parm = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -627,9 +628,12 @@ static int netrigctl_open(RIG *rig)
rs->mode_list |= rs->tx_range_list[i].modes;
rs->vfo_list |= rs->tx_range_list[i].vfo;
}
if (rs->vfo_list == 0) {
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo_list empty, defaulting to A/B\n", __func__);
rs->vfo_list = RIG_VFO_A|RIG_VFO_B;
if (rs->vfo_list == 0)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo_list empty, defaulting to A/B\n",
__func__);
rs->vfo_list = RIG_VFO_A | RIG_VFO_B;
}
if (prot_ver == 0) { return RIG_OK; }
@ -640,7 +644,7 @@ static int netrigctl_open(RIG *rig)
do
{
char setting[32], value[1024];
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
strtok(buf, "\r\n"); // chop the EOL
if (ret <= 0)
@ -891,7 +895,7 @@ static int netrigctl_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
CHKSCN1ARG(num_sscanf(buf, "%"SCNfreq, freq));
#if 0 // implement set_freq VFO later if it can be detected
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -962,7 +966,7 @@ static int netrigctl_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
*mode = rig_parse_mode(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -1575,7 +1579,7 @@ static int netrigctl_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
*tx_mode = rig_parse_mode(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -1595,7 +1599,8 @@ static int netrigctl_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
char buf[BUF_MAX];
char vfostr[16] = "";
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, vfotx=%s, split=%d\n", __func__,
rig_strvfo(vfo), rig_strvfo(tx_vfo), split);
ret = netrigctl_vfostr(rig, vfostr, sizeof(vfostr), RIG_VFO_A);
@ -1641,7 +1646,7 @@ static int netrigctl_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
*split = atoi(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -2163,7 +2168,7 @@ static int netrigctl_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
ret);
}
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -2289,10 +2294,15 @@ static int netrigctl_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
int ret, len;
char cmd[CMD_MAX];
char buf[BUF_MAX];
char vfostr[16] = "";
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
len = sprintf(cmd, "J %s\n", rig_strvfop(op));
ret = netrigctl_vfostr(rig, vfostr, sizeof(vfostr), vfo);
if (ret != RIG_OK) { return ret; }
len = sprintf(cmd, "G%s %s\n", vfostr, rig_strvfop(op));
ret = netrigctl_transaction(rig, cmd, len, buf);
@ -2555,7 +2565,8 @@ static int netrigctl_power2mW(RIG *rig, unsigned int *mwpower, float power,
ENTERFUNC;
// we shouldn't need any precision than microwatts
snprintf(cmdbuf, sizeof(cmdbuf), "\\power2mW %.3f %.0f %s\n", power, freq, rig_strrmode(mode));
snprintf(cmdbuf, sizeof(cmdbuf), "\\power2mW %.3f %.0f %s\n", power, freq,
rig_strrmode(mode));
ret = netrigctl_transaction(rig, cmdbuf, strlen(cmdbuf), buf);
if (ret <= 0)
@ -2579,7 +2590,7 @@ struct rig_caps netrigctl_caps =
RIG_MODEL(RIG_MODEL_NETRIGCTL),
.model_name = "NET rigctl",
.mfg_name = "Hamlib",
.version = "20211118.0",
.version = "20211123.0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_OTHER,

Wyświetl plik

@ -57,7 +57,7 @@ static int netrotctl_transaction(ROT *rot, char *cmd, int len, char *buf)
return ret;
}
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
if (ret < 0)
{
@ -100,14 +100,14 @@ static int netrotctl_open(ROT *rot)
return -RIG_EPROTO;
}
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
if (ret <= 0)
{
return (ret < 0) ? ret : -RIG_EPROTO;
}
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
if (ret <= 0)
{
@ -116,7 +116,7 @@ static int netrotctl_open(ROT *rot)
rs->min_az = atof(buf);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
if (ret <= 0)
{
@ -125,7 +125,7 @@ static int netrotctl_open(ROT *rot)
rs->max_az = atof(buf);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
if (ret <= 0)
{
@ -134,7 +134,7 @@ static int netrotctl_open(ROT *rot)
rs->min_el = atof(buf);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
if (ret <= 0)
{
@ -198,7 +198,7 @@ static int netrotctl_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
*az = atof(buf);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
if (ret <= 0)
{

Wyświetl plik

@ -190,6 +190,13 @@ static int dummy_rot_open(ROT *rot)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (rot->caps->rot_model == ROT_MODEL_DUMMY)
{
simulating = 1;
rig_debug(RIG_DEBUG_VERBOSE, "%s: dummy rotator so simulating speed\n",
__func__);
}
return RIG_OK;
}
@ -918,7 +925,7 @@ const struct rot_caps dummy_rot_caps =
ROT_MODEL(ROT_MODEL_DUMMY),
.model_name = "Dummy",
.mfg_name = "Hamlib",
.version = "20210207.0",
.version = "20211120.0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rot_type = ROT_TYPE_AZEL,

2124
rigs/dummy/tci1x.c 100644

Plik diff jest za duży Load Diff

Wyświetl plik

@ -243,7 +243,7 @@ static int read_transaction(RIG *rig, char *response, int response_len)
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
len = read_string(&rs->rigport, response, response_len, delims,
strlen(delims), 0);
strlen(delims), 0, 1);
if (len <= 0)
{

Wyświetl plik

@ -253,7 +253,7 @@ transaction_read:
/* allow one extra byte for terminator we don't return */
len = min(datasize ? datasize + 1 : strlen(priv->verify_cmd) + 13,
ELAD_MAX_BUF_LEN);
retval = read_string(&rs->rigport, buffer, len, cmdtrm, strlen(cmdtrm), 0);
retval = read_string(&rs->rigport, buffer, len, cmdtrm, strlen(cmdtrm), 0, 1);
if (retval < 0)
{
@ -3739,7 +3739,7 @@ DECLARE_PROBERIG_BACKEND(elad)
}
retval = write_block(port, "ID;", 3);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2, 0);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2, 0, 1);
close(port->fd);
if (retval != RIG_OK || id_len < 0)
@ -3800,7 +3800,7 @@ DECLARE_PROBERIG_BACKEND(elad)
}
retval = write_block(port, "K2;", 3);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2, 0);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2, 0, 1);
close(port->fd);
if (retval != RIG_OK)

Wyświetl plik

@ -288,7 +288,7 @@ int icmarine_transaction(RIG *rig, const char *cmd, const char *param,
/*
* Transceiver sends an echo of cmd followed by a CR/LF
*/
retval = read_string(&rs->rigport, respbuf, BUFSZ, LF, strlen(LF), 0);
retval = read_string(&rs->rigport, respbuf, BUFSZ, LF, strlen(LF), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -9,7 +9,7 @@ ICOMSRC = ic706.c icr8500.c ic735.c ic775.c ic756.c \
ic707.c ic728.c ic751.c ic761.c \
ic78.c ic7800.c ic785x.c \
ic7000.c ic7100.c ic7200.c ic7300.c ic7600.c ic7610.c ic7700.c \
icom.c icom.h icom_defs.h frame.c frame.h optoscan.c optoscan.h x108g.c
icom.c icom.h icom_defs.h frame.c frame.h ic7300.h optoscan.c optoscan.h x108g.c
noinst_LTLIBRARIES = libhamlib-icom.la
libhamlib_icom_la_SOURCES = $(ICOMSRC)

Wyświetl plik

@ -138,7 +138,6 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
unsigned char ctrl_id;
ENTERFUNC;
rig_lock();
memset(buf, 0, 200);
memset(sendbuf, 0, MAXFRAMELEN);
rs = &rig->state;
@ -164,7 +163,6 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
if (retval != RIG_OK)
{
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(retval);
}
@ -186,14 +184,12 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
{
/* Nothing received, CI-V interface is not echoing */
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(-RIG_BUSERROR);
}
if (retval < 0)
{
set_transaction_inactive(rig);
rig_unlock();
/* Other error, return it */
RETURNFUNC(retval);
}
@ -201,7 +197,6 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
if (retval < 1)
{
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(-RIG_EPROTO);
}
@ -210,7 +205,6 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
case COL:
/* Collision */
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(-RIG_BUSBUSY);
case FI:
@ -221,7 +215,6 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
/* Timeout after reading at least one character */
/* Problem on ci-v bus? */
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(-RIG_BUSERROR);
}
@ -231,7 +224,6 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
/* Problem on ci-v bus? */
/* Someone else got a packet in? */
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(-RIG_EPROTO);
}
@ -241,7 +233,6 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
/* Problem on ci-v bus? */
/* Someone else got a packet in? */
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(-RIG_EPROTO);
}
}
@ -252,7 +243,6 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
if (data_len == NULL)
{
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(RIG_OK);
}
@ -283,7 +273,6 @@ read_another_frame:
if (frm_len < 0)
{
rig_unlock();
set_transaction_inactive(rig);
/* RIG_TIMEOUT: timeout getting response, return timeout */
/* other error: return it */
@ -292,7 +281,6 @@ read_another_frame:
if (frm_len < 1)
{
rig_unlock();
set_transaction_inactive(rig);
RETURNFUNC(-RIG_EPROTO);
}
@ -302,7 +290,6 @@ read_another_frame:
if (retval < 0)
{
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(retval);
}
@ -311,7 +298,6 @@ read_another_frame:
if (frm_len < 1)
{
rig_debug(RIG_DEBUG_ERR, "Unexpected frame len=%d\n", frm_len);
rig_unlock();
RETURNFUNC(-RIG_EPROTO);
}
@ -320,7 +306,6 @@ read_another_frame:
case COL:
set_transaction_inactive(rig);
/* Collision */
rig_unlock();
RETURNFUNC(-RIG_BUSBUSY);
case FI:
@ -329,21 +314,18 @@ read_another_frame:
case NAK:
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(-RIG_ERJCTED);
default:
set_transaction_inactive(rig);
/* Timeout after reading at least one character */
/* Problem on ci-v bus? */
rig_unlock();
RETURNFUNC(-RIG_EPROTO);
}
if (frm_len < ACKFRMLEN)
{
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(-RIG_EPROTO);
}
@ -352,7 +334,6 @@ read_another_frame:
if (frm_len == 6 && NAK == buf[frm_len - 2])
{
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(-RIG_ERJCTED);
}
@ -363,7 +344,6 @@ read_another_frame:
if (FI != buf[frm_len - 1] && ACK != buf[frm_len - 1])
{
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(-RIG_BUSBUSY);
}
@ -372,7 +352,6 @@ read_another_frame:
if (frm_data_len <= 0)
{
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(-RIG_EPROTO);
}
@ -390,7 +369,6 @@ read_another_frame:
if (elapsed_ms > rs->rigport.timeout)
{
set_transaction_inactive(rig);
rig_unlock();
RETURNFUNC(-RIG_ETIMEOUT);
}
@ -400,13 +378,13 @@ read_another_frame:
set_transaction_inactive(rig);
*data_len = frm_data_len;
memcpy(data, buf + 4, *data_len);
if (data != NULL && data_len != NULL) { memcpy(data, buf + 4, *data_len); }
/*
* TODO: check addresses in reply frame
*/
rig_unlock();
RETURNFUNC(RIG_OK);
}
@ -493,11 +471,13 @@ static int read_icom_frame_generic(hamlib_port_t *p, const unsigned char rxbuffe
int i;
if (direct)
{
i = read_string_direct(p, rx_ptr, MAXFRAMELEN - read, icom_block_end, icom_block_end_length, 0);
i = read_string_direct(p, rx_ptr, MAXFRAMELEN - read,
icom_block_end, icom_block_end_length, 0, 1);
}
else
{
i = read_string(p, rx_ptr, MAXFRAMELEN - read, icom_block_end, icom_block_end_length, 0);
i = read_string(p, rx_ptr, MAXFRAMELEN - read,
icom_block_end, icom_block_end_length, 0, 1);
}
if (i < 0 && i != RIG_BUSBUSY) /* die on errors */

Wyświetl plik

@ -32,6 +32,7 @@
#include "idx_builtin.h"
#include "bandplan.h"
#include "token.h"
#include "misc.h"
#define IC7100_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR|\
@ -202,6 +203,106 @@ static const struct icom_priv_caps ic7100_priv_caps =
.ant_count = 2
};
// if hour < 0 then only date will be set
int ic7100_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
int sec, double msec, int utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
unsigned char prmbuf[MAXFRAMELEN];
if (year >= 0)
{
prmbuf[0] = 0x01;
prmbuf[1] = 0x20;
to_bcd(&prmbuf[2], year / 100, 2);
to_bcd(&prmbuf[3], year % 100, 2);
to_bcd(&prmbuf[4], month, 2);
to_bcd(&prmbuf[5], day, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
if (hour >= 0)
{
prmbuf[0] = 0x01;
prmbuf[1] = 0x21;
to_bcd(&prmbuf[2], hour, 2);
to_bcd(&prmbuf[3], min, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
prmbuf[0] = 0x01;
prmbuf[1] = 0x23;
rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
return retval;
}
int ic7100_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int *min, int *sec, double *msec, int *utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
int resplen;
unsigned char prmbuf[MAXFRAMELEN];
unsigned char respbuf[MAXFRAMELEN];
prmbuf[0] = 0x01;
prmbuf[1] = 0x20;
resplen = sizeof(respbuf);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
*month = from_bcd(&respbuf[6], 2);
*day = from_bcd(&respbuf[7], 2);
if (hour != NULL)
{
prmbuf[0] = 0x01;
prmbuf[1] = 0x21;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*hour = from_bcd(&respbuf[4], 2);
*min = from_bcd(&respbuf[5], 2);
*sec = 0;
*msec = 0;
prmbuf[0] = 0x01;
prmbuf[1] = 0x23;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*utc_offset = from_bcd(&respbuf[4], 2) * 100;
*utc_offset += from_bcd(&respbuf[5], 2);
if (respbuf[6] != 0x00) { *utc_offset *= -1; }
//rig_debug(RIG_DEBUG_VERBOSE,
// "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
// __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
// *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
}
return retval;
}
const struct rig_caps ic7100_caps =
{
RIG_MODEL(RIG_MODEL_IC7100),
@ -407,5 +508,7 @@ const struct rig_caps ic7100_caps =
.get_powerstat = icom_get_powerstat,
.send_morse = icom_send_morse,
.stop_morse = icom_stop_morse,
.wait_morse = rig_wait_morse
.wait_morse = rig_wait_morse,
.set_clock = ic7100_set_clock,
.get_clock = ic7100_get_clock
};

Wyświetl plik

@ -24,7 +24,8 @@
#include "config.h"
#endif
#include <string.h> /* String function definitions */
#include <string.h>
#include <stdlib.h>
#include <hamlib/rig.h>
#include "idx_builtin.h"
@ -35,9 +36,16 @@
#include "frame.h"
#include "bandplan.h"
#include "tones.h"
#include "misc.h"
#include "ic7300.h"
static int ic7300_set_parm(RIG *rig, setting_t parm, value_t val);
static int ic7300_get_parm(RIG *rig, setting_t parm, value_t *val);
int ic7300_set_clock(RIG *rig, int year, int month, int day, int hour,
int min, int sec, double msec, int utc_offset);
int ic7300_get_clock(RIG *rig, int *year, int *month, int *day,
int *hour,
int *min, int *sec, double *msec, int *utc_offset);
#define IC7300_ALL_RX_MODES (RIG_MODE_FM|RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM|RIG_MODE_PKTAM)
@ -535,7 +543,7 @@ const struct rig_caps ic7300_caps =
RIG_MODEL(RIG_MODEL_IC7300),
.model_name = "IC-7300",
.mfg_name = "Icom",
.version = BACKEND_VER ".5",
.version = BACKEND_VER ".6",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -759,7 +767,9 @@ const struct rig_caps ic7300_caps =
.send_morse = icom_send_morse,
.stop_morse = icom_stop_morse,
.wait_morse = rig_wait_morse,
.send_voice_mem = icom_send_voice_mem
.send_voice_mem = icom_send_voice_mem,
.set_clock = ic7300_set_clock,
.get_clock = ic7300_get_clock
};
const struct rig_caps ic9700_caps =
@ -767,7 +777,7 @@ const struct rig_caps ic9700_caps =
RIG_MODEL(RIG_MODEL_IC9700),
.model_name = "IC-9700",
.mfg_name = "Icom",
.version = BACKEND_VER ".4",
.version = BACKEND_VER ".5",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -1463,3 +1473,203 @@ int ic7300_get_parm(RIG *rig, setting_t parm, value_t *val)
return RIG_OK;
}
// if hour < 0 then only date will be set
int ic7300_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
int sec, double msec, int utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
unsigned char prmbuf[MAXFRAMELEN];
if (year >= 0)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x94;
to_bcd(&prmbuf[2], year / 100, 2);
to_bcd(&prmbuf[3], year % 100, 2);
to_bcd(&prmbuf[4], month, 2);
to_bcd(&prmbuf[5], day, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
if (hour >= 0)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x95;
to_bcd(&prmbuf[2], hour, 2);
to_bcd(&prmbuf[3], min, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
prmbuf[0] = 0x00;
prmbuf[1] = 0x96;
rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
return retval;
}
int ic7300_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int *min, int *sec, double *msec, int *utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
int resplen;
unsigned char prmbuf[MAXFRAMELEN];
unsigned char respbuf[MAXFRAMELEN];
prmbuf[0] = 0x00;
prmbuf[1] = 0x94;
resplen = sizeof(respbuf);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
*month = from_bcd(&respbuf[6], 2);
*day = from_bcd(&respbuf[7], 2);
if (hour != NULL)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x95;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*hour = from_bcd(&respbuf[4], 2);
*min = from_bcd(&respbuf[5], 2);
*sec = 0;
*msec = 0;
prmbuf[0] = 0x00;
prmbuf[1] = 0x96;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*utc_offset = from_bcd(&respbuf[4], 2) * 100;
*utc_offset += from_bcd(&respbuf[5], 2);
if (respbuf[6] != 0x00) { *utc_offset *= -1; }
//rig_debug(RIG_DEBUG_VERBOSE,
// "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
// __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
// *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
}
return retval;
}
// if hour < 0 then only date will be set
int ic9700_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
int sec, double msec, int utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
unsigned char prmbuf[MAXFRAMELEN];
if (year >= 0)
{
prmbuf[0] = 0x01;
prmbuf[1] = 0x79;
to_bcd(&prmbuf[2], year / 100, 2);
to_bcd(&prmbuf[3], year % 100, 2);
to_bcd(&prmbuf[4], month, 2);
to_bcd(&prmbuf[5], day, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
if (hour >= 0)
{
prmbuf[0] = 0x01;
prmbuf[1] = 0x80;
to_bcd(&prmbuf[2], hour, 2);
to_bcd(&prmbuf[3], min, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
prmbuf[0] = 0x01;
prmbuf[1] = 0x84;
rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
return retval;
}
int ic9700_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int *min, int *sec, double *msec, int *utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
int resplen;
unsigned char prmbuf[MAXFRAMELEN];
unsigned char respbuf[MAXFRAMELEN];
prmbuf[0] = 0x01;
prmbuf[1] = 0x79;
resplen = sizeof(respbuf);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
*month = from_bcd(&respbuf[6], 2);
*day = from_bcd(&respbuf[7], 2);
if (hour != NULL)
{
prmbuf[0] = 0x01;
prmbuf[1] = 0x80;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*hour = from_bcd(&respbuf[4], 2);
*min = from_bcd(&respbuf[5], 2);
*sec = 0;
*msec = 0;
prmbuf[0] = 0x01;
prmbuf[1] = 0x84;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*utc_offset = from_bcd(&respbuf[4], 2) * 100;
*utc_offset += from_bcd(&respbuf[5], 2);
if (respbuf[6] != 0x00) { *utc_offset *= -1; }
//rig_debug(RIG_DEBUG_VERBOSE,
// "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
// __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
// *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
}
return retval;
}

Wyświetl plik

@ -0,0 +1,8 @@
#include "frame.h"
#include "misc.h"
extern int ic7300_set_clock(RIG *rig, int year, int month, int day, int hour,
int min, int sec, double msec, int utc_offset);
extern int ic7300_get_clock(RIG *rig, int *year, int *month, int *day,
int *hour,
int *min, int *sec, double *msec, int *utc_offset);

Wyświetl plik

@ -23,7 +23,8 @@
#include "config.h"
#endif
#include <string.h> /* String function definitions */
#include <string.h>
#include <stdlib.h>
#include <hamlib/rig.h>
#include "token.h"
@ -32,6 +33,8 @@
#include "icom.h"
#include "icom_defs.h"
#include "bandplan.h"
#include "frame.h"
#include "misc.h"
#define IC7600_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM|RIG_MODE_PSK|RIG_MODE_PSKR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTAM|RIG_MODE_PKTFM)
#define IC7600_1HZ_TS_MODES IC7600_ALL_RX_MODES
@ -163,12 +166,113 @@ static const struct icom_priv_caps ic7600_priv_caps =
.extcmds = ic7600_extcmds, /* Custom op parameters */
};
// if hour < 0 then only date will be set
int ic7600_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
int sec, double msec, int utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
unsigned char prmbuf[MAXFRAMELEN];
if (year >= 0)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x53;
to_bcd(&prmbuf[2], year / 100, 2);
to_bcd(&prmbuf[3], year % 100, 2);
to_bcd(&prmbuf[4], month, 2);
to_bcd(&prmbuf[5], day, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
if (hour >= 0)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x54;
to_bcd(&prmbuf[2], hour, 2);
to_bcd(&prmbuf[3], min, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
prmbuf[0] = 0x00;
prmbuf[1] = 0x56;
rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
return retval;
}
int ic7600_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int *min, int *sec, double *msec, int *utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
int resplen;
unsigned char prmbuf[MAXFRAMELEN];
unsigned char respbuf[MAXFRAMELEN];
prmbuf[0] = 0x00;
prmbuf[1] = 0x53;
resplen = sizeof(respbuf);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
*month = from_bcd(&respbuf[6], 2);
*day = from_bcd(&respbuf[7], 2);
if (hour != NULL)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x54;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*hour = from_bcd(&respbuf[4], 2);
*min = from_bcd(&respbuf[5], 2);
*sec = 0;
*msec = 0;
prmbuf[0] = 0x00;
prmbuf[1] = 0x56;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*utc_offset = from_bcd(&respbuf[4], 2) * 100;
*utc_offset += from_bcd(&respbuf[5], 2);
if (respbuf[6] != 0x00) { *utc_offset *= -1; }
//rig_debug(RIG_DEBUG_VERBOSE,
// "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
// __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
// *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
}
return retval;
}
const struct rig_caps ic7600_caps =
{
RIG_MODEL(RIG_MODEL_IC7600),
.model_name = "IC-7600",
.mfg_name = "Icom",
.version = BACKEND_VER ".1",
.version = BACKEND_VER ".2",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -343,5 +447,7 @@ const struct rig_caps ic7600_caps =
.get_split_vfo = icom_get_split_vfo,
.set_powerstat = icom_set_powerstat,
.get_powerstat = icom_get_powerstat,
.send_morse = icom_send_morse
.send_morse = icom_send_morse,
.set_clock = ic7600_set_clock,
.get_clock = ic7600_get_clock
};

Wyświetl plik

@ -24,7 +24,8 @@
#include "config.h"
#endif
#include <string.h> /* String function definitions */
#include <string.h>
#include <stdlib.h>
#include <hamlib/rig.h>
#include "token.h"
@ -33,6 +34,8 @@
#include "icom.h"
#include "icom_defs.h"
#include "bandplan.h"
#include "frame.h"
#include "misc.h"
#define IC7610_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM|RIG_MODE_PSK|RIG_MODE_PSKR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTAM|RIG_MODE_PKTFM)
#define IC7610_1HZ_TS_MODES IC7610_ALL_RX_MODES
@ -243,12 +246,113 @@ static const struct icom_priv_caps ic7610_priv_caps =
.extcmds = ic7610_extcmds,
};
// if hour < 0 then only date will be set
int ic7610_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
int sec, double msec, int utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
unsigned char prmbuf[MAXFRAMELEN];
if (year >= 0)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x58;
to_bcd(&prmbuf[2], year / 100, 2);
to_bcd(&prmbuf[3], year % 100, 2);
to_bcd(&prmbuf[4], month, 2);
to_bcd(&prmbuf[5], day, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
if (hour >= 0)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x59;
to_bcd(&prmbuf[2], hour, 2);
to_bcd(&prmbuf[3], min, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
prmbuf[0] = 0x00;
prmbuf[1] = 0x62;
rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
return retval;
}
int ic7610_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int *min, int *sec, double *msec, int *utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
int resplen;
unsigned char prmbuf[MAXFRAMELEN];
unsigned char respbuf[MAXFRAMELEN];
prmbuf[0] = 0x00;
prmbuf[1] = 0x58;
resplen = sizeof(respbuf);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
*month = from_bcd(&respbuf[6], 2);
*day = from_bcd(&respbuf[7], 2);
if (hour != NULL)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x59;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*hour = from_bcd(&respbuf[4], 2);
*min = from_bcd(&respbuf[5], 2);
*sec = 0;
*msec = 0;
prmbuf[0] = 0x00;
prmbuf[1] = 0x62;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*utc_offset = from_bcd(&respbuf[4], 2) * 100;
*utc_offset += from_bcd(&respbuf[5], 2);
if (respbuf[6] != 0x00) { *utc_offset *= -1; }
//rig_debug(RIG_DEBUG_VERBOSE,
// "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
// __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
// *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
}
return retval;
}
const struct rig_caps ic7610_caps =
{
RIG_MODEL(RIG_MODEL_IC7610),
.model_name = "IC-7610",
.mfg_name = "Icom",
.version = BACKEND_VER ".4",
.version = BACKEND_VER ".5",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -478,5 +582,7 @@ const struct rig_caps ic7610_caps =
.send_morse = icom_send_morse,
.stop_morse = icom_stop_morse,
.wait_morse = rig_wait_morse,
.send_voice_mem = rig_send_voice_mem
.send_voice_mem = rig_send_voice_mem,
.set_clock = ic7610_set_clock,
.get_clock = ic7610_get_clock
};

Wyświetl plik

@ -23,7 +23,8 @@
#include "config.h"
#endif
#include <string.h> /* String function definitions */
#include <string.h>
#include <stdlib.h>
#include <hamlib/rig.h>
#include "token.h"
@ -32,6 +33,8 @@
#include "icom.h"
#include "icom_defs.h"
#include "bandplan.h"
#include "frame.h"
#include "misc.h"
#define IC7700_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM|RIG_MODE_PSK|RIG_MODE_PSKR)
#define IC7700_AM_TX_MODES (RIG_MODE_AM|RIG_MODE_PKTAM)
@ -146,6 +149,106 @@ static const struct icom_priv_caps ic7700_priv_caps =
.extcmds = ic7700_extcmds,
};
// if hour < 0 then only date will be set
int ic7700_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
int sec, double msec, int utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
unsigned char prmbuf[MAXFRAMELEN];
if (year >= 0)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x58;
to_bcd(&prmbuf[2], year / 100, 2);
to_bcd(&prmbuf[3], year % 100, 2);
to_bcd(&prmbuf[4], month, 2);
to_bcd(&prmbuf[5], day, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
if (hour >= 0)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x59;
to_bcd(&prmbuf[2], hour, 2);
to_bcd(&prmbuf[3], min, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
prmbuf[0] = 0x00;
prmbuf[1] = 0x61;
rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
return retval;
}
int ic7700_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int *min, int *sec, double *msec, int *utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
int resplen;
unsigned char prmbuf[MAXFRAMELEN];
unsigned char respbuf[MAXFRAMELEN];
prmbuf[0] = 0x00;
prmbuf[1] = 0x58;
resplen = sizeof(respbuf);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
*month = from_bcd(&respbuf[6], 2);
*day = from_bcd(&respbuf[7], 2);
if (hour != NULL)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x59;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*hour = from_bcd(&respbuf[4], 2);
*min = from_bcd(&respbuf[5], 2);
*sec = 0;
*msec = 0;
prmbuf[0] = 0x00;
prmbuf[1] = 0x61;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*utc_offset = from_bcd(&respbuf[4], 2) * 100;
*utc_offset += from_bcd(&respbuf[5], 2);
if (respbuf[6] != 0x00) { *utc_offset *= -1; }
//rig_debug(RIG_DEBUG_VERBOSE,
// "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
// __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
// *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
}
return retval;
}
const struct rig_caps ic7700_caps =
{
RIG_MODEL(RIG_MODEL_IC7700),
@ -325,5 +428,7 @@ const struct rig_caps ic7700_caps =
.get_powerstat = icom_get_powerstat,
.send_morse = icom_send_morse,
.stop_morse = icom_stop_morse,
.wait_morse = rig_wait_morse
.wait_morse = rig_wait_morse,
.set_clock = ic7700_set_clock,
.get_clock = ic7700_get_clock
};

Wyświetl plik

@ -24,6 +24,7 @@
#endif
#include <string.h> /* String function definitions */
#include <stdlib.h>
#include <hamlib/rig.h>
#include "token.h"
@ -32,6 +33,7 @@
#include "icom.h"
#include "icom_defs.h"
#include "bandplan.h"
#include "ic7300.h"
#define IC7800_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM|RIG_MODE_PSK|RIG_MODE_PSKR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTAM|RIG_MODE_PKTFM)
#define IC7800_1HZ_TS_MODES IC7800_ALL_RX_MODES
@ -154,7 +156,7 @@ const struct rig_caps ic7800_caps =
RIG_MODEL(RIG_MODEL_IC7800),
.model_name = "IC-7800",
.mfg_name = "Icom",
.version = BACKEND_VER ".3",
.version = BACKEND_VER ".5",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -328,7 +330,9 @@ const struct rig_caps ic7800_caps =
.get_powerstat = icom_get_powerstat,
.send_morse = icom_send_morse,
.stop_morse = icom_stop_morse,
.wait_morse = rig_wait_morse
.wait_morse = rig_wait_morse,
.set_clock = ic7300_set_clock,
.get_clock = ic7300_get_clock,
};
/*
@ -402,3 +406,103 @@ int ic7800_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return RIG_OK;
}
// if hour < 0 then only date will be set
int ic7800_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
int sec, double msec, int utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
unsigned char prmbuf[MAXFRAMELEN];
if (year >= 0)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x59;
to_bcd(&prmbuf[2], year / 100, 2);
to_bcd(&prmbuf[3], year % 100, 2);
to_bcd(&prmbuf[4], month, 2);
to_bcd(&prmbuf[5], day, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
if (hour >= 0)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x60;
to_bcd(&prmbuf[2], hour, 2);
to_bcd(&prmbuf[3], min, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
prmbuf[0] = 0x00;
prmbuf[1] = 0x62;
rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
}
return retval;
}
int ic7800_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int *min, int *sec, double *msec, int *utc_offset)
{
int cmd = 0x1a;
int subcmd = 0x05;
int retval = RIG_OK;
int resplen;
unsigned char prmbuf[MAXFRAMELEN];
unsigned char respbuf[MAXFRAMELEN];
prmbuf[0] = 0x00;
prmbuf[1] = 0x59;
resplen = sizeof(respbuf);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
*month = from_bcd(&respbuf[6], 2);
*day = from_bcd(&respbuf[7], 2);
if (hour != NULL)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x60;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*hour = from_bcd(&respbuf[4], 2);
*min = from_bcd(&respbuf[5], 2);
*sec = 0;
*msec = 0;
prmbuf[0] = 0x00;
prmbuf[1] = 0x62;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
*utc_offset = from_bcd(&respbuf[4], 2) * 100;
*utc_offset += from_bcd(&respbuf[5], 2);
if (respbuf[6] != 0x00) { *utc_offset *= -1; }
//rig_debug(RIG_DEBUG_VERBOSE,
// "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
// __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
// *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
}
return retval;
}

Wyświetl plik

@ -33,6 +33,7 @@
#include "icom.h"
#include "icom_defs.h"
#include "bandplan.h"
#include "ic7300.h"
#define IC785x_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM|RIG_MODE_PSK|RIG_MODE_PSKR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTAM|RIG_MODE_PKTFM)
#define IC785x_1HZ_TS_MODES IC785x_ALL_RX_MODES
@ -242,7 +243,7 @@ const struct rig_caps ic785x_caps =
RIG_MODEL(RIG_MODEL_IC785x),
.model_name = "IC-7850/7851",
.mfg_name = "Icom",
.version = BACKEND_VER ".2",
.version = BACKEND_VER ".3",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -472,7 +473,9 @@ const struct rig_caps ic785x_caps =
.get_powerstat = icom_get_powerstat,
.send_morse = icom_send_morse,
.stop_morse = icom_stop_morse,
.wait_morse = rig_wait_morse
.wait_morse = rig_wait_morse,
.set_clock = ic7300_set_clock,
.get_clock = ic7300_get_clock
};
int ic785x_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)

Wyświetl plik

@ -791,9 +791,11 @@ static vfo_t icom_current_vfo_x25(RIG *rig)
{
// we can't change freqs unless rig is idle and we don't know that
// so we only check vfo once when freqs are equal
rig_debug(RIG_DEBUG_TRACE,"%s: vfo already determined...returning current_vfo", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: vfo already determined...returning current_vfo",
__func__);
return rig->state.current_vfo;
}
priv->vfo_flag = 1;
fOffset = 100;
@ -884,9 +886,11 @@ static vfo_t icom_current_vfo(RIG *rig)
{
// we can't change freqs unless rig is idle and we don't know that
// so we only check vfo once when freqs are equal
rig_debug(RIG_DEBUG_TRACE,"%s: vfo already determined...returning current_vfo", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: vfo already determined...returning current_vfo",
__func__);
return rig->state.current_vfo;
}
priv->vfo_flag = 1;
fOffset = 100;
@ -980,13 +984,16 @@ retry_open:
else if (retval != RIG_OK)
{
// didnt' ask for power on so let's retry one more time
rig_debug(RIG_DEBUG_ERR, "%s: rig error getting frequency retry=%d, err=%s\n", __func__,retry_flag,rigerror(retval));
rig_debug(RIG_DEBUG_ERR, "%s: rig error getting frequency retry=%d, err=%s\n",
__func__, retry_flag, rigerror(retval));
if (retry_flag)
{
retry_flag = 0;
hl_usleep(500*1000); // 500ms pause
hl_usleep(500 * 1000); // 500ms pause
goto retry_open;
}
RETURNFUNC(retval);
}
@ -1360,6 +1367,7 @@ int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
case RIG_VFO_NONE: // VFO_NONE will become VFO_CURR
rig->state.current_vfo = RIG_VFO_CURR;
case RIG_VFO_CURR: priv->curr_freq = freq; break;
case RIG_VFO_OTHER: priv->other_freq = freq; break;
@ -1638,6 +1646,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
case RIG_VFO_NONE: // VFO_NONE will become VFO_CURR
rig->state.current_vfo = RIG_VFO_CURR;
case RIG_VFO_CURR: priv->curr_freq = *freq; break;
default:
@ -1762,8 +1771,8 @@ int icom_set_xit_new(RIG *rig, vfo_t vfo, shortfreq_t ts)
and some models like IC910/Omni VI Plus have a different meaning for
this subcommand
*/
int filtericom[] = { 50,100,150,200,250,300,350,400,450,500,600,700,800,900,1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,3000,3100,3200,3300,3400,3500,3600 };
int filtericom[] = { 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600 };
pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode)
{
@ -1812,7 +1821,8 @@ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode)
if (-RIG_ERJCTED == retval)
{
if (priv->no_1a_03_cmd == ENUM_1A_03_UNK) {
if (priv->no_1a_03_cmd == ENUM_1A_03_UNK)
{
priv->no_1a_03_cmd = ENUM_1A_03_NO; /* do not keep asking */
return (RIG_OK);
}
@ -1839,10 +1849,13 @@ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode)
if (mode & RIG_MODE_AM)
{
if (i > 49) {
rig_debug(RIG_DEBUG_ERR, "%s: Expected max 49, got %d for filter\n", __func__, i);
if (i > 49)
{
rig_debug(RIG_DEBUG_ERR, "%s: Expected max 49, got %d for filter\n", __func__,
i);
RETURNFUNC(-RIG_EPROTO);
}
return ((i + 1) * 200); /* All Icoms that we know of */
}
else if (mode &
@ -1869,9 +1882,10 @@ int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width)
S_MEM_FILT_WDTH;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: mode=%s, width=%d\n", __func__, rig_strrmode(mode), (int)width);
rig_debug(RIG_DEBUG_TRACE, "%s: mode=%s, width=%d\n", __func__,
rig_strrmode(mode), (int)width);
if (RIG_PASSBAND_NOCHANGE == width)
{
RETURNFUNC(RIG_OK);
@ -1903,7 +1917,8 @@ int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width)
RETURNFUNC(-RIG_EINVAL);
}
}
if (priv->no_1a_03_cmd == ENUM_1A_03_NO) RETURNFUNC(RIG_OK); // don't bother to try since it doesn't work
if (priv->no_1a_03_cmd == ENUM_1A_03_NO) { RETURNFUNC(RIG_OK); } // don't bother to try since it doesn't work
if (mode & RIG_MODE_AM)
{
@ -1922,12 +1937,14 @@ int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width)
}
else
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: unknown mode=%s\n", __func__, rig_strrmode(mode));
rig_debug(RIG_DEBUG_VERBOSE, "%s: unknown mode=%s\n", __func__,
rig_strrmode(mode));
RETURNFUNC(RIG_OK);
}
to_bcd(&flt_ext, flt_idx, 2);
rig_debug(RIG_DEBUG_VERBOSE, "%s: flt_ext=%d, flt_idx=%d\n", __func__, flt_ext, flt_idx);
rig_debug(RIG_DEBUG_VERBOSE, "%s: flt_ext=%d, flt_idx=%d\n", __func__, flt_ext,
flt_idx);
retval = icom_transaction(rig, C_CTL_MEM, fw_sub_cmd, &flt_ext, 1,
ackbuf, &ack_len);
@ -2168,6 +2185,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
}
}
}
icom_set_dsp_flt(rig, mode, width);
RETURNFUNC(retval);
@ -2421,7 +2439,10 @@ int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
TRACE;
rig_debug(RIG_DEBUG_VERBOSE, "%s: targetable=%x, targetable_mode=%x, and=%d\n", __func__, rig->caps->targetable_vfo,RIG_TARGETABLE_MODE, rig->caps->targetable_vfo & RIG_TARGETABLE_MODE);
rig_debug(RIG_DEBUG_VERBOSE, "%s: targetable=%x, targetable_mode=%x, and=%d\n",
__func__, rig->caps->targetable_vfo, RIG_TARGETABLE_MODE,
rig->caps->targetable_vfo & RIG_TARGETABLE_MODE);
// IC7800 can set but not read with 0x26
if ((rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
&& (rig->caps->rig_model != RIG_MODEL_IC7800))
@ -2722,8 +2743,10 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
case RIG_VFO_MAIN:
icvfo = S_MAIN;
// If not split or satmode then we must want VFOA
if (VFO_HAS_MAIN_SUB_A_B_ONLY && !priv->split_on && !rig->state.cache.satmode) { icvfo = S_VFOA; }
break;
case RIG_VFO_SUB:
@ -2861,10 +2884,51 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
break;
case RIG_VFO_OTHER:
switch (rig->state.current_vfo)
{
case RIG_VFO_A:
icvfo = vfo = RIG_VFO_B;
break;
case RIG_VFO_B:
icvfo = vfo = RIG_VFO_A;
break;
case RIG_VFO_MAIN:
icvfo = vfo = RIG_VFO_SUB;
break;
case RIG_VFO_SUB:
icvfo = vfo = RIG_VFO_MAIN;
break;
case RIG_VFO_MAIN_A:
icvfo = vfo = RIG_VFO_MAIN_B;
break;
case RIG_VFO_MAIN_B:
icvfo = vfo = RIG_VFO_MAIN_A;
break;
case RIG_VFO_SUB_A:
icvfo = vfo = RIG_VFO_SUB_B;
break;
case RIG_VFO_SUB_B:
icvfo = vfo = RIG_VFO_SUB_A;
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unknown vfo '%s'\n", __func__,
rig_strvfo(rig->state.current_vfo));
}
default:
if (!priv->x25cmdfails)
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__,
rig_strvfo(vfo));
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__,
rig_strvfo(vfo));
RETURNFUNC(-RIG_EINVAL);
}
@ -7685,7 +7749,7 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
priv->serial_USB_echo_off = 1;
retval =
icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, ackbuf, &ack_len);
hl_usleep(4000*1000); // give some time to wake up
hl_usleep(4000 * 1000); // give some time to wake up
break;
@ -7707,8 +7771,11 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
// need to see if echo is on or not first
// until such time as rig is awake we don't know
retval = icom_get_usb_echo_off(rig);
if (retval == -RIG_ETIMEOUT) {
rig_debug(RIG_DEBUG_WARN, "%s: get_usb_echo_off timeout...try#%d\n", __func__, i+1);
if (retval == -RIG_ETIMEOUT)
{
rig_debug(RIG_DEBUG_WARN, "%s: get_usb_echo_off timeout...try#%d\n", __func__,
i + 1);
continue;
}
@ -7729,6 +7796,7 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
__func__, i + 1, retry);
}
}
rs->rigport.retry = retry_save;
if (i == retry)

Wyświetl plik

@ -30,7 +30,7 @@
#include <sys/time.h>
#endif
#define BACKEND_VER "20211115"
#define BACKEND_VER "20211120"
#define ICOM_IS_SECONDARY_VFO(vfo) ((vfo) & (RIG_VFO_B | RIG_VFO_SUB | RIG_VFO_SUB_B | RIG_VFO_MAIN_B))
#define ICOM_GET_VFO_NUMBER(vfo) (ICOM_IS_SECONDARY_VFO(vfo) ? 0x01 : 0x00)

Wyświetl plik

@ -245,9 +245,9 @@ int optoscan_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length)
unsigned char dtmfbuf[MAXFRAMELEN], digit;
int len, digitpos;
const unsigned char xlate[] = {'0', '1', '2', '3', '4', '5', '6',
'7', '8', '9', 'A', 'B', 'C', 'D',
'*', '#'
};
'7', '8', '9', 'A', 'B', 'C', 'D',
'*', '#'
};
digitpos = 0;
do

Wyświetl plik

@ -93,7 +93,7 @@ static int jrc_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0);
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0, 1);
set_transaction_inactive(rig);
@ -1632,7 +1632,7 @@ int jrc_decode_event(RIG *rig)
//#define SETUP_STATUS_LEN 17
//count = read_string(&rs->rigport, buf, SETUP_STATUS_LEN, "", 0);
count = read_string(&rs->rigport, buf, priv->info_len, "", 0, 0);
count = read_string(&rs->rigport, buf, priv->info_len, "", 0, 0, 1);
if (count < 0)
{

Wyświetl plik

@ -93,7 +93,7 @@ static int kachina_transaction(RIG *rig, unsigned char cmd1, unsigned char cmd2)
return retval;
}
count = read_string(&rs->rigport, (char *) buf4, 1, "", 0, 0);
count = read_string(&rs->rigport, (char *) buf4, 1, "", 0, 0, 1);
if (count != 1)
{
@ -128,7 +128,7 @@ static int kachina_trans_n(RIG *rig, unsigned char cmd1, const char *data,
return retval;
}
count = read_string(&rs->rigport, (char *) buf, 1, "", 0, 0);
count = read_string(&rs->rigport, (char *) buf, 1, "", 0, 0, 1);
if (count != 1)
{
@ -273,7 +273,7 @@ int kachina_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
rig_flush(&rig->state.rigport);
count = read_string(&rig->state.rigport, (char *) buf, 31, rcv_signal_range,
128, 0);
128, 0, 1);
if (count < 1)
{

Wyświetl plik

@ -135,7 +135,7 @@ int elecraft_open(RIG *rig)
return err;
}
err = read_string(&rs->rigport, buf, sizeof(buf), ";", 1, 0);
err = read_string(&rs->rigport, buf, sizeof(buf), ";", 1, 0, 1);
if (err < 0)
{
@ -477,12 +477,12 @@ int elecraft_get_firmware_revision_level(RIG *rig, const char *cmd,
int elecraft_get_vfo_tq(RIG *rig, vfo_t *vfo)
{
int retval;
int fr,ft,tq;
int fr, ft, tq;
char cmdbuf[10];
char splitbuf[12];
memset(splitbuf,0,sizeof(splitbuf));
snprintf(cmdbuf,sizeof(cmdbuf),"FR;");
memset(splitbuf, 0, sizeof(splitbuf));
snprintf(cmdbuf, sizeof(cmdbuf), "FR;");
retval = kenwood_safe_transaction(rig, cmdbuf, splitbuf, 12, 3);
if (retval != RIG_OK)
@ -490,11 +490,12 @@ int elecraft_get_vfo_tq(RIG *rig, vfo_t *vfo)
RETURNFUNC(retval);
}
if(sscanf(splitbuf, "FR%1d", &fr) != 1)
if (sscanf(splitbuf, "FR%1d", &fr) != 1)
{
rig_debug(RIG_DEBUG_ERR, "%s: unable to parse FR '%s'\n", __func__, splitbuf);
}
snprintf(cmdbuf,sizeof(cmdbuf),"FT;");
snprintf(cmdbuf, sizeof(cmdbuf), "FT;");
retval = kenwood_safe_transaction(rig, cmdbuf, splitbuf, 12, 3);
if (retval != RIG_OK)
@ -502,11 +503,12 @@ int elecraft_get_vfo_tq(RIG *rig, vfo_t *vfo)
RETURNFUNC(retval);
}
if(sscanf(splitbuf, "FT%1d", &ft) != 1)
if (sscanf(splitbuf, "FT%1d", &ft) != 1)
{
rig_debug(RIG_DEBUG_ERR, "%s: unable to parse FT '%s'\n", __func__, splitbuf);
}
snprintf(cmdbuf,sizeof(cmdbuf),"TQ;");
snprintf(cmdbuf, sizeof(cmdbuf), "TQ;");
retval = kenwood_safe_transaction(rig, cmdbuf, splitbuf, 12, 3);
if (retval != RIG_OK)
@ -514,13 +516,17 @@ int elecraft_get_vfo_tq(RIG *rig, vfo_t *vfo)
RETURNFUNC(retval);
}
if(sscanf(splitbuf, "TQ%1d", &tq) != 1)
if (sscanf(splitbuf, "TQ%1d", &tq) != 1)
{
rig_debug(RIG_DEBUG_ERR, "%s: unable to parse TQ '%s'\n", __func__, splitbuf);
}
*vfo = RIG_VFO_A;
if (tq && ft == 1) *vfo = RIG_VFO_B;
if (!tq && fr == 1) *vfo = RIG_VFO_B;
if (tq && ft == 1) { *vfo = RIG_VFO_B; }
if (!tq && fr == 1) { *vfo = RIG_VFO_B; }
RETURNFUNC(RIG_OK);
}

Wyświetl plik

@ -919,6 +919,7 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
__func__, lvlbuf);
return -RIG_EPROTO;
}
n = val->i;
val->f = (n + 20.0) / (120.0 - -20.0);

Wyświetl plik

@ -110,7 +110,7 @@ transaction:
}
// this should be the ID response
retval = read_string(&rs->rigport, buffer, sizeof(buffer), ";", 1, 0);
retval = read_string(&rs->rigport, buffer, sizeof(buffer), ";", 1, 0, 1);
// might be ?; too
if (buffer[0] == '?' && retry_cmd++ < rs->rigport.retry)
@ -129,7 +129,7 @@ transaction:
return RIG_OK;
}
retval = read_string(&rs->rigport, data, 50, ";", 1, 0);
retval = read_string(&rs->rigport, data, 50, ";", 1, 0, 1);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -959,6 +959,7 @@ int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
cmd_bw_len = 7;
}
if (!mode || !width)
{
return -RIG_EINVAL;
@ -978,7 +979,8 @@ int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
if (temp_m == RIG_MODE_RTTY)
{
err = kenwood_safe_transaction(rig, cmd_mode, buf, KENWOOD_MAX_BUF_LEN, strlen(cmd_mode)+1);
err = kenwood_safe_transaction(rig, cmd_mode, buf, KENWOOD_MAX_BUF_LEN,
strlen(cmd_mode) + 1);
if (err != RIG_OK)
{
@ -1005,7 +1007,8 @@ int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
}
else if (temp_m == RIG_MODE_RTTYR)
{
err = kenwood_safe_transaction(rig, cmd_mode, buf, KENWOOD_MAX_BUF_LEN, strlen(cmd_mode)+1);
err = kenwood_safe_transaction(rig, cmd_mode, buf, KENWOOD_MAX_BUF_LEN,
strlen(cmd_mode) + 1);
if (err != RIG_OK)
{
@ -1039,7 +1042,8 @@ int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
/* The K3 is not limited to specific filter widths so we can query
* the actual bandwidth using the BW command
*/
err = kenwood_safe_transaction(rig, cmd_bw, buf, KENWOOD_MAX_BUF_LEN, cmd_bw_len);
err = kenwood_safe_transaction(rig, cmd_bw, buf, KENWOOD_MAX_BUF_LEN,
cmd_bw_len);
if (err != RIG_OK)
{
@ -1047,7 +1051,7 @@ int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
return err;
}
*width = atoi(&buf[cmd_bw_len-4]) * 10;
*width = atoi(&buf[cmd_bw_len - 4]) * 10;
return RIG_OK;
}
@ -1086,28 +1090,30 @@ int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
int err,err2;
int err, err2;
char cmd_m[5];
char buf[KENWOOD_MAX_BUF_LEN];
char *dtcmd;
struct kenwood_priv_caps *caps = kenwood_caps(rig);
struct kenwood_priv_data *priv = rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s mode=%s width=%d\n", __func__, rig_strvfo(vfo), rig_strrmode(mode), (int)width);
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s mode=%s width=%d\n", __func__,
rig_strvfo(vfo), rig_strrmode(mode), (int)width);
if (vfo == RIG_VFO_CURR)
{
vfo = rig->state.current_vfo;
}
rmode_t tmodeA,tmodeB;
rmode_t tmodeA, tmodeB;
pbwidth_t twidth;
err = k3_get_mode(rig, RIG_VFO_A, &tmodeA, &twidth);
err2 = k3_get_mode(rig, RIG_VFO_B, &tmodeB, &twidth);
// we keep both vfos in the same mode -- any reason they should ever be differnet? If so, fix this
// if we change mode on one VFO we'll also change the other
if (err == RIG_OK && err2 == RIG_OK && tmodeA == mode && tmodeB == mode && width == RIG_PASSBAND_NOCHANGE)
if (err == RIG_OK && err2 == RIG_OK && tmodeA == mode && tmodeB == mode
&& width == RIG_PASSBAND_NOCHANGE)
{
rig_debug(RIG_DEBUG_TRACE, "%s(%d): mode/width no change, skipping\n", __FILE__,
__LINE__);
@ -1116,11 +1122,14 @@ int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
else
{
rig_debug(RIG_DEBUG_TRACE,
"%s(%d): changing oldmode=A=%s B=%s, to mode=%s, oldwidth=%ld, to width=%ld\n", __FILE__,
__LINE__, rig_strrmode(tmodeA), rig_strrmode(tmodeB), rig_strrmode(mode), twidth, width);
"%s(%d): changing oldmode=A=%s B=%s, to mode=%s, oldwidth=%ld, to width=%ld\n",
__FILE__,
__LINE__, rig_strrmode(tmodeA), rig_strrmode(tmodeB), rig_strrmode(mode),
twidth, width);
}
dtcmd = "DT";
if ((priv->is_k4 || priv->is_k4d || priv->is_k4hd) && vfo == RIG_VFO_B)
{
dtcmd = "DT$";
@ -2699,7 +2708,9 @@ int k4_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
snprintf(cmd, sizeof(cmd), "RX");
if (ptt) cmd[0] = 'T';
if (ptt) { cmd[0] = 'T'; }
retval = kenwood_transaction(rig, cmd, NULL, 0);
if (retval != RIG_OK)
@ -2709,20 +2720,23 @@ int k4_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
do
{
hl_usleep(10*1000);
hl_usleep(10 * 1000);
retval = kenwood_safe_transaction(rig, "TQ", pttbuf, 6, 3);
if (retval != RIG_OK)
{
return retval;
}
ptt2 = pttbuf[2] == '1'? RIG_PTT_ON : RIG_PTT_OFF;
ptt2 = pttbuf[2] == '1' ? RIG_PTT_ON : RIG_PTT_OFF;
if (ptt2 != ptt)
{
rig_debug(RIG_DEBUG_TRACE, "%s: ptt=%d, expected=%d\n", __func__, ptt2, ptt);
}
} while (ptt != ptt2);
}
while (ptt != ptt2);
return RIG_OK;
}

Wyświetl plik

@ -268,7 +268,8 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data,
if (cache_age_ms < 500) // 500ms cache time
{
rig_debug(RIG_DEBUG_TRACE, "%s: cache hit, age=%dms\n", __func__, cache_age_ms);
rig_debug(RIG_DEBUG_TRACE, "%s(%d): cache hit, age=%dms\n", __func__, __LINE__,
cache_age_ms);
if (data) { strncpy(data, priv->last_if_response, datasize); }
@ -369,7 +370,8 @@ transaction_read:
/* allow room for most any response */
len = min(datasize ? datasize + 1 : strlen(priv->verify_cmd) + 48,
KENWOOD_MAX_BUF_LEN);
retval = read_string(&rs->rigport, buffer, len, cmdtrm_str, strlen(cmdtrm_str), 0);
retval = read_string(&rs->rigport, buffer, len, cmdtrm_str, strlen(cmdtrm_str),
0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: read_string(len=%d)='%s'\n", __func__,
(int)strlen(buffer), buffer);
@ -466,9 +468,11 @@ transaction_read:
{
rig_debug(RIG_DEBUG_ERR, "%s: Unknown command or rig busy '%s'\n", __func__,
cmdstr);
// sometimes IF; command after TX; will return ? but still return IF response
if (retry_read++ <= 1) {
hl_usleep(100*1000);
if (retry_read++ <= 1)
{
hl_usleep(100 * 1000);
goto transaction_read;
}
}
@ -1065,11 +1069,16 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
* This prevents a 1.8 second delay in PowerSDR when switching VFOs
* We'll do this once if curr_mode has not been set yet
*/
if (priv->is_emulation && priv->curr_mode > 0) { RETURNFUNC(RIG_OK); }
if (priv->is_emulation && priv->curr_mode > 0)
{
TRACE;
RETURNFUNC(RIG_OK);
}
if (rig->state.current_vfo == vfo)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo already is %s...skipping\n", __func__, rig_strvfo(vfo));
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo already is %s...skipping\n", __func__,
rig_strvfo(vfo));
RETURNFUNC(RIG_OK);
}
@ -1088,6 +1097,7 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
break;
case RIG_VFO_CURR:
TRACE;
rig->state.current_vfo = RIG_VFO_CURR;
RETURNFUNC(RIG_OK);
@ -1122,6 +1132,7 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
}
}
TRACE;
snprintf(cmdbuf, sizeof(cmdbuf), "FR%c", vfo_function);
// as we change VFO we will change split to the other VFO
@ -1150,6 +1161,8 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
{
RETURNFUNC(retval);
}
TRACE;
rig->state.current_vfo = vfo;
/* if FN command then there's no FT or FR */
@ -1159,15 +1172,57 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
RETURNFUNC(RIG_OK);
}
TRACE;
// some rigs need split turned on after VFOA is set
if (vfo == RIG_VFO_A && priv->split == RIG_SPLIT_ON)
if (priv->split == RIG_SPLIT_ON)
{
rig_set_split_vfo(rig, RIG_VFO_CURR, 1, priv->tx_vfo);
// so let's figure out who the rx_vfo is based on the tx_vfo
TRACE;
vfo_t rx_vfo = RIG_VFO_A;
switch (priv->tx_vfo)
{
case RIG_VFO_A:
rx_vfo = RIG_VFO_B;
break;
case RIG_VFO_MAIN:
rx_vfo = RIG_VFO_SUB;
break;
case RIG_VFO_MAIN_A:
rx_vfo = RIG_VFO_MAIN_B;
break;
case RIG_VFO_B:
rx_vfo = RIG_VFO_A;
break;
case RIG_VFO_SUB:
rx_vfo = RIG_VFO_MAIN;
break;
case RIG_VFO_SUB_B:
rx_vfo = RIG_VFO_MAIN_A;
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unhandled VFO=%s, deafaulting to VFOA\n",
__func__, rig_strvfo(priv->tx_vfo));
}
retval = rig_set_split_vfo(rig, rx_vfo, 1, priv->tx_vfo);
}
#if 0
/* set TX VFO */
cmdbuf[1] = 'T';
RETURNFUNC(kenwood_transaction(rig, cmdbuf, NULL, 0));
#else
RETURNFUNC(retval);
#endif
}
@ -1241,9 +1296,10 @@ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
char cmdbuf[12];
int retval;
unsigned char vfo_function;
split_t tsplit=0;
split_t tsplit = 0;
rig_debug(RIG_DEBUG_VERBOSE, "%s called %s,%d,%s\n", __func__, rig_strvfo(vfo), split, rig_strvfo(txvfo));
rig_debug(RIG_DEBUG_VERBOSE, "%s called %s,%d,%s\n", __func__, rig_strvfo(vfo),
split, rig_strvfo(txvfo));
if (RIG_IS_TS990S)
{
@ -1259,57 +1315,66 @@ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
RETURNFUNC(kenwood_transaction(rig, cmdbuf, NULL, 0));
}
if (vfo == RIG_VFO_CURR) vfo = rig->state.current_vfo;
if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; }
switch (vfo)
switch (vfo)
{
case RIG_VFO_A: vfo_function = '0'; break;
case RIG_VFO_B: vfo_function = '1'; break;
case RIG_VFO_MEM: vfo_function = '2'; break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__, rig_strvfo(vfo));
RETURNFUNC(-RIG_EINVAL);
}
rig_get_split(rig, vfo, &tsplit);
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): tsplit=%d, split=%d\n", __func__,
__LINE__, tsplit, split);
if (tsplit == split)
{
rig_debug(RIG_DEBUG_TRACE, "%s: split already set\n", __func__);
RETURNFUNC(RIG_OK);
}
/* set RX VFO */
snprintf(cmdbuf, sizeof(cmdbuf), "FR%c", vfo_function);
// FR can turn off split on some Kenwood rigs
// So we'll turn it back on just in case
TRACE;
if (split)
{
if (vfo_function == '0')
{
case RIG_VFO_A: vfo_function = '0'; break;
case RIG_VFO_B: vfo_function = '1'; break;
case RIG_VFO_MEM: vfo_function = '2'; break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__, rig_strvfo(vfo));
RETURNFUNC(-RIG_EINVAL);
TRACE;
strcat(cmdbuf, ";FT1");
}
rig_get_split(rig, vfo, &tsplit);
if (tsplit == split)
else
{
rig_debug(RIG_DEBUG_TRACE, "%s: split already set\n", __func__);
RETURNFUNC(RIG_OK);
TRACE;
strcat(cmdbuf, ";FT0");
}
}
else
{
strcat(cmdbuf, ";FT0");
}
/* set RX VFO */
snprintf(cmdbuf, sizeof(cmdbuf), "FR%c", vfo_function);
retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
// FR can turn off split on some Kenwood rigs
// So we'll turn it back on just in case
if (split && vfo_function == '0') { strcat(cmdbuf, ";FT1"); }
if (retval != RIG_OK)
{
RETURNFUNC(retval);
}
if (priv->split)
{
if (vfo_function == '0')
{
strcat(cmdbuf, ";FT1");
}
else
{
strcat(cmdbuf, ";FT0");
}
}
retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
if (retval != RIG_OK)
{
RETURNFUNC(retval);
}
rig->state.cache.split = split;
rig->state.cache.split_vfo = txvfo;
elapsed_ms(&rig->state.cache.time_split, HAMLIB_ELAPSED_SET);
rig->state.cache.split = split;
rig->state.cache.split_vfo = txvfo;
elapsed_ms(&rig->state.cache.time_split, HAMLIB_ELAPSED_SET);
/* Split off means Rx and Tx are the same */
if (split == RIG_SPLIT_OFF)
@ -1327,14 +1392,18 @@ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
}
}
if (txvfo == RIG_VFO_CURR && vfo == RIG_VFO_A) {
if (vfo == RIG_VFO_A) txvfo = RIG_VFO_B;
else if (vfo == RIG_VFO_B) txvfo = RIG_VFO_A;
else {
rig_debug(RIG_DEBUG_ERR, "%s: unsupported split VFO=%s\n", __func__, rig_strvfo(txvfo));
if (txvfo == RIG_VFO_CURR && vfo == RIG_VFO_A)
{
if (vfo == RIG_VFO_A) { txvfo = RIG_VFO_B; }
else if (vfo == RIG_VFO_B) { txvfo = RIG_VFO_A; }
else
{
rig_debug(RIG_DEBUG_ERR, "%s: unsupported split VFO=%s\n", __func__,
rig_strvfo(txvfo));
RETURNFUNC(-RIG_EINVAL);
}
}
switch (txvfo)
{
case RIG_VFO_VFO:
@ -1358,29 +1427,27 @@ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
*/
tsplit = RIG_SPLIT_OFF; // default in case rig does not set split status
retval = rig_get_split(rig, vfo, &tsplit);
// and it should be OK to do a SPLIT_OFF at any time so we won's skip that
if (retval == RIG_OK && split == RIG_SPLIT_ON && tsplit == RIG_SPLIT_ON)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: already set split=%d\n", __func__, tsplit);
RETURNFUNC(RIG_OK);
RETURNFUNC(RIG_OK);
}
rig_debug(RIG_DEBUG_VERBOSE, "%s: split is=%d, split wants=%d\n", __func__, tsplit, split);
rig_debug(RIG_DEBUG_VERBOSE, "%s: split is=%d, split wants=%d\n", __func__,
tsplit, split);
/* set TX VFO */
// if turning on split need to do some VFOB setup on Elecraft rigs to avoid SPLIT N/A and ER59 messages
if (rig->caps->rig_model == RIG_MODEL_K4 // Elecraft needs VFOB to be same band as VFOA
||rig->caps->rig_model == RIG_MODEL_K3
||rig->caps->rig_model == RIG_MODEL_KX2
||rig->caps->rig_model == RIG_MODEL_KX3)
if (rig->caps->rig_model ==
RIG_MODEL_K4 // Elecraft needs VFOB to be same band as VFOA
|| rig->caps->rig_model == RIG_MODEL_K3
|| rig->caps->rig_model == RIG_MODEL_KX2
|| rig->caps->rig_model == RIG_MODEL_KX3)
{
rig_set_freq(rig, RIG_VFO_B, rig->state.cache.freqMainA);
snprintf(cmdbuf, sizeof(cmdbuf), "FT%c", vfo_function);
}
else
{
snprintf(cmdbuf, sizeof(cmdbuf), "FT%c", vfo_function);
}
retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
if (retval != RIG_OK)
{
@ -1501,11 +1568,43 @@ int kenwood_get_split_vfo_if(RIG *rig, vfo_t rxvfo, split_t *split,
switch (priv->info[30])
{
case '0':
*txvfo = priv->tx_vfo = (*split && !transmitting) ? RIG_VFO_B : RIG_VFO_A;
if (rig->state.rx_vfo == RIG_VFO_A)
{
TRACE;
*txvfo = priv->tx_vfo = (*split && !transmitting) ? RIG_VFO_B : RIG_VFO_A;
}
else if (rig->state.rx_vfo == RIG_VFO_B)
{
TRACE;
*txvfo = priv->tx_vfo = (*split && !transmitting) ? RIG_VFO_B : RIG_VFO_A;
}
else
{
rig_debug(RIG_DEBUG_WARN, "%s(%d): unknown rxVFO=%s\n", __func__, __LINE__,
rig_strvfo(rig->state.rx_vfo));
*txvfo = RIG_VFO_A; // pick a default
}
break;
case '1':
*txvfo = priv->tx_vfo = (*split && !transmitting) ? RIG_VFO_A : RIG_VFO_B;
if (rig->state.rx_vfo == RIG_VFO_A)
{
TRACE;
*txvfo = priv->tx_vfo = (*split && !transmitting) ? RIG_VFO_A : RIG_VFO_B;
}
else if (rig->state.rx_vfo == RIG_VFO_B)
{
TRACE;
*txvfo = priv->tx_vfo = (*split && !transmitting) ? RIG_VFO_B : RIG_VFO_A;
}
else
{
rig_debug(RIG_DEBUG_WARN, "%s(%d): unknown rxVFO=%s\n", __func__, __LINE__,
rig_strvfo(rig->state.rx_vfo));
*txvfo = RIG_VFO_A; // pick a default
}
break;
case '2':
@ -1619,6 +1718,7 @@ int kenwood_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
}
rig_get_freq(rig, tvfo, &tfreq);
if (tfreq == freq)
{
rig_debug(RIG_DEBUG_TRACE, "%s: no freq change needed\n", __func__);
@ -2062,9 +2162,24 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
struct kenwood_priv_data *priv = rig->state.priv;
struct kenwood_priv_caps *caps = kenwood_caps(rig);
rig_debug(RIG_DEBUG_VERBOSE,
"%s called, vfo=%s, mode=%s, width=%d, curr_vfo=%s\n", __func__,
rig_strvfo(vfo), rig_strrmode(mode), (int)width,
rig_strvfo(rig->state.current_vfo));
rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, mode=%s, width=%d\n", __func__,
rig_strvfo(vfo), rig_strrmode(mode), (int)width);
// we wont' set opposite VFO if the mode is the same as requested
// setting VFOB mode requires split modifications which cause VFO flashing
// this should generally work unless the user changes mode on VFOB
// in which case VFOB won't get mode changed until restart
if (priv->split && (priv->tx_vfo & (RIG_VFO_B | RIG_VFO_SUB | RIG_VFO_SUB_A)))
{
if (priv->modeB == mode)
{
rig_debug(RIG_DEBUG_TRACE, "%s: VFOB mode already %s so ignoring request\n",
__func__, rig_strrmode(mode));
return (RIG_OK);
}
}
if (RIG_IS_TS590S || RIG_IS_TS590SG || RIG_IS_TS950S || RIG_IS_TS950SDX)
{
@ -2094,7 +2209,10 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
/* emulations like PowerSDR and SmartSDR normally hijack the
RTTY modes for SSB-DATA AFSK modes */
rig_debug(RIG_DEBUG_VERBOSE, "%s: emulate=%d, HPSDR=%d, changing PKT mode to RTTY\n", __func__, priv->is_emulation, RIG_IS_HPSDR);
rig_debug(RIG_DEBUG_VERBOSE,
"%s: emulate=%d, HPSDR=%d, changing PKT mode to RTTY\n", __func__,
priv->is_emulation, RIG_IS_HPSDR);
if (RIG_MODE_PKTLSB == mode) { mode = RIG_MODE_RTTY; }
if (RIG_MODE_PKTUSB == mode) { mode = RIG_MODE_RTTYR; }
@ -2175,18 +2293,37 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
datamode = 1;
}
}
rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_mode=%s, new_mode=%s\n", __func__, rig_strrmode(priv->curr_mode), rig_strrmode(mode));
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s, curr_mode=%s, new_mode=%s\n",
__func__, rig_strvfo(vfo), rig_strrmode(priv->curr_mode), rig_strrmode(mode));
// only change mode if needed
if (priv->curr_mode != mode)
{
snprintf(buf, sizeof(buf), "MD%c", c);
err = kenwood_transaction(rig, buf, NULL, 0);
}
// determine if we need to set datamode on A or B
needdata = 0;
if ((vfo == RIG_VFO_A) && ((priv->datamodeA == 0 && datamode) || (priv->datamodeA == 1 && !datamode)))
if (vfo == RIG_VFO_CURR)
{
TRACE;
vfo = rig->state.current_vfo;
}
if ((vfo & (RIG_VFO_A | RIG_VFO_MAIN)) && ((priv->datamodeA == 0 && datamode)
|| (priv->datamodeA == 1 && !datamode)))
{
needdata = 1;
if ((vfo == RIG_VFO_B) && ((priv->datamodeB == 0 && datamode) || (priv->datamodeB == 1 && !datamode)))
}
if ((vfo & (RIG_VFO_B | RIG_VFO_SUB)) && ((priv->datamodeB == 0 && datamode)
|| (priv->datamodeB == 1 && !datamode)))
{
needdata = 1;
}
if (needdata)
{
@ -2196,6 +2333,11 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (err != RIG_OK) { RETURNFUNC(err); }
}
else if (datamode)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): datamode set on %s not needed\n",
__func__, __LINE__, rig_strvfo(vfo));
}
if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(RIG_OK); }
@ -2339,7 +2481,8 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
struct kenwood_priv_data *priv = rig->state.priv;
struct kenwood_priv_caps *caps = kenwood_caps(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig_debug(RIG_DEBUG_VERBOSE, "%s called, curr_vfo=%s\n", __func__,
rig_strvfo(rig->state.current_vfo));
if (!mode || !width)
{
@ -2351,7 +2494,8 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
/* only need to get it if it has to be initialized */
if (priv->curr_mode > 0 && priv->is_emulation && vfo == RIG_VFO_B)
{
RETURNFUNC(priv->curr_mode);
rig->state.current_vfo = RIG_VFO_A;
RETURNFUNC(RIG_OK);
}
if (RIG_IS_TS990S)
@ -2382,7 +2526,8 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
}
else
{
if (vfo == RIG_VFO_B && rig->caps->rig_model == RIG_MODEL_K4) // K4 new MD$ command for VFOB
if (vfo == RIG_VFO_B
&& rig->caps->rig_model == RIG_MODEL_K4) // K4 new MD$ command for VFOB
{
snprintf(cmd, sizeof(cmd), "MD$");
offs = 3;
@ -2416,7 +2561,10 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
/* emulations like PowerSDR and SmartSDR normally hijack the
RTTY modes for SSB-DATA AFSK modes */
rig_debug(RIG_DEBUG_VERBOSE, "%s: emulate=%d, HPSDR=%d, changing RTTY mode to PKT\n", __func__, priv->is_emulation, RIG_IS_HPSDR);
rig_debug(RIG_DEBUG_VERBOSE,
"%s: emulate=%d, HPSDR=%d, changing RTTY mode to PKT\n", __func__,
priv->is_emulation, RIG_IS_HPSDR);
if (RIG_MODE_RTTY == *mode) { *mode = RIG_MODE_PKTLSB; }
if (RIG_MODE_RTTYR == *mode) { *mode = RIG_MODE_PKTUSB; }
@ -2434,8 +2582,9 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
if ('1' == modebuf[2])
{
if (vfo == RIG_VFO_A) priv->datamodeA = 1;
else priv->datamodeB = 1;
if (vfo == RIG_VFO_A) { priv->datamodeA = 1; }
else { priv->datamodeB = 1; }
switch (*mode)
{
case RIG_MODE_USB: *mode = RIG_MODE_PKTUSB; break;
@ -2451,8 +2600,8 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
}
else
{
if (vfo == RIG_VFO_A) priv->datamodeA = 0;
else priv->datamodeB = 0;
if (vfo == RIG_VFO_A) { priv->datamodeA = 0; }
else { priv->datamodeB = 0; }
}
}
@ -2472,9 +2621,9 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
*width = rig_passband_normal(rig, *mode);
}
if (vfo == RIG_VFO_A) priv->modeA = *mode;
else priv->modeB = *mode;
if (vfo == RIG_VFO_A) { priv->modeA = *mode; }
else { priv->modeB = *mode; }
RETURNFUNC(RIG_OK);
}
@ -2541,7 +2690,7 @@ static int kenwood_get_micgain_minmax(RIG *rig, int *micgain_now,
if (retval != RIG_OK) { RETURNFUNC(retval); }
retval = read_string(&rs->rigport, levelbuf, sizeof(levelbuf), NULL, 0, 0);
retval = read_string(&rs->rigport, levelbuf, sizeof(levelbuf), NULL, 0, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval);
@ -2640,7 +2789,7 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
if (retval != RIG_OK) { RETURNFUNC(retval); }
retval = read_string(&rs->rigport, levelbuf, sizeof(levelbuf), NULL, 0, 0);
retval = read_string(&rs->rigport, levelbuf, sizeof(levelbuf), NULL, 0, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval);
@ -4477,18 +4626,15 @@ int kenwood_set_trn(RIG *rig, int trn)
case RIG_MODEL_TS990S:
RETURNFUNC(kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI2" : "AI0", NULL,
0));
break;
case RIG_MODEL_THD7A:
case RIG_MODEL_THD74:
RETURNFUNC(kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI 1" : "AI 0", buf,
sizeof buf));
break;
default:
RETURNFUNC(kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI1" : "AI0", NULL,
0));
break;
}
}
@ -5307,7 +5453,7 @@ DECLARE_PROBERIG_BACKEND(kenwood)
}
retval = write_block(port, "ID;", 3);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2, 0);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2, 0, 1);
close(port->fd);
if (retval != RIG_OK || id_len < 0)
@ -5374,7 +5520,7 @@ DECLARE_PROBERIG_BACKEND(kenwood)
}
retval = write_block(port, "K2;", 3);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2, 0);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2, 0, 1);
close(port->fd);
if (retval != RIG_OK)

Wyświetl plik

@ -28,7 +28,7 @@
#include "token.h"
#include "misc.h"
#define BACKEND_VER "20211118"
#define BACKEND_VER "20211128"
#define EOM_KEN ';'
#define EOM_TH '\r'

Wyświetl plik

@ -442,7 +442,7 @@ static int ts480_read_meters(RIG *rig, int *swr, int *comp, int *alc)
// TS-480 returns values for all meters at the same time, for example: RM10000;RM20000;RM30000;
retval = read_string(&rs->rigport, ackbuf, expected_len + 1, NULL, 0, 0);
retval = read_string(&rs->rigport, ackbuf, expected_len + 1, NULL, 0, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: read_string retval=%d\n", __func__, retval);

Wyświetl plik

@ -224,6 +224,7 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
default:
return kenwood_get_level(rig, vfo, level, val);
}
return -RIG_EINTERNAL;
}

Wyświetl plik

@ -285,7 +285,7 @@ int xg3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return retval;
}
retval = read_string(&rs->rigport, replybuf, replysize, ";", 1, 0);
retval = read_string(&rs->rigport, replybuf, replysize, ";", 1, 0, 1);
if (retval < 0)
{
@ -462,7 +462,7 @@ int xg3_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return retval;
}
retval = read_string(&rs->rigport, freqbuf, freqsize, ";", 1, 0);
retval = read_string(&rs->rigport, freqbuf, freqsize, ";", 1, 0, 1);
if (retval < 0)
{
@ -514,7 +514,7 @@ int xg3_get_powerstat(RIG *rig, powerstat_t *status)
if (retval == RIG_OK)
{
char reply[32];
retval = read_string(&rs->rigport, reply, sizeof(reply), ";", 1, 0);
retval = read_string(&rs->rigport, reply, sizeof(reply), ";", 1, 0, 1);
*status = RIG_POWER_ON;
priv->powerstat = RIG_POWER_ON;
}
@ -578,7 +578,7 @@ int xg3_get_mem(RIG *rig, vfo_t vfo, int *ch)
return retval;
}
retval = read_string(&rs->rigport, reply, sizeof(reply), ";", 1, 0);
retval = read_string(&rs->rigport, reply, sizeof(reply), ";", 1, 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -75,7 +75,8 @@ static int funcubepro_get_level(RIG *rig, vfo_t vfo, setting_t level,
value_t *val);
static const char *funcube_get_info(RIG *rig);
static int funcube_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
static int funcube_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width);
static const struct confparams funcube_cfg_params[] =
{
@ -943,7 +944,8 @@ int funcubepro_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return RIG_OK;
}
static int funcube_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
static int funcube_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width)
{
if (rig->caps->rig_model == RIG_MODEL_FUNCUBEDONGLE)
{
@ -953,6 +955,7 @@ static int funcube_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width
{
*mode = RIG_MODE_IQ;
}
*width = 192000;
return RIG_OK;
}

Wyświetl plik

@ -102,7 +102,7 @@ static int rshfiq_open(RIG *rig)
return retval;
}
retval = read_string(&rig->state.rigport, versionstr, 20, stopset, 2, 0);
retval = read_string(&rig->state.rigport, versionstr, 20, stopset, 2, 0, 1);
}
if (retval <= 0)
@ -191,7 +191,7 @@ static int rshfiq_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return retval;
}
retval = read_string(&rig->state.rigport, cmdstr, 9, stopset, 2, 0);
retval = read_string(&rig->state.rigport, cmdstr, 9, stopset, 2, 0, 1);
if (retval <= 0)
{
@ -276,7 +276,7 @@ static int rshfiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
stopset[0] = '\r';
stopset[1] = '\n';
retval = read_string(&rig->state.rigport, cmdstr, 9, stopset, 2, 0);
retval = read_string(&rig->state.rigport, cmdstr, 9, stopset, 2, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_RFPOWER_METER reply=%s\n", cmdstr);
@ -314,7 +314,7 @@ static int rshfiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
stopset[0] = '\r';
stopset[1] = '\n';
retval = read_string(&rig->state.rigport, cmdstr, 9, stopset, 2, 0);
retval = read_string(&rig->state.rigport, cmdstr, 9, stopset, 2, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_TEMP_METER reply=%s\n", cmdstr);

Wyświetl plik

@ -79,7 +79,7 @@ int lowe_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, data, BUFSZ, CR, 1, 0);
retval = read_string(&rs->rigport, data, BUFSZ, CR, 1, 0, 1);
if (retval == -RIG_ETIMEOUT)
{
@ -342,7 +342,7 @@ DECLARE_PROBERIG_BACKEND(lowe)
}
retval = write_block(port, "TYP?" EOM, 4);
id_len = read_string(port, idbuf, BUFSZ, CR, 2, 0);
id_len = read_string(port, idbuf, BUFSZ, CR, 2, 0, 1);
close(port->fd);

Wyświetl plik

@ -170,7 +170,7 @@ static int read_prompt_and_send(hamlib_port_t *rigport,
buflen = (data_len == NULL) ? sizeof(buf) : *data_len;
retval = read_string(rigport, data, buflen, delimiter, 1, 0);
retval = read_string(rigport, data, buflen, delimiter, 1, 0, 1);
if (retval < 0)
{
@ -230,7 +230,7 @@ static int prm80_wait_for_prompt(hamlib_port_t *rigport)
int retval;
// Read up to the '>' prompt and discard content.
retval = read_string(rigport, buf, sizeof(buf), ">", 1, 0);
retval = read_string(rigport, buf, sizeof(buf), ">", 1, 0, 1);
if (retval < 0)
{
@ -910,7 +910,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
if (ret == 3 && buf[2] == 'T')
{
// Read the question
ret = read_string(&rs->rigport, buf, sizeof(buf), "?", 1, 0);
ret = read_string(&rs->rigport, buf, sizeof(buf), "?", 1, 0, 1);
if (ret < 0)
{
@ -1126,7 +1126,7 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
}
// Read CRLF
ret = read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0);
ret = read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0, 1);
if (ret < 0)
{
@ -1142,7 +1142,7 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
for (i = 0; i < (RSSI_HOLD_ADDR / 16) + 1; i++)
{
ret = read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0);
ret = read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0, 1);
if (ret < 0)
{
@ -1158,7 +1158,7 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
// discard the remaining content of RAM print
for (i = 0; i < (16 - RSSI_HOLD_ADDR / 16) - 1; i++)
{
read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0);
read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0, 1);
}
prm80_wait_for_prompt(&rs->rigport);
@ -1281,7 +1281,7 @@ const char *prm80_get_info(RIG *rig)
return NULL;
}
ret = read_string(&rs->rigport, s_buf, BUFSZ, ">", 1, 0);
ret = read_string(&rs->rigport, s_buf, BUFSZ, ">", 1, 0, 1);
if (ret < 0)
{

Wyświetl plik

@ -122,7 +122,7 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
do
{
retval = read_string(&rs->rigport, respbuf, BUFSZ, EOM, strlen(EOM), 0);
retval = read_string(&rs->rigport, respbuf, BUFSZ, EOM, strlen(EOM), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -100,7 +100,7 @@ static int racal_transaction(RIG *rig, const char *cmd, char *data,
return retval;
}
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0);
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0, 1);
if (retval <= 0)
{

Wyświetl plik

@ -71,7 +71,7 @@ int rft_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, data, BUFSZ, CR, 1, 0);
retval = read_string(&rs->rigport, data, BUFSZ, CR, 1, 0, 1);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -89,7 +89,7 @@ gp2000_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, data, RESPSZ, CR, 1, 0);
retval = read_string(&rs->rigport, data, RESPSZ, CR, 1, 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -80,7 +80,7 @@ int rs_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, data, BUFSZ, CR, 1, 0);
retval = read_string(&rs->rigport, data, BUFSZ, CR, 1, 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -88,7 +88,7 @@ static int skanti_transaction(RIG *rig, const char *cmd, int cmd_len,
* Transceiver sends back ">"
*/
char retbuf[BUFSZ + 1];
retval = read_string(&rs->rigport, retbuf, BUFSZ, PROMPT, strlen(PROMPT), 0);
retval = read_string(&rs->rigport, retbuf, BUFSZ, PROMPT, strlen(PROMPT), 0, 1);
if (retval < 0)
{
@ -107,7 +107,7 @@ static int skanti_transaction(RIG *rig, const char *cmd, int cmd_len,
}
}
retval = read_string(&rs->rigport, data, BUFSZ, LF, strlen(LF), 0);
retval = read_string(&rs->rigport, data, BUFSZ, LF, strlen(LF), 0, 1);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -288,7 +288,8 @@ static int tt588_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
if (data)
{
retval = read_string(&rs->rigport, data, (*data_len) + 1, term, strlen(term), 0);
retval = read_string(&rs->rigport, data, (*data_len) + 1, term, strlen(term), 0,
1);
if (retval != -RIG_ETIMEOUT)
{
@ -310,7 +311,7 @@ static int tt588_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
write_block(&rs->rigport, "XX" EOM,
3); // we wont' worry about the response here
retval = read_string(&rs->rigport, xxbuf, sizeof(xxbuf), "",
0, 0); // this should timeout
0, 0, 1); // this should timeout
if (retval != RIG_OK)
{

Wyświetl plik

@ -156,7 +156,7 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
#endif
*data_len = data_len_init; /* restore orig. buffer length */
*data_len = read_string(&rs->rigport, data, *data_len,
EOM, strlen(EOM), 0);
EOM, strlen(EOM), 0, 1);
if (!strncmp(data, "Z!", 2)) // command unrecognized??
{
@ -197,7 +197,7 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
passcount, itry);
*data_len = data_len_init; /* restore orig. buffer length */
read_string(&rs->rigport, data, *data_len,
EOM, strlen(EOM), 0); // purge the input stream...
EOM, strlen(EOM), 0, 1); // purge the input stream...
continue; // now go retry the full command
}
}

Wyświetl plik

@ -269,7 +269,7 @@ static int rx331_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, data, BUFSZ, EOM, 1, 0);
retval = read_string(&rs->rigport, data, BUFSZ, EOM, 1, 0, 1);
if (retval < 0)
{
@ -780,6 +780,7 @@ int rx331_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
return -RIG_EPROTO;
}
f = val->i / 120.0;
val->f = 1.0 - f;

Wyświetl plik

@ -219,7 +219,7 @@ static int rx340_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, data, BUFSZ, EOM, 1, 0);
retval = read_string(&rs->rigport, data, BUFSZ, EOM, 1, 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -85,7 +85,7 @@ int tentec_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, data, *data_len, NULL, 0, 0);
retval = read_string(&rs->rigport, data, *data_len, NULL, 0, 0, 1);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -103,7 +103,7 @@ tt550_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, data, *data_len, NULL, 0, 0);
retval = read_string(&rs->rigport, data, *data_len, NULL, 0, 0, 1);
if (retval == -RIG_ETIMEOUT)
{
@ -1699,7 +1699,8 @@ tt550_decode_event(RIG *rig)
priv = (struct tt550_priv_data *) rs->priv;
data_len = read_string(&rs->rigport, (char *) buf, MAXFRAMELEN, "\n\r", 2, 0);
data_len = read_string(&rs->rigport, (char *) buf, MAXFRAMELEN, "\n\r", 2, 0,
1);
if (data_len == -RIG_ETIMEOUT)

Wyświetl plik

@ -156,7 +156,7 @@ transaction_write:
}
memset(data, 0, *datasize);
retval = read_string(&rs->rigport, data, *datasize, EOM, strlen(EOM), 0);
retval = read_string(&rs->rigport, data, *datasize, EOM, strlen(EOM), 0, 1);
if (retval < 0)
{
@ -838,7 +838,7 @@ DECLARE_PROBERIG_BACKEND(uniden)
}
retval = write_block(port, "SI"EOM, 3);
id_len = read_string(port, idbuf, IDBUFSZ, EOM, 1, 0);
id_len = read_string(port, idbuf, IDBUFSZ, EOM, 1, 0, 1);
close(port->fd);
if (retval != RIG_OK || id_len < 0)

Wyświetl plik

@ -138,7 +138,7 @@ transaction_write:
}
memset(data, 0, *datasize);
retval = read_string(&rs->rigport, data, *datasize, EOM, strlen(EOM), 0);
retval = read_string(&rs->rigport, data, *datasize, EOM, strlen(EOM), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -36,7 +36,8 @@
#include "yaesu.h"
#include "frg100.h"
enum frg100_native_cmd_e {
enum frg100_native_cmd_e
{
FRG100_NATIVE_RECALL_MEM = 0, /* 0x02, p1=ch */
FRG100_NATIVE_VFO_TO_MEM, /* 0x03, p1=ch, p2=0 */
FRG100_NATIVE_MEM_HIDE, /* 0x03, p1=ch, p2=1 */

Wyświetl plik

@ -41,51 +41,52 @@
#include "misc.h"
#include "bandplan.h"
enum ft100_native_cmd_e {
enum ft100_native_cmd_e
{
FT100_NATIVE_CAT_LOCK_ON = 0,
FT100_NATIVE_CAT_LOCK_OFF,
FT100_NATIVE_CAT_PTT_ON,
FT100_NATIVE_CAT_PTT_OFF,
FT100_NATIVE_CAT_SET_FREQ,
FT100_NATIVE_CAT_SET_MODE_LSB,
FT100_NATIVE_CAT_SET_MODE_USB,
FT100_NATIVE_CAT_SET_MODE_CW,
FT100_NATIVE_CAT_SET_MODE_CWR,
FT100_NATIVE_CAT_SET_MODE_AM,
FT100_NATIVE_CAT_SET_MODE_FM,
FT100_NATIVE_CAT_SET_MODE_DIG,
FT100_NATIVE_CAT_SET_MODE_WFM,
FT100_NATIVE_CAT_CLAR_ON,
FT100_NATIVE_CAT_CLAR_OFF,
FT100_NATIVE_CAT_SET_CLAR_FREQ,
FT100_NATIVE_CAT_SET_VFOAB,
FT100_NATIVE_CAT_SET_VFOA,
FT100_NATIVE_CAT_SET_VFOB,
FT100_NATIVE_CAT_SPLIT_ON,
FT100_NATIVE_CAT_SPLIT_OFF,
FT100_NATIVE_CAT_SET_RPT_SHIFT_MINUS,
FT100_NATIVE_CAT_SET_RPT_SHIFT_PLUS,
FT100_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX,
FT100_NATIVE_CAT_SET_RPT_OFFSET,
/* fix me */
FT100_NATIVE_CAT_SET_DCS_ON,
FT100_NATIVE_CAT_SET_CTCSS_ENC_ON,
FT100_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON,
FT100_NATIVE_CAT_SET_CTCSS_DCS_OFF,
/* em xif */
FT100_NATIVE_CAT_SET_CTCSS_FREQ,
FT100_NATIVE_CAT_SET_DCS_CODE,
FT100_NATIVE_CAT_GET_RX_STATUS,
FT100_NATIVE_CAT_GET_TX_STATUS,
FT100_NATIVE_CAT_GET_FREQ_MODE_STATUS,
FT100_NATIVE_CAT_PWR_WAKE,
FT100_NATIVE_CAT_PWR_ON,
FT100_NATIVE_CAT_PWR_OFF,
FT100_NATIVE_CAT_READ_STATUS,
FT100_NATIVE_CAT_READ_METERS,
FT100_NATIVE_CAT_READ_FLAGS,
FT100_NATIVE_SIZE /* end marker */
FT100_NATIVE_CAT_LOCK_ON = 0,
FT100_NATIVE_CAT_LOCK_OFF,
FT100_NATIVE_CAT_PTT_ON,
FT100_NATIVE_CAT_PTT_OFF,
FT100_NATIVE_CAT_SET_FREQ,
FT100_NATIVE_CAT_SET_MODE_LSB,
FT100_NATIVE_CAT_SET_MODE_USB,
FT100_NATIVE_CAT_SET_MODE_CW,
FT100_NATIVE_CAT_SET_MODE_CWR,
FT100_NATIVE_CAT_SET_MODE_AM,
FT100_NATIVE_CAT_SET_MODE_FM,
FT100_NATIVE_CAT_SET_MODE_DIG,
FT100_NATIVE_CAT_SET_MODE_WFM,
FT100_NATIVE_CAT_CLAR_ON,
FT100_NATIVE_CAT_CLAR_OFF,
FT100_NATIVE_CAT_SET_CLAR_FREQ,
FT100_NATIVE_CAT_SET_VFOAB,
FT100_NATIVE_CAT_SET_VFOA,
FT100_NATIVE_CAT_SET_VFOB,
FT100_NATIVE_CAT_SPLIT_ON,
FT100_NATIVE_CAT_SPLIT_OFF,
FT100_NATIVE_CAT_SET_RPT_SHIFT_MINUS,
FT100_NATIVE_CAT_SET_RPT_SHIFT_PLUS,
FT100_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX,
FT100_NATIVE_CAT_SET_RPT_OFFSET,
/* fix me */
FT100_NATIVE_CAT_SET_DCS_ON,
FT100_NATIVE_CAT_SET_CTCSS_ENC_ON,
FT100_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON,
FT100_NATIVE_CAT_SET_CTCSS_DCS_OFF,
/* em xif */
FT100_NATIVE_CAT_SET_CTCSS_FREQ,
FT100_NATIVE_CAT_SET_DCS_CODE,
FT100_NATIVE_CAT_GET_RX_STATUS,
FT100_NATIVE_CAT_GET_TX_STATUS,
FT100_NATIVE_CAT_GET_FREQ_MODE_STATUS,
FT100_NATIVE_CAT_PWR_WAKE,
FT100_NATIVE_CAT_PWR_ON,
FT100_NATIVE_CAT_PWR_OFF,
FT100_NATIVE_CAT_READ_STATUS,
FT100_NATIVE_CAT_READ_METERS,
FT100_NATIVE_CAT_READ_FLAGS,
FT100_NATIVE_SIZE /* end marker */
};
/*
@ -95,41 +96,41 @@ enum ft100_native_cmd_e {
*/
typedef struct
{
unsigned char band_no;
unsigned char freq[4];
unsigned char mode;
unsigned char ctcss;
unsigned char dcs;
unsigned char flag1;
unsigned char flag2;
unsigned char clarifier[2];
unsigned char not_used;
unsigned char step1;
unsigned char step2;
unsigned char filter;
unsigned char band_no;
unsigned char freq[4];
unsigned char mode;
unsigned char ctcss;
unsigned char dcs;
unsigned char flag1;
unsigned char flag2;
unsigned char clarifier[2];
unsigned char not_used;
unsigned char step1;
unsigned char step2;
unsigned char filter;
unsigned char stuffing[16];
unsigned char stuffing[16];
}
FT100_STATUS_INFO;
FT100_STATUS_INFO;
typedef struct
{
unsigned char mic_switch_1;
unsigned char tx_fwd_power;
unsigned char tx_rev_power;
unsigned char s_meter;
unsigned char mic_level;
unsigned char squelch_level;
unsigned char mic_switch_2;
unsigned char final_temp;
unsigned char alc_level;
unsigned char mic_switch_1;
unsigned char tx_fwd_power;
unsigned char tx_rev_power;
unsigned char s_meter;
unsigned char mic_level;
unsigned char squelch_level;
unsigned char mic_switch_2;
unsigned char final_temp;
unsigned char alc_level;
}
FT100_METER_INFO;
FT100_METER_INFO;
typedef struct
{
unsigned char byte[8];
unsigned char byte[8];
}
FT100_FLAG_INFO;
@ -161,8 +162,10 @@ static int ft100_set_parm(RIG *rig, setting_t parm, value_t val);
static int ft100_get_parm(RIG *rig, setting_t parm, value_t *val);
#endif
static int ft100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
static int ft100_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
static int ft100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo);
static int ft100_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo);
static int ft100_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift);
static int ft100_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *shift);
@ -525,7 +528,7 @@ static int ft100_send_priv_cmd(RIG *rig, unsigned char cmd_index)
if (!rig) { return -RIG_EINVAL; }
return write_block(&rig->state.rigport, (char *) &ncmd[cmd_index].nseq,
YAESU_CMD_LENGTH);
YAESU_CMD_LENGTH);
}
static int ft100_read_status(RIG *rig)
@ -920,18 +923,24 @@ int ft100_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
case RIG_PTT_ON:
cmd_index = FT100_NATIVE_CAT_PTT_ON;
if (split) rig_set_vfo(rig,RIG_VFO_B);
if (split) { rig_set_vfo(rig, RIG_VFO_B); }
break;
case RIG_PTT_OFF:
cmd_index = FT100_NATIVE_CAT_PTT_OFF;
if (split) rig_set_vfo(rig,RIG_VFO_A);
hl_usleep(100*1000); // give ptt some time to do it's thing -- fake it was not reseting freq after tx
if (split) { rig_set_vfo(rig, RIG_VFO_A); }
hl_usleep(100 *
1000); // give ptt some time to do it's thing -- fake it was not reseting freq after tx
break;
default:
return -RIG_EINVAL;
}
return ft100_send_priv_cmd(rig, cmd_index);
}
@ -974,9 +983,11 @@ int ft100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
rig_debug(RIG_DEBUG_VERBOSE, "%s: %s\n", __func__, rig_strlevel(level));
// if in split have to switch to VFOB to read power and back to VFOA
if (split && ptt) rig_set_vfo(rig, RIG_VFO_B);
if (split && ptt) { rig_set_vfo(rig, RIG_VFO_B); }
ret = ft100_send_priv_cmd(rig, FT100_NATIVE_CAT_READ_METERS);
if (split && ptt) rig_set_vfo(rig, RIG_VFO_A);
if (split && ptt) { rig_set_vfo(rig, RIG_VFO_A); }
if (ret != RIG_OK)
{

Wyświetl plik

@ -44,73 +44,74 @@
#include "ft1000d.h"
// FT1000D native commands
enum FT1000D_native_cmd_e {
FT1000D_NATIVE_SPLIT_OFF = 0,
FT1000D_NATIVE_SPLIT_ON,
FT1000D_NATIVE_RECALL_MEM,
FT1000D_NATIVE_VFO_TO_MEM,
FT1000D_NATIVE_LOCK_OFF,
FT1000D_NATIVE_LOCK_ON,
FT1000D_NATIVE_VFO_A,
FT1000D_NATIVE_VFO_B,
FT1000D_NATIVE_MEM_TO_VFO,
FT1000D_NATIVE_VFO_STEP_UP,
FT1000D_NATIVE_VFO_STEP_UP_FAST,
FT1000D_NATIVE_VFO_STEP_DOWN,
FT1000D_NATIVE_VFO_STEP_DOWN_FAST,
FT1000D_NATIVE_RX_CLARIFIER_OFF,
FT1000D_NATIVE_RX_CLARIFIER_ON,
FT1000D_NATIVE_TX_CLARIFIER_OFF,
FT1000D_NATIVE_TX_CLARIFIER_ON,
FT1000D_NATIVE_CLEAR_CLARIFIER_OFFSET,
FT1000D_NATIVE_CLARIFIER_OPS,
FT1000D_NATIVE_FREQ_SET,
FT1000D_NATIVE_MODE_SET_LSB,
FT1000D_NATIVE_MODE_SET_USB,
FT1000D_NATIVE_MODE_SET_CW_W,
FT1000D_NATIVE_MODE_SET_CW_N,
FT1000D_NATIVE_MODE_SET_AM_W,
FT1000D_NATIVE_MODE_SET_AM_N,
FT1000D_NATIVE_MODE_SET_FM,
FT1000D_NATIVE_MODE_SET_RTTY_LSB,
FT1000D_NATIVE_MODE_SET_RTTY_USB,
FT1000D_NATIVE_MODE_SET_PKT_LSB,
FT1000D_NATIVE_MODE_SET_PKT_FM,
FT1000D_NATIVE_MODE_SUB_VFOB_SET_LSB, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_USB, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_CW_W, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_CW_N, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_AM_W, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_AM_N, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_FM, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_RTTY_LSB, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_RTTY_USB, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_PKT_LSB, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_PKT_FM, /* Added December 2016 */
FT1000D_NATIVE_PACING,
FT1000D_NATIVE_PTT_OFF,
FT1000D_NATIVE_PTT_ON,
FT1000D_NATIVE_UPDATE_ALL_DATA,
FT1000D_NATIVE_UPDATE_MEM_CHNL,
FT1000D_NATIVE_UPDATE_OP_DATA,
FT1000D_NATIVE_UPDATE_VFO_DATA,
FT1000D_NATIVE_UPDATE_MEM_CHNL_DATA,
FT1000D_NATIVE_TUNER_OFF,
FT1000D_NATIVE_TUNER_ON,
FT1000D_NATIVE_TUNER_START,
FT1000D_NATIVE_RPTR_SHIFT_NONE,
FT1000D_NATIVE_RPTR_SHIFT_MINUS,
FT1000D_NATIVE_RPTR_SHIFT_PLUS,
FT1000D_NATIVE_VFO_TO_VFO,
FT1000D_NATIVE_SET_SUB_VFO_FREQ,
FT1000D_NATIVE_BANDWIDTH,
FT1000D_NATIVE_OP_FREQ_STEP_UP,
FT1000D_NATIVE_OP_FREQ_STEP_DOWN,
FT1000D_NATIVE_READ_METER,
FT1000D_NATIVE_DIM_LEVEL,
FT1000D_NATIVE_RPTR_OFFSET,
FT1000D_NATIVE_READ_FLAGS,
FT1000D_NATIVE_SIZE
enum FT1000D_native_cmd_e
{
FT1000D_NATIVE_SPLIT_OFF = 0,
FT1000D_NATIVE_SPLIT_ON,
FT1000D_NATIVE_RECALL_MEM,
FT1000D_NATIVE_VFO_TO_MEM,
FT1000D_NATIVE_LOCK_OFF,
FT1000D_NATIVE_LOCK_ON,
FT1000D_NATIVE_VFO_A,
FT1000D_NATIVE_VFO_B,
FT1000D_NATIVE_MEM_TO_VFO,
FT1000D_NATIVE_VFO_STEP_UP,
FT1000D_NATIVE_VFO_STEP_UP_FAST,
FT1000D_NATIVE_VFO_STEP_DOWN,
FT1000D_NATIVE_VFO_STEP_DOWN_FAST,
FT1000D_NATIVE_RX_CLARIFIER_OFF,
FT1000D_NATIVE_RX_CLARIFIER_ON,
FT1000D_NATIVE_TX_CLARIFIER_OFF,
FT1000D_NATIVE_TX_CLARIFIER_ON,
FT1000D_NATIVE_CLEAR_CLARIFIER_OFFSET,
FT1000D_NATIVE_CLARIFIER_OPS,
FT1000D_NATIVE_FREQ_SET,
FT1000D_NATIVE_MODE_SET_LSB,
FT1000D_NATIVE_MODE_SET_USB,
FT1000D_NATIVE_MODE_SET_CW_W,
FT1000D_NATIVE_MODE_SET_CW_N,
FT1000D_NATIVE_MODE_SET_AM_W,
FT1000D_NATIVE_MODE_SET_AM_N,
FT1000D_NATIVE_MODE_SET_FM,
FT1000D_NATIVE_MODE_SET_RTTY_LSB,
FT1000D_NATIVE_MODE_SET_RTTY_USB,
FT1000D_NATIVE_MODE_SET_PKT_LSB,
FT1000D_NATIVE_MODE_SET_PKT_FM,
FT1000D_NATIVE_MODE_SUB_VFOB_SET_LSB, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_USB, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_CW_W, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_CW_N, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_AM_W, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_AM_N, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_FM, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_RTTY_LSB, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_RTTY_USB, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_PKT_LSB, /* Added December 2016 */
FT1000D_NATIVE_MODE_SUB_VFOB_SET_PKT_FM, /* Added December 2016 */
FT1000D_NATIVE_PACING,
FT1000D_NATIVE_PTT_OFF,
FT1000D_NATIVE_PTT_ON,
FT1000D_NATIVE_UPDATE_ALL_DATA,
FT1000D_NATIVE_UPDATE_MEM_CHNL,
FT1000D_NATIVE_UPDATE_OP_DATA,
FT1000D_NATIVE_UPDATE_VFO_DATA,
FT1000D_NATIVE_UPDATE_MEM_CHNL_DATA,
FT1000D_NATIVE_TUNER_OFF,
FT1000D_NATIVE_TUNER_ON,
FT1000D_NATIVE_TUNER_START,
FT1000D_NATIVE_RPTR_SHIFT_NONE,
FT1000D_NATIVE_RPTR_SHIFT_MINUS,
FT1000D_NATIVE_RPTR_SHIFT_PLUS,
FT1000D_NATIVE_VFO_TO_VFO,
FT1000D_NATIVE_SET_SUB_VFO_FREQ,
FT1000D_NATIVE_BANDWIDTH,
FT1000D_NATIVE_OP_FREQ_STEP_UP,
FT1000D_NATIVE_OP_FREQ_STEP_DOWN,
FT1000D_NATIVE_READ_METER,
FT1000D_NATIVE_DIM_LEVEL,
FT1000D_NATIVE_RPTR_OFFSET,
FT1000D_NATIVE_READ_FLAGS,
FT1000D_NATIVE_SIZE
};
static int ft1000d_init(RIG *rig);
@ -120,20 +121,28 @@ static int ft1000d_close(RIG *rig);
static int ft1000d_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
static int ft1000d_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
static int ft1000d_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
static int ft1000d_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
static int ft1000d_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width);
static int ft1000d_set_vfo(RIG *rig, vfo_t vfo);
static int ft1000d_get_vfo(RIG *rig, vfo_t *vfo);
static int ft1000d_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
static int ft1000d_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
static int ft1000d_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift);
static int ft1000d_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift);
static int ft1000d_get_rptr_shift(RIG *rig, vfo_t vfo,
rptr_shift_t *rptr_shift);
static int ft1000d_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs);
static int ft1000d_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq); /* Added December 2016 */
static int ft1000d_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq); /* Added December 2016 */
static int ft1000d_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
static int ft1000d_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
static int ft1000d_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width); /* Added December 2016 */
static int ft1000d_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width); /* Added December 2016 */
static int ft1000d_set_split_freq(RIG *rig, vfo_t vfo,
freq_t tx_freq); /* Added December 2016 */
static int ft1000d_get_split_freq(RIG *rig, vfo_t vfo,
freq_t *tx_freq); /* Added December 2016 */
static int ft1000d_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo);
static int ft1000d_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo);
static int ft1000d_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
pbwidth_t tx_width); /* Added December 2016 */
static int ft1000d_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
pbwidth_t *tx_width); /* Added December 2016 */
static int ft1000d_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
static int ft1000d_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit);
static int ft1000d_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
@ -141,12 +150,14 @@ static int ft1000d_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status);
static int ft1000d_set_parm(RIG *rig, setting_t parm, value_t val);
static int ft1000d_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit);
static int ft1000d_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit);
static int ft1000d_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *value);
static int ft1000d_get_level(RIG *rig, vfo_t vfo, setting_t level,
value_t *value);
static int ft1000d_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op);
static int ft1000d_set_mem(RIG *rig, vfo_t vfo, int ch);
static int ft1000d_get_mem(RIG *rig, vfo_t vfo, int *ch);
static int ft1000d_set_channel (RIG *rig, vfo_t vfo, const channel_t *chan);
static int ft1000d_get_channel (RIG *rig, vfo_t vfo, channel_t *chan, int read_only);
static int ft1000d_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan);
static int ft1000d_get_channel(RIG *rig, vfo_t vfo, channel_t *chan,
int read_only);
@ -1121,7 +1132,8 @@ static int ft1000d_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs)
* the correct TX VFO is selected by the rig in split mode.
* An error is returned if vfo and tx_vfo are the same.
*/
static int ft1000d_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
static int ft1000d_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo)
{
struct ft1000d_priv_data *priv;
unsigned char ci;
@ -1222,7 +1234,8 @@ static int ft1000d_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vf
* Comments: The passed value for the vfo is ignored in order to
* preserve the current split vfo system settings.
*/
static int ft1000d_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
static int ft1000d_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo)
{
struct ft1000d_priv_data *priv;
int err;
@ -2076,7 +2089,8 @@ static int ft1000d_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
* In all other cases the passed vfo is selected if it differs
* from the currently selected VFO.
*/
static int ft1000d_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
static int ft1000d_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width)
{
struct ft1000d_priv_data *priv;
unsigned char *p;
@ -2435,7 +2449,8 @@ static int ft1000d_get_vfo(RIG *rig, vfo_t *vfo)
* In all other cases the passed vfo is selected if it differs
* from the currently selected VFO.
*/
static int ft1000d_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *value)
static int ft1000d_get_level(RIG *rig, vfo_t vfo, setting_t level,
value_t *value)
{
struct ft1000d_priv_data *priv;
unsigned char mdata[YAESU_CMD_LENGTH];
@ -2480,7 +2495,8 @@ static int ft1000d_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *valu
return err;
}
err = read_block(&rig->state.rigport, (char *) mdata, FT1000D_READ_METER_LENGTH);
err = read_block(&rig->state.rigport, (char *) mdata,
FT1000D_READ_METER_LENGTH);
if (err < 0)
{
@ -2798,7 +2814,8 @@ static int ft1000d_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
* Status for split operation, active rig functions and tuning steps
* are only relevant for currVFO
*/
static int ft1000d_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
static int ft1000d_get_channel(RIG *rig, vfo_t vfo, channel_t *chan,
int read_only)
{
struct ft1000d_priv_data *priv;
ft1000d_op_data_t *p;
@ -3279,7 +3296,8 @@ static int ft1000d_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_on
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
*/
static int ft1000d_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
static int ft1000d_get_update_data(RIG *rig, unsigned char ci,
unsigned short ch)
{
struct rig_state *rig_s;
struct ft1000d_priv_data *priv;
@ -3447,8 +3465,8 @@ static int ft1000d_send_static_cmd(RIG *rig, unsigned char ci)
* otherwise returns error from called functiion
*/
static int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
unsigned char p1, unsigned char p2,
unsigned char p3, unsigned char p4)
unsigned char p1, unsigned char p2,
unsigned char p3, unsigned char p4)
{
struct ft1000d_priv_data *priv;
int err;
@ -3768,7 +3786,7 @@ static int ft1000d_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
*/
static int ft1000d_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
pbwidth_t tx_width)
pbwidth_t tx_width)
{
int err;
unsigned char bw;
@ -3901,7 +3919,7 @@ static int ft1000d_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
*/
static int ft1000d_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
pbwidth_t *tx_width)
pbwidth_t *tx_width)
{
struct ft1000d_priv_data *priv;
int err;

Wyświetl plik

@ -117,10 +117,13 @@ static int ft1000mp_open(RIG *rig);
static int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
static int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
static int ft1000mp_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq);
static int ft1000mp_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq, rmode_t mode, pbwidth_t width);
static int ft1000mp_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq,
rmode_t mode, pbwidth_t width);
static int ft1000mp_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq);
static int ft1000mp_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
static int ft1000mp_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
static int ft1000mp_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo);
static int ft1000mp_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo);
static int ft1000mp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
pbwidth_t width); /* select mode */
static int ft1000mp_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
@ -131,7 +134,8 @@ static int ft1000mp_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
static int ft1000mp_set_xit(RIG *rig, vfo_t vfo, shortfreq_t rit);
static int ft1000mp_set_rxit(RIG *rig, vfo_t vfo, shortfreq_t rit);
static int ft1000mp_get_rxit(RIG *rig, vfo_t vfo, shortfreq_t *rit);
static int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
static int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level,
value_t *val);
static int ft1000mp_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
static int ft1000mp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
static int ft1000mp_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status);
@ -423,7 +427,7 @@ const struct rig_caps ft1000mp_caps =
.set_split_freq = ft1000mp_set_split_freq,
.get_split_freq = ft1000mp_get_split_freq,
.set_split_freq_mode =ft1000mp_set_split_freq_mode,
.set_split_freq_mode = ft1000mp_set_split_freq_mode,
.set_split_vfo = ft1000mp_set_split_vfo,
.get_split_vfo = ft1000mp_get_split_vfo,
@ -558,7 +562,7 @@ const struct rig_caps ft1000mpmkv_caps =
.set_split_freq = ft1000mp_set_split_freq,
.get_split_freq = ft1000mp_get_split_freq,
.set_split_freq_mode =ft1000mp_set_split_freq_mode,
.set_split_freq_mode = ft1000mp_set_split_freq_mode,
.set_split_vfo = ft1000mp_set_split_vfo,
.get_split_vfo = ft1000mp_get_split_vfo,
@ -693,7 +697,7 @@ const struct rig_caps ft1000mpmkvfld_caps =
.set_split_freq = ft1000mp_set_split_freq,
.get_split_freq = ft1000mp_get_split_freq,
.set_split_freq_mode =ft1000mp_set_split_freq_mode,
.set_split_freq_mode = ft1000mp_set_split_freq_mode,
.set_split_vfo = ft1000mp_set_split_vfo,
.get_split_vfo = ft1000mp_get_split_vfo,
@ -815,7 +819,8 @@ static int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
p = (struct ft1000mp_priv_data *)rig->state.priv;
rig_debug(RIG_DEBUG_TRACE, "%s: requested freq on %s = %"PRIfreq" Hz \n", __func__,
rig_debug(RIG_DEBUG_TRACE, "%s: requested freq on %s = %"PRIfreq" Hz \n",
__func__,
rig_strvfo(vfo), freq);
if (vfo == RIG_VFO_CURR)
@ -1066,7 +1071,8 @@ static int ft1000mp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
*
*/
static int ft1000mp_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
static int ft1000mp_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width)
{
struct ft1000mp_priv_data *priv;
unsigned char mymode; /* ft1000mp mode */
@ -1324,6 +1330,7 @@ static int ft1000mp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported set_func %s", __func__,
rig_strfunc(func));
}
RETURNFUNC(-RIG_EINVAL);
}
@ -1515,7 +1522,8 @@ static int ft1000mp_get_rxit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
}
static int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
static int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level,
value_t *val)
{
struct ft1000mp_priv_data *priv;
struct rig_state *rs;
@ -1687,13 +1695,15 @@ static int ft1000mp_send_priv_cmd(RIG *rig, unsigned char ci)
__func__);
RETURNFUNC(-RIG_EINVAL);
}
write_block(&rig->state.rigport, (char *) ncmd[ci].nseq, YAESU_CMD_LENGTH);
RETURNFUNC(RIG_OK);
}
static int ft1000mp_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
static int ft1000mp_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo)
{
unsigned char cmd_index = 0; /* index of sequence to send */
@ -1730,7 +1740,8 @@ static int ft1000mp_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_v
*
*/
static int ft1000mp_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
static int ft1000mp_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo)
{
struct ft1000mp_priv_data *p;
int retval;
@ -1772,7 +1783,8 @@ static int ft1000mp_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
RETURNFUNC(ft1000mp_set_freq(rig, RIG_VFO_B, tx_freq));
}
static int ft1000mp_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq, rmode_t mode, pbwidth_t width)
static int ft1000mp_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq,
rmode_t mode, pbwidth_t width)
{
// don't believe mode on VFOB can be different than mode on VFOA
return ft1000mp_set_split_freq(rig, vfo, freq);

Wyświetl plik

@ -152,7 +152,7 @@ const struct rig_caps ftdx1200_caps =
RIG_MODEL(RIG_MODEL_FTDX1200),
.model_name = "FTDX-1200",
.mfg_name = "Yaesu",
.version = NEWCAT_VER ".2",
.version = NEWCAT_VER ".3",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -320,4 +320,6 @@ const struct rig_caps ftdx1200_caps =
.set_ext_level = newcat_set_ext_level,
.get_ext_level = newcat_get_ext_level,
.send_morse = newcat_send_morse,
.set_clock = newcat_set_clock,
.get_clock = newcat_get_clock
};

Wyświetl plik

@ -41,47 +41,48 @@
#include "misc.h"
#include "bandplan.h"
enum ft600_native_cmd_e {
enum ft600_native_cmd_e
{
FT600_NATIVE_CAT_LOCK_ON = 0,
FT600_NATIVE_CAT_LOCK_OFF,
FT600_NATIVE_CAT_PTT_ON,
FT600_NATIVE_CAT_PTT_OFF,
FT600_NATIVE_CAT_SET_FREQ,
FT600_NATIVE_CAT_SET_MODE_LSB,
FT600_NATIVE_CAT_SET_MODE_USB,
FT600_NATIVE_CAT_SET_MODE_DIG,
FT600_NATIVE_CAT_SET_MODE_CW,
FT600_NATIVE_CAT_SET_MODE_AM,
FT600_NATIVE_CAT_CLAR_ON,
FT600_NATIVE_CAT_CLAR_OFF,
FT600_NATIVE_CAT_SET_CLAR_FREQ,
FT600_NATIVE_CAT_SET_VFOAB,
FT600_NATIVE_CAT_SET_VFOA,
FT600_NATIVE_CAT_SET_VFOB,
FT600_NATIVE_CAT_SPLIT_ON,
FT600_NATIVE_CAT_SPLIT_OFF,
FT600_NATIVE_CAT_SET_RPT_SHIFT_MINUS,
FT600_NATIVE_CAT_SET_RPT_SHIFT_PLUS,
FT600_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX,
FT600_NATIVE_CAT_SET_RPT_OFFSET,
/* fix me */
FT600_NATIVE_CAT_SET_DCS_ON,
FT600_NATIVE_CAT_SET_CTCSS_ENC_ON,
FT600_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON,
FT600_NATIVE_CAT_SET_CTCSS_DCS_OFF,
/* em xif */
FT600_NATIVE_CAT_SET_CTCSS_FREQ,
FT600_NATIVE_CAT_SET_DCS_CODE,
FT600_NATIVE_CAT_GET_RX_STATUS,
FT600_NATIVE_CAT_GET_TX_STATUS,
FT600_NATIVE_CAT_GET_FREQ_MODE_STATUS,
FT600_NATIVE_CAT_PWR_WAKE,
FT600_NATIVE_CAT_PWR_ON,
FT600_NATIVE_CAT_PWR_OFF,
FT600_NATIVE_CAT_READ_STATUS,
FT600_NATIVE_CAT_READ_METERS,
FT600_NATIVE_CAT_READ_FLAGS
FT600_NATIVE_CAT_LOCK_ON = 0,
FT600_NATIVE_CAT_LOCK_OFF,
FT600_NATIVE_CAT_PTT_ON,
FT600_NATIVE_CAT_PTT_OFF,
FT600_NATIVE_CAT_SET_FREQ,
FT600_NATIVE_CAT_SET_MODE_LSB,
FT600_NATIVE_CAT_SET_MODE_USB,
FT600_NATIVE_CAT_SET_MODE_DIG,
FT600_NATIVE_CAT_SET_MODE_CW,
FT600_NATIVE_CAT_SET_MODE_AM,
FT600_NATIVE_CAT_CLAR_ON,
FT600_NATIVE_CAT_CLAR_OFF,
FT600_NATIVE_CAT_SET_CLAR_FREQ,
FT600_NATIVE_CAT_SET_VFOAB,
FT600_NATIVE_CAT_SET_VFOA,
FT600_NATIVE_CAT_SET_VFOB,
FT600_NATIVE_CAT_SPLIT_ON,
FT600_NATIVE_CAT_SPLIT_OFF,
FT600_NATIVE_CAT_SET_RPT_SHIFT_MINUS,
FT600_NATIVE_CAT_SET_RPT_SHIFT_PLUS,
FT600_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX,
FT600_NATIVE_CAT_SET_RPT_OFFSET,
/* fix me */
FT600_NATIVE_CAT_SET_DCS_ON,
FT600_NATIVE_CAT_SET_CTCSS_ENC_ON,
FT600_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON,
FT600_NATIVE_CAT_SET_CTCSS_DCS_OFF,
/* em xif */
FT600_NATIVE_CAT_SET_CTCSS_FREQ,
FT600_NATIVE_CAT_SET_DCS_CODE,
FT600_NATIVE_CAT_GET_RX_STATUS,
FT600_NATIVE_CAT_GET_TX_STATUS,
FT600_NATIVE_CAT_GET_FREQ_MODE_STATUS,
FT600_NATIVE_CAT_PWR_WAKE,
FT600_NATIVE_CAT_PWR_ON,
FT600_NATIVE_CAT_PWR_OFF,
FT600_NATIVE_CAT_READ_STATUS,
FT600_NATIVE_CAT_READ_METERS,
FT600_NATIVE_CAT_READ_FLAGS
};
@ -92,28 +93,28 @@ enum ft600_native_cmd_e {
*/
typedef struct
{
unsigned char band_no;
unsigned char freq[16];
unsigned char mode;
unsigned char ctcss;
unsigned char dcs;
unsigned char flag1;
unsigned char flag2;
unsigned char clarifier[2];
unsigned char not_used;
unsigned char step1;
unsigned char step2;
unsigned char filter;
unsigned char band_no;
unsigned char freq[16];
unsigned char mode;
unsigned char ctcss;
unsigned char dcs;
unsigned char flag1;
unsigned char flag2;
unsigned char clarifier[2];
unsigned char not_used;
unsigned char step1;
unsigned char step2;
unsigned char filter;
// cppcheck-suppress *
unsigned char stuffing[16];
unsigned char stuffing[16];
}
FT600_STATUS_INFO;
FT600_STATUS_INFO;
typedef struct
{
unsigned char byte[8];
unsigned char byte[8];
}
// cppcheck-suppress *
FT600_FLAG_INFO;
@ -396,7 +397,8 @@ static int ft600_send_priv_cmd(RIG *rig, unsigned char cmd_index)
if (!rig) { return -RIG_EINVAL; }
return write_block(&rig->state.rigport, (char *) &ncmd[cmd_index].nseq, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (char *) &ncmd[cmd_index].nseq,
YAESU_CMD_LENGTH);
}
static int ft600_read_status(RIG *rig)

Wyświetl plik

@ -52,35 +52,36 @@
*
*/
enum ft747_native_cmd_e {
FT_747_NATIVE_SPLIT_OFF = 0,
FT_747_NATIVE_SPLIT_ON,
FT_747_NATIVE_RECALL_MEM,
FT_747_NATIVE_VFO_TO_MEM,
FT_747_NATIVE_DLOCK_OFF,
FT_747_NATIVE_DLOCK_ON,
FT_747_NATIVE_VFO_A,
FT_747_NATIVE_VFO_B,
FT_747_NATIVE_M_TO_VFO,
FT_747_NATIVE_UP_500K,
FT_747_NATIVE_DOWN_500K,
FT_747_NATIVE_CLARIFY_OFF,
FT_747_NATIVE_CLARIFY_ON,
FT_747_NATIVE_FREQ_SET,
FT_747_NATIVE_MODE_SET_LSB,
FT_747_NATIVE_MODE_SET_USB,
FT_747_NATIVE_MODE_SET_CWW,
FT_747_NATIVE_MODE_SET_CWN,
FT_747_NATIVE_MODE_SET_AMW,
FT_747_NATIVE_MODE_SET_AMN,
FT_747_NATIVE_MODE_SET_FMW,
FT_747_NATIVE_MODE_SET_FMN,
FT_747_NATIVE_PACING,
FT_747_NATIVE_PTT_OFF,
FT_747_NATIVE_PTT_ON,
FT_747_NATIVE_UPDATE,
FT_747_NATIVE_SIZE /* end marker, value indicates number of */
/* native cmd entries */
enum ft747_native_cmd_e
{
FT_747_NATIVE_SPLIT_OFF = 0,
FT_747_NATIVE_SPLIT_ON,
FT_747_NATIVE_RECALL_MEM,
FT_747_NATIVE_VFO_TO_MEM,
FT_747_NATIVE_DLOCK_OFF,
FT_747_NATIVE_DLOCK_ON,
FT_747_NATIVE_VFO_A,
FT_747_NATIVE_VFO_B,
FT_747_NATIVE_M_TO_VFO,
FT_747_NATIVE_UP_500K,
FT_747_NATIVE_DOWN_500K,
FT_747_NATIVE_CLARIFY_OFF,
FT_747_NATIVE_CLARIFY_ON,
FT_747_NATIVE_FREQ_SET,
FT_747_NATIVE_MODE_SET_LSB,
FT_747_NATIVE_MODE_SET_USB,
FT_747_NATIVE_MODE_SET_CWW,
FT_747_NATIVE_MODE_SET_CWN,
FT_747_NATIVE_MODE_SET_AMW,
FT_747_NATIVE_MODE_SET_AMN,
FT_747_NATIVE_MODE_SET_FMW,
FT_747_NATIVE_MODE_SET_FMN,
FT_747_NATIVE_PACING,
FT_747_NATIVE_PTT_OFF,
FT_747_NATIVE_PTT_ON,
FT_747_NATIVE_UPDATE,
FT_747_NATIVE_SIZE /* end marker, value indicates number of */
/* native cmd entries */
};
@ -169,8 +170,10 @@ static int ft747_close(RIG *rig);
static int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
static int ft747_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
static int ft747_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); /* select mode */
static int ft747_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); /* get mode */
static int ft747_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
pbwidth_t width); /* select mode */
static int ft747_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width); /* get mode */
static int ft747_set_vfo(RIG *rig, vfo_t vfo); /* select vfo */
static int ft747_get_vfo(RIG *rig, vfo_t *vfo); /* get vfo */
@ -1049,7 +1052,8 @@ static int ft747_send_priv_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
return write_block(&rig->state.rigport, (char *) ft747_ncmd[ci].nseq, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (char *) ft747_ncmd[ci].nseq,
YAESU_CMD_LENGTH);
}

Wyświetl plik

@ -63,8 +63,10 @@ static int ft757_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
static int ft757_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
static int ft757gx_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
static int ft757_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); /* select mode */
static int ft757_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); /* get mode */
static int ft757_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
pbwidth_t width); /* select mode */
static int ft757_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width); /* get mode */
static int ft757_set_vfo(RIG *rig, vfo_t vfo); /* select vfo */
static int ft757_get_vfo(RIG *rig, vfo_t *vfo); /* get vfo */

Wyświetl plik

@ -169,9 +169,9 @@ static int ft817_power2mW(RIG *rig, unsigned int *mwpower, float power,
static int ft817_mW2power(RIG *rig, float *power, unsigned int mwpower,
freq_t freq, rmode_t mode);
static int ft817_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx);
ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx);
static int ft818_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx);
ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx);
/* Native ft817 cmd set prototypes. These are READ ONLY as each */
/* rig instance will copy from these and modify if required . */
@ -320,8 +320,8 @@ const struct rig_caps ft817_caps =
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_LOCK | RIG_FUNC_TONE | RIG_FUNC_TSQL,
.has_get_level =
RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR | RIG_LEVEL_RFPOWER |
RIG_LEVEL_ALC | RIG_LEVEL_SWR,
RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR | RIG_LEVEL_RFPOWER |
RIG_LEVEL_ALC | RIG_LEVEL_SWR,
.has_set_level = RIG_LEVEL_NONE,
.has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE,
@ -466,8 +466,8 @@ const struct rig_caps ft818_caps =
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_LOCK | RIG_FUNC_TONE | RIG_FUNC_TSQL,
.has_get_level =
RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR | RIG_LEVEL_RFPOWER |
RIG_LEVEL_ALC | RIG_LEVEL_SWR,
RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR | RIG_LEVEL_RFPOWER |
RIG_LEVEL_ALC | RIG_LEVEL_SWR,
.has_set_level = RIG_LEVEL_NONE,
.has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE,
@ -729,7 +729,7 @@ static int ft817_get_status(RIG *rig, int status)
case FT817_NATIVE_CAT_GET_TX_METERING:
data = result;
len = sizeof(result)/sizeof(result[0]); /* We expect two bytes */
len = sizeof(result) / sizeof(result[0]); /* We expect two bytes */
tv = &p->tx_level_tv;
break;
@ -762,50 +762,51 @@ static int ft817_get_status(RIG *rig, int status)
if (n != len)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: Length mismatch exp %d got %d!\n",
__func__, len, n);
__func__, len, n);
return -RIG_EIO;
}
switch(status)
switch (status)
{
case FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS:
{
/* Only in digimode we need fetch to extra bits from EEPROM.
* This save communication cycle for all other modes.
* Because mode and frequency are shared this saves also when
* getting the frequency. */
switch (p->fm_status[4] & 0x7f)
{
/* Only in digimode we need fetch to extra bits from EEPROM.
* This save communication cycle for all other modes.
* Because mode and frequency are shared this saves also when
* getting the frequency. */
switch (p->fm_status[4] & 0x7f)
unsigned char dig_mode;
case 0x0a:
if ((n = ft817_read_eeprom(rig, 0x0065, &dig_mode)) < 0)
{
unsigned char dig_mode;
case 0x0a:
if ((n = ft817_read_eeprom(rig, 0x0065, &dig_mode)) < 0)
{
return n;
}
/* Top 3 bit define the digi mode */
p->dig_mode = dig_mode >> 5;
default:
break;
return n;
}
/* Top 3 bit define the digi mode */
p->dig_mode = dig_mode >> 5;
default:
break;
}
break;
}
break;
case FT817_NATIVE_CAT_GET_TX_METERING:
/* FT-817 returns 2 bytes with 4 nibbles.
* Extract raw values here;
* convert to float when they are requested. */
p->swr_level = result[0] & 0xF;
p->pwr_level = result[0] >> 4;
p->alc_level = result[1] & 0xF;
p->mod_level = result[1] >> 4;
rig_debug(RIG_DEBUG_TRACE, "%s: swr: %d, pwr %d, alc %d, mod %d\n",
__func__,
p->swr_level,
p->pwr_level,
p->alc_level,
p->mod_level);
/* FT-817 returns 2 bytes with 4 nibbles.
* Extract raw values here;
* convert to float when they are requested. */
p->swr_level = result[0] & 0xF;
p->pwr_level = result[0] >> 4;
p->alc_level = result[1] & 0xF;
p->mod_level = result[1] >> 4;
rig_debug(RIG_DEBUG_TRACE, "%s: swr: %d, pwr %d, alc %d, mod %d\n",
__func__,
p->swr_level,
p->pwr_level,
p->alc_level,
p->mod_level);
break;
}
@ -837,7 +838,7 @@ static int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
f1 = f2;
f2 = from_bcd_be(p->fm_status, 8);
dump_hex(p->fm_status, sizeof(p->fm_status)/sizeof(p->fm_status[0]));
dump_hex(p->fm_status, sizeof(p->fm_status) / sizeof(p->fm_status[0]));
}
#if 1 // user must be twiddling the VFO
@ -945,7 +946,8 @@ static int ft817_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
return RIG_OK;
}
static int ft817_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
static int ft817_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
ptt_t ptt;
@ -954,6 +956,7 @@ static int ft817_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vf
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
n = ft817_get_ptt(rig, 0, &ptt);
if (n != RIG_OK)
{
return n;
@ -967,6 +970,7 @@ static int ft817_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vf
/* Get split status from EEPROM */
n = ft817_read_eeprom(rig, 0x7a, &c);
if (n != RIG_OK)
{
return n;
@ -1003,7 +1007,8 @@ static int ft817_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
return RIG_OK;
}
static int ft817_get_tx_level(RIG *rig, value_t *val, unsigned char *tx_level, const cal_table_float_t *cal)
static int ft817_get_tx_level(RIG *rig, value_t *val, unsigned char *tx_level,
const cal_table_float_t *cal)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
@ -1023,6 +1028,7 @@ static int ft817_get_tx_level(RIG *rig, value_t *val, unsigned char *tx_level, c
* perhaps pointless retries + timeouts.
*/
n = ft817_get_ptt(rig, 0, &ptt);
if (n != RIG_OK)
{
return n;
@ -1035,6 +1041,7 @@ static int ft817_get_tx_level(RIG *rig, value_t *val, unsigned char *tx_level, c
}
n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_TX_METERING);
if (n != RIG_OK)
{
return n;
@ -1114,6 +1121,7 @@ static int ft817_get_raw_smeter_level(RIG *rig, value_t *val)
static int ft817_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
switch (level)
{
@ -1125,7 +1133,8 @@ static int ft817_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return ft817_get_raw_smeter_level(rig, val);
case RIG_LEVEL_RFPOWER:
return ft817_get_tx_level(rig, val, &p->pwr_level, &rig->caps->rfpower_meter_cal);
return ft817_get_tx_level(rig, val, &p->pwr_level,
&rig->caps->rfpower_meter_cal);
case RIG_LEVEL_ALC:
return ft817_get_tx_level(rig, val, &p->alc_level, &rig->caps->alc_cal);
@ -1179,6 +1188,7 @@ static int ft818_817_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
/* Read eeprom for current 'band' for both VFO's */
ret = ft817_read_eeprom(rig, 0x59, &eeprom_band);
if (ret != RIG_OK)
{
return ret;
@ -1188,6 +1198,7 @@ static int ft818_817_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
* The FT818/817 stores antenna per band not per VFO!
* So changing antenna will change for both VFO's */
ret = ft817_read_eeprom(rig, 0x7A, &eeprom_ant);
if (ret != RIG_OK)
{
return ret;
@ -1200,18 +1211,20 @@ static int ft818_817_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
}
/* band info is 4 bit per VFO, for A lower nibble, B is upper nible */
switch (vfo) {
case RIG_VFO_A:
eeprom_band &= 0xF;
break;
case RIG_VFO_B:
eeprom_band = eeprom_band >> 4;
switch (vfo)
{
case RIG_VFO_A:
eeprom_band &= 0xF;
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO %0x!\n",
__func__, vfo);
return -RIG_EINTERNAL;
case RIG_VFO_B:
eeprom_band = eeprom_band >> 4;
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO %0x!\n",
__func__, vfo);
return -RIG_EINTERNAL;
}
/* The 818 and the 817 differ in bands: the 818 has 60m.
@ -1233,43 +1246,44 @@ static int ft818_817_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
*/
switch (eeprom_band) {
case 0: /* 160M */
case 1: /* 80M */
case 2: /* 60M, 818 only */
case 3: /* 40M */
case 4: /* 30M */
case 5: /* 20M */
case 6: /* 17M */
case 7: /* 15M */
case 8: /* 12M */
case 9: /* 10M */
/* All HF use the same antenna setting, bit 0 */
eeprom_ant &= 1<<0;
switch (eeprom_band)
{
case 0: /* 160M */
case 1: /* 80M */
case 2: /* 60M, 818 only */
case 3: /* 40M */
case 4: /* 30M */
case 5: /* 20M */
case 6: /* 17M */
case 7: /* 15M */
case 8: /* 12M */
case 9: /* 10M */
/* All HF use the same antenna setting, bit 0 */
eeprom_ant &= 1 << 0;
break;
case 0xA: /* 6m, bit 1 */
eeprom_ant &= 1<<1;
case 0xA: /* 6m, bit 1 */
eeprom_ant &= 1 << 1;
break;
case 0xB: /* FM BCB 76Mhz - 108Mhz, bit 2 */
eeprom_ant &= 1<<2;
case 0xB: /* FM BCB 76Mhz - 108Mhz, bit 2 */
eeprom_ant &= 1 << 2;
break;
case 0xC: /* Airband, bit 3 */
eeprom_ant &= 1<<3;
case 0xC: /* Airband, bit 3 */
eeprom_ant &= 1 << 3;
break;
case 0xD: /* 2M, bit 4 */
eeprom_ant &= 1<<4;
case 0xD: /* 2M, bit 4 */
eeprom_ant &= 1 << 4;
break;
case 0xE: /* 70cm / UHF, bit 5 */
eeprom_ant &= 1<<5;
case 0xE: /* 70cm / UHF, bit 5 */
eeprom_ant &= 1 << 5;
break;
case 0xF: /* Free-tuning?, bit 6 */
eeprom_ant &= 1<<6;
case 0xF: /* Free-tuning?, bit 6 */
eeprom_ant &= 1 << 6;
break;
}
@ -1281,18 +1295,18 @@ static int ft818_817_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
}
static int ft817_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx)
ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx)
{
return ft818_817_get_ant(rig, vfo, ant, option, ant_curr, ant_tx, ant_rx,
true);
true);
}
static int ft818_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx)
ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx)
{
return ft818_817_get_ant(rig, vfo, ant, option, ant_curr, ant_tx, ant_rx,
false);
false);
}
/* ---------------------------------------------------------------------- */
@ -1517,6 +1531,7 @@ static int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
int n;
n = ft817_send_cmd(rig, index);
if (n < 0 && n != -RIG_ERJCTED)
{
rig_debug(RIG_DEBUG_ERR, "%s: send ptt cmd failed\n", __func__);
@ -1526,6 +1541,7 @@ static int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
/* Read TX status it contains the PTT flag.
* Use TX_STATUS instead of ft817_get_ptt to skip the cache. */
n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_TX_STATUS);
if (n < 0 && n != -RIG_ERJCTED)
{
rig_debug(RIG_DEBUG_ERR, "%s: get ptt cmd failed\n", __func__);
@ -1535,6 +1551,7 @@ static int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
/* Should be in cache now! But if above command was rejected
* we will still try again here. */
n = ft817_get_ptt(rig, vfo, &ptt_response);
if (n < 0 && n != -RIG_ERJCTED)
{
rig_debug(RIG_DEBUG_ERR, "%s: get ptt cmd failed\n", __func__);
@ -1863,7 +1880,7 @@ static int ft817_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
1 bar = 0.5W
*/
static int ft817_power2mW(RIG *rig, unsigned int *mwpower, float power,
freq_t freq, rmode_t mode)
freq_t freq, rmode_t mode)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
*mwpower = (int)(power * 6000);
@ -1873,7 +1890,7 @@ static int ft817_power2mW(RIG *rig, unsigned int *mwpower, float power,
/* FIXME: currently ignores mode and freq */
static int ft817_mW2power(RIG *rig, float *power, unsigned int mwpower,
freq_t freq, rmode_t mode)
freq_t freq, rmode_t mode)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
*power = mwpower / 6000.0;

Wyświetl plik

@ -45,31 +45,32 @@
*
*/
enum ft840_native_cmd_e {
FT840_NATIVE_SPLIT_OFF = 0,
FT840_NATIVE_SPLIT_ON,
FT840_NATIVE_RECALL_MEM,
FT840_NATIVE_VFO_TO_MEM,
FT840_NATIVE_VFO_A,
FT840_NATIVE_VFO_B,
FT840_NATIVE_MEM_TO_VFO,
FT840_NATIVE_CLARIFIER_OPS,
FT840_NATIVE_FREQ_SET,
FT840_NATIVE_MODE_SET,
FT840_NATIVE_PACING,
FT840_NATIVE_PTT_OFF,
FT840_NATIVE_PTT_ON,
FT840_NATIVE_MEM_CHNL,
FT840_NATIVE_OP_DATA,
FT840_NATIVE_VFO_DATA,
FT840_NATIVE_MEM_CHNL_DATA,
FT840_NATIVE_TUNER_OFF,
FT840_NATIVE_TUNER_ON,
FT840_NATIVE_TUNER_START,
FT840_NATIVE_READ_METER,
FT840_NATIVE_READ_FLAGS,
FT840_NATIVE_SIZE /* end marker, value indicates number of */
/* native cmd entries */
enum ft840_native_cmd_e
{
FT840_NATIVE_SPLIT_OFF = 0,
FT840_NATIVE_SPLIT_ON,
FT840_NATIVE_RECALL_MEM,
FT840_NATIVE_VFO_TO_MEM,
FT840_NATIVE_VFO_A,
FT840_NATIVE_VFO_B,
FT840_NATIVE_MEM_TO_VFO,
FT840_NATIVE_CLARIFIER_OPS,
FT840_NATIVE_FREQ_SET,
FT840_NATIVE_MODE_SET,
FT840_NATIVE_PACING,
FT840_NATIVE_PTT_OFF,
FT840_NATIVE_PTT_ON,
FT840_NATIVE_MEM_CHNL,
FT840_NATIVE_OP_DATA,
FT840_NATIVE_VFO_DATA,
FT840_NATIVE_MEM_CHNL_DATA,
FT840_NATIVE_TUNER_OFF,
FT840_NATIVE_TUNER_ON,
FT840_NATIVE_TUNER_START,
FT840_NATIVE_READ_METER,
FT840_NATIVE_READ_FLAGS,
FT840_NATIVE_SIZE /* end marker, value indicates number of */
/* native cmd entries */
};
/*

Wyświetl plik

@ -65,96 +65,97 @@
*
*/
enum ft847_native_cmd_e {
enum ft847_native_cmd_e
{
/* Set commands to the rig */
/* Set commands to the rig */
FT_847_NATIVE_CAT_ON = 0,
FT_847_NATIVE_CAT_OFF,
FT_847_NATIVE_CAT_ON = 0,
FT_847_NATIVE_CAT_OFF,
FT_847_NATIVE_CAT_PTT_ON,
FT_847_NATIVE_CAT_PTT_OFF,
FT_847_NATIVE_CAT_PTT_ON,
FT_847_NATIVE_CAT_PTT_OFF,
FT_847_NATIVE_CAT_SAT_MODE_ON,
FT_847_NATIVE_CAT_SAT_MODE_OFF,
FT_847_NATIVE_CAT_SAT_MODE_ON,
FT_847_NATIVE_CAT_SAT_MODE_OFF,
FT_847_NATIVE_CAT_SET_FREQ_MAIN,
FT_847_NATIVE_CAT_SET_FREQ_SAT_RX_VFO,
FT_847_NATIVE_CAT_SET_FREQ_SAT_TX_VFO,
FT_847_NATIVE_CAT_SET_FREQ_MAIN,
FT_847_NATIVE_CAT_SET_FREQ_SAT_RX_VFO,
FT_847_NATIVE_CAT_SET_FREQ_SAT_TX_VFO,
FT_847_NATIVE_CAT_SET_MODE_MAIN_LSB, /* MAIN VFO */
FT_847_NATIVE_CAT_SET_MODE_MAIN_USB,
FT_847_NATIVE_CAT_SET_MODE_MAIN_CW,
FT_847_NATIVE_CAT_SET_MODE_MAIN_CWR,
FT_847_NATIVE_CAT_SET_MODE_MAIN_AM,
FT_847_NATIVE_CAT_SET_MODE_MAIN_FM,
FT_847_NATIVE_CAT_SET_MODE_MAIN_CWN,
FT_847_NATIVE_CAT_SET_MODE_MAIN_CWRN,
FT_847_NATIVE_CAT_SET_MODE_MAIN_AMN,
FT_847_NATIVE_CAT_SET_MODE_MAIN_FMN,
FT_847_NATIVE_CAT_SET_MODE_MAIN_LSB, /* MAIN VFO */
FT_847_NATIVE_CAT_SET_MODE_MAIN_USB,
FT_847_NATIVE_CAT_SET_MODE_MAIN_CW,
FT_847_NATIVE_CAT_SET_MODE_MAIN_CWR,
FT_847_NATIVE_CAT_SET_MODE_MAIN_AM,
FT_847_NATIVE_CAT_SET_MODE_MAIN_FM,
FT_847_NATIVE_CAT_SET_MODE_MAIN_CWN,
FT_847_NATIVE_CAT_SET_MODE_MAIN_CWRN,
FT_847_NATIVE_CAT_SET_MODE_MAIN_AMN,
FT_847_NATIVE_CAT_SET_MODE_MAIN_FMN,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_LSB, /* SAT RX VFO */
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_USB,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_CW,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_CWR,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_AM,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_FM,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_CWN,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_CWRN,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_AMN,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_FMN,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_LSB, /* SAT RX VFO */
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_USB,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_CW,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_CWR,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_AM,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_FM,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_CWN,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_CWRN,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_AMN,
FT_847_NATIVE_CAT_SET_MODE_SAT_RX_FMN,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_LSB, /* SAT TX VFO */
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_USB,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_CW,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_CWR,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_AM,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_FM,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_CWN,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_CWRN,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_AMN,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_FMN,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_LSB, /* SAT TX VFO */
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_USB,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_CW,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_CWR,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_AM,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_FM,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_CWN,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_CWRN,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_AMN,
FT_847_NATIVE_CAT_SET_MODE_SAT_TX_FMN,
FT_847_NATIVE_CAT_SET_DCS_ON_MAIN, /* MAIN CTCSS/DCS */
FT_847_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON_MAIN,
FT_847_NATIVE_CAT_SET_CTCSS_ENC_ON_MAIN,
FT_847_NATIVE_CAT_SET_CTCSS_DCS_OFF_MAIN,
FT_847_NATIVE_CAT_SET_DCS_ON_MAIN, /* MAIN CTCSS/DCS */
FT_847_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON_MAIN,
FT_847_NATIVE_CAT_SET_CTCSS_ENC_ON_MAIN,
FT_847_NATIVE_CAT_SET_CTCSS_DCS_OFF_MAIN,
FT_847_NATIVE_CAT_SET_DCS_ON_SAT_RX, /* SAT RX CTCSS/DCS */
FT_847_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON_SAT_RX,
FT_847_NATIVE_CAT_SET_CTCSS_ENC_ON_SAT_RX,
FT_847_NATIVE_CAT_SET_CTCSS_DCS_OFF_SAT_RX,
FT_847_NATIVE_CAT_SET_DCS_ON_SAT_RX, /* SAT RX CTCSS/DCS */
FT_847_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON_SAT_RX,
FT_847_NATIVE_CAT_SET_CTCSS_ENC_ON_SAT_RX,
FT_847_NATIVE_CAT_SET_CTCSS_DCS_OFF_SAT_RX,
FT_847_NATIVE_CAT_SET_DCS_ON_SAT_TX, /* SAT TX CTCSS/DCS */
FT_847_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON_SAT_TX,
FT_847_NATIVE_CAT_SET_CTCSS_ENC_ON_SAT_TX,
FT_847_NATIVE_CAT_SET_CTCSS_DCS_OFF_SAT_TX,
FT_847_NATIVE_CAT_SET_DCS_ON_SAT_TX, /* SAT TX CTCSS/DCS */
FT_847_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON_SAT_TX,
FT_847_NATIVE_CAT_SET_CTCSS_ENC_ON_SAT_TX,
FT_847_NATIVE_CAT_SET_CTCSS_DCS_OFF_SAT_TX,
FT_847_NATIVE_CAT_SET_CTCSS_FREQ_MAIN, /* CTCSS Freq */
FT_847_NATIVE_CAT_SET_CTCSS_FREQ_SAT_RX,
FT_847_NATIVE_CAT_SET_CTCSS_FREQ_SAT_TX,
FT_847_NATIVE_CAT_SET_CTCSS_FREQ_MAIN, /* CTCSS Freq */
FT_847_NATIVE_CAT_SET_CTCSS_FREQ_SAT_RX,
FT_847_NATIVE_CAT_SET_CTCSS_FREQ_SAT_TX,
FT_847_NATIVE_CAT_SET_DCS_CODE_MAIN, /* DCS code */
FT_847_NATIVE_CAT_SET_DCS_CODE_SAT_RX,
FT_847_NATIVE_CAT_SET_DCS_CODE_SAT_TX,
FT_847_NATIVE_CAT_SET_DCS_CODE_MAIN, /* DCS code */
FT_847_NATIVE_CAT_SET_DCS_CODE_SAT_RX,
FT_847_NATIVE_CAT_SET_DCS_CODE_SAT_TX,
FT_847_NATIVE_CAT_SET_RPT_SHIFT_MINUS, /* RPT SHIFT */
FT_847_NATIVE_CAT_SET_RPT_SHIFT_PLUS,
FT_847_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX,
FT_847_NATIVE_CAT_SET_RPT_SHIFT_MINUS, /* RPT SHIFT */
FT_847_NATIVE_CAT_SET_RPT_SHIFT_PLUS,
FT_847_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX,
FT_847_NATIVE_CAT_SET_RPT_OFFSET, /* RPT Offset frequency */
FT_847_NATIVE_CAT_SET_RPT_OFFSET, /* RPT Offset frequency */
/* Get info from the rig */
/* Get info from the rig */
FT_847_NATIVE_CAT_GET_RX_STATUS,
FT_847_NATIVE_CAT_GET_TX_STATUS,
FT_847_NATIVE_CAT_GET_RX_STATUS,
FT_847_NATIVE_CAT_GET_TX_STATUS,
FT_847_NATIVE_CAT_GET_FREQ_MODE_STATUS_MAIN,
FT_847_NATIVE_CAT_GET_FREQ_MODE_STATUS_SAT_RX,
FT_847_NATIVE_CAT_GET_FREQ_MODE_STATUS_SAT_TX,
FT_847_NATIVE_CAT_GET_FREQ_MODE_STATUS_MAIN,
FT_847_NATIVE_CAT_GET_FREQ_MODE_STATUS_SAT_RX,
FT_847_NATIVE_CAT_GET_FREQ_MODE_STATUS_SAT_TX,
FT_847_NATIVE_SIZE /* end marker, value indicates number of */
/* native cmd entries */
FT_847_NATIVE_SIZE /* end marker, value indicates number of */
/* native cmd entries */
};
@ -175,30 +176,36 @@ static int ft847_close(RIG *rig);
static int ft847_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
static int ft847_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
static int ft847_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); /* select mode */
static int ft847_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); /* get mode */
static int ft847_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
pbwidth_t width); /* select mode */
static int ft847_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width); /* get mode */
static int ft847_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
static int ft847_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
static int ft847_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo);
static int ft847_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo);
static int ft847_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq);
static int ft847_get_split_freq(RIG *rig, vfo_t vfo, freq_t *freq);
static int ft847_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
static int ft847_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
static int ft847_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode,
pbwidth_t width);
static int ft847_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width);
static int ft847_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
static int ft847_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
static int ft847_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd);
static int ft847_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t * val);
static int ft847_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
static int ft847_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
static int ft847_set_ctcss_tone (RIG *rig, vfo_t vfo, tone_t tone);
static int ft847_set_ctcss_sql (RIG *rig, vfo_t vfo, tone_t tone);
static int ft847_set_dcs_sql (RIG *rig, vfo_t vfo, tone_t code);
static int ft847_set_rptr_shift (RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift);
static int ft847_set_rptr_offs (RIG *rig, vfo_t vfo, shortfreq_t rptr_offs);
static int ft847_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone);
static int ft847_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone);
static int ft847_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code);
static int ft847_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift);
static int ft847_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs);
/*
* ft847 instance - private data
@ -942,7 +949,8 @@ static int ft847_send_priv_cmd(RIG *rig, int cmd_index)
return -RIG_EINVAL;
}
return write_block(&rig->state.rigport, (char *) ncmd[cmd_index].nseq, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (char *) ncmd[cmd_index].nseq,
YAESU_CMD_LENGTH);
}
@ -1335,7 +1343,8 @@ static int ft847_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
return ret;
}
static int ft847_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
static int ft847_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo)
{
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
@ -1361,12 +1370,14 @@ static int ft847_get_split_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return ft847_get_freq(rig, RIG_VFO_TX, freq);
}
static int ft847_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
static int ft847_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode,
pbwidth_t width)
{
return ft847_set_mode(rig, RIG_VFO_TX, mode, width);
}
static int ft847_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
static int ft847_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width)
{
return ft847_get_mode(rig, RIG_VFO_TX, mode, width);
}

Wyświetl plik

@ -75,48 +75,49 @@
#include "tones.h"
#include "bandplan.h"
enum ft857_native_cmd_e {
FT857_NATIVE_CAT_LOCK_ON = 0,
FT857_NATIVE_CAT_LOCK_OFF,
FT857_NATIVE_CAT_PTT_ON,
FT857_NATIVE_CAT_PTT_OFF,
FT857_NATIVE_CAT_SET_FREQ,
FT857_NATIVE_CAT_SET_MODE_LSB,
FT857_NATIVE_CAT_SET_MODE_USB,
FT857_NATIVE_CAT_SET_MODE_CW,
FT857_NATIVE_CAT_SET_MODE_CWR,
FT857_NATIVE_CAT_SET_MODE_AM,
FT857_NATIVE_CAT_SET_MODE_FM,
FT857_NATIVE_CAT_SET_MODE_FM_N,
FT857_NATIVE_CAT_SET_MODE_DIG,
FT857_NATIVE_CAT_SET_MODE_PKT,
FT857_NATIVE_CAT_CLAR_ON,
FT857_NATIVE_CAT_CLAR_OFF,
FT857_NATIVE_CAT_SET_CLAR_FREQ,
FT857_NATIVE_CAT_SET_VFOAB,
FT857_NATIVE_CAT_SPLIT_ON,
FT857_NATIVE_CAT_SPLIT_OFF,
FT857_NATIVE_CAT_SET_RPT_SHIFT_MINUS,
FT857_NATIVE_CAT_SET_RPT_SHIFT_PLUS,
FT857_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX,
FT857_NATIVE_CAT_SET_RPT_OFFSET,
FT857_NATIVE_CAT_SET_DCS_ON,
FT857_NATIVE_CAT_SET_DCS_DEC_ON,
FT857_NATIVE_CAT_SET_DCS_ENC_ON,
FT857_NATIVE_CAT_SET_CTCSS_ON,
FT857_NATIVE_CAT_SET_CTCSS_DEC_ON,
FT857_NATIVE_CAT_SET_CTCSS_ENC_ON,
FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF,
FT857_NATIVE_CAT_SET_CTCSS_FREQ,
FT857_NATIVE_CAT_SET_DCS_CODE,
FT857_NATIVE_CAT_GET_RX_STATUS,
FT857_NATIVE_CAT_GET_TX_STATUS,
FT857_NATIVE_CAT_GET_FREQ_MODE_STATUS,
FT857_NATIVE_CAT_PWR_WAKE,
FT857_NATIVE_CAT_PWR_ON,
FT857_NATIVE_CAT_PWR_OFF,
FT857_NATIVE_CAT_EEPROM_READ,
FT857_NATIVE_SIZE /* end marker */
enum ft857_native_cmd_e
{
FT857_NATIVE_CAT_LOCK_ON = 0,
FT857_NATIVE_CAT_LOCK_OFF,
FT857_NATIVE_CAT_PTT_ON,
FT857_NATIVE_CAT_PTT_OFF,
FT857_NATIVE_CAT_SET_FREQ,
FT857_NATIVE_CAT_SET_MODE_LSB,
FT857_NATIVE_CAT_SET_MODE_USB,
FT857_NATIVE_CAT_SET_MODE_CW,
FT857_NATIVE_CAT_SET_MODE_CWR,
FT857_NATIVE_CAT_SET_MODE_AM,
FT857_NATIVE_CAT_SET_MODE_FM,
FT857_NATIVE_CAT_SET_MODE_FM_N,
FT857_NATIVE_CAT_SET_MODE_DIG,
FT857_NATIVE_CAT_SET_MODE_PKT,
FT857_NATIVE_CAT_CLAR_ON,
FT857_NATIVE_CAT_CLAR_OFF,
FT857_NATIVE_CAT_SET_CLAR_FREQ,
FT857_NATIVE_CAT_SET_VFOAB,
FT857_NATIVE_CAT_SPLIT_ON,
FT857_NATIVE_CAT_SPLIT_OFF,
FT857_NATIVE_CAT_SET_RPT_SHIFT_MINUS,
FT857_NATIVE_CAT_SET_RPT_SHIFT_PLUS,
FT857_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX,
FT857_NATIVE_CAT_SET_RPT_OFFSET,
FT857_NATIVE_CAT_SET_DCS_ON,
FT857_NATIVE_CAT_SET_DCS_DEC_ON,
FT857_NATIVE_CAT_SET_DCS_ENC_ON,
FT857_NATIVE_CAT_SET_CTCSS_ON,
FT857_NATIVE_CAT_SET_CTCSS_DEC_ON,
FT857_NATIVE_CAT_SET_CTCSS_ENC_ON,
FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF,
FT857_NATIVE_CAT_SET_CTCSS_FREQ,
FT857_NATIVE_CAT_SET_DCS_CODE,
FT857_NATIVE_CAT_GET_RX_STATUS,
FT857_NATIVE_CAT_GET_TX_STATUS,
FT857_NATIVE_CAT_GET_FREQ_MODE_STATUS,
FT857_NATIVE_CAT_PWR_WAKE,
FT857_NATIVE_CAT_PWR_ON,
FT857_NATIVE_CAT_PWR_OFF,
FT857_NATIVE_CAT_EEPROM_READ,
FT857_NATIVE_SIZE /* end marker */
};
static int ft857_init(RIG *rig);
@ -127,10 +128,14 @@ static int ft857_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
static int ft857_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
static int ft857_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
static int ft857_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
static int ft857_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq, rmode_t mode, pbwidth_t width);
static int ft857_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width);
static int ft857_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
static int ft857_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
static int ft857_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq,
rmode_t mode, pbwidth_t width);
static int ft857_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq,
rmode_t *mode, pbwidth_t *width);
static int ft857_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo);
static int ft857_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo);
// static int ft857_set_vfo(RIG *rig, vfo_t vfo);
// static int ft857_get_vfo(RIG *rig, vfo_t *vfo);
static int ft857_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);

Wyświetl plik

@ -75,31 +75,32 @@
*
*/
enum ft890_native_cmd_e {
FT890_NATIVE_SPLIT_OFF = 0,
FT890_NATIVE_SPLIT_ON,
FT890_NATIVE_RECALL_MEM,
FT890_NATIVE_VFO_TO_MEM,
FT890_NATIVE_VFO_A,
FT890_NATIVE_VFO_B,
FT890_NATIVE_MEM_TO_VFO,
FT890_NATIVE_CLARIFIER_OPS,
FT890_NATIVE_FREQ_SET,
FT890_NATIVE_MODE_SET,
FT890_NATIVE_PACING,
FT890_NATIVE_PTT_OFF,
FT890_NATIVE_PTT_ON,
FT890_NATIVE_MEM_CHNL,
FT890_NATIVE_OP_DATA,
FT890_NATIVE_VFO_DATA,
FT890_NATIVE_MEM_CHNL_DATA,
FT890_NATIVE_TUNER_OFF,
FT890_NATIVE_TUNER_ON,
FT890_NATIVE_TUNER_START,
FT890_NATIVE_READ_METER,
FT890_NATIVE_READ_FLAGS,
FT890_NATIVE_SIZE /* end marker, value indicates number of */
/* native cmd entries */
enum ft890_native_cmd_e
{
FT890_NATIVE_SPLIT_OFF = 0,
FT890_NATIVE_SPLIT_ON,
FT890_NATIVE_RECALL_MEM,
FT890_NATIVE_VFO_TO_MEM,
FT890_NATIVE_VFO_A,
FT890_NATIVE_VFO_B,
FT890_NATIVE_MEM_TO_VFO,
FT890_NATIVE_CLARIFIER_OPS,
FT890_NATIVE_FREQ_SET,
FT890_NATIVE_MODE_SET,
FT890_NATIVE_PACING,
FT890_NATIVE_PTT_OFF,
FT890_NATIVE_PTT_ON,
FT890_NATIVE_MEM_CHNL,
FT890_NATIVE_OP_DATA,
FT890_NATIVE_VFO_DATA,
FT890_NATIVE_MEM_CHNL_DATA,
FT890_NATIVE_TUNER_OFF,
FT890_NATIVE_TUNER_ON,
FT890_NATIVE_TUNER_START,
FT890_NATIVE_READ_METER,
FT890_NATIVE_READ_FLAGS,
FT890_NATIVE_SIZE /* end marker, value indicates number of */
/* native cmd entries */
};
typedef enum ft890_native_cmd_e ft890_native_cmd_t;
@ -302,8 +303,10 @@ static int ft890_get_vfo(RIG *rig, vfo_t *vfo);
static int ft890_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
static int ft890_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
static int ft890_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
static int ft890_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
static int ft890_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo);
static int ft890_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo);
static int ft890_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
static int ft890_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit);

Wyświetl plik

@ -44,11 +44,15 @@
/* Prototypes */
static int ft891_init(RIG *rig);
static int ft891_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
static int ft891_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width);
static int ft891_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width);
static int ft891_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo);
static int ft891_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
pbwidth_t *tx_width);
static int ft891_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
pbwidth_t tx_width);
static int ft891_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
static int ft891_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
static int ft891_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo);
const struct confparams ft891_ext_levels[] =
{
@ -131,7 +135,7 @@ const struct rig_caps ft891_caps =
RIG_MODEL(RIG_MODEL_FT891),
.model_name = "FT-891",
.mfg_name = "Yaesu",
.version = NEWCAT_VER ".4",
.version = NEWCAT_VER ".5",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -316,6 +320,8 @@ const struct rig_caps ft891_caps =
.set_ext_level = newcat_set_ext_level,
.get_ext_level = newcat_get_ext_level,
.send_morse = newcat_send_morse,
.set_clock = newcat_set_clock,
.get_clock = newcat_get_clock
};
/*
@ -408,7 +414,8 @@ static int ft891_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
*
* Comments: The passed value for the vfo is ignored since can only split one way
*/
static int ft891_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
static int ft891_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo)
{
struct newcat_priv_data *priv;
int err;
@ -467,7 +474,7 @@ static int ft891_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vf
*/
static int ft891_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
pbwidth_t *tx_width)
pbwidth_t *tx_width)
{
struct newcat_priv_data *priv;
int err;
@ -514,7 +521,7 @@ static int ft891_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
*/
static int ft891_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
pbwidth_t tx_width)
pbwidth_t tx_width)
{
struct newcat_priv_data *priv;
struct rig_state *state;

Wyświetl plik

@ -81,48 +81,49 @@
#include "tones.h"
#include "bandplan.h"
enum ft897_native_cmd_e {
FT897_NATIVE_CAT_LOCK_ON = 0,
FT897_NATIVE_CAT_LOCK_OFF,
FT897_NATIVE_CAT_PTT_ON,
FT897_NATIVE_CAT_PTT_OFF,
FT897_NATIVE_CAT_SET_FREQ,
FT897_NATIVE_CAT_SET_MODE_LSB,
FT897_NATIVE_CAT_SET_MODE_USB,
FT897_NATIVE_CAT_SET_MODE_CW,
FT897_NATIVE_CAT_SET_MODE_CWR,
FT897_NATIVE_CAT_SET_MODE_AM,
FT897_NATIVE_CAT_SET_MODE_FM,
FT897_NATIVE_CAT_SET_MODE_FM_N,
FT897_NATIVE_CAT_SET_MODE_DIG,
FT897_NATIVE_CAT_SET_MODE_PKT,
FT897_NATIVE_CAT_CLAR_ON,
FT897_NATIVE_CAT_CLAR_OFF,
FT897_NATIVE_CAT_SET_CLAR_FREQ,
FT897_NATIVE_CAT_SET_VFOAB,
FT897_NATIVE_CAT_SPLIT_ON,
FT897_NATIVE_CAT_SPLIT_OFF,
FT897_NATIVE_CAT_SET_RPT_SHIFT_MINUS,
FT897_NATIVE_CAT_SET_RPT_SHIFT_PLUS,
FT897_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX,
FT897_NATIVE_CAT_SET_RPT_OFFSET,
FT897_NATIVE_CAT_SET_DCS_ON,
FT897_NATIVE_CAT_SET_DCS_DEC_ON,
FT897_NATIVE_CAT_SET_DCS_ENC_ON,
FT897_NATIVE_CAT_SET_CTCSS_ON,
FT897_NATIVE_CAT_SET_CTCSS_DEC_ON,
FT897_NATIVE_CAT_SET_CTCSS_ENC_ON,
FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF,
FT897_NATIVE_CAT_SET_CTCSS_FREQ,
FT897_NATIVE_CAT_SET_DCS_CODE,
FT897_NATIVE_CAT_GET_RX_STATUS,
FT897_NATIVE_CAT_GET_TX_STATUS,
FT897_NATIVE_CAT_GET_FREQ_MODE_STATUS,
FT897_NATIVE_CAT_PWR_WAKE,
FT897_NATIVE_CAT_PWR_ON,
FT897_NATIVE_CAT_PWR_OFF,
FT897_NATIVE_CAT_EEPROM_READ,
FT897_NATIVE_SIZE /* end marker */
enum ft897_native_cmd_e
{
FT897_NATIVE_CAT_LOCK_ON = 0,
FT897_NATIVE_CAT_LOCK_OFF,
FT897_NATIVE_CAT_PTT_ON,
FT897_NATIVE_CAT_PTT_OFF,
FT897_NATIVE_CAT_SET_FREQ,
FT897_NATIVE_CAT_SET_MODE_LSB,
FT897_NATIVE_CAT_SET_MODE_USB,
FT897_NATIVE_CAT_SET_MODE_CW,
FT897_NATIVE_CAT_SET_MODE_CWR,
FT897_NATIVE_CAT_SET_MODE_AM,
FT897_NATIVE_CAT_SET_MODE_FM,
FT897_NATIVE_CAT_SET_MODE_FM_N,
FT897_NATIVE_CAT_SET_MODE_DIG,
FT897_NATIVE_CAT_SET_MODE_PKT,
FT897_NATIVE_CAT_CLAR_ON,
FT897_NATIVE_CAT_CLAR_OFF,
FT897_NATIVE_CAT_SET_CLAR_FREQ,
FT897_NATIVE_CAT_SET_VFOAB,
FT897_NATIVE_CAT_SPLIT_ON,
FT897_NATIVE_CAT_SPLIT_OFF,
FT897_NATIVE_CAT_SET_RPT_SHIFT_MINUS,
FT897_NATIVE_CAT_SET_RPT_SHIFT_PLUS,
FT897_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX,
FT897_NATIVE_CAT_SET_RPT_OFFSET,
FT897_NATIVE_CAT_SET_DCS_ON,
FT897_NATIVE_CAT_SET_DCS_DEC_ON,
FT897_NATIVE_CAT_SET_DCS_ENC_ON,
FT897_NATIVE_CAT_SET_CTCSS_ON,
FT897_NATIVE_CAT_SET_CTCSS_DEC_ON,
FT897_NATIVE_CAT_SET_CTCSS_ENC_ON,
FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF,
FT897_NATIVE_CAT_SET_CTCSS_FREQ,
FT897_NATIVE_CAT_SET_DCS_CODE,
FT897_NATIVE_CAT_GET_RX_STATUS,
FT897_NATIVE_CAT_GET_TX_STATUS,
FT897_NATIVE_CAT_GET_FREQ_MODE_STATUS,
FT897_NATIVE_CAT_PWR_WAKE,
FT897_NATIVE_CAT_PWR_ON,
FT897_NATIVE_CAT_PWR_OFF,
FT897_NATIVE_CAT_EEPROM_READ,
FT897_NATIVE_SIZE /* end marker */
};
struct ft897_priv_data

Wyświetl plik

@ -76,31 +76,32 @@
*
*/
enum ft900_native_cmd_e {
FT900_NATIVE_SPLIT_OFF = 0,
FT900_NATIVE_SPLIT_ON,
FT900_NATIVE_RECALL_MEM,
FT900_NATIVE_VFO_TO_MEM,
FT900_NATIVE_VFO_A,
FT900_NATIVE_VFO_B,
FT900_NATIVE_MEM_TO_VFO,
FT900_NATIVE_CLARIFIER_OPS,
FT900_NATIVE_FREQ_SET,
FT900_NATIVE_MODE_SET,
FT900_NATIVE_PACING,
FT900_NATIVE_PTT_OFF,
FT900_NATIVE_PTT_ON,
FT900_NATIVE_MEM_CHNL,
FT900_NATIVE_OP_DATA,
FT900_NATIVE_VFO_DATA,
FT900_NATIVE_MEM_CHNL_DATA,
FT900_NATIVE_TUNER_OFF,
FT900_NATIVE_TUNER_ON,
FT900_NATIVE_TUNER_START,
FT900_NATIVE_READ_METER,
FT900_NATIVE_READ_FLAGS,
FT900_NATIVE_SIZE /* end marker, value indicates number of */
/* native cmd entries */
enum ft900_native_cmd_e
{
FT900_NATIVE_SPLIT_OFF = 0,
FT900_NATIVE_SPLIT_ON,
FT900_NATIVE_RECALL_MEM,
FT900_NATIVE_VFO_TO_MEM,
FT900_NATIVE_VFO_A,
FT900_NATIVE_VFO_B,
FT900_NATIVE_MEM_TO_VFO,
FT900_NATIVE_CLARIFIER_OPS,
FT900_NATIVE_FREQ_SET,
FT900_NATIVE_MODE_SET,
FT900_NATIVE_PACING,
FT900_NATIVE_PTT_OFF,
FT900_NATIVE_PTT_ON,
FT900_NATIVE_MEM_CHNL,
FT900_NATIVE_OP_DATA,
FT900_NATIVE_VFO_DATA,
FT900_NATIVE_MEM_CHNL_DATA,
FT900_NATIVE_TUNER_OFF,
FT900_NATIVE_TUNER_ON,
FT900_NATIVE_TUNER_START,
FT900_NATIVE_READ_METER,
FT900_NATIVE_READ_FLAGS,
FT900_NATIVE_SIZE /* end marker, value indicates number of */
/* native cmd entries */
};
typedef enum ft900_native_cmd_e ft900_native_cmd_t;
@ -322,8 +323,10 @@ static int ft900_get_vfo(RIG *rig, vfo_t *vfo);
static int ft900_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
static int ft900_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
static int ft900_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
static int ft900_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
static int ft900_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo);
static int ft900_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo);
static int ft900_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
static int ft900_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit);

Wyświetl plik

@ -71,7 +71,8 @@
*
*/
enum ft920_native_cmd_e {
enum ft920_native_cmd_e
{
FT920_NATIVE_SPLIT_OFF = 0,
FT920_NATIVE_SPLIT_ON,
FT920_NATIVE_RECALL_MEM,
@ -99,7 +100,7 @@ enum ft920_native_cmd_e {
FT920_NATIVE_VFO_B_PASSBAND_NAR,
FT920_NATIVE_STATUS_FLAGS,
FT920_NATIVE_SIZE /* end marker, value indicates number of */
/* native cmd entries */
/* native cmd entries */
};
/*
@ -302,14 +303,18 @@ static int ft920_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
static int ft920_set_vfo(RIG *rig, vfo_t vfo);
static int ft920_get_vfo(RIG *rig, vfo_t *vfo);
static int ft920_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
static int ft920_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
static int ft920_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo);
static int ft920_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo);
static int ft920_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq);
static int ft920_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq);
static int ft920_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width);
static int ft920_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width);
static int ft920_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
pbwidth_t tx_width);
static int ft920_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
pbwidth_t *tx_width);
static int ft920_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
static int ft920_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit);

Wyświetl plik

@ -48,61 +48,62 @@
#include "ft990.h"
// FT990 native commands
enum ft990_native_cmd_e {
FT990_NATIVE_SPLIT_OFF = 0,
FT990_NATIVE_SPLIT_ON,
FT990_NATIVE_RECALL_MEM,
FT990_NATIVE_VFO_TO_MEM,
FT990_NATIVE_LOCK_OFF,
FT990_NATIVE_LOCK_ON,
FT990_NATIVE_VFO_A,
FT990_NATIVE_VFO_B,
FT990_NATIVE_MEM_TO_VFO,
FT990_NATIVE_VFO_STEP_UP,
FT990_NATIVE_VFO_STEP_UP_FAST,
FT990_NATIVE_VFO_STEP_DOWN,
FT990_NATIVE_VFO_STEP_DOWN_FAST,
FT990_NATIVE_RX_CLARIFIER_OFF,
FT990_NATIVE_RX_CLARIFIER_ON,
FT990_NATIVE_TX_CLARIFIER_OFF,
FT990_NATIVE_TX_CLARIFIER_ON,
FT990_NATIVE_CLEAR_CLARIFIER_OFFSET,
FT990_NATIVE_CLARIFIER_OPS,
FT990_NATIVE_FREQ_SET,
FT990_NATIVE_MODE_SET_LSB,
FT990_NATIVE_MODE_SET_USB,
FT990_NATIVE_MODE_SET_CW_W,
FT990_NATIVE_MODE_SET_CW_N,
FT990_NATIVE_MODE_SET_AM_W,
FT990_NATIVE_MODE_SET_AM_N,
FT990_NATIVE_MODE_SET_FM,
FT990_NATIVE_MODE_SET_RTTY_LSB,
FT990_NATIVE_MODE_SET_RTTY_USB,
FT990_NATIVE_MODE_SET_PKT_LSB,
FT990_NATIVE_MODE_SET_PKT_FM,
FT990_NATIVE_PACING,
FT990_NATIVE_PTT_OFF,
FT990_NATIVE_PTT_ON,
FT990_NATIVE_UPDATE_ALL_DATA,
FT990_NATIVE_UPDATE_MEM_CHNL,
FT990_NATIVE_UPDATE_OP_DATA,
FT990_NATIVE_UPDATE_VFO_DATA,
FT990_NATIVE_UPDATE_MEM_CHNL_DATA,
FT990_NATIVE_TUNER_OFF,
FT990_NATIVE_TUNER_ON,
FT990_NATIVE_TUNER_START,
FT990_NATIVE_RPTR_SHIFT_NONE,
FT990_NATIVE_RPTR_SHIFT_MINUS,
FT990_NATIVE_RPTR_SHIFT_PLUS,
FT990_NATIVE_VFO_TO_VFO,
FT990_NATIVE_BANDWIDTH,
FT990_NATIVE_OP_FREQ_STEP_UP,
FT990_NATIVE_OP_FREQ_STEP_DOWN,
FT990_NATIVE_READ_METER,
FT990_NATIVE_DIM_LEVEL,
FT990_NATIVE_RPTR_OFFSET,
FT990_NATIVE_READ_FLAGS,
FT990_NATIVE_SIZE
enum ft990_native_cmd_e
{
FT990_NATIVE_SPLIT_OFF = 0,
FT990_NATIVE_SPLIT_ON,
FT990_NATIVE_RECALL_MEM,
FT990_NATIVE_VFO_TO_MEM,
FT990_NATIVE_LOCK_OFF,
FT990_NATIVE_LOCK_ON,
FT990_NATIVE_VFO_A,
FT990_NATIVE_VFO_B,
FT990_NATIVE_MEM_TO_VFO,
FT990_NATIVE_VFO_STEP_UP,
FT990_NATIVE_VFO_STEP_UP_FAST,
FT990_NATIVE_VFO_STEP_DOWN,
FT990_NATIVE_VFO_STEP_DOWN_FAST,
FT990_NATIVE_RX_CLARIFIER_OFF,
FT990_NATIVE_RX_CLARIFIER_ON,
FT990_NATIVE_TX_CLARIFIER_OFF,
FT990_NATIVE_TX_CLARIFIER_ON,
FT990_NATIVE_CLEAR_CLARIFIER_OFFSET,
FT990_NATIVE_CLARIFIER_OPS,
FT990_NATIVE_FREQ_SET,
FT990_NATIVE_MODE_SET_LSB,
FT990_NATIVE_MODE_SET_USB,
FT990_NATIVE_MODE_SET_CW_W,
FT990_NATIVE_MODE_SET_CW_N,
FT990_NATIVE_MODE_SET_AM_W,
FT990_NATIVE_MODE_SET_AM_N,
FT990_NATIVE_MODE_SET_FM,
FT990_NATIVE_MODE_SET_RTTY_LSB,
FT990_NATIVE_MODE_SET_RTTY_USB,
FT990_NATIVE_MODE_SET_PKT_LSB,
FT990_NATIVE_MODE_SET_PKT_FM,
FT990_NATIVE_PACING,
FT990_NATIVE_PTT_OFF,
FT990_NATIVE_PTT_ON,
FT990_NATIVE_UPDATE_ALL_DATA,
FT990_NATIVE_UPDATE_MEM_CHNL,
FT990_NATIVE_UPDATE_OP_DATA,
FT990_NATIVE_UPDATE_VFO_DATA,
FT990_NATIVE_UPDATE_MEM_CHNL_DATA,
FT990_NATIVE_TUNER_OFF,
FT990_NATIVE_TUNER_ON,
FT990_NATIVE_TUNER_START,
FT990_NATIVE_RPTR_SHIFT_NONE,
FT990_NATIVE_RPTR_SHIFT_MINUS,
FT990_NATIVE_RPTR_SHIFT_PLUS,
FT990_NATIVE_VFO_TO_VFO,
FT990_NATIVE_BANDWIDTH,
FT990_NATIVE_OP_FREQ_STEP_UP,
FT990_NATIVE_OP_FREQ_STEP_DOWN,
FT990_NATIVE_READ_METER,
FT990_NATIVE_DIM_LEVEL,
FT990_NATIVE_RPTR_OFFSET,
FT990_NATIVE_READ_FLAGS,
FT990_NATIVE_SIZE
};
@ -122,8 +123,10 @@ static int ft990_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
static int ft990_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift);
static int ft990_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift);
static int ft990_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs);
static int ft990_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
static int ft990_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
static int ft990_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo);
static int ft990_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo);
static int ft990_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
static int ft990_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit);
static int ft990_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
@ -135,8 +138,9 @@ static int ft990_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
static int ft990_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op);
static int ft990_set_mem(RIG *rig, vfo_t vfo, int ch);
static int ft990_get_mem(RIG *rig, vfo_t vfo, int *ch);
static int ft990_set_channel (RIG *rig, vfo_t vfo, const channel_t *chan);
static int ft990_get_channel (RIG *rig, vfo_t vfo, channel_t *chan, int read_only);
static int ft990_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan);
static int ft990_get_channel(RIG *rig, vfo_t vfo, channel_t *chan,
int read_only);

Wyświetl plik

@ -143,7 +143,7 @@ const struct rig_caps ft991_caps =
RIG_MODEL(RIG_MODEL_FT991),
.model_name = "FT-991",
.mfg_name = "Yaesu",
.version = NEWCAT_VER ".7",
.version = NEWCAT_VER ".8",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -329,6 +329,8 @@ const struct rig_caps ft991_caps =
.get_ext_level = newcat_get_ext_level,
.send_morse = newcat_send_morse,
.send_voice_mem = newcat_send_voice_mem,
.set_clock = newcat_set_clock,
.get_clock = newcat_get_clock
};
@ -452,7 +454,7 @@ ft991_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
*/
static int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
pbwidth_t *tx_width)
pbwidth_t *tx_width)
{
struct newcat_priv_data *priv;
int err;
@ -538,7 +540,7 @@ static void debug_ft991info_data(const ft991info *rdata)
*/
static int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
pbwidth_t tx_width)
pbwidth_t tx_width)
{
struct newcat_priv_data *priv;
struct rig_state *state;

Wyświetl plik

@ -139,7 +139,7 @@ const struct rig_caps ftdx10_caps =
RIG_MODEL(RIG_MODEL_FTDX10),
.model_name = "FTDX-10",
.mfg_name = "Yaesu",
.version = NEWCAT_VER ".0",
.version = NEWCAT_VER ".1",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -308,4 +308,6 @@ const struct rig_caps ftdx10_caps =
.set_ext_level = newcat_set_ext_level,
.get_ext_level = newcat_get_ext_level,
.send_morse = newcat_send_morse,
.set_clock = newcat_set_clock,
.get_clock = newcat_get_clock
};

Wyświetl plik

@ -139,7 +139,7 @@ const struct rig_caps ftdx101d_caps =
RIG_MODEL(RIG_MODEL_FTDX101D),
.model_name = "FTDX-101D",
.mfg_name = "Yaesu",
.version = NEWCAT_VER ".12",
.version = NEWCAT_VER ".13",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -309,4 +309,6 @@ const struct rig_caps ftdx101d_caps =
.set_ext_level = newcat_set_ext_level,
.get_ext_level = newcat_get_ext_level,
.send_morse = newcat_send_morse,
.set_clock = newcat_set_clock,
.get_clock = newcat_get_clock
};

Wyświetl plik

@ -77,7 +77,7 @@ const struct rig_caps ftdx101mp_caps =
RIG_MODEL(RIG_MODEL_FTDX101MP),
.model_name = "FTDX-101MP",
.mfg_name = "Yaesu",
.version = NEWCAT_VER ".3",
.version = NEWCAT_VER ".4",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -247,4 +247,6 @@ const struct rig_caps ftdx101mp_caps =
.set_ext_level = newcat_set_ext_level,
.get_ext_level = newcat_get_ext_level,
.send_morse = newcat_send_morse,
.set_clock = newcat_set_clock,
.get_clock = newcat_get_clock
};

Wyświetl plik

@ -932,6 +932,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
&& rig->caps->set_vfo != NULL) // gotta' have get_vfo too
{
TRACE;
if (rig->state.current_vfo != vfo)
{
int vfo1 = 1, vfo2 = 0;
@ -1245,9 +1246,13 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB)
{
rig_get_mode(rig, vfo, &tmode, &twidth);
if (mode == tmode && (twidth == width || twidth == RIG_PASSBAND_NOCHANGE))
{
RETURNFUNC(RIG_OK);
}
}
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MD0x%c", cat_term);
priv->cmd_str[3] = newcat_modechar(mode);
@ -2312,7 +2317,8 @@ int newcat_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
vfo_t rx_vfo = RIG_VFO_NONE;
//ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: entered, rxvfo=%s, txvfo=%s, split=%d\n", __func__, rig_strvfo(vfo), rig_strvfo(tx_vfo), split);
rig_debug(RIG_DEBUG_TRACE, "%s: entered, rxvfo=%s, txvfo=%s, split=%d\n",
__func__, rig_strvfo(vfo), rig_strvfo(tx_vfo), split);
err = newcat_set_vfo_from_alias(rig, &vfo);
@ -3697,6 +3703,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
RETURNFUNC(-RIG_ENAVAIL);
}
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "KS%03d%c", val.i, cat_term);
break;
@ -4618,6 +4625,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx9000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM06%c", cat_term);
@ -4626,6 +4634,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM3%c", cat_term);
}
break;
case RIG_LEVEL_VD_METER:
@ -4633,6 +4642,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx9000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM11%c", cat_term);
@ -4641,6 +4651,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM8%c", cat_term);
}
break;
case RIG_LEVEL_ID_METER:
@ -4648,6 +4659,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx9000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM10%c", cat_term);
@ -4656,6 +4668,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM7%c", cat_term);
}
break;
case RIG_LEVEL_ANTIVOX:
@ -5067,14 +5080,17 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_RAWSTR:
case RIG_LEVEL_KEYSPD:
if (rig->caps->rig_model == RIG_MODEL_TS570D || rig->caps->rig_model == RIG_MODEL_TS570S)
{ // TS570 uses 010-~060 scale according to manual
val->i = atoi(retlvl)/2 + 10;
if (rig->caps->rig_model == RIG_MODEL_TS570D
|| rig->caps->rig_model == RIG_MODEL_TS570S)
{
// TS570 uses 010-~060 scale according to manual
val->i = atoi(retlvl) / 2 + 10;
}
else
{
val->i = atoi(retlvl);
}
break;
case RIG_LEVEL_IF:
@ -5594,15 +5610,28 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
}
if (is_ftdx101d || is_ftdx101mp) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c2%04d%c", main_sub_vfo, status ? 1 : 0, cat_term);
} else if (is_ftdx10 || is_ft991 || is_ft891) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO02%04d%c", status ? 1 : 0, cat_term);
} else if (is_ftdx5000) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%02d%c", main_sub_vfo, status ? 2 : 0, cat_term);
} else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%02d%c", status ? 2 : 0, cat_term);
} else {
if (is_ftdx101d || is_ftdx101mp)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c2%04d%c", main_sub_vfo,
status ? 1 : 0, cat_term);
}
else if (is_ftdx10 || is_ft991 || is_ft891)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO02%04d%c", status ? 1 : 0,
cat_term);
}
else if (is_ftdx5000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%02d%c", main_sub_vfo,
status ? 2 : 0, cat_term);
}
else if (is_ftdx3000 || is_ftdx1200 || is_ft2000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%02d%c", status ? 2 : 0,
cat_term);
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -5835,19 +5864,31 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx101d || is_ftdx101mp) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c2%c", main_sub_vfo, cat_term);
} else if (is_ftdx10 || is_ft991 || is_ft891) {
if (is_ftdx101d || is_ftdx101mp)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c2%c", main_sub_vfo,
cat_term);
}
else if (is_ftdx10 || is_ft991 || is_ft891)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO02%c", cat_term);
} else if (is_ftdx5000) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%c", main_sub_vfo, cat_term);
} else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) {
}
else if (is_ftdx5000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%c", main_sub_vfo,
cat_term);
}
else if (is_ftdx3000 || is_ftdx1200 || is_ft2000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%c", cat_term);
} else {
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
break;
default:
RETURNFUNC(-RIG_EINVAL);
}
@ -5930,15 +5971,24 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
break;
case RIG_FUNC_APF:
if (is_ftdx101d || is_ftdx101mp) {
if (is_ftdx101d || is_ftdx101mp)
{
*status = (retfunc[last_char_index] == '1') ? 1 : 0;
} else if (is_ftdx10 || is_ft991 || is_ft891) {
}
else if (is_ftdx10 || is_ft991 || is_ft891)
{
*status = (retfunc[last_char_index] == '1') ? 1 : 0;
} else if (is_ftdx5000) {
}
else if (is_ftdx5000)
{
*status = (retfunc[last_char_index] == '2') ? 1 : 0;
} else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) {
}
else if (is_ftdx3000 || is_ftdx1200 || is_ft2000)
{
*status = (retfunc[last_char_index] == '2') ? 1 : 0;
} else {
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -5986,7 +6036,7 @@ int newcat_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
}
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "KR%d%c", val.i ? 1 : 0,
cat_term);
cat_term);
RETURNFUNC(newcat_set_cmd(rig));
@ -6176,6 +6226,7 @@ int newcat_send_morse(RIG *rig, vfo_t vfo, const char *msg)
int rc;
char *s = strdup(msg);
ENTERFUNC;
if (newcat_is_rig(rig, RIG_MODEL_FT450))
{
// 450 manual says 1/2/3 playback needs P1=6/7/8
@ -6185,6 +6236,7 @@ int newcat_send_morse(RIG *rig, vfo_t vfo, const char *msg)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "KY%c%c", s[0], cat_term);
}
rc = newcat_set_cmd(rig);
free(s);
RETURNFUNC(rc);
@ -9851,7 +9903,7 @@ int newcat_get_cmd(RIG *rig)
/* read the reply */
if ((rc = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data),
&cat_term, sizeof(cat_term), 0)) <= 0)
&cat_term, sizeof(cat_term), 0, 1)) <= 0)
{
continue; /* usually a timeout - retry */
}
@ -10051,7 +10103,7 @@ int newcat_set_cmd_validate(RIG *rig)
if (strlen(valcmd) == 0) { RETURNFUNC(RIG_OK); }
bytes = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data),
&cat_term, sizeof(cat_term), 0);
&cat_term, sizeof(cat_term), 0, 1);
// FA and FB success is now verified in rig.c with a followup query
// so no validation is needed
@ -10179,7 +10231,7 @@ int newcat_set_cmd(RIG *rig)
/* read the reply */
if ((rc = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data),
&cat_term, sizeof(cat_term), 0)) <= 0)
&cat_term, sizeof(cat_term), 0, 1)) <= 0)
{
continue; /* usually a timeout - retry */
}
@ -10249,7 +10301,7 @@ int newcat_set_cmd(RIG *rig)
/* read/flush the verify command reply which should still be there */
if ((rc = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data),
&cat_term, sizeof(cat_term), 0)) > 0)
&cat_term, sizeof(cat_term), 0, 1)) > 0)
{
rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s\n",
__func__, rc, priv->ret_data);
@ -10394,10 +10446,12 @@ int newcat_send_voice_mem(RIG *rig, vfo_t vfo, int ch)
{
char *p1 = "0"; // newer rigs have 2 bytes where is fixed at zero e.g. FT991
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
if (!newcat_valid_command(rig, "PB"))
{
RETURNFUNC(-RIG_ENAVAIL);
}
// we don't do any channel checking -- varies by rig -- could do it but not critical
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PB%s%d%c", p1, ch, cat_term);
@ -10415,13 +10469,23 @@ static int newcat_set_apf_frequency(RIG *rig, vfo_t vfo, int freq)
}
// Range seems to be -250..250 Hz in 10 Hz steps
if (is_ftdx101d || is_ftdx101mp) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c3%04d%c", main_sub_vfo, (freq + 250) / 10, cat_term);
} else if (is_ftdx10 || is_ft991 || is_ft891) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO03%04d%c", (freq + 250) / 10, cat_term);
} else if (is_ftdx3000 || is_ftdx1200) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO02%02d%c", (freq + 250) / 10, cat_term);
} else {
if (is_ftdx101d || is_ftdx101mp)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c3%04d%c", main_sub_vfo,
(freq + 250) / 10, cat_term);
}
else if (is_ftdx10 || is_ft991 || is_ft891)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO03%04d%c", (freq + 250) / 10,
cat_term);
}
else if (is_ftdx3000 || is_ftdx1200)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO02%02d%c", (freq + 250) / 10,
cat_term);
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -10441,13 +10505,21 @@ static int newcat_get_apf_frequency(RIG *rig, vfo_t vfo, int *freq)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx101d || is_ftdx101mp) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c3%c", main_sub_vfo, cat_term);
} else if (is_ftdx10 || is_ft991 || is_ft891) {
if (is_ftdx101d || is_ftdx101mp)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c3%c", main_sub_vfo,
cat_term);
}
else if (is_ftdx10 || is_ft991 || is_ft891)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO03%c", cat_term);
} else if (is_ftdx3000 || is_ftdx1200) {
}
else if (is_ftdx3000 || is_ftdx1200)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO02%c", cat_term);
} else {
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -10481,17 +10553,29 @@ static int newcat_set_apf_width(RIG *rig, vfo_t vfo, int choice)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx101d || is_ftdx101mp || is_ftdx10) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030201%d%c", choice, cat_term);
} else if (is_ft991) {
if (is_ftdx101d || is_ftdx101mp || is_ftdx10)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030201%d%c", choice,
cat_term);
}
else if (is_ft991)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX111%d%c", choice, cat_term);
} else if (is_ft891) {
}
else if (is_ft891)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX1201%d%c", choice, cat_term);
} else if (is_ftdx5000) {
}
else if (is_ftdx5000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX112%d%c", choice, cat_term);
} else if (is_ftdx3000 || is_ftdx1200) {
}
else if (is_ftdx3000 || is_ftdx1200)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX107%d%c", choice, cat_term);
} else {
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -10510,17 +10594,28 @@ static int newcat_get_apf_width(RIG *rig, vfo_t vfo, int *choice)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx101d || is_ftdx101mp || is_ftdx10) {
if (is_ftdx101d || is_ftdx101mp || is_ftdx10)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030201%c", cat_term);
} else if (is_ft991) {
}
else if (is_ft991)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX111%c", cat_term);
} else if (is_ft891) {
}
else if (is_ft891)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX1201%c", cat_term);
} else if (is_ftdx5000) {
}
else if (is_ftdx5000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX112%c", cat_term);
} else if (is_ftdx3000 || is_ftdx1200) {
}
else if (is_ftdx3000 || is_ftdx1200)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX107%c", cat_term);
} else {
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -10552,15 +10647,28 @@ static int newcat_set_contour(RIG *rig, vfo_t vfo, int status)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx101d || is_ftdx101mp) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%04d%c", main_sub_vfo, status ? 1 : 0, cat_term);
} else if (is_ftdx10 || is_ft991 || is_ft891) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%04d%c", status ? 1 : 0, cat_term);
} else if (is_ftdx5000) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%02d%c", main_sub_vfo, status ? 1 : 0, cat_term);
} else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%02d%c", status ? 1 : 0, cat_term);
} else {
if (is_ftdx101d || is_ftdx101mp)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%04d%c", main_sub_vfo,
status ? 1 : 0, cat_term);
}
else if (is_ftdx10 || is_ft991 || is_ft891)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%04d%c", status ? 1 : 0,
cat_term);
}
else if (is_ftdx5000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%02d%c", main_sub_vfo,
status ? 1 : 0, cat_term);
}
else if (is_ftdx3000 || is_ftdx1200 || is_ft2000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%02d%c", status ? 1 : 0,
cat_term);
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -10581,15 +10689,26 @@ static int newcat_get_contour(RIG *rig, vfo_t vfo, int *status)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx101d || is_ftdx101mp) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%c", main_sub_vfo, cat_term);
} else if (is_ftdx10 || is_ft991 || is_ft891) {
if (is_ftdx101d || is_ftdx101mp)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%c", main_sub_vfo,
cat_term);
}
else if (is_ftdx10 || is_ft991 || is_ft891)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%c", cat_term);
} else if (is_ftdx5000) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%c", main_sub_vfo, cat_term);
} else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) {
}
else if (is_ftdx5000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%c", main_sub_vfo,
cat_term);
}
else if (is_ftdx3000 || is_ftdx1200 || is_ft2000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%c", cat_term);
} else {
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -10623,19 +10742,31 @@ static int newcat_set_contour_frequency(RIG *rig, vfo_t vfo, int freq)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx101d || is_ftdx101mp) {
if (is_ftdx101d || is_ftdx101mp)
{
// Range is 10..3200 Hz
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c1%04d%c", main_sub_vfo, freq, cat_term);
} else if (is_ftdx10 || is_ft991 || is_ft891) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c1%04d%c", main_sub_vfo,
freq, cat_term);
}
else if (is_ftdx10 || is_ft991 || is_ft891)
{
// Range is 10..3200 Hz
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO01%04d%c", freq, cat_term);
} else if (is_ftdx5000) {
}
else if (is_ftdx5000)
{
// Range is 100..4000 Hz in 100 Hz steps
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c1%01d%c", main_sub_vfo, freq / 100, cat_term);
} else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c1%01d%c", main_sub_vfo,
freq / 100, cat_term);
}
else if (is_ftdx3000 || is_ftdx1200 || is_ft2000)
{
// Range is 100..4000 Hz in 100 Hz steps
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO01%02d%c", freq / 100, cat_term);
} else {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO01%02d%c", freq / 100,
cat_term);
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -10655,15 +10786,26 @@ static int newcat_get_contour_frequency(RIG *rig, vfo_t vfo, int *freq)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx101d || is_ftdx101mp) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c1%c", main_sub_vfo, cat_term);
} else if (is_ftdx10 || is_ft991 || is_ft891) {
if (is_ftdx101d || is_ftdx101mp)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c1%c", main_sub_vfo,
cat_term);
}
else if (is_ftdx10 || is_ft991 || is_ft891)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO01%c", cat_term);
} else if (is_ftdx5000) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c1%c", main_sub_vfo, cat_term);
} else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) {
}
else if (is_ftdx5000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c1%c", main_sub_vfo,
cat_term);
}
else if (is_ftdx3000 || is_ftdx1200 || is_ft2000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO01%c", cat_term);
} else {
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -10682,11 +10824,16 @@ static int newcat_get_contour_frequency(RIG *rig, vfo_t vfo, int *freq)
int raw_value = atoi(ret_data);
if (is_ftdx101d || is_ftdx101mp || is_ftdx10 || is_ft991 || is_ft891) {
if (is_ftdx101d || is_ftdx101mp || is_ftdx10 || is_ft991 || is_ft891)
{
*freq = raw_value;
} else if (is_ftdx5000 || is_ftdx3000 || is_ftdx1200 || is_ft2000) {
}
else if (is_ftdx5000 || is_ftdx3000 || is_ftdx1200 || is_ft2000)
{
*freq = raw_value * 100;
} else {
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -10702,17 +10849,30 @@ static int newcat_set_contour_level(RIG *rig, vfo_t vfo, int level)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx101d || is_ftdx101mp || is_ftdx10) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030202%+03d%c", level, cat_term);
} else if (is_ft991) {
if (is_ftdx101d || is_ftdx101mp || is_ftdx10)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030202%+03d%c", level,
cat_term);
}
else if (is_ft991)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX112%+03d%c", level, cat_term);
} else if (is_ft891) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX1202%+03d%c", level, cat_term);
} else if (is_ftdx5000) {
}
else if (is_ft891)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX1202%+03d%c", level,
cat_term);
}
else if (is_ftdx5000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX113%+03d%c", level, cat_term);
} else if (is_ftdx3000 || is_ftdx1200) {
}
else if (is_ftdx3000 || is_ftdx1200)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX108%+03d%c", level, cat_term);
} else {
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -10731,17 +10891,28 @@ static int newcat_get_contour_level(RIG *rig, vfo_t vfo, int *level)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx101d || is_ftdx101mp || is_ftdx10) {
if (is_ftdx101d || is_ftdx101mp || is_ftdx10)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030202%c", cat_term);
} else if (is_ft991) {
}
else if (is_ft991)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX112%c", cat_term);
} else if (is_ft891) {
}
else if (is_ft891)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX1202%c", cat_term);
} else if (is_ftdx5000) {
}
else if (is_ftdx5000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX113%c", cat_term);
} else if (is_ftdx3000 || is_ftdx1200) {
}
else if (is_ftdx3000 || is_ftdx1200)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX108%c", cat_term);
} else {
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -10772,17 +10943,29 @@ static int newcat_set_contour_width(RIG *rig, vfo_t vfo, int width)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx101d || is_ftdx101mp || is_ftdx10) {
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030203%02d%c", width, cat_term);
} else if (is_ft991) {
if (is_ftdx101d || is_ftdx101mp || is_ftdx10)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030203%02d%c", width,
cat_term);
}
else if (is_ft991)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX113%02d%c", width, cat_term);
} else if (is_ft891) {
}
else if (is_ft891)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX1203%02d%c", width, cat_term);
} else if (is_ftdx5000) {
}
else if (is_ftdx5000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX114%02d%c", width, cat_term);
} else if (is_ftdx3000 || is_ftdx1200) {
}
else if (is_ftdx3000 || is_ftdx1200)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX109%02d%c", width, cat_term);
} else {
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -10801,17 +10984,28 @@ static int newcat_get_contour_width(RIG *rig, vfo_t vfo, int *width)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx101d || is_ftdx101mp || is_ftdx10) {
if (is_ftdx101d || is_ftdx101mp || is_ftdx10)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030203%c", cat_term);
} else if (is_ft991) {
}
else if (is_ft991)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX113%c", cat_term);
} else if (is_ft891) {
}
else if (is_ft891)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX1203%c", cat_term);
} else if (is_ftdx5000) {
}
else if (is_ftdx5000)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX114%c", cat_term);
} else if (is_ftdx3000 || is_ftdx1200) {
}
else if (is_ftdx3000 || is_ftdx1200)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX109%c", cat_term);
} else {
}
else
{
RETURNFUNC(-RIG_ENIMPL);
}
@ -10832,3 +11026,112 @@ static int newcat_get_contour_width(RIG *rig, vfo_t vfo, int *width)
RETURNFUNC(RIG_OK);
}
int newcat_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
int sec, double msec, int utc_offset)
{
int retval = RIG_OK;
int err;
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
if (!newcat_valid_command(rig, "DT"))
{
RETURNFUNC(-RIG_ENAVAIL);
}
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "DT0%04d%02d%02d%c", year, month,
day, cat_term);
if (RIG_OK != (err = newcat_set_cmd(rig)))
{
rig_debug(RIG_DEBUG_VERBOSE, "%s:%d command err = %d\n", __func__, __LINE__,
err);
RETURNFUNC(err);
}
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "DT1%02d%02d%02d%c", hour, min, sec, cat_term);
if (RIG_OK != (err = newcat_set_cmd(rig)))
{
rig_debug(RIG_DEBUG_VERBOSE, "%s:%d command err = %d\n", __func__, __LINE__,
err);
RETURNFUNC(err);
}
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "DT2%c%04d%c", utc_offset>=0?'+':'-', utc_offset, cat_term);
if (RIG_OK != (err = newcat_set_cmd(rig)))
{
rig_debug(RIG_DEBUG_VERBOSE, "%s:%d command err = %d\n", __func__, __LINE__,
err);
RETURNFUNC(err);
}
RETURNFUNC(retval);
}
int newcat_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int *min, int *sec, double *msec, int *utc_offset)
{
int retval = RIG_OK;
int err;
int n;
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
if (!newcat_valid_command(rig, "DT"))
{
RETURNFUNC(-RIG_ENAVAIL);
}
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "DT0%c", cat_term);
if ((err = newcat_get_cmd(rig)) != RIG_OK)
{
RETURNFUNC(err);
}
n = sscanf(priv->ret_data, "DT0%04d%02d%02d", year, month, day);
if (n != 3)
{
rig_debug(RIG_DEBUG_ERR, "%s: DT0 unable to parse '%s'\n", __func__,
priv->ret_data);
RETURNFUNC(-RIG_EPROTO);
}
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "DT1%c", cat_term);
if ((err = newcat_get_cmd(rig)) != RIG_OK)
{
RETURNFUNC(err);
}
n = sscanf(priv->ret_data, "DT1%02d%02d%02d", hour, min, sec);
if (n != 3)
{
rig_debug(RIG_DEBUG_ERR, "%s: DT1 unable to parse '%s'\n", __func__,
priv->ret_data);
RETURNFUNC(-RIG_EPROTO);
}
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "DT2%c", cat_term);
if ((err = newcat_get_cmd(rig)) != RIG_OK)
{
RETURNFUNC(err);
}
// we keep utc_offset in HHMM format rather than converting
n = sscanf(priv->ret_data, "DT2%d", utc_offset);
if (n != 1)
{
rig_debug(RIG_DEBUG_ERR, "%s: DT2 unable to parse '%s'\n", __func__,
priv->ret_data);
RETURNFUNC(-RIG_EPROTO);
}
RETURNFUNC(retval);
}

Wyświetl plik

@ -50,7 +50,7 @@
typedef char ncboolean;
/* shared function version */
#define NEWCAT_VER "20211114"
#define NEWCAT_VER "20211202"
/* Hopefully large enough for future use, 128 chars plus '\0' */
#define NEWCAT_DATA_LEN 129
@ -222,6 +222,11 @@ int newcat_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val);
int newcat_send_morse(RIG *rig, vfo_t vfo, const char *msg);
int newcat_send_voice_mem(RIG *rig, vfo_t vfo, int ch);
int newcat_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
int sec, double msec, int utc_offset);
int newcat_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int *min, int *sec, double *msec, int *utc_offset);
#define TOKEN_BACKEND(t) (t)

Wyświetl plik

@ -46,100 +46,101 @@
#include "vx1700.h"
// VX-1700 native commands
typedef enum vx1700_native_cmd_e {
VX1700_NATIVE_RECALL_MEM = 0, /* 0x02, p1=ch */
VX1700_NATIVE_VFO_TO_MEM, /* 0x03, p1=ch, p2=0 */
VX1700_NATIVE_MEM_HIDE, /* 0x03, p1=ch, p2=1 */
VX1700_NATIVE_VFO_A, /* 0x05 */
VX1700_NATIVE_FREQ_SET, /* 0x0a, p1:4=freq */
VX1700_NATIVE_MODE_SET_LSB, /* 0x0c, p1=0x00 */
VX1700_NATIVE_MODE_SET_USB, /* 0x0c, p1=0x01 */
VX1700_NATIVE_MODE_SET_CW_W, /* 0x0c, p1=0x02 */
VX1700_NATIVE_MODE_SET_CW_N, /* 0x0c, p1=0x03 */
VX1700_NATIVE_MODE_SET_AM, /* 0x0c, p1=0x04 */
VX1700_NATIVE_MODE_SET_RTTY_LSB_W, /* 0x0c, p1=0x08 */
VX1700_NATIVE_MODE_SET_RTTY_USB_W, /* 0x0c, p1=0x09 */
VX1700_NATIVE_MODE_SET_H3E, /* 0x0c, p1=0x0d */
VX1700_NATIVE_MODE_SET_RTTY_LSB_N, /* 0x0c, p1=0x0e */
VX1700_NATIVE_MODE_SET_RTTY_USB_N, /* 0x0c, p1=0x0f */
VX1700_NATIVE_PTT_OFF, /* 0x0f, p1=0 */
VX1700_NATIVE_PTT_ON, /* 0x0f, p1=1 */
VX1700_NATIVE_UPDATE_MEM_CHNL, /* 0x10, p1=1 */
VX1700_NATIVE_UPDATE_OP_DATA, /* 0x10, p1=2 */
VX1700_NATIVE_UPDATE_VFO_DATA, /* 0x10, p1=3 */
VX1700_NATIVE_TX_POWER_LOW, /* 0x18 */
VX1700_NATIVE_TX_POWER_MID, /* 0x28 */
VX1700_NATIVE_TX_POWER_HI, /* 0x48 */
VX1700_NATIVE_CPY_RX_TO_TX, /* 0x85 */
VX1700_NATIVE_TX_FREQ_SET, /* 0x8a, p1:4=freq */
VX1700_NATIVE_OP_FREQ_STEP_UP, /* 0x8e, p1=0 */
VX1700_NATIVE_OP_FREQ_STEP_DOWN, /* 0x8e, p1=1 */
VX1700_NATIVE_READ_METER, /* 0xf7 */
VX1700_NATIVE_READ_FLAGS, /* 0xfa */
typedef enum vx1700_native_cmd_e
{
VX1700_NATIVE_RECALL_MEM = 0, /* 0x02, p1=ch */
VX1700_NATIVE_VFO_TO_MEM, /* 0x03, p1=ch, p2=0 */
VX1700_NATIVE_MEM_HIDE, /* 0x03, p1=ch, p2=1 */
VX1700_NATIVE_VFO_A, /* 0x05 */
VX1700_NATIVE_FREQ_SET, /* 0x0a, p1:4=freq */
VX1700_NATIVE_MODE_SET_LSB, /* 0x0c, p1=0x00 */
VX1700_NATIVE_MODE_SET_USB, /* 0x0c, p1=0x01 */
VX1700_NATIVE_MODE_SET_CW_W, /* 0x0c, p1=0x02 */
VX1700_NATIVE_MODE_SET_CW_N, /* 0x0c, p1=0x03 */
VX1700_NATIVE_MODE_SET_AM, /* 0x0c, p1=0x04 */
VX1700_NATIVE_MODE_SET_RTTY_LSB_W, /* 0x0c, p1=0x08 */
VX1700_NATIVE_MODE_SET_RTTY_USB_W, /* 0x0c, p1=0x09 */
VX1700_NATIVE_MODE_SET_H3E, /* 0x0c, p1=0x0d */
VX1700_NATIVE_MODE_SET_RTTY_LSB_N, /* 0x0c, p1=0x0e */
VX1700_NATIVE_MODE_SET_RTTY_USB_N, /* 0x0c, p1=0x0f */
VX1700_NATIVE_PTT_OFF, /* 0x0f, p1=0 */
VX1700_NATIVE_PTT_ON, /* 0x0f, p1=1 */
VX1700_NATIVE_UPDATE_MEM_CHNL, /* 0x10, p1=1 */
VX1700_NATIVE_UPDATE_OP_DATA, /* 0x10, p1=2 */
VX1700_NATIVE_UPDATE_VFO_DATA, /* 0x10, p1=3 */
VX1700_NATIVE_TX_POWER_LOW, /* 0x18 */
VX1700_NATIVE_TX_POWER_MID, /* 0x28 */
VX1700_NATIVE_TX_POWER_HI, /* 0x48 */
VX1700_NATIVE_CPY_RX_TO_TX, /* 0x85 */
VX1700_NATIVE_TX_FREQ_SET, /* 0x8a, p1:4=freq */
VX1700_NATIVE_OP_FREQ_STEP_UP, /* 0x8e, p1=0 */
VX1700_NATIVE_OP_FREQ_STEP_DOWN, /* 0x8e, p1=1 */
VX1700_NATIVE_READ_METER, /* 0xf7 */
VX1700_NATIVE_READ_FLAGS, /* 0xfa */
VX1700_NATIVE_SIZE
} vx1700_native_cmd_t;
// OpCode Declarations
#define VX1700_CMD_RECALLMEM 0x02
#define VX1700_CMD_VFO2MEM 0x03
#define VX1700_CMD_SEL_VFOA 0x05
#define VX1700_CMD_SET_VFOA 0x0a
#define VX1700_CMD_SEL_OP_MODE 0x0c
#define VX1700_CMD_PTT 0x0f
#define VX1700_CMD_UPDATE 0x10
#define VX1700_CMD_RX2TX 0x85
#define VX1700_CMD_STEP_VFO 0x8e
#define VX1700_CMD_RD_METER 0xf7
#define VX1700_CMD_RD_FLAGS 0xfa
#define VX1700_CMD_RECALLMEM 0x02
#define VX1700_CMD_VFO2MEM 0x03
#define VX1700_CMD_SEL_VFOA 0x05
#define VX1700_CMD_SET_VFOA 0x0a
#define VX1700_CMD_SEL_OP_MODE 0x0c
#define VX1700_CMD_PTT 0x0f
#define VX1700_CMD_UPDATE 0x10
#define VX1700_CMD_RX2TX 0x85
#define VX1700_CMD_STEP_VFO 0x8e
#define VX1700_CMD_RD_METER 0xf7
#define VX1700_CMD_RD_FLAGS 0xfa
// Return codes
#define VX1700_CMD_RETCODE_OK 0x00
#define VX1700_CMD_RETCODE_ERROR 0xF0
#define VX1700_CMD_RETCODE_OK 0x00
#define VX1700_CMD_RETCODE_ERROR 0xF0
// Operating Mode Status
#define VX1700_MODE_LSB 0x00
#define VX1700_MODE_USB 0x01
#define VX1700_MODE_CW_W 0x02
#define VX1700_MODE_CW_N 0x03
#define VX1700_MODE_AM 0x04
#define VX1700_MODE_RTTY 0x05
#define VX1700_MODE_LSB 0x00
#define VX1700_MODE_USB 0x01
#define VX1700_MODE_CW_W 0x02
#define VX1700_MODE_CW_N 0x03
#define VX1700_MODE_AM 0x04
#define VX1700_MODE_RTTY 0x05
// Operation Mode Selection
#define VX1700_OP_MODE_LSB 0x00
#define VX1700_OP_MODE_USB 0x01
#define VX1700_OP_MODE_CW_W 0x02
#define VX1700_OP_MODE_CW_N 0x03
#define VX1700_OP_MODE_AM 0x04
#define VX1700_OP_MODE_RTTY_LSB_W 0x08
#define VX1700_OP_MODE_RTTY_USB_W 0x09
#define VX1700_OP_MODE_H3E 0x0d
#define VX1700_OP_MODE_RTTY_LSB_N 0x0e
#define VX1700_OP_MODE_RTTY_USB_N 0x0f
#define VX1700_OP_MODE_LSB 0x00
#define VX1700_OP_MODE_USB 0x01
#define VX1700_OP_MODE_CW_W 0x02
#define VX1700_OP_MODE_CW_N 0x03
#define VX1700_OP_MODE_AM 0x04
#define VX1700_OP_MODE_RTTY_LSB_W 0x08
#define VX1700_OP_MODE_RTTY_USB_W 0x09
#define VX1700_OP_MODE_H3E 0x0d
#define VX1700_OP_MODE_RTTY_LSB_N 0x0e
#define VX1700_OP_MODE_RTTY_USB_N 0x0f
// Status Flag 1 Masks
#define VX1700_SF_LOCKED 0x01 /* LOCK is activated */
#define VX1700_SF_MEM 0x20 /* Memory Mode */
#define VX1700_SF_VFO 0x80 /* VFO Mode */
#define VX1700_SF_LOCKED 0x01 /* LOCK is activated */
#define VX1700_SF_MEM 0x20 /* Memory Mode */
#define VX1700_SF_VFO 0x80 /* VFO Mode */
// Status Flag 2 Masks
#define VX1700_SF_PTT_BY_CAT 0x01 /* PTT closed by CAT */
#define VX1700_SF_MEM_SCAN_PAUSE 0x02 /* Scanning paused */
#define VX1700_SF_MEM_SCAN 0x04 /* Scanning enabled */
#define VX1700_SF_RTTY_FILTER_NARROW 0x08 /* Narrow RTTY filter selected */
#define VX1700_SF_CW_FILTER_NARROW 0x10 /* Narrow CW filter selected */
#define VX1700_SF_RTTY_USB 0x20 /* USB selected for RTTY */
#define VX1700_SF_PTT_BY_CAT 0x01 /* PTT closed by CAT */
#define VX1700_SF_MEM_SCAN_PAUSE 0x02 /* Scanning paused */
#define VX1700_SF_MEM_SCAN 0x04 /* Scanning enabled */
#define VX1700_SF_RTTY_FILTER_NARROW 0x08 /* Narrow RTTY filter selected */
#define VX1700_SF_CW_FILTER_NARROW 0x10 /* Narrow CW filter selected */
#define VX1700_SF_RTTY_USB 0x20 /* USB selected for RTTY */
// Status Flag 3 Masks
#define VX1700_SF_10W_TX 0x20 /* 10 Watt TX output selected */
#define VX1700_SF_TUNER_ON 0x20 /* Antenna Tuner working */
#define VX1700_SF_TRANSMISSION_ON 0x80 /* Transmission in progress */
#define VX1700_SF_10W_TX 0x20 /* 10 Watt TX output selected */
#define VX1700_SF_TUNER_ON 0x20 /* Antenna Tuner working */
#define VX1700_SF_TRANSMISSION_ON 0x80 /* Transmission in progress */
/* HAMLIB API implementation */
static int vx1700_init(RIG *rig);
static int vx1700_open(RIG *rig);
static int vx1700_cleanup(RIG *rig);
static const char * vx1700_get_info(RIG *rig);
static const char *vx1700_get_info(RIG *rig);
static int vx1700_set_vfo(RIG *rig, vfo_t vfo);
static int vx1700_get_vfo(RIG *rig, vfo_t *vfo);
@ -148,7 +149,8 @@ static int vx1700_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
static int vx1700_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq);
static int vx1700_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq);
static int vx1700_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
static int vx1700_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
static int vx1700_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width);
static int vx1700_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
static int vx1700_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
static int vx1700_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);

Wyświetl plik

@ -92,7 +92,7 @@ transaction_write:
/* the answer */
memset(data, 0, data_len);
retval = read_string(&rs->rotport, data, data_len, ACK, strlen(ACK), 0);
retval = read_string(&rs->rotport, data, data_len, ACK, strlen(ACK), 0, 1);
if (retval < 0)
{

Some files were not shown because too many files have changed in this diff Show More