kopia lustrzana https://github.com/Hamlib/Hamlib
Added rig_get_caps_int and rig_get_caps_cptr functions to replace using caps-> values
https://github.com/Hamlib/Hamlib/issues/484pull/494/head
rodzic
325dc8497b
commit
aafaafd473
4
NEWS
4
NEWS
|
@ -6,6 +6,10 @@ Copyright (C) 2000-2020 Michael Black W9MDB, and others
|
|||
|
||||
Please send Hamlib bug reports to hamlib-developer@lists.sourceforge.net
|
||||
|
||||
Version 4.1
|
||||
* New rig_get_caps_int and rig_get_caps_cptr functions to replace using caps-> values
|
||||
* New rig_get_function to replace using caps-> function pointers
|
||||
|
||||
Version 4.0
|
||||
2020-11-29
|
||||
* API/ABI changes, advance ABI to 4 0 0.
|
||||
|
|
|
@ -1938,6 +1938,39 @@ enum rig_function_e {
|
|||
//! @cond Doxygen_Suppress
|
||||
extern void *rig_get_function_ptr(RIG *rig, enum rig_function_e rig_function);
|
||||
|
||||
/**
|
||||
* \brief Enumeration of rig->caps values
|
||||
*
|
||||
*/
|
||||
//! @cond Doxygen_Suppress
|
||||
// values enumerated for rig->caps values
|
||||
enum rig_caps_int_e {
|
||||
RIG_CAPS_TARGETABLE_VFO,
|
||||
RIG_CAPS_RIG_MODEL,
|
||||
RIG_CAPS_PORT_TYPE,
|
||||
RIG_CAPS_PTT_TYPE
|
||||
};
|
||||
|
||||
enum rig_caps_cptr_e {
|
||||
RIG_CAPS_VERSION,
|
||||
RIG_CAPS_MFG_NAME,
|
||||
RIG_CAPS_MODEL_NAME
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Function to return int value from rig->caps
|
||||
*
|
||||
*/
|
||||
//! @cond Doxygen_Suppress
|
||||
extern int rig_get_caps_int(RIG *rig, enum rig_caps_int_e rig_caps);
|
||||
|
||||
/**
|
||||
* \brief Function to return char pointer value from rig->caps
|
||||
*
|
||||
*/
|
||||
//! @cond Doxygen_Suppress
|
||||
extern const char* rig_get_caps_cptr(RIG *rig, enum rig_caps_cptr_e rig_caps);
|
||||
|
||||
/**
|
||||
* \brief Port definition
|
||||
*
|
||||
|
|
41
src/misc.c
41
src/misc.c
|
@ -2077,7 +2077,48 @@ void *rig_get_function_ptr(RIG *rig, enum rig_function_e rig_function)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
int rig_get_caps_int(RIG *rig, enum rig_caps_int_e rig_caps)
|
||||
{
|
||||
switch (rig_caps)
|
||||
{
|
||||
case RIG_CAPS_TARGETABLE_VFO:
|
||||
return rig->caps->targetable_vfo;
|
||||
|
||||
case RIG_CAPS_RIG_MODEL:
|
||||
return rig->caps->rig_model;
|
||||
|
||||
case RIG_CAPS_PTT_TYPE:
|
||||
return rig->caps->ptt_type;
|
||||
|
||||
case RIG_CAPS_PORT_TYPE:
|
||||
return rig->caps->port_type;
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unknown rig_caps value=%d\n", __func__, rig_caps);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
const char *rig_get_caps_cptr(RIG *rig, enum rig_caps_cptr_e rig_caps)
|
||||
{
|
||||
switch (rig_caps)
|
||||
{
|
||||
case RIG_CAPS_VERSION:
|
||||
return rig->caps->version;
|
||||
|
||||
case RIG_CAPS_MFG_NAME:
|
||||
return rig->caps->mfg_name;
|
||||
|
||||
case RIG_CAPS_MODEL_NAME:
|
||||
return rig->caps->model_name;
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unknown rig_caps value=%d\n", __func__, rig_caps);
|
||||
return "Unknown caps value";
|
||||
}
|
||||
}
|
||||
|
||||
//! @endcond
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue