[Hamlib-commits] Hamlib -- Ham radio control libraries branch Hamlib-4.4 created. 5f8c4cd5c2c0830c8
Library to control radio transceivers and receivers
Brought to you by:
n0nb
|
From: Nate B. <n0...@us...> - 2021-12-02 23:48:37
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Hamlib -- Ham radio control libraries".
The branch, Hamlib-4.4 has been created
at 5f8c4cd5c2c0830c8e363762c4255c6e3e4d3e3f (commit)
- Log -----------------------------------------------------------------
commit 5f8c4cd5c2c0830c8e363762c4255c6e3e4d3e3f
Author: Nate Bargmann <n0...@n0...>
Date: Thu Dec 2 17:46:51 2021 -0600
Advance to 4.4 stable
diff --git a/configure.ac b/configure.ac
index 540c0baf..f3fed5b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,7 +14,7 @@ dnl Please do not use '-' in the version number, as package managers will fail,
dnl however, the use of '~' should be fine as apt (others?) will treat
dnl it as an earlier version than the actual release. TNX KA6MAL
dnl PACKAGE_NAME + " " + PACKAGE_VERSION must not exceed 20 chars!
-AC_INIT([Hamlib],[4.4~git],[ham...@li...],[hamlib],[http://www.hamlib.org])
+AC_INIT([Hamlib],[4.4],[ham...@li...],[hamlib],[http://www.hamlib.org])
AC_CONFIG_SRCDIR([include/hamlib/rig.h])
AC_CONFIG_MACRO_DIR([macros])
commit 712a5f3f046f66b2f2cc4a15b12275efe5a3b27a
Author: Mike Black W9MDB <mdb...@ya...>
Date: Thu Dec 2 17:37:17 2021 -0600
Update NEWS
diff --git a/NEWS b/NEWS
index 585bb53a..8c34da14 100644
--- a/NEWS
+++ b/NEWS
@@ -7,7 +7,7 @@ Copyright (C) 2000-2021 Michael Black W9MDB, and others
Please send Hamlib bug reports to ham...@li...
Version 4.4
- * 2021-12-01
+ * 2021-12-02
* Icom rigs now default filter 2 when setting PKTUSB but user can override
* Fix FTDX9000 meter readings
* Add Android sensor as a rotator
commit 1a22f5caf73973208c4c2c3ac6686ed47b17660e
Author: Mike Black W9MDB <mdb...@ya...>
Date: Thu Dec 2 17:36:54 2021 -0600
Update NEWS
diff --git a/NEWS b/NEWS
index 6e336a13..585bb53a 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ Version 4.4
* Added M0NKA mcHF URP rig
* Faster serial i/o noticeable on higher baud rates
* IC7300/9700/7800/785x set_clock/get_clock routines added -- no auto set yet
+ * Yaesu FT1200/891/991/DX10/DX101/DX101MP set_clock/get_clock routines added
Version 4.3.1
* 2021-09-14
commit a1da584bc13b9b4481e4bde21eed0e708dd2d10e
Author: Mike Black W9MDB <mdb...@ya...>
Date: Thu Dec 2 16:53:22 2021 -0600
Add HAMLIB_CACHE_ALWAYS to rig_get_mode
https://github.com/Hamlib/Hamlib/issues/880
diff --git a/src/rig.c b/src/rig.c
index 4bc17aae..b61fc01e 100644
--- a/src/rig.c
+++ b/src/rig.c
@@ -2492,6 +2492,14 @@ int HAMLIB_API rig_get_mode(RIG *rig,
cache_show(rig, __func__, __LINE__);
+ if (rig->state.cache.timeout_ms == HAMLIB_CACHE_ALWAYS)
+ {
+ rig_debug(RIG_DEBUG_TRACE, "%s: cache hit age mode=%dms, width=%dms\n",
+ __func__, cache_ms_mode, cache_ms_width);
+
+ ELAPSED2;
+ RETURNFUNC(RIG_OK);
+ }
if ((*mode != RIG_MODE_NONE && cache_ms_mode < rig->state.cache.timeout_ms)
&& cache_ms_width < rig->state.cache.timeout_ms)
{
commit b5a4e99a3e9a39c073c5567ce22d80831216b31e
Author: Mike Black W9MDB <mdb...@ya...>
Date: Thu Dec 2 16:44:39 2021 -0600
Add HAMLIB_CACHE_ALWAYS
Enable for rig_get_freq
https://github.com/Hamlib/Hamlib/issues/880
diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h
index ddc05cb3..64a06369 100644
--- a/include/hamlib/rig.h
+++ b/include/hamlib/rig.h
@@ -2199,6 +2199,8 @@ typedef hamlib_port_t port_t;
#define HAMLIB_ELAPSED_SET 1
#define HAMLIB_ELAPSED_INVALIDATE 2
+#define HAMLIB_CACHE_ALWAYS -1 /*< value to set cache timeout to always use cache */
+
typedef enum {
HAMLIB_CACHE_ALL, // to set all cache timeouts at once
HAMLIB_CACHE_VFO,
diff --git a/src/rig.c b/src/rig.c
index 3a66c15a..4bc17aae 100644
--- a/src/rig.c
+++ b/src/rig.c
@@ -2177,7 +2177,7 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
cache_show(rig, __func__, __LINE__);
- if (*freq != 0 && cache_ms_freq < rig->state.cache.timeout_ms)
+ if (*freq != 0 && (cache_ms_freq < rig->state.cache.timeout_ms || rig->state.cache.timeout_ms == HAMLIB_CACHE_ALWAYS))
{
rig_debug(RIG_DEBUG_TRACE, "%s: %s cache hit age=%dms, freq=%.0f\n", __func__,
rig_strvfo(vfo), cache_ms_freq, *freq);
commit cab48cecfae7a21377379fedb12bc76aed0ebfb8
Author: Mike Black W9MDB <mdb...@ya...>
Date: Thu Dec 2 16:08:08 2021 -0600
Add get/set clock for Yaesu FT1200/891/991/DX10/DX101/DX101MP
https://github.com/Hamlib/Hamlib/issues/851
diff --git a/rigs/yaesu/ft1200.c b/rigs/yaesu/ft1200.c
index 06e43e36..d6b11cb3 100644
--- a/rigs/yaesu/ft1200.c
+++ b/rigs/yaesu/ft1200.c
@@ -152,7 +152,7 @@ const struct rig_caps ftdx1200_caps =
RIG_MODEL(RIG_MODEL_FTDX1200),
.model_name = "FTDX-1200",
.mfg_name = "Yaesu",
- .version = NEWCAT_VER ".2",
+ .version = NEWCAT_VER ".3",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@@ -320,4 +320,6 @@ const struct rig_caps ftdx1200_caps =
.set_ext_level = newcat_set_ext_level,
.get_ext_level = newcat_get_ext_level,
.send_morse = newcat_send_morse,
+ .set_clock = newcat_set_clock,
+ .get_clock = newcat_get_clock
};
diff --git a/rigs/yaesu/ft891.c b/rigs/yaesu/ft891.c
index 0c38dfa3..c004cd63 100644
--- a/rigs/yaesu/ft891.c
+++ b/rigs/yaesu/ft891.c
@@ -135,7 +135,7 @@ const struct rig_caps ft891_caps =
RIG_MODEL(RIG_MODEL_FT891),
.model_name = "FT-891",
.mfg_name = "Yaesu",
- .version = NEWCAT_VER ".4",
+ .version = NEWCAT_VER ".5",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@@ -320,6 +320,8 @@ const struct rig_caps ft891_caps =
.set_ext_level = newcat_set_ext_level,
.get_ext_level = newcat_get_ext_level,
.send_morse = newcat_send_morse,
+ .set_clock = newcat_set_clock,
+ .get_clock = newcat_get_clock
};
/*
diff --git a/rigs/yaesu/ft991.c b/rigs/yaesu/ft991.c
index d2b93143..c59f5f40 100644
--- a/rigs/yaesu/ft991.c
+++ b/rigs/yaesu/ft991.c
@@ -143,7 +143,7 @@ const struct rig_caps ft991_caps =
RIG_MODEL(RIG_MODEL_FT991),
.model_name = "FT-991",
.mfg_name = "Yaesu",
- .version = NEWCAT_VER ".7",
+ .version = NEWCAT_VER ".8",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@@ -329,6 +329,8 @@ const struct rig_caps ft991_caps =
.get_ext_level = newcat_get_ext_level,
.send_morse = newcat_send_morse,
.send_voice_mem = newcat_send_voice_mem,
+ .set_clock = newcat_set_clock,
+ .get_clock = newcat_get_clock
};
diff --git a/rigs/yaesu/ftdx10.c b/rigs/yaesu/ftdx10.c
index bc3d6542..41738e4c 100644
--- a/rigs/yaesu/ftdx10.c
+++ b/rigs/yaesu/ftdx10.c
@@ -139,7 +139,7 @@ const struct rig_caps ftdx10_caps =
RIG_MODEL(RIG_MODEL_FTDX10),
.model_name = "FTDX-10",
.mfg_name = "Yaesu",
- .version = NEWCAT_VER ".0",
+ .version = NEWCAT_VER ".1",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@@ -308,4 +308,6 @@ const struct rig_caps ftdx10_caps =
.set_ext_level = newcat_set_ext_level,
.get_ext_level = newcat_get_ext_level,
.send_morse = newcat_send_morse,
+ .set_clock = newcat_set_clock,
+ .get_clock = newcat_get_clock
};
diff --git a/rigs/yaesu/ftdx101.c b/rigs/yaesu/ftdx101.c
index db9fdd7a..00ca222f 100644
--- a/rigs/yaesu/ftdx101.c
+++ b/rigs/yaesu/ftdx101.c
@@ -139,7 +139,7 @@ const struct rig_caps ftdx101d_caps =
RIG_MODEL(RIG_MODEL_FTDX101D),
.model_name = "FTDX-101D",
.mfg_name = "Yaesu",
- .version = NEWCAT_VER ".12",
+ .version = NEWCAT_VER ".13",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@@ -309,4 +309,6 @@ const struct rig_caps ftdx101d_caps =
.set_ext_level = newcat_set_ext_level,
.get_ext_level = newcat_get_ext_level,
.send_morse = newcat_send_morse,
+ .set_clock = newcat_set_clock,
+ .get_clock = newcat_get_clock
};
diff --git a/rigs/yaesu/ftdx101mp.c b/rigs/yaesu/ftdx101mp.c
index a1157b5a..4fbcebfb 100644
--- a/rigs/yaesu/ftdx101mp.c
+++ b/rigs/yaesu/ftdx101mp.c
@@ -77,7 +77,7 @@ const struct rig_caps ftdx101mp_caps =
RIG_MODEL(RIG_MODEL_FTDX101MP),
.model_name = "FTDX-101MP",
.mfg_name = "Yaesu",
- .version = NEWCAT_VER ".3",
+ .version = NEWCAT_VER ".4",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@@ -247,4 +247,6 @@ const struct rig_caps ftdx101mp_caps =
.set_ext_level = newcat_set_ext_level,
.get_ext_level = newcat_get_ext_level,
.send_morse = newcat_send_morse,
+ .set_clock = newcat_set_clock,
+ .get_clock = newcat_get_clock
};
diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c
index 35916383..85d6ad2c 100644
--- a/rigs/yaesu/newcat.c
+++ b/rigs/yaesu/newcat.c
@@ -11026,3 +11026,112 @@ static int newcat_get_contour_width(RIG *rig, vfo_t vfo, int *width)
RETURNFUNC(RIG_OK);
}
+
+int newcat_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
+ int sec, double msec, int utc_offset)
+{
+ int retval = RIG_OK;
+ int err;
+ struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
+
+ if (!newcat_valid_command(rig, "DT"))
+ {
+ RETURNFUNC(-RIG_ENAVAIL);
+ }
+
+ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "DT0%04d%02d%02d%c", year, month,
+ day, cat_term);
+
+ if (RIG_OK != (err = newcat_set_cmd(rig)))
+ {
+ rig_debug(RIG_DEBUG_VERBOSE, "%s:%d command err = %d\n", __func__, __LINE__,
+ err);
+ RETURNFUNC(err);
+ }
+
+ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "DT1%02d%02d%02d%c", hour, min, sec, cat_term);
+
+ if (RIG_OK != (err = newcat_set_cmd(rig)))
+ {
+ rig_debug(RIG_DEBUG_VERBOSE, "%s:%d command err = %d\n", __func__, __LINE__,
+ err);
+ RETURNFUNC(err);
+ }
+
+ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "DT2%c%04d%c", utc_offset>=0?'+':'-', utc_offset, cat_term);
+
+ if (RIG_OK != (err = newcat_set_cmd(rig)))
+ {
+ rig_debug(RIG_DEBUG_VERBOSE, "%s:%d command err = %d\n", __func__, __LINE__,
+ err);
+ RETURNFUNC(err);
+ }
+
+ RETURNFUNC(retval);
+}
+
+int newcat_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
+ int *min, int *sec, double *msec, int *utc_offset)
+{
+ int retval = RIG_OK;
+ int err;
+ int n;
+ struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
+
+ if (!newcat_valid_command(rig, "DT"))
+ {
+ RETURNFUNC(-RIG_ENAVAIL);
+ }
+
+ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "DT0%c", cat_term);
+
+ if ((err = newcat_get_cmd(rig)) != RIG_OK)
+ {
+ RETURNFUNC(err);
+ }
+
+ n = sscanf(priv->ret_data, "DT0%04d%02d%02d", year, month, day);
+
+ if (n != 3)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s: DT0 unable to parse '%s'\n", __func__,
+ priv->ret_data);
+ RETURNFUNC(-RIG_EPROTO);
+ }
+
+ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "DT1%c", cat_term);
+
+ if ((err = newcat_get_cmd(rig)) != RIG_OK)
+ {
+ RETURNFUNC(err);
+ }
+
+ n = sscanf(priv->ret_data, "DT1%02d%02d%02d", hour, min, sec);
+
+ if (n != 3)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s: DT1 unable to parse '%s'\n", __func__,
+ priv->ret_data);
+ RETURNFUNC(-RIG_EPROTO);
+ }
+
+ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "DT2%c", cat_term);
+
+ if ((err = newcat_get_cmd(rig)) != RIG_OK)
+ {
+ RETURNFUNC(err);
+ }
+
+ // we keep utc_offset in HHMM format rather than converting
+ n = sscanf(priv->ret_data, "DT2%d", utc_offset);
+
+ if (n != 1)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s: DT2 unable to parse '%s'\n", __func__,
+ priv->ret_data);
+ RETURNFUNC(-RIG_EPROTO);
+ }
+
+ RETURNFUNC(retval);
+}
+
diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h
index 7daac880..89108f4b 100644
--- a/rigs/yaesu/newcat.h
+++ b/rigs/yaesu/newcat.h
@@ -50,7 +50,7 @@
typedef char ncboolean;
/* shared function version */
-#define NEWCAT_VER "20211114"
+#define NEWCAT_VER "20211202"
/* Hopefully large enough for future use, 128 chars plus '\0' */
#define NEWCAT_DATA_LEN 129
@@ -222,6 +222,11 @@ int newcat_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val);
int newcat_send_morse(RIG *rig, vfo_t vfo, const char *msg);
int newcat_send_voice_mem(RIG *rig, vfo_t vfo, int ch);
+int newcat_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
+ int sec, double msec, int utc_offset);
+int newcat_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
+ int *min, int *sec, double *msec, int *utc_offset);
+
#define TOKEN_BACKEND(t) (t)
commit 9ed36ffe548f0a5e14329851980b59f46aa47fe6
Author: Mike Black W9MDB <mdb...@ya...>
Date: Wed Dec 1 23:30:19 2021 -0600
Clean up compilation warning on ic7100.c
diff --git a/rigs/icom/ic7100.c b/rigs/icom/ic7100.c
index 2071350a..68fdc540 100644
--- a/rigs/icom/ic7100.c
+++ b/rigs/icom/ic7100.c
@@ -32,6 +32,7 @@
#include "idx_builtin.h"
#include "bandplan.h"
#include "token.h"
+#include "misc.h"
#define IC7100_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR|\
commit d38a248fdaa6c65320e736b3bd255dda73b1246b
Author: Mike Black W9MDB <mdb...@ya...>
Date: Wed Dec 1 22:52:55 2021 -0600
set/get_clock routines for IC7100/7300/7600/7610/7700/7800/785x/9700
https://github.com/Hamlib/Hamlib/issues/851
diff --git a/NEWS b/NEWS
index a272440a..6e336a13 100644
--- a/NEWS
+++ b/NEWS
@@ -15,7 +15,7 @@ Version 4.4
* Added ability to build hamlib with docker
* Added M0NKA mcHF URP rig
* Faster serial i/o noticeable on higher baud rates
- * IC7300 set_clock/get_clock routines added -- no auto set yet
+ * IC7300/9700/7800/785x set_clock/get_clock routines added -- no auto set yet
Version 4.3.1
* 2021-09-14
diff --git a/doc/man1/rigctl.1 b/doc/man1/rigctl.1
index 7d3e7dea..3aad329e 100644
--- a/doc/man1/rigctl.1
+++ b/doc/man1/rigctl.1
@@ -1149,6 +1149,11 @@ YYYY-MM-DDTHH:MM:SS.SSS+ZZ (where +ZZ is either -/+ UTC offset)
YYYY-MM-DDTHH:MM:SS+ZZ
YYYY-MM-DDTHH:MM+ZZ
YYYY-MM-DD (sets date only)
+Note: Icom rigs expect you to set local time and the hours off to UTC.
+So...4PM EST example would be 2021-12-01T16:00:00+05
+But...if you want to display GMT you must set the clock for GMT with zero UTC offset.
+Hopefully Icom will allow displaying either clock in the future
+
.EE
.
.TP
diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c
index 2317b14f..a43324d7 100644
--- a/rigs/icom/frame.c
+++ b/rigs/icom/frame.c
@@ -377,7 +377,8 @@ read_another_frame:
Unhold_Decode(rig);
*data_len = frm_data_len;
- if (data != NULL && data_len != NULL) memcpy(data, buf + 4, *data_len);
+
+ if (data != NULL && data_len != NULL) { memcpy(data, buf + 4, *data_len); }
/*
* TODO: check addresses in reply frame
diff --git a/rigs/icom/ic7100.c b/rigs/icom/ic7100.c
index 5b484739..2071350a 100644
--- a/rigs/icom/ic7100.c
+++ b/rigs/icom/ic7100.c
@@ -202,6 +202,106 @@ static const struct icom_priv_caps ic7100_priv_caps =
.ant_count = 2
};
+// if hour < 0 then only date will be set
+int ic7100_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
+ int sec, double msec, int utc_offset)
+{
+ int cmd = 0x1a;
+ int subcmd = 0x05;
+ int retval = RIG_OK;
+ unsigned char prmbuf[MAXFRAMELEN];
+
+ if (year >= 0)
+ {
+ prmbuf[0] = 0x01;
+ prmbuf[1] = 0x20;
+ to_bcd(&prmbuf[2], year / 100, 2);
+ to_bcd(&prmbuf[3], year % 100, 2);
+ to_bcd(&prmbuf[4], month, 2);
+ to_bcd(&prmbuf[5], day, 2);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
+
+ if (retval != RIG_OK)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
+ }
+ }
+
+ if (hour >= 0)
+ {
+ prmbuf[0] = 0x01;
+ prmbuf[1] = 0x21;
+ to_bcd(&prmbuf[2], hour, 2);
+ to_bcd(&prmbuf[3], min, 2);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
+
+ if (retval != RIG_OK)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
+ }
+
+ prmbuf[0] = 0x01;
+ prmbuf[1] = 0x23;
+ rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
+ to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
+ to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
+ to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
+
+ if (retval != RIG_OK)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
+ }
+ }
+
+ return retval;
+}
+
+int ic7100_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
+ int *min, int *sec, double *msec, int *utc_offset)
+{
+ int cmd = 0x1a;
+ int subcmd = 0x05;
+ int retval = RIG_OK;
+ int resplen;
+ unsigned char prmbuf[MAXFRAMELEN];
+ unsigned char respbuf[MAXFRAMELEN];
+
+ prmbuf[0] = 0x01;
+ prmbuf[1] = 0x20;
+ resplen = sizeof(respbuf);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
+ *year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
+ *month = from_bcd(&respbuf[6], 2);
+ *day = from_bcd(&respbuf[7], 2);
+
+ if (hour != NULL)
+ {
+ prmbuf[0] = 0x01;
+ prmbuf[1] = 0x21;
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
+ *hour = from_bcd(&respbuf[4], 2);
+ *min = from_bcd(&respbuf[5], 2);
+ *sec = 0;
+ *msec = 0;
+
+ prmbuf[0] = 0x01;
+ prmbuf[1] = 0x23;
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
+ *utc_offset = from_bcd(&respbuf[4], 2) * 100;
+ *utc_offset += from_bcd(&respbuf[5], 2);
+
+ if (respbuf[6] != 0x00) { *utc_offset *= -1; }
+
+ //rig_debug(RIG_DEBUG_VERBOSE,
+ // "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
+ // __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
+ // *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
+ }
+
+ return retval;
+}
+
const struct rig_caps ic7100_caps =
{
RIG_MODEL(RIG_MODEL_IC7100),
@@ -407,5 +507,7 @@ const struct rig_caps ic7100_caps =
.get_powerstat = icom_get_powerstat,
.send_morse = icom_send_morse,
.stop_morse = icom_stop_morse,
- .wait_morse = rig_wait_morse
+ .wait_morse = rig_wait_morse,
+ .set_clock = ic7100_set_clock,
+ .get_clock = ic7100_get_clock
};
diff --git a/rigs/icom/ic7300.c b/rigs/icom/ic7300.c
index 3436604b..d0d7fc06 100644
--- a/rigs/icom/ic7300.c
+++ b/rigs/icom/ic7300.c
@@ -543,7 +543,7 @@ const struct rig_caps ic7300_caps =
RIG_MODEL(RIG_MODEL_IC7300),
.model_name = "IC-7300",
.mfg_name = "Icom",
- .version = BACKEND_VER ".5",
+ .version = BACKEND_VER ".6",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@@ -772,7 +772,7 @@ const struct rig_caps ic9700_caps =
RIG_MODEL(RIG_MODEL_IC9700),
.model_name = "IC-9700",
.mfg_name = "Icom",
- .version = BACKEND_VER ".4",
+ .version = BACKEND_VER ".5",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@@ -1482,10 +1482,10 @@ int ic7300_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x94;
- prmbuf[2] = year / 100;
- prmbuf[3] = year % 100;
- prmbuf[4] = month;
- prmbuf[5] = day;
+ to_bcd(&prmbuf[2], year / 100, 2);
+ to_bcd(&prmbuf[3], year % 100, 2);
+ to_bcd(&prmbuf[4], month, 2);
+ to_bcd(&prmbuf[5], day, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
if (retval != RIG_OK)
@@ -1498,8 +1498,8 @@ int ic7300_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x95;
- prmbuf[2] = hour;
- prmbuf[3] = min;
+ to_bcd(&prmbuf[2], hour, 2);
+ to_bcd(&prmbuf[3], min, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
if (retval != RIG_OK)
@@ -1509,9 +1509,10 @@ int ic7300_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
prmbuf[0] = 0x00;
prmbuf[1] = 0x96;
- prmbuf[2] = utc_offset / 100;
- prmbuf[3] = utc_offset % 100;
- prmbuf[4] = utc_offset >= 0 ? 0 : 1;
+ rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
+ to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
+ to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
+ to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
if (retval != RIG_OK)
@@ -1537,8 +1538,7 @@ int ic7300_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
prmbuf[1] = 0x94;
resplen = sizeof(respbuf);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
- dump_hex(respbuf, resplen);
- *year = from_bcd(&respbuf[4], 2)*1000+from_bcd(&respbuf[5],2);
+ *year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
*month = from_bcd(&respbuf[6], 2);
*day = from_bcd(&respbuf[7], 2);
@@ -1547,7 +1547,6 @@ int ic7300_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
prmbuf[0] = 0x00;
prmbuf[1] = 0x95;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
- dump_hex(respbuf, resplen);
*hour = from_bcd(&respbuf[4], 2);
*min = from_bcd(&respbuf[5], 2);
*sec = 0;
@@ -1556,11 +1555,15 @@ int ic7300_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
prmbuf[0] = 0x00;
prmbuf[1] = 0x96;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
- *utc_offset = from_bcd(&respbuf[4], 2);
- rig_debug(RIG_DEBUG_VERBOSE,
- "%s: %02d-%02d-%02dT%02d:%02d:%02d:%0.3lf%s%02d\n'",
- __func__, *year, *month, *day, *hour, *min, *sec, *msec,
- *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
+ *utc_offset = from_bcd(&respbuf[4], 2) * 100;
+ *utc_offset += from_bcd(&respbuf[5], 2);
+
+ if (respbuf[6] != 0x00) { *utc_offset *= -1; }
+
+ //rig_debug(RIG_DEBUG_VERBOSE,
+ // "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
+ // __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
+ // *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
}
return retval;
@@ -1577,12 +1580,12 @@ int ic9700_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
if (year >= 0)
{
- prmbuf[0] = 0x00;
- prmbuf[1] = 0x94;
- prmbuf[2] = year / 100;
- prmbuf[3] = year % 100;
- prmbuf[4] = month;
- prmbuf[5] = day;
+ prmbuf[0] = 0x01;
+ prmbuf[1] = 0x79;
+ to_bcd(&prmbuf[2], year / 100, 2);
+ to_bcd(&prmbuf[3], year % 100, 2);
+ to_bcd(&prmbuf[4], month, 2);
+ to_bcd(&prmbuf[5], day, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
if (retval != RIG_OK)
@@ -1593,10 +1596,10 @@ int ic9700_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
if (hour >= 0)
{
- prmbuf[0] = 0x00;
- prmbuf[1] = 0x95;
- prmbuf[2] = hour;
- prmbuf[3] = min;
+ prmbuf[0] = 0x01;
+ prmbuf[1] = 0x80;
+ to_bcd(&prmbuf[2], hour, 2);
+ to_bcd(&prmbuf[3], min, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
if (retval != RIG_OK)
@@ -1604,11 +1607,12 @@ int ic9700_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
- prmbuf[0] = 0x00;
- prmbuf[1] = 0x96;
- prmbuf[2] = utc_offset / 100;
- prmbuf[3] = utc_offset % 100;
- prmbuf[4] = utc_offset >= 0 ? 0 : 1;
+ prmbuf[0] = 0x01;
+ prmbuf[1] = 0x84;
+ rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
+ to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
+ to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
+ to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
if (retval != RIG_OK)
@@ -1634,30 +1638,32 @@ int ic9700_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
prmbuf[1] = 0x79;
resplen = sizeof(respbuf);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
- dump_hex(respbuf, resplen);
- *year = respbuf[4];
- *month = respbuf[5];
- *day = respbuf[6];
+ *year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
+ *month = from_bcd(&respbuf[6], 2);
+ *day = from_bcd(&respbuf[7], 2);
if (hour != NULL)
{
prmbuf[0] = 0x01;
prmbuf[1] = 0x80;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
- dump_hex(respbuf, resplen);
- *hour = respbuf[4];
- *min = respbuf[5];
- *sec = respbuf[6];
+ *hour = from_bcd(&respbuf[4], 2);
+ *min = from_bcd(&respbuf[5], 2);
+ *sec = 0;
*msec = 0;
- rig_debug(RIG_DEBUG_VERBOSE, "%s: %02d-%02d-%02dT%02d:%02d:%02d:%0.3lf\n'",
- __func__, *year, *month, *day, *hour, *min, *sec, *msec);
+
prmbuf[0] = 0x01;
- prmbuf[1] = 0x81;
+ prmbuf[1] = 0x84;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
- dump_hex(respbuf, resplen);
- *utc_offset = respbuf[4];
+ *utc_offset = from_bcd(&respbuf[4], 2) * 100;
+ *utc_offset += from_bcd(&respbuf[5], 2);
+
+ if (respbuf[6] != 0x00) { *utc_offset *= -1; }
- if (respbuf[5] > 0) { *utc_offset = *utc_offset * 100 + respbuf[5]; }
+ //rig_debug(RIG_DEBUG_VERBOSE,
+ // "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
+ // __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
+ // *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
}
return retval;
diff --git a/rigs/icom/ic7600.c b/rigs/icom/ic7600.c
index 7f997b95..909933dc 100644
--- a/rigs/icom/ic7600.c
+++ b/rigs/icom/ic7600.c
@@ -23,7 +23,8 @@
#include "config.h"
#endif
-#include <string.h> /* String function definitions */
+#include <string.h>
+#include <stdlib.h>
#include <hamlib/rig.h>
#include "token.h"
@@ -32,6 +33,8 @@
#include "icom.h"
#include "icom_defs.h"
#include "bandplan.h"
+#include "frame.h"
+#include "misc.h"
#define IC7600_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM|RIG_MODE_PSK|RIG_MODE_PSKR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTAM|RIG_MODE_PKTFM)
#define IC7600_1HZ_TS_MODES IC7600_ALL_RX_MODES
@@ -163,12 +166,113 @@ static const struct icom_priv_caps ic7600_priv_caps =
.extcmds = ic7600_extcmds, /* Custom op parameters */
};
+
+// if hour < 0 then only date will be set
+int ic7600_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
+ int sec, double msec, int utc_offset)
+{
+ int cmd = 0x1a;
+ int subcmd = 0x05;
+ int retval = RIG_OK;
+ unsigned char prmbuf[MAXFRAMELEN];
+
+ if (year >= 0)
+ {
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x53;
+ to_bcd(&prmbuf[2], year / 100, 2);
+ to_bcd(&prmbuf[3], year % 100, 2);
+ to_bcd(&prmbuf[4], month, 2);
+ to_bcd(&prmbuf[5], day, 2);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
+
+ if (retval != RIG_OK)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
+ }
+ }
+
+ if (hour >= 0)
+ {
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x54;
+ to_bcd(&prmbuf[2], hour, 2);
+ to_bcd(&prmbuf[3], min, 2);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
+
+ if (retval != RIG_OK)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
+ }
+
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x56;
+ rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
+ to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
+ to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
+ to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
+
+ if (retval != RIG_OK)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
+ }
+ }
+
+ return retval;
+}
+
+int ic7600_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
+ int *min, int *sec, double *msec, int *utc_offset)
+{
+ int cmd = 0x1a;
+ int subcmd = 0x05;
+ int retval = RIG_OK;
+ int resplen;
+ unsigned char prmbuf[MAXFRAMELEN];
+ unsigned char respbuf[MAXFRAMELEN];
+
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x53;
+ resplen = sizeof(respbuf);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
+ *year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
+ *month = from_bcd(&respbuf[6], 2);
+ *day = from_bcd(&respbuf[7], 2);
+
+ if (hour != NULL)
+ {
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x54;
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
+ *hour = from_bcd(&respbuf[4], 2);
+ *min = from_bcd(&respbuf[5], 2);
+ *sec = 0;
+ *msec = 0;
+
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x56;
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
+ *utc_offset = from_bcd(&respbuf[4], 2) * 100;
+ *utc_offset += from_bcd(&respbuf[5], 2);
+
+ if (respbuf[6] != 0x00) { *utc_offset *= -1; }
+
+ //rig_debug(RIG_DEBUG_VERBOSE,
+ // "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
+ // __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
+ // *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
+ }
+
+ return retval;
+}
+
const struct rig_caps ic7600_caps =
{
RIG_MODEL(RIG_MODEL_IC7600),
.model_name = "IC-7600",
.mfg_name = "Icom",
- .version = BACKEND_VER ".1",
+ .version = BACKEND_VER ".2",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@@ -343,5 +447,7 @@ const struct rig_caps ic7600_caps =
.get_split_vfo = icom_get_split_vfo,
.set_powerstat = icom_set_powerstat,
.get_powerstat = icom_get_powerstat,
- .send_morse = icom_send_morse
+ .send_morse = icom_send_morse,
+ .set_clock = ic7600_set_clock,
+ .get_clock = ic7600_get_clock
};
diff --git a/rigs/icom/ic7610.c b/rigs/icom/ic7610.c
index 3cfeb1be..1559e845 100644
--- a/rigs/icom/ic7610.c
+++ b/rigs/icom/ic7610.c
@@ -24,7 +24,8 @@
#include "config.h"
#endif
-#include <string.h> /* String function definitions */
+#include <string.h>
+#include <stdlib.h>
#include <hamlib/rig.h>
#include "token.h"
@@ -33,6 +34,8 @@
#include "icom.h"
#include "icom_defs.h"
#include "bandplan.h"
+#include "frame.h"
+#include "misc.h"
#define IC7610_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM|RIG_MODE_PSK|RIG_MODE_PSKR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTAM|RIG_MODE_PKTFM)
#define IC7610_1HZ_TS_MODES IC7610_ALL_RX_MODES
@@ -243,12 +246,113 @@ static const struct icom_priv_caps ic7610_priv_caps =
.extcmds = ic7610_extcmds,
};
+
+// if hour < 0 then only date will be set
+int ic7610_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
+ int sec, double msec, int utc_offset)
+{
+ int cmd = 0x1a;
+ int subcmd = 0x05;
+ int retval = RIG_OK;
+ unsigned char prmbuf[MAXFRAMELEN];
+
+ if (year >= 0)
+ {
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x58;
+ to_bcd(&prmbuf[2], year / 100, 2);
+ to_bcd(&prmbuf[3], year % 100, 2);
+ to_bcd(&prmbuf[4], month, 2);
+ to_bcd(&prmbuf[5], day, 2);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
+
+ if (retval != RIG_OK)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
+ }
+ }
+
+ if (hour >= 0)
+ {
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x59;
+ to_bcd(&prmbuf[2], hour, 2);
+ to_bcd(&prmbuf[3], min, 2);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
+
+ if (retval != RIG_OK)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
+ }
+
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x62;
+ rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
+ to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
+ to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
+ to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
+
+ if (retval != RIG_OK)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
+ }
+ }
+
+ return retval;
+}
+
+int ic7610_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
+ int *min, int *sec, double *msec, int *utc_offset)
+{
+ int cmd = 0x1a;
+ int subcmd = 0x05;
+ int retval = RIG_OK;
+ int resplen;
+ unsigned char prmbuf[MAXFRAMELEN];
+ unsigned char respbuf[MAXFRAMELEN];
+
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x58;
+ resplen = sizeof(respbuf);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
+ *year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
+ *month = from_bcd(&respbuf[6], 2);
+ *day = from_bcd(&respbuf[7], 2);
+
+ if (hour != NULL)
+ {
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x59;
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
+ *hour = from_bcd(&respbuf[4], 2);
+ *min = from_bcd(&respbuf[5], 2);
+ *sec = 0;
+ *msec = 0;
+
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x62;
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
+ *utc_offset = from_bcd(&respbuf[4], 2) * 100;
+ *utc_offset += from_bcd(&respbuf[5], 2);
+
+ if (respbuf[6] != 0x00) { *utc_offset *= -1; }
+
+ //rig_debug(RIG_DEBUG_VERBOSE,
+ // "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
+ // __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
+ // *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
+ }
+
+ return retval;
+}
+
const struct rig_caps ic7610_caps =
{
RIG_MODEL(RIG_MODEL_IC7610),
.model_name = "IC-7610",
.mfg_name = "Icom",
- .version = BACKEND_VER ".4",
+ .version = BACKEND_VER ".5",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@@ -478,5 +582,7 @@ const struct rig_caps ic7610_caps =
.send_morse = icom_send_morse,
.stop_morse = icom_stop_morse,
.wait_morse = rig_wait_morse,
- .send_voice_mem = rig_send_voice_mem
+ .send_voice_mem = rig_send_voice_mem,
+ .set_clock = ic7610_set_clock,
+ .get_clock = ic7610_get_clock
};
diff --git a/rigs/icom/ic7700.c b/rigs/icom/ic7700.c
index 9b020452..7e215ca7 100644
--- a/rigs/icom/ic7700.c
+++ b/rigs/icom/ic7700.c
@@ -23,7 +23,8 @@
#include "config.h"
#endif
-#include <string.h> /* String function definitions */
+#include <string.h>
+#include <stdlib.h>
#include <hamlib/rig.h>
#include "token.h"
@@ -32,6 +33,8 @@
#include "icom.h"
#include "icom_defs.h"
#include "bandplan.h"
+#include "frame.h"
+#include "misc.h"
#define IC7700_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM|RIG_MODE_PSK|RIG_MODE_PSKR)
#define IC7700_AM_TX_MODES (RIG_MODE_AM|RIG_MODE_PKTAM)
@@ -146,6 +149,106 @@ static const struct icom_priv_caps ic7700_priv_caps =
.extcmds = ic7700_extcmds,
};
+// if hour < 0 then only date will be set
+int ic7700_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
+ int sec, double msec, int utc_offset)
+{
+ int cmd = 0x1a;
+ int subcmd = 0x05;
+ int retval = RIG_OK;
+ unsigned char prmbuf[MAXFRAMELEN];
+
+ if (year >= 0)
+ {
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x58;
+ to_bcd(&prmbuf[2], year / 100, 2);
+ to_bcd(&prmbuf[3], year % 100, 2);
+ to_bcd(&prmbuf[4], month, 2);
+ to_bcd(&prmbuf[5], day, 2);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
+
+ if (retval != RIG_OK)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
+ }
+ }
+
+ if (hour >= 0)
+ {
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x59;
+ to_bcd(&prmbuf[2], hour, 2);
+ to_bcd(&prmbuf[3], min, 2);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
+
+ if (retval != RIG_OK)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
+ }
+
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x61;
+ rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
+ to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
+ to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
+ to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
+
+ if (retval != RIG_OK)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
+ }
+ }
+
+ return retval;
+}
+
+int ic7700_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
+ int *min, int *sec, double *msec, int *utc_offset)
+{
+ int cmd = 0x1a;
+ int subcmd = 0x05;
+ int retval = RIG_OK;
+ int resplen;
+ unsigned char prmbuf[MAXFRAMELEN];
+ unsigned char respbuf[MAXFRAMELEN];
+
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x58;
+ resplen = sizeof(respbuf);
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
+ *year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
+ *month = from_bcd(&respbuf[6], 2);
+ *day = from_bcd(&respbuf[7], 2);
+
+ if (hour != NULL)
+ {
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x59;
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
+ *hour = from_bcd(&respbuf[4], 2);
+ *min = from_bcd(&respbuf[5], 2);
+ *sec = 0;
+ *msec = 0;
+
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x61;
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
+ *utc_offset = from_bcd(&respbuf[4], 2) * 100;
+ *utc_offset += from_bcd(&respbuf[5], 2);
+
+ if (respbuf[6] != 0x00) { *utc_offset *= -1; }
+
+ //rig_debug(RIG_DEBUG_VERBOSE,
+ // "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
+ // __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
+ // *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
+ }
+
+ return retval;
+}
+
const struct rig_caps ic7700_caps =
{
RIG_MODEL(RIG_MODEL_IC7700),
@@ -325,5 +428,7 @@ const struct rig_caps ic7700_caps =
.get_powerstat = icom_get_powerstat,
.send_morse = icom_send_morse,
.stop_morse = icom_stop_morse,
- .wait_morse = rig_wait_morse
+ .wait_morse = rig_wait_morse,
+ .set_clock = ic7700_set_clock,
+ .get_clock = ic7700_get_clock
};
diff --git a/rigs/icom/ic7800.c b/rigs/icom/ic7800.c
index 31d8a183..e878aba8 100644
--- a/rigs/icom/ic7800.c
+++ b/rigs/icom/ic7800.c
@@ -24,6 +24,7 @@
#endif
#include <string.h> /* String function definitions */
+#include <stdlib.h>
#include <hamlib/rig.h>
#include "token.h"
@@ -155,7 +156,7 @@ const struct rig_caps ic7800_caps =
RIG_MODEL(RIG_MODEL_IC7800),
.model_name = "IC-7800",
.mfg_name = "Icom",
- .version = BACKEND_VER ".4",
+ .version = BACKEND_VER ".5",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@@ -417,12 +418,12 @@ int ic7800_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
if (year >= 0)
{
- prmbuf[0] = 0x01;
- prmbuf[1] = 0x20;
- prmbuf[2] = year / 100;
- prmbuf[3] = year % 100;
- prmbuf[4] = month;
- prmbuf[5] = day;
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x59;
+ to_bcd(&prmbuf[2], year / 100, 2);
+ to_bcd(&prmbuf[3], year % 100, 2);
+ to_bcd(&prmbuf[4], month, 2);
+ to_bcd(&prmbuf[5], day, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
if (retval != RIG_OK)
@@ -433,10 +434,10 @@ int ic7800_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
if (hour >= 0)
{
- prmbuf[0] = 0x01;
- prmbuf[1] = 0x21;
- prmbuf[2] = hour;
- prmbuf[3] = min;
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x60;
+ to_bcd(&prmbuf[2], hour, 2);
+ to_bcd(&prmbuf[3], min, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
if (retval != RIG_OK)
@@ -444,11 +445,12 @@ int ic7800_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
}
- prmbuf[0] = 0x01;
- prmbuf[1] = 0x23;
- prmbuf[2] = utc_offset / 100;
- prmbuf[3] = utc_offset % 100;
- prmbuf[4] = utc_offset >= 0 ? 0 : 1;
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x62;
+ rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
+ to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
+ to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
+ to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
if (retval != RIG_OK)
@@ -460,7 +462,6 @@ int ic7800_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
return retval;
}
-
int ic7800_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int *min, int *sec, double *msec, int *utc_offset)
{
@@ -472,30 +473,36 @@ int ic7800_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
unsigned char respbuf[MAXFRAMELEN];
prmbuf[0] = 0x00;
- prmbuf[1] = 0x94;
+ prmbuf[1] = 0x59;
resplen = sizeof(respbuf);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
- dump_hex(respbuf, resplen);
- *year = respbuf[4];
- *month = respbuf[5];
- *day = respbuf[6];
+ *year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
+ *month = from_bcd(&respbuf[6], 2);
+ *day = from_bcd(&respbuf[7], 2);
- if (hour >= 0) //
+ if (hour != NULL)
{
prmbuf[0] = 0x00;
- prmbuf[1] = 0x95;
+ prmbuf[1] = 0x60;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
- dump_hex(respbuf, resplen);
- rig_debug(RIG_DEBUG_VERBOSE, "%s: %02d-%02d-%02dT%02d:%02d:%02d:%0.3lf\n'",
- __func__, *year, *month, *day, *hour, *min, *sec, *msec);
- prmbuf[0] = 0x01;
- prmbuf[1] = 0x81;
+ *hour = from_bcd(&respbuf[4], 2);
+ *min = from_bcd(&respbuf[5], 2);
+ *sec = 0;
+ *msec = 0;
+
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x62;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
- dump_hex(respbuf, resplen);
- *utc_offset = respbuf[4];
- if (respbuf[5] > 0) *utc_offset = *utc_offset*100 + respbuf[5];
+ *utc_offset = from_bcd(&respbuf[4], 2) * 100;
+ *utc_offset += from_bcd(&respbuf[5], 2);
+
+ if (respbuf[6] != 0x00) { *utc_offset *= -1; }
+
+ //rig_debug(RIG_DEBUG_VERBOSE,
+ // "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
+ // __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
+ // *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
}
return retval;
}
-
diff --git a/rigs/icom/ic785x.c b/rigs/icom/ic785x.c
index 0d0c5304..db2e58c3 100644
--- a/rigs/icom/ic785x.c
+++ b/rigs/icom/ic785x.c
@@ -243,7 +243,7 @@ const struct rig_caps ic785x_caps =
RIG_MODEL(RIG_MODEL_IC785x),
.model_name = "IC-7850/7851",
.mfg_name = "Icom",
- .version = BACKEND_VER ".2",
+ .version = BACKEND_VER ".3",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c
index f0393f19..9cd33966 100644
--- a/tests/rigctl_parse.c
+++ b/tests/rigctl_parse.c
@@ -346,7 +346,8 @@ static struct test_table test_list[] =
{ 0xf5, "get_rig_info", ACTION(get_rig_info), ARG_NOVFO | ARG_OUT, "RigInfo" }, /* get several vfo parameters at once */
{ 0xf4, "get_vfo_list", ACTION(get_vfo_list), ARG_OUT | ARG_NOVFO, "VFOs" },
{ 0xf6, "get_modes", ACTION(get_modes), ARG_OUT | ARG_NOVFO, "Modes" },
- { 0xf9, "get_clock", ACTION(get_clock), ARG_IN | ARG_NOVFO, "local/utc" },
+// { 0xf9, "get_clock", ACTION(get_clock), ARG_IN | ARG_NOVFO, "local/utc" },
+ { 0xf9, "get_clock", ACTION(get_clock), ARG_NOVFO },
{ 0xf8, "set_clock", ACTION(set_clock), ARG_IN | ARG_NOVFO, "YYYYMMDDHHMMSS.sss+ZZ" },
{ 0xf1, "halt", ACTION(halt), ARG_NOVFO }, /* rigctld only--halt the daemon */
{ 0x8c, "pause", ACTION(pause), ARG_IN, "Seconds" },
@@ -5228,6 +5229,10 @@ declare_proto_rig(set_clock)
__func__, n, year, mon, day, hour, min, sec, msec, utc_offset >= 0 ? "+" : "-",
(unsigned)abs(utc_offset));
+ rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
+ if (utc_offset < 24) utc_offset *= 100; // allow for minutes offset too
+ rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
+
RETURNFUNC(rig_set_clock(rig, year, mon, day, hour, min, sec, msec,
utc_offset));
}
@@ -5235,20 +5240,21 @@ declare_proto_rig(set_clock)
/* '0xf9' */
declare_proto_rig(get_clock)
{
- char option[64];
- int year, month, day, hour, min, sec, utc_offset;
+ //char option[64];
+ int year, month, day, hour, min, sec, utc_offset, aoffset;
int retval;
double msec;
ENTERFUNC;
- CHKSCN1ARG(sscanf(arg1, "%63s", option));
+ //CHKSCN1ARG(sscanf(arg1, "%63s", option));
retval = rig_get_clock(rig, &year, &month, &day, &hour, &min, &sec, &msec,
&utc_offset);
-
- fprintf(fout, "%04d-%02d-%02dT%02d:%02d:%02d.%0.3f%s%02d\n", year, month, day,
- hour, min, sec, msec, utc_offset >= 0 ? "+" : "-", (unsigned)abs(utc_offset));
+ aoffset = abs(utc_offset);
+ fprintf(fout, "%04d-%02d-%02dT%02d:%02d:%06.3f%s%02d:%02d\n", year, month, day,
+ hour, min, sec + msec / 1000, utc_offset >= 0 ? "+" : "-",
+ aoffset/100, aoffset % 100);
return retval;
}
commit 41990372da5c697f8b0fe6a4799866aafdd1b490
Author: Mike Black W9MDB <mdb...@ya...>
Date: Wed Dec 1 12:53:10 2021 -0600
Progress on get_clock
diff --git a/rigs/icom/ic7300.c b/rigs/icom/ic7300.c
index a0447a39..3436604b 100644
--- a/rigs/icom/ic7300.c
+++ b/rigs/icom/ic7300.c
@@ -1538,9 +1538,9 @@ int ic7300_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
resplen = sizeof(respbuf);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
dump_hex(respbuf, resplen);
- *year = from_bcd(&respbuf[4], 4);
- *month = from_bcd(&respbuf[5], 2);
- *day = from_bcd(&respbuf[6], 2);
+ *year = from_bcd(&respbuf[4], 2)*1000+from_bcd(&respbuf[5],2);
+ *month = from_bcd(&respbuf[6], 2);
+ *day = from_bcd(&respbuf[7], 2);
if (hour != NULL)
{
commit 8e28c68d3e892c94e35ecb19b41fd6be466487f8
Merge: 23d291de 26d1b57d
Author: Mike Black W9MDB <mdb...@ya...>
Date: Wed Dec 1 12:46:17 2021 -0600
Merge branch 'master' of https://github.com/Hamlib/Hamlib
commit 23d291de3ce0adaecf19432013a286313fbe1e04
Author: Mike Black W9MDB <mdb...@ya...>
Date: Wed Dec 1 12:45:07 2021 -0600
Progress on get_clock
https://github.com/Hamlib/Hamlib/issues/851
diff --git a/rigs/icom/ic7300.c b/rigs/icom/ic7300.c
index 9b3af86a..a0447a39 100644
--- a/rigs/icom/ic7300.c
+++ b/rigs/icom/ic7300.c
@@ -24,7 +24,8 @@
#include "config.h"
#endif
-#include <string.h> /* String function definitions */
+#include <string.h>
+#include <stdlib.h>
#include <hamlib/rig.h>
#include "idx_builtin.h"
@@ -41,10 +42,10 @@
static int ic7300_set_parm(RIG *rig, setting_t parm, value_t val);
static int ic7300_get_parm(RIG *rig, setting_t parm, value_t *val);
int ic7300_set_clock(RIG *rig, int year, int month, int day, int hour,
- int min, int sec, double msec, int utc_offset);
+ int min, int sec, double msec, int utc_offset);
int ic7300_get_clock(RIG *rig, int *year, int *month, int *day,
- int *hour,
- int *min, int *sec, double *msec, int *utc_offset);
+ int *hour,
+ int *min, int *sec, double *msec, int *utc_offset);
#define IC7300_ALL_RX_MODES (RIG_MODE_FM|RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM|RIG_MODE_PKTAM)
@@ -1537,18 +1538,29 @@ int ic7300_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
resplen = sizeof(respbuf);
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
dump_hex(respbuf, resplen);
- *year = respbuf[4];
- *month = respbuf[5];
- *day = respbuf[6];
+ *year = from_bcd(&respbuf[4], 4);
+ *month = from_bcd(&respbuf[5], 2);
+ *day = from_bcd(&respbuf[6], 2);
- if (hour >= 0) //
+ if (hour != NULL)
{
prmbuf[0] = 0x00;
prmbuf[1] = 0x95;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
dump_hex(respbuf, resplen);
- rig_debug(RIG_DEBUG_VERBOSE, "%s: %02d-%02d-%02dT%02d:%02d:%02d:%0.3lf\n'",
- __func__, *year, *month, *day, *hour, *min, *sec, *msec);
+ *hour = from_bcd(&respbuf[4], 2);
+ *min = from_bcd(&respbuf[5], 2);
+ *sec = 0;
+ *msec = 0;
+
+ prmbuf[0] = 0x00;
+ prmbuf[1] = 0x96;
+ retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
+ *utc_offset = from_bcd(&respbuf[4], 2);
+ rig_debug(RIG_DEBUG_VERBOSE,
+ "%s: %02d-%02d-%02dT%02d:%02d:%02d:%0.3lf%s%02d\n'",
+ __func__, *year, *month, *day, *hour, *min, *sec, *msec,
+ *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
}
return retval;
@@ -1627,7 +1639,7 @@ int ic9700_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
*month = respbuf[5];
*day = respbuf[6];
- if (hour != NULL)
+ if (hour != NULL)
{
prmbuf[0] = 0x01;
prmbuf[1] = 0x80;
@@ -1644,7 +1656,8 @@ int ic9700_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
dump_hex(respbuf, resplen);
*utc_offset = respbuf[4];
- if (respbuf[5] > 0) *utc_offset = *utc_offset*100 + respbuf[5];
+
+ if (respbuf[5] > 0) { *utc_offset = *utc_offset * 100 + respbuf[5]; }
}
return retval;
commit 26d1b57d8f5a37322f0609a610022ae2ecab8423
Author: Mike Black W9MDB <mdb...@ya...>
Date: Wed Dec 1 12:30:14 2021 -0600
Add ic7300.h to Makefile.am
diff --git a/rigs/icom/Makefile.am b/rigs/icom/Makefile.am
index ebb2ecab..56fb9a63 100644
--- a/rigs/icom/Makefile.am
+++ b/rigs/icom/Makefile.am
@@ -9,7 +9,7 @@ ICOMSRC = ic706.c icr8500.c ic735.c ic775.c ic756.c \
ic707.c ic728.c ic751.c ic761.c \
ic78.c ic7800.c ic785x.c \
ic7000.c ic7100.c ic7200.c ic7300.c ic7600.c ic7610.c ic7700.c \
- icom.c icom.h icom_defs.h frame.c frame.h optoscan.c optoscan.h x108g.c
+ icom.c icom.h icom_defs.h frame.c frame.h ic7300.h optoscan.c optoscan.h x108g.c
noinst_LTLIBRARIES = libhamlib-icom.la
libhamlib_icom_la_SOURCES = $(ICOMSRC)
commit a1c8493c62d309488e2f41f50850372bc41e6052
Author: Mike Black W9MDB <mdb...@ya...>
Date: Wed Dec 1 11:50:33 2021 -0600
First cut at clock setting for IC7300/7800/785x/9700
https://github.com/Hamlib/Hamlib/issues/851
diff --git a/NEWS b/NEWS
index 595ce892..a272440a 100644
--- a/NEWS
+++ b/NEWS
@@ -7,13 +7,15 @@ Copyright (C) 2000-2021 Michael Black W9MDB, and others
Please send Hamlib bug reports to ham...@li...
Version 4.4
- * 2021-??-??
+ * 2021-12-01
* Icom rigs now default filter 2 when setting PKTUSB but user can override
* Fix FTDX9000 meter readings
* Add Android sensor as a rotator
* Added rig_get_vfo to some Icom rigs that have XCHG or 0x25 command capability
* Added ability to build hamlib with docker
* Added M0NKA mcHF URP rig
+ * Faster serial i/o noticeable on higher baud rates
+ * IC7300 set_clock/get_clock routines added -- no auto set yet
Version 4.3.1
* 2021-09-14
diff --git a/cppcheck.sh b/cppcheck.sh
index d71b45ba..8389b07c 100755
--- a/cppcheck.sh
+++ b/cppcheck.sh
@@ -80,7 +80,7 @@ CHECK="\
if test $# -eq 0 ; then
echo "See cppcheck.log when done"
echo "This takes a while to run"
- cppcheck --inline-suppr \
+ strace -f cppcheck --inline-suppr \
-I src \
-I include \
--include=include/config.h \
diff --git a/doc/man1/rigctl.1 b/doc/man1/rigctl.1
index 71f0a822..7d3e7dea 100644
--- a/doc/man1/rigctl.1
+++ b/doc/man1/rigctl.1
@@ -1136,6 +1136,30 @@ option above, will terminate each command string sent to the radio. This
character should not be a part of the input string.
.
.TP
+.BR set_clock " \(aq" \fIDateTime\fP \(aq
+Set
+.RI \(aq DateTime \(aq
+.IP
+Sets rig clock -- note that some rigs do not handle seconds or milliseconds.
+If you try to set sec/msec and rig does not support it you will get a debug warning message.
+Format is ISO8601,
+.EX
+Formats accepted
+YYYY-MM-DDTHH:MM:SS.SSS+ZZ (where +ZZ is either -/+ UTC offset)
+YYYY-MM-DDTHH:MM:SS+ZZ
+YYYY-MM-DDTHH:MM+ZZ
+YYYY-MM-DD (sets date only)
+.EE
+.
+.TP
+.BR get_clock
+Get
+.RI \(aq RigTime \(aq
+.IP
+Gets rig clock -- note that some rigs do not handle seconds or milliseconds.
+Format is ISO8601 YYYY-MM-DDTHH:MM:SS.sss+ZZ where +ZZ is either -/+ UTC offset
+.
+.TP
.BR chk_vfo
Get
.RI \(aq Status \(aq
diff --git a/doc/man1/rigctld.1 b/doc/man1/rigctld.1
index 09ba8c02..e5d4fcd9 100644
--- a/doc/man1/rigctld.1
+++ b/doc/man1/rigctld.1
@@ -1077,6 +1077,29 @@ and
also need to be provided as output power may vary according to these values.
.IP
VFO parameter is not used in VFO mode.
+.TP
+.BR set_clock " \(aq" \fIDateTime\fP \(aq
+Set
+.RI \(aq DateTime \(aq
+.IP
+Sets rig clock -- note that some rigs do not handle seconds or milliseconds.
+If you try to set that you will get a debug warning message.
+Format is ISO8601.
+.EX
+Formats accepted
+YYYY-MM-DDTHH:MM:SS.sss+ZZ (where +ZZ is either -/+ UTC offset)
+YYYY-MM-DDTHH:MM:SS+ZZ
+YYYY-MM-DDTHH:MM+ZZ
+YYYY-MM-DD (sets date only)
+.EE
+.
+.TP
+.BR get_clock
+Get
+.RI \(aq RigTime \(aq
+.IP
+Gets rig clock -- note that some rigs do not handle seconds or milliseconds.
+Format is ISO8601 YYYY-MM-DDTHH:MM:SS.sss+ZZ where +ZZ is either -/+ UTC offset
.
.TP
.B chk_vfo
diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h
index b041a430..ddc05cb3 100644
--- a/include/hamlib/rig.h
+++ b/include/hamlib/rig.h
@@ -1980,6 +1980,8 @@ struct rig_caps {
rmode_t *mode,
pbwidth_t *width,
split_t *split);
+ int(*set_clock) (RIG *rig, int year, int month, int day, int hour, int min, int sec, double msec, int utc_offset);
+ int(*get_clock) (RIG *rig, int *year, int *month, int *day, int *hour, int *min, int *sec, double *msec, int *utc_offset);
const char *clone_combo_set; /*!< String describing key combination to enter load cloning mode */
const char *clone_combo_get; /*!< String describing key combination to enter save cloning mode */
@@ -3175,6 +3177,8 @@ extern HAMLIB_EXPORT(int) rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rm
extern HAMLIB_EXPORT(int) rig_get_rig_info(RIG *rig, char *response, int max_response_len);
extern HAMLIB_EXPORT(int) rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int * cache_ms_freq, rmode_t *mode, int *cache_ms_mode, pbwidth_t *width, int *cache_ms_width);
+extern HAMLIB_EXPORT(int) rig_set_clock(RIG *rig, int year, int month, int day, int hour, int min, int sec, double msec, int utc_offset);
+extern HAMLIB_EXPORT(int) rig_get_clock(RIG *rig, int *year, int *month, int *day, int *hour, int *min, int *sec, double *msec, int *utc_offset);
typedef unsigned long rig_useconds_t;
extern HAMLIB_EXPORT(int) hl_usleep(rig_useconds_t msec);
diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c
index 9c5c8fae..df01574d 100644
--- a/rigs/dummy/dummy.c
+++ b/rigs/dummy/dummy.c
@@ -2140,6 +2140,55 @@ static int dummy_mW2power(RIG *rig, float *power, unsigned int mwpower,
RETURNFUNC(RIG_OK);
}
+static int m_year, m_month, m_day, m_hour, m_min, m_sec, m_utc_offset;
+static double m_msec;
+
+int dummy_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
+ int sec, double msec, int utc_offset)
+{
+ int retval = RIG_OK;
+
+ rig_debug(RIG_DEBUG_VERBOSE, "%s: %04d-%02d-%02dT%02d:%02d:%02d.%.03f%s%02d\n",
+ __func__, year,
+ month, day,...
[truncated message content] |