2007-11-22 04:48:43 +00:00
|
|
|
/*
|
|
|
|
* hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net)
|
|
|
|
* and the Hamlib Group (hamlib-developer at lists.sourceforge.net)
|
|
|
|
*
|
|
|
|
* newcat.h - (C) Nate Bargmann 2007 (n0nb at arrl.net)
|
2010-01-04 23:52:43 +00:00
|
|
|
* (C) Terry Embry 2008-2010
|
2007-11-22 04:48:43 +00:00
|
|
|
*
|
|
|
|
* This shared library provides the backend API for communicating
|
|
|
|
* via serial interface to any Yaesu radio using the new "CAT"
|
|
|
|
* interface commands that are similar to the Kenwood command set.
|
|
|
|
*
|
2007-12-01 22:09:52 +00:00
|
|
|
* Models this code aims to support are FTDX-9000*, FT-2000,
|
|
|
|
* FT-950, FT-450. Much testing remains. -N0NB
|
2007-11-22 04:48:43 +00:00
|
|
|
*
|
2007-12-01 22:09:52 +00:00
|
|
|
*
|
2011-08-23 02:26:44 +00:00
|
|
|
* 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.
|
2007-11-22 04:48:43 +00:00
|
|
|
*
|
2011-08-23 02:26:44 +00:00
|
|
|
* 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.
|
2007-11-22 04:48:43 +00:00
|
|
|
*
|
2011-08-23 02:26:44 +00:00
|
|
|
* 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
|
2007-11-22 04:48:43 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _NEWCAT_H
|
|
|
|
#define _NEWCAT_H 1
|
|
|
|
|
2008-12-26 00:05:02 +00:00
|
|
|
#include <tones.h>
|
2016-06-05 14:26:21 +00:00
|
|
|
#include <token.h>
|
2007-11-23 03:31:26 +00:00
|
|
|
|
|
|
|
/* Handy constants */
|
|
|
|
|
2008-09-22 21:34:45 +00:00
|
|
|
#ifndef TRUE
|
|
|
|
#define TRUE 1
|
|
|
|
#endif
|
|
|
|
#define ON TRUE
|
|
|
|
#ifndef FALSE
|
|
|
|
#define FALSE 0
|
|
|
|
#endif
|
|
|
|
#define OFF FALSE
|
|
|
|
|
|
|
|
typedef char ncboolean;
|
|
|
|
|
2008-10-25 14:37:19 +00:00
|
|
|
/* shared function version */
|
2023-10-13 22:36:29 +00:00
|
|
|
#define NEWCAT_VER "20231012"
|
2008-10-25 14:37:19 +00:00
|
|
|
|
2020-10-28 13:30:25 +00:00
|
|
|
/* Hopefully large enough for future use, 128 chars plus '\0' */
|
|
|
|
#define NEWCAT_DATA_LEN 129
|
2007-11-23 03:31:26 +00:00
|
|
|
|
|
|
|
/* arbitrary value for now. 11 bits (8N2+1) == 2.2917 mS @ 4800 bps */
|
2008-09-22 21:34:45 +00:00
|
|
|
#define NEWCAT_DEFAULT_READ_TIMEOUT (NEWCAT_DATA_LEN * 5)
|
2007-11-23 03:31:26 +00:00
|
|
|
|
|
|
|
|
2008-11-01 22:39:07 +00:00
|
|
|
#define NEWCAT_MEM_CAP { \
|
2020-04-20 04:18:59 +00:00
|
|
|
.freq = 1, \
|
|
|
|
.mode = 1, \
|
|
|
|
.rit = 1, \
|
|
|
|
.xit = 1, \
|
|
|
|
.rptr_shift = 1, \
|
|
|
|
.ctcss_tone = 1,\
|
|
|
|
.ctcss_sql = 1,\
|
2008-11-01 22:39:07 +00:00
|
|
|
}
|
|
|
|
|
2022-05-01 12:26:44 +00:00
|
|
|
#define YAESU_DEFAULT_VD_METER_200W_CAL \
|
|
|
|
{ \
|
|
|
|
3, \
|
|
|
|
{ \
|
|
|
|
{0, 0.0f}, \
|
|
|
|
{196, 50.0f}, \
|
|
|
|
{255, 65.0f}, \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-05 21:46:55 +00:00
|
|
|
extern const struct confparams newcat_cfg_params[];
|
|
|
|
|
2015-04-13 03:56:36 +00:00
|
|
|
/*
|
2020-10-25 16:06:13 +00:00
|
|
|
* Private caps for newcat rigs
|
2015-04-13 03:56:36 +00:00
|
|
|
*/
|
|
|
|
|
2020-10-25 16:06:13 +00:00
|
|
|
#define NEWCAT_ROOFING_FILTER_COUNT 12
|
|
|
|
|
|
|
|
struct newcat_roofing_filter
|
|
|
|
{
|
|
|
|
/* Index of the roofing filter in the ext level combo */
|
|
|
|
int index;
|
|
|
|
/* Value to set the selected roofing filter, must be 0 for a get-only choice */
|
|
|
|
char set_value;
|
|
|
|
/* Value returned by the rig for this roofing filter, must be 0 for a set-only choice */
|
|
|
|
char get_value;
|
|
|
|
/* Width of the filter in Hz */
|
|
|
|
int width;
|
|
|
|
/* 0 = Always available, 1 = Optional filter */
|
|
|
|
int optional;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct newcat_priv_caps
|
|
|
|
{
|
|
|
|
int roofing_filter_count;
|
|
|
|
struct newcat_roofing_filter roofing_filters[NEWCAT_ROOFING_FILTER_COUNT];
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Private state for newcat rigs
|
|
|
|
*/
|
2020-04-20 04:18:59 +00:00
|
|
|
struct newcat_priv_data
|
|
|
|
{
|
2015-04-13 03:56:36 +00:00
|
|
|
char cmd_str[NEWCAT_DATA_LEN]; /* command string buffer */
|
2020-04-20 04:18:59 +00:00
|
|
|
char
|
|
|
|
ret_data[NEWCAT_DATA_LEN]; /* returned data--max value, most are less */
|
|
|
|
int
|
|
|
|
current_mem; /* private memory channel number */
|
|
|
|
int
|
|
|
|
rig_id; /* rig id from CAT Command ID; */
|
2015-11-29 18:26:39 +00:00
|
|
|
int trn_state; /* AI state found at startup */
|
2020-04-20 04:18:59 +00:00
|
|
|
int fast_set_commands; /* do not check for ACK/NAK; needed for high throughput > 100 commands/s */
|
2017-06-27 15:48:44 +00:00
|
|
|
int width_frequency; /* found at startup */
|
2020-04-26 20:44:38 +00:00
|
|
|
struct timespec cache_start;
|
|
|
|
char last_if_response[NEWCAT_DATA_LEN];
|
2020-06-14 22:14:24 +00:00
|
|
|
int poweron; /* to prevent powering on more than once */
|
2020-10-26 07:19:38 +00:00
|
|
|
int question_mark_response_means_rejected; /* the question mark response has multiple meanings */
|
2022-12-28 22:34:32 +00:00
|
|
|
char front_rear_status; /* e.g. FTDX5000 EX103 status */
|
2023-09-28 13:04:01 +00:00
|
|
|
int ftdx101_st_missing; /* is ST command gone? assume not until proven otherwise */
|
2015-04-13 03:56:36 +00:00
|
|
|
};
|
|
|
|
|
2007-11-22 04:48:43 +00:00
|
|
|
/*
|
|
|
|
* Functions considered to be Stable:
|
|
|
|
*
|
|
|
|
* Functions considered to be Beta:
|
|
|
|
*
|
|
|
|
* Functions considered to be Alpha:
|
|
|
|
* newcat_set_freq
|
2007-11-23 03:31:26 +00:00
|
|
|
* newcat_get_freq
|
2007-11-22 04:48:43 +00:00
|
|
|
* newcat_set_vfo
|
2007-11-23 03:31:26 +00:00
|
|
|
* newcat_get_vfo
|
2008-11-30 15:30:39 +00:00
|
|
|
* newcat_get_rit
|
|
|
|
* newcat_set_rit
|
|
|
|
* newcat_get_xit
|
|
|
|
* newcat_set_xit
|
|
|
|
* power2mW
|
|
|
|
* mW2power
|
|
|
|
* newcat_get_ant
|
|
|
|
* newcat_set_ant
|
|
|
|
* newcat_get_ptt
|
2007-11-22 04:48:43 +00:00
|
|
|
* Functions not yet implemented
|
|
|
|
* most everything at this time.
|
|
|
|
*
|
|
|
|
* At this time, CAT documentation for the FT-450 can be obtained from
|
|
|
|
* the Yaesu website at: http://www.yaesu.com/downloadFile.cfm?FileID=2600&FileCatID=158&FileName=FT%2D450%5FCAT%5FOperation%5FReference%5FBook.pdf&FileContentType=application%2Fpdf
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* newcat function definitions.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-04-20 04:18:59 +00:00
|
|
|
int newcat_get_cmd(RIG *rig);
|
|
|
|
int newcat_set_cmd(RIG *rig);
|
2017-01-18 15:28:23 +00:00
|
|
|
|
2007-11-22 04:48:43 +00:00
|
|
|
int newcat_init(RIG *rig);
|
|
|
|
int newcat_cleanup(RIG *rig);
|
|
|
|
int newcat_open(RIG *rig);
|
|
|
|
int newcat_close(RIG *rig);
|
|
|
|
|
2016-06-05 21:46:55 +00:00
|
|
|
int newcat_set_conf(RIG *rig, token_t token, const char *val);
|
|
|
|
int newcat_get_conf(RIG *rig, token_t token, char *val);
|
2022-01-10 23:22:33 +00:00
|
|
|
int newcat_get_conf2(RIG *rig, token_t token, char *val, int val_len);
|
2016-06-05 14:26:21 +00:00
|
|
|
|
2007-11-22 04:48:43 +00:00
|
|
|
int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
|
|
|
int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
|
|
|
|
|
|
|
|
int newcat_set_vfo(RIG *rig, vfo_t vfo);
|
|
|
|
int newcat_get_vfo(RIG *rig, vfo_t *vfo);
|
|
|
|
|
2020-04-20 04:18:59 +00:00
|
|
|
int newcat_set_tx_vfo(RIG *rig, vfo_t tx_vfo);
|
|
|
|
int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo);
|
|
|
|
|
2008-10-25 14:37:19 +00:00
|
|
|
int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
|
|
|
|
int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
|
|
|
|
|
|
|
|
int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
|
2008-11-27 07:46:34 +00:00
|
|
|
int newcat_get_ptt(RIG * rig, vfo_t vfo, ptt_t * ptt);
|
2020-01-21 23:53:12 +00:00
|
|
|
int newcat_set_ant(RIG * rig, vfo_t vfo, ant_t ant, value_t option);
|
2020-02-19 05:10:14 +00:00
|
|
|
int newcat_get_ant(RIG * rig, vfo_t vfo, ant_t dummy, value_t * option, ant_t * ant_curr, ant_t * ant_tx, ant_t *ant_rx);
|
2008-11-01 22:39:07 +00:00
|
|
|
int newcat_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val);
|
|
|
|
int newcat_get_level(RIG * rig, vfo_t vfo, setting_t level, value_t * val);
|
|
|
|
int newcat_set_func(RIG * rig, vfo_t vfo, setting_t func, int status);
|
|
|
|
int newcat_get_func(RIG * rig, vfo_t vfo, setting_t func, int *status);
|
2023-08-11 15:40:42 +00:00
|
|
|
int newcat_set_parm(RIG * rig, setting_t parm, value_t val);
|
|
|
|
int newcat_get_parm(RIG * rig, setting_t parm, value_t *val);
|
2008-11-01 22:39:07 +00:00
|
|
|
int newcat_set_mem(RIG * rig, vfo_t vfo, int ch);
|
|
|
|
int newcat_get_mem(RIG * rig, vfo_t vfo, int *ch);
|
|
|
|
int newcat_vfo_op(RIG * rig, vfo_t vfo, vfo_op_t op);
|
|
|
|
const char *newcat_get_info(RIG * rig);
|
|
|
|
|
2008-11-29 19:26:09 +00:00
|
|
|
int newcat_get_rit(RIG * rig, vfo_t vfo, shortfreq_t * rit);
|
|
|
|
int newcat_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit);
|
|
|
|
int newcat_get_xit(RIG * rig, vfo_t vfo, shortfreq_t * xit);
|
|
|
|
int newcat_set_xit(RIG * rig, vfo_t vfo, shortfreq_t xit);
|
2023-07-18 20:31:15 +00:00
|
|
|
int newcat_get_clarifier_frequency(RIG *rig, vfo_t vfo, shortfreq_t *freq);
|
|
|
|
int newcat_set_clarifier_frequency(RIG *rig, vfo_t vfo, shortfreq_t freq);
|
2008-11-30 12:42:42 +00:00
|
|
|
int newcat_power2mW(RIG * rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode);
|
|
|
|
int newcat_mW2power(RIG * rig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode);
|
2008-12-06 02:37:45 +00:00
|
|
|
int newcat_set_split_vfo(RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
|
|
|
|
int newcat_get_split_vfo(RIG * rig, vfo_t vfo, split_t * split, vfo_t *tx_vfo);
|
2008-12-25 14:45:00 +00:00
|
|
|
int newcat_set_rptr_shift(RIG * rig, vfo_t vfo, rptr_shift_t rptr_shift);
|
|
|
|
int newcat_get_rptr_shift(RIG * rig, vfo_t vfo, rptr_shift_t * rptr_shift);
|
2020-05-12 03:37:21 +00:00
|
|
|
int newcat_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs);
|
|
|
|
int newcat_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *offs);
|
2008-12-26 00:05:02 +00:00
|
|
|
int newcat_set_ctcss_tone(RIG * rig, vfo_t vfo, tone_t tone);
|
|
|
|
int newcat_get_ctcss_tone(RIG * rig, vfo_t vfo, tone_t * tone);
|
|
|
|
int newcat_set_ctcss_sql(RIG * rig, vfo_t vfo, tone_t tone);
|
|
|
|
int newcat_get_ctcss_sql(RIG * rig, vfo_t vfo, tone_t * tone);
|
2008-12-27 08:08:47 +00:00
|
|
|
int newcat_set_powerstat(RIG * rig, powerstat_t status);
|
2008-12-28 00:25:31 +00:00
|
|
|
int newcat_get_powerstat(RIG * rig, powerstat_t * status);
|
|
|
|
int newcat_set_ts(RIG * rig, vfo_t vfo, shortfreq_t ts);
|
|
|
|
int newcat_get_ts(RIG * rig, vfo_t vfo, shortfreq_t * ts);
|
2008-12-30 18:52:32 +00:00
|
|
|
int newcat_set_trn(RIG * rig, int trn);
|
|
|
|
int newcat_get_trn(RIG * rig, int *trn);
|
2020-11-30 05:32:14 +00:00
|
|
|
int newcat_set_channel(RIG * rig, vfo_t vfo, const channel_t * chan);
|
|
|
|
int newcat_get_channel(RIG * rig, vfo_t vfo, channel_t * chan, int read_only);
|
2020-04-26 22:01:45 +00:00
|
|
|
rmode_t newcat_rmode(char mode);
|
|
|
|
char newcat_modechar(rmode_t rmode);
|
|
|
|
rmode_t newcat_rmode_width(RIG *rig, vfo_t vfo, char mode, pbwidth_t *width);
|
|
|
|
|
2020-10-25 20:11:04 +00:00
|
|
|
int newcat_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val);
|
|
|
|
int newcat_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val);
|
|
|
|
|
2021-10-17 22:53:02 +00:00
|
|
|
int newcat_send_morse(RIG *rig, vfo_t vfo, const char *msg);
|
2021-10-22 12:29:27 +00:00
|
|
|
int newcat_send_voice_mem(RIG *rig, vfo_t vfo, int ch);
|
2021-12-02 22:08:08 +00:00
|
|
|
int newcat_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
|
|
|
|
int sec, double msec, int utc_offset);
|
|
|
|
int newcat_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
|
|
|
|
int *min, int *sec, double *msec, int *utc_offset);
|
2022-10-22 03:27:58 +00:00
|
|
|
int newcat_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch);
|
2021-10-17 22:53:02 +00:00
|
|
|
|
2020-10-25 16:06:13 +00:00
|
|
|
#define TOKEN_BACKEND(t) (t)
|
|
|
|
|
|
|
|
#define TOK_ROOFING_FILTER TOKEN_BACKEND(100)
|
2021-11-20 19:28:26 +00:00
|
|
|
#define TOK_KEYER TOKEN_BACKEND(101)
|
|
|
|
#define TOK_APF_FREQ TOKEN_BACKEND(102)
|
|
|
|
#define TOK_APF_WIDTH TOKEN_BACKEND(103)
|
|
|
|
#define TOK_CONTOUR TOKEN_BACKEND(104)
|
|
|
|
#define TOK_CONTOUR_FREQ TOKEN_BACKEND(105)
|
|
|
|
#define TOK_CONTOUR_LEVEL TOKEN_BACKEND(106)
|
|
|
|
#define TOK_CONTOUR_WIDTH TOKEN_BACKEND(107)
|
2023-10-11 14:01:15 +00:00
|
|
|
#define TOK_MAXPOWER_HF TOKEN_BACKEND(108)
|
|
|
|
#define TOK_MAXPOWER_6M TOKEN_BACKEND(109)
|
|
|
|
#define TOK_MAXPOWER_4M TOKEN_BACKEND(110)
|
|
|
|
#define TOK_MAXPOWER_AM TOKEN_BACKEND(111)
|
|
|
|
#define TOK_MAXPOWER_VHF TOKEN_BACKEND(112)
|
|
|
|
#define TOK_MAXPOWER_UHF TOKEN_BACKEND(113)
|
2008-10-25 14:37:19 +00:00
|
|
|
|
2007-11-22 04:48:43 +00:00
|
|
|
#endif /* _NEWCAT_H */
|