kopia lustrzana https://github.com/Hamlib/Hamlib
make use of factorized rig_strmtype/rig_strptrshift
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2333 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.8
rodzic
95a679eb2e
commit
d5d2736642
|
@ -3,7 +3,7 @@
|
|||
* This programs dumps the capabilities of a backend rig.
|
||||
*
|
||||
*
|
||||
* $Id: dumpcaps.c,v 1.45 2008-01-05 18:13:12 fillods Exp $
|
||||
* $Id: dumpcaps.c,v 1.46 2008-04-27 09:56:06 fillods Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -37,7 +37,6 @@
|
|||
|
||||
|
||||
static int print_ext(RIG *rig, const struct confparams *cfp, rig_ptr_t ptr);
|
||||
static const char *decode_mtype(chan_type_t type);
|
||||
int range_sanity_check(const struct freq_range_list range_list[], int rx);
|
||||
int ts_sanity_check(const struct tuning_step_list tuning_step[]);
|
||||
static void dump_chan_caps(const channel_cap_t *chan, FILE *fout);
|
||||
|
@ -280,7 +279,7 @@ int dumpcaps (RIG* rig, FILE *fout)
|
|||
for (i=0; i<CHANLSTSIZ && caps->chan_list[i].type; i++) {
|
||||
fprintf(fout, "\n\t%d..%d: \t%s", caps->chan_list[i].start,
|
||||
caps->chan_list[i].end,
|
||||
decode_mtype(caps->chan_list[i].type));
|
||||
rig_strmtype(caps->chan_list[i].type));
|
||||
fprintf(fout, "\n\t mem caps: ");
|
||||
dump_chan_caps(&caps->chan_list[i].mem_caps, fout);
|
||||
}
|
||||
|
@ -453,22 +452,6 @@ static int print_ext(RIG *rig, const struct confparams *cfp, rig_ptr_t ptr)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* NB: this function is not reentrant, because of the static buf.
|
||||
* but who cares? --SF
|
||||
*/
|
||||
static const char *decode_mtype(chan_type_t type)
|
||||
{
|
||||
switch(type) {
|
||||
case RIG_MTYPE_NONE: return "NONE";
|
||||
case RIG_MTYPE_MEM: return "MEM";
|
||||
case RIG_MTYPE_EDGE: return "EDGE";
|
||||
case RIG_MTYPE_CALL: return "CALL";
|
||||
case RIG_MTYPE_MEMOPAD: return "MEMOPAD";
|
||||
default: return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* check for:
|
||||
* - start_freq<end_freq return_code=-1
|
||||
|
@ -558,14 +541,14 @@ static void dump_chan_caps(const channel_cap_t *chan, FILE *fout)
|
|||
if (chan->tuning_step) fprintf(fout, "TS ");
|
||||
if (chan->rit) fprintf(fout, "RIT ");
|
||||
if (chan->xit) fprintf(fout, "XIT ");
|
||||
if (chan->funcs) fprintf(fout, "FUNC ");
|
||||
if (chan->levels) fprintf(fout, "LEVEL ");
|
||||
if (chan->funcs) fprintf(fout, "FUNC "); /* TODO: iterate over the list */
|
||||
if (chan->levels) fprintf(fout, "LEVEL "); /* TODO: iterate over the list */
|
||||
if (chan->ctcss_tone) fprintf(fout, "TONE ");
|
||||
if (chan->ctcss_sql) fprintf(fout, "CTCSS ");
|
||||
if (chan->dcs_code) fprintf(fout, "DCSCODE ");
|
||||
if (chan->dcs_sql) fprintf(fout, "DCSSQL ");
|
||||
if (chan->scan_group) fprintf(fout, "SCANGRP ");
|
||||
if (chan->flags) fprintf(fout, "FLAG "); /* RIG_CHFLAG's */
|
||||
if (chan->flags) fprintf(fout, "FLAG "); /* TODO: iterate over the RIG_CHFLAG's */
|
||||
if (chan->channel_desc) fprintf(fout, "NAME ");
|
||||
if (chan->ext_levels) fprintf(fout, "EXTLVL ");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* This programs dumps the mmeory contents of a rig.
|
||||
*
|
||||
*
|
||||
* $Id: dumpmem.c,v 1.9 2006-07-18 22:51:43 n0nb Exp $
|
||||
* $Id: dumpmem.c,v 1.10 2008-04-27 09:56:06 fillods Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -148,7 +148,7 @@ int dump_chan(RIG *rig, int chan_num)
|
|||
sprintf_freq(freqbuf,chan.tx_width);
|
||||
printf("TXWidth: %s\n", freqbuf);
|
||||
|
||||
printf("Shift: %d\n", chan.rptr_shift);
|
||||
printf("Shift: %s\n", rig_strptrshift(chan.rptr_shift));
|
||||
sprintf_freq(freqbuf,chan.rptr_offs);
|
||||
printf("Offset: %s%s\n", chan.rptr_offs>0?"+":"", freqbuf);
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/*
|
||||
* memsave.c - Copyright (C) 2003-2005 Thierry Leconte
|
||||
* Copyright (C) 2008 Stephane Fillod
|
||||
*
|
||||
*
|
||||
* $Id: memsave.c,v 1.10 2006-10-07 19:56:57 csete Exp $
|
||||
* $Id: memsave.c,v 1.11 2008-04-27 09:56:06 fillods Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -28,6 +29,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <hamlib/rig.h>
|
||||
#include "misc.h"
|
||||
|
@ -87,6 +89,8 @@ int dump_xml_chan(RIG *rig, channel_t **chan_pp, int chan_num, const chan_t *cha
|
|||
char attrbuf[20];
|
||||
xmlNodePtr root = arg;
|
||||
xmlNodePtr node = NULL;
|
||||
int i;
|
||||
const char *mtype;
|
||||
|
||||
static channel_t chan;
|
||||
const channel_cap_t *mem_caps = &chan_list->mem_caps;
|
||||
|
@ -101,26 +105,16 @@ int dump_xml_chan(RIG *rig, channel_t **chan_pp, int chan_num, const chan_t *cha
|
|||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
switch (chan_list->type) {
|
||||
case RIG_MTYPE_NONE :
|
||||
return RIG_OK;
|
||||
case RIG_MTYPE_MEM:
|
||||
node=xmlNewChild(root,NULL,(unsigned char *) "mem",NULL);
|
||||
break;
|
||||
case RIG_MTYPE_EDGE:
|
||||
node=xmlNewChild(root,NULL,(unsigned char *) "edge",NULL);
|
||||
break;
|
||||
case RIG_MTYPE_CALL:
|
||||
node=xmlNewChild(root,NULL,(unsigned char *) "call",NULL);
|
||||
break;
|
||||
case RIG_MTYPE_MEMOPAD:
|
||||
node=xmlNewChild(root,NULL,(unsigned char *) "memopad",NULL);
|
||||
break;
|
||||
case RIG_MTYPE_SAT:
|
||||
node=xmlNewChild(root,NULL,(unsigned char *) "sat",NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
if (chan_list->type == RIG_MTYPE_NONE)
|
||||
return RIG_OK;
|
||||
|
||||
mtype = rig_strmtype(chan_list->type);
|
||||
for (i=0; i<strlen(mtype); i++)
|
||||
attrbuf[i] = tolower(mtype[i]);
|
||||
attrbuf[i] = '\0';
|
||||
|
||||
node=xmlNewChild(root,NULL,(unsigned char *)attrbuf,NULL);
|
||||
|
||||
if (mem_caps->bank_num) {
|
||||
sprintf(attrbuf,"%d",chan.bank_num);
|
||||
|
@ -177,23 +171,9 @@ int dump_xml_chan(RIG *rig, channel_t **chan_pp, int chan_num, const chan_t *cha
|
|||
}
|
||||
}
|
||||
if (mem_caps->rptr_shift && chan.rptr_shift!=RIG_RPT_SHIFT_NONE) {
|
||||
switch(chan.rptr_shift) {
|
||||
case RIG_RPT_SHIFT_NONE:
|
||||
xmlNewProp(node,
|
||||
(unsigned char *) "rptr_shift",
|
||||
(unsigned char *) "=");
|
||||
break;
|
||||
case RIG_RPT_SHIFT_PLUS:
|
||||
xmlNewProp(node,
|
||||
(unsigned char *) "rptr_shift",
|
||||
(unsigned char *) "+");
|
||||
break;
|
||||
case RIG_RPT_SHIFT_MINUS:
|
||||
xmlNewProp(node,
|
||||
(unsigned char *) "rptr_shift",
|
||||
(unsigned char *) "-");
|
||||
break;
|
||||
}
|
||||
xmlNewProp(node,
|
||||
(unsigned char *) "rptr_shift",
|
||||
(unsigned char *) rig_strptrshift(chan.rptr_shift));
|
||||
if (mem_caps->rptr_offs && (int)chan.rptr_offs!=0) {
|
||||
sprintf(attrbuf,"%d",(int)chan.rptr_offs);
|
||||
xmlNewProp(node,
|
||||
|
|
Ładowanie…
Reference in New Issue