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.
|
* 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
|
* 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 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 range_sanity_check(const struct freq_range_list range_list[], int rx);
|
||||||
int ts_sanity_check(const struct tuning_step_list tuning_step[]);
|
int ts_sanity_check(const struct tuning_step_list tuning_step[]);
|
||||||
static void dump_chan_caps(const channel_cap_t *chan, FILE *fout);
|
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++) {
|
for (i=0; i<CHANLSTSIZ && caps->chan_list[i].type; i++) {
|
||||||
fprintf(fout, "\n\t%d..%d: \t%s", caps->chan_list[i].start,
|
fprintf(fout, "\n\t%d..%d: \t%s", caps->chan_list[i].start,
|
||||||
caps->chan_list[i].end,
|
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: ");
|
fprintf(fout, "\n\t mem caps: ");
|
||||||
dump_chan_caps(&caps->chan_list[i].mem_caps, fout);
|
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:
|
* check for:
|
||||||
* - start_freq<end_freq return_code=-1
|
* - 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->tuning_step) fprintf(fout, "TS ");
|
||||||
if (chan->rit) fprintf(fout, "RIT ");
|
if (chan->rit) fprintf(fout, "RIT ");
|
||||||
if (chan->xit) fprintf(fout, "XIT ");
|
if (chan->xit) fprintf(fout, "XIT ");
|
||||||
if (chan->funcs) fprintf(fout, "FUNC ");
|
if (chan->funcs) fprintf(fout, "FUNC "); /* TODO: iterate over the list */
|
||||||
if (chan->levels) fprintf(fout, "LEVEL ");
|
if (chan->levels) fprintf(fout, "LEVEL "); /* TODO: iterate over the list */
|
||||||
if (chan->ctcss_tone) fprintf(fout, "TONE ");
|
if (chan->ctcss_tone) fprintf(fout, "TONE ");
|
||||||
if (chan->ctcss_sql) fprintf(fout, "CTCSS ");
|
if (chan->ctcss_sql) fprintf(fout, "CTCSS ");
|
||||||
if (chan->dcs_code) fprintf(fout, "DCSCODE ");
|
if (chan->dcs_code) fprintf(fout, "DCSCODE ");
|
||||||
if (chan->dcs_sql) fprintf(fout, "DCSSQL ");
|
if (chan->dcs_sql) fprintf(fout, "DCSSQL ");
|
||||||
if (chan->scan_group) fprintf(fout, "SCANGRP ");
|
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->channel_desc) fprintf(fout, "NAME ");
|
||||||
if (chan->ext_levels) fprintf(fout, "EXTLVL ");
|
if (chan->ext_levels) fprintf(fout, "EXTLVL ");
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* This programs dumps the mmeory contents of a rig.
|
* 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
|
* 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);
|
sprintf_freq(freqbuf,chan.tx_width);
|
||||||
printf("TXWidth: %s\n", freqbuf);
|
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);
|
sprintf_freq(freqbuf,chan.rptr_offs);
|
||||||
printf("Offset: %s%s\n", chan.rptr_offs>0?"+":"", freqbuf);
|
printf("Offset: %s%s\n", chan.rptr_offs>0?"+":"", freqbuf);
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* memsave.c - Copyright (C) 2003-2005 Thierry Leconte
|
* 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
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -28,6 +29,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <hamlib/rig.h>
|
#include <hamlib/rig.h>
|
||||||
#include "misc.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];
|
char attrbuf[20];
|
||||||
xmlNodePtr root = arg;
|
xmlNodePtr root = arg;
|
||||||
xmlNodePtr node = NULL;
|
xmlNodePtr node = NULL;
|
||||||
|
int i;
|
||||||
|
const char *mtype;
|
||||||
|
|
||||||
static channel_t chan;
|
static channel_t chan;
|
||||||
const channel_cap_t *mem_caps = &chan_list->mem_caps;
|
const channel_cap_t *mem_caps = &chan_list->mem_caps;
|
||||||
|
@ -102,25 +106,15 @@ int dump_xml_chan(RIG *rig, channel_t **chan_pp, int chan_num, const chan_t *cha
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (chan_list->type) {
|
if (chan_list->type == RIG_MTYPE_NONE)
|
||||||
case RIG_MTYPE_NONE :
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
case RIG_MTYPE_MEM:
|
|
||||||
node=xmlNewChild(root,NULL,(unsigned char *) "mem",NULL);
|
mtype = rig_strmtype(chan_list->type);
|
||||||
break;
|
for (i=0; i<strlen(mtype); i++)
|
||||||
case RIG_MTYPE_EDGE:
|
attrbuf[i] = tolower(mtype[i]);
|
||||||
node=xmlNewChild(root,NULL,(unsigned char *) "edge",NULL);
|
attrbuf[i] = '\0';
|
||||||
break;
|
|
||||||
case RIG_MTYPE_CALL:
|
node=xmlNewChild(root,NULL,(unsigned char *)attrbuf,NULL);
|
||||||
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 (mem_caps->bank_num) {
|
if (mem_caps->bank_num) {
|
||||||
sprintf(attrbuf,"%d",chan.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) {
|
if (mem_caps->rptr_shift && chan.rptr_shift!=RIG_RPT_SHIFT_NONE) {
|
||||||
switch(chan.rptr_shift) {
|
|
||||||
case RIG_RPT_SHIFT_NONE:
|
|
||||||
xmlNewProp(node,
|
xmlNewProp(node,
|
||||||
(unsigned char *) "rptr_shift",
|
(unsigned char *) "rptr_shift",
|
||||||
(unsigned char *) "=");
|
(unsigned char *) rig_strptrshift(chan.rptr_shift));
|
||||||
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;
|
|
||||||
}
|
|
||||||
if (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);
|
sprintf(attrbuf,"%d",(int)chan.rptr_offs);
|
||||||
xmlNewProp(node,
|
xmlNewProp(node,
|
||||||
|
|
Ładowanie…
Reference in New Issue