Merged from upstream

Hamlib-3.1
Ervin Hegedus 2016-05-08 22:00:35 +02:00
commit 3b981f4b31
261 zmienionych plików z 21032 dodań i 11479 usunięć

1
.gitignore vendored
Wyświetl plik

@ -6,6 +6,7 @@
*.o
*.lo
*.la
*.orig
*.swp
Makefile
Makefile.in

Wyświetl plik

@ -1,3 +1,3 @@
For a complete log of changes to Hamlib, please visit:
http://hamlib.git.sourceforge.net/git/gitweb.cgi?p=hamlib/hamlib;a=log
http://sourceforge.net/p/hamlib/code/commit_browser

18
INSTALL
Wyświetl plik

@ -250,13 +250,13 @@ MS Windows
./configure --host=i686-w64-mingw32
- Specifying the directory of libusb for a Windows build using MinGW as
libusb must be installed separately, use the following environment
- Specifying the directory of libusb-1.0 for a Windows build using MinGW as
libusb-1.0 must be installed separately, use the following environment
variables after all other options.
./configure [other options] \
CPPFLAGS="-I/path_to_libusb/include" \
LDFLAGS="-L/path_to_libusb/lib/gcc"
CPPFLAGS="-I/path_to_libusb-1.0/include" \
LDFLAGS="-L/path_to_libusb-1.0/lib/gcc"
- Mingw compiler under Cygwin
@ -333,12 +333,12 @@ Note, the following is still experimental.
application may be thought to ease its distribution. As a static library is
built by default the following notes may assist application authors.
The 'kit' backend depends on libusb. To link libusb statically set the
The 'kit' backend depends on libusb-1.0. To link libusb-1.0 statically set the
following environment variable on the 'configure' command line:
LIBUSB_LIBS="/usr/lib/i386-linux-gnu/libusb.a"
LIBUSB_LIBS="/usr/lib/i386-linux-gnu/libusb-1.0.a"
do note that the absolute path to 'libusb.a' may well be quite different on
do note that the absolute path to 'libusb-1.0.a' may well be quite different on
other systems.
By default the GNU linker (ld) will include most all symbols in a static
@ -358,7 +358,7 @@ nor does 'rotctl' contain any rig symbols.
./configure --disable-shared --prefix="$HOME/local" --without-cxx-binding \
--disable-winradio CFLAGS="-fdata-sections -ffunction-sections" \
LDFLAGS="-Wl,--gc-sections" LIBUSB_LIBS="/usr/lib/i386-linux-gnu/libusb.a"
LDFLAGS="-Wl,--gc-sections" LIBUSB_LIBS="/usr/lib/i386-linux-gnu/libusb-1.0.a"
to make a static only Hamlib library, statically link libusb, and include only
to make a static only Hamlib library, statically link libusb-1.0, and include only
the needed symbols in the Hamlib utilities linking to libhamlib.a.

Wyświetl plik

@ -19,7 +19,7 @@ SUBDIRS = macros include lib \
## Static list of distributed directories. $(BACKEND_LIST) is dynamically
## assigned by 'configure' so list rig backends statically.
DIST_SUBDIRS = macros include lib src c++ bindings tests doc android scripts \
adat alinco aor drake dummy flexradio icom jrc kachina kenwood kit \
adat alinco aor drake dummy flexradio icom icmarine jrc kachina kenwood kit \
lowe pcr prm80 racal rft rs skanti tapr tentec tuner uniden wj yaesu \
winradio \
$(ROT_BACKEND_LIST)

14
NEWS
Wyświetl plik

@ -1,12 +1,17 @@
Hamlib -- History of visible changes.
Copyright (C) 2000-2003 Frank Singleton
Copyright (C) 2000-2013 Stephane Fillod, and others
Copyright (C) 2000-2015 Stephane Fillod, and others
Please send Hamlib bug reports to hamlib-developer@lists.sourceforge.net
Version 3.1
2016-??-??
* Fix kenwood_set_mode for ts590s and mode CW, RTTY or AM.
Tks Tom, DL1JBE
Version 3.0
2013-??-??
2015-09-20
* Kill RPC backends and rpc.rigd/rpc.rotd
* Remove -e|--end-marker option from rigctld and rotctld
* Build system updates--remove obsolete macros, autogen.sh now
@ -51,6 +56,11 @@ Version 3.0
only invoke pkg-config when either or both of these features are
selected. Only the Winradio g313 model uses libdl so test for it
only when Winradio backend is enabled.
* New IC-M700PRO, IC-M710, IC-M802.
* New Icom ID-5100 model.
* New rotor, cnctrk by KI4SBL
* Many backend fixes and updates from many contributors (see Git
log for complete details).
Version 1.2.15.3
2012-11-01

Wyświetl plik

@ -86,12 +86,12 @@ Optional, but highly recommended for a complete build:
* zlib devel # Needed by configure's test for Python
* libxml2 devel # xml2-config --version
* libgd2 devel # gdlib-config --version
* libusb devel # libusb-config --version (not 1.0.0!)
* libusb-1.0 devel # ver 1.0 or newer (not 0.1!)
* libreadline devel # ver 5.2 or newer
N.B The libusb package is required for building most of the 'kit' backend.
The older version is needed, not 1.0.0 or higher. Debian and derivatives
package libusb 0.1.12 which is what is needed.
The newer version is needed, not 0.1. Debian and derivatives
package libusb-1.0 which is what is needed.
Documentation:
* Doxygen

Wyświetl plik

@ -146,7 +146,7 @@ Much documentation on Git exists. A good starting point is:
http://git-scm.com/documentation
From this page are links to toturials, books (Pro Git proved useful for me),
From this page are links to tutorials, books (Pro Git proved useful for me),
and references (http://gitref.org/ is another good resource).
Another site:
@ -247,14 +247,13 @@ Optional, but highly recommended:
* python devel # python-config
* libxml2 devel # xml2-config --version
* libgd2 devel # gdlib-config --version
* libusb devel # libusb-config --version (not 1.0.0!)
* libusb-1.0 devel # 1.0.0 or newer
* libreadline devel # ver 5.2 or newer
* texlive # 5.1 tested with 'make distcheck'
* pkg-config 0.9.0 # pkg-config --version (libxml and USRP)
N.B.: The libusb package is required for building most of the 'kit' backend.
The older version is needed, not 1.0.0 or higher. Debian and derivatives
package libusb 0.1.12 which is what is needed.
N.B.: The libusb-1.0 package is required for building most of the 'kit'
backend. The older version of libusb 0.1.x is no longer supported.
Documentation:
* Doxygen
@ -393,7 +392,8 @@ So far, Hamlib has been tested successfully under the following systems:
Create a new subdir, of the name of the protocol backend.
NB: the directory MUST be the same as the backend name.
2.2. Add <mybackend> to the DIST_SUBDIRS variable in the topdir Makefile.am
2.2. Add <mybackend> to the DIST_SUBDIRS variable in the topdir
Makefile.am (not needed for rotators)
2.3. Add the backend name to the BACKEND_LIST variable (add to
ROT_BACKEND_LIST for a new rotor backend) in configure.ac.
@ -541,17 +541,29 @@ readability. Align closing braces with the opening block's keyword. In
function definitions put the opening brace on its own line under the
definition's parameter line.
Hamlib source code is no place for an entry into the obsfucated C contest!
A configuration file for the Artistic Style (http://astyle.sourceforge.net/)
utility can be found in the scripts directory. The settings it provides should
conform reasonably close to the Linux style guide referenced above. This file
can be copied to $HOME/.astylerc where it will be used as the default
configuration. If you already have an existing .astylerc, passing
--options=/path/to/hamlib/scripts/astylerc
will use this file as the configuration for formatting. Consider using this
utility whenever working on a given C source file in Hamlib.
Hamlib source code is no place for an entry into the obfuscated C contest!
Many of us are hobbyists and write this for fun. Easy to read and
understand logic is preferred over a clever solution. If your solution must
be written in a clever fashion, please document it well in your comments.
Any header files included from the hamlib/ directory should be enclosed
in <>:
Any header files included from the hamlib/ directory should be enclosed in <>:
#include <hamlib/rig.h> # Per GNU GCC documentation
Other included header files (backend and rig specific headers) should be
enclosed in "":
#include "yaesu.h"
Contributed code should always keep the source base in a compilable state,
@ -576,12 +588,14 @@ Hamlib should also compile with the following common compilers:
* gcc-4.x and newer
* in shared and static
* C++ compiler against rig.h, riglist.h, rotator.h
* clang compiler
Portability issues to watch:
* C99 is probably (in 2016) a reasonable target
* little vs. big endian systems (use shifts or adhoc functions)
* 64 bit int: avoid them in API
* printf/scanf of 64bit int: use PRIll and SCNll
* printf/scanf of 64bit int: use PRIll (cast value to int64_t) and SCNll
* printf/scanf of freq_t: use PRIfreq and SCNfreq
Testing:
@ -670,6 +684,9 @@ big, you can send it as a compressed attachment.
8.3.1 Changelog
A ChangeLog file is no longer manually maintained. At some point it may be
automatically generated from the Git commit log for source tarballs.
Simply summarize your changes when the files are committed to Git or, if
providing patches to the mailing list, provide a summary so the uploader can
include it in the commit message which will show in the commit log (Git

Plik diff jest za duży Load Diff

Wyświetl plik

@ -292,6 +292,8 @@ int alinco_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (retval != RIG_OK)
return retval;
if (width == RIG_PASSBAND_NOCHANGE) return retval;
/*
* TODO: please DX77 owners, check this, I'm not sure
* which passband is default!
@ -818,7 +820,7 @@ int alinco_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
if (retval != RIG_OK)
return retval;
if (ptt_len != 3 || ptt_len != 4) {
if (ptt_len != 3 && ptt_len != 4) {
rig_debug(RIG_DEBUG_ERR,"alinco_get_ptt: wrong answer %s, "
"len=%d\n", pttbuf, ptt_len);
return -RIG_ERJCTED;
@ -852,7 +854,7 @@ int alinco_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
if (retval != RIG_OK)
return retval;
if (dcd_len != 4 || dcd_len != 5) {
if (dcd_len != 4 && dcd_len != 5) {
rig_debug(RIG_DEBUG_ERR,"alinco_get_dcd: wrong answer %s, "
"len=%d\n", dcdbuf, dcd_len);
return -RIG_ERJCTED;

Wyświetl plik

@ -12,6 +12,7 @@ Notes:
** FTDI USB to serial converter driver is not included in standard kernel. It should work on rooted device.
** But NET rigctl works fine
* Backends are named libhamlib-vendor.so, I don't know how to include libraries without lib prefix into APK
* Check the location of libusb.h and define the corresponding macro accordingly in config.h.
Happy hacking
73 Lada, OK1ZIA

Wyświetl plik

@ -222,8 +222,11 @@
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <usb.h> header file. */
#define HAVE_USB_H 1
/* Define to 1 if you have the <libusb.h> header file. */
#define HAVE_LIBUSB_H 1
/* Define to 1 if you have the <libusb-1.0/libusb.h> header file. */
/* #undef HAVE_LIBUSB_1_0_LIBUSB_H 1
/* Define to 1 if you have the `usleep' function. */
#define HAVE_USLEEP 1

Wyświetl plik

@ -299,55 +299,57 @@ int format8k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width)
switch (mode) {
case RIG_MODE_AM:
if (rig->caps->rig_model == RIG_MODEL_AR8000)
{
aormode = AR8K_AM;
}
else
{
switch(width) {
case RIG_PASSBAND_NORMAL:
case s_kHz(9): aormode = AR8K_AM; break;
if (rig->caps->rig_model == RIG_MODEL_AR8000)
{
aormode = AR8K_AM;
}
else
{
switch(width) {
case RIG_PASSBAND_NORMAL:
case s_kHz(9): aormode = AR8K_AM; break;
case s_kHz(12): aormode = AR8K_WAM; break;
case s_kHz(3): aormode = AR8K_NAM; break;
default:
rig_debug(RIG_DEBUG_ERR,
"%s: unsupported passband %d %d\n",
__FUNCTION__,
mode, width);
return -RIG_EINVAL;
}
}
case s_kHz(12): aormode = AR8K_WAM; break;
case s_kHz(3): aormode = AR8K_NAM; break;
case RIG_PASSBAND_NOCHANGE: aormode = AR8K_AM; break;
default:
rig_debug(RIG_DEBUG_ERR,
"%s: unsupported passband %d %d\n",
__FUNCTION__,
mode, width);
return -RIG_EINVAL;
}
}
break;
case RIG_MODE_CW: aormode = AR8K_CW; break;
case RIG_MODE_USB: aormode = AR8K_USB; break;
case RIG_MODE_LSB: aormode = AR8K_LSB; break;
case RIG_MODE_WFM: aormode = AR8K_WFM; break;
case RIG_MODE_FM:
if (rig->caps->rig_model == RIG_MODEL_AR8000)
{
aormode = AR8K_NFM;
}
else
{
switch(width) {
case RIG_PASSBAND_NORMAL:
case s_kHz(12): aormode = AR8K_NFM; break;
if (rig->caps->rig_model == RIG_MODEL_AR8000)
{
aormode = AR8K_NFM;
}
else
{
switch(width) {
case RIG_PASSBAND_NORMAL:
case s_kHz(12): aormode = AR8K_NFM; break;
case s_kHz(9): aormode = AR8K_SFM; break;
default:
rig_debug(RIG_DEBUG_ERR,
"%s: unsupported passband %d %d\n",
__FUNCTION__,
mode, width);
return -RIG_EINVAL;
}
}
case s_kHz(9): aormode = AR8K_SFM; break;
case RIG_PASSBAND_NOCHANGE: aormode = AR8K_NFM; break;
default:
rig_debug(RIG_DEBUG_ERR,
"%s: unsupported passband %d %d\n",
__FUNCTION__,
mode, width);
return -RIG_EINVAL;
}
}
break;
default:
rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n",
__FUNCTION__, mode);
__FUNCTION__, mode);
return -RIG_EINVAL;
}

Wyświetl plik

@ -379,9 +379,14 @@ int ar3030_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL;
}
mdbuf_len = sprintf(mdbuf, "%dB%c" EOM,
width < rig_passband_normal(rig,mode) ? 1 : 0,
aormode);
if (width != RIG_PASSBAND_NOCHANGE) {
mdbuf_len = sprintf(mdbuf, "%c" EOM, aormode);
}
else {
mdbuf_len = sprintf(mdbuf, "%dB%c" EOM,
width < rig_passband_normal(rig,mode) ? 1 : 0,
aormode);
}
retval = ar3030_transaction (rig, mdbuf, mdbuf_len, NULL, NULL);
return retval;

Wyświetl plik

@ -396,9 +396,9 @@ const struct rig_caps ar5000a_caps = {
int format5k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width)
{
int aormode, aorwidth;
int aormode, aorwidth;
switch (mode) {
switch (mode) {
case RIG_MODE_AM: aormode = AR5K_AM; break;
case RIG_MODE_WFM:
case RIG_MODE_FM: aormode = AR5K_FM; break;
@ -409,29 +409,34 @@ int format5k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width)
case RIG_MODE_SAL: aormode = AR5K_SAL; break;
case RIG_MODE_SAH: aormode = AR5K_SAH; break;
default:
rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n",
__FUNCTION__, mode);
return -RIG_EINVAL;
}
rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n",
__FUNCTION__, mode);
return -RIG_EINVAL;
}
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode);
width = rig_passband_normal(rig, mode);
switch (width) {
case 500: aorwidth = '0'; break;
case s_kHz(3): aorwidth = '1'; break;
case s_kHz(6): aorwidth = '2'; break;
case s_kHz(15): aorwidth = '3'; break;
case s_kHz(30): aorwidth = '4'; break;
case s_kHz(110): aorwidth = '5'; break;
case s_kHz(220): aorwidth = '6'; break;
default:
rig_debug(RIG_DEBUG_ERR,"%s: unsupported width %d\n",
__FUNCTION__, width);
return -RIG_EINVAL;
case 500: aorwidth = '0'; break;
case s_kHz(3): aorwidth = '1'; break;
case s_kHz(6): aorwidth = '2'; break;
case s_kHz(15): aorwidth = '3'; break;
case s_kHz(30): aorwidth = '4'; break;
case s_kHz(110): aorwidth = '5'; break;
case s_kHz(220): aorwidth = '6'; break;
default:
rig_debug(RIG_DEBUG_ERR,"%s: unsupported width %d\n",
__FUNCTION__, width);
return -RIG_EINVAL;
}
return sprintf(buf, "MD%c BW%c", aormode, aorwidth);
}
else {
return sprintf(buf, "MD%c", aormode);
}
}

Wyświetl plik

@ -364,6 +364,8 @@ static int ar7030_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL;
}
if (RIG_PASSBAND_NOCHANGE == width) return RIG_OK;
if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode);

Wyświetl plik

@ -572,46 +572,46 @@ static int ar7030p_set_mode( RIG * rig, vfo_t vfo, rmode_t mode,
rc = lockRx( rig, LOCK_1 );
if ( RIG_OK == rc )
{
/* TODO - deal with selected VFO */
ar_mode = modeToNative( mode );
rc = writeByte( rig, WORKING, MODE, ar_mode );
if ( RIG_OK == rc )
{
if ( RIG_PASSBAND_NORMAL == width )
{
width = rig_passband_normal( rig, mode );
}
else
{
/* TODO - get filter BWs at startup */
ar_filter = (unsigned char) 6;
for ( i = 1; i <= 6; i++ )
{
if ( width <= filterTab[ i ] )
{
if ( filterTab[ i ] < filterTab[ (int) ar_filter ] )
{
ar_filter = (unsigned char) i;
}
}
/* TODO - deal with selected VFO */
ar_mode = modeToNative( mode );
rig_debug( RIG_DEBUG_VERBOSE, "%s: width %d ar_filter %d filterTab[%d] %d\n",
__func__, width, ar_filter, i, filterTab[i] );
}
}
rc = writeByte( rig, WORKING, MODE, ar_mode );
if ( RIG_OK == rc && width != RIG_PASSBAND_NOCHANGE )
{
if ( RIG_PASSBAND_NORMAL == width )
{
width = rig_passband_normal( rig, mode );
}
else
{
/* TODO - get filter BWs at startup */
ar_filter = (unsigned char) 6;
for ( i = 1; i <= 6; i++ )
{
if ( width <= filterTab[ i ] )
{
if ( filterTab[ i ] < filterTab[ (int) ar_filter ] )
{
ar_filter = (unsigned char) i;
}
}
rc = writeByte( rig, WORKING, FILTER, ar_filter );
if ( RIG_OK == rc )
{
rc = execRoutine( rig, SET_ALL );
}
rig_debug( RIG_DEBUG_VERBOSE, "%s: width %d ar_filter %d filterTab[%d] %d\n",
__func__, width, ar_filter, i, filterTab[i] );
}
}
rc = writeByte( rig, WORKING, FILTER, ar_filter );
if ( RIG_OK == rc )
{
rc = execRoutine( rig, SET_ALL );
}
}
rc = lockRx( rig, LOCK_0 );
}
rc = lockRx( rig, LOCK_0 );
}
return( rc );
}

Wyświetl plik

@ -51,7 +51,7 @@ static const unsigned int PAGE_SIZE[] = {
*/
int NOP( RIG *rig, unsigned char x )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char op = ( ( 0x0f & x ) | op_NOP );
@ -72,7 +72,7 @@ int NOP( RIG *rig, unsigned char x )
*/
int SRH( RIG *rig, unsigned char x )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char op = ( ( 0x0f & x ) | op_SRH );
@ -93,7 +93,7 @@ int SRH( RIG *rig, unsigned char x )
*/
int PGE( RIG *rig, enum PAGE_e page )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char op = ( ( 0x0f & page ) | op_PGE );
@ -132,7 +132,7 @@ int PGE( RIG *rig, enum PAGE_e page )
*/
int ADR( RIG *rig, unsigned char x )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char op = ( ( 0x0f & x ) | op_ADR );
@ -153,7 +153,7 @@ int ADR( RIG *rig, unsigned char x )
*/
int ADH( RIG *rig, unsigned char x )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char op = ( ( 0x0f & x ) | op_ADH );
@ -176,7 +176,7 @@ int ADH( RIG *rig, unsigned char x )
*/
int WRD( RIG *rig, unsigned char out )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char op = ( ( 0x0f & out ) | op_WRD );
@ -198,7 +198,7 @@ int WRD( RIG *rig, unsigned char out )
*/
int MSK( RIG *rig, unsigned char mask )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char op = ( ( 0x0f & mask ) | op_MSK );
@ -219,7 +219,7 @@ int MSK( RIG *rig, unsigned char mask )
*/
int EXE( RIG *rig, enum ROUTINE_e routine )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char op = ( ( 0x0f & routine ) | op_EXE );
@ -265,7 +265,7 @@ int EXE( RIG *rig, enum ROUTINE_e routine )
*/
int RDD( RIG *rig, unsigned char len )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char inChr = 0;
unsigned char op = ( ( 0x0f & len ) | op_RDD );
@ -298,7 +298,7 @@ int RDD( RIG *rig, unsigned char len )
*/
int LOC( RIG *rig, enum LOCK_LVL_e level )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char op = ( ( 0x0f & level ) | op_LOC );
@ -333,7 +333,7 @@ int LOC( RIG *rig, enum LOCK_LVL_e level )
*/
int BUT( RIG *rig, enum BUTTON_e button )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char op = ( ( 0x0f & button ) | op_BUT );
@ -390,7 +390,7 @@ int execRoutine( RIG * rig, enum ROUTINE_e rtn )
if ( 0 == write_block( &rig->state.rigport, (char *) &v, 1 ) )
{
rc = -RIG_OK;
rc = RIG_OK;
rig_debug( RIG_DEBUG_VERBOSE, "%s: routine %2d\n", __func__, rtn );
}
@ -427,7 +427,7 @@ static int setAddr( RIG * rig, enum PAGE_e page, unsigned int addr )
if ( 0 == write_block( &rig->state.rigport, (char *) &v, 1 ) )
{
curPage = page;
rc = -RIG_OK;
rc = RIG_OK;
rig_debug( RIG_DEBUG_VERBOSE, "%s: set page %2d\n", __func__, page );
}
@ -442,7 +442,7 @@ static int setAddr( RIG * rig, enum PAGE_e page, unsigned int addr )
v = SRH( ( 0x0f0 & addr ) >> 4 );
if ( 0 == write_block( &rig->state.rigport, (char *) &v, 1 ) )
{
rc = -RIG_OK;
rc = RIG_OK;
}
else
{
@ -458,7 +458,7 @@ static int setAddr( RIG * rig, enum PAGE_e page, unsigned int addr )
if ( 0 == write_block( &rig->state.rigport, (char *) &v, 1 ) )
{
curAddr = addr;
rc = -RIG_OK;
rc = RIG_OK;
rig_debug( RIG_DEBUG_VERBOSE, "%s: set addr 0x%04x\n", __func__, addr );
}
@ -470,7 +470,7 @@ static int setAddr( RIG * rig, enum PAGE_e page, unsigned int addr )
else
{
curAddr = addr;
rc = -RIG_OK;
rc = RIG_OK;
rig_debug( RIG_DEBUG_VERBOSE, "%s: set addr 0x%04x\n", __func__, addr );
}
@ -521,7 +521,7 @@ int writeByte( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char x )
{
if ( 0 == write_block( &rig->state.rigport, (char *) &lo, 1 ) )
{
rc = -RIG_OK;
rc = RIG_OK;
curAddr++;
rig_debug( RIG_DEBUG_VERBOSE, "%s: wrote byte 0x%02x\n", __func__, x );
@ -638,7 +638,7 @@ int writeInt( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int x )
*/
int readByte( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char *x )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char v = RDD( 1 ); // Read command
assert( NULL != rig );
@ -653,7 +653,7 @@ int readByte( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char *x )
if ( 1 == read_block( &rig->state.rigport, (char *) x, 1 ) )
{
curAddr++;
rc = -RIG_OK;
rc = RIG_OK;
rig_debug( RIG_DEBUG_VERBOSE, "%s: read 0x%02x\n", __func__, *x );
}
@ -676,7 +676,7 @@ int readByte( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char *x )
*/
int readShort( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned short *x )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char v;
assert( NULL != rig );
@ -711,7 +711,7 @@ int readShort( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned short *x
*/
int read3Bytes( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int *x )
{
int rc = -RIG_OK;
int rc = RIG_OK;
unsigned char v;
assert( NULL != rig );
@ -801,7 +801,7 @@ int readSignal( RIG * rig, unsigned char *x )
{
if ( 1 == read_block( &rig->state.rigport, (char *) x, 1 ) )
{
rc = -RIG_OK;
rc = RIG_OK;
rig_debug( RIG_DEBUG_VERBOSE, "%s: raw AGC %03d\n", __func__, *x );
}
@ -825,7 +825,7 @@ int flushBuffer( RIG * rig )
if ( 0 == write_block( &rig->state.rigport, &v, 1 ) )
{
rc = -RIG_OK;
rc = RIG_OK;
}
return( rc );
@ -853,14 +853,14 @@ int lockRx( RIG * rig, enum LOCK_LVL_e level )
if ( 0 == write_block( &rig->state.rigport, (char *) &v, 1 ) )
{
rc = -RIG_OK;
rc = RIG_OK;
curLock = level;
}
}
else
{
rc = -RIG_OK;
rc = RIG_OK;
}
}
else
@ -962,7 +962,7 @@ unsigned char int2BCD( const unsigned int val )
*/
int getCalLevel( RIG * rig, unsigned char rawAgc, int *dbm )
{
int rc = -RIG_OK;
int rc = RIG_OK;
int i;
int raw = (int) rawAgc;
int step = 10;

Wyświetl plik

@ -370,15 +370,21 @@ int sr2200_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
normal_width = rig_passband_normal(rig, mode);
if (width == 0)
if (width == RIG_PASSBAND_NORMAL)
width = normal_width;
switch (mode) {
case RIG_MODE_AM: aormode = width > normal_width ?
SR2200_WAM : SR2200_AM; break;
case RIG_MODE_FM: aormode = width < normal_width ?
SR2200_SFM : SR2200_FM; break;
case RIG_MODE_WFM: aormode = SR2200_WFM; break;
case RIG_MODE_AM:
aormode = width > normal_width ?
SR2200_WAM : SR2200_AM;
break;
case RIG_MODE_FM:
aormode = width >= normal_width ?
SR2200_FM : SR2200_SFM;
break;
case RIG_MODE_WFM:
aormode = SR2200_WFM;
break;
default:
rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n",
__FUNCTION__,mode);

Wyświetl plik

@ -14,7 +14,7 @@ AUTORECONF=autoreconf
AUTOMAKE=automake
# variables below this line should not need modification
SRCDIR=`dirname $0`
SRCDIR=`dirname "$0"`
test -z "$SRCDIR" && SRCDIR=.
ORIGDIR=`pwd`
@ -26,21 +26,21 @@ FILE=include/hamlib/rig.h
DIE=0
($AUTORECONF --version) < /dev/null > /dev/null 2>&1 || {
("$AUTORECONF" --version) > /dev/null 2>&1 || {
echo
echo "You must have autoreconf installed to compile $PROJECT."
echo "Download the appropriate package for your distribution,"
DIE=1
}
($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
("$AUTOMAKE" --version) > /dev/null 2>&1 || {
echo
echo "You must have automake installed to compile $PROJECT."
echo "Download the appropriate package for your distribution,"
DIE=1
}
($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
("$LIBTOOLIZE" --version) > /dev/null 2>&1 || {
echo
echo "You must have libtool installed to compile $PROJECT."
echo "Download the appropriate package for your distribution."
@ -51,7 +51,7 @@ if test "$DIE" -eq 1; then
exit 1
fi
cd $SRCDIR
cd "$SRCDIR"
test $TEST_TYPE $FILE || {
echo "You must run this script in the top-level $PROJECT directory"
@ -68,13 +68,13 @@ echo "Running '$AUTORECONF -i' to process configure.ac"
echo "and generate the configure script."
# Tell autoreconf to install needed build system files
$AUTORECONF -i
"$AUTORECONF" -i
cd $ORIGDIR
cd "$ORIGDIR"
if test -z "$*"; then
echo "I am going to run ./configure with no arguments - if you wish "
echo "to pass any to it, please specify them on the $0 command line."
echo "to pass any to it, please specify them on the \"$0\" command line."
fi
$SRCDIR/configure "$@"
"$SRCDIR/configure" "$@"

Wyświetl plik

@ -78,22 +78,20 @@ if ENABLE_PYTHON
##########################################
# Python binding
python_ltlib = _Hamlib.la
#pythondir = @pythondir@
pyexec_ltlib = _Hamlib.la
MOSTLYCLEANFILES+= hamlibpy_wrap.c Hamlib.py *.pyc
BUILT_SOURCES += hamlibpy_wrap.c Hamlib.py
nodist_python_PYTHON = Hamlib.py
nodist_pyexec_PYTHON = Hamlib.py
nodist__Hamlib_la_SOURCES = hamlibpy_wrap.c
_Hamlib_la_LDFLAGS = -no-undefined -module -avoid-version
_Hamlib_la_LIBADD = $(top_builddir)/src/libhamlib.la
_Hamlib_ladir = $(pythondir)
_Hamlib_la_LTLIBRARIES = $(python_ltlib)
_Hamlib_ladir = $(pyexecdir)
_Hamlib_la_LTLIBRARIES = $(pyexec_ltlib)
all-py: $(python_ltlib)
all-py: $(pyexec_ltlib)
check-py: all-py
$(srcdir)/pytest.py || echo "Python test failed" 1>&2

Wyświetl plik

@ -65,6 +65,8 @@
%ignore RIG_BACKEND_RS;
%ignore RIG_ADAT;
%ignore RIG_BACKEND_ADAT;
%ignore RIG_ICMARINE;
%ignore RIG_BACKEND_ICMARINE;
%ignore ROT_DUMMY;
%ignore ROT_BACKEND_DUMMY;

Wyświetl plik

@ -16,7 +16,7 @@ TESTS = $(check_SCRIPTS)
testcpp.sh:
echo 'LD_LIBRARY_PATH=$(top_builddir)/dummy/.libs ./testcpp' > testcpp.sh
echo 'LD_LIBRARY_PATH=$(top_builddir)/c++/.libs:$(top_builddir)/dummy/.libs ./testcpp' > testcpp.sh
chmod +x ./testcpp.sh
CLEANFILES = testcpp.sh

Wyświetl plik

@ -311,6 +311,18 @@ rmode_t Rig::getSplitMode(pbwidth_t& width, vfo_t vfo) {
return mode;
}
void Rig::setSplitFreqMode(freq_t tx_freq, rmode_t mode, pbwidth_t width, vfo_t vfo) {
CHECK_RIG (rig_set_split_freq_mode (theRig, vfo, tx_freq, mode, width));
}
freq_t Rig::getSplitFreqMode(rmode_t& mode, pbwidth_t& width, vfo_t vfo) {
freq_t freq;
CHECK_RIG (rig_get_split_freq_mode (theRig, vfo, &freq, &mode, &width));
return freq;
}
void Rig::setSplitVFO(split_t split, vfo_t vfo, vfo_t tx_vfo) {
CHECK_RIG(rig_set_split_vfo(theRig, vfo, split, tx_vfo));
}

12
cnctrk/Android.mk 100644
Wyświetl plik

@ -0,0 +1,12 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := cnctrk.c
LOCAL_MODULE := cnctrk
LOCAL_CFLAGS := -DHAVE_CONFIG_H
LOCAL_C_INCLUDES := android include src
LOCAL_LDLIBS := -lhamlib -Lobj/local/armeabi
include $(BUILD_STATIC_LIBRARY)

Wyświetl plik

@ -0,0 +1,5 @@
noinst_LTLIBRARIES = libhamlib-cnctrk.la
libhamlib_cnctrk_la_SOURCES = cnctrk.c
EXTRA_DIST = Android.mk

91
cnctrk/cnctrk.c 100644
Wyświetl plik

@ -0,0 +1,91 @@
/*
* Hamlib Rotator backend - LinuxCNC no hardware port
* Copyright (c) 2015 by Robert Freeman
* Adapted from AMSAT code by Stephane Fillod
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <math.h>
#include <stdlib.h>
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#include "hamlib/rotator.h"
#include "misc.h"
#include "register.h"
char axcmd[512];
static int
cnctrk_set_position(ROT *rot, azimuth_t az, elevation_t el)
{
int retval;
retval = system ("/usr/bin/axis-remote --ping");
if (retval != 0)
return retval;
sprintf(axcmd, "/usr/bin/axis-remote --mdi 'G00 X %6.2f Y %6.2f' \n", az, el);
return retval = system (axcmd);
return RIG_OK;
}
/** CNCTRK implements essentially only the set position function.
it assumes there is a LinuxCNC running with the Axis GUI */
const struct rot_caps cnctrk_rot_caps = {
.rot_model = ROT_MODEL_CNCTRK,
.model_name = "CNCTRK",
.mfg_name = "CNCTRK",
.version = "0.1",
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rot_type = ROT_TYPE_OTHER,
.port_type = RIG_PORT_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.retry = 3,
.min_az = 0,
.max_az = 360,
.min_el = -20,
.max_el = 180,
.set_position = cnctrk_set_position,
};
/* ************************************************************************* */
DECLARE_INITROT_BACKEND(cnctrk)
{
rig_debug(RIG_DEBUG_VERBOSE, "cnctrk: _init called\n");
rot_register(&cnctrk_rot_caps);
return RIG_OK;
}

Wyświetl plik

@ -15,7 +15,7 @@ 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],
[3.0~git],
[3.1~git],
[hamlib-developer@lists.sourceforge.net],
[hamlib],
[http://www.hamlib.org])
@ -49,14 +49,14 @@ dnl added to AC_CONFIG_FILES near the end of this file. See README.developer
dnl Beware of duplication should a backend directory include both rig and
dnl rotor definitions, e.g. "dummy". Optional backends will not be listed
dnl here but will be added later, e.g. "winradio".
BACKEND_LIST="adat alinco aor drake dummy flexradio icom jrc kachina kenwood kit lowe pcr prm80 racal rft rs skanti tapr tentec tuner uniden wj yaesu"
ROT_BACKEND_LIST="amsat ars celestron easycomm ether6 fodtrack gs232a heathkit m2 rotorez sartek spid ts7400"
BACKEND_LIST="adat alinco aor drake dummy flexradio icom icmarine jrc kachina kenwood kit lowe pcr prm80 racal rft rs skanti tapr tentec tuner uniden wj yaesu"
ROT_BACKEND_LIST="amsat ars celestron cnctrk easycomm ether6 fodtrack gs232a heathkit m2 rotorez sartek spid ts7400 prosistel"
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=3
ABI_REVISION=0
ABI_REVISION=1
ABI_AGE=1
AC_DEFINE_UNQUOTED([ABI_VERSION], [$ABI_VERSION], [Frontend ABI version])
@ -309,23 +309,23 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
dnl Check for libusb, treat LIBUSB_LIBS and LIBUSB_CFLAGS as precious variables
AC_ARG_VAR([LIBUSB_CFLAGS], [C compiler flags for libusb, overriding configure defaults])
AC_ARG_VAR([LIBUSB_LIBS], [linker flags for libusb, overriding configure check (useful for specifying static libusb.a (see INSTALL))])
AC_ARG_VAR([LIBUSB_LIBS], [linker flags for libusb, overriding configure check (useful for specifying static libusb-1.0.a (see INSTALL))])
cf_with_libusb="no"
AS_IF([test -z $LIBUSB_LIBS],
[AC_CHECK_LIB([usb], [usb_init], [LIBUSB_LIBS="-lusb" cf_with_libusb="yes"],
[AC_MSG_WARN([usb_init was not found in libusb--USB backends will be disabled])])
[AC_CHECK_LIB([usb-1.0], [libusb_init], [LIBUSB_LIBS="-lusb-1.0" cf_with_libusb="yes"],
[AC_MSG_WARN([libusb_init was not found in libusb-1.0--USB backends will be disabled])])
], [cf_with_libusb="yes"])
LIBUSB=""
AS_IF([test x"${cf_with_libusb}" = "xyes"],
[AC_CHECK_HEADERS([usb.h])
[AC_CHECK_HEADERS([libusb.h libusb-1.0/libusb.h])
AC_DEFINE([HAVE_LIBUSB],
[1],
[Define if libusb is available])
LIBUSB="libusb"])
[Define if libusb-1.0 is available])
LIBUSB="libusb-1.0"])
# Only used in hamlib.pc.in
AC_SUBST([LIBUSB])
@ -415,7 +415,7 @@ dnl http://lists.gnu.org/archive/html/automake/2011-03/msg00008.html
dnl
dnl Check for pkg-config program, used for configuring some libraries.
m4_define_default([PKG_PROG_PKG_CONFIG],
[AC_MSG_CHECKING([pkg-config]
[AC_MSG_CHECKING([pkg-config])
AC_MSG_RESULT([no])])
PKG_PROG_PKG_CONFIG
@ -619,13 +619,17 @@ AS_CASE(["$host_os"],
],
dnl As g313-posix.c has a hard dependency on linux/types.h
dnl via linradio/wrg313api.h, disable compilation on other POSIX.
[ *linux-gnu ], [
dnl (Certain systems have extra characters following "-gnu" such as
dnl the Raspberry Pi which is "linux-gnueabihf"; presume that "linux-gnu"
dnl is a sufficient test.)
[ *linux-gnu* ], [
AM_CONDITIONAL(G313_LINUX_GNU, true)
AM_CONDITIONAL(G313_WINDOWS, false)
],
[
AM_CONDITIONAL(G313_LINUX_GNU, false)
AM_CONDITIONAL(G313_WINDOWS, false)
AC_DEFINE([OTHER_POSIX], [1], [Compilation on POSIX other than Linux])
])
dnl If libdl is present, check for its header file.
@ -691,6 +695,7 @@ lib/Makefile
dummy/Makefile
yaesu/Makefile
icom/Makefile
icmarine/Makefile
aor/Makefile
kenwood/Makefile
winradio/Makefile
@ -732,9 +737,11 @@ amsat/Makefile
adat/Makefile
ts7400/Makefile
celestron/Makefile
cnctrk/Makefile
ether6/Makefile
scripts/Makefile
android/Makefile
prosistel/Makefile
hamlib.pc])
AC_OUTPUT

Wyświetl plik

@ -231,9 +231,18 @@ system hierarchy. Perhaps you want to install to your home directory
instead:
@example
@command{./configure --prefix=~/local}
@command{./configure --prefix=$HOME/local}
@end example
@quotation Note
For practice you may wish to start out using the
@samp{--prefix=$HOME/local} option to install the Hamlib files into
your home directory and avoid overwriting any version of Hamlib
installed into the system directories. The code examples in the
remainder of this manual will assume Hamlib has been installed to
@samp{$HOME/local}.
@end quotation
All of the files will be installed in the @file{local} directory of
your home directory. @file{local} will be created if it does not
exist during installation as will several other directories in it.

Wyświetl plik

@ -365,30 +365,36 @@ argument is not used. See @command{chk_vfo} below.
@*
@end ifhtml
@item -n
@itemx --no-restore-ai
On exit @command{rigctl} restores the state of auto information (AI)
on the controlled rig. If this is not desired, for example if you are
using @command{rigctl} to turn AI mode on or off, pass this option.
@item -i
@itemx --read-history
Read previously saved command and argument history from a file
(default '@file{~/.rigctl_history}') for the current session.
(default '@file{$HOME/.rigctl_history}') for the current session.
Available when @command{rigctl} is built with Readline support.
@strong{N.B.} To read a history file stored in another directory, set
the @env{RIGCTL_HIST_DIR} environment variable, e.g.@:
'@kbd{RIGCTL_HIST_DIR=~/tmp rigctl -i}'. When @env{RIGCTL_HIST_DIR}
is not set, the value of @env{HOME} is used.
'@kbd{RIGCTL_HIST_DIR=$HOME/tmp rigctl -i}'. When
@env{RIGCTL_HIST_DIR} is not set, the value of @env{HOME} is used.
@item -I
@itemx --save-history
Write current session (and previously saved session(s) if @option{-i}
option is also given) command and argument history to a file (default
'@file{~/.rigctl_history}') at the end of the current session.
'@file{$HOME/.rigctl_history}') at the end of the current session.
Complete commands with arguments are saved as a single line to be
recalled and used or edited. Available when @command{rigctl} is built
with Readline support.
To write a history file in another directory, set the
@env{RIGCTL_HIST_DIR} environment variable, e.g.@:
'@kbd{RIGCTL_HIST_DIR=~/tmp rigctl -I}'. When @env{RIGCTL_HIST_DIR}
is not set, the value of @env{HOME} is used.
'@kbd{RIGCTL_HIST_DIR=$HOME/tmp rigctl -I}'. When
@env{RIGCTL_HIST_DIR} is not set, the value of @env{HOME} is used.
@item -v
@itemx --verbose
@ -513,7 +519,9 @@ Set @var{Mode} to one of: @code{USB}, @code{LSB}, @code{CW},
@code{SAH}, @code{DSB}.
Set @var{Passband} frequency in Hertz, or @code{0} for the Hamlib
backend default.
backend default. A value of @code{-1} may be passed which leaves the
rig passband unchanged from the current or default value for the mode
as defined by the rig.
@strong{N.B.} Passing a @kbd{?} (query) as the first argument
instead of @var{Mode} will return a space separated list of radio
@ -671,12 +679,16 @@ Get @var{DCS Sql} code.
@item I, set_split_freq @var{Tx Frequency}
Set @var{TX Frequency}, in Hertz for ``split'' frequency operation.
See also @command{set_split_freq_mode} below.
@ifhtml
@*
@end ifhtml
@item i, get_split_freq
Get @var{TX Frequency}, in Hertz for ``split'' frequency operation.
See also @command{get_split_freq_mode} below.
@ifhtml
@*
@end ifhtml
@ -689,19 +701,75 @@ Set @var{TX Mode} to one of: @code{AM}, @code{FM}, @code{CW},
@code{SAH}, @code{DSB}.
The @var{TX Passband} is the exact passband frequency in Hertz, or
@code{0} for the Hamlib backend default.
@code{0} for the Hamlib backend default. A value of @code{-1} may be
passed which leaves the rig passband unchanged from the current or
default value for the mode as defined by the rig.
@strong{N.B.} Passing a @kbd{?} (query) as the first argument instead
of @var{TX Mode} will return a space separated list of radio backend
supported TX Modes. Use this to determine the supported TX Modes of a
given radio backend.
See also @command{set_split_freq_mode} below.
@ifhtml
@*
@end ifhtml
@item x, get_split_mode
Get @var{TX Mode}, @var{TX Passband}.
Returns TX mode as a string from @command{set_split_mode} above and TX
passband in Hz.
See also @command{get_split_freq_mode} below.
@ifhtml
@*
@end ifhtml
@item K, set_split_freq_mode @var{Tx Frequency}, @var{TX Mode}, @var{TX Passband}
Set @var{TX Frequency}, in Hertz for ``split'' frequency operation.
Set @var{TX Mode} to one of: @code{AM}, @code{FM}, @code{CW},
@code{CWR}, @code{USB}, @code{LSB}, @code{RTTY}, @code{RTTYR},
@code{WFM}, @code{AMS}, @code{PKTLSB}, @code{PKTUSB}, @code{PKTFM},
@code{ECSSUSB}, @code{ECSSLSB}, @code{FAX}, @code{SAM}, @code{SAL},
@code{SAH}, @code{DSB}.
The @var{TX Passband} is the exact passband frequency in Hertz, or
@code{0} for the Hamlib backend default. A value of @code{-1} may be
passed which leaves the rig passband unchanged from the current or
default value for the mode as defined by the rig.
This is a convenience function that combines the effect of
@command{set_split_freq} and @command{set_split_mode}. It should be
used when both are required since it allows the back end to optimize
the operations. For example on many Icom rigs the current VFO must be
changed temporarily while executing these commands and that can
disrupt receive or transmit, using this function may minimize that
disruption.
See also @command{set_split_freq} and @command{set_split_mode} above.
@ifhtml
@*
@end ifhtml
@item k, get_split_freq_mode
Get @var{TX Frequency}, in Hertz for ``split'' frequency operation
along with The @var{TX Mode} as a string from @command{set_split_mode}
above and @var{TX Passband} in Hz.
This is a convenience function that combines the effect of
@command{get_split_freq} and @command{get_split_mode}. It should be
used when both are required since it allows the back end to optimize
the operations. For example on many Icom rigs the current VFO must be
changed temporarily while executing these commands and that can
disrupt receive or transmit, using this function may minimize that
disruption.
See also @command{get_split_freq} and @command{get_split_mode} above.
@ifhtml
@*
@end ifhtml
@item S, set_split_vfo @var{Split}, @var{TX VFO}
Set @var{Split} mode, @code{0} (off) or @code{1} (on), and @var{TX VFO}
from @command{set_vfo} above.
@ -1000,7 +1068,7 @@ their defaults as described in the
@url{http://cnswww.cns.cwru.edu/php/chet/readline/rluserman.html,
Readline manual} although @command{rigctl} sets the name @code{rigctl}
which can be used in @code{Conditional Init Constructs} in the
Readline Init File (@file{~/.inputrc} by default) for custom
Readline Init File (@file{$HOME/.inputrc} by default) for custom
keybindings unique to @command{rigctl}.
Command history is available with Readline support as described in the
@ -1022,12 +1090,12 @@ This is useful to save a set of commands and then read them later but
not write the modified history for a consistent set of test commands
in interactive mode, for example.
History is stored in @file{~/.rigctl_history} by default although the
destination directory may be changed by setting the
History is stored in @file{$HOME/.rigctl_history} by default although
the destination directory may be changed by setting the
@env{RIGCTL_HIST_DIR} environment variable. When
@env{RIGCTL_HIST_DIR} is unset, the value of the @env{HOME} environment
variable is used instead. Only the destination directory may be
changed at this time.
@env{RIGCTL_HIST_DIR} is unset, the value of the @env{HOME}
environment variable is used instead. Only the destination directory
may be changed at this time.
If Readline support is not found at configure time the original
internal command handler is used. Readline is not used for
@ -1307,26 +1375,26 @@ exit.
@item -i
@itemx --read-history
Read previously saved command and argument history from a file
(default '@file{~/.rotctl_history}') for the current session.
(default '@file{$HOME/.rotctl_history}') for the current session.
Available when @command{rotctl} is built with Readline support.
@strong{N.B.} To read a history file stored in another directory, set
the @env{ROTCTL_HIST_DIR} environment variable, e.g.@:
'@kbd{ROTCTL_HIST_DIR=~/tmp rotctl -i}'. When @env{ROTCTL_HIST_DIR}
'@kbd{ROTCTL_HIST_DIR=$HOME/tmp rotctl -i}'. When @env{ROTCTL_HIST_DIR}
is not set, the value of @env{HOME} is used.
@item -I
@itemx --save-history
Write current session (and previously saved session(s) if @option{-i}
option is also given) command and argument history to a file (default
'@file{~/.rotctl_history}') at the end of the current session.
'@file{$HOME/.rotctl_history}') at the end of the current session.
Complete commands with arguments are saved as a single line to be
recalled and used or edited. Available when @command{rotctl} is built
with Readline support.
To write a history file in another directory, set the
@env{ROTCTL_HIST_DIR} environment variable, e.g.@:
'@kbd{ROTCTL_HIST_DIR=~/tmp rotctl -I}'. When @env{ROTCTL_HIST_DIR}
'@kbd{ROTCTL_HIST_DIR=$HOME/tmp rotctl -I}'. When @env{ROTCTL_HIST_DIR}
is not set, the value of @env{HOME} is used.
@item -v
@ -1532,7 +1600,7 @@ their defaults as described in the
@url{http://cnswww.cns.cwru.edu/php/chet/readline/rluserman.html,
Readline manual} although @command{rotctl} sets the name @code{rotctl}
which can be used in @code{Conditional Init Constructs} in the
Readline Init File (@file{~/.inputrc} by default) for custom
Readline Init File (@file{$HOME/.inputrc} by default) for custom
keybindings unique to @command{rotctl}.
Command history is available with Readline support as described in the
@ -1554,7 +1622,7 @@ This is useful to save a set of commands and then read them later but
not write the modified history for a consistent set of test commands
in interactive mode, for example.
History is stored in @file{~/.rotctl_history} by default although the
History is stored in @file{$HOME/.rotctl_history} by default although the
destination directory may be changed by setting the
@env{ROTCTL_HIST_DIR} environment variable. When
@env{ROTCTL_HIST_DIR} is unset, the value of the @env{HOME} environment
@ -2098,12 +2166,16 @@ Get @var{DCS Sql} code.
@item I, set_split_freq @var{Tx Frequency}
Set @var{TX Frequency}, in Hertz for ``split'' frequency operation.
See also @command{set_split_freq_mode} below.
@ifhtml
@*
@end ifhtml
@item i, get_split_freq
Get @var{TX Frequency}, in Hertz for ``split'' frequency operation.
See also @command{get_split_freq_mode} below.
@ifhtml
@*
@end ifhtml
@ -2116,19 +2188,75 @@ Set @var{TX Mode} to one of: @code{AM}, @code{FM}, @code{CW},
@code{SAH}, @code{DSB}.
The @var{TX Passband} is the exact passband frequency in Hertz, or
@code{0} for the Hamlib backend default.
@code{0} for the Hamlib backend default. A value of @code{-1} may be
passed which leaves the rig passband unchanged from the current or
default value for the mode as defined by the rig.
@strong{N.B.} Passing a @kbd{?} (query) as the first argument instead
of @var{TX Mode} will return a space separated list of radio backend
supported TX Modes. Use this to determine the supported TX Modes of a
given radio backend.
See also @command{set_split_freq_mode} below.
@ifhtml
@*
@end ifhtml
@item x, get_split_mode
Get @var{TX Mode}, @var{TX Passband}.
Returns TX mode as a string from @command{set_split_mode} above and TX
passband in Hz.
See also @command{get_split_freq_mode} below.
@ifhtml
@*
@end ifhtml
@item K, set_split_freq_mode @var{Tx Frequency}, @var{TX Mode}, @var{TX Passband}
Set @var{TX Frequency}, in Hertz for ``split'' frequency operation.
Set @var{TX Mode} to one of: @code{AM}, @code{FM}, @code{CW},
@code{CWR}, @code{USB}, @code{LSB}, @code{RTTY}, @code{RTTYR},
@code{WFM}, @code{AMS}, @code{PKTLSB}, @code{PKTUSB}, @code{PKTFM},
@code{ECSSUSB}, @code{ECSSLSB}, @code{FAX}, @code{SAM}, @code{SAL},
@code{SAH}, @code{DSB}.
The @var{TX Passband} is the exact passband frequency in Hertz, or
@code{0} for the Hamlib backend default. A value of @code{-1} may be
passed which leaves the rig passband unchanged from the current or
default value for the mode as defined by the rig.
This is a convenience function that combines the effect of
@command{set_split_freq} and @command{set_split_mode}. It should be
used when both are required since it allows the back end to optimize
the operations. For example on many Icom rigs the current VFO must be
changed temporarily while executing these commands and that can
disrupt receive or transmit, using this function may minimize that
disruption.
See also @command{set_split_freq} and @command{set_split_mode} above.
@ifhtml
@*
@end ifhtml
@item k, get_split_freq_mode
Get @var{TX Frequency}, in Hertz for ``split'' frequency operation
along with the @var{TX Mode} as a string from @command{set_split_mode}
above and @var{TX Passband} in Hz.
This is a convenience function that combines the effect of
@command{get_split_freq} and @command{get_split_mode}. It should be
used when both are required since it allows the back end to optimize
the operations. For example on many Icom rigs the current VFO must be
changed temporarily while executing these commands and that can
disrupt receive or transmit, using this function may minimize that
disruption.
See also @command{get_split_freq} and @command{get_split_mode} above.
@ifhtml
@*
@end ifhtml
@item S, set_split_vfo @var{Split}, @var{TX VFO}
Set @var{Split} mode, @code{0} (off) or @code{1} (on), and @var{TX VFO}
from @command{set_vfo} above.

Plik diff jest za duży Load Diff

Wyświetl plik

@ -33,6 +33,7 @@
#include "hamlib/rig.h"
#include "serial.h"
#include "parallel.h"
#include "misc.h"
#include "tones.h"
#include "idx_builtin.h"
@ -337,6 +338,8 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
curr->mode = mode;
if (RIG_PASSBAND_NOCHANGE == width) return RIG_OK;
if (width == RIG_PASSBAND_NORMAL)
curr->width = rig_passband_normal(rig, mode);
else
@ -412,10 +415,22 @@ static int dummy_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
static int dummy_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
int status = 0;
ptt_t par_status = RIG_PTT_OFF;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__);
*ptt = priv->ptt;
// sneak a look at the hardware PTT and OR that in with our result
// as if it had keyed us
switch (rig->state.pttport.type.ptt)
{
case RIG_PTT_SERIAL_DTR: ser_get_dtr (&rig->state.pttport, &status); break;
case RIG_PTT_SERIAL_RTS: ser_get_rts (&rig->state.pttport, &status); break;
case RIG_PTT_PARALLEL: par_ptt_get (&rig->state.pttport, &par_status); break;
default: break;
}
*ptt = *ptt || status || RIG_PTT_ON == par_status;
return RIG_OK;
}
@ -613,6 +628,8 @@ static int dummy_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t
rig_strvfo(vfo), rig_strrmode(tx_mode), buf);
curr->tx_mode = tx_mode;
if (RIG_PASSBAND_NOCHANGE == tx_width) return RIG_OK;
curr->tx_width = tx_width;
return RIG_OK;

Wyświetl plik

@ -2,6 +2,7 @@
* Hamlib Rotator backend - Easycom
* Copyright (c) 2001-2003 by Stephane Fillod
* Contributed by Francois Retief <fgretief@sun.ac.za>
* Copyright (c) 2014 by Alexander Schultze <alexschultze@gmail.com>
*
*
* This library is free software; you can redistribute it and/or
@ -51,25 +52,36 @@
static int
easycomm_transaction (ROT *rot, const char *cmdstr, char *data, size_t data_len)
{
struct rot_state *rs;
int retval;
struct rot_state *rs;
int retval;
rs = &rot->state;
retval = write_block(&rs->rotport, cmdstr, strlen(cmdstr));
if (retval != RIG_OK) {
return retval;
}
rig_debug(RIG_DEBUG_TRACE, "%s called: %s\n", __FUNCTION__, cmdstr);
if (data == NULL || data_len <= 0)
return RIG_OK; /* don't want a reply */
if (!rot )
return -RIG_EINVAL;
retval = read_string(&rs->rotport, data, data_len, "\n", 1);
if (retval < 0)
return retval; /* error */
rs = &rot->state;
serial_flush(&rs->rotport);
retval = write_block(&rs->rotport, cmdstr, strlen(cmdstr));
if (retval != RIG_OK) {
goto transaction_quit;
}
/* TODO: Error checking */
if (data == NULL || data_len <= 0)
return RIG_OK; /* don't want a reply */
return RIG_OK;
memset(data,0,data_len);
retval = read_string(&rs->rotport, data, data_len, "\n", 1);
if (retval < 0) {
rig_debug(RIG_DEBUG_TRACE, "%s read_string failed with status %d\n", __FUNCTION__, retval);
goto transaction_quit;
} else {
rig_debug(RIG_DEBUG_TRACE, "%s read_string: %s\n", __FUNCTION__, data);
retval = RIG_OK;
}
transaction_quit:
return retval;
}
/* ************************************************************************* */
@ -102,10 +114,12 @@ easycomm_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
if (retval != RIG_OK) {
rig_debug(RIG_DEBUG_TRACE, "%s got error: %d\n", __FUNCTION__, retval);
return retval;
}
/* Parse parse string to extract AZ,EL values */
rig_debug(RIG_DEBUG_TRACE, "%s got response: %s\n", __FUNCTION__, ackbuf);
retval = sscanf(ackbuf, "AZ%f EL%f", az, el);
if (retval != 2) {
rig_debug(RIG_DEBUG_ERR, "%s: unknown response (%s)\n", __FUNCTION__, ackbuf);
@ -166,7 +180,7 @@ easycomm_rot_move(ROT *rot, int direction, int speed)
int retval;
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__);
/* Note: speed is unused at the moment */
/* For EasyComm 1/2/3 */
switch (direction) {
case ROT_MOVE_UP: /* Elevation increase */
sprintf(cmdstr, "MU\n");
@ -192,6 +206,153 @@ easycomm_rot_move(ROT *rot, int direction, int speed)
return RIG_OK;
}
static int
easycomm_rot_move_velocity(ROT *rot, int direction, int speed)
{
char cmdstr[24], ackbuf[32];
int retval;
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__);
if(speed<0 && speed>9999)
rig_debug(RIG_DEBUG_ERR,"%s: Invalid speed value!(0-9999) (%d)\n", __FUNCTION__, speed);
return -RIG_EINVAL;
/* Speed for EasyComm 3 */
switch (direction) {
case ROT_MOVE_UP: /* Elevation increase */
sprintf(cmdstr, "VU%04d\n", speed);
break;
case ROT_MOVE_DOWN: /* Elevation decrease */
sprintf(cmdstr, "VD%04d\n", speed);
break;
case ROT_MOVE_LEFT: /* Azimuth decrease */
sprintf(cmdstr, "VL%04d\n", speed);
break;
case ROT_MOVE_RIGHT: /* Azimuth increase */
sprintf(cmdstr, "VR%04d\n", speed);
break;
default:
rig_debug(RIG_DEBUG_ERR,"%s: Invalid direction value! (%d)\n", __FUNCTION__, direction);
return -RIG_EINVAL;
}
retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
if (retval != RIG_OK)
return retval;
return RIG_OK;
}
/*
* Get Info
* returns the model name string
*/
static const char * easycomm_rot_get_info(ROT *rot)
{
const struct rot_caps *rc;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
return (const char *)-RIG_EINVAL;
rc = rot->caps;
return rc->model_name;
}
/*
* Receive status / configuration / output
*
* For configuration registers, *val must contain string of register e.g. '0'-'f'
*/
static int easycomm_rot_get_conf(ROT *rot, token_t token, char *val) {
char cmdstr[16], ackbuf[32];
int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: token = %d", __func__, token);
if (!rot)
return -RIG_EINVAL;
switch(token) {
case TOK_GET_STATUS:
sprintf(cmdstr, "GS\n;");
break;
case TOK_GET_ERRORS:
sprintf(cmdstr, "GE\n;");
break;
case TOK_GET_INPUT:
sprintf(cmdstr, "IP\n;");
break;
case TOK_GET_ANALOG_INPUT:
sprintf(cmdstr, "AN\n;");
break;
case TOK_GET_VERSION:
sprintf(cmdstr, "VE\n;");
break;
case TOK_GET_CONFIG:
sprintf(cmdstr, "CR %c\n;",*val);
break;
default:
return -RIG_EINVAL;
}
rig_debug(RIG_DEBUG_TRACE, "%s: cmdstr = %s, *val = %c\n", __func__, cmdstr, *val);
retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
if (retval != RIG_OK) {
rig_debug(RIG_DEBUG_TRACE, "%s got error: %d\n", __FUNCTION__, retval);
return retval;
}
rig_debug(RIG_DEBUG_TRACE, "%s got response: %s\n", __FUNCTION__, ackbuf);
/* Return given string at correct position*/
val = &ackbuf[2]; /* CCxxxxxx */
return RIG_OK;
}
/*
* Set configuration
*
* For configuration registers, *val must contain char of register e.g. '0'-'f' followed by setting
* e.g. x,yyyyy
*/
static int easycomm_rot_set_conf(ROT *rot, token_t token, const char *val) {
char cmdstr[16], ackbuf[32];
int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: token = %d", __func__, token);
if (!rot)
return -RIG_EINVAL;
switch(token) {
case TOK_SET_CONFIG:
sprintf(cmdstr, "CW%s\n;",val);
break;
default:
return -RIG_EINVAL;
}
rig_debug(RIG_DEBUG_TRACE, "%s: cmdstr = %s, *val = %c\n", __func__, cmdstr, *val);
retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
if (retval != RIG_OK) {
rig_debug(RIG_DEBUG_TRACE, "%s got error: %d\n", __FUNCTION__, retval);
return retval;
}
return RIG_OK;
}
/* ************************************************************************* */
/*
* Easycomm rotator capabilities.
@ -205,7 +366,7 @@ const struct rot_caps easycomm1_rot_caps = {
.rot_model = ROT_MODEL_EASYCOMM1,
.model_name = "EasycommI",
.mfg_name = "Hamlib",
.version = "0.3",
.version = "0.4",
.copyright = "LGPL",
.status = RIG_STATUS_BETA,
.rot_type = ROT_TYPE_OTHER,
@ -230,6 +391,7 @@ const struct rot_caps easycomm1_rot_caps = {
.set_position = easycomm_rot_set_position,
.stop = easycomm_rot_stop,
.get_info = easycomm_rot_get_info,
};
/* EasycommII implement most of the functions. Again the radio tags
@ -239,7 +401,7 @@ const struct rot_caps easycomm2_rot_caps = {
.rot_model = ROT_MODEL_EASYCOMM2,
.model_name = "EasycommII",
.mfg_name = "Hamlib",
.version = "0.3",
.version = "0.4",
.copyright = "LGPL",
.status = RIG_STATUS_BETA,
.rot_type = ROT_TYPE_OTHER,
@ -273,8 +435,54 @@ const struct rot_caps easycomm2_rot_caps = {
.park = easycomm_rot_park,
.reset = easycomm_rot_reset,
.move = easycomm_rot_move,
.set_conf = easycomm_rot_set_conf,
.get_conf = easycomm_rot_get_conf,
.get_info = easycomm_rot_get_info,
};
.get_info = NULL,
/* EasycommIII provides changes Moving functions and info.
*/
const struct rot_caps easycomm3_rot_caps = {
.rot_model = ROT_MODEL_EASYCOMM3,
.model_name = "EasycommIII",
.mfg_name = "Hamlib",
.version = "0.4",
.copyright = "LGPL",
.status = RIG_STATUS_ALPHA,
.rot_type = ROT_TYPE_OTHER,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 9600,
.serial_rate_max = 19200,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.retry = 3,
.min_az = 0.0,
.max_az = 360.0,
.min_el = 0.0,
.max_el = 180.0,
.priv = NULL, /* priv */
.rot_init = NULL,
.rot_cleanup = NULL,
.rot_open = NULL,
.rot_close = NULL,
.get_position = easycomm_rot_get_position,
.set_position = easycomm_rot_set_position,
.stop = easycomm_rot_stop,
.park = easycomm_rot_park,
.reset = easycomm_rot_reset,
.move = easycomm_rot_move_velocity,
.set_conf = easycomm_rot_set_conf,
.get_conf = easycomm_rot_get_conf,
.get_info = easycomm_rot_get_info,
};
/* ************************************************************************* */
@ -285,7 +493,7 @@ DECLARE_INITROT_BACKEND(easycomm)
rot_register(&easycomm1_rot_caps);
rot_register(&easycomm2_rot_caps);
rot_register(&easycomm3_rot_caps);
return RIG_OK;
}

Wyświetl plik

@ -2,6 +2,7 @@
* Hamlib Rotator backend - Easycomm interface protocol
* Copyright (c) 2001-2003 by Stephane Fillod
* Contributed by Francois Retief <fgretief@sun.ac.za>
* Copyright (c) 2014 by Alexander Schultze <alexschultze@gmail.com>
*
*
* This library is free software; you can redistribute it and/or
@ -23,7 +24,25 @@
#ifndef _ROT_EASYCOMM_H
#define _ROT_EASYCOMM_H 1
#include "token.h"
extern const struct rot_caps easycomm1_rot_caps;
extern const struct rot_caps easycomm2_rot_caps;
extern const struct rot_caps easycomm3_rot_caps;
/*
* Tokens used by rotorez_rot_set_conf and get_conf and the 'C' command in rotctl
* and rotctld.
*/
#define TOK_GET_CONFIG TOKEN_BACKEND(1)
#define TOK_SET_CONFIG TOKEN_BACKEND(2)
#define TOK_GET_STATUS TOKEN_BACKEND(3)
#define TOK_GET_ERRORS TOKEN_BACKEND(4)
#define TOK_GET_VERSION TOKEN_BACKEND(5)
#define TOK_GET_INPUT TOKEN_BACKEND(6)
#define TOK_SET_OUTPUT TOKEN_BACKEND(7)
#define TOK_GET_ANALOG_INPUT TOKEN_BACKEND(8)
#endif /* _ROT_EASYCOMM_H */

Wyświetl plik

@ -1,6 +1,5 @@
The following are the specifications for the EasyComm interfaces which
are available with the WiSP programs. Both EasyComm 1 and EasyComm2 are
available in WiSP32. Only EasyComm1 is available with WiSP31. The EasyComm
are available with the WiSP programs. The EasyComm
interfaces are for use by those who wish to design their own radio and rotor
controllers.
@ -38,8 +37,8 @@ The Host PC can issue the following commands -:
Command Meaning Perameters
------- ------- ----------
AZ Azimuth number - 1 decimal place
EL Elevation number - 1 decimal place
AZ Azimuth number - 1 decimal place [deg]
EL Elevation number - 1 decimal place [deg]
UP Uplink freq in Hertz
DN Downlink freq in Hertz
DM Downlink Mode ascii, eg SSB, FM
@ -83,3 +82,53 @@ ALxxx Alarm, where xxxx is an ascii string with the alarm info.
Chris Jackson, G7UPN
EASYCOMM III Standard
--------------------
The EasyComm 3 standard is an extension of the version 2 with the additional features:
Command Meaning Perameters Hamlib Config Token
------- ------- ---------- -------------------
VL Velocity Left number [mdeg/s]
VR Velocity Right number [mdeg/s]
VU Velocity Up number [mdeg/s]
VD Velocity Down number [mdeg/s]
CR Read config register [0-x] 1
CW Write config register [0-x] 2
GS Get status register 3
GE Get error register 4
VE Request Version 5
IP Read an input number 6
OP Set output number 7
AN Read analogue input number 8
>Several status and error bits can combined. Proposed mapping:
Status Meaning
------- -------
1 Idle
2 Moving
4 Pointing
8 Error
Error Meaning
------- -------
1 Sensor Error
2 Jam
4 Homing Error
>Proposed mapping of configuration registers:
Register Meaning Value
------- ------- ----------
0 MaxSpeed number
a Overshoot 0/1/-
b Jamming 0/1/-
c Endpoints 0/1/-
d Unstick 0/1/-
73, Alexander Schultze

Wyświetl plik

@ -662,6 +662,16 @@ int dttsp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int ret = RIG_OK;
int filter_l, filter_h;
/* DttSP set mode */
buf_len = sprintf (buf, "setMode %d\n", rmode2dttsp(mode) );
ret = send_command (rig, buf, buf_len);
rig_debug(RIG_DEBUG_VERBOSE,"%s: %s\n",
__FUNCTION__, buf);
if (ret != RIG_OK || RIG_PASSBAND_NOCHANGE == width) return ret;
if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode);
sprintf_freq(buf, width);
@ -692,11 +702,6 @@ int dttsp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL;
}
/* DttSP set mode */
buf_len = sprintf (buf, "setMode %d\n", rmode2dttsp(mode) );
ret = send_command (rig, buf, buf_len);
buf_len = sprintf (buf, "setFilter %d %d\n", filter_l, filter_h );
ret = send_command (rig, buf, buf_len);

Wyświetl plik

@ -582,7 +582,8 @@ int gr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %s %s\n",
__FUNCTION__, rig_strvfo(vfo), rig_strrmode(mode), buf);
if (mode == chan->mode && width == chan->width)
if (mode == chan->mode
&& (RIG_PASSBAND_NOCHANGE == width || width == chan->width))
return RIG_OK;
@ -605,7 +606,8 @@ int gr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
pthread_mutex_lock(&priv->mutex_process);
/* Same mode, but different width */
if (mode != RIG_MODE_NONE && mode == chan->mode) {
if (width != RIG_PASSBAND_NOCHANGE
&& mode != RIG_MODE_NONE && mode == chan->mode) {
mod->setWidth(width);
chan->width = width;
pthread_mutex_unlock(&priv->mutex_process);
@ -626,14 +628,16 @@ int gr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (mode == RIG_MODE_NONE) {
/* ez */
chan->mode = mode;
chan->width = width;
chan->mode = mode;
if (width != RIG_PASSBAND_NOCHANGE) chan->width = width;
pthread_mutex_unlock(&priv->mutex_process);
return RIG_OK;
}
float rf_gain = chan->levels[rig_setting2idx(RIG_LEVEL_RF)].f;
if (RIG_PASSBAND_NOCHANGE == width) width = chan->width;
switch(mode) {
case RIG_MODE_LSB:
mod = new LSBDemodChainCF(priv->source, priv->sink, mode, width, priv->input_rate, (freq_t)freq_offset);

Wyświetl plik

@ -10,4 +10,4 @@ Version: @PACKAGE_VERSION@
Requires.private: @LIBUSB@
Cflags: -I${includedir} @PTHREAD_CFLAGS@
Libs: -L${libdir} -lhamlib
Libs.private: @MATH_LIBS@ @DL_LIBS@ @PTHREAD_LIBS@
Libs.private: @MATH_LIBS@ @DL_LIBS@ @NET_LIBS@ @PTHREAD_LIBS@

Wyświetl plik

@ -0,0 +1,13 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := icm700pro.c icm710.c icm802.c \
icmarine.c
LOCAL_MODULE := icmarine
LOCAL_CFLAGS := -DHAVE_CONFIG_H
LOCAL_C_INCLUDES := android include src
LOCAL_LDLIBS := -lhamlib -Lobj/local/armeabi
include $(BUILD_STATIC_LIBRARY)

Wyświetl plik

@ -0,0 +1,8 @@
#icm802.c
ICMARINESRC = icm700pro.c icm710.c icm802.c \
icmarine.c icmarine.h
noinst_LTLIBRARIES = libhamlib-icmarine.la
libhamlib_icmarine_la_SOURCES = $(ICMARINESRC)
EXTRA_DIST = Android.mk

Wyświetl plik

@ -0,0 +1,178 @@
/*
* Hamlib ICOM Marine backend - description of IC-M700PRO caps
* Copyright (c) 2014-2015 by Stephane Fillod
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include "hamlib/rig.h"
#include "icmarine.h"
#include "idx_builtin.h"
#include "bandplan.h"
#define ICM700PRO_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY)
#define ICM700PRO_RX_MODES (ICM700PRO_MODES|RIG_MODE_AM)
#define ICM700PRO_FUNC_ALL (RIG_FUNC_NB)
#define ICM700PRO_LEVEL_ALL (RIG_LEVEL_RFPOWER|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_AGC|RIG_LEVEL_RAWSTR)
#define ICM700PRO_VFO_ALL (RIG_VFO_A)
#define ICM700PRO_VFO_OPS (RIG_OP_TUNE)
#define ICM700PRO_SCAN_OPS (RIG_SCAN_NONE)
/*
* TODO calibrate the real values
*/
#define ICM700PRO_STR_CAL { 2, {{ 0, -60}, { 8, 60}} }
static const struct icmarine_priv_caps icm700pro_priv_caps = {
.default_remote_id = 2,
};
const struct rig_caps icm700pro_caps = {
.rig_model = RIG_MODEL_IC_M700PRO,
.model_name = "IC-M700PRO",
.mfg_name = "Icom",
.version = BACKEND_VER,
.copyright = "LGPL",
.status = RIG_STATUS_ALPHA,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 4800,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 500,
.retry = 0,
.has_get_func = ICM700PRO_FUNC_ALL,
.has_set_func = ICM700PRO_FUNC_ALL,
.has_get_level = ICM700PRO_LEVEL_ALL,
.has_set_level = RIG_LEVEL_SET(ICM700PRO_LEVEL_ALL),
.has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE,
.level_gran = {
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 8 } },
},
.parm_gran = {},
.str_cal = ICM700PRO_STR_CAL,
.ctcss_list = NULL,
.dcs_list = NULL,
.preamp = { RIG_DBLST_END, },
.attenuator = { RIG_DBLST_END, },
.max_rit = Hz(150),
.max_xit = Hz(0),
.max_ifshift = Hz(0),
.targetable_vfo = 0,
.vfo_ops = ICM700PRO_VFO_OPS,
.scan_ops = ICM700PRO_SCAN_OPS,
.transceive = RIG_TRN_OFF,
.bank_qty = 3,
.chan_desc_sz = 0,
.chan_list = {
RIG_CHAN_END,
},
.rx_range_list1 = { {kHz(500),MHz(30)-100,ICM700PRO_RX_MODES,-1,-1,ICM700PRO_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list1 = {
{kHz(1600),MHz(3)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(4), MHz(5)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(6), MHz(7)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(8), MHz(9)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(12), MHz(14)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(16), MHz(18)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(18), MHz(20)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(22), MHz(23)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(25), MHz(27.500),ICM700PRO_MODES,W( 60),W( 60),ICM700PRO_VFO_ALL,RIG_ANT_1},
RIG_FRNG_END,
},
.rx_range_list2 = { {kHz(500),MHz(30)-100,ICM700PRO_RX_MODES,-1,-1,ICM700PRO_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list2 = {
{kHz(1600),MHz(3)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(4), MHz(5)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(6), MHz(7)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(8), MHz(9)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(12), MHz(14)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(16), MHz(18)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(18), MHz(20)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(22), MHz(23)-100,ICM700PRO_MODES,W(150),W(150),ICM700PRO_VFO_ALL,RIG_ANT_1},
{MHz(25), MHz(27.500),ICM700PRO_MODES,W( 60),W( 60),ICM700PRO_VFO_ALL,RIG_ANT_1},
RIG_FRNG_END,
},
.tuning_steps = {
{ICM700PRO_RX_MODES,Hz(100)},
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.3)},
{RIG_MODE_AM, kHz(14)},
RIG_FLT_END,
},
.cfgparams = icmarine_cfg_params,
.set_conf = icmarine_set_conf,
.get_conf = icmarine_get_conf,
.priv = (void*)&icm700pro_priv_caps,
.rig_init = icmarine_init,
.rig_cleanup = icmarine_cleanup,
.rig_open = NULL,
.rig_close = NULL,
.set_freq = icmarine_set_freq,
.get_freq = icmarine_get_freq,
.set_split_freq = icmarine_set_tx_freq,
.get_split_freq = icmarine_get_tx_freq,
.set_split_vfo = icmarine_set_split_vfo,
.get_split_vfo = icmarine_get_split_vfo,
.set_mode = icmarine_set_mode,
.get_mode = icmarine_get_mode,
.set_ptt = icmarine_set_ptt,
.get_ptt = icmarine_get_ptt,
.get_dcd = icmarine_get_dcd,
.vfo_op = icmarine_vfo_op,
.set_level = icmarine_set_level,
.get_level = icmarine_get_level,
.set_func = icmarine_set_func,
.get_func = icmarine_get_func,
};

179
icmarine/icm710.c 100644
Wyświetl plik

@ -0,0 +1,179 @@
/*
* Hamlib ICOM Marine backend - description of IC-M710 caps
* Copyright (c) 2015 by Stephane Fillod
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include "hamlib/rig.h"
#include "icmarine.h"
#include "idx_builtin.h"
#include "bandplan.h"
#define ICM710_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY)
#define ICM710_RX_MODES (ICM710_MODES|RIG_MODE_AM)
#define ICM710_FUNC_ALL (RIG_FUNC_NB)
#define ICM710_LEVEL_ALL (RIG_LEVEL_RFPOWER|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_AGC|RIG_LEVEL_RAWSTR)
#define ICM710_VFO_ALL (RIG_VFO_A)
#define ICM710_VFO_OPS (RIG_OP_TUNE)
#define ICM710_SCAN_OPS (RIG_SCAN_NONE)
/*
* TODO calibrate the real values
*/
#define ICM710_STR_CAL { 2, {{ 0, -60}, { 8, 60}} }
static const struct icmarine_priv_caps icm710_priv_caps = {
.default_remote_id = 0x01, /* default address */
};
const struct rig_caps icm710_caps = {
.rig_model = RIG_MODEL_IC_M710,
.model_name = "IC-M710",
.mfg_name = "Icom",
.version = BACKEND_VER,
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 4800,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 500,
.retry = 0,
.has_get_func = ICM710_FUNC_ALL,
.has_set_func = ICM710_FUNC_ALL,
.has_get_level = ICM710_LEVEL_ALL,
.has_set_level = RIG_LEVEL_SET(ICM710_LEVEL_ALL),
.has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE,
.level_gran = {
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 8 } },
},
.parm_gran = {},
.str_cal = ICM710_STR_CAL,
.ctcss_list = NULL,
.dcs_list = NULL,
.preamp = { RIG_DBLST_END, },
.attenuator = { RIG_DBLST_END, },
.max_rit = Hz(0),
.max_xit = Hz(0),
.max_ifshift = Hz(0),
.targetable_vfo = 0,
.vfo_ops = ICM710_VFO_OPS,
.scan_ops = ICM710_SCAN_OPS,
.transceive = RIG_TRN_OFF,
.bank_qty = 0,
.chan_desc_sz = 0,
.chan_list = {
RIG_CHAN_END,
},
.rx_range_list1 = { {kHz(500),MHz(30)-100,ICM710_RX_MODES,-1,-1,ICM710_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list1 = {
{kHz(1600),MHz(3)-100,ICM710_MODES,W(60),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(4), MHz(5)-100,ICM710_MODES,W(60),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(6), MHz(7)-100,ICM710_MODES,W(60),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(8), MHz(9)-100,ICM710_MODES,W(60),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(12), MHz(14)-100,ICM710_MODES,W(60),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(16), MHz(18)-100,ICM710_MODES,W(60),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(18), MHz(20)-100,ICM710_MODES,W(60),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(22), MHz(23)-100,ICM710_MODES,W(60),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(25), MHz(27.500),ICM710_MODES,W(60),W( 60),ICM710_VFO_ALL,RIG_ANT_1},
RIG_FRNG_END,
},
.rx_range_list2 = { {kHz(500),MHz(30)-100,ICM710_RX_MODES,-1,-1,ICM710_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list2 = {
{kHz(1600),MHz(3)-100,ICM710_MODES,W(20),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(4), MHz(5)-100,ICM710_MODES,W(20),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(6), MHz(7)-100,ICM710_MODES,W(20),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(8), MHz(9)-100,ICM710_MODES,W(20),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(12), MHz(14)-100,ICM710_MODES,W(20),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(16), MHz(18)-100,ICM710_MODES,W(20),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(18), MHz(20)-100,ICM710_MODES,W(20),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(22), MHz(23)-100,ICM710_MODES,W(20),W(150),ICM710_VFO_ALL,RIG_ANT_1},
{MHz(25), MHz(27.500),ICM710_MODES,W(20),W( 60),ICM710_VFO_ALL,RIG_ANT_1},
RIG_FRNG_END,
},
.tuning_steps = {
{ICM710_RX_MODES,Hz(1)},
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.3)},
{RIG_MODE_AM, kHz(14)},
RIG_FLT_END,
},
.cfgparams = icmarine_cfg_params,
.set_conf = icmarine_set_conf,
.get_conf = icmarine_get_conf,
.priv = (void*)&icm710_priv_caps,
.rig_init = icmarine_init,
.rig_cleanup = icmarine_cleanup,
.rig_open = NULL,
.rig_close = NULL,
.set_freq = icmarine_set_freq,
.get_freq = icmarine_get_freq,
.set_split_freq = icmarine_set_tx_freq,
.get_split_freq = icmarine_get_tx_freq,
.set_split_vfo = icmarine_set_split_vfo,
.get_split_vfo = icmarine_get_split_vfo,
.set_mode = icmarine_set_mode,
.get_mode = icmarine_get_mode,
.set_ptt = icmarine_set_ptt,
.get_ptt = icmarine_get_ptt,
.get_dcd = icmarine_get_dcd,
.vfo_op = icmarine_vfo_op,
.set_level = icmarine_set_level,
.get_level = icmarine_get_level,
.set_func = icmarine_set_func,
.get_func = icmarine_get_func,
};

179
icmarine/icm802.c 100644
Wyświetl plik

@ -0,0 +1,179 @@
/*
* Hamlib ICOM Marine backend - description of IC-M802 caps
* Copyright (c) 2014-2015 by Stephane Fillod
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include "hamlib/rig.h"
#include "icmarine.h"
#include "idx_builtin.h"
#include "bandplan.h"
#define ICM802_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY)
#define ICM802_RX_MODES (ICM802_MODES|RIG_MODE_AM)
#define ICM802_FUNC_ALL (RIG_FUNC_NB)
#define ICM802_LEVEL_ALL (RIG_LEVEL_RFPOWER|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_AGC|RIG_LEVEL_RAWSTR)
#define ICM802_VFO_ALL (RIG_VFO_A)
#define ICM802_VFO_OPS (RIG_OP_TUNE)
#define ICM802_SCAN_OPS (RIG_SCAN_NONE)
/*
* TODO calibrate the real values
*/
#define ICM802_STR_CAL { 2, {{ 0, -60}, { 8, 60}} }
static const struct icmarine_priv_caps icm802_priv_caps = {
.default_remote_id = 0x08, /* default address */
};
const struct rig_caps icm802_caps = {
.rig_model = RIG_MODEL_IC_M802,
.model_name = "IC-M802",
.mfg_name = "Icom",
.version = BACKEND_VER,
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 4800,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 500,
.retry = 0,
.has_get_func = ICM802_FUNC_ALL,
.has_set_func = ICM802_FUNC_ALL,
.has_get_level = ICM802_LEVEL_ALL,
.has_set_level = RIG_LEVEL_SET(ICM802_LEVEL_ALL),
.has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE,
.level_gran = {
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 8 } },
},
.parm_gran = {},
.str_cal = ICM802_STR_CAL,
.ctcss_list = NULL,
.dcs_list = NULL,
.preamp = { RIG_DBLST_END, },
.attenuator = { RIG_DBLST_END, },
.max_rit = Hz(0),
.max_xit = Hz(0),
.max_ifshift = Hz(0),
.targetable_vfo = 0,
.vfo_ops = ICM802_VFO_OPS,
.scan_ops = ICM802_SCAN_OPS,
.transceive = RIG_TRN_OFF,
.bank_qty = 0,
.chan_desc_sz = 0,
.chan_list = {
RIG_CHAN_END,
},
.rx_range_list1 = { {kHz(500),MHz(30)-100,ICM802_RX_MODES,-1,-1,ICM802_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list1 = {
{kHz(1600),MHz(3)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(4), MHz(5)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(6), MHz(7)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(8), MHz(9)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(12), MHz(14)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(16), MHz(18)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(18), MHz(20)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(22), MHz(23)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(25), MHz(27.500),ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
RIG_FRNG_END,
},
.rx_range_list2 = { {kHz(500),MHz(30)-100,ICM802_RX_MODES,-1,-1,ICM802_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list2 = {
{kHz(1600),MHz(3)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(4), MHz(5)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(6), MHz(7)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(8), MHz(9)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(12), MHz(14)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(16), MHz(18)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(18), MHz(20)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(22), MHz(23)-100,ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
{MHz(25), MHz(27.500),ICM802_MODES,W(20),W(150),ICM802_VFO_ALL,RIG_ANT_1},
RIG_FRNG_END,
},
.tuning_steps = {
{ICM802_RX_MODES,Hz(1)},
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.3)},
{RIG_MODE_AM, kHz(14)},
RIG_FLT_END,
},
.cfgparams = icmarine_cfg_params,
.set_conf = icmarine_set_conf,
.get_conf = icmarine_get_conf,
.priv = (void*)&icm802_priv_caps,
.rig_init = icmarine_init,
.rig_cleanup = icmarine_cleanup,
.rig_open = NULL,
.rig_close = NULL,
.set_freq = icmarine_set_freq,
.get_freq = icmarine_get_freq,
.set_split_freq = icmarine_set_tx_freq,
.get_split_freq = icmarine_get_tx_freq,
.set_split_vfo = icmarine_set_split_vfo,
.get_split_vfo = icmarine_get_split_vfo,
.set_mode = icmarine_set_mode,
.get_mode = icmarine_get_mode,
.set_ptt = icmarine_set_ptt,
.get_ptt = icmarine_get_ptt,
.get_dcd = icmarine_get_dcd,
.vfo_op = icmarine_vfo_op,
.set_level = icmarine_set_level,
.get_level = icmarine_get_level,
.set_func = icmarine_set_func,
.get_func = icmarine_get_func,
};

626
icmarine/icmarine.c 100644
Wyświetl plik

@ -0,0 +1,626 @@
/*
* Hamlib ICOM Marine backend - main file
* Copyright (c) 2014-2015 by Stephane Fillod
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <math.h>
#include <hamlib/rig.h>
#include <serial.h>
#include <misc.h>
#include <cal.h>
#include <token.h>
#include <register.h>
#include "icmarine.h"
/*
* NMEA 0183 protocol
*
* Total message is maximum 82 characters, including '$' and CR+LF.
*
* Serial setup is 8N1, msb always 0, -> ASCII protocol
*
* Proprietary Extension Message format:
* Byte pos Length Value Description
* 0 1 0x24 '$' Start character
* 1 1 0x50 'P' Type: Proprietary
* 2 3 'ICO' Manufacturer ID
* 5 Message Data
*/
/* CR LF */
#define EOM "\x0d\x0a"
#define LF "\x0a"
#define BUFSZ 96
#define OFFSET_CMD 13
/*
* Protocol stuff
*/
#define CONTROLLER_ID 90
#if 0
#define MD_LSB "J3E"
#define MD_USB "J3E"
#define MD_CW "A1A"
#define MD_AM "A3E"
#else
#define MD_LSB "LSB"
#define MD_USB "USB"
#define MD_CW "CW"
#define MD_AM "AM"
#endif
#define MD_FSK "J2B"
#define CMD_TXFREQ "TXF" /* Transmit frequency */
#define CMD_RXFREQ "RXF" /* Receive frequency */
#define CMD_MODE "MODE" /* Mode */
#define CMD_REMOTE "REMOTE" /* Remote */
#define CMD_PTT "TRX" /* PTT */
#define CMD_AFGAIN "AFG"
#define CMD_RFGAIN "RFG"
#define CMD_RFPWR "TXP"
#define CMD_NB "NB"
#define CMD_AGC "AGC"
#define CMD_TUNER "TUNER"
/* Data Output Commands */
#define CMD_SMETER "SIGM" /* S-meter read */
#define CMD_SQLS "SQLS" /* Squelch status */
/* Tokens */
#define TOK_REMOTEID TOKEN_BACKEND(1)
const struct confparams icmarine_cfg_params[] = {
{ TOK_REMOTEID, "remoteid", "Remote ID", "Transceiver's remote ID",
"1", RIG_CONF_NUMERIC, { .n = { 1, 99, 1 } }
},
{ RIG_CONF_END, NULL, }
};
/*
* Basically, set up *priv
*/
int icmarine_init(RIG *rig)
{
struct icmarine_priv_data *priv;
const struct icmarine_priv_caps *priv_caps;
const struct rig_caps *caps;
if (!rig || !rig->caps)
return -RIG_EINVAL;
caps = rig->caps;
if (!caps->priv)
return -RIG_ECONF;
priv_caps = (const struct icmarine_priv_caps *) caps->priv;
priv = (struct icmarine_priv_data*)malloc(sizeof(struct icmarine_priv_data));
if (!priv) {
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
rig->state.priv = (void*)priv;
priv->remote_id = priv_caps->default_remote_id;
priv->split = RIG_SPLIT_OFF;
return RIG_OK;
}
int icmarine_cleanup(RIG *rig)
{
if (!rig)
return -RIG_EINVAL;
if (rig->state.priv)
free(rig->state.priv);
rig->state.priv = NULL;
return RIG_OK;
}
int icmarine_set_conf(RIG *rig, token_t token, const char *val)
{
struct icmarine_priv_data *priv;
priv = (struct icmarine_priv_data*)rig->state.priv;
switch(token) {
case TOK_REMOTEID:
priv->remote_id = atoi(val);
break;
default:
return -RIG_EINVAL;
}
return RIG_OK;
}
int icmarine_get_conf(RIG *rig, token_t token, char *val)
{
struct icmarine_priv_data *priv;
priv = (struct icmarine_priv_data*)rig->state.priv;
switch(token) {
case TOK_REMOTEID:
sprintf(val, "%u", priv->remote_id);
break;
default:
return -RIG_EINVAL;
}
return RIG_OK;
}
/*
* icmarine_transaction
* We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL
*
* cmd: mandatory
* param: only 1 optional NMEA paramter, NULL for none (=query)
* response: optional (holding BUFSZ bytes)
*/
int icmarine_transaction(RIG *rig, const char *cmd, const char *param, char *response)
{
struct icmarine_priv_data *priv;
int i, retval;
struct rig_state *rs;
char cmdbuf[BUFSZ+1];
char respbuf[BUFSZ+1];
char *p;
int cmd_len = 0;
unsigned csum = 0;
rs = &rig->state;
priv = (struct icmarine_priv_data *)rs->priv;
serial_flush(&rs->rigport);
/* command formating */
cmdbuf[BUFSZ]='\0';
cmd_len = snprintf(cmdbuf, BUFSZ, "$PICOA,%02u,%02u,%s",
CONTROLLER_ID,
priv->remote_id,
cmd);
if (param)
cmd_len += snprintf(cmdbuf+cmd_len, BUFSZ-cmd_len, ",%s", param);
/* NMEA checksum, betwwen '$' and '*' */
for (i=1; i<cmd_len; i++)
csum = csum ^ (unsigned)cmdbuf[i];
cmd_len += snprintf(cmdbuf+cmd_len, BUFSZ-cmd_len, "*%02X" EOM, csum);
/* I/O */
retval = write_block(&rs->rigport, cmdbuf, cmd_len);
if (retval != RIG_OK)
return retval;
/*
* Transceiver sends an echo of cmd followed by a CR/LF
*/
retval = read_string(&rs->rigport, respbuf, BUFSZ, LF, strlen(LF));
if (retval < 0)
return retval;
/* Minimal length */
if (retval < OFFSET_CMD+5)
return -RIG_EPROTO;
respbuf[retval] = 0;
/* check response */
if (memcmp(respbuf, "$PICOA,", strlen("$PICOA,")))
return -RIG_EPROTO;
/* TODO: check ID's */
/* if not a query, check for correct as acknowledge */
if (param) {
if (memcmp(cmdbuf+OFFSET_CMD, respbuf+OFFSET_CMD, cmd_len-OFFSET_CMD-5) == 0)
return RIG_OK;
else
return -RIG_ERJCTED;
}
/* So this is a query */
/* strip *checksum and CR/LF from string */
respbuf[retval-5] = 0;
p = strchr(respbuf+OFFSET_CMD, ',');
if (p)
strncpy(response, p+1, BUFSZ);
else
return -RIG_EPROTO;
return RIG_OK;
}
int icmarine_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
char freqbuf[BUFSZ];
struct icmarine_priv_data *priv;
priv = (struct icmarine_priv_data*)rig->state.priv;
sprintf(freqbuf, "%.6f", freq/MHz(1));
/* no error reporting upon TXFREQ failure */
if (RIG_SPLIT_OFF == priv->split)
icmarine_transaction (rig, CMD_TXFREQ, freqbuf, NULL);
return icmarine_transaction (rig, CMD_RXFREQ, freqbuf, NULL);
}
/*
* icmarine_get_freq
* Assumes rig!=NULL, freq!=NULL
*/
int icmarine_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
int retval;
char freqbuf[BUFSZ] = "";
double d;
retval = icmarine_transaction (rig, CMD_RXFREQ, NULL, freqbuf);
if (retval != RIG_OK)
return retval;
if (freqbuf[0] == '\0') {
*freq = 0;
} else {
if (sscanf(freqbuf, "%lf", &d) != 1)
return -RIG_EPROTO;
*freq = (freq_t)(d*MHz(1));
}
return RIG_OK;
}
int icmarine_set_tx_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
char freqbuf[BUFSZ];
sprintf(freqbuf, "%.6f", freq/MHz(1));
return icmarine_transaction (rig, CMD_TXFREQ, freqbuf, NULL);
}
int icmarine_get_tx_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
int retval;
char freqbuf[BUFSZ] = "";
double d;
retval = icmarine_transaction (rig, CMD_TXFREQ, NULL, freqbuf);
if (retval != RIG_OK)
return retval;
if (freqbuf[0] == '\0') {
*freq = 0;
} else {
if (sscanf(freqbuf, "%lf", &d) != 1)
return -RIG_EPROTO;
*freq = (freq_t)(d*MHz(1));
}
return RIG_OK;
}
int icmarine_set_split_vfo(RIG *rig, vfo_t rx_vfo, split_t split, vfo_t tx_vfo)
{
struct icmarine_priv_data *priv;
priv = (struct icmarine_priv_data *)rig->state.priv;
/* when disabling split mode */
if (RIG_SPLIT_ON == priv->split &&
RIG_SPLIT_OFF == split)
{
freq_t freq;
if (RIG_OK == icmarine_get_freq(rig, rx_vfo, &freq))
icmarine_set_tx_freq(rig, rx_vfo, freq);
}
priv->split = split;
return RIG_OK;
}
int icmarine_get_split_vfo(RIG *rig, vfo_t rx_vfo, split_t *split, vfo_t *tx_vfo)
{
struct icmarine_priv_data *priv;
priv = (struct icmarine_priv_data *)rig->state.priv;
*split = priv->split;
*tx_vfo = rx_vfo;
return RIG_OK;
}
/* REM: no way to change passband width ? */
int icmarine_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
const char *pmode;
switch (mode) {
case RIG_MODE_CW: pmode = MD_CW; break;
case RIG_MODE_USB: pmode = MD_USB; break;
case RIG_MODE_LSB: pmode = MD_LSB; break;
case RIG_MODE_AM: pmode = MD_AM; break;
case RIG_MODE_RTTY: pmode = MD_FSK; break;
default:
rig_debug(RIG_DEBUG_ERR,
"%s: unsupported mode %d\n",
__func__, mode);
return -RIG_EINVAL;
}
return icmarine_transaction (rig, CMD_MODE, pmode, NULL);
}
int icmarine_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
int retval;
char modebuf[BUFSZ];
retval = icmarine_transaction (rig, CMD_MODE, NULL, modebuf);
if (retval != RIG_OK)
return retval;
if (!memcmp(modebuf, MD_LSB, strlen(MD_LSB)))
*mode = RIG_MODE_LSB;
else if (!memcmp(modebuf, MD_USB, strlen(MD_USB)))
*mode = RIG_MODE_USB;
else if (!memcmp(modebuf, MD_CW, strlen(MD_CW)))
*mode = RIG_MODE_CW;
else if (!memcmp(modebuf, MD_AM, strlen(MD_AM)))
*mode = RIG_MODE_AM;
else if (!memcmp(modebuf, MD_FSK, strlen(MD_FSK)))
*mode = RIG_MODE_RTTY;
else
retval = -RIG_EPROTO;
if (retval == RIG_OK)
*width = rig_passband_normal(rig, *mode);
return retval;
}
/*
* Rem: The "TX" command will fail on invalid frequencies.
*/
int icmarine_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
return icmarine_transaction (rig, CMD_PTT,
ptt == RIG_PTT_ON ? "TX" : "RX", NULL);
}
int icmarine_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
char pttbuf[BUFSZ];
int retval;
retval = icmarine_transaction (rig, CMD_PTT, NULL, pttbuf);
if (retval != RIG_OK)
return retval;
if (!strcmp(pttbuf, "TX"))
*ptt = RIG_PTT_ON;
else if (!strcmp(pttbuf, "RX"))
*ptt = RIG_PTT_OFF;
else
retval = -RIG_EPROTO;
return retval;
}
int icmarine_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
char dcdbuf[BUFSZ];
int retval;
retval = icmarine_transaction (rig, CMD_SQLS, NULL, dcdbuf);
if (retval != RIG_OK)
return retval;
if (!strcmp(dcdbuf, "OPEN"))
*dcd = RIG_DCD_ON;
else if (!strcmp(dcdbuf, "CLOSE"))
*dcd = RIG_DCD_OFF;
else
retval = -RIG_EPROTO;
return retval;
}
int icmarine_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
{
if (RIG_OP_TUNE != op && RIG_OP_NONE != op)
return -RIG_EINVAL;
return icmarine_transaction (rig, CMD_TUNER,
RIG_OP_TUNE == op ? "ON" : "OFF", NULL);
}
int icmarine_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
int retval;
switch(func) {
case RIG_FUNC_NB:
retval = icmarine_transaction (rig, CMD_NB, status ? "ON":"OFF", NULL);
break;
default:
return -RIG_EINVAL;
}
return retval;
}
int icmarine_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
{
char funcbuf[BUFSZ];
int retval;
switch(func) {
case RIG_FUNC_NB:
retval = icmarine_transaction (rig, CMD_NB, NULL, funcbuf);
break;
default:
return -RIG_EINVAL;
}
*status = !strcmp(funcbuf, "ON");
return retval;
}
int icmarine_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
char lvlbuf[BUFSZ];
int retval;
switch(level) {
case RIG_LEVEL_AF:
sprintf(lvlbuf, "%u", (unsigned)(val.f * 255));
retval = icmarine_transaction (rig, CMD_AFGAIN, lvlbuf, NULL);
break;
case RIG_LEVEL_RF:
sprintf(lvlbuf, "%u", (unsigned)(val.f * 9));
retval = icmarine_transaction (rig, CMD_RFGAIN, lvlbuf, NULL);
break;
case RIG_LEVEL_RFPOWER:
sprintf(lvlbuf, "%u", 1 + (unsigned)(val.f * 2));
retval = icmarine_transaction (rig, CMD_RFPWR, lvlbuf, NULL);
break;
case RIG_LEVEL_AGC:
retval = icmarine_transaction (rig, CMD_AGC,
RIG_AGC_OFF == val.i ? "OFF":"ON", NULL);
break;
default:
return -RIG_EINVAL;
}
return retval;
}
int icmarine_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
char lvlbuf[BUFSZ];
int retval;
switch(level) {
case RIG_LEVEL_RAWSTR:
retval = icmarine_transaction (rig, CMD_SMETER, NULL, lvlbuf);
if (retval != RIG_OK)
return retval;
if (lvlbuf[0] < '0' || lvlbuf[0] > '9')
return -RIG_EPROTO;
val->i = lvlbuf[0] - '0';
break;
case RIG_LEVEL_AF:
retval = icmarine_transaction (rig, CMD_AFGAIN, NULL, lvlbuf);
if (retval != RIG_OK)
return retval;
val->f = atof(lvlbuf)/255.;
break;
case RIG_LEVEL_RF:
retval = icmarine_transaction (rig, CMD_RFGAIN, NULL, lvlbuf);
if (retval != RIG_OK)
return retval;
if (lvlbuf[0] < '0' || lvlbuf[0] > '9')
return -RIG_EPROTO;
val->f = (float)(lvlbuf[0] - '0')/9.;
break;
case RIG_LEVEL_RFPOWER:
retval = icmarine_transaction (rig, CMD_RFPWR, NULL, lvlbuf);
if (retval != RIG_OK)
return retval;
if (lvlbuf[0] < '1' || lvlbuf[0] > '3')
return -RIG_EPROTO;
val->f = (float)(lvlbuf[0] - '1')/3.;
break;
case RIG_LEVEL_AGC:
retval = icmarine_transaction (rig, CMD_AGC, NULL, lvlbuf);
if (retval != RIG_OK)
return retval;
val->i = !strcmp(lvlbuf, "ON") ? RIG_AGC_SLOW : RIG_AGC_OFF;
break;
default:
return -RIG_EINVAL;
}
return retval;
}
/*
* initrigs_icmarine is called by rig_backend_load
*/
DECLARE_INITRIG_BACKEND(icmarine)
{
rig_debug(RIG_DEBUG_VERBOSE, "icmarine: _init called\n");
rig_register(&icm700pro_caps);
rig_register(&icm710_caps);
rig_register(&icm802_caps);
return RIG_OK;
}

Wyświetl plik

@ -0,0 +1,75 @@
/*
* Hamlib ICOM Marine backend - main header
* Copyright (c) 2014-2015 by Stephane Fillod
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef _ICMARINE_H
#define _ICMARINE_H 1
#include "hamlib/rig.h"
#include "cal.h"
#include "tones.h"
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#define BACKEND_VER "0.1"
struct icmarine_priv_caps {
unsigned char default_remote_id; /* the remote default equipment's ID */
};
struct icmarine_priv_data {
unsigned char remote_id; /* the remote equipment's ID */
split_t split; /* current split mode */
};
extern const struct confparams icmarine_cfg_params[];
int icmarine_init(RIG *rig);
int icmarine_cleanup(RIG *rig);
int icmarine_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
int icmarine_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
int icmarine_set_tx_freq(RIG *rig, vfo_t vfo, freq_t freq);
int icmarine_get_tx_freq(RIG *rig, vfo_t vfo, freq_t *freq);
int icmarine_set_split_vfo(RIG *rig, vfo_t rx_vfo, split_t split, vfo_t tx_vfo);
int icmarine_get_split_vfo(RIG *rig, vfo_t rx_vfo, split_t *split, vfo_t *tx_vfo);
int icmarine_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
int icmarine_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
int icmarine_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq);
int icmarine_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq);
int icmarine_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
int icmarine_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
int icmarine_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd);
int icmarine_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op);
int icmarine_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val);
int icmarine_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
int icmarine_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
int icmarine_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status);
int icmarine_set_parm(RIG *rig, setting_t parm, value_t val);
int icmarine_get_parm(RIG *rig, setting_t parm, value_t *val);
int icmarine_set_conf(RIG *rig, token_t token, const char *val);
int icmarine_get_conf(RIG *rig, token_t token, char *val);
extern const struct rig_caps icm700pro_caps;
extern const struct rig_caps icm710_caps;
extern const struct rig_caps icm802_caps;
#endif /* _ICMARINE_H */

Wyświetl plik

@ -7,8 +7,9 @@ LOCAL_SRC_FILES := ic706.c icr8500.c ic735.c ic775.c ic756.c \
icr7000.c ic910.c ic9100.c ic970.c ic725.c ic737.c ic718.c \
os535.c os456.c omni.c delta2.c ic92d.c \
ic736.c ic738.c ic7410.c ic746.c ic703.c ic726.c ic271.c \
ic765.c ic781.c ic471.c id1.c icr9000.c icr9500.c \
ic765.c ic781.c ic471.c icr9000.c icr9500.c \
icr10.c icr20.c icr71.c icr72.c icr75.c icrx7.c \
id1.c id5100.c ic2730.c \
ic707.c ic728.c ic751.c ic761.c \
ic78.c ic7800.c ic7000.c ic7100.c ic7200.c ic7600.c ic7700.c \
icom.c frame.c optoscan.c

Wyświetl plik

@ -3,10 +3,11 @@ ICOMSRC = ic706.c icr8500.c ic735.c ic775.c ic756.c \
icr7000.c ic910.c ic9100.c ic970.c ic725.c ic737.c ic718.c \
os535.c os456.c omni.c delta2.c ic92d.c \
ic736.c ic738.c ic7410.c ic746.c ic703.c ic726.c ic271.c \
ic765.c ic781.c ic471.c id1.c icr9000.c icr9500.c \
ic765.c ic781.c ic471.c icr9000.c icr9500.c \
icr10.c icr20.c icr71.c icr72.c icr75.c icrx7.c \
id1.c id5100.c ic2730.c \
ic707.c ic728.c ic751.c ic761.c \
ic78.c ic7800.c ic7000.c ic7100.c ic7200.c ic7600.c ic7700.c \
ic78.c ic7800.c ic7000.c ic7100.c ic7200.c ic7300.c ic7600.c ic7700.c \
icom.c icom.h icom_defs.h frame.c frame.h optoscan.c optoscan.h
noinst_LTLIBRARIES = libhamlib-icom.la

Wyświetl plik

@ -56,6 +56,7 @@
static const struct icom_priv_caps delta2_priv_caps = {
0x01, /* default address */
1, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list /* TODO: ts_sc_list */
};
@ -78,7 +79,7 @@ const struct rig_caps delta2_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -221,9 +221,8 @@ int icom_one_transaction (RIG *rig, int cmd, int subcmd, const unsigned char *pa
return -RIG_EPROTO;
}
if (frm_len < ACKFRMLEN) {
return -RIG_EPROTO;
}
if (frm_len < ACKFRMLEN) return -RIG_EPROTO;
if (NAK == buf[frm_len - 2]) return -RIG_ERJCTED;
*data_len = frm_len-(ACKFRMLEN-1);
memcpy(data, buf+4, *data_len);
@ -256,7 +255,7 @@ int icom_transaction (RIG *rig, int cmd, int subcmd, const unsigned char *payloa
do {
retval = icom_one_transaction (rig, cmd, subcmd, payload, payload_len, data, data_len);
if (retval == RIG_OK)
if (retval == RIG_OK || retval == -RIG_ERJCTED)
break;
} while (retry-- > 0);
@ -339,21 +338,23 @@ int rig2icom_mode(RIG *rig, rmode_t mode, pbwidth_t width,
return -RIG_EINVAL;
}
medium_width = rig_passband_normal(rig, mode);
if (width == medium_width || width == RIG_PASSBAND_NORMAL)
if (width != RIG_PASSBAND_NOCHANGE) {
medium_width = rig_passband_normal(rig, mode);
if (width == medium_width || width == RIG_PASSBAND_NORMAL)
icmode_ext = -1; /* medium, no passband data-> rig default. Is medium always the default? */
else if (width < medium_width)
else if (width < medium_width)
icmode_ext = PD_NARROW_3;
else
else
icmode_ext = PD_WIDE_3;
if (rig->caps->rig_model == RIG_MODEL_ICR7000) {
if (rig->caps->rig_model == RIG_MODEL_ICR7000) {
if (mode == RIG_MODE_USB || mode == RIG_MODE_LSB) {
icmode = S_R7000_SSB;
icmode_ext = 0x00;
icmode = S_R7000_SSB;
icmode_ext = 0x00;
} else if (mode == RIG_MODE_AM && icmode_ext == -1) {
icmode_ext = PD_WIDE_3; /* default to Wide */
icmode_ext = PD_WIDE_3; /* default to Wide */
}
}
}
*md = icmode;

Wyświetl plik

@ -39,6 +39,7 @@
static const struct icom_priv_caps ic1275_priv_caps = {
0x18, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -61,7 +62,7 @@ const struct rig_caps ic1275_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -48,6 +48,7 @@
static const struct icom_priv_caps ic271_priv_caps = {
0x20, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -70,7 +71,7 @@ const struct rig_caps ic271_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

205
icom/ic2730.c 100644
Wyświetl plik

@ -0,0 +1,205 @@
/*
* Hamlib CI-V backend - description of IC-2730 and variations
* Copyright (c) 2015 by Stephane Fillod
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include "hamlib/rig.h"
#include "idx_builtin.h"
#include "icom.h"
#define IC2730_MODES (RIG_MODE_FM)
#define IC2730_ALL_RX_MODES (RIG_MODE_AM|IC2730_MODES)
#define IC2730_VFO_ALL (RIG_VFO_MAIN|RIG_VFO_SUB)
#define IC2730_SCAN_OPS RIG_SCAN_NONE
#define IC2730_VFO_OPS RIG_OP_NONE
#define IC2730_FUNC_ALL ( \
RIG_FUNC_TONE| \
RIG_FUNC_TSQL| \
RIG_FUNC_VOX)
#define IC2730_LEVEL_ALL (RIG_LEVEL_AF| \
RIG_LEVEL_SQL| \
RIG_LEVEL_RFPOWER| \
RIG_LEVEL_MICGAIN| \
RIG_LEVEL_VOXGAIN)
#define IC2730_PARM_ALL RIG_PARM_NONE
/*
* FIXME: real measurement
*/
#define IC2730_STR_CAL UNKNOWN_IC_STR_CAL
static const struct icom_priv_caps ic2730_priv_caps = {
0x90, /* default address */
0, /* 731 mode */
1, /* no XCHG */
};
const struct rig_caps ic2730_caps = {
.rig_model = RIG_MODEL_IC2730,
.model_name = "IC-2730",
.mfg_name = "Icom",
.version = BACKEND_VER,
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_MOBILE,
.ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 19200,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 1000,
.retry = 3,
.has_get_func = IC2730_FUNC_ALL,
.has_set_func = IC2730_FUNC_ALL,
.has_get_level = IC2730_LEVEL_ALL,
.has_set_level = RIG_LEVEL_SET(IC2730_LEVEL_ALL),
.has_get_parm = IC2730_PARM_ALL,
.has_set_parm = IC2730_PARM_ALL,
.level_gran = {
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } },
},
.parm_gran = {},
.ctcss_list = common_ctcss_list,
.dcs_list = full_dcs_list,
.preamp = { RIG_DBLST_END, },
.attenuator = { RIG_DBLST_END, },
.max_rit = Hz(0),
.max_xit = Hz(0),
.max_ifshift = Hz(0),
.targetable_vfo = 0,
.vfo_ops = IC2730_VFO_OPS,
.scan_ops = IC2730_SCAN_OPS,
.transceive = RIG_TRN_RIG,
.bank_qty = 0,
.chan_desc_sz = 0,
.chan_list = {
// There's no memory support through CI-V,
// but there is a clone mode apart.
RIG_CHAN_END,
},
.rx_range_list1 = {
{MHz(118),MHz(174),IC2730_ALL_RX_MODES,-1,-1,IC2730_VFO_ALL},
{MHz(375),MHz(550),IC2730_ALL_RX_MODES,-1,-1,IC2730_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list1 = {
{MHz(144),MHz(146),IC2730_MODES,W(5),W(25),IC2730_VFO_ALL},
{MHz(430),MHz(440),IC2730_MODES,W(5),W(25),IC2730_VFO_ALL},
RIG_FRNG_END, },
.rx_range_list2 = {
{MHz(118),MHz(174),IC2730_ALL_RX_MODES,-1,-1,IC2730_VFO_ALL},
{MHz(375),MHz(550),IC2730_ALL_RX_MODES,-1,-1,IC2730_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list2 = {
{MHz(144),MHz(148),IC2730_MODES,W(5),W(50),IC2730_VFO_ALL},
{MHz(430),MHz(450),IC2730_MODES,W(5),W(50),IC2730_VFO_ALL},
RIG_FRNG_END, },
.tuning_steps = {
// Rem: no support for changing tuning step
{IC2730_ALL_RX_MODES,kHz(5)},
{IC2730_ALL_RX_MODES,kHz(6.25)},
// The 8.33 kHz step is not selectable, depending on the operating band or mode.
{IC2730_ALL_RX_MODES,kHz(8.33)},
{IC2730_ALL_RX_MODES,kHz(10)},
{IC2730_ALL_RX_MODES,12500},
{IC2730_ALL_RX_MODES,kHz(15)},
{IC2730_ALL_RX_MODES,kHz(20)},
{IC2730_ALL_RX_MODES,kHz(25)},
{IC2730_ALL_RX_MODES,kHz(30)},
{IC2730_ALL_RX_MODES,kHz(50)},
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_FM|RIG_MODE_AM, kHz(12)},
{RIG_MODE_FM|RIG_MODE_AM, kHz(6)},
RIG_FLT_END,
},
.str_cal = IC2730_STR_CAL,
.cfgparams = icom_cfg_params,
.set_conf = icom_set_conf,
.get_conf = icom_get_conf,
.priv = (void*)&ic2730_priv_caps,
.rig_init = icom_init,
.rig_cleanup = icom_cleanup,
.rig_open = NULL,
.rig_close = NULL,
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
.set_powerstat = icom_set_powerstat,
.get_powerstat = icom_get_powerstat,
.decode_event = icom_decode_event,
.set_func = icom_set_func,
.get_func = icom_get_func,
.set_level = icom_set_level,
.get_level = icom_get_level,
.set_ptt = icom_set_ptt,
.get_ptt = icom_get_ptt,
.get_dcd = icom_get_dcd,
.set_rptr_shift = icom_set_rptr_shift,
.get_rptr_shift = icom_get_rptr_shift,
.set_rptr_offs = icom_set_rptr_offs,
.get_rptr_offs = icom_get_rptr_offs,
.set_ctcss_tone = icom_set_ctcss_tone,
.get_ctcss_tone = icom_get_ctcss_tone,
.set_ctcss_sql = icom_set_ctcss_sql,
.get_ctcss_sql = icom_get_ctcss_sql,
.set_dcs_sql = icom_set_dcs_code,
.get_dcs_sql = icom_get_dcs_code,
.set_split_vfo = icom_set_split_vfo,
.get_split_vfo = icom_get_split_vfo,
.set_split_freq = icom_set_split_freq,
.get_split_freq = icom_get_split_freq,
.set_split_mode = icom_set_split_mode,
.get_split_mode = icom_get_split_mode,
};

Wyświetl plik

@ -43,6 +43,7 @@
static const struct icom_priv_caps ic275_priv_caps = {
0x10, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -65,7 +66,7 @@ const struct rig_caps ic275_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -47,6 +47,7 @@
static const struct icom_priv_caps ic471_priv_caps = {
0x22, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -69,7 +70,7 @@ const struct rig_caps ic471_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -43,6 +43,7 @@
static const struct icom_priv_caps ic475_priv_caps = {
0x14, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -65,7 +66,7 @@ const struct rig_caps ic475_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -109,6 +109,7 @@
static const struct icom_priv_caps IC7000_priv_caps = {
0x70, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic7000_ts_sc_list
};
@ -132,7 +133,7 @@ const struct rig_caps ic7000_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC7000_FUNCS,
.has_set_func = IC7000_FUNCS,

Wyświetl plik

@ -79,6 +79,7 @@
static const struct icom_priv_caps ic703_priv_caps = {
0x68, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic706_ts_sc_list
};
@ -101,7 +102,7 @@ const struct rig_caps ic703_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC703_FUNC_ALL,
.has_set_func = IC703_FUNC_ALL,

Wyświetl plik

@ -46,12 +46,14 @@ static int ic706_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width,
err = rig2icom_mode(rig, mode, width, md, pd);
if (err != RIG_OK)
return err;
return err;
if (width != RIG_PASSBAND_NOCHANGE) {
if (*pd == -1)
*pd = PD_MEDIUM_2;
*pd = PD_MEDIUM_2;
else
(*pd)--;
(*pd)--;
}
return RIG_OK;
}
@ -132,6 +134,7 @@ static int ic706_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width,
static const struct icom_priv_caps ic706_priv_caps = {
0x48, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic706_ts_sc_list,
.r2i_mode = ic706_r2i_mode
};
@ -155,7 +158,7 @@ const struct rig_caps ic706_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,
@ -264,6 +267,7 @@ const struct rig_caps ic706_caps = {
static const struct icom_priv_caps ic706mkii_priv_caps = {
0x4e, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic706_ts_sc_list,
.r2i_mode = ic706_r2i_mode
};
@ -287,7 +291,7 @@ const struct rig_caps ic706mkii_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,
@ -419,6 +423,7 @@ const struct rig_caps ic706mkii_caps = {
static const struct icom_priv_caps ic706mkiig_priv_caps = {
0x58, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic706_ts_sc_list,
.r2i_mode = ic706_r2i_mode
};
@ -442,7 +447,7 @@ const struct rig_caps ic706mkiig_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC706IIG_FUNC_ALL,
.has_set_func = IC706IIG_FUNC_ALL,
@ -569,8 +574,6 @@ const struct rig_caps ic706mkiig_caps = {
.set_mem = icom_set_mem,
.vfo_op = icom_vfo_op,
.scan = icom_scan,
.set_ptt = icom_set_ptt,
.get_ptt = icom_get_ptt,
.get_dcd = icom_get_dcd,
.set_ts = icom_set_ts,
.set_rptr_shift = icom_set_rptr_shift,

Wyświetl plik

@ -53,6 +53,7 @@
static const struct icom_priv_caps ic707_priv_caps = {
0x3e, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -75,7 +76,7 @@ const struct rig_caps ic707_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -97,6 +97,7 @@
static const struct icom_priv_caps ic7100_priv_caps = {
0x88, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic7100_ts_sc_list, /* FIXME */
};
@ -108,7 +109,7 @@ const struct rig_caps ic7100_caps = {
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_SERIAL_CAT,
.ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 300,
@ -119,7 +120,7 @@ const struct rig_caps ic7100_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC7100_FUNC_ALL,
.has_set_func = IC7100_FUNC_ALL | RIG_FUNC_RESUME,
@ -222,8 +223,8 @@ const struct rig_caps ic7100_caps = {
.get_freq = icom_get_freq,
.set_freq = icom_set_freq,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode_with_data,
.get_vfo = NULL,
.set_vfo = icom_set_vfo,

Wyświetl plik

@ -71,6 +71,7 @@
static const struct icom_priv_caps IC718_priv_caps = {
0x5e, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic718_ts_sc_list
};
@ -93,7 +94,7 @@ const struct rig_caps ic718_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC718_FUNC_ALL,
.has_set_func = IC718_FUNC_ALL,

Wyświetl plik

@ -79,6 +79,7 @@
static const struct icom_priv_caps IC7200_priv_caps = {
0x76, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic7200_ts_sc_list
};
@ -102,7 +103,7 @@ const struct rig_caps ic7200_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC7200_FUNCS,
.has_set_func = IC7200_FUNCS,
@ -190,8 +191,8 @@ const struct rig_caps ic7200_caps = {
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_vfo = icom_set_vfo,
.set_ant = NULL, /*automatically set by rig depending band */
.get_ant = NULL,

Wyświetl plik

@ -51,6 +51,7 @@
static const struct icom_priv_caps ic725_priv_caps = {
0x28, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -73,7 +74,7 @@ const struct rig_caps ic725_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -53,6 +53,7 @@
static const struct icom_priv_caps ic726_priv_caps = {
0x30, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -75,7 +76,7 @@ const struct rig_caps ic726_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -53,6 +53,7 @@
static const struct icom_priv_caps ic728_priv_caps = {
0x38, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -75,7 +76,7 @@ const struct rig_caps ic728_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

234
icom/ic7300.c 100644
Wyświetl plik

@ -0,0 +1,234 @@
/*
* Hamlib CI-V backend - description of IC-7300 and variations
* Adapted by J.Watson from IC-7000 code (c) 2004 by Stephane Fillod
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* 26Mar09: Corrected tuning steps and added data modes.
* 25Mar09: Initial release
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h> /* String function definitions */
#include <hamlib/rig.h>
#include "token.h"
#include "idx_builtin.h"
#include "icom.h"
#include "icom_defs.h"
#include "frame.h"
#include "misc.h"
#include "bandplan.h"
#include "tones.h"
/* AM Data mode needs adding - this would require one more mode 'RIG_MODE_PKTAM' to rig.h */
#define IC7300_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB)
#define IC7300_1HZ_TS_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB)
#define IC7300_NOT_TS_MODES (IC7300_ALL_RX_MODES &~IC7300_1HZ_TS_MODES)
#define IC7300_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR)
#define IC7300_AM_TX_MODES (RIG_MODE_AM)
#define IC7300_FUNCS (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_MON|RIG_FUNC_MN|RIG_FUNC_ANF|RIG_FUNC_VSC|RIG_FUNC_LOCK|RIG_FUNC_ARO)
#define IC7300_LEVELS (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_SWR|RIG_LEVEL_ALC)
#define IC7300_VFOS (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM)
#define IC7300_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT|RIG_PARM_APO|RIG_PARM_TIME|RIG_PARM_BEEP)
#define IC7300_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL|RIG_OP_TUNE)
#define IC7300_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_PROG|RIG_SCAN_SLCT|RIG_SCAN_PRIO)
#define IC7300_ANTS (RIG_ANT_1) /* ant-1 is Hf-6m */
/*
* FIXME: This is a guess real measures please!
*/
#define IC7300_STR_CAL { 2, \
{ \
{ 0, -60 }, \
{ 255, 60 } \
} }
/*
* IC-7300 rig capabilities.
*
* TODO: complete command set (esp. the $1A bunch!) and testing..
*/
static const struct icom_priv_caps IC7300_priv_caps = {
0x94, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic7300_ts_sc_list
};
const struct rig_caps ic7300_caps = {
.rig_model = RIG_MODEL_IC7300,
.model_name = "IC-7300",
.mfg_name = "Icom",
.version = BACKEND_VER,
.copyright = "LGPL",
.status = RIG_STATUS_ALPHA,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 300,
.serial_rate_max = 19200,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 1000,
.retry = 3,
.has_get_func = IC7300_FUNCS,
.has_set_func = IC7300_FUNCS,
.has_get_level = IC7300_LEVELS,
.has_set_level = RIG_LEVEL_SET(IC7300_LEVELS),
.has_get_parm = IC7300_PARMS,
.has_set_parm = RIG_PARM_SET(IC7300_PARMS),
.level_gran = {
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } },
},
.parm_gran = {},
.ctcss_list = full_ctcss_list,
.dcs_list = NULL,
.preamp = { 10, RIG_DBLST_END, }, /* FIXME: TBC it's a guess*/
.attenuator = { 20, RIG_DBLST_END, }, /* value taken from p.45 of manual*/
.max_rit = Hz(9999),
.max_xit = Hz(9999),
.max_ifshift = Hz(0),
.targetable_vfo = 0,
.vfo_ops = IC7300_VFO_OPS,
.scan_ops = IC7300_SCAN_OPS,
.transceive = RIG_TRN_RIG,
.bank_qty = 1,
.chan_desc_sz = 0,
.chan_list = {
{ 1, 199, RIG_MTYPE_MEM },
{ 200, 201, RIG_MTYPE_EDGE }, /* two by two */
RIG_CHAN_END,
},
.rx_range_list1 = { {kHz(30),MHz(60),IC7300_ALL_RX_MODES,-1,-1,IC7300_VFOS}, RIG_FRNG_END, },
.tx_range_list1 = {
FRQ_RNG_HF(1,IC7300_OTHER_TX_MODES, W(2),W(100),IC7300_VFOS,RIG_ANT_1),
FRQ_RNG_6m(1,IC7300_OTHER_TX_MODES, W(2),W(100),IC7300_VFOS,RIG_ANT_1),
FRQ_RNG_HF(1,IC7300_AM_TX_MODES, W(1),W(40),IC7300_VFOS,RIG_ANT_1), /* AM class */
FRQ_RNG_6m(1,IC7300_AM_TX_MODES, W(1),W(40),IC7300_VFOS,RIG_ANT_1), /* AM class */
RIG_FRNG_END, },
.rx_range_list2 = { {kHz(30),MHz(60),IC7300_ALL_RX_MODES,-1,-1,IC7300_VFOS}, RIG_FRNG_END, },
.tx_range_list2 = { /* needs the 5 mhz channels added */
FRQ_RNG_HF(2,IC7300_OTHER_TX_MODES, W(2),W(100),IC7300_VFOS,RIG_ANT_1),
FRQ_RNG_6m(2,IC7300_OTHER_TX_MODES, W(2),W(100),IC7300_VFOS,RIG_ANT_1),
FRQ_RNG_HF(2,IC7300_AM_TX_MODES, W(1),W(40),IC7300_VFOS,RIG_ANT_1), /* AM class */
FRQ_RNG_6m(2,IC7300_AM_TX_MODES, W(1),W(40),IC7300_VFOS,RIG_ANT_1), /* AM class */
RIG_FRNG_END, },
.tuning_steps = {
{IC7300_1HZ_TS_MODES,1},
{IC7300_NOT_TS_MODES,10},
{IC7300_ALL_RX_MODES,Hz(100)},
{IC7300_ALL_RX_MODES,kHz(1)},
{IC7300_ALL_RX_MODES,kHz(5)},
{IC7300_ALL_RX_MODES,kHz(9)},
{IC7300_ALL_RX_MODES,kHz(10)},
RIG_TS_END,
},
/* mode/filter list, remember: order matters! But duplication may speed up search. Put the most commonly used modes first! Remember these are defaults, with dsp rigs you can change them to anything you want except FM and WFM which are fixed */
.filters = {
{RIG_MODE_SSB, kHz(2.4)},
{RIG_MODE_SSB, kHz(1.8)},
{RIG_MODE_SSB, kHz(3)},
{RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(500)},
{RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(250)},
{RIG_MODE_CW|RIG_MODE_CWR, kHz(1.2)},
{RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(2.4)},
{RIG_MODE_AM, kHz(6)},
{RIG_MODE_AM, kHz(3)},
{RIG_MODE_AM, kHz(9)},
RIG_FLT_END,
},
.str_cal = IC7300_STR_CAL,
.cfgparams = icom_cfg_params,
.set_conf = icom_set_conf,
.get_conf = icom_get_conf,
.priv = (void*)&IC7300_priv_caps,
.rig_init = icom_init,
.rig_cleanup = icom_cleanup,
.rig_open = NULL,
.rig_close = NULL,
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
//.get_vfo = icom_get_vfo,
.set_vfo = icom_set_vfo,
.set_ant = NULL, /*automatically set by rig depending band */
.get_ant = NULL,
.set_rit = icom_set_rit,
.decode_event = icom_decode_event,
.set_level = icom_set_level,
.get_level = icom_get_level,
.set_func = icom_set_func,
.get_func = icom_get_func,
.set_parm = NULL,
.get_parm = NULL,
.set_mem = icom_set_mem,
.vfo_op = icom_vfo_op,
.scan = icom_scan,
.set_ptt = icom_set_ptt,
.get_ptt = icom_get_ptt,
.get_dcd = icom_get_dcd,
.set_ts = icom_set_ts,
.get_ts = NULL,
.set_rptr_shift = icom_set_rptr_shift,
.get_rptr_shift = NULL,
.set_rptr_offs = icom_set_rptr_offs,
.get_rptr_offs = icom_get_rptr_offs,
.set_ctcss_tone = icom_set_ctcss_tone,
.get_ctcss_tone = icom_get_ctcss_tone,
.set_ctcss_sql = icom_set_ctcss_sql,
.get_ctcss_sql = icom_get_ctcss_sql,
.set_split_freq = icom_set_split_freq,
.get_split_freq = icom_get_split_freq,
.set_split_mode = icom_set_split_mode,
.get_split_mode = icom_get_split_mode,
.set_split_vfo = icom_set_split_vfo,
.get_split_vfo = NULL,
.send_morse = icom_send_morse
};

Wyświetl plik

@ -50,6 +50,7 @@
static const struct icom_priv_caps ic735_priv_caps = {
0x04, /* default address */
1, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -72,7 +73,7 @@ const struct rig_caps ic735_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -57,6 +57,7 @@
static const struct icom_priv_caps ic736_priv_caps = {
0x40, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -79,7 +80,7 @@ const struct rig_caps ic736_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -53,6 +53,7 @@
static const struct icom_priv_caps ic737_priv_caps = {
0x3c, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -75,7 +76,7 @@ const struct rig_caps ic737_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -57,6 +57,7 @@
static const struct icom_priv_caps ic738_priv_caps = {
0x44, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -79,7 +80,7 @@ const struct rig_caps ic738_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -36,19 +36,16 @@
#include "misc.h"
#include "bandplan.h"
/*
* TODO: PSK and PSKR
*/
#define IC7410_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM)
#define IC7410_1HZ_TS_MODES IC7410_ALL_RX_MODES
#define IC7410_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM)
#define IC7410_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)
#define IC7410_AM_TX_MODES (RIG_MODE_AM)
#define IC7410_ALL_RX_MODES IC7410_OTHER_TX_MODES | IC7410_AM_TX_MODES
#define IC7410_1HZ_TS_MODES IC7410_ALL_RX_MODES
#define IC7410_FUNCS (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_MON|RIG_FUNC_MN|RIG_FUNC_ANF|RIG_FUNC_VSC|RIG_FUNC_LOCK)
#define IC7410_LEVELS (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_BALANCE|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_SWR|RIG_LEVEL_ALC)
#define IC7410_VFOS (RIG_VFO_MAIN|RIG_VFO_SUB|RIG_VFO_MEM)
#define IC7410_VFOS (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM)
#define IC7410_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT)
#define IC7410_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL|RIG_OP_TUNE)
@ -75,6 +72,7 @@
static const struct icom_priv_caps ic7410_priv_caps = {
0x80, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic756pro_ts_sc_list
};
@ -98,7 +96,7 @@ const struct rig_caps ic7410_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC7410_FUNCS,
.has_set_func = IC7410_FUNCS,
@ -144,8 +142,8 @@ const struct rig_caps ic7410_caps = {
.tx_range_list2 = {
FRQ_RNG_HF(2,IC7410_OTHER_TX_MODES, W(2),W(100),IC7410_VFOS,IC7410_ANTS),
FRQ_RNG_6m(2,IC7410_OTHER_TX_MODES, W(2),W(100),IC7410_VFOS,IC7410_ANTS),
FRQ_RNG_HF(2,IC7410_AM_TX_MODES, W(1),W(27),IC7410_VFOS,IC7410_ANTS), /* AM class */
FRQ_RNG_6m(2,IC7410_AM_TX_MODES, W(1),W(27),IC7410_VFOS,IC7410_ANTS), /* AM class */
FRQ_RNG_HF(2,IC7410_AM_TX_MODES, W(2),W(27),IC7410_VFOS,IC7410_ANTS), /* AM class */
FRQ_RNG_6m(2,IC7410_AM_TX_MODES, W(2),W(27),IC7410_VFOS,IC7410_ANTS), /* AM class */
/* USA only, TBC: end of range and modes */
{MHz(5.33050),MHz(5.33350),IC7410_OTHER_TX_MODES,W(2),W(100),IC7410_VFOS,IC7410_ANTS}, /* USA only */
{MHz(5.34650),MHz(5.34950),IC7410_OTHER_TX_MODES,W(2),W(100),IC7410_VFOS,IC7410_ANTS}, /* USA only */
@ -191,8 +189,8 @@ const struct rig_caps ic7410_caps = {
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_vfo = icom_set_vfo,
.set_ant = icom_set_ant,
.get_ant = icom_get_ant,

Wyświetl plik

@ -163,6 +163,7 @@ static int ic746pro_get_ext_parm(RIG *rig, token_t token, value_t *val);
static const struct icom_priv_caps ic746_priv_caps = {
0x56, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic756pro_ts_sc_list
};
@ -185,7 +186,7 @@ const struct rig_caps ic746_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC746_FUNC_ALL,
.has_set_func = IC746_FUNC_ALL,
@ -369,6 +370,7 @@ static const struct confparams ic746pro_ext_parms[] = {
static const struct icom_priv_caps ic746pro_priv_caps = {
0x66, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic756pro_ts_sc_list
};
@ -391,7 +393,7 @@ const struct rig_caps ic746pro_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC746_FUNC_ALL,
.has_set_func = IC746_FUNC_ALL,

Wyświetl plik

@ -79,6 +79,7 @@
static const struct icom_priv_caps ic751_priv_caps = {
0x1c, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -101,7 +102,7 @@ const struct rig_caps ic751_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -113,6 +113,7 @@ static int r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width,
static const struct icom_priv_caps ic756_priv_caps = {
0x50, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic756_ts_sc_list,
.r2i_mode = r2i_mode
};
@ -136,7 +137,7 @@ const struct rig_caps ic756_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,
@ -240,6 +241,8 @@ const struct rig_caps ic756_caps = {
.get_split_freq = icom_get_split_freq,
.set_split_mode = icom_set_split_mode,
.get_split_mode = icom_get_split_mode,
.set_split_freq_mode = icom_set_split_freq_mode,
.get_split_freq_mode = icom_get_split_freq_mode,
.set_split_vfo = icom_set_split_vfo,
.get_split_vfo = icom_mem_get_split_vfo,
@ -254,6 +257,7 @@ const struct rig_caps ic756_caps = {
static const struct icom_priv_caps ic756pro_priv_caps = {
0x5c, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic756pro_ts_sc_list
};
@ -276,7 +280,7 @@ const struct rig_caps ic756pro_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC756PRO_FUNC_ALL,
.has_set_func = IC756PRO_FUNC_ALL,
@ -358,8 +362,8 @@ const struct rig_caps ic756pro_caps = {
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
.set_ant = icom_set_ant,
.get_ant = icom_get_ant,
@ -388,6 +392,8 @@ const struct rig_caps ic756pro_caps = {
.get_split_freq = icom_get_split_freq,
.set_split_mode = icom_set_split_mode,
.get_split_mode = icom_get_split_mode,
.set_split_freq_mode = icom_set_split_freq_mode,
.get_split_freq_mode = icom_get_split_freq_mode,
.set_split_vfo = icom_set_split_vfo,
.get_split_vfo = icom_mem_get_split_vfo,
@ -401,6 +407,7 @@ const struct rig_caps ic756pro_caps = {
static const struct icom_priv_caps ic756pro2_priv_caps = {
0x64, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic756pro_ts_sc_list
};
@ -480,7 +487,7 @@ const struct rig_caps ic756pro2_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC756PRO_FUNC_ALL,
.has_set_func = IC756PRO_FUNC_ALL,
@ -593,6 +600,8 @@ const struct rig_caps ic756pro2_caps = {
.get_split_freq = icom_get_split_freq,
.set_split_mode = icom_set_split_mode,
.get_split_mode = icom_get_split_mode,
.set_split_freq_mode = icom_set_split_freq_mode,
.get_split_freq_mode = icom_get_split_freq_mode,
.set_split_vfo = icom_set_split_vfo,
.get_split_vfo = icom_mem_get_split_vfo,
@ -759,6 +768,7 @@ static int ic756pro2_get_ext_parm(RIG *rig, token_t token, value_t *val)
static const struct icom_priv_caps ic756pro3_priv_caps = {
0x6e, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic756pro_ts_sc_list
};
@ -811,7 +821,7 @@ const struct rig_caps ic756pro3_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC756PRO_FUNC_ALL,
.has_set_func = IC756PRO_FUNC_ALL,
@ -929,6 +939,8 @@ const struct rig_caps ic756pro3_caps = {
.get_split_freq = icom_get_split_freq,
.set_split_mode = icom_set_split_mode,
.get_split_mode = icom_get_split_mode,
.set_split_freq_mode = icom_set_split_freq_mode,
.get_split_freq_mode = icom_get_split_freq_mode,
.set_split_vfo = icom_set_split_vfo,
.get_split_vfo = icom_mem_get_split_vfo,

Wyświetl plik

@ -88,6 +88,7 @@
static const struct icom_priv_caps ic7600_priv_caps = {
0x7a, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic756pro_ts_sc_list
};
@ -111,7 +112,7 @@ const struct rig_caps ic7600_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC7600_FUNCS,
.has_set_func = IC7600_FUNCS,

Wyświetl plik

@ -51,6 +51,7 @@
static const struct icom_priv_caps ic761_priv_caps = {
0x1e, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -73,7 +74,7 @@ const struct rig_caps ic761_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -53,6 +53,7 @@
static const struct icom_priv_caps ic765_priv_caps = {
0x2c, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -75,7 +76,7 @@ const struct rig_caps ic765_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -36,19 +36,16 @@
#include "misc.h"
#include "bandplan.h"
/*
* TODO: PSK and PSKR
*/
#define IC7700_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM)
#define IC7700_1HZ_TS_MODES IC7700_ALL_RX_MODES
#define IC7700_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM)
#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)
#define IC7700_AM_TX_MODES (RIG_MODE_AM)
#define IC7700_ALL_RX_MODES IC7700_OTHER_TX_MODES | IC7700_AM_TX_MODES
#define IC7700_1HZ_TS_MODES IC7700_ALL_RX_MODES
#define IC7700_FUNCS (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_MON|RIG_FUNC_MN|RIG_FUNC_ANF|RIG_FUNC_VSC|RIG_FUNC_LOCK)
#define IC7700_LEVELS (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_BALANCE|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_APF|RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_SWR|RIG_LEVEL_ALC)
#define IC7700_VFOS (RIG_VFO_MAIN|RIG_VFO_SUB|RIG_VFO_MEM)
#define IC7700_VFOS (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM)
#define IC7700_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT)
#define IC7700_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL|RIG_OP_TUNE)
@ -75,6 +72,7 @@
static const struct icom_priv_caps ic7700_priv_caps = {
0x74, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic756pro_ts_sc_list
};
@ -98,7 +96,7 @@ const struct rig_caps ic7700_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC7700_FUNCS,
.has_set_func = IC7700_FUNCS,
@ -192,8 +190,8 @@ const struct rig_caps ic7700_caps = {
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_vfo = icom_set_vfo,
.set_ant = icom_set_ant,
.get_ant = icom_get_ant,

Wyświetl plik

@ -50,6 +50,7 @@
static const struct icom_priv_caps ic775_priv_caps = {
0x46, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -72,7 +73,7 @@ const struct rig_caps ic775_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -63,6 +63,7 @@
static const struct icom_priv_caps ic78_priv_caps = {
0x62, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic706_ts_sc_list
};
@ -85,7 +86,7 @@ const struct rig_caps ic78_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC78_FUNC_ALL,
.has_set_func = IC78_FUNC_ALL,

Wyświetl plik

@ -78,6 +78,7 @@ static int ic7800_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
static const struct icom_priv_caps ic7800_priv_caps = {
0x6a, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic756pro_ts_sc_list
};
@ -101,7 +102,7 @@ const struct rig_caps ic7800_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC7800_FUNCS,
.has_set_func = IC7800_FUNCS,

Wyświetl plik

@ -54,6 +54,7 @@
static const struct icom_priv_caps ic781_priv_caps = {
0x26, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -76,7 +77,7 @@ const struct rig_caps ic781_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -48,7 +48,8 @@
*/
static const struct icom_priv_caps ic820h_priv_caps = {
0x42, /* default address */
1, /* 731 mode */
1, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -71,7 +72,7 @@ const struct rig_caps ic820h_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -48,7 +48,8 @@
*/
static const struct icom_priv_caps ic821h_priv_caps = {
0x4c, /* default address */
1, /* 731 mode */
1, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -71,7 +72,7 @@ const struct rig_caps ic821h_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -1,6 +1,6 @@
/*
* Hamlib CI-V backend - description of IC-910 (VHF/UHF All-Mode Tranceiver)
* Contributed by Francois Retief <fgretief@sun.ac.za>
* Hamlib CI-V backend - description of IC-910 (VHF/UHF All-Mode
* Tranceiver) Contributed by Francois Retief <fgretief@sun.ac.za>
* Copyright (c) 2000-2010 by Stephane Fillod
*
*
@ -41,21 +41,24 @@
#ifdef HAVE_WEIRD_IC910_MODES
static int ic910_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
/* FIX: The IC-910 has "Set FM" = 4, which is RTTY in for other radios */
if (mode == RIG_MODE_FM) {
mode = RIG_MODE_RTTY;
}
return icom_set_mode(rig, vfo, mode, width);
/* FIX: The IC-910 has "Set FM" = 4, which is RTTY in for other radios */
if (mode == RIG_MODE_FM) {
mode = RIG_MODE_RTTY;
}
return icom_set_mode(rig, vfo, mode, width);
}
static int ic910_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
/* FIX: The IC-910 has "Set FM" = 4, which is RTTY in for other radios */
int retval = icom_get_mode(rig, vfo, mode, width);
if (*mode == RIG_MODE_RTTY) {
*mode = RIG_MODE_FM;
}
return retval;
/* FIX: The IC-910 has "Set FM" = 4, which is RTTY in for other radios */
int retval = icom_get_mode(rig, vfo, mode, width);
if (*mode == RIG_MODE_RTTY) {
*mode = RIG_MODE_FM;
}
return retval;
}
#endif /* HAVE_WEIRD_IC910_MODES */
@ -64,133 +67,212 @@ static int ic910_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
* returns 0 if they are in different bands
*/
static int compareFrequencies (RIG* rig, freq_t freq1, freq_t freq2) {
int freq1band=0, freq2band=0;
freq_range_t noband = RIG_FRNG_END;
static int compareFrequencies(RIG *rig, freq_t freq1, freq_t freq2)
{
int freq1band = 0, freq2band = 0;
freq_range_t noband = RIG_FRNG_END;
while (rig->caps->rx_range_list1[freq1band].start!=noband.start) {
if (freq1 >= rig->caps->rx_range_list1[freq1band].start &&
freq1 <= rig->caps->rx_range_list1[freq1band].end)
break;
++freq1band;
//fprintf(stderr, "%i\n", freq1band);
}
while (rig->caps->rx_range_list1[freq1band].start != noband.start) {
if (freq1 >= rig->caps->rx_range_list1[freq1band].start &&
freq1 <= rig->caps->rx_range_list1[freq1band].end)
break;
while (rig->caps->rx_range_list1[freq2band].start!=noband.start) {
if (freq2 >= rig->caps->rx_range_list1[freq2band].start &&
freq2 <= rig->caps->rx_range_list1[freq2band].end)
break;
++freq2band;
}
++freq1band;
//fprintf(stderr, "%i\n", freq1band);
}
if (freq2band == freq1band) return 1;
else return 0;
while (rig->caps->rx_range_list1[freq2band].start != noband.start) {
if (freq2 >= rig->caps->rx_range_list1[freq2band].start &&
freq2 <= rig->caps->rx_range_list1[freq2band].end)
break;
++freq2band;
}
if (freq2band == freq1band) return 1;
else return 0;
}
/* swaps main and sub band - but preserves PREAMP, MODE
* they are also exchanged, but we do not want that
*/
static int ic910_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
int retval;
freq_t otherfreq;
freq_t origfreq;
static int icom_swap_bands(RIG* rig) {
/* TODO: actually use retval! */
int retval=0;
rmode_t mmode, smode; /* used to store the mode */
pbwidth_t mwidth, swidth; /* used to store the width */
value_t mpreamp, spreamp; /* used to store preamp */
value_t matt, satt; /* used to store attenuation */
/* main band get values */
icom_set_vfo(rig, RIG_VFO_MAIN);
/* get the mode, width, preamp */
icom_get_mode(rig, RIG_VFO_CURR, &mmode, &mwidth);
icom_get_level(rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, &mpreamp);
icom_get_level(rig, RIG_VFO_CURR, RIG_LEVEL_ATT, &matt);
/* sub band get values */
icom_set_vfo(rig, RIG_VFO_SUB);
/* get the mode, width, preamp, att */
icom_get_mode(rig, RIG_VFO_CURR, &smode, &swidth);
icom_get_level(rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, &spreamp);
icom_get_level(rig, RIG_VFO_CURR, RIG_LEVEL_ATT, &satt);
/* now, we can exchange the bands */
icom_vfo_op(rig, RIG_VFO_CURR, RIG_OP_XCHG);
/* restore the sub vales NOTE: sub band is still active */
/* set the mode, width, preamp */
icom_set_mode(rig, RIG_VFO_CURR, smode, swidth);
icom_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, spreamp);
icom_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_ATT, satt);
/* restore main band values */
icom_set_vfo(rig, RIG_VFO_MAIN);
/* set the mode, width, preamp */
icom_set_mode(rig, RIG_VFO_CURR, mmode, mwidth);
icom_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, mpreamp);
icom_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_ATT, matt);
return retval;
if ((retval = icom_get_freq(rig, RIG_VFO_CURR, &origfreq)) != RIG_OK) return retval;
if (compareFrequencies (rig, freq, origfreq))
{
/* correct band already */
if (RIG_VFO_A == vfo || RIG_VFO_B == vfo)
{
/* switch to desired VFO and read its frequency */
if ((retval = icom_set_vfo (rig, vfo)) != RIG_OK) return retval;
if ((retval = icom_get_freq(rig, vfo, &otherfreq)) != RIG_OK) return retval;
retval = icom_set_freq (rig, RIG_VFO_CURR, freq);
if (otherfreq != origfreq)
{
/* swap VFOs back as original was the other one */
icom_set_vfo (rig, RIG_VFO_A == vfo ? RIG_VFO_B : RIG_VFO_A);
}
}
else if (RIG_VFO_MAIN == vfo || RIG_VFO_SUB == vfo)
{
/* switch to the desired of MAIN and SUB and read its frequency */
if ((retval = icom_set_vfo (rig, vfo)) != RIG_OK) return retval;
if ((retval = icom_get_freq(rig, vfo, &otherfreq)) != RIG_OK) return retval;
if (otherfreq != origfreq)
{
/* started on a different so band exchange MAIN and SUB */
if ((retval = icom_vfo_op(rig, RIG_VFO_CURR, RIG_OP_XCHG)) != RIG_OK) return retval;
retval = icom_set_freq (rig, RIG_VFO_CURR, freq);
/* swap MAIN/SUB back as original was the other one */
icom_set_vfo (rig, RIG_VFO_MAIN == vfo ? RIG_VFO_SUB : RIG_VFO_MAIN);
}
else
{
/* already correct one of MAIN and SUB */
retval = icom_set_freq (rig, RIG_VFO_CURR, freq);
}
}
else if (RIG_VFO_CURR == vfo)
{
retval = icom_set_freq (rig, RIG_VFO_CURR, freq);
}
else retval = -RIG_EVFO;
}
else
{
/* wrong band */
if (RIG_VFO_A == vfo || RIG_VFO_B == vfo)
{
/* try and set frequency, may fail if band is already on other of MAIN/SUB */
retval = icom_set_freq (rig, RIG_VFO_CURR, freq);
if (-RIG_ERJCTED == retval)
{
/* exchange MAIN & SUB */
if ((retval = icom_vfo_op(rig, RIG_VFO_CURR, RIG_OP_XCHG)) != RIG_OK) return retval;
if ((retval = icom_get_freq(rig, vfo, &origfreq)) != RIG_OK) return retval;
if ((retval = icom_set_vfo (rig, vfo)) != RIG_OK) return retval;
if ((retval = icom_get_freq(rig, vfo, &otherfreq)) != RIG_OK) return retval;
retval = icom_set_freq (rig, RIG_VFO_CURR, freq);
if (-RIG_ERJCTED == retval)
{
/* band not fitted so swap MAIN & SUB back and give up */
icom_vfo_op(rig, RIG_VFO_CURR, RIG_OP_XCHG);
return retval;
}
else if (retval != RIG_OK) return retval;
if (otherfreq != origfreq)
{
/* swap VFOs back as original was the other one */
icom_set_vfo (rig, RIG_VFO_A == vfo ? RIG_VFO_B : RIG_VFO_A);
}
/* we do not exchange bands back as this is taken to
mean set VFOA/B on MAIN to the specified frequency
as Hamlib does not recognize A on MAIN or B on SUB
etc. This is probably reasonable since we cannot Tx
on SUB */
return retval;
}
/* we changed band to the "third band" which always makes
VFO A current so just make the requested one the
specified frequency as well if it is VFO B. There is no
way of going to the "third band" without changing VFO
A */
if (RIG_VFO_B == vfo) {
if ((retval = icom_set_vfo (rig, vfo)) != RIG_OK) return retval;
retval = icom_set_freq (rig, RIG_VFO_CURR, freq);
icom_set_vfo (rig, RIG_VFO_A);
}
}
else if (RIG_VFO_MAIN == vfo || RIG_VFO_SUB == vfo)
{
if ((retval = icom_set_vfo (rig, vfo)) != RIG_OK) return retval;
if ((retval = icom_get_freq(rig, vfo, &otherfreq)) != RIG_OK) return retval;
retval = icom_set_freq (rig, RIG_VFO_CURR, freq);
if (-RIG_ERJCTED == retval)
{
/* required band is on other of MAIN or SUB */
if ((retval = icom_vfo_op(rig, RIG_VFO_CURR, RIG_OP_XCHG)) != RIG_OK) return retval;
retval = icom_set_freq (rig, RIG_VFO_CURR, freq);
}
else if (retval != RIG_OK) return retval;
if (otherfreq != origfreq)
{
/* started on other of MAIN & SUB so switch back */
icom_set_vfo (rig,
RIG_VFO_MAIN == vfo ?
RIG_VFO_SUB : RIG_VFO_MAIN);
}
}
else if (RIG_VFO_CURR == vfo)
{
retval = icom_set_freq (rig, RIG_VFO_CURR, freq);
if (-RIG_ERJCTED == retval)
{
/* exchange MAIN & SUB */
if ((retval = icom_vfo_op(rig, RIG_VFO_CURR, RIG_OP_XCHG)) != RIG_OK) return retval;
retval = icom_set_freq (rig, RIG_VFO_CURR, freq);
if (-RIG_ERJCTED == retval)
{
/* band not fitted so swap MAIN & SUB back and give up */
icom_vfo_op(rig, RIG_VFO_CURR, RIG_OP_XCHG);
return retval;
}
}
}
else retval = -RIG_EVFO;
}
return retval;
}
static int ic910_set_freq(RIG* rig, vfo_t vfo, freq_t freq)
{
int retval;
freq_t otherfreq;
freq_t oldfreq;
static int ic910_get_freq(RIG *rig, vfo_t vfo, freq_t * freq)
{
int retval;
freq_t origfreq;
if (vfo==RIG_VFO_CURR) {
/* try to detect active subband */
retval=icom_get_freq(rig, RIG_VFO_CURR, &oldfreq);
if (retval!=RIG_OK) return retval;
icom_set_vfo(rig, RIG_VFO_SUB);
retval=icom_get_freq(rig, RIG_VFO_CURR, &otherfreq);
if (retval!=RIG_OK) return retval;
if (otherfreq == oldfreq) {
/* were already in subband */
vfo = RIG_VFO_SUB;
icom_set_vfo(rig, RIG_VFO_MAIN);
retval=icom_get_freq(rig, RIG_VFO_CURR, &otherfreq);
if (retval!=RIG_OK) return retval;
} else {
/* we were in mainband */
vfo = RIG_VFO_MAIN;
}
} else {
/* get the freq of the other band */
if (vfo==RIG_VFO_MAIN)
icom_set_vfo(rig, RIG_VFO_SUB);
else
icom_set_vfo(rig, RIG_VFO_MAIN);
retval=icom_get_freq(rig, RIG_VFO_CURR, &otherfreq);
if (retval!=RIG_OK) return retval;
/* start off by reading the current VFO frequency */
if ((retval = icom_get_freq(rig, RIG_VFO_CURR, &origfreq)) != RIG_OK) return retval;
if (RIG_VFO_A == vfo || RIG_VFO_B == vfo) {
/* switch to desired VFO and read its frequency */
if ((retval = icom_set_vfo (rig, vfo)) != RIG_OK) return retval;
if ((retval = icom_get_freq(rig, vfo, freq)) != RIG_OK) return retval;
if (*freq != origfreq) {
/* swap VFOs back as original was the other one */
icom_set_vfo (rig, RIG_VFO_A == vfo ? RIG_VFO_B : RIG_VFO_A);
}
}
if (compareFrequencies(rig, freq, otherfreq) == 0)
icom_swap_bands(rig);
icom_set_vfo(rig, vfo);
return icom_set_freq(rig, RIG_VFO_CURR, freq);
}
else if (RIG_VFO_MAIN == vfo || RIG_VFO_SUB == vfo) {
/* switch to the desired of MAIN and SUB and read its frequency */
if ((retval = icom_set_vfo (rig, vfo)) != RIG_OK) return retval;
if ((retval = icom_get_freq(rig, vfo, freq)) != RIG_OK) return retval;
if (*freq != origfreq) {
/* started on a different so switch back MAIN or SUB */
icom_set_vfo (rig, RIG_VFO_MAIN == vfo ? RIG_VFO_SUB : RIG_VFO_MAIN);
}
}
else if (RIG_VFO_CURR == vfo) {
*freq = origfreq;
}
else retval = -RIG_EVFO;
return retval;
}
/*
* This function does the special bandwidth coding for IC-910
* (1 - normal, 2 - narrow)
*/
static int ic910_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width,
unsigned char *md, signed char *pd)
unsigned char *md, signed char *pd)
{
int err;
int err;
err = rig2icom_mode(rig, mode, width, md, pd);
err = rig2icom_mode(rig, mode, width, md, pd);
if (*pd == PD_NARROW_3)
*pd = PD_NARROW_2;
if (*pd == PD_NARROW_3)
*pd = PD_NARROW_2;
return err;
return err;
}
@ -237,132 +319,141 @@ static int ic910_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width,
RIG_LEVEL_ATT| \
RIG_LEVEL_PREAMP)
#define IC910_STR_CAL UNKNOWN_IC_STR_CAL /* FIXME */
#define IC910_STR_CAL UNKNOWN_IC_STR_CAL /* FIXME */
/*
*/
static const struct icom_priv_caps ic910_priv_caps = {
0x60, /* default address */
0, /* 731 mode */
ic910_ts_sc_list,
.r2i_mode = ic910_r2i_mode
0x60, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic910_ts_sc_list,
.r2i_mode = ic910_r2i_mode
};
const struct rig_caps ic910_caps = {
.rig_model = RIG_MODEL_IC910,
.model_name = "IC-910",
.mfg_name = "Icom",
.version = BACKEND_VER ".1",
.copyright = "LGPL",
.status = RIG_STATUS_BETA,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_NONE,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 300,
.serial_rate_max = 19200,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.retry = 3,
.has_get_func = IC910_FUNC_ALL,
.has_set_func = IC910_FUNC_ALL | RIG_FUNC_RESUME,
.has_get_level = IC910_LEVEL_ALL | (RIG_LEVEL_RAWSTR),
.has_set_level = IC910_LEVEL_ALL,
.has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE,
.level_gran = {
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } },
},
.parm_gran = {},
.ctcss_list = NULL,
.dcs_list = NULL,
.preamp = {20, RIG_DBLST_END, },
.attenuator = {20, RIG_DBLST_END, },
.max_rit = Hz(0), /* SSB,CW: +-1.0kHz FM: +-5.0kHz */
.max_xit = Hz(0),
.max_ifshift = Hz(0), /* 1.2kHz manual knob */
.targetable_vfo = 0,
.vfo_ops = IC910_VFO_OPS,
.scan_ops = IC910_SCAN_OPS,
.transceive = RIG_TRN_RIG,
.bank_qty = 0,
.chan_desc_sz = 0,
.rig_model = RIG_MODEL_IC910,
.model_name = "IC-910",
.mfg_name = "Icom",
.version = BACKEND_VER ".1",
.copyright = "LGPL",
.status = RIG_STATUS_BETA,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_NONE,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 300,
.serial_rate_max = 19200,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 1000,
.retry = 3,
.has_get_func = IC910_FUNC_ALL,
.has_set_func = IC910_FUNC_ALL | RIG_FUNC_RESUME,
.has_get_level = IC910_LEVEL_ALL | (RIG_LEVEL_RAWSTR),
.has_set_level = IC910_LEVEL_ALL,
.has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE,
.level_gran = {
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } },
},
.parm_gran = {},
.ctcss_list = NULL,
.dcs_list = NULL,
.preamp = { 20, RIG_DBLST_END, },
.attenuator = { 20, RIG_DBLST_END, },
.max_rit = Hz(0), /* SSB,CW: +-1.0kHz FM: +-5.0kHz */
.max_xit = Hz(0),
.max_ifshift = Hz(0), /* 1.2kHz manual knob */
.targetable_vfo = RIG_TARGETABLE_FREQ,
.vfo_ops = IC910_VFO_OPS,
.scan_ops = IC910_SCAN_OPS,
.transceive = RIG_TRN_RIG,
.bank_qty = 0,
.chan_desc_sz = 0,
.chan_list = {
.chan_list = {
{ 1, 99, RIG_MTYPE_MEM },
{ 100, 105, RIG_MTYPE_EDGE },
{ 106, 106, RIG_MTYPE_CALL },
RIG_CHAN_END, },
RIG_CHAN_END,
},
.rx_range_list1 = { /* USA */
{MHz(144),MHz(148),IC910_MODES,-1,-1,IC910_VFO_ALL},
{MHz(430),MHz(450),IC910_MODES,-1,-1,IC910_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list1 = {
{MHz(144),MHz(148),IC910_MODES,W(5),W(100),IC910_VFO_ALL},
{MHz(430),MHz(450),IC910_MODES,W(5),W(75),IC910_VFO_ALL},
RIG_FRNG_END, },
.rx_range_list1 = { /* USA */
{MHz(144), MHz(148), IC910_MODES, -1, -1, IC910_VFO_ALL},
{MHz(430), MHz(450), IC910_MODES, -1, -1, IC910_VFO_ALL},
{MHz(1240), MHz(1300), IC910_MODES, -1, -1, IC910_VFO_ALL},
RIG_FRNG_END,
},
.tx_range_list1 = {
{MHz(144), MHz(148), IC910_MODES, W(5), W(100), IC910_VFO_ALL},
{MHz(430), MHz(450), IC910_MODES, W(5), W(75), IC910_VFO_ALL},
{MHz(1240), MHz(1300), IC910_MODES, -1, -1, IC910_VFO_ALL},
RIG_FRNG_END,
},
.rx_range_list2 = { /* Europe */
{MHz(144),MHz(146),IC910_MODES,-1,-1,IC910_VFO_ALL},
{MHz(430),MHz(440),IC910_MODES,-1,-1,IC910_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list2 = {
{MHz(144),MHz(146),IC910_MODES,W(5),W(100),IC910_VFO_ALL},
{MHz(430),MHz(440),IC910_MODES,W(5),W(75),IC910_VFO_ALL},
RIG_FRNG_END, },
.rx_range_list2 = { /* Europe */
{MHz(144), MHz(146), IC910_MODES, -1, -1, IC910_VFO_ALL},
{MHz(430), MHz(440), IC910_MODES, -1, -1, IC910_VFO_ALL},
{MHz(1240), MHz(1300), IC910_MODES, -1, -1, IC910_VFO_ALL},
RIG_FRNG_END,
},
.tx_range_list2 = {
{MHz(144), MHz(146), IC910_MODES, W(5), W(100), IC910_VFO_ALL},
{MHz(430), MHz(440), IC910_MODES, W(5), W(75), IC910_VFO_ALL},
{MHz(1240), MHz(1300), IC910_MODES, -1, -1, IC910_VFO_ALL},
RIG_FRNG_END,
},
.tuning_steps = {
{RIG_MODE_SSB|RIG_MODE_CW,1},
{RIG_MODE_SSB|RIG_MODE_CW,10},
{RIG_MODE_SSB|RIG_MODE_CW,50},
{RIG_MODE_SSB|RIG_MODE_CW,100},
{RIG_MODE_FM,kHz(0.1)},
{RIG_MODE_FM,kHz(5)},
{RIG_MODE_FM,kHz(6.25)},
{RIG_MODE_FM,kHz(10)},
{RIG_MODE_FM,kHz(12.5)},
{RIG_MODE_FM,kHz(20)},
{RIG_MODE_FM,kHz(25)},
{RIG_MODE_FM,kHz(100)},
RIG_TS_END, },
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_CW | RIG_MODE_SSB, kHz(2.3)}, /* builtin */
{RIG_MODE_CW, Hz(600)}, /* with optional FL-132/Fl133 CW filters */
{RIG_MODE_FM, kHz(15)}, /* builtin */
{RIG_MODE_FM, kHz(6)}, /* builtin */
RIG_FLT_END, },
.str_cal = IC910_STR_CAL,
.tuning_steps = {
{RIG_MODE_SSB | RIG_MODE_CW, 1},
{RIG_MODE_SSB | RIG_MODE_CW, 10},
{RIG_MODE_SSB | RIG_MODE_CW, 50},
{RIG_MODE_SSB | RIG_MODE_CW, 100},
{RIG_MODE_FM, kHz(0.1)},
{RIG_MODE_FM, kHz(5)},
{RIG_MODE_FM, kHz(6.25)},
{RIG_MODE_FM, kHz(10)},
{RIG_MODE_FM, kHz(12.5)},
{RIG_MODE_FM, kHz(20)},
{RIG_MODE_FM, kHz(25)},
{RIG_MODE_FM, kHz(100)},
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_CW | RIG_MODE_SSB, kHz(2.3)}, /* builtin */
{RIG_MODE_CW, Hz(600)}, /* with optional FL-132/Fl133 CW filters */
{RIG_MODE_FM, kHz(15)}, /* builtin */
{RIG_MODE_FM, kHz(6)}, /* builtin */
RIG_FLT_END,
},
.str_cal = IC910_STR_CAL,
.priv = (void*)&ic910_priv_caps,
.rig_init = icom_init,
.rig_cleanup = icom_cleanup,
.rig_open = NULL,
.rig_close = NULL,
.priv = &ic910_priv_caps,
.rig_init = icom_init,
.rig_cleanup = icom_cleanup,
.cfgparams = icom_cfg_params,
.set_conf = icom_set_conf,
.get_conf = icom_get_conf,
.cfgparams = icom_cfg_params,
.set_conf = icom_set_conf,
.get_conf = icom_get_conf,
.get_freq = icom_get_freq,
.set_freq = ic910_set_freq,
.get_freq = ic910_get_freq,
.set_freq = ic910_set_freq,
#ifdef HAVE_WEIRD_IC910_MODES
.get_mode = ic910_get_mode,
.set_mode = ic910_set_mode,
.get_mode = ic910_get_mode,
.set_mode = ic910_set_mode,
#else
.get_mode = icom_get_mode,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode,
#endif
.get_vfo = NULL,
.set_vfo = icom_set_vfo,
.get_ts = icom_get_ts,
.set_ts = icom_set_ts,
@ -381,6 +472,8 @@ const struct rig_caps ic910_caps = {
.get_split_freq = icom_get_split_freq,
.set_split_mode = icom_set_split_mode,
.get_split_mode = icom_get_split_mode,
.set_split_freq_mode = icom_set_split_freq_mode,
.get_split_freq_mode = icom_get_split_freq_mode,
};
/* end of file */

Wyświetl plik

@ -97,6 +97,7 @@
static const struct icom_priv_caps ic9100_priv_caps = {
0x7c, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic910_ts_sc_list, /* FIXME */
};
@ -108,7 +109,7 @@ const struct rig_caps ic9100_caps = {
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_NONE,
.ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 300,
@ -119,7 +120,7 @@ const struct rig_caps ic9100_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC9100_FUNC_ALL,
.has_set_func = IC9100_FUNC_ALL | RIG_FUNC_RESUME,
@ -222,8 +223,8 @@ const struct rig_caps ic9100_caps = {
.get_freq = icom_get_freq,
.set_freq = icom_set_freq,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode_with_data,
.get_vfo = NULL,
.set_vfo = icom_set_vfo,
@ -261,6 +262,7 @@ const struct rig_caps ic9100_caps = {
.get_dcd = icom_get_dcd,
.decode_event = icom_decode_event,
.set_split_vfo = icom_set_split_vfo,
.get_split_vfo = icom_get_split_vfo,
.set_split_freq = icom_set_split_freq,
.get_split_freq = icom_get_split_freq,
.set_split_mode = icom_set_split_mode,

Wyświetl plik

@ -89,6 +89,7 @@ const struct ts_sc_list ic92d_ts_sc_list[] = {
static const struct icom_priv_caps ic92d_priv_caps = {
0x01, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic92d_ts_sc_list,
.serial_full_duplex = 1
};
@ -112,7 +113,7 @@ const struct rig_caps ic92d_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = IC92D_FUNC_ALL,
.has_set_func = IC92D_FUNC_ALL,

Wyświetl plik

@ -44,6 +44,7 @@
static const struct icom_priv_caps ic970_priv_caps = {
0x2e, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -66,7 +67,7 @@ const struct rig_caps ic970_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_NONE,

Wyświetl plik

@ -1,6 +1,6 @@
/*
* Hamlib CI-V backend - main file
* Copyright (c) 2000-2012 by Stephane Fillod
* Copyright (c) 2000-2015 by Stephane Fillod
*
*
* This library is free software; you can redistribute it and/or
@ -220,6 +220,19 @@ const struct ts_sc_list ic7200_ts_sc_list[] = {
{ 0, 0 },
};
const struct ts_sc_list ic7300_ts_sc_list[] = {
{ 10, 0x00 }, /* Manual says "Send/read the tuning step OFF" */
{ 100, 0x01 },
{ kHz(1), 0x02 },
{ kHz(5), 0x03 },
{ kHz(9), 0x04 },
{ kHz(10), 0x05 },
{ kHz(12.5), 0x06 },
{ kHz(20), 0x07 },
{ kHz(25), 0x08 },
{ 0, 0 },
};
const struct ts_sc_list ic910_ts_sc_list[] = {
{ Hz(1), 0x00 },
{ Hz(10), 0x01 },
@ -255,6 +268,7 @@ struct icom_addr {
#define TOK_CIVADDR TOKEN_BACKEND(1)
#define TOK_MODE731 TOKEN_BACKEND(2)
#define TOK_NOXCHG TOKEN_BACKEND(3)
const struct confparams icom_cfg_params[] = {
{ TOK_CIVADDR, "civaddr", "CI-V address", "Transceiver's CI-V address",
@ -264,6 +278,9 @@ const struct confparams icom_cfg_params[] = {
"data length, needed for IC731 and IC735",
"0", RIG_CONF_CHECKBUTTON
},
{ TOK_NOXCHG, "no_xchg", "No VFO XCHG", "Don't Use VFO XCHG to set other VFO mode and Frequency",
"0", RIG_CONF_CHECKBUTTON
},
{ RIG_CONF_END, NULL, }
};
@ -361,7 +378,7 @@ int icom_init(RIG *rig)
priv_caps = (const struct icom_priv_caps *) caps->priv;
priv = (struct icom_priv_data*)malloc(sizeof(struct icom_priv_data));
priv = (struct icom_priv_data*)calloc(1, sizeof(struct icom_priv_data));
if (!priv) {
/* whoops! memory shortage! */
return -RIG_ENOMEM;
@ -378,6 +395,7 @@ int icom_init(RIG *rig)
priv->re_civ_addr = priv_caps->re_civ_addr;
priv->civ_731_mode = priv_caps->civ_731_mode;
priv->no_xchg = priv_caps->no_xchg;
return RIG_OK;
}
@ -529,83 +547,91 @@ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode) {
int retval, res_len, rfstatus;
unsigned char resbuf[MAXFRAMELEN];
value_t rfwidth;
unsigned char fw_sub_cmd = RIG_MODEL_IC7200 == rig->caps->rig_model ? 0x02 : S_MEM_FILT_WDTH;
struct icom_priv_data * priv = (struct icom_priv_data*)rig->state.priv;
if (rig_has_get_func(rig, RIG_FUNC_RF) && (mode & (RIG_MODE_RTTY | RIG_MODE_RTTYR))) {
if(!rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_RF, &rfstatus) && (rfstatus)) {
retval = rig_get_ext_parm (rig, TOK_RTTY_FLTR, &rfwidth);
if (retval != RIG_OK || rfwidth.i >= RTTY_FIL_NB)
return 0; /* use default */
else
return rtty_fil[rfwidth.i];
if(!rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_RF, &rfstatus) && (rfstatus)) {
retval = rig_get_ext_parm (rig, TOK_RTTY_FLTR, &rfwidth);
if (retval != RIG_OK || rfwidth.i >= RTTY_FIL_NB)
return 0; /* use default */
else
return rtty_fil[rfwidth.i];
}
}
retval = icom_transaction (rig, C_CTL_MEM, S_MEM_FILT_WDTH, 0, 0,
resbuf, &res_len);
if (priv->no_1a_03_cmd) return 0;
retval = icom_transaction (rig, C_CTL_MEM, fw_sub_cmd, 0, 0,
resbuf, &res_len);
if (-RIG_ERJCTED == retval) {
priv->no_1a_03_cmd = -1; /* do not keep asking */
return 0;
}
if (retval != RIG_OK) {
rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), "
"len=%d\n", __FUNCTION__,resbuf[0],res_len);
return 0; /* use default */
"len=%d\n", __FUNCTION__,resbuf[0],res_len);
return 0; /* use default */
}
if (res_len == 3 && resbuf[0] == C_CTL_MEM) {
int i;
i = (int) from_bcd(resbuf + 2, 2);
if (mode & RIG_MODE_AM)
return (i + 1)* 200; /* Ic_7800 */
return (i + 1)* 200; /* Ic_7800 */
else if (mode & (RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_RTTY | RIG_MODE_RTTYR))
return i < 10 ? (i+1) * 50 : (i -4) * 100;
return i < 10 ? (i+1) * 50 : (i -4) * 100;
}
return 0;
}
int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width) {
int retval, rfstatus, i;
unsigned char ackbuf[MAXFRAMELEN];
unsigned char flt_ext;
value_t rfwidth;
int ack_len=sizeof(ackbuf), flt_idx;
unsigned char fw_sub_cmd = RIG_MODEL_IC7200 == rig->caps->rig_model ? 0x02 : S_MEM_FILT_WDTH;
if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode);
if (RIG_PASSBAND_NOCHANGE == width) return RIG_OK;
if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode);
if (rig_has_get_func(rig, RIG_FUNC_RF) && (mode & (RIG_MODE_RTTY | RIG_MODE_RTTYR))) {
if(!rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_RF, &rfstatus) && (rfstatus)) {
for (i=0; i<RTTY_FIL_NB; i++) {
if (rtty_fil[i] == width) {
rfwidth.i = i;
return rig_set_ext_parm (rig, TOK_RTTY_FLTR, rfwidth);
}
}
/* not found */
return -RIG_EINVAL;
}
for (i=0; i<RTTY_FIL_NB; i++) {
if (rtty_fil[i] == width) {
rfwidth.i = i;
return rig_set_ext_parm (rig, TOK_RTTY_FLTR, rfwidth);
}
}
/* not found */
return -RIG_EINVAL;
}
}
if (mode & RIG_MODE_AM)
flt_idx = (width/200)-1; /* TBC: Ic_7800? */
else if (mode & (RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_RTTY | RIG_MODE_RTTYR)) {
if (width == 0)
width = 1;
flt_idx = width <= 500 ? ((width+49)/50)-1 : ((width+99)/100)+4;
} else
return RIG_OK;
if (mode & RIG_MODE_AM)
flt_idx = (width/200)-1; /* TBC: Ic_7800? */
else if (mode & (RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_RTTY | RIG_MODE_RTTYR)) {
if (width == 0)
width = 1;
flt_idx = width <= 500 ? ((width+49)/50)-1 : ((width+99)/100)+4;
} else
return RIG_OK;
to_bcd(&flt_ext, flt_idx, 2);
to_bcd(&flt_ext, flt_idx, 2);
retval = icom_transaction (rig, C_CTL_MEM, S_MEM_FILT_WDTH, &flt_ext, 1,
ackbuf, &ack_len);
retval = icom_transaction (rig, C_CTL_MEM, fw_sub_cmd, &flt_ext, 1,
ackbuf, &ack_len);
if (retval != RIG_OK) {
rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), "
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
return retval;
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
return retval;
}
if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"%s: command not supported ? (%#.2x), "
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
return retval;
}
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
return retval;
}
return RIG_OK;
}
@ -620,6 +646,7 @@ int icom_set_mode_with_data (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width
unsigned char ackbuf[MAXFRAMELEN];
int ack_len=sizeof(ackbuf);
rmode_t icom_mode;
unsigned char dm_sub_cmd = RIG_MODEL_IC7200 == rig->caps->rig_model ? 0x04 : S_MEM_DATA_MODE;
switch (mode)
{
@ -634,29 +661,31 @@ int icom_set_mode_with_data (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width
if (RIG_OK == retval)
{
if (RIG_MODE_PKTUSB == mode || RIG_MODE_PKTLSB == mode || RIG_MODE_PKTFM == mode)
{
datamode = 0x01;
}
{
datamode = 0x01; /* some rigs (e.g. IC-7700 & IC-7800)
have D1/2/3 but we cannot know
which to set so just set D1 */
}
else
{
datamode = 0x00;
}
{
datamode = 0x00;
}
retval = icom_transaction (rig, C_CTL_MEM, S_MEM_DATA_MODE, &datamode, 1,
ackbuf, &ack_len);
retval = icom_transaction (rig, C_CTL_MEM, dm_sub_cmd, &datamode, 1,
ackbuf, &ack_len);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), "
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
}
{
rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), "
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
}
else
{
if (ack_len != 1 || ackbuf[0] != ACK)
{
rig_debug(RIG_DEBUG_ERR,"%s: command not supported ? (%#.2x), "
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
}
}
{
if (ack_len != 1 || ackbuf[0] != ACK)
{
rig_debug(RIG_DEBUG_ERR,"%s: command not supported ? (%#.2x), "
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
}
}
}
return retval;
@ -682,12 +711,12 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
priv_caps = (const struct icom_priv_caps *) rig->caps->priv;
if (priv_caps->r2i_mode != NULL) { /* call priv code if defined */
err = priv_caps->r2i_mode(rig, mode, width,
&icmode, &icmode_ext);
err = priv_caps->r2i_mode(rig, mode, width,
&icmode, &icmode_ext);
}
else { /* else call default */
err = rig2icom_mode(rig, mode, width,
&icmode, &icmode_ext);
&icmode, &icmode_ext);
}
if (err < 0)
@ -702,24 +731,24 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
icmode_ext = -1;
retval = icom_transaction (rig, C_SET_MODE, icmode, (unsigned char *) &icmode_ext,
(icmode_ext == -1 ? 0 : 1), ackbuf, &ack_len);
(icmode_ext == -1 ? 0 : 1), ackbuf, &ack_len);
if (retval != RIG_OK)
return retval;
if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_set_mode: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len);
"len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED;
}
#if 0
/* Tentative DSP filter setting ($1A$03), but not supported by every rig,
* and some models like IC910/Omni VI Plus have a different meaning for
* this subcommand
*/
/* Tentative DSP filter setting ($1A$03), but not supported by every rig,
* and some models like IC910/Omni VI Plus have a different meaning for
* this subcommand
*/
if ( (rig->caps->rig_model != RIG_MODEL_IC910) &&
(rig->caps->rig_model != RIG_MODEL_OMNIVIP) )
icom_set_dsp_flt(rig, mode, width);
(rig->caps->rig_model != RIG_MODEL_OMNIVIP) )
icom_set_dsp_flt(rig, mode, width);
#endif
return RIG_OK;
@ -734,6 +763,7 @@ int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width
{
unsigned char databuf[MAXFRAMELEN];
int data_len, retval;
unsigned char dm_sub_cmd = RIG_MODEL_IC7200 == rig->caps->rig_model ? 0x04 : S_MEM_DATA_MODE;
retval = icom_get_mode (rig, vfo, mode, width);
@ -742,42 +772,42 @@ int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width
/*
* fetch data mode on/off
*/
retval = icom_transaction (rig, C_CTL_MEM, S_MEM_DATA_MODE, 0, 0,
databuf, &data_len);
retval = icom_transaction (rig, C_CTL_MEM, dm_sub_cmd, 0, 0,
databuf, &data_len);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), "
"len=%d\n", __FUNCTION__, databuf[0], data_len);
return -RIG_ERJCTED;
}
{
rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), "
"len=%d\n", __FUNCTION__, databuf[0], data_len);
return -RIG_ERJCTED;
}
/*
* databuf should contain Cn,Sc,D0[,D1]
*/
data_len -= 2;
if (1 > data_len || data_len > 2) /* manual says 1 byte answer
but at least IC756 ProIII
sends 2 - second byte
appears to be same as
second byte from 04 command
which is filter preset
number, whatever it is we
ignore it */
{
rig_debug(RIG_DEBUG_ERR,"%s: wrong frame len=%d\n",
__FUNCTION__, data_len);
return -RIG_ERJCTED;
}
if (0x01 == databuf[2]) /* 0x01 -> data mode, 0x00 -> not data mode */
{
switch (*mode)
{
case RIG_MODE_USB: *mode = RIG_MODE_PKTUSB; break;
case RIG_MODE_LSB: *mode = RIG_MODE_PKTLSB; break;
case RIG_MODE_FM: *mode = RIG_MODE_PKTFM; break;
default: break;
}
}
but at least IC756 ProIII
sends 2 - second byte
appears to be same as
second byte from 04 command
which is filter preset
number, whatever it is we
ignore it */
{
rig_debug(RIG_DEBUG_ERR,"%s: wrong frame len=%d\n",
__FUNCTION__, data_len);
return -RIG_ERJCTED;
}
if (databuf[2]) /* 0x01/0x02/0x03 -> data mode, 0x00 -> not data mode */
{
switch (*mode)
{
case RIG_MODE_USB: *mode = RIG_MODE_PKTUSB; break;
case RIG_MODE_LSB: *mode = RIG_MODE_PKTLSB; break;
case RIG_MODE_FM: *mode = RIG_MODE_PKTFM; break;
default: break;
}
}
}
return retval;
}
@ -838,7 +868,6 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
unsigned char ackbuf[MAXFRAMELEN];
int ack_len=sizeof(ackbuf), icvfo, retval;
if (vfo == RIG_VFO_CURR)
return RIG_OK;
@ -927,6 +956,16 @@ int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
break;
}
}
if (rig->caps->rig_model == RIG_MODEL_IC7300) {
switch (level) {
case RIG_LEVEL_KEYSPD:
if (val.i < 6) val.i = 6;
if (val.i > 48) val.i = 48;
icom_val = (val.i-6)*(255/42.0)+.99;
default:
break;
}
}
/*
* Most of the time, the data field is a 3 digit BCD,
@ -1331,6 +1370,13 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
break;
}
}
else if ((rig->caps->rig_model == RIG_MODEL_IC7300)&&(level==RIG_LEVEL_KEYSPD)){
switch (level) {
case RIG_LEVEL_KEYSPD:
val->i = val->i*(42.0/255)+6+.5;
break;
}
}
rig_debug(RIG_DEBUG_TRACE,"icom_get_level: %d %d %d %f\n", lvl_len,
icom_val, val->i, val->f);
@ -1359,6 +1405,9 @@ int icom_set_conf(RIG *rig, token_t token, const char *val)
case TOK_MODE731:
priv->civ_731_mode = atoi(val) ? 1:0;
break;
case TOK_NOXCHG:
priv->no_xchg = atoi(val) ? 1:0;
break;
default:
return -RIG_EINVAL;
}
@ -1385,6 +1434,9 @@ int icom_get_conf(RIG *rig, token_t token, char *val)
case TOK_MODE731:
sprintf(val, "%d", priv->civ_731_mode);
break;
case TOK_NOXCHG:
sprintf(val, "%d", priv->no_xchg);
break;
default:
return -RIG_EINVAL;
}
@ -1632,7 +1684,8 @@ static int get_split_vfos(const RIG *rig, vfo_t *rx_vfo, vfo_t *tx_vfo)
{
if ((rig->state.vfo_list & (RIG_VFO_A|RIG_VFO_B)) == (RIG_VFO_A|RIG_VFO_B)) {
*rx_vfo = RIG_VFO_A;
*tx_vfo = RIG_VFO_B;
*tx_vfo = RIG_VFO_B; /* rig doesn't enforce this but
convention is needed here */
} else if ((rig->state.vfo_list & (RIG_VFO_MAIN|RIG_VFO_SUB)) == (RIG_VFO_MAIN|RIG_VFO_SUB)) {
*rx_vfo = RIG_VFO_MAIN;
*tx_vfo = RIG_VFO_SUB;
@ -1646,143 +1699,158 @@ static int get_split_vfos(const RIG *rig, vfo_t *rx_vfo, vfo_t *tx_vfo)
* icom_set_split_freq
* Assumes rig!=NULL, rig->state.priv!=NULL,
* icom_set_vfo,icom_set_freq works for this rig
* FIXME: status
*
* Assumes also that the current VFO is the rx VFO.
*/
int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
{
int status;
int rc;
vfo_t rx_vfo, tx_vfo;
struct icom_priv_data *priv;
struct rig_state *rs;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len=sizeof(ackbuf);
rs = &rig->state;
priv = (struct icom_priv_data*)rs->priv;
/* This method works also in memory mode(RIG_VFO_MEM) */
if (rig_has_vfo_op(rig, RIG_OP_XCHG)) {
status = icom_vfo_op(rig, vfo, RIG_OP_XCHG);
if (status != RIG_OK)
return status;
status = icom_set_freq(rig, RIG_VFO_CURR, tx_freq);
if (status != RIG_OK)
return status;
status = icom_vfo_op(rig, vfo, RIG_OP_XCHG);
if (status != RIG_OK)
return status;
return 0;
if (!priv->no_xchg && rig_has_vfo_op(rig, RIG_OP_XCHG)) {
if (RIG_OK != (rc = icom_vfo_op(rig, vfo, RIG_OP_XCHG))) return rc;
if (RIG_OK != (rc = icom_set_freq(rig, RIG_VFO_CURR, tx_freq))) return rc;
if (RIG_OK != (rc = icom_vfo_op(rig, vfo, RIG_OP_XCHG))) return rc;
return rc;
}
status = get_split_vfos(rig, &rx_vfo, &tx_vfo);
if (status != RIG_OK)
return status;
status = icom_set_vfo(rig, tx_vfo);
if (status != RIG_OK)
return status;
status = icom_set_freq(rig, RIG_VFO_CURR, tx_freq);
if (status != RIG_OK)
return status;
status = icom_set_vfo(rig, rx_vfo);
if (status != RIG_OK)
return status;
return status;
/* In the case of rigs with an A/B VFO arrangement we assume the
current VFO is VFO A and the split Tx VFO is always VFO B. These
assumptions allow us to deal with the lack of VFO and split
queries */
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) { /* broken if user changes split on rig :( */
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc;
if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_set_split_freq: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED;
}
}
if (RIG_OK != (rc = get_split_vfos(rig, &rx_vfo, &tx_vfo))) return rc;
if (RIG_OK != (rc = icom_set_vfo(rig, tx_vfo))) return rc;
if (RIG_OK != (rc = rig_set_freq(rig, RIG_VFO_CURR, tx_freq))) return rc;
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) return rc;
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) {
/* Re-enable split */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf, &ack_len))) return rc;
}
return rc;
}
/*
* icom_get_split_freq
* Assumes rig!=NULL, rig->state.priv!=NULL, rx_freq!=NULL, tx_freq!=NULL
* icom_set_vfo,icom_get_freq works for this rig
* FIXME: status
*/
int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
{
int status;
int rc;
vfo_t rx_vfo, tx_vfo;
struct icom_priv_data *priv;
struct rig_state *rs;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len=sizeof(ackbuf);
rs = &rig->state;
priv = (struct icom_priv_data*)rs->priv;
/* This method works also in memory mode(RIG_VFO_MEM) */
if (rig_has_vfo_op(rig, RIG_OP_XCHG)) {
status = icom_vfo_op(rig, vfo, RIG_OP_XCHG);
if (status != RIG_OK)
return status;
status = icom_get_freq(rig, RIG_VFO_CURR, tx_freq);
if (status != RIG_OK)
return status;
status = icom_vfo_op(rig, vfo, RIG_OP_XCHG);
if (status != RIG_OK)
return status;
return 0;
if (!priv->no_xchg && rig_has_vfo_op(rig, RIG_OP_XCHG)) {
if (RIG_OK != (rc = icom_vfo_op(rig, vfo, RIG_OP_XCHG))) return rc;
if (RIG_OK != (rc = icom_get_freq(rig, RIG_VFO_CURR, tx_freq))) return rc;
if (RIG_OK != (rc = icom_vfo_op(rig, vfo, RIG_OP_XCHG))) return rc;
return rc;
}
status = get_split_vfos(rig, &rx_vfo, &tx_vfo);
if (status != RIG_OK)
return status;
status = icom_set_vfo(rig, tx_vfo);
if (status != RIG_OK)
return status;
status = icom_get_freq(rig, RIG_VFO_CURR, tx_freq);
if (status != RIG_OK)
return status;
status = icom_set_vfo(rig, rx_vfo);
if (status != RIG_OK)
return status;
return status;
/* In the case of rigs with an A/B VFO arrangement we assume the
current VFO is VFO A and the split Tx VFO is always VFO B. These
assumptions allow us to deal with the lack of VFO and split
queries */
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) { /* broken if user changes split on rig :( */
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc;
if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_get_split_freq: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED;
}
}
if (RIG_OK != (rc = get_split_vfos(rig, &rx_vfo, &tx_vfo))) return rc;
if (RIG_OK != (rc = icom_set_vfo(rig, tx_vfo))) return rc;
if (RIG_OK != (rc = icom_get_freq(rig, RIG_VFO_CURR, tx_freq))) return rc;
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) return rc;
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) {
/* Re-enable split */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf, &ack_len))) return rc;
}
return rc;
}
/*
* icom_set_split_mode
* Assumes rig!=NULL, rig->state.priv!=NULL,
* icom_set_vfo,icom_set_mode works for this rig
* FIXME: status
*/
int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)
{
int status;
int rc;
vfo_t rx_vfo, tx_vfo;
struct icom_priv_data *priv;
struct rig_state *rs;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len=sizeof(ackbuf);
rs = &rig->state;
priv = (struct icom_priv_data*)rs->priv;
/* This method works also in memory mode(RIG_VFO_MEM) */
if (rig_has_vfo_op(rig, RIG_OP_XCHG)) {
status = icom_vfo_op(rig, vfo, RIG_OP_XCHG);
if (status != RIG_OK)
return status;
status = rig->caps->set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width);
if (status != RIG_OK)
return status;
status = icom_vfo_op(rig, vfo, RIG_OP_XCHG);
if (status != RIG_OK)
return status;
return 0;
if (!priv->no_xchg && rig_has_vfo_op(rig, RIG_OP_XCHG)) {
if (RIG_OK != (rc = icom_vfo_op(rig, vfo, RIG_OP_XCHG))) return rc;
if (RIG_OK != (rc = rig->caps->set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width))) return rc;
if (RIG_OK != (rc = icom_vfo_op(rig, vfo, RIG_OP_XCHG))) return rc;
return rc;
}
status = get_split_vfos(rig, &rx_vfo, &tx_vfo);
if (status != RIG_OK)
return status;
status = icom_set_vfo(rig, tx_vfo);
if (status != RIG_OK)
return status;
status = rig->caps->set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width);
if (status != RIG_OK)
return status;
status = icom_set_vfo(rig, rx_vfo);
if (status != RIG_OK)
return status;
return status;
/* In the case of rigs with an A/B VFO arrangement we assume the
current VFO is VFO A and the split Tx VFO is always VFO B. These
assumptions allow us to deal with the lack of VFO and split
queries */
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) { /* broken if user changes split on rig :( */
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc;
if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_set_split_mode: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED;
}
}
if (RIG_OK != (rc = get_split_vfos(rig, &rx_vfo, &tx_vfo))) return rc;
if (RIG_OK != (rc = icom_set_vfo(rig, tx_vfo))) return rc;
if (RIG_OK != (rc = rig->caps->set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width))) return rc;
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) return rc;
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) {
/* Re-enable split */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf, &ack_len))) return rc;
}
return rc;
}
/*
@ -1790,47 +1858,157 @@ int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width
* Assumes rig!=NULL, rig->state.priv!=NULL,
* rx_mode!=NULL, rx_width!=NULL, tx_mode!=NULL, tx_width!=NULL
* icom_set_vfo,icom_get_mode works for this rig
* FIXME: status
*/
int icom_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width)
{
int status;
int rc;
vfo_t rx_vfo, tx_vfo;
struct icom_priv_data *priv;
struct rig_state *rs;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len=sizeof(ackbuf);
rs = &rig->state;
priv = (struct icom_priv_data*)rs->priv;
/* This method works also in memory mode(RIG_VFO_MEM) */
if (!priv->no_xchg && rig_has_vfo_op(rig, RIG_OP_XCHG)) {
if (RIG_OK != (rc = icom_vfo_op(rig, vfo, RIG_OP_XCHG))) return rc;
if (RIG_OK != (rc = rig->caps->get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width))) return rc;
if (RIG_OK != (rc = icom_vfo_op(rig, vfo, RIG_OP_XCHG))) return rc;
return rc;
}
/* In the case of rigs with an A/B VFO arrangement we assume the
current VFO is VFO A and the split Tx VFO is always VFO B. These
assumptions allow us to deal with the lack of VFO and split
queries */
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) { /* broken if user changes split on rig :( */
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc;
if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_get_split_mode: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED;
}
}
if (RIG_OK != (rc = get_split_vfos(rig, &rx_vfo, &tx_vfo))) return rc;
if (RIG_OK != (rc = icom_set_vfo(rig, tx_vfo))) return rc;
if (RIG_OK != (rc = rig->caps->get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width))) return rc;
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) return rc;
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) {
/* Re-enable split */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf, &ack_len))) return rc;
}
return rc;
}
/*
* icom_set_split_freq_mode
* Assumes rig!=NULL, rig->state.priv!=NULL,
* icom_set_vfo,icom_set_mode works for this rig
*/
int icom_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t tx_freq, rmode_t tx_mode, pbwidth_t tx_width)
{
int rc;
struct icom_priv_data * priv = (struct icom_priv_data *)rig->state.priv;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len=sizeof(ackbuf);
vfo_t rx_vfo, tx_vfo;
/* This method works also in memory mode(RIG_VFO_MEM) */
if (rig_has_vfo_op(rig, RIG_OP_XCHG)) {
status = icom_vfo_op(rig, vfo, RIG_OP_XCHG);
if (status != RIG_OK)
return status;
status = rig->caps->get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width);
if (status != RIG_OK)
return status;
status = icom_vfo_op(rig, vfo, RIG_OP_XCHG);
if (status != RIG_OK)
return status;
return 0;
if (!priv->no_xchg && rig_has_vfo_op(rig, RIG_OP_XCHG)) {
if (RIG_OK != (rc = icom_vfo_op(rig, vfo, RIG_OP_XCHG))) return rc;
if (RIG_OK != (rc = rig_set_freq(rig, RIG_VFO_CURR, tx_freq))) return rc;
if (RIG_OK != (rc = rig->caps->set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width))) return rc;
if (RIG_OK != (rc = icom_vfo_op(rig, vfo, RIG_OP_XCHG))) return rc;
return rc;
}
status = get_split_vfos(rig, &rx_vfo, &tx_vfo);
if (status != RIG_OK)
return status;
/* In the case of rigs with an A/B VFO arrangement we assume the
current VFO is VFO A and the split Tx VFO is always VFO B. These
assumptions allow us to deal with the lack of VFO and split
queries */
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) { /* broken if user changes split on rig :( */
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc;
if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_set_split_freq_mode: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED;
}
}
if (RIG_OK != (rc = get_split_vfos(rig, &rx_vfo, &tx_vfo))) return rc;
if (RIG_OK != (rc = icom_set_vfo(rig, tx_vfo))) return rc;
if (RIG_OK != (rc = rig_set_freq(rig, RIG_VFO_CURR, tx_freq))) return rc;
if (RIG_OK != (rc = rig->caps->set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width))) return rc;
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) return rc;
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) {
/* Re-enable split */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf, &ack_len))) return rc;
}
return rc;
}
status = icom_set_vfo(rig, tx_vfo);
if (status != RIG_OK)
return status;
/*
* icom_get_split_freq_mode
* Assumes rig!=NULL, rig->state.priv!=NULL,
* rx_mode!=NULL, rx_width!=NULL, tx_mode!=NULL, tx_width!=NULL
* icom_set_vfo,icom_get_mode works for this rig
*/
int icom_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *tx_freq, rmode_t *tx_mode, pbwidth_t *tx_width)
{
int rc;
vfo_t rx_vfo, tx_vfo;
struct icom_priv_data *priv;
struct rig_state *rs;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len=sizeof(ackbuf);
status = rig->caps->get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width);
if (status != RIG_OK)
return status;
rs = &rig->state;
priv = (struct icom_priv_data*)rs->priv;
status = icom_set_vfo(rig, rx_vfo);
if (status != RIG_OK)
return status;
/* This method works also in memory mode(RIG_VFO_MEM) */
if (!priv->no_xchg && rig_has_vfo_op(rig, RIG_OP_XCHG)) {
if (RIG_OK != (rc = icom_vfo_op(rig, vfo, RIG_OP_XCHG))) return rc;
if (RIG_OK != (rc = rig_get_freq(rig, RIG_VFO_CURR, tx_freq))) return rc;
if (RIG_OK != (rc = rig->caps->get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width))) return rc;
if (RIG_OK != (rc = icom_vfo_op(rig, vfo, RIG_OP_XCHG))) return rc;
return rc;
}
return status;
/* In the case of rigs with an A/B VFO arrangement we assume the
current VFO is VFO A and the split Tx VFO is always VFO B. These
assumptions allow us to deal with the lack of VFO and split
queries */
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) { /* broken if user changes split on rig :( */
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc;
if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_get_split_freq_mode: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED;
}
}
if (RIG_OK != (rc = get_split_vfos(rig, &rx_vfo, &tx_vfo))) return rc;
if (RIG_OK != (rc = icom_set_vfo(rig, tx_vfo))) return rc;
if (RIG_OK != (rc = icom_get_freq(rig, RIG_VFO_CURR, tx_freq))) return rc;
if (RIG_OK != (rc = rig->caps->get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width))) return rc;
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) return rc;
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) {
/* Re-enable split */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf, &ack_len))) return rc;
}
return rc;
}
@ -1840,34 +2018,38 @@ int icom_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_wid
*/
int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
struct icom_priv_data * priv = (struct icom_priv_data *)rig->state.priv;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len=sizeof(ackbuf), retval;
int ack_len=sizeof(ackbuf), rc;
int split_sc;
switch (split) {
case RIG_SPLIT_OFF:
split_sc = S_SPLT_OFF;
break;
case RIG_SPLIT_ON:
split_sc = S_SPLT_ON;
if (!priv->split_on) {
/* ensure VFO A is Rx and VFO B is Tx as we assume that elsewhere */
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)) {
if (RIG_OK != (rc = icom_set_vfo(rig, RIG_VFO_A))) return rc;
}
}
break;
default:
rig_debug(RIG_DEBUG_ERR,"%s: Unsupported split %d", __FUNCTION__, split);
return -RIG_EINVAL;
}
retval = icom_transaction (rig, C_CTL_SPLT, split_sc, NULL, 0,
ackbuf, &ack_len);
if (retval != RIG_OK)
return retval;
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, split_sc, NULL, 0,
ackbuf, &ack_len))) return rc;
if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_set_split: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED;
}
priv->split_on = RIG_SPLIT_ON == split;
return RIG_OK;
}
@ -2458,12 +2640,14 @@ int icom_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
caps = rig->caps;
for (i = 0; caps->ctcss_list[i] != 0 && i<52; i++) {
if (caps->ctcss_list[i] == tone)
break;
if (caps->ctcss_list) {
for (i = 0; caps->ctcss_list[i] != 0 && i<52; i++) {
if (caps->ctcss_list[i] == tone)
break;
}
if (caps->ctcss_list[i] != tone)
return -RIG_EINVAL;
}
if (caps->ctcss_list[i] != tone)
return -RIG_EINVAL;
/* Sent as frequency in tenth of Hz */
@ -2512,6 +2696,8 @@ int icom_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
tone_len -= 2;
*tone = from_bcd_be(tonebuf+2, tone_len*2);
if (!caps->ctcss_list) return RIG_OK;
/* check this tone exists. That's better than nothing. */
for (i = 0; caps->ctcss_list[i] != 0 && i<52; i++) {
if (caps->ctcss_list[i] == *tone)
@ -3013,6 +3199,35 @@ int icom_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
return RIG_OK;
}
/*
* icom_send_morse
* Assumes rig!=NULL, msg!=NULL
*/
int icom_send_morse (RIG * rig, vfo_t vfo, const char *msg)
{
unsigned char ackbuf[MAXFRAMELEN];
int ack_len=sizeof(ackbuf), retval;
int len = strlen(msg);
if (len > 30) len=30;
rig_debug(RIG_DEBUG_TRACE,"icom_send_morse: %s\n", msg);
retval = icom_transaction(rig, C_SND_CW, -1, (unsigned char*)msg, len,
ackbuf, &ack_len);
if (retval != RIG_OK)
return retval;
if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_send_morse: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED;
}
return RIG_OK;
}
/*
* icom_decode is called by sa_sigio, when some asynchronous
* data has been received from the rig
@ -3294,6 +3509,7 @@ DECLARE_INITRIG_BACKEND(icom)
rig_register(&ic7000_caps);
rig_register(&ic7100_caps);
rig_register(&ic7200_caps);
rig_register(&ic7300_caps);
rig_register(&ic781_caps);
rig_register(&ic707_caps);
rig_register(&ic728_caps);
@ -3330,7 +3546,8 @@ DECLARE_INITRIG_BACKEND(icom)
rig_register(&ic92d_caps);
rig_register(&id1_caps);
rig_register(&id5100_caps);
rig_register(&ic2730_caps);
return RIG_OK;
}

Wyświetl plik

@ -1,6 +1,6 @@
/*
* Hamlib CI-V backend - main header
* Copyright (c) 2000-2012 by Stephane Fillod
* Copyright (c) 2000-2015 by Stephane Fillod
*
*
* This library is free software; you can redistribute it and/or
@ -98,6 +98,7 @@ typedef struct rig_pltstate {
struct icom_priv_caps {
unsigned char re_civ_addr; /* the remote dlft equipment's CI-V address*/
int civ_731_mode; /* Off: freqs on 10 digits, On: freqs on 8 digits */
int no_xchg; /* Off: use VFO XCHG to set other VFO, On: use set VFO to set other VFO */
const struct ts_sc_list *ts_sc_list;
int settle_time; /*!< Receiver settle time, in ms */
int (*r2i_mode)(RIG *rig, rmode_t mode, pbwidth_t width,
@ -116,6 +117,9 @@ struct icom_priv_caps {
struct icom_priv_data {
unsigned char re_civ_addr; /* the remote equipment's CI-V address*/
int civ_731_mode; /* Off: freqs on 10 digits, On: freqs on 8 digits */
int no_xchg; /* Off: use VFO XCHG to set other VFO, On: use set VFO to set other VFO */
int no_1a_03_cmd; /* rig doesn't tell IF widths */
int split_on; /* record split state */
pltstate_t *pltstate; /* only on optoscan */
};
@ -131,6 +135,7 @@ extern const struct ts_sc_list ic706_ts_sc_list[];
extern const struct ts_sc_list ic7000_ts_sc_list[];
extern const struct ts_sc_list ic7100_ts_sc_list[];
extern const struct ts_sc_list ic7200_ts_sc_list[];
extern const struct ts_sc_list ic7300_ts_sc_list[];
extern const struct ts_sc_list ic910_ts_sc_list[];
extern const struct ts_sc_list ic718_ts_sc_list[];
@ -156,6 +161,8 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq);
int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq);
int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width);
int icom_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width);
int icom_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t tx_freq, rmode_t tx_mode, pbwidth_t tx_width);
int icom_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *tx_freq, rmode_t *tx_mode, pbwidth_t *tx_width);
int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
int icom_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
int icom_mem_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
@ -187,6 +194,7 @@ int icom_get_powerstat(RIG *rig, powerstat_t *status);
int icom_set_ant(RIG * rig, vfo_t vfo, ant_t ant);
int icom_get_ant(RIG * rig, vfo_t vfo, ant_t *ant);
int icom_decode_event(RIG *rig);
int icom_send_morse (RIG * rig, vfo_t vfo, const char *msg);
extern const struct confparams icom_cfg_params[];
@ -221,6 +229,7 @@ extern const struct rig_caps ic7800_caps;
extern const struct rig_caps ic7000_caps;
extern const struct rig_caps ic7100_caps;
extern const struct rig_caps ic7200_caps;
extern const struct rig_caps ic7300_caps;
extern const struct rig_caps ic781_caps;
extern const struct rig_caps ic820h_caps;
extern const struct rig_caps ic821h_caps;
@ -252,5 +261,7 @@ extern const struct rig_caps os535_caps;
extern const struct rig_caps ic92d_caps;
extern const struct rig_caps id1_caps;
extern const struct rig_caps id5100_caps;
extern const struct rig_caps ic2730_caps;
#endif /* _ICOM_H */

Wyświetl plik

@ -303,6 +303,8 @@
/*
* Misc contents (C_CTL_MEM) subcommands applies to newer rigs.
*
* Beware the IC-7200 which is non-standard.
*/
#define S_MEM_CNTNT 0x00 /* Memory content 2 bigendian */
#define S_MEM_BAND_REG 0x01 /* band stacking register */

Wyświetl plik

@ -48,6 +48,7 @@
static const struct icom_priv_caps icr10_priv_caps = {
0x52, /* default address */
0, /* 731 mode */
0, /* no XCHG */
r8500_ts_sc_list /* wrong, but don't have set_ts anyway */
};
@ -70,7 +71,7 @@ const struct rig_caps icr10_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = ICR10_FUNC_ALL,
.has_set_func = ICR10_FUNC_ALL,

Wyświetl plik

@ -52,6 +52,7 @@
static const struct icom_priv_caps icr20_priv_caps = {
0x6c, /* default address */
0, /* 731 mode */
0, /* no XCHG */
r8500_ts_sc_list /* wrong, but don't have set_ts anyway */
};
@ -74,7 +75,7 @@ const struct rig_caps icr20_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = ICR20_FUNC_ALL,
.has_set_func = ICR20_FUNC_ALL,

Wyświetl plik

@ -52,6 +52,7 @@ static int r7000_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
static const struct icom_priv_caps icr7000_priv_caps = {
0x08, /* default address */
0, /* 731 mode */
0, /* no XCHG */
r7100_ts_sc_list
};
/*
@ -76,7 +77,7 @@ const struct rig_caps icr7000_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
@ -161,6 +162,7 @@ const struct rig_caps icr7000_caps = {
static const struct icom_priv_caps icr7100_priv_caps = {
0x34, /* default address */
0, /* 731 mode */
0, /* no XCHG */
r7100_ts_sc_list
};
/*
@ -185,7 +187,7 @@ const struct rig_caps icr7100_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = ICR7100_FUNCS,

Wyświetl plik

@ -43,6 +43,7 @@
static const struct icom_priv_caps icr71_priv_caps = {
0x1a, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list /* none actually */
};
@ -65,7 +66,7 @@ const struct rig_caps icr71_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = ICR71_FUNC_ALL,
.has_set_func = ICR71_FUNC_ALL,

Wyświetl plik

@ -44,6 +44,7 @@
static const struct icom_priv_caps icr72_priv_caps = {
0x32, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic737_ts_sc_list
};
@ -66,7 +67,7 @@ const struct rig_caps icr72_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = ICR72_FUNC_ALL,
.has_set_func = ICR72_FUNC_ALL,

Wyświetl plik

@ -97,6 +97,7 @@ static int icr75_get_channel(RIG *rig, channel_t *chan);
static const struct icom_priv_caps icr75_priv_caps = {
0x5a, /* default address */
0, /* 731 mode */
0, /* no XCHG */
r75_ts_sc_list
};
@ -119,7 +120,7 @@ const struct rig_caps icr75_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 1,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = ICR75_FUNC_ALL,
.has_set_func = ICR75_FUNC_ALL,

Wyświetl plik

@ -65,6 +65,7 @@
static const struct icom_priv_caps icr8500_priv_caps = {
0x4a, /* default address */
0, /* 731 mode */
0, /* no XCHG */
r8500_ts_sc_list
};
/*
@ -89,7 +90,7 @@ const struct rig_caps icr8500_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,

Wyświetl plik

@ -60,6 +60,7 @@
static const struct icom_priv_caps icr9000_priv_caps = {
0x2a, /* default address */
0, /* 731 mode */
0, /* no XCHG */
r9000_ts_sc_list
};

Wyświetl plik

@ -64,6 +64,7 @@
static const struct icom_priv_caps icr9500_priv_caps = {
0x72, /* default address */
0, /* 731 mode */
0, /* no XCHG */
r9500_ts_sc_list
};

Wyświetl plik

@ -48,6 +48,7 @@
static const struct icom_priv_caps icrx7_priv_caps = {
0x78, /* default address */
0, /* 731 mode */
0, /* no XCHG */
r8500_ts_sc_list /* wrong, but don't have set_ts anyway */
};
@ -70,7 +71,7 @@ const struct rig_caps icrx7_caps = {
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.timeout = 1000,
.retry = 3,
.has_get_func = ICRX7_FUNC_ALL,
.has_set_func = ICRX7_FUNC_ALL,

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