kopia lustrzana https://github.com/Hamlib/Hamlib
make use of save memory at once API, and make CSV separator a parameter
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2026 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.5
rodzic
579823eb53
commit
1fe29dce61
201
tests/memcsv.c
201
tests/memcsv.c
|
@ -4,7 +4,7 @@
|
|||
* This program exercises the backup and restore of a radio
|
||||
* using Hamlib. CSV primitives
|
||||
*
|
||||
* $Id: memcsv.c,v 1.7 2005-04-15 21:14:10 fillods Exp $
|
||||
* $Id: memcsv.c,v 1.8 2005-04-20 14:47:04 fillods Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -47,10 +47,12 @@
|
|||
|
||||
extern int all;
|
||||
|
||||
char csv_sep = ','; /* CSV separator */
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
static void dump_csv_chan(const channel_cap_t *mem_caps, const channel_t *chan, FILE *f);
|
||||
static int dump_csv_chan(RIG *rig, channel_t **chan, int channel_num, const chan_t *chan_list, rig_ptr_t arg);
|
||||
static void dump_csv_name(const channel_cap_t *mem_caps, FILE *f);
|
||||
|
||||
int csv_save (RIG *rig, const char *outfilename);
|
||||
|
@ -62,42 +64,21 @@ int csv_parm_load (RIG *rig, const char *infilename);
|
|||
|
||||
int csv_save (RIG *rig, const char *outfilename)
|
||||
{
|
||||
int i,j,status;
|
||||
int status;
|
||||
FILE *f;
|
||||
channel_t chan;
|
||||
|
||||
f = fopen(outfilename, "w");
|
||||
if (!f)
|
||||
return -1;
|
||||
|
||||
if (rig->caps->clone_combo_get)
|
||||
printf("About to save data, enter cloning mode: %s\n",
|
||||
rig->caps->clone_combo_get);
|
||||
|
||||
for (i=0; rig->state.chan_list[i].type && i < CHANLSTSIZ; i++) {
|
||||
|
||||
dump_csv_name(&rig->state.chan_list[i].mem_caps, f);
|
||||
|
||||
for (j = rig->state.chan_list[i].start;
|
||||
j <= rig->state.chan_list[i].end; j++) {
|
||||
chan.vfo = RIG_VFO_MEM;
|
||||
chan.channel_num = j;
|
||||
status=rig_get_channel(rig, &chan);
|
||||
|
||||
if (status == -RIG_ENAVAIL ) {
|
||||
/* empty channel */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (status != RIG_OK ) {
|
||||
printf("rig_get_channel: error = %s \n", rigerror(status));
|
||||
return status;
|
||||
}
|
||||
|
||||
dump_csv_chan(&rig->state.chan_list[i].mem_caps, &chan, f);
|
||||
}
|
||||
}
|
||||
|
||||
status = rig_get_chan_all_cb (rig, dump_csv_chan, f);
|
||||
|
||||
fclose(f);
|
||||
return 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
int csv_load (RIG *rig, const char *infilename)
|
||||
|
@ -108,7 +89,7 @@ int csv_load (RIG *rig, const char *infilename)
|
|||
|
||||
static int print_parm_name(RIG *rig, const struct confparams *cfp, rig_ptr_t ptr)
|
||||
{
|
||||
fprintf((FILE*)ptr, "%s;", cfp->name);
|
||||
fprintf((FILE*)ptr, "%s%c", cfp->name, csv_sep);
|
||||
|
||||
return 1; /* process them all */
|
||||
}
|
||||
|
@ -120,18 +101,18 @@ static int print_parm_val(RIG *rig, const struct confparams *cfp, rig_ptr_t ptr)
|
|||
rig_get_ext_parm(rig, cfp->token, &val);
|
||||
|
||||
switch (cfp->type) {
|
||||
case RIG_CONF_CHECKBUTTON:
|
||||
case RIG_CONF_COMBO:
|
||||
fprintf(f,"%d;", val.i);
|
||||
break;
|
||||
case RIG_CONF_NUMERIC:
|
||||
fprintf(f,"%f;", val.f);
|
||||
break;
|
||||
case RIG_CONF_STRING:
|
||||
fprintf(f,"%s;", val.s);
|
||||
break;
|
||||
default:
|
||||
fprintf(f,"unknown;");
|
||||
case RIG_CONF_CHECKBUTTON:
|
||||
case RIG_CONF_COMBO:
|
||||
fprintf(f,"%d%c", val.i, csv_sep);
|
||||
break;
|
||||
case RIG_CONF_NUMERIC:
|
||||
fprintf(f,"%f%c", val.f, csv_sep);
|
||||
break;
|
||||
case RIG_CONF_STRING:
|
||||
fprintf(f,"%s%c", val.s, csv_sep);
|
||||
break;
|
||||
default:
|
||||
fprintf(f,"unknown%c", csv_sep);
|
||||
}
|
||||
|
||||
return 1; /* process them all */
|
||||
|
@ -152,7 +133,7 @@ int csv_parm_save (RIG *rig, const char *outfilename)
|
|||
const char *ms = rig_strparm(get_parm & rig_idx2setting(i));
|
||||
if (!ms || !ms[0])
|
||||
continue;
|
||||
fprintf(f, "%s;", ms);
|
||||
fprintf(f, "%s%c", ms, csv_sep);
|
||||
}
|
||||
|
||||
rig_ext_parm_foreach(rig, print_parm_name, f);
|
||||
|
@ -169,9 +150,9 @@ int csv_parm_save (RIG *rig, const char *outfilename)
|
|||
continue;
|
||||
ret = rig_get_parm(rig, parm, &val);
|
||||
if (RIG_PARM_IS_FLOAT(parm))
|
||||
fprintf(f, "%f;", val.f);
|
||||
fprintf(f, "%f%c", val.f, csv_sep);
|
||||
else
|
||||
fprintf(f, "%d;", val.i);
|
||||
fprintf(f, "%d%c", val.i, csv_sep);
|
||||
}
|
||||
|
||||
|
||||
|
@ -194,162 +175,190 @@ int csv_parm_load (RIG *rig, const char *infilename)
|
|||
|
||||
void dump_csv_name(const channel_cap_t *mem_caps, FILE *f)
|
||||
{
|
||||
fprintf(f, "num;");
|
||||
fprintf(f, "num%c", csv_sep);
|
||||
|
||||
if (mem_caps->bank_num) {
|
||||
fprintf(f, "bank_num;");
|
||||
fprintf(f, "bank_num%c", csv_sep);
|
||||
}
|
||||
|
||||
if (mem_caps->channel_desc) {
|
||||
fprintf(f, "channel_desc;");
|
||||
fprintf(f, "channel_desc%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->vfo) {
|
||||
fprintf(f, "vfo;");
|
||||
fprintf(f, "vfo%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->ant) {
|
||||
fprintf(f, "ant;");
|
||||
fprintf(f, "ant%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->freq) {
|
||||
fprintf(f, "freq;");
|
||||
fprintf(f, "freq%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->mode) {
|
||||
fprintf(f, "mode;");
|
||||
fprintf(f, "mode%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->width) {
|
||||
fprintf(f, "width;");
|
||||
fprintf(f, "width%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->tx_freq) {
|
||||
fprintf(f, "tx_freq;");
|
||||
fprintf(f, "tx_freq%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->tx_mode) {
|
||||
fprintf(f, "tx_mode;");
|
||||
fprintf(f, "tx_mode%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->tx_width) {
|
||||
fprintf(f, "tx_width;");
|
||||
fprintf(f, "tx_width%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->split) {
|
||||
fprintf(f, "split;");
|
||||
fprintf(f, "split%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->tx_vfo) {
|
||||
fprintf(f, "tx_vfo;");
|
||||
fprintf(f, "tx_vfo%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->rptr_shift) {
|
||||
fprintf(f, "rptr_shift;");
|
||||
fprintf(f, "rptr_shift%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->rptr_offs) {
|
||||
fprintf(f, "rptr_offs;");
|
||||
fprintf(f, "rptr_offs%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->tuning_step) {
|
||||
fprintf(f, "tuning_step;");
|
||||
fprintf(f, "tuning_step%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->rit) {
|
||||
fprintf(f, "rit;");
|
||||
fprintf(f, "rit%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->xit) {
|
||||
fprintf(f, "xit;");
|
||||
fprintf(f, "xit%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->funcs) {
|
||||
fprintf(f, "funcs;");
|
||||
fprintf(f, "funcs%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->ctcss_tone) {
|
||||
fprintf(f, "ctcss_tone;");
|
||||
fprintf(f, "ctcss_tone%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->ctcss_sql) {
|
||||
fprintf(f, "ctcss_sql;");
|
||||
fprintf(f, "ctcss_sql%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->dcs_code) {
|
||||
fprintf(f, "dcs_code;");
|
||||
fprintf(f, "dcs_code%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->dcs_sql) {
|
||||
fprintf(f, "dcs_sql;");
|
||||
fprintf(f, "dcs_sql%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->scan_group) {
|
||||
fprintf(f, "scan_group;");
|
||||
fprintf(f, "scan_group%c", csv_sep);
|
||||
}
|
||||
if (mem_caps->flags) {
|
||||
fprintf(f, "flags;");
|
||||
fprintf(f, "flags%c", csv_sep);
|
||||
}
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
|
||||
|
||||
void dump_csv_chan(const channel_cap_t *mem_caps, const channel_t *chan, FILE *f)
|
||||
int dump_csv_chan(RIG *rig, channel_t **chan_pp, int channel_num, const chan_t *chan_list, rig_ptr_t arg)
|
||||
{
|
||||
fprintf(f,"%d;",chan->channel_num);
|
||||
FILE *f = arg;
|
||||
static channel_t chan;
|
||||
static int first_time = 1;
|
||||
const channel_cap_t *mem_caps = &chan_list->mem_caps;
|
||||
|
||||
if (first_time) {
|
||||
dump_csv_name(mem_caps, f);
|
||||
first_time = 0;
|
||||
}
|
||||
|
||||
if (*chan_pp == NULL) {
|
||||
/*
|
||||
* Hamlib frontend demand application an allocated
|
||||
* channel_t pointer for next round.
|
||||
*/
|
||||
*chan_pp = &chan;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
fprintf(f,"%d%c",chan.channel_num, csv_sep);
|
||||
|
||||
if (mem_caps->bank_num) {
|
||||
fprintf(f,"%d;",chan->bank_num);
|
||||
fprintf(f,"%d%c",chan.bank_num, csv_sep);
|
||||
}
|
||||
|
||||
if (mem_caps->channel_desc) {
|
||||
fprintf(f, "%s;", chan->channel_desc);
|
||||
fprintf(f, "%s%c", chan.channel_desc, csv_sep);
|
||||
}
|
||||
if (mem_caps->vfo) {
|
||||
fprintf(f,"%s;",rig_strvfo(chan->vfo));
|
||||
fprintf(f,"%s%c",rig_strvfo(chan.vfo), csv_sep);
|
||||
}
|
||||
if (mem_caps->ant) {
|
||||
fprintf(f,"%d;",chan->ant);
|
||||
fprintf(f,"%d%c",chan.ant, csv_sep);
|
||||
}
|
||||
if (mem_caps->freq) {
|
||||
fprintf(f,"%"PRIfreq";",chan->freq);
|
||||
fprintf(f,"%.0"PRIfreq"%c",chan.freq, csv_sep);
|
||||
}
|
||||
if (mem_caps->mode) {
|
||||
fprintf(f, "%s;", rig_strrmode(chan->mode));
|
||||
fprintf(f, "%s%c", rig_strrmode(chan.mode), csv_sep);
|
||||
}
|
||||
if (mem_caps->width) {
|
||||
fprintf(f,"%d;",(int)chan->width);
|
||||
fprintf(f,"%d%c",(int)chan.width, csv_sep);
|
||||
}
|
||||
if (mem_caps->tx_freq) {
|
||||
fprintf(f,"%"PRIfreq";",chan->tx_freq);
|
||||
fprintf(f,"%.0"PRIfreq"%c",chan.tx_freq, csv_sep);
|
||||
}
|
||||
if (mem_caps->tx_mode) {
|
||||
fprintf(f, "%s;", rig_strrmode(chan->tx_mode));
|
||||
fprintf(f, "%s%c", rig_strrmode(chan.tx_mode), csv_sep);
|
||||
}
|
||||
if (mem_caps->tx_width) {
|
||||
fprintf(f,"%d;",(int)chan->tx_width);
|
||||
fprintf(f,"%d%c",(int)chan.tx_width, csv_sep);
|
||||
}
|
||||
if (mem_caps->split) {
|
||||
fprintf(f, "%s;", chan->split==RIG_SPLIT_ON?"on":"off");
|
||||
fprintf(f, "%s%c", chan.split==RIG_SPLIT_ON?"on":"off", csv_sep);
|
||||
}
|
||||
if (mem_caps->tx_vfo) {
|
||||
fprintf(f,"%s;",rig_strvfo(chan->tx_vfo));
|
||||
fprintf(f,"%s%c",rig_strvfo(chan.tx_vfo), csv_sep);
|
||||
}
|
||||
if (mem_caps->rptr_shift) {
|
||||
fprintf(f, "%s;", rig_strptrshift(chan->rptr_shift));
|
||||
fprintf(f, "%s%c", rig_strptrshift(chan.rptr_shift), csv_sep);
|
||||
}
|
||||
if (mem_caps->rptr_offs) {
|
||||
fprintf(f,"%d;",(int)chan->rptr_offs);
|
||||
fprintf(f,"%d%c",(int)chan.rptr_offs, csv_sep);
|
||||
}
|
||||
if (mem_caps->tuning_step) {
|
||||
fprintf(f,"%d;",(int)chan->tuning_step);
|
||||
fprintf(f,"%d%c",(int)chan.tuning_step, csv_sep);
|
||||
}
|
||||
if (mem_caps->rit) {
|
||||
fprintf(f,"%d;",(int)chan->rit);
|
||||
fprintf(f,"%d%c",(int)chan.rit, csv_sep);
|
||||
}
|
||||
if (mem_caps->xit) {
|
||||
fprintf(f,"%d;",(int)chan->xit);
|
||||
fprintf(f,"%d%c",(int)chan.xit, csv_sep);
|
||||
}
|
||||
if (mem_caps->funcs) {
|
||||
fprintf(f,"%lx;",chan->funcs);
|
||||
fprintf(f,"%lx%c",chan.funcs, csv_sep);
|
||||
}
|
||||
if (mem_caps->ctcss_tone) {
|
||||
fprintf(f,"%d;",chan->ctcss_tone);
|
||||
fprintf(f,"%d%c",chan.ctcss_tone, csv_sep);
|
||||
}
|
||||
if (mem_caps->ctcss_sql) {
|
||||
fprintf(f,"%d;",chan->ctcss_sql);
|
||||
fprintf(f,"%d%c",chan.ctcss_sql, csv_sep);
|
||||
}
|
||||
if (mem_caps->dcs_code) {
|
||||
fprintf(f,"%d;",chan->dcs_code);
|
||||
fprintf(f,"%d%c",chan.dcs_code, csv_sep);
|
||||
}
|
||||
if (mem_caps->dcs_sql) {
|
||||
fprintf(f,"%d;",chan->dcs_sql);
|
||||
fprintf(f,"%d%c",chan.dcs_sql, csv_sep);
|
||||
}
|
||||
if (mem_caps->scan_group) {
|
||||
fprintf(f,"%d;",chan->scan_group);
|
||||
fprintf(f,"%d%c",chan.scan_group, csv_sep);
|
||||
}
|
||||
if (mem_caps->flags) {
|
||||
fprintf(f,"%x;",chan->flags);
|
||||
fprintf(f,"%x%c",chan.flags, csv_sep);
|
||||
}
|
||||
fprintf(f,"\n");
|
||||
|
||||
/*
|
||||
* keep the same *chan_pp for next round, thanks
|
||||
* to chan being static
|
||||
*/
|
||||
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
101
tests/memsave.c
101
tests/memsave.c
|
@ -2,7 +2,7 @@
|
|||
* memsave.c - Copyright (C) 2003-2005 Thierry Leconte
|
||||
*
|
||||
*
|
||||
* $Id: memsave.c,v 1.8 2005-01-25 00:21:44 fillods Exp $
|
||||
* $Id: memsave.c,v 1.9 2005-04-20 14:47:04 fillods Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -37,13 +37,13 @@
|
|||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
static int dump_xml_chan(RIG *rig, xmlNodePtr root ,int chn, int chan_num);
|
||||
static int dump_xml_chan(RIG *rig, channel_t **chan, int channel_num, const chan_t *chan_list, rig_ptr_t arg);
|
||||
#endif
|
||||
|
||||
int xml_save (RIG *my_rig, const char *outfilename)
|
||||
int xml_save (RIG *rig, const char *outfilename)
|
||||
{
|
||||
#ifdef HAVE_XML2
|
||||
int i,j;
|
||||
int retval;
|
||||
xmlDocPtr Doc;
|
||||
xmlNodePtr root;
|
||||
|
||||
|
@ -54,12 +54,13 @@ int xml_save (RIG *my_rig, const char *outfilename)
|
|||
root=xmlNewChild(root,NULL,"channels",NULL);
|
||||
|
||||
|
||||
for (i=0; my_rig->state.chan_list[i].type && i < CHANLSTSIZ; i++) {
|
||||
for (j = my_rig->state.chan_list[i].start;
|
||||
j <= my_rig->state.chan_list[i].end; j++) {
|
||||
dump_xml_chan(my_rig, root, i,j);
|
||||
}
|
||||
}
|
||||
if (rig->caps->clone_combo_get)
|
||||
printf("About to save data, enter cloning mode: %s\n",
|
||||
rig->caps->clone_combo_get);
|
||||
|
||||
retval = rig_get_chan_all_cb (rig, dump_xml_chan, root);
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
|
||||
/* write xml File */
|
||||
|
||||
|
@ -74,7 +75,7 @@ int xml_save (RIG *my_rig, const char *outfilename)
|
|||
#endif
|
||||
}
|
||||
|
||||
int xml_parm_save (RIG *my_rig, const char *outfilename)
|
||||
int xml_parm_save (RIG *rig, const char *outfilename)
|
||||
{
|
||||
return -RIG_ENIMPL;
|
||||
}
|
||||
|
@ -82,28 +83,27 @@ int xml_parm_save (RIG *my_rig, const char *outfilename)
|
|||
|
||||
|
||||
#ifdef HAVE_XML2
|
||||
int dump_xml_chan(RIG *rig, xmlNodePtr root, int i, int chan_num)
|
||||
int dump_xml_chan(RIG *rig, channel_t **chan_pp, int chan_num, const chan_t *chan_list, rig_ptr_t arg)
|
||||
{
|
||||
channel_t chan;
|
||||
int status;
|
||||
char attrbuf[20];
|
||||
xmlNodePtr root = arg;
|
||||
xmlNodePtr node;
|
||||
|
||||
chan.vfo = RIG_VFO_MEM;
|
||||
chan.channel_num = chan_num;
|
||||
status=rig_get_channel(rig, &chan);
|
||||
static channel_t chan;
|
||||
const channel_cap_t *mem_caps = &chan_list->mem_caps;
|
||||
|
||||
|
||||
if (*chan_pp == NULL) {
|
||||
/*
|
||||
* Hamlib frontend demand application an allocated
|
||||
* channel_t pointer for next round.
|
||||
*/
|
||||
*chan_pp = &chan;
|
||||
|
||||
if (status == -RIG_ENAVAIL ) {
|
||||
/* empty channel */
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
if (status != RIG_OK ) {
|
||||
printf("rig_get_channel: error = %s \n", rigerror(status));
|
||||
return status;
|
||||
}
|
||||
|
||||
switch (rig->state.chan_list[i].type) {
|
||||
|
||||
switch (chan_list->type) {
|
||||
case RIG_MTYPE_NONE :
|
||||
return RIG_OK;
|
||||
case RIG_MTYPE_MEM:
|
||||
|
@ -123,7 +123,7 @@ int dump_xml_chan(RIG *rig, xmlNodePtr root, int i, int chan_num)
|
|||
break;
|
||||
}
|
||||
|
||||
if (rig->state.chan_list[i].mem_caps.bank_num) {
|
||||
if (mem_caps->bank_num) {
|
||||
sprintf(attrbuf,"%d",chan.bank_num);
|
||||
xmlNewProp(node, "bank_num", attrbuf);
|
||||
}
|
||||
|
@ -131,47 +131,47 @@ int dump_xml_chan(RIG *rig, xmlNodePtr root, int i, int chan_num)
|
|||
sprintf(attrbuf,"%d",chan.channel_num);
|
||||
xmlNewProp(node, "num", attrbuf);
|
||||
|
||||
if (rig->state.chan_list[i].mem_caps.channel_desc && chan.channel_desc[0]!='\0') {
|
||||
if (mem_caps->channel_desc && chan.channel_desc[0]!='\0') {
|
||||
xmlNewProp(node, "channel_desc", chan.channel_desc);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.vfo) {
|
||||
if (mem_caps->vfo) {
|
||||
sprintf(attrbuf,"%d",chan.vfo);
|
||||
xmlNewProp(node, "vfo", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.ant && chan.ant != RIG_ANT_NONE) {
|
||||
if (mem_caps->ant && chan.ant != RIG_ANT_NONE) {
|
||||
sprintf(attrbuf,"%d",chan.ant);
|
||||
xmlNewProp(node, "ant", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.freq && chan.freq != RIG_FREQ_NONE) {
|
||||
if (mem_caps->freq && chan.freq != RIG_FREQ_NONE) {
|
||||
sprintf(attrbuf,"%"PRIll,(long long)chan.freq);
|
||||
xmlNewProp(node, "freq", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.mode && chan.mode != RIG_MODE_NONE) {
|
||||
if (mem_caps->mode && chan.mode != RIG_MODE_NONE) {
|
||||
xmlNewProp(node, "mode", rig_strrmode(chan.mode));
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.width && chan.width != 0) {
|
||||
if (mem_caps->width && chan.width != 0) {
|
||||
sprintf(attrbuf,"%d",(int)chan.width);
|
||||
xmlNewProp(node, "width", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.tx_freq && chan.tx_freq != RIG_FREQ_NONE) {
|
||||
if (mem_caps->tx_freq && chan.tx_freq != RIG_FREQ_NONE) {
|
||||
sprintf(attrbuf,"%"PRIll,(long long)chan.tx_freq);
|
||||
xmlNewProp(node, "tx_freq", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.tx_mode && chan.tx_mode != RIG_MODE_NONE) {
|
||||
if (mem_caps->tx_mode && chan.tx_mode != RIG_MODE_NONE) {
|
||||
xmlNewProp(node, "tx_mode", rig_strrmode(chan.tx_mode));
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.tx_width && chan.tx_width!=0) {
|
||||
if (mem_caps->tx_width && chan.tx_width!=0) {
|
||||
sprintf(attrbuf,"%d",(int)chan.tx_width);
|
||||
xmlNewProp(node, "tx_width", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.split && chan.split!=RIG_SPLIT_OFF) {
|
||||
if (mem_caps->split && chan.split!=RIG_SPLIT_OFF) {
|
||||
xmlNewProp(node, "split", "on");
|
||||
if (rig->state.chan_list[i].mem_caps.tx_vfo) {
|
||||
if (mem_caps->tx_vfo) {
|
||||
sprintf(attrbuf,"%x",chan.tx_vfo);
|
||||
xmlNewProp(node, "tx_vfo", attrbuf);
|
||||
}
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.rptr_shift && chan.rptr_shift!=RIG_RPT_SHIFT_NONE) {
|
||||
if (mem_caps->rptr_shift && chan.rptr_shift!=RIG_RPT_SHIFT_NONE) {
|
||||
switch(chan.rptr_shift) {
|
||||
case RIG_RPT_SHIFT_NONE:
|
||||
xmlNewProp(node, "rptr_shift", "=");
|
||||
|
@ -183,48 +183,48 @@ int dump_xml_chan(RIG *rig, xmlNodePtr root, int i, int chan_num)
|
|||
xmlNewProp(node, "rptr_shift", "-");
|
||||
break;
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.rptr_offs && (int)chan.rptr_offs!=0) {
|
||||
if (mem_caps->rptr_offs && (int)chan.rptr_offs!=0) {
|
||||
sprintf(attrbuf,"%d",(int)chan.rptr_offs);
|
||||
xmlNewProp(node, "rptr_offs", attrbuf);
|
||||
}
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.tuning_step && chan.tuning_step !=0) {
|
||||
if (mem_caps->tuning_step && chan.tuning_step !=0) {
|
||||
sprintf(attrbuf,"%d",(int)chan.tuning_step);
|
||||
xmlNewProp(node, "tuning_step", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.rit && chan.rit!=0) {
|
||||
if (mem_caps->rit && chan.rit!=0) {
|
||||
sprintf(attrbuf,"%d",(int)chan.rit);
|
||||
xmlNewProp(node, "rit", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.xit && chan.xit !=0) {
|
||||
if (mem_caps->xit && chan.xit !=0) {
|
||||
sprintf(attrbuf,"%d",(int)chan.xit);
|
||||
xmlNewProp(node, "xit", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.funcs) {
|
||||
if (mem_caps->funcs) {
|
||||
sprintf(attrbuf,"%llx",(long long)chan.funcs);
|
||||
xmlNewProp(node, "funcs", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.ctcss_tone && chan.ctcss_tone !=0) {
|
||||
if (mem_caps->ctcss_tone && chan.ctcss_tone !=0) {
|
||||
sprintf(attrbuf,"%d",chan.ctcss_tone);
|
||||
xmlNewProp(node, "ctcss_tone", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.ctcss_sql && chan.ctcss_sql !=0) {
|
||||
if (mem_caps->ctcss_sql && chan.ctcss_sql !=0) {
|
||||
sprintf(attrbuf,"%d",chan.ctcss_sql);
|
||||
xmlNewProp(node, "ctcss_sql", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.dcs_code && chan.dcs_code !=0) {
|
||||
if (mem_caps->dcs_code && chan.dcs_code !=0) {
|
||||
sprintf(attrbuf,"%d",chan.dcs_code);
|
||||
xmlNewProp(node, "dcs_code", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.dcs_sql && chan.dcs_sql !=0) {
|
||||
if (mem_caps->dcs_sql && chan.dcs_sql !=0) {
|
||||
sprintf(attrbuf,"%d",chan.dcs_sql);
|
||||
xmlNewProp(node, "dcs_sql", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.scan_group) {
|
||||
if (mem_caps->scan_group) {
|
||||
sprintf(attrbuf,"%d",chan.scan_group);
|
||||
xmlNewProp(node, "scan_group", attrbuf);
|
||||
}
|
||||
if (rig->state.chan_list[i].mem_caps.flags) {
|
||||
if (mem_caps->flags) {
|
||||
sprintf(attrbuf,"%x",chan.flags);
|
||||
xmlNewProp(node, "flags", attrbuf);
|
||||
}
|
||||
|
@ -232,4 +232,3 @@ int dump_xml_chan(RIG *rig, xmlNodePtr root, int i, int chan_num)
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue