git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@961 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.3
Stéphane Fillod, F8CFE 2002-02-15 15:09:03 +00:00
rodzic ee972fe23f
commit 74ba433844
1 zmienionych plików z 429 dodań i 30 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib tcl/tk bindings - rig
* Copyright (c) 2001,2002 by Stephane Fillod
*
* $Id: tclrig.c,v 1.2 2002-02-15 00:14:17 fillods Exp $
* $Id: tclrig.c,v 1.3 2002-02-15 15:09:03 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -77,10 +77,17 @@ declare_proto_rig(set_func);
declare_proto_rig(get_func);
declare_proto_rig(set_parm);
declare_proto_rig(get_parm);
#if 0
declare_proto_rig(set_ptt);
declare_proto_rig(get_ptt);
declare_proto_rig(get_dcd);
declare_proto_rig(set_split_freq);
declare_proto_rig(get_split_freq);
declare_proto_rig(set_split_mode);
declare_proto_rig(get_split_mode);
declare_proto_rig(set_split);
declare_proto_rig(get_split);
declare_proto_rig(set_bank);
declare_proto_rig(set_mem);
declare_proto_rig(get_mem);
declare_proto_rig(vfo_op);
declare_proto_rig(scan);
declare_proto_rig(set_rptr_shift);
declare_proto_rig(get_rptr_shift);
declare_proto_rig(set_rptr_offs);
@ -89,24 +96,33 @@ declare_proto_rig(set_ctcss_tone);
declare_proto_rig(get_ctcss_tone);
declare_proto_rig(set_dcs_code);
declare_proto_rig(get_dcs_code);
declare_proto_rig(set_split_freq);
declare_proto_rig(get_split_freq);
declare_proto_rig(set_split_mode);
declare_proto_rig(get_split_mode);
declare_proto_rig(set_split);
declare_proto_rig(get_split);
declare_proto_rig(set_ctcss_sql);
declare_proto_rig(get_ctcss_sql);
declare_proto_rig(set_dcs_sql);
declare_proto_rig(get_dcs_sql);
declare_proto_rig(set_ts);
declare_proto_rig(get_ts);
declare_proto_rig(set_rit);
declare_proto_rig(get_rit);
declare_proto_rig(set_xit);
declare_proto_rig(get_xit);
#if 0
declare_proto_rig(set_ptt);
declare_proto_rig(get_ptt);
declare_proto_rig(get_dcd);
declare_proto_rig(power2mW);
declare_proto_rig(set_bank);
declare_proto_rig(set_mem);
declare_proto_rig(get_mem);
declare_proto_rig(vfo_op);
declare_proto_rig(scan);
declare_proto_rig(set_channel);
declare_proto_rig(get_channel);
declare_proto_rig(set_trn);
declare_proto_rig(get_trn);
declare_proto_rig(set_powerstat);
declare_proto_rig(get_powerstat);
declare_proto_rig(reset);
declare_proto_rig(set_ant);
declare_proto_rig(get_ant);
declare_proto_rig(send_dtmf);
declare_proto_rig(recv_dtmf);
declare_proto_rig(send_morse);
#endif
/*
@ -130,9 +146,17 @@ static struct cmd_table cmd_list[] = {
{ "get_func", get_func, ARG_IN1|ARG_OUT2, "Func", "Func status" },
{ "set_parm", set_parm, ARG_IN, "Parm", "Value" },
{ "get_parm", get_parm, ARG_IN1|ARG_OUT2, "Parm", "Value" },
#if 0
{ "set_ptt", set_ptt, ARG_IN, "PTT" },
{ "get_ptt", get_ptt, ARG_OUT, "PTT" },
{ "set_bank", set_bank, ARG_IN, "Bank" },
{ "set_mem", set_mem, ARG_IN, "Memory#" },
{ "get_mem", get_mem, ARG_OUT, "Memory#" },
{ "vfo_op", vfo_op, ARG_IN, "Mem/VFO op" },
{ "set_split_freq", set_split_freq, ARG_IN, "Tx frequency" },
{ "get_split_freq", get_split_freq, ARG_OUT, "Tx frequency" },
{ "set_split_mode", set_split_mode, ARG_IN, "Mode", "Passband" },
{ "get_split_mode", get_split_mode, ARG_OUT, "Mode", "Passband" },
{ "set_split", set_split, ARG_IN, "Split mode" },
{ "get_split", get_split, ARG_OUT, "Split mode" },
{ "scan", scan, ARG_IN, "Scan fct", "Channel" },
{ "set_rptr_shift", set_rptr_shift, ARG_IN, "Rptr shift" },
{ "get_rptr_shift", get_rptr_shift, ARG_OUT, "Rptr shift" },
{ "set_rptr_offs", set_rptr_offs, ARG_IN, "Rptr offset" },
@ -141,23 +165,23 @@ static struct cmd_table cmd_list[] = {
{ "get_ctcss_tone", get_ctcss_tone, ARG_OUT, "CTCSS tone" },
{ "set_dcs_code", set_dcs_code, ARG_IN, "DCS code" },
{ "get_dcs_code", get_dcs_code, ARG_OUT, "DCS code" },
{ "set_split_freq", set_split_freq, ARG_IN, "Tx frequency" },
{ "get_split_freq", get_split_freq, ARG_OUT, "Tx frequency" },
{ "set_split_mode", set_split_mode, ARG_IN, "Mode", "Passband" },
{ "get_split_mode", get_split_mode, ARG_OUT, "Mode", "Passband" },
{ "set_split", set_split, ARG_IN, "Split mode" },
{ "get_split", get_split, ARG_OUT, "Split mode" },
{ "set_ctcss_sql", set_ctcss_sql, ARG_IN, "CTCSS tone" },
{ "get_ctcss_sql", get_ctcss_sql, ARG_OUT, "CTCSS tone" },
{ "set_dcs_sql", set_dcs_sql, ARG_IN, "DCS code" },
{ "get_dcs_sql", get_dcs_sql, ARG_OUT, "DCS code" },
{ "set_ts", set_ts, ARG_IN, "Tuning step" },
{ "get_ts", get_ts, ARG_OUT, "Tuning step" },
{ "set_mem", set_mem, ARG_IN, "Memory#" },
{ "get_mem", get_mem, ARG_OUT, "Memory#" },
{ "vfo_op", vfo_op, ARG_IN, "Mem/VFO op" },
{ "scan", scan, ARG_IN, "Scan fct", "Channel" },
{ "set_rit", set_rit, ARG_IN, "RIT" },
{ "get_rit", get_rit, ARG_OUT, "RIT" },
{ "set_xit", set_xit, ARG_IN, "XIT" },
{ "get_xit", get_xit, ARG_OUT, "XIT" },
#if 0
{ "set_ptt", set_ptt, ARG_IN, "PTT" },
{ "get_ptt", get_ptt, ARG_OUT, "PTT" },
{ "set_channel", set_channel, ARG_IN, /* huh! */ },
{ "get_channel", get_channel, ARG_IN, "Channel" },
{ "set_trn", set_trn, ARG_IN, "Transceive" },
{ "get_trn", get_trn, ARG_OUT, "Transceive" },
{ "set_bank", set_bank, ARG_IN, "Bank" },
{ "power2mW", power2mW },
#endif
{ "get_info", get_info, ARG_OUT, "Info" },
@ -443,6 +467,381 @@ declare_proto_rig(get_vfo)
return RIG_OK;
}
declare_proto_rig(set_split)
{
split_t split;
int arg;
Tcl_GetIntFromObj(interp, objv[2], &arg);
split = arg ? RIG_SPLIT_ON : RIG_SPLIT_OFF;
return rig_set_split(rig, RIG_VFO_CURR, split);
}
declare_proto_rig(get_split)
{
int status;
split_t split;
Tcl_Obj *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
status = rig_get_split(rig, RIG_VFO_CURR, &split);
if (status != RIG_OK)
return status;
Tcl_SetIntObj(resultPtr, split);
return RIG_OK;
}
declare_proto_rig(scan)
{
scan_t scan;
int ch;
scan = parse_scan(Tcl_GetString(objv[2]));
Tcl_GetIntFromObj(interp, objv[3], &ch);
return rig_scan(rig, RIG_VFO_CURR, scan, ch);
}
declare_proto_rig(vfo_op)
{
vfo_op_t op;
op = parse_vfo_op(Tcl_GetString(objv[2]));
return rig_vfo_op(rig, RIG_VFO_CURR, op);
}
declare_proto_rig(set_bank)
{
int bank;
Tcl_GetIntFromObj(interp, objv[2], &bank);
return rig_set_bank(rig, RIG_VFO_CURR, bank);
}
declare_proto_rig(set_mem)
{
int ch;
Tcl_GetIntFromObj(interp, objv[2], &ch);
return rig_set_mem(rig, RIG_VFO_CURR, ch);
}
declare_proto_rig(get_mem)
{
int status;
int ch;
Tcl_Obj *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
status = rig_get_mem(rig, RIG_VFO_CURR, &ch);
if (status != RIG_OK)
return status;
Tcl_SetIntObj(resultPtr, ch);
return RIG_OK;
}
declare_proto_rig(set_split_freq)
{
int status;
double d;
freq_t freq;
status = Tcl_GetDoubleFromObj(interp, objv[2], &d);
if (status != TCL_OK)
return status;
freq = (freq_t)d;
return rig_set_split_freq(rig, RIG_VFO_CURR, freq);
}
declare_proto_rig(get_split_freq)
{
int status;
freq_t freq;
Tcl_Obj *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
status = rig_get_split_freq(rig, RIG_VFO_CURR, &freq);
if (status != RIG_OK)
return status;
Tcl_SetDoubleObj(resultPtr, (double)freq);
return RIG_OK;
}
declare_proto_rig(set_split_mode)
{
int status;
rmode_t mode;
pbwidth_t width;
mode = parse_mode(Tcl_GetString(objv[2]));
status = Tcl_GetLongFromObj(interp, objv[3], &width);
if (status != TCL_OK)
return status;
return rig_set_split_mode(rig, RIG_VFO_CURR, mode, width);
}
declare_proto_rig(get_split_mode)
{
int status;
rmode_t mode;
pbwidth_t width;
Tcl_Obj *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
status = rig_get_split_mode(rig, RIG_VFO_CURR, &mode, &width);
if (status != RIG_OK)
return status;
/* FIXME: return also width */
Tcl_SetStringObj(resultPtr, strmode(mode), -1);
return RIG_OK;
}
declare_proto_rig(set_rptr_shift)
{
rptr_shift_t rptr_shift;
rptr_shift = parse_rptr_shift(Tcl_GetString(objv[2]));
return rig_set_rptr_shift(rig, RIG_VFO_CURR, rptr_shift);
}
declare_proto_rig(get_rptr_shift)
{
int status;
rptr_shift_t rptr_shift;
Tcl_Obj *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
status = rig_get_rptr_shift(rig, RIG_VFO_CURR, &rptr_shift);
if (status != RIG_OK)
return status;
/* FIXME: return also width */
Tcl_SetStringObj(resultPtr, strptrshift(rptr_shift), -1);
return RIG_OK;
}
declare_proto_rig(set_rptr_offs)
{
shortfreq_t offs;
Tcl_GetLongFromObj(interp, objv[2], &offs);
return rig_set_rptr_offs(rig, RIG_VFO_CURR, offs);
}
declare_proto_rig(get_rptr_offs)
{
int status;
shortfreq_t offs;
Tcl_Obj *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
status = rig_get_rptr_offs(rig, RIG_VFO_CURR, &offs);
if (status != RIG_OK)
return status;
Tcl_SetLongObj(resultPtr, offs);
return RIG_OK;
}
declare_proto_rig(set_rit)
{
shortfreq_t rit;
Tcl_GetLongFromObj(interp, objv[2], &rit);
return rig_set_rit(rig, RIG_VFO_CURR, rit);
}
declare_proto_rig(get_rit)
{
int status;
shortfreq_t rit;
Tcl_Obj *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
status = rig_get_rit(rig, RIG_VFO_CURR, &rit);
if (status != RIG_OK)
return status;
Tcl_SetLongObj(resultPtr, rit);
return RIG_OK;
}
declare_proto_rig(set_xit)
{
shortfreq_t xit;
Tcl_GetLongFromObj(interp, objv[2], &xit);
return rig_set_xit(rig, RIG_VFO_CURR, xit);
}
declare_proto_rig(get_xit)
{
int status;
shortfreq_t xit;
Tcl_Obj *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
status = rig_get_xit(rig, RIG_VFO_CURR, &xit);
if (status != RIG_OK)
return status;
Tcl_SetLongObj(resultPtr, xit);
return RIG_OK;
}
declare_proto_rig(set_ts)
{
shortfreq_t ts;
Tcl_GetLongFromObj(interp, objv[2], &ts);
return rig_set_ts(rig, RIG_VFO_CURR, ts);
}
declare_proto_rig(get_ts)
{
int status;
shortfreq_t ts;
Tcl_Obj *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
status = rig_get_ts(rig, RIG_VFO_CURR, &ts);
if (status != RIG_OK)
return status;
Tcl_SetLongObj(resultPtr, ts);
return RIG_OK;
}
declare_proto_rig(set_dcs_code)
{
tone_t code;
Tcl_GetIntFromObj(interp, objv[2], &code);
return rig_set_dcs_code(rig, RIG_VFO_CURR, code);
}
declare_proto_rig(get_dcs_code)
{
int status;
tone_t code;
Tcl_Obj *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
status = rig_get_dcs_code(rig, RIG_VFO_CURR, &code);
if (status != RIG_OK)
return status;
Tcl_SetIntObj(resultPtr, code);
return RIG_OK;
}
declare_proto_rig(set_dcs_sql)
{
tone_t code;
Tcl_GetIntFromObj(interp, objv[2], &code);
return rig_set_dcs_sql(rig, RIG_VFO_CURR, code);
}
declare_proto_rig(get_dcs_sql)
{
int status;
tone_t code;
Tcl_Obj *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
status = rig_get_dcs_sql(rig, RIG_VFO_CURR, &code);
if (status != RIG_OK)
return status;
Tcl_SetIntObj(resultPtr, code);
return RIG_OK;
}
declare_proto_rig(set_ctcss_tone)
{
tone_t code;
Tcl_GetIntFromObj(interp, objv[2], &code);
return rig_set_ctcss_tone(rig, RIG_VFO_CURR, code);
}
declare_proto_rig(get_ctcss_tone)
{
int status;
tone_t code;
Tcl_Obj *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
status = rig_get_ctcss_tone(rig, RIG_VFO_CURR, &code);
if (status != RIG_OK)
return status;
Tcl_SetIntObj(resultPtr, code);
return RIG_OK;
}
declare_proto_rig(set_ctcss_sql)
{
tone_t code;
Tcl_GetIntFromObj(interp, objv[2], &code);
return rig_set_ctcss_sql(rig, RIG_VFO_CURR, code);
}
declare_proto_rig(get_ctcss_sql)
{
int status;
tone_t code;
Tcl_Obj *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
status = rig_get_ctcss_sql(rig, RIG_VFO_CURR, &code);
if (status != RIG_OK)
return status;
Tcl_SetIntObj(resultPtr, code);
return RIG_OK;
}
declare_proto_rig(get_info)
{