Definitions, storage and infrastructure for queuing config commands

pull/1568/head
George Baltz N3GB 2024-06-14 15:34:48 -04:00
rodzic 341a205bd7
commit 86a7a0636c
3 zmienionych plików z 52 dodań i 0 usunięć

Wyświetl plik

@ -1853,6 +1853,22 @@ struct rig_spectrum_line
unsigned char *spectrum_data; /*!< 8-bit spectrum data covering bandwidth of either the span_freq in center mode or from low edge to high edge in fixed mode. A higher value represents higher signal strength. */
};
/**
* Config item for deferred processing
**/
struct deferred_config_item {
struct deferred_config_item *next;
hamlib_token_t token;
char *value; // strdup'ed, must be freed
};
typedef struct deferred_config_item deferred_config_item_t;
struct deferred_config_header {
struct deferred_config_item *first; // NULL if none
struct deferred_config_item *last;
};
typedef struct deferred_config_header deferred_config_header_t;
/**
* \brief Rig data structure.
*

Wyświetl plik

@ -3125,4 +3125,38 @@ int rig_test_2038(RIG *rig)
//! @endcond
/**
* Add item to be sent to device after it is opened
* (currently only used by rotators)
**/
int queue_deferred_config(deferred_config_header_t *head, hamlib_token_t token, const char *val)
{
deferred_config_item_t *item;
if (!(item = malloc(sizeof(deferred_config_item_t))))
{
return -RIG_ENOMEM;
}
if (!(item->value = strdup(val)))
{
free(item);
return -RIG_ENOMEM;
}
item->token = token;
item->next = NULL;
if (!head->first)
{
head->first = item;
}
else
{
head->last->next = item;
}
head->last = item;
return RIG_OK;
}
/** @} */

Wyświetl plik

@ -211,6 +211,8 @@ extern HAMLIB_EXPORT(int) rig_settings_load_all(char *settings_file);
extern int check_level_param(RIG *rig, setting_t level, value_t val, gran_t **gran);
extern int queue_deferred_config(deferred_config_header_t *head, hamlib_token_t token, const char *val);
// Takes rig-specific band result and maps it the bandlist int the rig's backend
extern HAMLIB_EXPORT(hamlib_band_t) rig_get_band(RIG *rig, freq_t freq, int band);
extern HAMLIB_EXPORT(const char*) rig_get_band_str(RIG *rig, hamlib_band_t band, int which);