diff --git a/hamlib/ChangeLog.txt b/hamlib/ChangeLog.txt new file mode 100644 index 0000000..3f315b5 --- /dev/null +++ b/hamlib/ChangeLog.txt @@ -0,0 +1,12 @@ +For a complete log of changes to Hamlib, please visit: + +http://sourceforge.net/p/hamlib/code/commit_browser + +Major changes in 4.0 affecting usage +Most rig model numbers have changed +RIG_LEVEL_VOX has been deprecated and replaced by RIG_LEVEL_VOXDELAY +rigctl 'f' command now returns VFO argument too +rigctl 'y' and 'Y' command now take/show antenna argument and option. +range_list items are undergoing changes towards a different model TBD +RTS/DTR PTT sharing is off by default now -- use serial_share=1 option to +enable diff --git a/hamlib/LICENSE.txt b/hamlib/LICENSE.txt new file mode 100644 index 0000000..2ae408a --- /dev/null +++ b/hamlib/LICENSE.txt @@ -0,0 +1,57 @@ +Hamlib - Ham Radio Control Libraries + +(C) 2010 Lockless Inc. for winpthreads.h +Copyright (C) 2000,2001 Frank Singleton +Copyright (C) 2000,2001 Stephane Fillod +Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009, + 2010,2011,2012 + The Hamlib Group + +See the included README.md file for more information on Hamlib and the Hamlib +Project or visit http://www.hamlib.org for documentation and links to the +source code of Hamlib. + +The 'AUTHORS' file lists contributors known as the The Hamlib Group. + +The frontend library source code files and associated backend library +source code files are licensed and released under the Lesser GNU Public +License (LGPL): + + 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 + +The included file 'COPYING.LIB' is a copy of the GNU Lesser General +Public License. + + +Various other supplied program source files and example source files are +licensed and released under the GNU Public License (GPL): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +The included file 'COPYING' is a copy of the GNU General Public License. + diff --git a/hamlib/amplifier.h b/hamlib/amplifier.h index d123c70..8a0b076 100644 --- a/hamlib/amplifier.h +++ b/hamlib/amplifier.h @@ -146,7 +146,8 @@ enum amp_level_e AMP_LEVEL_PWR_FWD = (1 << 4), /*!< \c Power reading forward. */ AMP_LEVEL_PWR_REFLECTED = (1 << 5), /*!< \c Power reading reverse. */ AMP_LEVEL_PWR_PEAK = (1 << 6), /*!< \c Power reading peak. */ - AMP_LEVEL_FAULT = (1 << 7) /*!< \c Fault code. */ + AMP_LEVEL_FAULT = (1 << 7), /*!< \c Fault code. */ + AMP_LEVEL_PWR = (1 << 8), /*!< \c Power setting. */ }; //! @endcond @@ -232,6 +233,7 @@ struct amp_caps int (*get_freq)(AMP *amp, freq_t *val); /*!< Pointer to backend implementation of ::amp_get_freq(). */ int (*set_conf)(AMP *amp, token_t token, const char *val); /*!< Pointer to backend implementation of ::amp_set_conf(). */ + int (*get_conf2)(AMP *amp, token_t token, char *val, int val_len); /*!< Pointer to backend implementation of ::amp_get_conf(). */ int (*get_conf)(AMP *amp, token_t token, char *val); /*!< Pointer to backend implementation of ::amp_get_conf(). */ /* @@ -241,7 +243,9 @@ struct amp_caps int (*reset)(AMP *amp, amp_reset_t reset); /*!< Pointer to backend implementation of ::amp_reset(). */ int (*get_level)(AMP *amp, setting_t level, value_t *val); /*!< Pointer to backend implementation of ::amp_get_level(). */ + int (*set_level)(AMP *amp, setting_t level, value_t val); /*!< Pointer to backend implementation of ::amp_get_level(). */ int (*get_ext_level)(AMP *amp, token_t level, value_t *val); /*!< Pointer to backend implementation of ::amp_get_ext_level(). */ + int (*set_ext_level)(AMP *amp, token_t level, value_t val); /*!< Pointer to backend implementation of ::amp_set_ext_level(). */ int (*set_powerstat)(AMP *amp, powerstat_t status); /*!< Pointer to backend implementation of ::amp_set_powerstat(). */ int (*get_powerstat)(AMP *amp, powerstat_t *status); /*!< Pointer to backend implementation of ::amp_get_powerstat(). */ @@ -280,16 +284,18 @@ struct amp_state /* * non overridable fields, internal use */ - hamlib_port_t ampport; /*!< Amplifier port (internal use). */ + hamlib_port_t_deprecated ampport_deprecated; /*!< Amplifier port (internal use). Deprecated */ int comm_state; /*!< Comm port state, opened/closed. */ rig_ptr_t priv; /*!< Pointer to private amplifier state data. */ rig_ptr_t obj; /*!< Internal use by hamlib++ for event handling. */ setting_t has_get_level; /*!< List of get levels. */ + setting_t has_set_level; /*!< List of set levels. */ gran_t level_gran[RIG_SETTING_MAX]; /*!< Level granularity. */ gran_t parm_gran[RIG_SETTING_MAX]; /*!< Parameter granularity. */ + hamlib_port_t ampport; /*!< Amplifier port (internal use). */ }; @@ -364,6 +370,10 @@ amp_get_info HAMLIB_PARAMS((AMP *amp)); extern HAMLIB_EXPORT(int) amp_get_level HAMLIB_PARAMS((AMP *amp, setting_t level, value_t *val)); +extern HAMLIB_EXPORT(int) +amp_set_level HAMLIB_PARAMS((AMP *amp, setting_t level, value_t val)); + + extern HAMLIB_EXPORT(int) amp_register HAMLIB_PARAMS((const struct amp_caps *caps)); @@ -408,6 +418,10 @@ extern HAMLIB_EXPORT(setting_t) amp_has_get_level HAMLIB_PARAMS((AMP *amp, setting_t level)); +extern HAMLIB_EXPORT(setting_t) +amp_has_set_level HAMLIB_PARAMS((AMP *amp, + setting_t level)); + extern HAMLIB_EXPORT(const struct confparams *) amp_ext_lookup HAMLIB_PARAMS((AMP *amp, const char *name)); @@ -417,6 +431,11 @@ amp_get_ext_level HAMLIB_PARAMS((AMP *amp, token_t token, value_t *val)); +extern HAMLIB_EXPORT(int) +amp_set_ext_level HAMLIB_PARAMS((AMP *amp, + token_t token, + value_t val)); + extern HAMLIB_EXPORT(const char *) amp_strlevel(setting_t); extern HAMLIB_EXPORT(const struct confparams *) diff --git a/hamlib/amplist.h b/hamlib/amplist.h index e52f66f..db6d4b5 100644 --- a/hamlib/amplist.h +++ b/hamlib/amplist.h @@ -106,6 +106,10 @@ //! @endcond #define AMP_MODEL_ELECRAFT_KPA1500 AMP_MAKE_MODEL(AMP_ELECRAFT, 1) //#define AMP_MODEL_ELECRAFT_KPA500 AMP_MAKE_MODEL(AMP_ELECRAFT, 2) +#define AMP_GEMINI 3 +#define AMP_BACKEND_GEMINI "gemini" +#define AMP_MODEL_GEMINI_DX1200 AMP_MAKE_MODEL(AMP_GEMINI, 1) + /** * \brief Convenience type definition for an amplifier model. diff --git a/hamlib/config.h b/hamlib/config.h new file mode 100644 index 0000000..2d41861 --- /dev/null +++ b/hamlib/config.h @@ -0,0 +1,551 @@ +/* include/hamlib/config.h. Generated from config.h.in by configure. */ +/* include/hamlib/config.h.in. Generated from configure.ac by autoheader. */ + +/* Frontend ABI age */ +#define ABI_AGE 0 + +/* Frontend ABI revision */ +#define ABI_REVISION 5 + +/* Frontend ABI version */ +#define ABI_VERSION 4 + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +/* #undef HAVE_ALLOCA_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_INET_H */ + +/* Define to 1 if you have the `cfmakeraw' function. */ +/* #undef HAVE_CFMAKERAW */ + +/* define if the compiler supports basic C++11 syntax */ +#define HAVE_CXX11 1 + +/* Define to 1 if you have the declaration of `gai_strerror', and to 0 if you + don't. */ +#define HAVE_DECL_GAI_STRERROR 1 + +/* Define to 1 if you have the header + file. */ +/* #undef HAVE_DEV_PPBUS_PPBCONF_HDEV_PPBUS_PPI_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `floor' function. */ +#define HAVE_FLOOR 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GD_H */ + +/* Define to 1 if you have the `getaddrinfo' function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `getopt' function. */ +#define HAVE_GETOPT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GETOPT_H 1 + +/* Define to 1 if you have the `getopt_long' function. */ +#define HAVE_GETOPT_LONG 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `glob' function. */ +/* #undef HAVE_GLOB */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GLOB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_HISTORY_H */ + +/* Define to 1 if you have the `inet_ntoa' function. */ +/* #undef HAVE_INET_NTOA */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `ioctl' function. */ +/* #undef HAVE_IOCTL */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LAUXLIB_H */ + +/* Define if you have an INDI compatible library */ +/* #undef HAVE_LIBINDI */ + +/* Define if you have a nova compatible library */ +/* #undef HAVE_LIBNOVA */ + +/* Define if you have a readline compatible library */ +/* #undef HAVE_LIBREADLINE */ + +/* Define if libusb-1.0 is available */ +#define HAVE_LIBUSB 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIBUSB_1_0_LIBUSB_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBUSB_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_HIDRAW_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_IOCTL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_PARPORT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_PPDEV_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LUACONF_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LUALIB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LUA_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the `memchr' function. */ +#define HAVE_MEMCHR 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have the `nanosleep' function. */ +#define HAVE_NANOSLEEP 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETDB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINET_IN_H */ + +/* Define to 1 if you have the `pow' function. */ +#define HAVE_POW 1 + +/* Define if you have POSIX threads libraries and header files. */ +#define HAVE_PTHREAD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PTHREAD_H 1 + +/* Have PTHREAD_PRIO_INHERIT. */ +#define HAVE_PTHREAD_PRIO_INHERIT 1 + +/* If available, contains the Python version number currently in use. */ +/* #undef HAVE_PYTHON */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_READLINE_H */ + +/* Define if your readline library has \`add_history' */ +/* #undef HAVE_READLINE_HISTORY */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_READLINE_HISTORY_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_READLINE_READLINE_H */ + +/* Define to 1 if you have the `rint' function. */ +#define HAVE_RINT 1 + +/* Define to 1 if you have the `select' function. */ +/* #undef HAVE_SELECT */ + +/* Define to 1 if you have the `setitimer' function. */ +/* #undef HAVE_SETITIMER */ + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SGTTY_H */ + +/* Define to 1 if you have the `sigaction' function. */ +/* #undef HAVE_SIGACTION */ + +/* Define to 1 if the system has the type `siginfo_t'. */ +/* #undef HAVE_SIGINFO_T */ + +/* Define to 1 if you have the `signal' function. */ +#define HAVE_SIGNAL 1 + +/* Define to 1 if the system has the type `sig_atomic_t'. */ +#define HAVE_SIG_ATOMIC_T 1 + +/* Define to 1 if you have the `sleep' function. */ +#define HAVE_SLEEP 1 + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define to 1 if you have the `socket' function. */ +/* #undef HAVE_SOCKET */ + +/* Define to 1 if you have the `socketpair' function. */ +/* #undef HAVE_SOCKETPAIR */ + +/* Define to 1 if you have the `sqrt' function. */ +#define HAVE_SQRT 1 + +/* Define to 1 if the system has the type `ssize_t'. */ +#define HAVE_SSIZE_T 1 + +/* Define to 1 if you have Windows Sleep */ +#define HAVE_SSLEEP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strncasecmp' function. */ +#define HAVE_STRNCASECMP 1 + +/* Define to 1 if you have the `strrchr' function. */ +#define HAVE_STRRCHR 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if the system has the type `struct addrinfo'. */ +#define HAVE_STRUCT_ADDRINFO 1 + +/* Define to 1 if the system has the type `struct timezone'. */ +#define HAVE_STRUCT_TIMEZONE 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_IOCCOM_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_IOCTL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SELECT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKET_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TCL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TERMIOS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TERMIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `usleep' function. */ +#define HAVE_USLEEP 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_VALUES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_WINBASE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WINDOWS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WINIOCTL_H 1 + +/* Define if winradio backend is built */ +#define HAVE_WINRADIO 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WS2TCPIP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WSPIAPI_H 1 + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Compilation on POSIX other than Linux */ +/* #undef OTHER_POSIX */ + +/* Name of package */ +#define PACKAGE "hamlib" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "hamlib-developer@lists.sourceforge.net" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "Hamlib" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "Hamlib 4.5" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "hamlib" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "http://www.hamlib.org" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "4.5" + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Version number of package */ +#define VERSION "4.5" + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + + +/* Define missing prototypes, implemented in replacement lib */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef HAVE_GETOPT +int getopt (int argc, char * const argv[], const char * optstring); +extern char * optarg; +extern int optind, opterr, optopt; +#endif + +#ifndef HAVE_GETOPT_LONG +struct option; +int getopt_long (int argc, char * const argv[], const char * optstring, + const struct option * longopts, int * longindex); +#endif + +#ifndef HAVE_USLEEP +int usleep(unsigned long usec); /* SUSv2 */ +#endif + +#ifndef HAVE_GETTIMEOFDAY +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifndef HAVE_STRUCT_TIMEZONE +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; +#endif +int gettimeofday(struct timeval *tv, struct timezone *tz); +#endif + +#ifndef timersub +# define timersub(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ + if ((result)->tv_usec < 0) { \ + --(result)->tv_sec; \ + (result)->tv_usec += 1000000; \ + } \ + } while (0) +#endif + +#ifndef HAVE_SSIZE_T +typedef size_t ssize_t; +#endif + +#ifdef __cplusplus +} +#endif + + + +/* Define missing prototypes, implemented in replacement lib */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef HAVE_STRUCT_ADDRINFO +#ifdef HAVE_NETINET_IN_H +#include +#endif +#if HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#elif HAVE_WS2TCPIP_H +#include +#endif +struct addrinfo { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + socklen_t ai_addrlen; + struct sockaddr *ai_addr; +}; +#endif + +#ifndef HAVE_GETADDRINFO + +#ifdef HAVE_NETINET_IN_H +#include +#endif +#if HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#elif HAVE_WS2TCPIP_H +#include +#endif + +#ifndef AI_PASSIVE +#define AI_PASSIVE 0x0001 +#endif + +int getaddrinfo(const char *node, const char *service, + const struct addrinfo *hints, struct addrinfo **res); +void freeaddrinfo(struct addrinfo *res); +#endif + +#if !defined(HAVE_DECL_GAI_STRERROR) && !defined(gai_strerror) +const char *gai_strerror(int errcode); +#endif /* !HAVE_DECL_GAI_STRERROR */ + +#ifdef __cplusplus +} +#endif + diff --git a/hamlib/libgcc_s_sjlj-1.dll b/hamlib/libgcc_s_sjlj-1.dll new file mode 100644 index 0000000..c8d71f7 Binary files /dev/null and b/hamlib/libgcc_s_sjlj-1.dll differ diff --git a/hamlib/libhamlib-4.dll b/hamlib/libhamlib-4.dll new file mode 100644 index 0000000..7628ed6 Binary files /dev/null and b/hamlib/libhamlib-4.dll differ diff --git a/hamlib/libhamlib.dll.a b/hamlib/libhamlib.dll.a index 7942496..26aced7 100644 Binary files a/hamlib/libhamlib.dll.a and b/hamlib/libhamlib.dll.a differ diff --git a/hamlib/libusb-1.0.dll b/hamlib/libusb-1.0.dll new file mode 100644 index 0000000..8ff6bcb Binary files /dev/null and b/hamlib/libusb-1.0.dll differ diff --git a/hamlib/libwinpthread-1.dll b/hamlib/libwinpthread-1.dll new file mode 100644 index 0000000..acd0423 Binary files /dev/null and b/hamlib/libwinpthread-1.dll differ diff --git a/hamlib/rig.h b/hamlib/rig.h index 00d10b2..5b256ef 100644 --- a/hamlib/rig.h +++ b/hamlib/rig.h @@ -24,7 +24,12 @@ #ifndef _RIG_H #define _RIG_H 1 -#define TRACE rig_debug(RIG_DEBUG_TRACE,"%s(%d) trace\n", __FILE__, __LINE__) +#define BUILTINFUNC 0 + +// Our shared secret password +#define HAMLIB_SECRET_LENGTH 32 + +#define HAMLIB_TRACE rig_debug(RIG_DEBUG_TRACE,"%s(%d) trace\n", __FILE__, __LINE__) #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) #include @@ -32,7 +37,12 @@ #include #include #include -#include + +// For MSVC install the NUGet pthread package +#if defined(_MSC_VER) +#define HAVE_STRUCT_TIMESPEC +#endif +#include /* Rig list is in a separate file so as not to mess up w/ this one */ #include @@ -129,6 +139,10 @@ extern HAMLIB_EXPORT_VAR(const char *) hamlib_copyright2; * Unless stated otherwise, Hamlib functions return the negative value * of rig_errcode_e definitions in case of error, or 0 when successful. */ + /** + * @{ \name Hamlib error codes + */ + enum rig_errcode_e { RIG_OK = 0, /*!< 0 No error, operation completed successfully */ RIG_EINVAL, /*!< 1 invalid parameter */ @@ -147,8 +161,15 @@ enum rig_errcode_e { RIG_BUSBUSY, /*!< 14 Collision on the bus */ RIG_EARG, /*!< 15 NULL RIG handle or any invalid pointer parameter in get arg */ RIG_EVFO, /*!< 16 Invalid VFO */ - RIG_EDOM /*!< 17 Argument out of domain of func */ + RIG_EDOM, /*!< 17 Argument out of domain of func */ + RIG_EDEPRECATED,/*!< 18 Function deprecated */ + RIG_ESECURITY, /*!< 19 Security error */ + RIG_EPOWER, /*!, 20 Rig not powered on */ + RIG_EEND // MUST BE LAST ITEM IN LAST }; +/** + * @} + */ /** * \brief Determines if the given error code indicates a "soft" error @@ -157,7 +178,8 @@ enum rig_errcode_e { */ #define RIG_IS_SOFT_ERRCODE(errcode) (errcode == RIG_EINVAL || errcode == RIG_ENIMPL || errcode == RIG_ERJCTED \ || errcode == RIG_ETRUNC || errcode == RIG_ENAVAIL || errcode == RIG_ENTARGET \ - || errcode == RIG_EVFO || errcode == RIG_EDOM) + || errcode == RIG_EVFO || errcode == RIG_EDOM || errcode == RIG_EDEPRECATED \ + || errcode == RIG_ESECURITY || errcode == RIG_EPOWER) /** * \brief Token in the netrigctl protocol for returning error code @@ -210,12 +232,14 @@ typedef struct s_rig RIG; #define HAMLIB_MAX_SPECTRUM_MODES 5 /* max number of spectrum modes supported */ #define HAMLIB_MAX_SPECTRUM_AVG_MODES 12 /* max number of spectrum averaging modes supported */ #define HAMLIB_MAX_SPECTRUM_SPANS 20 /* max number of spectrum modes supported */ +#define HAMLIB_MAX_SPECTRUM_DATA 2048 /* max number of data bytes in a single spectrum line */ #define HAMLIB_MAX_CAL_LENGTH 32 /* max calibration plots in cal_table_t */ #define HAMLIB_MAX_MODES 63 #define HAMLIB_MAX_VFOS 31 #define HAMLIB_MAX_ROTORS 63 #define HAMLIB_MAX_VFO_OPS 31 #define HAMLIB_MAX_RSCANS 31 +#define HAMLIB_MAX_SNAPSHOT_PACKET_SIZE 16384 /* maximum number of bytes in a UDP snapshot packet */ //! @endcond @@ -304,6 +328,21 @@ typedef enum { RIG_FLAG_TUNER = (1 << 11) /*!< dumb tuner */ } rig_type_t; +/** + * \brief AGC delay settings + */ +/* TODO: kill me, and replace by real AGC delay */ +enum agc_level_e { + RIG_AGC_OFF = 0, + RIG_AGC_SUPERFAST, + RIG_AGC_FAST, + RIG_AGC_SLOW, + RIG_AGC_USER, /*!< user selectable */ + RIG_AGC_MEDIUM, + RIG_AGC_AUTO +}; + + //! @cond Doxygen_Suppress #define RIG_FLAG_TRANSCEIVER (RIG_FLAG_RECEIVER|RIG_FLAG_TRANSMITTER) #define RIG_TYPE_MASK (RIG_FLAG_TRANSCEIVER|RIG_FLAG_SCANNER|RIG_FLAG_MOBILE|RIG_FLAG_HANDHELD|RIG_FLAG_COMPUTER|RIG_FLAG_TRUNKING|RIG_FLAG_TUNER) @@ -523,6 +562,7 @@ typedef unsigned int vfo_t; #define RIG_TARGETABLE_ANT (1<<10) #define RIG_TARGETABLE_ROOFING (1<<11) // roofing filter targetable by VFO #define RIG_TARGETABLE_SPECTRUM (1<<12) // spectrum scope targetable by VFO +#define RIG_TARGETABLE_BAND (1<<13) // Band select -- e.g. Yaeus BS command #define RIG_TARGETABLE_COMMON (RIG_TARGETABLE_RITXIT | RIG_TARGETABLE_PTT | RIG_TARGETABLE_MEM | RIG_TARGETABLE_BANK) #define RIG_TARGETABLE_ALL 0x7fffffff //! @endcond @@ -671,6 +711,33 @@ typedef enum { RIG_OP_TOGGLE = (1 << 12) /*!< \c TOGGLE -- Toggle VFOA and VFOB */ } vfo_op_t; +/** + * \brief Band enumeration + * + * Some rig commands like Yaesu band select know about bands + * + * \sa rig_set_level() + */ +typedef enum { // numbers here reflect the Yaesu values + RIG_BAND_160M = 0, /*!< \c 160M */ + RIG_BAND_80M = 1, /*!< \c 80M */ + RIG_BAND_60M = 2, /*!< \c 60M */ + RIG_BAND_40M = 3, /*!< \c 40M */ + RIG_BAND_30M = 4, /*!< \c 30M */ + RIG_BAND_20M = 5, /*!< \c 20M */ + RIG_BAND_17M = 6, /*!< \c 17M */ + RIG_BAND_15M = 7, /*!< \c 15M */ + RIG_BAND_12M = 8, /*!< \c 12M */ + RIG_BAND_10M = 9, /*!< \c 10M */ + RIG_BAND_6M = 10, /*!< \c 6M */ + RIG_BAND_GEN = 11, /*!< \c 60M */ + RIG_BAND_MW = 12, /*!< \c Medium Wave */ + RIG_BAND_UNUSED = 13, /*!< \c Medium Wave */ + RIG_BAND_AIR = 14, /*!< \c Air band */ + RIG_BAND_144MHZ = 15, /*!< \c 144MHz */ + RIG_BAND_430MHZ = 16, /*!< \c 430MHz */ +} hamlib_band_t; + /** * \brief Rig Scan operation @@ -833,24 +900,11 @@ typedef unsigned int ant_t; #define RIG_ANT_MAX 32 -/** - * \brief AGC delay settings - */ -/* TODO: kill me, and replace by real AGC delay */ -enum agc_level_e { - RIG_AGC_OFF = 0, - RIG_AGC_SUPERFAST, - RIG_AGC_FAST, - RIG_AGC_SLOW, - RIG_AGC_USER, /*!< user selectable */ - RIG_AGC_MEDIUM, - RIG_AGC_AUTO -}; - //! @cond Doxygen_Suppress #define RIG_AGC_LAST RIG_AGC_AUTO //! @endcond +#if 1 // deprecated /** * \brief Level display meters */ @@ -863,8 +917,9 @@ enum meter_level_e { RIG_METER_DB = (1 << 4), /*< DB */ RIG_METER_PO = (1 << 5), /*< Power Out */ RIG_METER_VDD = (1 << 6), /*< Final Amp Voltage */ - RIG_METER_TEMP = (1 << 7) /*< Final Amp Voltage */ + RIG_METER_TEMP = (1 << 7) /*< Final Amp Temperature */ }; +#endif /** @@ -902,7 +957,7 @@ typedef uint64_t rig_level_e; #define RIG_LEVEL_AF CONSTANT_64BIT_FLAG(3) /*!< \c AF -- Volume, arg float [0.0 ... 1.0] */ #define RIG_LEVEL_RF CONSTANT_64BIT_FLAG(4) /*!< \c RF -- RF gain (not TX power) arg float [0.0 ... 1.0] */ #define RIG_LEVEL_SQL CONSTANT_64BIT_FLAG(5) /*!< \c SQL -- Squelch, arg float [0.0 ... 1.0] */ -#define RIG_LEVEL_IF CONSTANT_64BIT_FLAG(6) /*!< \c IF -- IF, arg int (Hz) */ +#define RIG_LEVEL_IF CONSTANT_64BIT_FLAG(6) /*!< \c IF shift -- IF, arg int (+/-Hz) */ #define RIG_LEVEL_APF CONSTANT_64BIT_FLAG(7) /*!< \c APF -- Audio Peak Filter, arg float [0.0 ... 1.0] */ #define RIG_LEVEL_NR CONSTANT_64BIT_FLAG(8) /*!< \c NR -- Noise Reduction, arg float [0.0 ... 1.0] */ #define RIG_LEVEL_PBT_IN CONSTANT_64BIT_FLAG(9) /*!< \c PBT_IN -- Twin PBT (inside) arg float [0.0 ... 1.0] */ @@ -947,9 +1002,8 @@ typedef uint64_t rig_level_e; #define RIG_LEVEL_SPECTRUM_REF CONSTANT_64BIT_FLAG(45) /*!< \c SPECTRUM_REF -- Spectrum scope reference display level, arg float (dB, define rig-specific granularity) */ #define RIG_LEVEL_SPECTRUM_AVG CONSTANT_64BIT_FLAG(46) /*!< \c SPECTRUM_AVG -- Spectrum scope averaging mode, arg int (see struct rig_spectrum_avg_mode). Supported averaging modes defined in rig caps. */ #define RIG_LEVEL_SPECTRUM_ATT CONSTANT_64BIT_FLAG(47) /*!< \c SPECTRUM_ATT -- Spectrum scope attenuator, arg int (dB). Supported attenuator values defined in rig caps. */ -#define RIG_LEVEL_TEMP_METER CONSTANT_64BIT_FLAG(48) /*!< \c TEMP_METER -- arg int (C, centigrade) */ -#define RIG_LEVEL_48 CONSTANT_64BIT_FLAG(48) /*!< \c Future use */ -#define RIG_LEVEL_49 CONSTANT_64BIT_FLAG(49) /*!< \c Future use */ +#define RIG_LEVEL_TEMP_METER CONSTANT_64BIT_FLAG(48) /*!< \c TEMP_METER -- arg float (C, centigrade) */ +#define RIG_LEVEL_BAND_SELECT CONSTANT_64BIT_FLAG(49) /*!< \c BAND_SELECT -- arg enum BAND_ENUM */ #define RIG_LEVEL_50 CONSTANT_64BIT_FLAG(50) /*!< \c Future use */ #define RIG_LEVEL_51 CONSTANT_64BIT_FLAG(51) /*!< \c Future use */ #define RIG_LEVEL_52 CONSTANT_64BIT_FLAG(52) /*!< \c Future use */ @@ -966,7 +1020,7 @@ typedef uint64_t rig_level_e; #define RIG_LEVEL_63 CONSTANT_64BIT_FLAG(63) /*!< \c Future use */ //! @cond Doxygen_Suppress -#define RIG_LEVEL_FLOAT_LIST (RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_APF|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_COMP|RIG_LEVEL_BALANCE|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_RFPOWER_METER_WATTS|RIG_LEVEL_COMP_METER|RIG_LEVEL_VD_METER|RIG_LEVEL_ID_METER|RIG_LEVEL_NOTCHF_RAW|RIG_LEVEL_MONITOR_GAIN|RIG_LEVEL_NB|RIG_LEVEL_SPECTRUM_REF) +#define RIG_LEVEL_FLOAT_LIST (RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_APF|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_COMP|RIG_LEVEL_BALANCE|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_RFPOWER_METER_WATTS|RIG_LEVEL_COMP_METER|RIG_LEVEL_VD_METER|RIG_LEVEL_ID_METER|RIG_LEVEL_NOTCHF_RAW|RIG_LEVEL_MONITOR_GAIN|RIG_LEVEL_NB|RIG_LEVEL_SPECTRUM_REF|RIG_LEVEL_TEMP_METER) #define RIG_LEVEL_READONLY_LIST (RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_STRENGTH|RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_COMP_METER|RIG_LEVEL_VD_METER|RIG_LEVEL_ID_METER) @@ -992,7 +1046,8 @@ enum rig_parm_e { RIG_PARM_TIME = (1 << 5), /*!< \c TIME -- hh:mm:ss, int in seconds from 00:00:00 */ RIG_PARM_BAT = (1 << 6), /*!< \c BAT -- battery level, float [0.0 ... 1.0] */ RIG_PARM_KEYLIGHT = (1 << 7), /*!< \c KEYLIGHT -- Button backlight, on/off */ - RIG_PARM_SCREENSAVER = (1 << 8) /*!< \c SCREENSAVER -- rig specific timeouts */ + RIG_PARM_SCREENSAVER = (1 << 8), /*!< \c SCREENSAVER -- rig specific timeouts */ + RIG_PARM_AFIF = (1 << 9) /*!< \c AFIF -- 0=AF audio, 1=IF audio -- see IC-7300/9700/705 */ }; /** @@ -1045,12 +1100,15 @@ typedef uint64_t setting_t; * \brief Transceive mode * The rig notifies the host of any event, like freq changed, mode changed, etc. * \def RIG_TRN_OFF + * \deprecated * Turn it off * \brief Transceive mode * \def RIG_TRN_RIG + * \deprecated * RIG_TRN_RIG means the rig acts asynchronously * \brief Transceive mode * \def RIG_TRN_POLL + * \deprecated * RIG_TRN_POLL means we have to poll the rig * */ @@ -1124,8 +1182,8 @@ typedef uint64_t setting_t; #define RIG_FUNC_TRANSCEIVE CONSTANT_64BIT_FLAG (42) /*!< \c TRANSCEIVE -- Send radio state changes automatically ON/OFF */ #define RIG_FUNC_SPECTRUM CONSTANT_64BIT_FLAG (43) /*!< \c SPECTRUM -- Spectrum scope data output ON/OFF */ #define RIG_FUNC_SPECTRUM_HOLD CONSTANT_64BIT_FLAG (44) /*!< \c SPECTRUM_HOLD -- Pause spectrum scope updates ON/OFF */ -#define RIG_FUNC_BIT45 CONSTANT_64BIT_FLAG (45) /*!< \c available for future RIG_FUNC items */ -#define RIG_FUNC_BIT46 CONSTANT_64BIT_FLAG (46) /*!< \c available for future RIG_FUNC items */ +#define RIG_FUNC_SEND_MORSE CONSTANT_64BIT_FLAG (45) /*!< \c SEND_MORSE -- Send specified characters using CW */ +#define RIG_FUNC_SEND_VOICE_MEM CONSTANT_64BIT_FLAG (46) /*!< \c SEND_VOICE_MEM -- Transmit in SSB message stored in memory */ #define RIG_FUNC_BIT47 CONSTANT_64BIT_FLAG (47) /*!< \c available for future RIG_FUNC items */ #define RIG_FUNC_BIT48 CONSTANT_64BIT_FLAG (48) /*!< \c available for future RIG_FUNC items */ #define RIG_FUNC_BIT49 CONSTANT_64BIT_FLAG (49) /*!< \c available for future RIG_FUNC items */ @@ -1230,8 +1288,8 @@ typedef uint64_t rmode_t; #define RIG_MODE_SPEC CONSTANT_64BIT_FLAG (35) /*!< \c Unfiltered as in PowerSDR */ #define RIG_MODE_CWN CONSTANT_64BIT_FLAG (36) /*!< \c CWN -- Narrow band CW (FT-736R) */ #define RIG_MODE_IQ CONSTANT_64BIT_FLAG (37) /*!< \c IQ mode for a couple of kit rigs */ -#define RIG_MODE_BIT38 CONSTANT_64BIT_FLAG (38) /*!< \c reserved for future expansion */ -#define RIG_MODE_BIT39 CONSTANT_64BIT_FLAG (39) /*!< \c reserved for future expansion */ +#define RIG_MODE_ISBUSB CONSTANT_64BIT_FLAG (38) /*!< \c ISB mode monitoring USB */ +#define RIG_MODE_ISBLSB CONSTANT_64BIT_FLAG (39) /*!< \c ISB mode monitoring LSB */ #define RIG_MODE_BIT40 CONSTANT_64BIT_FLAG (40) /*!< \c reserved for future expansion */ #define RIG_MODE_BIT41 CONSTANT_64BIT_FLAG (41) /*!< \c reserved for future expansion */ #define RIG_MODE_BIT42 CONSTANT_64BIT_FLAG (42) /*!< \c reserved for future expansion */ @@ -1355,6 +1413,7 @@ struct filter_list { #define RIG_FLT_ANY 0 #define RIG_FLT_END {RIG_MODE_NONE, 0} #define RIG_IS_FLT_END(f) ((f).modes == RIG_MODE_NONE) +#define DEBUGMSGSAVE_SIZE 24000 //! @endcond @@ -1681,7 +1740,7 @@ struct rig_spectrum_line freq_t low_edge_freq; /*!< Low edge frequency of the spectrum scope in Hz in RIG_SPECTRUM_FIXED mode. */ freq_t high_edge_freq; /*!< High edge frequency of the spectrum scope in Hz in RIG_SPECTRUM_FIXED mode. */ - int spectrum_data_length; /*!< Number of bytes of 8-bit spectrum data in the data buffer. The amount of data may vary if the rig has multiple spectrum scopes, depending on the scope. */ + size_t spectrum_data_length; /*!< Number of bytes of 8-bit spectrum data in the data buffer. The amount of data may vary if the rig has multiple spectrum scopes, depending on the scope. */ unsigned char *spectrum_data; /*!< 8-bit spectrum data covering bandwidth of either the span_freq in center mode or from low edge to high edge in fixed mode. A higher value represents higher signal strength. */ }; @@ -1706,6 +1765,7 @@ struct rig_spectrum_line */ //! @cond Doxygen_Suppress #define RIG_MODEL(arg) .rig_model=arg,.macro_name=#arg +#define HAMLIB_CHECK_RIG_CAPS "HAMLIB_CHECK_RIG_CAPS" struct rig_caps { rig_model_t rig_model; /*!< Rig model. */ const char *model_name; /*!< Model name. */ @@ -1763,7 +1823,7 @@ struct rig_caps { vfo_op_t vfo_ops; /*!< VFO op bit field list */ scan_t scan_ops; /*!< Scan bit field list */ int targetable_vfo; /*!< Bit field list of direct VFO access commands */ - int transceive; /*!< Supported transceive mode */ + int transceive; /*!< \deprecated Use async_data_supported instead */ int bank_qty; /*!< Number of banks */ int chan_desc_sz; /*!< Max length of memory channel name */ @@ -1986,6 +2046,23 @@ struct rig_caps { const char *clone_combo_set; /*!< String describing key combination to enter load cloning mode */ const char *clone_combo_get; /*!< String describing key combination to enter save cloning mode */ const char *macro_name; /*!< Rig model macro name */ + + int async_data_supported; /*!< Indicates that rig is capable of outputting asynchronous data updates, such as transceive state updates or spectrum data. 1 if true, 0 otherwise. */ + int (*read_frame_direct)(RIG *rig, + size_t buffer_length, + const unsigned char *buffer); + int (*is_async_frame)(RIG *rig, + size_t frame_length, + const unsigned char *frame); + int (*process_async_frame)(RIG *rig, + size_t frame_length, + const unsigned char *frame); +// this will be used to check rigcaps structure is compatible with client + char *hamlib_check_rig_caps; // a constant value we can check for hamlib integrity + int (*get_conf2)(RIG *rig, token_t token, char *val, int val_len); + int (*password)(RIG *rig, const char *key1); /*< Send encrypted password if rigctld is secured with -A/--password */ + int (*set_lock_mode)(RIG *rig, int mode); + int (*get_lock_mode)(RIG *rig, int *mode); }; //! @endcond @@ -2063,6 +2140,7 @@ enum rig_function_e { RIG_FUNCTION_SEND_MORSE, RIG_FUNCTION_STOP_MORSE, RIG_FUNCTION_WAIT_MORSE, + RIG_FUNCTION_SEND_VOICE_MEM, RIG_FUNCTION_SET_BANK, RIG_FUNCTION_SET_MEM, RIG_FUNCTION_GET_MEM, @@ -2079,6 +2157,10 @@ enum rig_function_e { RIG_FUNCTION_SET_MEM_ALL_CB, RIG_FUNCTION_GET_MEM_ALL_CB, RIG_FUNCTION_SET_VFO_OPT, + RIG_FUNCTION_READ_FRAME_DIRECT, + RIG_FUNCTION_IS_ASYNC_FRAME, + RIG_FUNCTION_PROCESS_ASYNC_FRAME, + RIG_FUNCTION_GET_CONF2, }; /** @@ -2123,12 +2205,20 @@ extern HAMLIB_EXPORT (long long) rig_get_caps_int(rig_model_t rig_model, enum ri //! @cond Doxygen_Suppress extern HAMLIB_EXPORT (const char *) rig_get_caps_cptr(rig_model_t rig_model, enum rig_caps_cptr_e rig_caps); +struct hamlib_async_pipe; + +typedef struct hamlib_async_pipe hamlib_async_pipe_t; + /** * \brief Port definition * * Of course, looks like OO painstakingly programmed in C, sigh. */ //! @cond Doxygen_Suppress +// DO NOT CHANGE THIS STRUCTURE ALL UNTIL 5.0 +// Right now it is static inside rig structure +// 5.0 will change it to a pointer which can then be added to +// At that point only add to the end of the structure typedef struct hamlib_port { union { rig_port_t rig; /*!< Communication port type */ @@ -2188,10 +2278,85 @@ typedef struct hamlib_port { } parm; /*!< Port parameter union */ int client_port; /*!< client socket port for tcp connection */ RIG *rig; /*!< our parent RIG device */ + int asyncio; /*!< enable asynchronous data handling if true -- async collides with python keyword so _async is used */ +#if defined(_WIN32) + hamlib_async_pipe_t *sync_data_pipe; /*!< pipe data structure for synchronous data */ + hamlib_async_pipe_t *sync_data_error_pipe; /*!< pipe data structure for synchronous data error codes */ +#else + int fd_sync_write; /*!< file descriptor for writing synchronous data */ + int fd_sync_read; /*!< file descriptor for reading synchronous data */ + int fd_sync_error_write; /*!< file descriptor for writing synchronous data error codes */ + int fd_sync_error_read; /*!< file descriptor for reading synchronous data error codes */ +#endif } hamlib_port_t; + + +// DO NOT CHANGE THIS STRUCTURE AT ALL +// Will be removed in 5.0 +typedef struct hamlib_port_deprecated { + union { + rig_port_t rig; /*!< Communication port type */ + ptt_type_t ptt; /*!< PTT port type */ + dcd_type_t dcd; /*!< DCD port type */ + } type; + + int fd; /*!< File descriptor */ + void *handle; /*!< handle for USB */ + + int write_delay; /*!< Delay between each byte sent out, in mS */ + int post_write_delay; /*!< Delay between each commands send out, in mS */ + + struct { + int tv_sec, tv_usec; + } post_write_date; /*!< hamlib internal use */ + + int timeout; /*!< Timeout, in mS */ + short retry; /*!< Maximum number of retries, 0 to disable */ + short flushx; /*!< If true flush is done with read instead of TCFLUSH - MicroHam */ + + char pathname[HAMLIB_FILPATHLEN]; /*!< Port pathname */ + + union { + struct { + int rate; /*!< Serial baud rate */ + int data_bits; /*!< Number of data bits */ + int stop_bits; /*!< Number of stop bits */ + enum serial_parity_e parity; /*!< Serial parity */ + enum serial_handshake_e handshake; /*!< Serial handshake */ + enum serial_control_state_e rts_state; /*!< RTS set state */ + enum serial_control_state_e dtr_state; /*!< DTR set state */ + } serial; /*!< serial attributes */ + + struct { + int pin; /*!< Parallel port pin number */ + } parallel; /*!< parallel attributes */ + + struct { + int ptt_bitnum; /*!< Bit number for CM108 GPIO PTT */ + } cm108; /*!< CM108 attributes */ + + struct { + int vid; /*!< Vendor ID */ + int pid; /*!< Product ID */ + int conf; /*!< Configuration */ + int iface; /*!< interface */ + int alt; /*!< alternate */ + char *vendor_name; /*!< Vendor name (opt.) */ + char *product; /*!< Product (opt.) */ + } usb; /*!< USB attributes */ + + struct { + int on_value; /*!< GPIO: 1 == normal, GPION: 0 == inverted */ + int value; /*!< Toggle PTT ON or OFF */ + } gpio; /*!< GPIO attributes */ + } parm; /*!< Port parameter union */ + int client_port; /*!< client socket port for tcp connection */ + RIG *rig; /*!< our parent RIG device */ +} hamlib_port_t_deprecated; //! @endcond #if !defined(__APPLE__) || !defined(__cplusplus) +typedef hamlib_port_t_deprecated port_t_deprecated; typedef hamlib_port_t port_t; #endif @@ -2199,7 +2364,7 @@ typedef hamlib_port_t port_t; #define HAMLIB_ELAPSED_SET 1 #define HAMLIB_ELAPSED_INVALIDATE 2 -#define HAMLIB_CACHE_ALWAYS -1 /*< value to set cache timeout to always use cache */ +#define HAMLIB_CACHE_ALWAYS (-1) /*< value to set cache timeout to always use cache */ typedef enum { HAMLIB_CACHE_ALL, // to set all cache timeouts at once @@ -2304,15 +2469,20 @@ struct rig_cache { * * It is NOT fine to move fields around as it can break share library offset * As of 2021-03-03 vfo_list is the last known item being reference externally - * So any additions or changes to this structure must be after vfo_list. + * So any additions or changes to this structure must be at the end of the structure */ struct rig_state { + /********* ENSURE ANY NEW ITEMS ARE ADDED AT BOTTOM OF THIS STRUCTURE *********/ /* * overridable fields */ - hamlib_port_t rigport; /*!< Rig port (internal use). */ - hamlib_port_t pttport; /*!< PTT port (internal use). */ - hamlib_port_t dcdport; /*!< DCD port (internal use). */ + // moving the hamlib_port_t to the end of rig_state and making it a pointer + // this should allow changes to hamlib_port_t without breaking shared libraries + // these will maintain a copy of the new port_t for backwards compatibility + // to these offsets -- note these must stay until a major version update is done like 5.0 + hamlib_port_t_deprecated rigport_deprecated; /*!< Rig port (internal use). */ + hamlib_port_t_deprecated pttport_deprecated; /*!< PTT port (internal use). */ + hamlib_port_t_deprecated dcdport_deprecated; /*!< DCD port (internal use). */ double vfo_comp; /*!< VFO compensation in PPM, 0.0 to disable */ @@ -2352,15 +2522,15 @@ struct rig_state { * non overridable fields, internal use */ - int hold_decode; /*!< set to 1 to hold the event decoder (async) otherwise 0 */ + int transaction_active; /*!< set to 1 to inform the async reader thread that a synchronous command transaction is waiting for a response, otherwise 0 */ vfo_t current_vfo; /*!< VFO currently set */ int vfo_list; /*!< Complete list of VFO for this rig */ int comm_state; /*!< Comm port state, opened/closed. */ rig_ptr_t priv; /*!< Pointer to private rig state data. */ rig_ptr_t obj; /*!< Internal use by hamlib++ for event handling. */ - int transceive; /*!< Whether the transceive mode is on */ - int poll_interval; /*!< Event notification polling period in milliseconds */ + int async_data_enabled; /*!< Whether async data mode is enabled */ + int poll_interval; /*!< Rig state polling period in milliseconds */ freq_t current_freq; /*!< Frequency currently set */ rmode_t current_mode; /*!< Mode currently set */ //rmode_t current_modeB; /*!< Mode currently set VFOB */ @@ -2390,10 +2560,32 @@ struct rig_state { int power_now; /*!< Current RF power level in rig units */ int power_min; /*!< Minimum RF power level in rig units */ int power_max; /*!< Maximum RF power level in rig units */ - unsigned char disable_yaesu_bandselect; /*!< Disables Yaeus band select logic */ + unsigned char disable_yaesu_bandselect; /*!< Disables Yaesu band select logic */ int twiddle_rit; /*!< Suppresses VFOB reading (cached value used) so RIT control can be used */ int twiddle_state; /*!< keeps track of twiddle status */ vfo_t rx_vfo; /*!< Rx VFO currently set */ + + volatile unsigned int snapshot_packet_sequence_number; + + volatile int multicast_publisher_run; + void *multicast_publisher_priv_data; + volatile int async_data_handler_thread_run; + void *async_data_handler_priv_data; + volatile int poll_routine_thread_run; + void *poll_routine_priv_data; + pthread_mutex_t mutex_set_transaction; + hamlib_port_t rigport; /*!< Rig port (internal use). */ + hamlib_port_t pttport; /*!< PTT port (internal use). */ + hamlib_port_t dcdport; /*!< DCD port (internal use). */ + /********* DO NOT ADD or CHANGE anything (or than to rename) ABOVE THIS LINE *********/ + /********* ENSURE ANY NEW ITEMS ARE ADDED AFTER HERE *********/ + /* flags instructing the rig_get routines to use cached values when asyncio is in use */ + int use_cached_freq; /*state.depth, spaces(), rig->state.depth, __func__, elapsed_ms(&__begin, HAMLIB_ELAPSED_GET)); + +// use this instead of snprintf for automatic detection of buffer limit +#define SNPRINTF(s,n,...) { snprintf(s,n,##__VA_ARGS__);if (strlen(s) > n-1) fprintf(stderr,"****** %s(%d): buffer overflow ******\n", __func__, __LINE__); } + extern HAMLIB_EXPORT(void) rig_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level, const char *fmt, ...)); @@ -3148,6 +3360,9 @@ extern HAMLIB_EXPORT(const char *) rig_strfunc(setting_t); extern HAMLIB_EXPORT(const char *) rig_strlevel(setting_t); extern HAMLIB_EXPORT(const char *) rig_strparm(setting_t); extern HAMLIB_EXPORT(const char *) rig_stragclevel(enum agc_level_e level); +extern HAMLIB_EXPORT(enum agc_level_e) rig_levelagcstr (char *agcString); +extern HAMLIB_EXPORT(enum agc_level_e) rig_levelagcvalue (int agcValue); +extern HAMLIB_EXPORT(value_t) rig_valueagclevel (enum agc_level_e agcLevel); extern HAMLIB_EXPORT(const char *) rig_strptrshift(rptr_shift_t); extern HAMLIB_EXPORT(const char *) rig_strvfop(vfo_op_t op); extern HAMLIB_EXPORT(const char *) rig_strscan(scan_t scan); @@ -3165,11 +3380,11 @@ extern HAMLIB_EXPORT(scan_t) rig_parse_scan(const char *s); extern HAMLIB_EXPORT(rptr_shift_t) rig_parse_rptr_shift(const char *s); extern HAMLIB_EXPORT(chan_type_t) rig_parse_mtype(const char *s); -extern HAMLIB_EXPORT(const char *) rig_license HAMLIB_PARAMS(()); -extern HAMLIB_EXPORT(const char *) rig_version HAMLIB_PARAMS(()); -extern HAMLIB_EXPORT(const char *) rig_copyright HAMLIB_PARAMS(()); +extern HAMLIB_EXPORT(const char *) rig_license HAMLIB_PARAMS((void)); +extern HAMLIB_EXPORT(const char *) rig_version HAMLIB_PARAMS((void)); +extern HAMLIB_EXPORT(const char *) rig_copyright HAMLIB_PARAMS((void)); -extern HAMLIB_EXPORT(void) rig_no_restore_ai(); +extern HAMLIB_EXPORT(void) rig_no_restore_ai(void); extern HAMLIB_EXPORT(int) rig_get_cache_timeout_ms(RIG *rig, hamlib_cache_t selection); extern HAMLIB_EXPORT(int) rig_set_cache_timeout_ms(RIG *rig, hamlib_cache_t selection, int ms); @@ -3187,6 +3402,28 @@ extern HAMLIB_EXPORT(int) hl_usleep(rig_useconds_t msec); extern HAMLIB_EXPORT(int) rig_cookie(RIG *rig, enum cookie_e cookie_cmd, char *cookie, int cookie_len); +extern HAMLIB_EXPORT(int) rig_password(RIG *rig, const char *key1); +extern HAMLIB_EXPORT(void) rig_password_generate_secret(char *pass, + char result[HAMLIB_SECRET_LENGTH + 1]); +extern HAMLIB_EXPORT(int) rig_send_raw(RIG *rig, const unsigned char* send, int send_len, unsigned char* reply, int reply_len, unsigned char *term); + +extern HAMLIB_EXPORT(int) +longlat2locator HAMLIB_PARAMS((double longitude, + double latitude, + char *locator_res, + int pair_count)); + +extern HAMLIB_EXPORT(int) +locator2longlat HAMLIB_PARAMS((double *longitude, + double *latitude, + const char *locator)); + +extern HAMLIB_EXPORT(char*) rig_make_md5(char *pass); + +extern HAMLIB_EXPORT(int) rig_set_lock_mode(RIG *rig, int lock); +extern HAMLIB_EXPORT(int) rig_get_lock_mode(RIG *rig, int *lock); + + //! @endcond __END_DECLS diff --git a/hamlib/riglist.h b/hamlib/riglist.h index aeadfac..be21679 100644 --- a/hamlib/riglist.h +++ b/hamlib/riglist.h @@ -123,6 +123,10 @@ #define RIG_MODEL_FT897D RIG_MAKE_MODEL(RIG_YAESU, 43) #define RIG_MODEL_FTDX101MP RIG_MAKE_MODEL(RIG_YAESU, 44) #define RIG_MODEL_MCHFQRP RIG_MAKE_MODEL(RIG_YAESU, 45) +#define RIG_MODEL_FT450D RIG_MAKE_MODEL(RIG_YAESU, 46) +#define RIG_MODEL_FT650 RIG_MAKE_MODEL(RIG_YAESU, 47) +#define RIG_MODEL_FT990UNI RIG_MAKE_MODEL(RIG_YAESU, 48) +#define RIG_MODEL_FT710 RIG_MAKE_MODEL(RIG_YAESU, 49) /* @@ -179,6 +183,8 @@ #define RIG_MODEL_K4 RIG_MAKE_MODEL(RIG_KENWOOD, 47) #define RIG_MODEL_POWERSDR RIG_MAKE_MODEL(RIG_KENWOOD, 48) #define RIG_MODEL_MALACHITE RIG_MAKE_MODEL(RIG_KENWOOD, 49) +#define RIG_MODEL_LAB599_TX500 RIG_MAKE_MODEL(RIG_KENWOOD,50) +#define RIG_MODEL_SDRUNO RIG_MAKE_MODEL(RIG_KENWOOD,51) /* * Icom @@ -262,7 +268,10 @@ #define RIG_MODEL_ID31 RIG_MAKE_MODEL(RIG_ICOM, 83) #define RIG_MODEL_ID51 RIG_MAKE_MODEL(RIG_ICOM, 84) #define RIG_MODEL_IC705 RIG_MAKE_MODEL(RIG_ICOM, 85) -/* next one is 86 */ +#define RIG_MODEL_ICF8101 RIG_MAKE_MODEL(RIG_ICOM, 86) +#define RIG_MODEL_X6100 RIG_MAKE_MODEL(RIG_ICOM, 87) /* Xiegu X6100 */ +#define RIG_MODEL_G90 RIG_MAKE_MODEL(RIG_ICOM, 88) /* Xiegu G90 */ +#define RIG_MODEL_X5105 RIG_MAKE_MODEL(RIG_ICOM, 89) /* Xiegu X5105 -- G90 compatible */ /* @@ -577,6 +586,7 @@ #define RIG_MODEL_ESMC RIG_MAKE_MODEL(RIG_RS, 1) #define RIG_MODEL_EB200 RIG_MAKE_MODEL(RIG_RS, 2) #define RIG_MODEL_XK2100 RIG_MAKE_MODEL(RIG_RS, 3) +#define RIG_MODEL_EK89X RIG_MAKE_MODEL(RIG_RS, 4) /* @@ -624,6 +634,7 @@ #define RIG_BACKEND_BARRETT "barrett" #define RIG_MODEL_BARRETT_2050 RIG_MAKE_MODEL(RIG_BARRETT, 1) #define RIG_MODEL_BARRETT_950 RIG_MAKE_MODEL(RIG_BARRETT, 2) +#define RIG_MODEL_BARRETT_4050 RIG_MAKE_MODEL(RIG_BARRETT, 3) /* * Elad @@ -631,8 +642,22 @@ #define RIG_ELAD 33 #define RIG_BACKEND_ELAD "elad" #define RIG_MODEL_ELAD_FDM_DUO RIG_MAKE_MODEL(RIG_ELAD, 1) -//! @endcond +/* + * CODAN + */ +#define RIG_CODAN 34 +#define RIG_BACKEND_CODAN "codan" +#define RIG_MODEL_CODAN_ENVOY RIG_MAKE_MODEL(RIG_CODAN, 1) +#define RIG_MODEL_CODAN_NGT RIG_MAKE_MODEL(RIG_CODAN, 2) + +/* + * Gomspace + */ +#define RIG_GOMSPACE 35 +#define RIG_BACKEND_GOMSPACE "gomspace" +#define RIG_MODEL_GS100 RIG_MAKE_MODEL(RIG_GOMSPACE, 1) +//! @endcond /* * TODO: diff --git a/hamlib/rotator.h b/hamlib/rotator.h index 83f379e..0b67230 100644 --- a/hamlib/rotator.h +++ b/hamlib/rotator.h @@ -453,6 +453,7 @@ struct rot_caps { int (*get_status)(ROT *rot, rot_status_t *status); /*!< Pointer to backend implementation of ::rot_get_status(). */ const char *macro_name; /*!< Rotator model macro name. */ + int (*get_conf2)(ROT *rot, token_t token, char *val, int val_len); /*!< Pointer to backend implementation of ::rot_get_conf2(). */ }; //! @cond Doxygen_Suppress #define ROT_MODEL(arg) .rot_model=arg,.macro_name=#arg @@ -496,15 +497,16 @@ struct rot_state { /* * non overridable fields, internal use */ - hamlib_port_t rotport; /*!< Rotator port (internal use). */ - hamlib_port_t rotport2; /*!< 2nd Rotator port (internal use). */ + hamlib_port_t_deprecated rotport_deprecated; /*!< Rotator port (internal use). Deprecated */ + hamlib_port_t_deprecated rotport2_deprecated; /*!< 2nd Rotator port (internal use). Deprecated */ int comm_state; /*!< Comm port state, i.e. opened or closed. */ rig_ptr_t priv; /*!< Pointer to private rotator state data. */ rig_ptr_t obj; /*!< Internal use by hamlib++ for event handling. */ int current_speed; /*!< Current speed 1-100, to be used when no change to speed is requested. */ - /* etc... */ + hamlib_port_t rotport; /*!< Rotator port (internal use). */ + hamlib_port_t rotport2; /*!< 2nd Rotator port (internal use). */ }; @@ -549,6 +551,12 @@ rot_get_conf HAMLIB_PARAMS((ROT *rot, token_t token, char *val)); +extern HAMLIB_EXPORT(int) +rot_get_conf2 HAMLIB_PARAMS((ROT *rot, + token_t token, + char *val, + int val_len)); + /* * General API commands, from most primitive to least.. ) * List Set/Get functions pairs @@ -743,6 +751,7 @@ distance_long_path HAMLIB_PARAMS((double distance)); extern HAMLIB_EXPORT(double) azimuth_long_path HAMLIB_PARAMS((double azimuth)); +#if 0 extern HAMLIB_EXPORT(int) longlat2locator HAMLIB_PARAMS((double longitude, double latitude, @@ -753,6 +762,7 @@ extern HAMLIB_EXPORT(int) locator2longlat HAMLIB_PARAMS((double *longitude, double *latitude, const char *locator)); +#endif extern HAMLIB_EXPORT(double) dms2dec HAMLIB_PARAMS((int degrees, diff --git a/hamlib/rotlist.h b/hamlib/rotlist.h index 338972a..99805d0 100644 --- a/hamlib/rotlist.h +++ b/hamlib/rotlist.h @@ -176,6 +176,13 @@ * The RT21 backend can be used with rotators that support the DCU command set * by Green Heron (currently the RT-21). */ +/** + * \brief A macro that returns the model number of the YRC-1 backend. + * + * \def ROT_MODEL_YRC1 + * + * The YRC1 backend can be used with rotators that support the DCU 2/3 command set + */ //! @cond Doxygen_Suppress #define ROT_ROTOREZ 4 #define ROT_BACKEND_ROTOREZ "rotorez" @@ -185,6 +192,8 @@ #define ROT_MODEL_DCU ROT_MAKE_MODEL(ROT_ROTOREZ, 3) #define ROT_MODEL_ERC ROT_MAKE_MODEL(ROT_ROTOREZ, 4) #define ROT_MODEL_RT21 ROT_MAKE_MODEL(ROT_ROTOREZ, 5) +#define ROT_MODEL_YRC1 ROT_MAKE_MODEL(ROT_ROTOREZ, 6) +#define ROT_MODEL_RT21 ROT_MAKE_MODEL(ROT_ROTOREZ, 5) /** @@ -314,6 +323,7 @@ #define ROT_MODEL_GS232A_EL ROT_MAKE_MODEL(ROT_GS232A, 10) #define ROT_MODEL_GS232B_AZ ROT_MAKE_MODEL(ROT_GS232A, 11) #define ROT_MODEL_GS232B_EL ROT_MAKE_MODEL(ROT_GS232A, 12) +#define ROT_MODEL_GS23_AZ ROT_MAKE_MODEL(ROT_GS232A, 13) /** @@ -623,6 +633,20 @@ #define ROT_BACKEND_ANDROIDSENSOR "androidsensor" #define ROT_MODEL_ANDROIDSENSOR ROT_MAKE_MODEL(ROT_ANDROIDSENSOR, 1) +/** + * \brief A macro that returns the model number of the GRBLTRK backend. + * + * \def ROT_MODEL_GRBLTRK + * + * The GRBLTRK backend can be used with rotators that support the GRBL + * protocol. + */ +//! @cond Doxygen_Suppress +#define ROT_GRBLTRK 24 +#define ROT_BACKEND_GRBLTRK "grbltrk" +//! @endcond +#define ROT_MODEL_GRBLTRK_SER ROT_MAKE_MODEL(ROT_GRBLTRK, 1) +#define ROT_MODEL_GRBLTRK_NET ROT_MAKE_MODEL(ROT_GRBLTRK, 2) /** * \brief Convenience type definition for a rotator model.