2000-11-01 23:25:54 +00:00
|
|
|
/*
|
2012-01-06 08:28:24 +00:00
|
|
|
* rigmatrix.c - Copyright (C) 2000-2012 Stephane Fillod
|
2000-11-01 23:25:54 +00:00
|
|
|
* This program generates the supported rig matrix in HTML format.
|
2001-01-28 22:24:27 +00:00
|
|
|
* The code is rather ugly since this is only a try out.
|
2000-11-01 23:25:54 +00:00
|
|
|
*
|
|
|
|
*
|
2011-08-22 01:51:06 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2000-11-01 23:25:54 +00:00
|
|
|
*
|
2011-08-22 01:51:06 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2000-11-01 23:25:54 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#include <gd.h>
|
|
|
|
#include <gdfontg.h>
|
|
|
|
#include <gdfonts.h>
|
|
|
|
|
|
|
|
#include <hamlib/rig.h>
|
2002-01-29 22:05:37 +00:00
|
|
|
#include "misc.h"
|
2000-11-01 23:25:54 +00:00
|
|
|
|
2002-01-29 22:05:37 +00:00
|
|
|
static setting_t bitmap_func, bitmap_level, bitmap_parm;
|
2000-11-01 23:25:54 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
int create_png_range(const freq_range_t rx_range_list[],
|
|
|
|
const freq_range_t tx_range_list[], int num);
|
2000-11-01 23:25:54 +00:00
|
|
|
|
|
|
|
int print_caps_sum(const struct rig_caps *caps, void *data)
|
|
|
|
{
|
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
printf("<TR><TD><A HREF=\"support/model%d.txt\">%s</A></TD><TD>%s</TD>"
|
|
|
|
"<TD>%s</TD><TD>%s</TD><TD>",
|
|
|
|
caps->rig_model,
|
|
|
|
caps->model_name,
|
|
|
|
caps->mfg_name,
|
|
|
|
caps->version,
|
|
|
|
rig_strstatus(caps->status));
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
switch (caps->rig_type & RIG_TYPE_MASK)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
case RIG_TYPE_TRANSCEIVER:
|
|
|
|
printf("Transceiver");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_TYPE_HANDHELD:
|
|
|
|
printf("Handheld");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_TYPE_MOBILE:
|
|
|
|
printf("Mobile");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_TYPE_RECEIVER:
|
|
|
|
printf("Receiver");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_TYPE_PCRECEIVER:
|
|
|
|
printf("PC Receiver");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_TYPE_SCANNER:
|
|
|
|
printf("Scanner");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_TYPE_TRUNKSCANNER:
|
|
|
|
printf("Trunking scanner");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_TYPE_COMPUTER:
|
|
|
|
printf("Computer");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_TYPE_OTHER:
|
|
|
|
printf("Other");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
printf("Unknown");
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("</TD><TD><A HREF=\"#rng%d\">range</A></TD>"
|
|
|
|
"<TD><A HREF=\"#parms%d\">parms</A></TD>"
|
|
|
|
"<TD><A HREF=\"#caps%d\">caps</A></TD>"
|
|
|
|
"<TD><A HREF=\"#getfunc%d\">funcs</A></TD>"
|
|
|
|
"<TD><A HREF=\"#setfunc%d\">funcs</A></TD>"
|
|
|
|
"<TD><A HREF=\"#getlevel%d\">levels</A></TD>"
|
|
|
|
"<TD><A HREF=\"#setlevel%d\">levels</A></TD>"
|
|
|
|
"<TD><A HREF=\"#getparm%d\">parms</A></TD>"
|
|
|
|
"<TD><A HREF=\"#setparm%d\">parms</A></TD>"
|
|
|
|
"</TR>\n",
|
|
|
|
caps->rig_model, caps->rig_model, caps->rig_model,
|
|
|
|
caps->rig_model, caps->rig_model, caps->rig_model,
|
|
|
|
caps->rig_model, caps->rig_model, caps->rig_model);
|
|
|
|
|
|
|
|
return 1; /* !=0, we want them all ! */
|
2000-11-01 23:25:54 +00:00
|
|
|
}
|
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
|
2001-01-28 22:24:27 +00:00
|
|
|
/*
|
|
|
|
* IO params et al.
|
|
|
|
*/
|
2001-05-22 22:01:00 +00:00
|
|
|
int print_caps_parameters(const struct rig_caps *caps, void *data)
|
2000-11-01 23:25:54 +00:00
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
printf("<A NAME=\"parms%d\"><TR><TD>%s</TD><TD>",
|
|
|
|
caps->rig_model,
|
|
|
|
caps->model_name);
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
switch (caps->ptt_type)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
case RIG_PTT_RIG:
|
|
|
|
printf("rig");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_PTT_PARALLEL:
|
|
|
|
printf("parallel");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_PTT_SERIAL_RTS:
|
|
|
|
case RIG_PTT_SERIAL_DTR:
|
|
|
|
printf("serial");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_PTT_NONE:
|
|
|
|
printf("None");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
printf("Unknown");
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("</TD><TD>");
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
switch (caps->dcd_type)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
case RIG_DCD_RIG:
|
|
|
|
printf("rig");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_DCD_PARALLEL:
|
|
|
|
printf("parallel");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_DCD_SERIAL_CTS:
|
|
|
|
case RIG_DCD_SERIAL_DSR:
|
|
|
|
printf("serial");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_DCD_NONE:
|
|
|
|
printf("None");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
printf("Unknown");
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("</TD><TD>");
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
switch (caps->port_type)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
case RIG_PORT_SERIAL:
|
|
|
|
printf("serial");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_PORT_DEVICE:
|
|
|
|
printf("device");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_PORT_NETWORK:
|
|
|
|
printf("network");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_PORT_UDP_NETWORK:
|
|
|
|
printf("UDP network");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_PORT_NONE:
|
|
|
|
printf("None");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
printf("Unknown");
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("</TD><TD>%d</TD><TD>%d</TD><TD>%d%c%d</TD><TD>%s</TD>",
|
|
|
|
caps->serial_rate_min,
|
|
|
|
caps->serial_rate_max,
|
|
|
|
caps->serial_data_bits,
|
|
|
|
caps->serial_parity == RIG_PARITY_NONE ? 'N' :
|
2017-10-06 23:58:42 +00:00
|
|
|
caps->serial_parity == RIG_PARITY_ODD ? 'O' :
|
|
|
|
caps->serial_parity == RIG_PARITY_EVEN ? 'E' :
|
|
|
|
caps->serial_parity == RIG_PARITY_MARK ? 'M' : 'S',
|
2017-08-09 18:09:55 +00:00
|
|
|
caps->serial_stop_bits,
|
|
|
|
caps->serial_handshake == RIG_HANDSHAKE_NONE ? "none" :
|
|
|
|
(caps->serial_handshake == RIG_HANDSHAKE_XONXOFF ? "XONXOFF" : "CTS/RTS"));
|
|
|
|
|
|
|
|
printf("<TD>%dms</TD><TD>%dms</TD><TD>%dms</TD><TD>%d</TD></TR></A>\n",
|
|
|
|
caps->write_delay,
|
|
|
|
caps->post_write_delay,
|
|
|
|
caps->timeout,
|
|
|
|
caps->retry);
|
|
|
|
|
|
|
|
return 1;
|
2000-11-01 23:25:54 +00:00
|
|
|
}
|
|
|
|
|
2001-01-28 22:24:27 +00:00
|
|
|
/* used by print_caps_caps and print_caps_level */
|
|
|
|
#define print_yn(fn) printf("<TD>%c</TD>", (fn) ? 'Y':'N')
|
|
|
|
|
|
|
|
/*
|
|
|
|
* backend functions definied
|
2001-02-11 23:23:17 +00:00
|
|
|
*
|
|
|
|
* TODO: add new API calls!
|
2001-01-28 22:24:27 +00:00
|
|
|
*/
|
2000-11-01 23:25:54 +00:00
|
|
|
int print_caps_caps(const struct rig_caps *caps, void *data)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
printf("<A NAME=\"caps%d\"><TR><TD>%s</TD>",
|
|
|
|
caps->rig_model,
|
|
|
|
caps->model_name);
|
|
|
|
|
|
|
|
/* targetable_vfo is not a function, but a boolean */
|
|
|
|
print_yn(caps->targetable_vfo);
|
|
|
|
|
|
|
|
print_yn(caps->set_freq);
|
|
|
|
print_yn(caps->get_freq);
|
|
|
|
print_yn(caps->set_mode);
|
|
|
|
print_yn(caps->get_mode);
|
|
|
|
print_yn(caps->set_vfo);
|
|
|
|
print_yn(caps->get_vfo);
|
|
|
|
print_yn(caps->set_ptt);
|
|
|
|
print_yn(caps->get_ptt);
|
|
|
|
print_yn(caps->get_dcd);
|
|
|
|
print_yn(caps->set_rptr_shift);
|
|
|
|
print_yn(caps->get_rptr_shift);
|
|
|
|
print_yn(caps->set_rptr_offs);
|
|
|
|
print_yn(caps->get_rptr_offs);
|
|
|
|
print_yn(caps->set_split_freq);
|
|
|
|
print_yn(caps->get_split_freq);
|
|
|
|
print_yn(caps->set_split_vfo);
|
|
|
|
print_yn(caps->get_split_vfo);
|
|
|
|
print_yn(caps->set_ts);
|
|
|
|
print_yn(caps->get_ts);
|
|
|
|
print_yn(caps->set_ctcss_tone);
|
|
|
|
print_yn(caps->get_ctcss_tone);
|
|
|
|
print_yn(caps->set_dcs_code);
|
|
|
|
print_yn(caps->get_dcs_code);
|
|
|
|
print_yn(caps->set_powerstat);
|
|
|
|
print_yn(caps->get_powerstat);
|
|
|
|
print_yn(caps->set_trn);
|
|
|
|
print_yn(caps->set_trn);
|
|
|
|
print_yn(caps->decode_event);
|
|
|
|
print_yn(caps->get_info);
|
|
|
|
|
|
|
|
printf("</TR></A>\n");
|
|
|
|
|
|
|
|
return 1;
|
2000-11-01 23:25:54 +00:00
|
|
|
}
|
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
|
2001-05-22 22:01:00 +00:00
|
|
|
/*
|
|
|
|
* Get/Set parm abilities
|
|
|
|
*/
|
|
|
|
int print_caps_parm(const struct rig_caps *caps, void *data)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
setting_t parm;
|
|
|
|
int i;
|
2001-05-22 22:01:00 +00:00
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
if (!data)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2001-05-22 22:01:00 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
parm = (*(int *)data) ? caps->has_set_parm : caps->has_get_parm;
|
2001-05-22 22:01:00 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
printf("<A NAME=\"%sparm%d\"><TR><TD>%s</TD>",
|
|
|
|
(*(int *)data) ? "set" : "get",
|
|
|
|
caps->rig_model,
|
|
|
|
caps->model_name);
|
2011-08-22 01:51:06 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/*
|
|
|
|
* bitmap_parm: only those who have a label
|
|
|
|
*/
|
2017-10-06 23:58:42 +00:00
|
|
|
for (i = 0; i < RIG_SETTING_MAX; i++)
|
|
|
|
{
|
|
|
|
if (rig_idx2setting(i) & bitmap_parm)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
print_yn(parm & rig_idx2setting(i));
|
|
|
|
}
|
|
|
|
}
|
2001-05-22 22:01:00 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
printf("</TR></A>\n");
|
|
|
|
|
|
|
|
return 1;
|
2001-05-22 22:01:00 +00:00
|
|
|
}
|
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
|
2001-01-28 22:24:27 +00:00
|
|
|
/*
|
|
|
|
* Get/Set level abilities
|
|
|
|
*/
|
|
|
|
int print_caps_level(const struct rig_caps *caps, void *data)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
setting_t level;
|
|
|
|
int i;
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
if (!data)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2001-01-28 22:24:27 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
level = (*(int *)data) ? caps->has_set_level : caps->has_get_level;
|
2001-01-28 22:24:27 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
printf("<A NAME=\"%slevel%d\"><TR><TD>%s</TD>",
|
|
|
|
(*(int *)data) ? "set" : "get",
|
|
|
|
caps->rig_model,
|
|
|
|
caps->model_name);
|
2001-01-28 22:24:27 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/*
|
|
|
|
* bitmap_level: only those who have a label
|
|
|
|
*/
|
2017-10-06 23:58:42 +00:00
|
|
|
for (i = 0; i < 32; i++)
|
|
|
|
{
|
|
|
|
if (rig_idx2setting(i) & bitmap_level)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
print_yn(level & rig_idx2setting(i));
|
|
|
|
}
|
|
|
|
}
|
2011-08-22 01:51:06 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
printf("</TR></A>\n");
|
2001-01-28 22:24:27 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
return 1;
|
2001-01-28 22:24:27 +00:00
|
|
|
}
|
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
|
2001-01-28 22:24:27 +00:00
|
|
|
/*
|
|
|
|
* Get/Set func abilities
|
|
|
|
*/
|
|
|
|
int print_caps_func(const struct rig_caps *caps, void *data)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
setting_t func;
|
|
|
|
int i;
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
if (!data)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2001-01-28 22:24:27 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
func = (*(int *)data) ? caps->has_set_func : caps->has_get_func;
|
2001-01-28 22:24:27 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
printf("<A NAME=\"%sfunc%d\"><TR><TD>%s</TD>",
|
|
|
|
(*(int *)data) ? "set" : "get",
|
|
|
|
caps->rig_model,
|
|
|
|
caps->model_name);
|
2001-01-28 22:24:27 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/*
|
|
|
|
* bitmap_func: only those who have a label
|
|
|
|
*/
|
2017-10-06 23:58:42 +00:00
|
|
|
for (i = 0; i < RIG_SETTING_MAX; i++)
|
|
|
|
{
|
|
|
|
if (rig_idx2setting(i) & bitmap_func)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
print_yn(func & rig_idx2setting(i));
|
|
|
|
}
|
|
|
|
}
|
2011-08-22 01:51:06 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
printf("</TR></A>\n");
|
2001-01-28 22:24:27 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
return 1;
|
2001-01-28 22:24:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* inlined PNG graphics
|
2001-02-11 23:23:17 +00:00
|
|
|
*
|
|
|
|
* FIXME: default output pics is for region2: add region 1 too!
|
2001-01-28 22:24:27 +00:00
|
|
|
*/
|
2000-11-01 23:25:54 +00:00
|
|
|
int print_caps_range(const struct rig_caps *caps, void *data)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
create_png_range(caps->rx_range_list2, caps->tx_range_list2,
|
|
|
|
caps->rig_model);
|
|
|
|
|
|
|
|
printf("<A NAME=\"rng%d\"><TR><TD>%s</TD>"
|
|
|
|
"<TD><IMG SRC=\"range%d.png\"></TD></TR></A>",
|
|
|
|
caps->rig_model,
|
|
|
|
caps->model_name,
|
|
|
|
caps->rig_model);
|
|
|
|
return 1;
|
2000-11-01 23:25:54 +00:00
|
|
|
}
|
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
|
2000-11-01 23:25:54 +00:00
|
|
|
#define RANGE_WIDTH 600
|
|
|
|
#define RANGE_HEIGHT 16
|
|
|
|
#define RANGE_MIDHEIGHT (RANGE_HEIGHT/2)
|
|
|
|
|
|
|
|
#define RX_R 0
|
|
|
|
#define RX_G 255
|
|
|
|
#define RX_B 255
|
|
|
|
#define TX_R 0
|
|
|
|
#define TX_G 0
|
|
|
|
#define TX_B 255
|
|
|
|
|
|
|
|
#define HF_H 10
|
|
|
|
#define VHF_H 30
|
|
|
|
#define UHF_H 50
|
|
|
|
#define IM_LGD 21
|
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
|
|
|
|
static void draw_range(const freq_range_t range_list[],
|
|
|
|
gdImagePtr im_rng,
|
|
|
|
int h1,
|
|
|
|
int h2,
|
|
|
|
int rgb)
|
2000-11-01 23:25:54 +00:00
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
int i;
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
for (i = 0; i < FRQRANGESIZ; i++)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
float start_pix, end_pix;
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
if (range_list[i].start == 0 && range_list[i].end == 0)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
start_pix = range_list[i].start;
|
|
|
|
end_pix = range_list[i].end;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* HF
|
|
|
|
*/
|
2017-10-06 23:58:42 +00:00
|
|
|
if (range_list[i].start < MHz(30))
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
start_pix = start_pix / MHz(30) * RANGE_WIDTH;
|
|
|
|
end_pix = end_pix / MHz(30) * RANGE_WIDTH;
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
if (end_pix >= RANGE_WIDTH)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
end_pix = RANGE_WIDTH - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
start_pix += IM_LGD;
|
|
|
|
end_pix += IM_LGD;
|
|
|
|
gdImageFilledRectangle(im_rng,
|
|
|
|
start_pix,
|
|
|
|
HF_H + h1,
|
|
|
|
end_pix,
|
|
|
|
HF_H + h2,
|
|
|
|
rgb);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* VHF
|
|
|
|
*/
|
|
|
|
start_pix = range_list[i].start;
|
|
|
|
end_pix = range_list[i].end;
|
|
|
|
|
|
|
|
if ((range_list[i].start > MHz(30) && range_list[i].start < MHz(300))
|
2017-10-06 23:58:42 +00:00
|
|
|
|| (range_list[i].start < MHz(30)
|
|
|
|
&& range_list[i].end > MHz(30)))
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
|
|
|
|
start_pix = (start_pix - MHz(30)) / MHz(300) * RANGE_WIDTH;
|
|
|
|
end_pix = (end_pix - MHz(30)) / MHz(300) * RANGE_WIDTH;
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
if (start_pix < 0)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
start_pix = 0;
|
|
|
|
}
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
if (end_pix >= RANGE_WIDTH)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
end_pix = RANGE_WIDTH - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
start_pix += IM_LGD;
|
|
|
|
end_pix += IM_LGD;
|
|
|
|
gdImageFilledRectangle(im_rng,
|
|
|
|
start_pix,
|
|
|
|
VHF_H + h1,
|
|
|
|
end_pix,
|
|
|
|
VHF_H + h2,
|
|
|
|
rgb);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* UHF
|
|
|
|
*/
|
|
|
|
start_pix = range_list[i].start;
|
|
|
|
end_pix = range_list[i].end;
|
|
|
|
|
|
|
|
if ((range_list[i].start > MHz(300) && range_list[i].start < GHz(3))
|
2017-10-06 23:58:42 +00:00
|
|
|
|| (range_list[i].start < MHz(300)
|
|
|
|
&& range_list[i].end > MHz(300)))
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
|
|
|
|
start_pix = (start_pix - MHz(300)) / GHz(3) * RANGE_WIDTH;
|
|
|
|
end_pix = (end_pix - MHz(300)) / GHz(3) * RANGE_WIDTH;
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
if (start_pix < 0)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
start_pix = 0;
|
|
|
|
}
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
if (end_pix >= RANGE_WIDTH)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
end_pix = RANGE_WIDTH - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
start_pix += IM_LGD;
|
|
|
|
end_pix += IM_LGD;
|
|
|
|
gdImageFilledRectangle(im_rng,
|
|
|
|
start_pix,
|
|
|
|
UHF_H + h1,
|
|
|
|
end_pix,
|
|
|
|
UHF_H + h2,
|
|
|
|
rgb);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2000-11-01 23:25:54 +00:00
|
|
|
}
|
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
|
2000-11-01 23:25:54 +00:00
|
|
|
int create_png_range(const freq_range_t rx_range_list[],
|
2017-08-09 18:09:55 +00:00
|
|
|
const freq_range_t tx_range_list[],
|
|
|
|
int num)
|
2000-11-01 23:25:54 +00:00
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
FILE *out;
|
2000-11-01 23:25:54 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/* Input and output images */
|
|
|
|
gdImagePtr im_rng;
|
|
|
|
char rng_fname[128];
|
2000-11-01 23:25:54 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/* Color indexes */
|
2000-11-01 23:25:54 +00:00
|
|
|
#if 0
|
2017-08-09 18:09:55 +00:00
|
|
|
int white;
|
2000-11-01 23:25:54 +00:00
|
|
|
#endif
|
2017-08-09 18:09:55 +00:00
|
|
|
int black;
|
|
|
|
int rx_rgb, tx_rgb;
|
2000-11-01 23:25:54 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/* Create output image, x by y pixels. */
|
|
|
|
im_rng = gdImageCreate(RANGE_WIDTH + IM_LGD, UHF_H + RANGE_HEIGHT);
|
2000-11-01 23:25:54 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/* First color allocated is background. */
|
|
|
|
// white = gdImageColorAllocate(im_rng, 255, 255, 255);
|
|
|
|
gdImageColorAllocate(im_rng, 255, 255, 255);
|
|
|
|
black = gdImageColorAllocate(im_rng, 0, 0, 0);
|
2000-11-01 23:25:54 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
#if 0
|
|
|
|
/* Set transparent color. */
|
|
|
|
gdImageColorTransparent(im_rng, white);
|
|
|
|
#endif
|
2000-11-01 23:25:54 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/* Try to load demoin.png and paste part of it into the
|
|
|
|
output image. */
|
|
|
|
|
|
|
|
tx_rgb = gdImageColorAllocate(im_rng, TX_R, TX_G, TX_B);
|
|
|
|
rx_rgb = gdImageColorAllocate(im_rng, RX_R, RX_G, RX_B);
|
|
|
|
|
|
|
|
draw_range(rx_range_list, im_rng, 0, RANGE_MIDHEIGHT - 1, rx_rgb);
|
|
|
|
draw_range(tx_range_list, im_rng, RANGE_MIDHEIGHT, RANGE_HEIGHT - 1, tx_rgb);
|
|
|
|
|
|
|
|
gdImageRectangle(im_rng,
|
|
|
|
IM_LGD,
|
|
|
|
HF_H,
|
|
|
|
IM_LGD + RANGE_WIDTH - 1,
|
|
|
|
HF_H + RANGE_HEIGHT - 1,
|
|
|
|
black);
|
|
|
|
|
|
|
|
gdImageRectangle(im_rng,
|
|
|
|
IM_LGD,
|
|
|
|
VHF_H,
|
|
|
|
IM_LGD + RANGE_WIDTH - 1,
|
|
|
|
VHF_H + RANGE_HEIGHT - 1,
|
|
|
|
black);
|
|
|
|
|
|
|
|
gdImageRectangle(im_rng,
|
|
|
|
IM_LGD,
|
|
|
|
UHF_H,
|
|
|
|
IM_LGD + RANGE_WIDTH - 1,
|
|
|
|
UHF_H + RANGE_HEIGHT - 1,
|
|
|
|
black);
|
|
|
|
|
|
|
|
/* gdImageStringUp */
|
|
|
|
gdImageString(im_rng,
|
|
|
|
gdFontSmall,
|
|
|
|
1,
|
|
|
|
HF_H + 1,
|
|
|
|
(unsigned char *) "HF",
|
|
|
|
black);
|
|
|
|
|
|
|
|
gdImageString(im_rng,
|
|
|
|
gdFontSmall,
|
|
|
|
1,
|
|
|
|
VHF_H + 1,
|
|
|
|
(unsigned char *) "VHF",
|
|
|
|
black);
|
|
|
|
|
|
|
|
gdImageString(im_rng,
|
|
|
|
gdFontSmall,
|
|
|
|
1,
|
|
|
|
UHF_H + 1,
|
|
|
|
(unsigned char *) "UHF",
|
|
|
|
black);
|
|
|
|
|
|
|
|
/* Make output image interlaced (allows "fade in" in some viewers,
|
|
|
|
and in the latest web browsers) */
|
|
|
|
gdImageInterlace(im_rng, 1);
|
|
|
|
|
|
|
|
sprintf(rng_fname, "range%d.png", num);
|
|
|
|
out = fopen(rng_fname, "wb");
|
|
|
|
|
|
|
|
/* Write PNG */
|
|
|
|
gdImagePng(im_rng, out);
|
|
|
|
fclose(out);
|
|
|
|
gdImageDestroy(im_rng);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2000-11-01 23:25:54 +00:00
|
|
|
|
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
time_t gentime;
|
|
|
|
int set_or_get;
|
|
|
|
int i;
|
|
|
|
char *pbuf, prntbuf[512];
|
|
|
|
|
|
|
|
rig_load_all_backends();
|
|
|
|
|
|
|
|
|
|
|
|
printf("<TABLE BORDER=1>");
|
|
|
|
printf("<TR><TD>Model</TD><TD>Mfg</TD><TD>Vers.</TD><TD>Status</TD>"
|
|
|
|
"<TD>Type</TD><TD>Freq. range</TD><TD>Parameters</TD>"
|
|
|
|
"<TD>Capabilities</TD>"
|
|
|
|
"<TD>Get func</TD>"
|
|
|
|
"<TD>Set func</TD>"
|
|
|
|
"<TD>Get level</TD>"
|
|
|
|
"<TD>Set level</TD>"
|
|
|
|
"<TD>Get parm</TD>"
|
|
|
|
"<TD>Set parm</TD>"
|
|
|
|
"</TR>\n");
|
|
|
|
rig_list_foreach(print_caps_sum, NULL);
|
|
|
|
printf("</TABLE>\n");
|
|
|
|
|
|
|
|
printf("<P>");
|
|
|
|
|
|
|
|
printf("<TABLE BORDER=1>\n");
|
|
|
|
printf("<TR><TD>Model</TD><TD>PTT</TD><TD>DCD</TD><TD>Port</TD>"
|
|
|
|
"<TD>Speed min</TD><TD>Speed max</TD>"
|
|
|
|
"<TD>Parm.</TD><TD>Handshake</TD><TD>Write delay</TD>"
|
|
|
|
"<TD>Post delay</TD><TD>Timeout</TD><TD>Retry</TD></TR>\n");
|
|
|
|
rig_list_foreach(print_caps_parameters, NULL);
|
|
|
|
printf("</TABLE>\n");
|
|
|
|
|
|
|
|
printf("<P>");
|
|
|
|
|
|
|
|
printf("<TABLE BORDER=1>\n");
|
|
|
|
printf("<TR><TD>Model</TD><TD>Freq. range</TD></TR>\n");
|
|
|
|
rig_list_foreach(print_caps_range, NULL);
|
|
|
|
printf("</TABLE>\n");
|
|
|
|
|
|
|
|
printf("<P>");
|
|
|
|
|
|
|
|
printf("<TABLE BORDER=1>\n");
|
|
|
|
printf("<TR><TD>Model</TD><TD>Target VFO</TD>"
|
|
|
|
"<TD>Set freq</TD><TD>Get freq</TD>"
|
|
|
|
"<TD>Set mode</TD><TD>Get mode</TD>"
|
|
|
|
"<TD>Set VFO</TD><TD>Get VFO</TD>"
|
|
|
|
"<TD>Set PTT</TD><TD>Get PTT</TD><TD>Get DCD</TD>"
|
|
|
|
"<TD>Set rptr shift</TD><TD>Get rptr shift</TD>"
|
|
|
|
"<TD>Set rptr offs</TD><TD>Get rptr offs</TD>"
|
|
|
|
"<TD>Set split frq</TD><TD>Get split frq</TD>"
|
|
|
|
"<TD>Set split</TD><TD>Get split</TD>"
|
|
|
|
"<TD>Set ts</TD><TD>Get ts</TD>"
|
|
|
|
"<TD>Set CTCSS</TD><TD>Get CTCSS</TD>"
|
|
|
|
"<TD>Set DCS</TD><TD>Get DCS</TD>"
|
|
|
|
"<TD>Set Power Stat</TD><TD>Get Power Stat</TD>"
|
|
|
|
"<TD>Set trn</TD><TD>Get trn</TD>"
|
|
|
|
"<TD>Decode</TD><TD>Get info</TD>"
|
|
|
|
"</TR>\n");
|
|
|
|
rig_list_foreach(print_caps_caps, NULL);
|
|
|
|
printf("</TABLE>\n");
|
|
|
|
|
|
|
|
printf("<P>");
|
|
|
|
|
|
|
|
bitmap_func = 0;
|
|
|
|
prntbuf[0] = '\0';
|
|
|
|
pbuf = prntbuf;
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
for (i = 0; i < RIG_SETTING_MAX; i++)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
setting_t func = rig_idx2setting(i);
|
|
|
|
const char *s = rig_strfunc(func);
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
if (!s)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
bitmap_func |= func;
|
|
|
|
pbuf += sprintf(pbuf, "<TD>%s</TD>", s);
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("Has set func");
|
|
|
|
printf("<TABLE BORDER=1>\n");
|
|
|
|
printf("<TR><TD>Model</TD>%s</TR>\n", prntbuf);
|
|
|
|
set_or_get = 1;
|
|
|
|
rig_list_foreach(print_caps_func, &set_or_get);
|
|
|
|
printf("</TABLE>\n");
|
|
|
|
|
|
|
|
printf("<P>");
|
|
|
|
|
|
|
|
printf("Has get func");
|
|
|
|
printf("<TABLE BORDER=1>\n");
|
|
|
|
printf("<TR><TD>Model</TD>%s</TR>\n", prntbuf);
|
|
|
|
set_or_get = 0;
|
|
|
|
rig_list_foreach(print_caps_func, &set_or_get);
|
|
|
|
printf("</TABLE>\n");
|
|
|
|
|
|
|
|
printf("<P>");
|
|
|
|
|
|
|
|
bitmap_level = 0;
|
|
|
|
prntbuf[0] = '\0';
|
|
|
|
pbuf = prntbuf;
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
for (i = 0; i < RIG_SETTING_MAX; i++)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
setting_t level = rig_idx2setting(i);
|
|
|
|
const char *s = rig_strlevel(level);
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
if (!s)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
bitmap_level |= level;
|
|
|
|
pbuf += sprintf(pbuf, "<TD>%s</TD>", s);
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("Set level");
|
|
|
|
printf("<TABLE BORDER=1>\n");
|
|
|
|
printf("<TR><TD>Model</TD>%s</TR>\n", prntbuf);
|
|
|
|
set_or_get = 1;
|
|
|
|
rig_list_foreach(print_caps_level, &set_or_get);
|
|
|
|
printf("</TABLE>\n");
|
|
|
|
|
|
|
|
printf("<P>");
|
|
|
|
|
|
|
|
printf("Get level");
|
|
|
|
printf("<TABLE BORDER=1>\n");
|
|
|
|
printf("<TR><TD>Model</TD>%s</TR>\n", prntbuf);
|
|
|
|
set_or_get = 0;
|
|
|
|
rig_list_foreach(print_caps_level, &set_or_get);
|
|
|
|
printf("</TABLE>\n");
|
|
|
|
|
|
|
|
printf("<P>");
|
|
|
|
|
|
|
|
bitmap_parm = 0;
|
|
|
|
prntbuf[0] = '\0';
|
|
|
|
pbuf = prntbuf;
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
for (i = 0; i < RIG_SETTING_MAX; i++)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
setting_t parm = rig_idx2setting(i);
|
|
|
|
const char *s = rig_strparm(parm);
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
if (!s)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
bitmap_parm |= parm;
|
|
|
|
pbuf += sprintf(pbuf, "<TD>%s</TD>", s);
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("Set parm");
|
|
|
|
printf("<TABLE BORDER=1>\n");
|
|
|
|
printf("<TR><TD>Model</TD>%s</TR>\n", prntbuf);
|
|
|
|
set_or_get = 1;
|
|
|
|
rig_list_foreach(print_caps_parm, &set_or_get);
|
|
|
|
printf("</TABLE>\n");
|
|
|
|
|
|
|
|
printf("<P>");
|
|
|
|
|
|
|
|
printf("Get parm");
|
|
|
|
printf("<TABLE BORDER=1>\n");
|
|
|
|
printf("<TR><TD>Model</TD>%s</TR>\n", prntbuf);
|
|
|
|
set_or_get = 0;
|
|
|
|
rig_list_foreach(print_caps_parm, &set_or_get);
|
|
|
|
printf("</TABLE>\n");
|
2000-11-01 23:25:54 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
printf("<P>");
|
2000-11-01 23:25:54 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
time(&gentime);
|
|
|
|
printf("Rigmatrix generated %s by %s\n", ctime(&gentime), getenv("USER"));
|
|
|
|
|
|
|
|
printf("</body></html>\n");
|
2000-11-01 23:25:54 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
return 0;
|
2000-11-01 23:25:54 +00:00
|
|
|
}
|