From fd935597a9cddd7e58a6ddd9fcb526116ab5ba86 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Mon, 10 Jan 2022 08:48:08 -0600 Subject: [PATCH] Finish implementing rig_get_conf2 https://github.com/Hamlib/Hamlib/issues/924 --- include/hamlib/rig.h | 1 + src/conf.c | 14 ++++++++++++-- src/misc.c | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index dd16282ca..63939d793 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -2105,6 +2105,7 @@ enum rig_function_e { RIG_FUNCTION_READ_FRAME_DIRECT, RIG_FUNCTION_IS_ASYNC_FRAME, RIG_FUNCTION_PROCESS_ASYNC_FRAME, + RIG_FUNCTION_GET_CONF2, }; /** diff --git a/src/conf.c b/src/conf.c index b6225476a..8aefb1734 100644 --- a/src/conf.c +++ b/src/conf.c @@ -692,7 +692,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val) * frontend_get_conf * assumes rig!=NULL, val!=NULL */ -static int frontend_get_conf(RIG *rig, token_t token, char *val) +static int frontend_get_conf2(RIG *rig, token_t token, char *val, int val_len) { struct rig_state *rs; const char *s = ""; @@ -1245,6 +1245,11 @@ int HAMLIB_API rig_set_conf(RIG *rig, token_t token, const char *val) * \sa rig_set_conf() */ int HAMLIB_API rig_get_conf(RIG *rig, token_t token, char *val) +{ + return rig_get_conf2(rig, token, val, 128); +} + +int HAMLIB_API rig_get_conf2(RIG *rig, token_t token, char *val, int val_len) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -1255,7 +1260,12 @@ int HAMLIB_API rig_get_conf(RIG *rig, token_t token, char *val) if (IS_TOKEN_FRONTEND(token)) { - return frontend_get_conf(rig, token, val); + return frontend_get_conf2(rig, token, val, val_len); + } + + if (rig->caps->get_conf2) + { + return rig->caps->get_conf2(rig, token, val, val_len); } if (rig->caps->get_conf == NULL) diff --git a/src/misc.c b/src/misc.c index 3b2e40cd5..20f2ac07e 100644 --- a/src/misc.c +++ b/src/misc.c @@ -2351,6 +2351,9 @@ void *HAMLIB_API rig_get_function_ptr(rig_model_t rig_model, case RIG_FUNCTION_GET_CONF: return caps->get_conf; + case RIG_FUNCTION_GET_CONF2: + return caps->get_conf2; + case RIG_FUNCTION_SEND_DTMF: return caps->send_dtmf;