Ejemplo n.º 1
0
static int netrigctl_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift)
{
  int ret, len;
  char cmd[CMD_MAX];
  char buf[BUF_MAX];

  rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__);

  len = sprintf(cmd, "R %s\n", rig_strptrshift(rptr_shift));

  ret = netrigctl_transaction(rig, cmd, len, buf);
  if (ret > 0)
	return -RIG_EPROTO;
  else
  	return ret;
}
Ejemplo n.º 2
0
/* Caution! Keep the function consistent with dump_csv_name and set_channel_data! */
int dump_csv_chan(RIG *rig,
                  channel_t **chan_pp,
                  int channel_num,
                  const chan_t *chan_list,
                  rig_ptr_t arg)
{
    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%c", chan.bank_num, csv_sep);
    }

    if (mem_caps->channel_desc)
    {
        fprintf(f, "%s%c", chan.channel_desc, csv_sep);
    }

    if (mem_caps->vfo)
    {
        fprintf(f, "%s%c", rig_strvfo(chan.vfo), csv_sep);
    }

    if (mem_caps->ant)
    {
        fprintf(f, "%d%c", chan.ant, csv_sep);
    }

    if (mem_caps->freq)
    {
        fprintf(f, "%.0"PRIfreq"%c", chan.freq, csv_sep);
    }

    if (mem_caps->mode)
    {
        fprintf(f, "%s%c", rig_strrmode(chan.mode), csv_sep);
    }

    if (mem_caps->width)
    {
        fprintf(f, "%d%c", (int)chan.width, csv_sep);
    }

    if (mem_caps->tx_freq)
    {
        fprintf(f, "%.0"PRIfreq"%c", chan.tx_freq, csv_sep);
    }

    if (mem_caps->tx_mode)
    {
        fprintf(f, "%s%c", rig_strrmode(chan.tx_mode), csv_sep);
    }

    if (mem_caps->tx_width)
    {
        fprintf(f, "%d%c", (int)chan.tx_width, csv_sep);
    }

    if (mem_caps->split)
    {
        fprintf(f, "%s%c", chan.split == RIG_SPLIT_ON ? "on" : "off", csv_sep);
    }

    if (mem_caps->tx_vfo)
    {
        fprintf(f, "%s%c", rig_strvfo(chan.tx_vfo), csv_sep);
    }

    if (mem_caps->rptr_shift)
    {
        fprintf(f, "%s%c", rig_strptrshift(chan.rptr_shift), csv_sep);
    }

    if (mem_caps->rptr_offs)
    {
        fprintf(f, "%d%c", (int)chan.rptr_offs, csv_sep);
    }

    if (mem_caps->tuning_step)
    {
        fprintf(f, "%d%c", (int)chan.tuning_step, csv_sep);
    }

    if (mem_caps->rit)
    {
        fprintf(f, "%d%c", (int)chan.rit, csv_sep);
    }

    if (mem_caps->xit)
    {
        fprintf(f, "%d%c", (int)chan.xit, csv_sep);
    }

    if (mem_caps->funcs)
    {
        fprintf(f, "%"PRXll"%c", chan.funcs, csv_sep);
    }

    if (mem_caps->ctcss_tone)
    {
        fprintf(f, "%d%c", chan.ctcss_tone, csv_sep);
    }

    if (mem_caps->ctcss_sql)
    {
        fprintf(f, "%d%c", chan.ctcss_sql, csv_sep);
    }

    if (mem_caps->dcs_code)
    {
        fprintf(f, "%d%c", chan.dcs_code, csv_sep);
    }

    if (mem_caps->dcs_sql)
    {
        fprintf(f, "%d%c", chan.dcs_sql, csv_sep);
    }

    if (mem_caps->scan_group)
    {
        fprintf(f, "%d%c", chan.scan_group, csv_sep);
    }

    if (mem_caps->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;
}