From e172d343816c8514b9892375851bc4bf9ed6f81b Mon Sep 17 00:00:00 2001 From: George Baltz N3GB Date: Mon, 28 Jul 2025 11:32:34 -0400 Subject: [PATCH] Deprecate amp_get_conf(), too --- c++/ampclass.cc | 16 ++++++++++++---- include/hamlib/ampclass.h | 2 ++ include/hamlib/amplifier.h | 9 +++++++-- tests/ampctl_parse.c | 2 +- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/c++/ampclass.cc b/c++/ampclass.cc index 72509c6d7..401051aed 100644 --- a/c++/ampclass.cc +++ b/c++/ampclass.cc @@ -74,13 +74,21 @@ void Amplifier::setConf(const char *name, const char *val) CHECK_AMP( amp_set_conf(theAmp, tokenLookup(name), val) ); } -void Amplifier::getConf(hamlib_token_t token, char *val) +HL_DEPRECATED void Amplifier::getConf(hamlib_token_t token, char *val) { - CHECK_AMP( amp_get_conf(theAmp, token, val) ); + CHECK_AMP( amp_get_conf2(theAmp, token, val, 128) ); } -void Amplifier::getConf(const char *name, char *val) +HL_DEPRECATED void Amplifier::getConf(const char *name, char *val) { - CHECK_AMP( amp_get_conf(theAmp, tokenLookup(name), val) ); + CHECK_AMP( amp_get_conf2(theAmp, tokenLookup(name), val, 128) ); +} +void Amplifier::getConf2(hamlib_token_t token, char *val, int val_len) +{ + CHECK_AMP( amp_get_conf2(theAmp, token, val, val_len) ); +} +void Amplifier::getConf2(const char *name, char *val, int val_len) +{ + CHECK_AMP( amp_get_conf2(theAmp, tokenLookup(name), val, val_len) ); } hamlib_token_t Amplifier::tokenLookup(const char *name) diff --git a/include/hamlib/ampclass.h b/include/hamlib/ampclass.h index 1bb5876b7..31415c6dd 100644 --- a/include/hamlib/ampclass.h +++ b/include/hamlib/ampclass.h @@ -57,6 +57,8 @@ public: void setConf(const char *name, const char *val); void getConf(hamlib_token_t token, char *val); void getConf(const char *name, char *val); + void getConf2(hamlib_token_t token, char *val, int val_len); + void getConf2(const char *name, char *val, int val_len); hamlib_token_t tokenLookup(const char *name); void setFreq(freq_t freq); diff --git a/include/hamlib/amplifier.h b/include/hamlib/amplifier.h index dd1ab62b4..f49d1d37f 100644 --- a/include/hamlib/amplifier.h +++ b/include/hamlib/amplifier.h @@ -232,7 +232,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, hamlib_token_t token, const char *val); /*!< Pointer to backend implementation of amp_set_conf(). */ - int (*get_conf2)(AMP *amp, hamlib_token_t token, char *val, int val_len); /*!< Pointer to backend implementation of amp_get_conf(). */ + int (*get_conf2)(AMP *amp, hamlib_token_t token, char *val, int val_len); /*!< Pointer to backend implementation of amp_get_conf2(). */ int (*get_conf)(AMP *amp, hamlib_token_t token, char *val); /*!< Pointer to backend implementation of amp_get_conf(). */ /* @@ -310,11 +310,16 @@ extern HAMLIB_EXPORT(int) amp_set_conf HAMLIB_PARAMS((AMP *amp, hamlib_token_t token, const char *val)); -extern HAMLIB_EXPORT(int) +HL_DEPRECATED extern HAMLIB_EXPORT(int) amp_get_conf HAMLIB_PARAMS((AMP *amp, hamlib_token_t token, char *val)); extern HAMLIB_EXPORT(int) +amp_get_conf2 HAMLIB_PARAMS((AMP *amp, + hamlib_token_t token, + char *val, + int val_len)); +extern HAMLIB_EXPORT(int) amp_set_powerstat HAMLIB_PARAMS((AMP *amp, powerstat_t status)); extern HAMLIB_EXPORT(int) diff --git a/tests/ampctl_parse.c b/tests/ampctl_parse.c index b54bd0235..e359b20b6 100644 --- a/tests/ampctl_parse.c +++ b/tests/ampctl_parse.c @@ -1501,7 +1501,7 @@ int print_conf_list(const struct confparams *cfp, rig_ptr_t data) int i; char buf[128] = ""; - amp_get_conf(amp, cfp->token, buf); + amp_get_conf2(amp, cfp->token, buf, sizeof(buf)); printf("%s: \"%s\"\n" "\tDefault: %s, Value: %s\n", cfp->name, cfp->tooltip,