git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@494 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.1
Stéphane Fillod, F8CFE 2001-05-24 22:24:18 +00:00
rodzic 0b2b629a1c
commit a4b66f55e1
2 zmienionych plików z 24 dodań i 15 usunięć

Wyświetl plik

@ -5,7 +5,7 @@
* will be used for obtaining rig capabilities. * will be used for obtaining rig capabilities.
* *
* *
* $Id: rig.h,v 1.30 2001-05-04 22:34:33 f4cfe Exp $ * $Id: rig.h,v 1.31 2001-05-24 22:24:18 f4cfe Exp $
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -31,6 +31,10 @@
#include <stdio.h> /* required for FILE definition */ #include <stdio.h> /* required for FILE definition */
#include <sys/time.h> /* required for struct timeval */ #include <sys/time.h> /* required for struct timeval */
#ifdef __cplusplus
extern "C" {
#endif
extern const char hamlib_version[]; extern const char hamlib_version[];
extern const int full_ctcss_list[]; extern const int full_ctcss_list[];
@ -570,10 +574,10 @@ struct channel {
shortfreq_t xit; shortfreq_t xit;
setting_t funcs; setting_t funcs;
value_t levels[RIG_SETTING_MAX]; value_t levels[RIG_SETTING_MAX];
int ctcss; unsigned int ctcss;
int ctcss_sql; unsigned int ctcss_sql;
int dcs; unsigned int dcs;
int dcs_sql; unsigned int dcs_sql;
char channel_desc[MAXCHANDESC]; char channel_desc[MAXCHANDESC];
}; };
@ -1026,7 +1030,7 @@ extern int rig_set_trn(RIG *rig, vfo_t vfo, int trn); /* activate the transceive
extern int rig_get_trn(RIG *rig, vfo_t vfo, int *trn); extern int rig_get_trn(RIG *rig, vfo_t vfo, int *trn);
extern unsigned char *rig_get_info(RIG *rig); extern const char *rig_get_info(RIG *rig);
extern const struct rig_caps *rig_get_caps(rig_model_t rig_model); extern const struct rig_caps *rig_get_caps(rig_model_t rig_model);
const freq_range_t *rig_get_range(const freq_range_t range_list[], freq_t freq, rmode_t mode); const freq_range_t *rig_get_range(const freq_range_t range_list[], freq_t freq, rmode_t mode);
@ -1038,6 +1042,7 @@ extern pbwidth_t rig_passband_wide(RIG *rig, rmode_t mode);
extern const char *rigerror(int errnum); extern const char *rigerror(int errnum);
extern int rig_setting2idx(setting_t s); extern int rig_setting2idx(setting_t s);
#define rig_idx2setting(i) (1<<(i))
/* /*
* Even if these functions are prefixed with "rig_", they are not rig specific * Even if these functions are prefixed with "rig_", they are not rig specific
@ -1052,5 +1057,9 @@ int rig_unregister(rig_model_t rig_model);
int rig_list_foreach(int (*cfunc)(const struct rig_caps*,void*),void *data); int rig_list_foreach(int (*cfunc)(const struct rig_caps*,void*),void *data);
int rig_load_backend(const char *be_name); int rig_load_backend(const char *be_name);
#ifdef __cplusplus
}
#endif
#endif /* _RIG_H */ #endif /* _RIG_H */

Wyświetl plik

@ -2,7 +2,7 @@
Copyright (C) 2000,2001 Stephane Fillod and Frank Singleton Copyright (C) 2000,2001 Stephane Fillod and Frank Singleton
This file is part of the hamlib package. This file is part of the hamlib package.
$Id: rig.c,v 1.27 2001-05-04 22:44:10 f4cfe Exp $ $Id: rig.c,v 1.28 2001-05-24 22:24:18 f4cfe Exp $
Hamlib is free software; you can redistribute it and/or modify it Hamlib is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by under the terms of the GNU General Public License as published by
@ -3345,7 +3345,7 @@ int rig_save_channel(RIG *rig, channel_t *chan)
rig_get_rptr_offs(rig, RIG_VFO_CURR, &chan->rptr_offs); rig_get_rptr_offs(rig, RIG_VFO_CURR, &chan->rptr_offs);
for (i=0; i<RIG_SETTING_MAX; i++) for (i=0; i<RIG_SETTING_MAX; i++)
rig_get_level(rig, RIG_VFO_CURR, 1<<i, &chan->levels[i]); rig_get_level(rig, RIG_VFO_CURR, rig_idx2setting(i), &chan->levels[i]);
rig_get_ant(rig, RIG_VFO_CURR, &chan->ant); rig_get_ant(rig, RIG_VFO_CURR, &chan->ant);
rig_get_ts(rig, RIG_VFO_CURR, &chan->tuning_step); rig_get_ts(rig, RIG_VFO_CURR, &chan->tuning_step);
@ -3355,8 +3355,8 @@ int rig_save_channel(RIG *rig, channel_t *chan)
chan->funcs = 0; chan->funcs = 0;
for (i=0; i<RIG_SETTING_MAX; i++) { for (i=0; i<RIG_SETTING_MAX; i++) {
int fstatus; int fstatus;
rig_get_func(rig, RIG_VFO_CURR, 1<<i, &fstatus); rig_get_func(rig, RIG_VFO_CURR, rig_idx2setting(i), &fstatus);
chan->funcs |= fstatus? 1<<i : 0; chan->funcs |= fstatus? rig_idx2setting(i) : 0;
} }
rig_get_ctcss(rig, RIG_VFO_CURR, &chan->ctcss); rig_get_ctcss(rig, RIG_VFO_CURR, &chan->ctcss);
@ -3416,9 +3416,8 @@ int rig_restore_channel(RIG *rig, const channel_t *chan)
rig_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_ATT, chan->att); rig_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_ATT, chan->att);
rig_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, chan->preamp); rig_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, chan->preamp);
#else #else
// define rig_idx2setting(s) (1<<(s))
for (i=0; i<RIG_SETTING_MAX; i++) for (i=0; i<RIG_SETTING_MAX; i++)
rig_set_level(rig, RIG_VFO_CURR, 1<<i, chan->levels[i]); rig_set_level(rig, RIG_VFO_CURR, rig_idx2setting(i), chan->levels[i]);
#endif #endif
rig_set_ant(rig, RIG_VFO_CURR, chan->ant); rig_set_ant(rig, RIG_VFO_CURR, chan->ant);
@ -3427,7 +3426,8 @@ int rig_restore_channel(RIG *rig, const channel_t *chan)
rig_set_xit(rig, RIG_VFO_CURR, chan->xit); rig_set_xit(rig, RIG_VFO_CURR, chan->xit);
for (i=0; i<RIG_SETTING_MAX; i++) for (i=0; i<RIG_SETTING_MAX; i++)
rig_set_func(rig, RIG_VFO_CURR, 1<<i, chan->funcs & (1<<i)); rig_set_func(rig, RIG_VFO_CURR, rig_idx2setting(i),
chan->funcs & rig_idx2setting(i));
rig_set_ctcss(rig, RIG_VFO_CURR, chan->ctcss); rig_set_ctcss(rig, RIG_VFO_CURR, chan->ctcss);
rig_set_ctcss_sql(rig, RIG_VFO_CURR, chan->ctcss_sql); rig_set_ctcss_sql(rig, RIG_VFO_CURR, chan->ctcss_sql);
@ -3653,7 +3653,7 @@ int rig_get_trn(RIG *rig, vfo_t vfo, int *trn)
* if the operation has been sucessful, or NULL * if the operation has been sucessful, or NULL
* if an error occured. * if an error occured.
*/ */
unsigned char* rig_get_info(RIG *rig) const char* rig_get_info(RIG *rig)
{ {
if (!rig || !rig->caps) if (!rig || !rig->caps)
return NULL; return NULL;
@ -3680,7 +3680,7 @@ int rig_setting2idx(setting_t s)
int i; int i;
for (i = 0; i<RIG_SETTING_MAX; i++) for (i = 0; i<RIG_SETTING_MAX; i++)
if (s & (1<<i)) if (s & rig_idx2setting(i))
return i; return i;
return 0; return 0;