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
This commit is contained in:
Mike Black W9MDB 2024-04-05 09:01:28 -05:00
parent 033330367c
commit c29279d59d
3 changed files with 11 additions and 2 deletions

View File

@ -33,6 +33,7 @@
#ifdef USE_HAMLIB
#include <hamlib/rig.h>
class PortSelectorDialog;
#endif
@ -297,7 +298,7 @@ private:
std::map<int, wxMenuItem *> rigSerialMenuItems;
std::map<int, wxMenuItem *> rigModelMenuItems;
wxMenu *rigModelMenu;
int rigModel;
rig_model_t rigModel;
int rigSerialRate;
long long rigSDRIF;
std::vector<int> 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
#endif

View File

@ -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;

View File

@ -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);