kopia lustrzana https://github.com/Hamlib/Hamlib
Add levelagcvalue and levelagcstr functions
https://github.com/Hamlib/Hamlib/issues/883pull/891/head
rodzic
550e5daa3b
commit
b90c745239
|
@ -304,6 +304,21 @@ typedef enum {
|
|||
RIG_FLAG_TUNER = (1 << 11) /*!< dumb tuner */
|
||||
} rig_type_t;
|
||||
|
||||
/**
|
||||
* \brief AGC delay settings
|
||||
*/
|
||||
/* TODO: kill me, and replace by real AGC delay */
|
||||
enum agc_level_e {
|
||||
RIG_AGC_OFF = 0,
|
||||
RIG_AGC_SUPERFAST,
|
||||
RIG_AGC_FAST,
|
||||
RIG_AGC_SLOW,
|
||||
RIG_AGC_USER, /*!< user selectable */
|
||||
RIG_AGC_MEDIUM,
|
||||
RIG_AGC_AUTO
|
||||
};
|
||||
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
#define RIG_FLAG_TRANSCEIVER (RIG_FLAG_RECEIVER|RIG_FLAG_TRANSMITTER)
|
||||
#define RIG_TYPE_MASK (RIG_FLAG_TRANSCEIVER|RIG_FLAG_SCANNER|RIG_FLAG_MOBILE|RIG_FLAG_HANDHELD|RIG_FLAG_COMPUTER|RIG_FLAG_TRUNKING|RIG_FLAG_TUNER)
|
||||
|
@ -833,20 +848,6 @@ typedef unsigned int ant_t;
|
|||
#define RIG_ANT_MAX 32
|
||||
|
||||
|
||||
/**
|
||||
* \brief AGC delay settings
|
||||
*/
|
||||
/* TODO: kill me, and replace by real AGC delay */
|
||||
enum agc_level_e {
|
||||
RIG_AGC_OFF = 0,
|
||||
RIG_AGC_SUPERFAST,
|
||||
RIG_AGC_FAST,
|
||||
RIG_AGC_SLOW,
|
||||
RIG_AGC_USER, /*!< user selectable */
|
||||
RIG_AGC_MEDIUM,
|
||||
RIG_AGC_AUTO
|
||||
};
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
#define RIG_AGC_LAST RIG_AGC_AUTO
|
||||
//! @endcond
|
||||
|
@ -3153,6 +3154,8 @@ extern HAMLIB_EXPORT(const char *) rig_strfunc(setting_t);
|
|||
extern HAMLIB_EXPORT(const char *) rig_strlevel(setting_t);
|
||||
extern HAMLIB_EXPORT(const char *) rig_strparm(setting_t);
|
||||
extern HAMLIB_EXPORT(const char *) rig_stragclevel(enum agc_level_e level);
|
||||
extern HAMLIB_EXPORT(enum agc_level_e) rig_levelagcstr (char *agcString);
|
||||
extern HAMLIB_EXPORT(enum agc_level_e) rig_levelagcvalue (int agcValue);
|
||||
extern HAMLIB_EXPORT(const char *) rig_strptrshift(rptr_shift_t);
|
||||
extern HAMLIB_EXPORT(const char *) rig_strvfop(vfo_op_t op);
|
||||
extern HAMLIB_EXPORT(const char *) rig_strscan(scan_t scan);
|
||||
|
|
54
src/misc.c
54
src/misc.c
|
@ -1266,6 +1266,57 @@ const char *HAMLIB_API rig_stragclevel(enum agc_level_e level)
|
|||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Convert a value to agc_level_e -- constrains the range
|
||||
* \param integer...
|
||||
* \return agc_level_e
|
||||
*/
|
||||
enum agc_level_e levelagcvalue(int agcValue)
|
||||
{
|
||||
enum agc_level_e agcLevel;
|
||||
|
||||
switch (agcValue)
|
||||
{
|
||||
case 0: agcLevel = RIG_AGC_OFF; break;
|
||||
|
||||
case 1: agcLevel = RIG_AGC_SUPERFAST; break;
|
||||
|
||||
case 2: agcLevel = RIG_AGC_FAST; break;
|
||||
|
||||
case 3: agcLevel = RIG_AGC_SLOW; break;
|
||||
|
||||
case 4: agcLevel = RIG_AGC_USER; break;
|
||||
|
||||
case 5: agcLevel = RIG_AGC_MEDIUM; break;
|
||||
|
||||
case 6: agcLevel = RIG_AGC_AUTO; break;
|
||||
|
||||
default: agcLevel = RIG_AGC_AUTO; break;
|
||||
}
|
||||
|
||||
return agcLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Convert AGC string... to agc_level_e
|
||||
* \param mode AGC string...
|
||||
* \return agc_level_e
|
||||
*/
|
||||
enum agc_level_e levelagcstr(char *agcString)
|
||||
{
|
||||
enum agc_level_e agcLevel;
|
||||
|
||||
if (strcmp(agcString, "OFF") == 0) { agcLevel = RIG_AGC_OFF; }
|
||||
else if (strcmp(agcString, "SUPERFAST") == 0) { agcLevel = RIG_AGC_SUPERFAST; }
|
||||
else if (strcmp(agcString, "FAST") == 0) { agcLevel = RIG_AGC_FAST; }
|
||||
else if (strcmp(agcString, "SLOW") == 0) { agcLevel = RIG_AGC_SLOW; }
|
||||
else if (strcmp(agcString, "USER") == 0) { agcLevel = RIG_AGC_USER; }
|
||||
else if (strcmp(agcString, "MEDIUM") == 0) { agcLevel = RIG_AGC_MEDIUM; }
|
||||
else { agcLevel = RIG_AGC_AUTO; }
|
||||
|
||||
return agcLevel;
|
||||
}
|
||||
|
||||
|
||||
static const struct
|
||||
{
|
||||
|
@ -2449,7 +2500,8 @@ char *date_strget(char *buf, int buflen, int localtime)
|
|||
gettimeofday(&tv, NULL);
|
||||
snprintf(tmpbuf, sizeof(tmpbuf), "%06ld", (long)tv.tv_usec);
|
||||
strcat(buf, tmpbuf);
|
||||
snprintf(tmpbuf, sizeof(tmpbuf), "%s%04d", mytimezone >=0? "-":"+", ((int)abs(mytimezone)/3600)*100);
|
||||
snprintf(tmpbuf, sizeof(tmpbuf), "%s%04d", mytimezone >= 0 ? "-" : "+",
|
||||
((int)abs(mytimezone) / 3600) * 100);
|
||||
strcat(buf, tmpbuf);
|
||||
return buf;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue