From c29279d59dc88897f33162b03cdac8bdd82fe212 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Fri, 5 Apr 2024 09:01:28 -0500 Subject: [PATCH] Fix Hamlib build to work with older and newer hamlib/rig.h by using RIGCAPS_NOT_CONST flag Change rig_model to standard type from rig.h --- src/AppFrame.h | 5 +++-- src/rig/RigThread.cpp | 4 ++++ src/rig/RigThread.h | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/AppFrame.h b/src/AppFrame.h index 481e6c9..71d37b0 100644 --- a/src/AppFrame.h +++ b/src/AppFrame.h @@ -33,6 +33,7 @@ #ifdef USE_HAMLIB +#include class PortSelectorDialog; #endif @@ -297,7 +298,7 @@ private: std::map rigSerialMenuItems; std::map rigModelMenuItems; wxMenu *rigModelMenu; - int rigModel; + rig_model_t rigModel; int rigSerialRate; long long rigSDRIF; std::vector rigSerialRates; @@ -386,4 +387,4 @@ private: #define wxID_RIG_FOLLOW_MODEM 11906 #define wxID_RIG_SERIAL_BASE 11950 #define wxID_RIG_MODEL_BASE 12000 -#endif \ No newline at end of file +#endif diff --git a/src/rig/RigThread.cpp b/src/rig/RigThread.cpp index f266cdd..ecb0da9 100644 --- a/src/rig/RigThread.cpp +++ b/src/rig/RigThread.cpp @@ -32,7 +32,11 @@ RigList &RigThread::enumerate() { return RigThread::rigCaps; } +#ifdef RIGCAPS_NOT_CONST +int RigThread::add_hamlib_rig(struct rig_caps *rc, void* /* f */) +#else int RigThread::add_hamlib_rig(const struct rig_caps *rc, void* /* f */) +#endif { rigCaps.push_back(rc); return 1; diff --git a/src/rig/RigThread.h b/src/rig/RigThread.h index af65fb9..0ae0f91 100644 --- a/src/rig/RigThread.h +++ b/src/rig/RigThread.h @@ -50,7 +50,11 @@ public: std::string getErrorMessage(); static RigList &enumerate(); +#ifdef RIGCAPS_NOT_CONST + static int add_hamlib_rig(struct rig_caps *rc, void* f); +#else static int add_hamlib_rig(const struct rig_caps *rc, void* f); +#endif protected: void setErrorStateFromHamlibCode(int errcode);