kopia lustrzana https://github.com/Hamlib/Hamlib
Porównaj commity
6 Commity
41de3425d2
...
3dac2efb48
Autor | SHA1 | Data |
---|---|---|
Mike Black W9MDB | 3dac2efb48 | |
Mike Black W9MDB | 63fa818fd7 | |
Mike Black W9MDB | 878243aff3 | |
Michael Black | 00ceb6e72f | |
Eli Schwartz | 279362f403 | |
Mike Black W9MDB | 9a7dda25c8 |
|
@ -1133,9 +1133,12 @@ enum rig_parm_e {
|
|||
RIG_PARM_BAT = (1 << 6), /*!< \c BAT -- battery level, float [0.0 ... 1.0] */
|
||||
RIG_PARM_KEYLIGHT = (1 << 7), /*!< \c KEYLIGHT -- Button backlight, on/off */
|
||||
RIG_PARM_SCREENSAVER = (1 << 8), /*!< \c SCREENSAVER -- rig specific timeouts */
|
||||
RIG_PARM_AFIF = (1 << 9), /*!< \c AFIF -- 0=AF audio, 1=IF audio -- see IC-7300/9700/705 */
|
||||
RIG_PARM_AFIF = (1 << 9), /*!< \c AFIF for USB -- 0=AF audio, 1=IF audio -- see IC-7300/9700/705 */
|
||||
RIG_PARM_BANDSELECT = (1 << 10), /*!< \c BANDSELECT -- e.g. BAND160M, BAND80M, BAND70CM, BAND2CM */
|
||||
RIG_PARM_KEYERTYPE = (1 << 11) /*!< \c KEYERTYPE -- 0,1,2 or STRAIGHT PADDLE BUG */
|
||||
RIG_PARM_KEYERTYPE = (1 << 11), /*!< \c KEYERTYPE -- 0,1,2 or STRAIGHT PADDLE BUG */
|
||||
RIG_PARM_AFIF_LAN = (1 << 12), /*!< \c AFIF for LAN -- 0=AF audi , 1=IF audio -- see IC-9700 */
|
||||
RIG_PARM_AFIF_WLAN = (1 << 13), /*!< \c AFIF_WLAN -- 0=AF audio, 1=IF audio -- see IC-705 */
|
||||
RIG_PARM_AFIF_ACC = (1 << 14) /*!< \c AFIF_ACC -- 0=AF audio, 1=IF audio -- see IC-9700 */
|
||||
};
|
||||
|
||||
enum rig_keyertype_e {
|
||||
|
|
|
@ -330,7 +330,7 @@ static char *xml_build(RIG *rig, char *cmd, char *value, char *xmlbuf,
|
|||
*/
|
||||
static char *xml_parse2(char *xml, char *value, int valueLen)
|
||||
{
|
||||
char *delims = "<>\r\n ";
|
||||
char *delims = "<>\r\n";
|
||||
char *xmltmp = strdup(xml);
|
||||
//rig_debug(RIG_DEBUG_TRACE, "%s: xml='%s'\n", __func__,xml);
|
||||
char *pr = xml;
|
||||
|
@ -2553,6 +2553,18 @@ static int flrig_get_ext_parm(RIG *rig, hamlib_token_t token, value_t *val)
|
|||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
HAMLIB_EXPORT(int) flrig_cat_string2(RIG *rig, const char *arg, char *value, int value_size)
|
||||
{
|
||||
int retval;
|
||||
char cmd_arg[MAXARGLEN];
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, arg);
|
||||
SNPRINTF(cmd_arg, sizeof(cmd_arg),
|
||||
"<params><param><value>%s</value></param></params>", arg);
|
||||
retval = flrig_transaction(rig, "rig.cat_string", cmd_arg, value, value_size);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: returned '%s'\n", __func__, value);
|
||||
return retval;
|
||||
}
|
||||
|
||||
HAMLIB_EXPORT(int) flrig_cat_string(RIG *rig, const char *arg)
|
||||
{
|
||||
int retval;
|
||||
|
|
|
@ -64,7 +64,7 @@ int ic9700_set_vfo(RIG *rig, vfo_t vfo);
|
|||
#define IC7300_VFOS (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM)
|
||||
// RIG_PARM_BANDSELECT disabled until Icom can describe the return from 0x1a 0x01
|
||||
//#define IC7300_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT|RIG_PARM_TIME|RIG_PARM_BEEP|RIG_PARM_BANDSELECT)
|
||||
#define IC7300_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT|RIG_PARM_SCREENSAVER|RIG_PARM_TIME|RIG_PARM_BEEP|RIG_PARM_KEYERTYPE)
|
||||
#define IC7300_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT|RIG_PARM_SCREENSAVER|RIG_PARM_TIME|RIG_PARM_BEEP|RIG_PARM_KEYERTYPE|RIG_PARM_AFIF)
|
||||
|
||||
#define IC7300_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL|RIG_OP_TUNE)
|
||||
#define IC7300_SCAN_OPS (RIG_SCAN_STOP|RIG_SCAN_MEM|RIG_SCAN_PROG|RIG_SCAN_SLCT)
|
||||
|
@ -147,6 +147,7 @@ int ic9700_set_vfo(RIG *rig, vfo_t vfo);
|
|||
/*
|
||||
* IC705 items that differ from IC7300
|
||||
*/
|
||||
#define IC705_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT|RIG_PARM_SCREENSAVER|RIG_PARM_TIME|RIG_PARM_BEEP|RIG_PARM_KEYERTYPE|RIG_PARM_AFIF|RIG_PARM_AFIF_WLAN)
|
||||
#define IC705_ALL_TX_MODES (RIG_MODE_FM|RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_DSTAR)
|
||||
#define IC705_ALL_RX_MODES (RIG_MODE_FM|RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM|RIG_MODE_PKTAM|RIG_MODE_DSTAR)
|
||||
#define IC705_OTHER_TX_MODES (RIG_MODE_FM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_DSTAR)
|
||||
|
@ -175,7 +176,7 @@ int ic9700_set_vfo(RIG *rig, vfo_t vfo);
|
|||
#define IC9700_VFOS (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MAIN|RIG_VFO_SUB|RIG_VFO_MEM|RIG_VFO_MAIN_A|RIG_VFO_MAIN_B|RIG_VFO_SUB_A|RIG_VFO_SUB_B)
|
||||
// RIG_PARM_BANDSELECT disabled until Icom can describe the return from 0x1a 0x01
|
||||
//#define IC9700_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT|RIG_PARM_TIME|RIG_PARM_BEEP|RIG_PARM_SCREENSAVER|RIG_PARM_BANDSELECT)
|
||||
#define IC9700_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT|RIG_PARM_TIME|RIG_PARM_BEEP|RIG_PARM_SCREENSAVER|RIG_PARM_KEYERTYPE)
|
||||
#define IC9700_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT|RIG_PARM_TIME|RIG_PARM_BEEP|RIG_PARM_SCREENSAVER|RIG_PARM_KEYERTYPE|RIG_PARM_AFIF|RIG_PARM_AFIF_LAN|RIG_PARM_AFIF_ACC)
|
||||
#define IC9700_FUNCS (RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_MON|RIG_FUNC_MN|RIG_FUNC_ANF|RIG_FUNC_LOCK|RIG_FUNC_RIT|RIG_FUNC_SCOPE|RIG_FUNC_SATMODE|RIG_FUNC_DUAL_WATCH|RIG_FUNC_AFC|RIG_FUNC_TRANSCEIVE|RIG_FUNC_SPECTRUM|RIG_FUNC_SPECTRUM_HOLD|RIG_FUNC_SEND_MORSE|RIG_FUNC_SEND_VOICE_MEM|RIG_FUNC_OVF_STATUS)
|
||||
#define IC9700_LEVELS (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF_RAW|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX|RIG_LEVEL_VOXDELAY|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_RFPOWER_METER_WATTS|RIG_LEVEL_COMP_METER|RIG_LEVEL_VD_METER|RIG_LEVEL_ID_METER|RIG_LEVEL_MONITOR_GAIN|RIG_LEVEL_NB|RIG_LEVEL_SPECTRUM_MODE|RIG_LEVEL_SPECTRUM_SPAN|RIG_LEVEL_SPECTRUM_SPEED|RIG_LEVEL_SPECTRUM_REF|RIG_LEVEL_SPECTRUM_AVG|RIG_LEVEL_SPECTRUM_EDGE_LOW|RIG_LEVEL_SPECTRUM_EDGE_HIGH|RIG_LEVEL_USB_AF|RIG_LEVEL_AGC_TIME)
|
||||
#define IC9700_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL)
|
||||
|
@ -271,7 +272,9 @@ struct cmdparams ic9700_extcmds[] =
|
|||
{ {.s = RIG_PARM_BACKLIGHT}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x52}, CMD_DAT_LVL, 2 },
|
||||
{ {.s = RIG_PARM_SCREENSAVER}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x67}, CMD_DAT_INT, 1 },
|
||||
{ {.s = RIG_PARM_TIME}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x80}, CMD_DAT_TIM, 2 },
|
||||
{ {.s = RIG_PARM_AFIF}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x00}, CMD_DAT_BOL, 1 },
|
||||
{ {.s = RIG_PARM_AFIF}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x05}, CMD_DAT_BOL, 1 },
|
||||
{ {.s = RIG_PARM_AFIF_ACC}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x00}, CMD_DAT_BOL, 1 },
|
||||
{ {.s = RIG_PARM_AFIF_LAN}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x10}, CMD_DAT_BOL, 1 },
|
||||
{ {.s = RIG_LEVEL_VOXDELAY}, CMD_PARAM_TYPE_LEVEL, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x03, 0x30}, CMD_DAT_INT, 1 },
|
||||
{ {.s = RIG_FUNC_TRANSCEIVE}, CMD_PARAM_TYPE_FUNC, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x27}, CMD_DAT_BOL, 1 },
|
||||
{ {.s = RIG_LEVEL_SPECTRUM_AVG}, CMD_PARAM_TYPE_LEVEL, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x92}, CMD_DAT_INT, 1 },
|
||||
|
@ -288,6 +291,7 @@ struct cmdparams ic705_extcmds[] =
|
|||
{ {.s = RIG_PARM_SCREENSAVER}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x38}, CMD_DAT_INT, 1 },
|
||||
{ {.s = RIG_PARM_TIME}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x66}, CMD_DAT_TIM, 2 },
|
||||
{ {.s = RIG_PARM_AFIF}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x09}, CMD_DAT_BOL, 1 },
|
||||
{ {.s = RIG_PARM_AFIF_WLAN}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x14}, CMD_DAT_BOL, 1 },
|
||||
{ {.s = RIG_LEVEL_VOXDELAY}, CMD_PARAM_TYPE_LEVEL, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x03, 0x59}, CMD_DAT_INT, 1 },
|
||||
{ {.s = RIG_FUNC_TRANSCEIVE}, CMD_PARAM_TYPE_FUNC, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x31}, CMD_DAT_BOL, 1 },
|
||||
{ {.s = RIG_LEVEL_SPECTRUM_AVG}, CMD_PARAM_TYPE_LEVEL, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x78}, CMD_DAT_INT, 1 },
|
||||
|
@ -737,7 +741,7 @@ struct rig_caps ic7300_caps =
|
|||
RIG_MODEL(RIG_MODEL_IC7300),
|
||||
.model_name = "IC-7300",
|
||||
.mfg_name = "Icom",
|
||||
.version = BACKEND_VER ".12",
|
||||
.version = BACKEND_VER ".13",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -982,7 +986,7 @@ struct rig_caps ic9700_caps =
|
|||
RIG_MODEL(RIG_MODEL_IC9700),
|
||||
.model_name = "IC-9700",
|
||||
.mfg_name = "Icom",
|
||||
.version = BACKEND_VER ".19",
|
||||
.version = BACKEND_VER ".20",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -1306,7 +1310,7 @@ struct rig_caps ic705_caps =
|
|||
RIG_MODEL(RIG_MODEL_IC705),
|
||||
.model_name = "IC-705",
|
||||
.mfg_name = "Icom",
|
||||
.version = BACKEND_VER ".10",
|
||||
.version = BACKEND_VER ".11",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -1600,7 +1604,7 @@ struct rig_caps ic905_caps =
|
|||
.has_get_level = IC705_LEVELS,
|
||||
.has_set_level = RIG_LEVEL_SET(IC705_LEVELS),
|
||||
.has_get_parm = IC7300_PARMS,
|
||||
.has_set_parm = RIG_PARM_SET(IC7300_PARMS),
|
||||
.has_set_parm = RIG_PARM_SET(IC705_PARMS),
|
||||
.level_gran = {
|
||||
#include "level_gran_icom.h"
|
||||
[LVL_KEYSPD] = {.min = {.i = 6}, .max = {.i = 48}, .step = {.i = 1}},
|
||||
|
|
|
@ -30,6 +30,22 @@ int split;
|
|||
int modeMain = 2;
|
||||
int modeSub = 2;
|
||||
int keyspd = 20;
|
||||
int sl=3, sh=3;
|
||||
int nr=0;
|
||||
int pa=0;
|
||||
int pc=25;
|
||||
int sm = 35;
|
||||
int nt = 0;
|
||||
int ag = 100;
|
||||
int ac = 0;
|
||||
int nb1=0,nb2=0;
|
||||
int sq=0;
|
||||
int rg=0;
|
||||
int mg=0;
|
||||
int ra=0;
|
||||
int rl=0;
|
||||
int is=0;
|
||||
int sp=0;
|
||||
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
|
@ -145,7 +161,11 @@ int main(int argc, char *argv[])
|
|||
cmd_err = 0;
|
||||
}
|
||||
|
||||
if (getmyline(fd, buf) > 0) { printf("Cmd:%s\n", buf); }
|
||||
if (getmyline(fd, buf) > 0)
|
||||
{
|
||||
// printf("Cmd:\"%s\"\n", buf);
|
||||
}
|
||||
|
||||
|
||||
// else { return 0; }
|
||||
|
||||
|
@ -156,7 +176,6 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
else if (strcmp(buf, "RM5;") == 0)
|
||||
{
|
||||
printf("%s\n", buf);
|
||||
hl_usleep(mysleep * 1000);
|
||||
pbuf = "RM5100000;";
|
||||
write(fd, pbuf, strlen(pbuf));
|
||||
|
@ -164,7 +183,6 @@ int main(int argc, char *argv[])
|
|||
|
||||
else if (strcmp(buf, "AN0;") == 0)
|
||||
{
|
||||
printf("%s\n", buf);
|
||||
hl_usleep(mysleep * 1000);
|
||||
pbuf = "AN030;";
|
||||
write(fd, pbuf, strlen(pbuf));
|
||||
|
@ -172,7 +190,6 @@ int main(int argc, char *argv[])
|
|||
else if (strcmp(buf, "IF;") == 0)
|
||||
{
|
||||
char ifbuf[256];
|
||||
printf("%s\n", buf);
|
||||
hl_usleep(mysleep * 1000);
|
||||
// pbuf = "IF000503130001000+0000000000030000000;"
|
||||
// sprintf(ifbuf, "IF%011d1000+0000002000000000000;", freqa);
|
||||
|
@ -180,74 +197,85 @@ int main(int argc, char *argv[])
|
|||
(ptt + ptt_mic + ptt_data + ptt_tune) > 0 ? 1 : 0, modeA);
|
||||
//pbuf = "IF00010138698 +00000000002000000 ;
|
||||
write(fd, ifbuf, strlen(ifbuf));
|
||||
continue;
|
||||
}
|
||||
else if (strcmp(buf, "NB1;") == 0)
|
||||
{
|
||||
hl_usleep(mysleep * 1000);
|
||||
pbuf = "NB10;";
|
||||
write(fd, pbuf, strlen(pbuf));
|
||||
continue;
|
||||
hl_usleep(mysleep * 100);
|
||||
sprintf(buf,"NB1%d;", nb1);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "NB1",3) == 0)
|
||||
{
|
||||
puts(buf);
|
||||
sscanf(buf, "NB1%d", &nb1);
|
||||
}
|
||||
else if (strcmp(buf, "NB2;") == 0)
|
||||
{
|
||||
hl_usleep(mysleep * 100);
|
||||
sprintf(buf,"NB2%d;", nb2);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "NB2",3) == 0)
|
||||
{
|
||||
puts(buf);
|
||||
sscanf(buf, "NB2%d", &nb2);
|
||||
}
|
||||
else if (strcmp(buf, "RA;") == 0)
|
||||
{
|
||||
hl_usleep(mysleep * 1000);
|
||||
pbuf = "RA1;"; /* -6dB */
|
||||
write(fd, pbuf, strlen(pbuf));
|
||||
continue;
|
||||
hl_usleep(mysleep * 200);
|
||||
sprintf(buf,"RA%d;", ra);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "RA", 2) == 0)
|
||||
{
|
||||
sscanf(buf, "RA%d", &ra);
|
||||
}
|
||||
else if (strcmp(buf, "RG;") == 0)
|
||||
{
|
||||
hl_usleep(mysleep * 1000);
|
||||
hl_usleep(mysleep * 000);
|
||||
pbuf = "RG255;";
|
||||
write(fd, pbuf, strlen(pbuf));
|
||||
continue;
|
||||
}
|
||||
else if (strcmp(buf, "MG;") == 0)
|
||||
{
|
||||
hl_usleep(mysleep * 1000);
|
||||
pbuf = "MG050;";
|
||||
write(fd, pbuf, strlen(pbuf));
|
||||
continue;
|
||||
}
|
||||
else if (strcmp(buf, "AG;") == 0)
|
||||
{
|
||||
hl_usleep(mysleep * 1000);
|
||||
pbuf = "AG100;";
|
||||
write(fd, pbuf, strlen(pbuf));
|
||||
continue;
|
||||
}
|
||||
else if (strcmp(buf, "FV;") == 0)
|
||||
{
|
||||
hl_usleep(mysleep * 1000);
|
||||
pbuf = "FV1.04;";
|
||||
write(fd, pbuf, strlen(pbuf));
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "IS;", 3) == 0)
|
||||
{
|
||||
SNPRINTF(buf, sizeof(buf), "IS+0000;");
|
||||
write(fd, buf, strlen(buf));
|
||||
printf("%s\n", buf);
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "IS", 2) == 0)
|
||||
{
|
||||
continue;
|
||||
sscanf(buf,"S%d", &is);
|
||||
}
|
||||
else if (strncmp(buf, "SM;", 3) == 0)
|
||||
{
|
||||
SNPRINTF(buf, sizeof(buf), "SM0035;");
|
||||
write(fd, buf, strlen(buf));
|
||||
printf("%s\n", buf);
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "PC;", 3) == 0)
|
||||
{
|
||||
SNPRINTF(buf, sizeof(buf), "PC100;");
|
||||
SNPRINTF(buf, sizeof(buf), "PC%03d;", pc);
|
||||
write(fd, buf, strlen(buf));
|
||||
printf("%s\n", buf);
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "PC", 2) == 0)
|
||||
{
|
||||
sscanf(buf,"PC%d", &pc);
|
||||
}
|
||||
else if (strcmp(buf, "FW1;") == 0)
|
||||
{
|
||||
|
@ -255,7 +283,6 @@ int main(int argc, char *argv[])
|
|||
pbuf = "FW10;";
|
||||
write(fd, pbuf, strlen(pbuf));
|
||||
hl_usleep(20 * 1000);
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "FW", 2) == 0)
|
||||
{
|
||||
|
@ -263,12 +290,10 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
else if (strcmp(buf, "ID;") == 0)
|
||||
{
|
||||
printf("%s\n", buf);
|
||||
hl_usleep(mysleep * 1000);
|
||||
int id = 24;
|
||||
SNPRINTF(buf, sizeof(buf), "ID%03d;", id);
|
||||
write(fd, buf, strlen(buf));
|
||||
continue;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -276,7 +301,6 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
if (strcmp(buf, "AI;"))
|
||||
{
|
||||
printf("%s\n", buf);
|
||||
hl_usleep(mysleep * 1000);
|
||||
n = fprintf(fp, "%s", "AI0;");
|
||||
}
|
||||
|
@ -287,7 +311,6 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
pbuf = "EX00011 001;";
|
||||
write(fd, pbuf, strlen(pbuf));
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "EX", 2) == 0)
|
||||
{
|
||||
|
@ -297,36 +320,30 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
SNPRINTF(buf, sizeof(buf), "FA%011d;", freqa);
|
||||
write(fd, buf, strlen(buf));
|
||||
continue;
|
||||
}
|
||||
else if (strcmp(buf, "FB;") == 0)
|
||||
{
|
||||
SNPRINTF(buf, sizeof(buf), "FB%011d;", freqb);
|
||||
write(fd, buf, strlen(buf));
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "FA", 2) == 0)
|
||||
{
|
||||
sscanf(buf, "FA%d", &freqa);
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "FB", 2) == 0)
|
||||
{
|
||||
sscanf(buf, "FB%d", &freqb);
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "AI;", 3) == 0)
|
||||
{
|
||||
SNPRINTF(buf, sizeof(buf), "AI0;");
|
||||
write(fd, buf, strlen(buf));
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (strncmp(buf, "PS;", 3) == 0)
|
||||
{
|
||||
SNPRINTF(buf, sizeof(buf), "PS1;");
|
||||
write(fd, buf, strlen(buf));
|
||||
continue;
|
||||
}
|
||||
else if (buf[3] == ';' && strncmp(buf, "SF", 2) == 0)
|
||||
{
|
||||
|
@ -335,7 +352,6 @@ int main(int argc, char *argv[])
|
|||
tmpvfo == 0 ? freqa : freqb,
|
||||
tmpvfo == 0 ? modeA : modeB);
|
||||
write(fd, buf, strlen(buf));
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "SF", 2) == 0)
|
||||
{
|
||||
|
@ -362,36 +378,30 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
printf("modeA=%X, modeB=%X\n", modeA, modeB);
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "MD;", 3) == 0)
|
||||
{
|
||||
SNPRINTF(buf, sizeof(buf), "MD%d;",
|
||||
modeA); // not worried about modeB yet for simulator
|
||||
write(fd, buf, strlen(buf));
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "MD", 2) == 0)
|
||||
{
|
||||
sscanf(buf, "MD%d", &modeA); // not worried about modeB yet for simulator
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "FL;", 3) == 0)
|
||||
{
|
||||
SNPRINTF(buf, sizeof(buf), "FL%03d%03d;", filternum1, filternum2);
|
||||
write(fd, buf, strlen(buf));
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "FL", 2) == 0)
|
||||
{
|
||||
sscanf(buf, "FL%3d%3d", &filternum1, &filternum2);
|
||||
continue;
|
||||
}
|
||||
else if (strcmp(buf, "FR;") == 0)
|
||||
{
|
||||
SNPRINTF(buf, sizeof(buf), "FR%d;", vfo);
|
||||
write(fd, buf, strlen(buf));
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "FR", 2) == 0)
|
||||
{
|
||||
|
@ -401,7 +411,6 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
SNPRINTF(buf, sizeof(buf), "FR%d;", vfo_tx);
|
||||
write(fd, buf, strlen(buf));
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "FT", 2) == 0)
|
||||
{
|
||||
|
@ -411,14 +420,10 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
SNPRINTF(buf, sizeof(buf), "DA%d;", datamode);
|
||||
write(fd, buf, strlen(buf));
|
||||
printf("%s\n", buf);
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "DA", 2) == 0)
|
||||
{
|
||||
sscanf(buf, "DA%d", &datamode);
|
||||
printf("%s\n", buf);
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "BD;", 3) == 0)
|
||||
{
|
||||
|
@ -447,7 +452,6 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "CB;", 3) == 0)
|
||||
{
|
||||
|
@ -499,6 +503,126 @@ int main(int argc, char *argv[])
|
|||
sprintf(buf, "RM2%04d;", 10);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strcmp(buf, "SL;") == 0)
|
||||
{
|
||||
sprintf(buf,"SL0%02d;", sl);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strcmp(buf, "SH;") == 0)
|
||||
{
|
||||
sprintf(buf,"SH0%02d;", sh);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "SL", 2) == 0)
|
||||
{
|
||||
sscanf(&buf[3],"%d", &sl);
|
||||
}
|
||||
else if (strncmp(buf, "SH", 2) == 0)
|
||||
{
|
||||
sscanf(&buf[3],"%d", &sh);
|
||||
}
|
||||
else if (strcmp(buf, "NR;") == 0)
|
||||
{
|
||||
sprintf(buf,"NR%d;", nr);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "NR", 2) == 0)
|
||||
{
|
||||
puts(buf);
|
||||
sscanf(buf,"NR%d", &nr);
|
||||
}
|
||||
else if (strcmp(buf, "PA;") == 0)
|
||||
{
|
||||
sprintf(buf,"PA%d;", pa);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "PA", 2) == 0)
|
||||
{
|
||||
sscanf(buf,"PA%d", &pa);
|
||||
}
|
||||
else if (strcmp(buf, "SM;") == 0)
|
||||
{
|
||||
sprintf(buf,"SM%04d;", sm);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strcmp(buf, "PC;") == 0)
|
||||
{
|
||||
sprintf(buf,"PC%03d;", sm);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strcmp(buf, "NT;") == 0)
|
||||
{
|
||||
sprintf(buf,"NT%d;", nt);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "NT", 2) == 0)
|
||||
{
|
||||
sscanf(buf,"NT%d", &nt);
|
||||
}
|
||||
else if (strcmp(buf, "AG;") == 0)
|
||||
{
|
||||
sprintf(buf,"AG%03d;", ag);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "AG", 2) == 0)
|
||||
{
|
||||
sscanf(buf,"AG%d", &ag);
|
||||
}
|
||||
else if (strcmp(buf, "AC;") == 0)
|
||||
{
|
||||
sprintf(buf,"AC%03d;", ac);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "AC", 2) == 0)
|
||||
{
|
||||
sscanf(buf,"AC%d", &ac);
|
||||
}
|
||||
else if (strcmp(buf, "SQ;") == 0)
|
||||
{
|
||||
sprintf(buf,"SQ%03d;", sq);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "SQ", 2) == 0)
|
||||
{
|
||||
sscanf(buf,"SQ%d", &sq);
|
||||
}
|
||||
else if (strcmp(buf, "RG;") == 0)
|
||||
{
|
||||
sprintf(buf,"RG%03d;", rg);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "RG", 2) == 0)
|
||||
{
|
||||
sscanf(buf,"RG%d", &rg);
|
||||
}
|
||||
else if (strcmp(buf, "MG;") == 0)
|
||||
{
|
||||
sprintf(buf,"MG%03d;", mg);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "MG", 2) == 0)
|
||||
{
|
||||
sscanf(buf,"MG%d", &mg);
|
||||
}
|
||||
else if (strncmp(buf, "RL1;", 3) == 0)
|
||||
{
|
||||
SNPRINTF(buf, sizeof(buf), "RL%02d;", rl);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "RL1", 2) == 0)
|
||||
{
|
||||
puts(buf);
|
||||
sscanf(buf,"RL1%d", &rl);
|
||||
}
|
||||
else if (strcmp(buf, "SP;") == 0)
|
||||
{
|
||||
sprintf(buf,"SP%d;", sp);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "SP", 2) == 0)
|
||||
{
|
||||
sscanf(buf,"SP%d", &sp);
|
||||
}
|
||||
else if (strlen(buf) > 0)
|
||||
{
|
||||
fprintf(stderr, "Unknown command: %s\n", buf);
|
||||
|
|
|
@ -1273,8 +1273,12 @@ static const struct
|
|||
{ RIG_PARM_BAT, "BAT" },
|
||||
{ RIG_PARM_KEYLIGHT, "KEYLIGHT"},
|
||||
{ RIG_PARM_SCREENSAVER, "SCREENSAVER"},
|
||||
{ RIG_PARM_AFIF, "AFIF"},
|
||||
{ RIG_PARM_BANDSELECT, "BANDSELECT"},
|
||||
{ RIG_PARM_KEYERTYPE, "KEYERTYPE"},
|
||||
{ RIG_PARM_AFIF_LAN, "AFIF_LAN"},
|
||||
{ RIG_PARM_AFIF_WLAN, "AFIF_WLAN"},
|
||||
{ RIG_PARM_AFIF_ACC, "AFIF_ACC"},
|
||||
{ RIG_PARM_NONE, "" },
|
||||
};
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <hamlib/rig.h>
|
||||
|
||||
#ifdef HAVE_XML2
|
||||
|
|
|
@ -575,7 +575,7 @@ static int scanfc(FILE *fin, const char *format, void *p)
|
|||
|
||||
if (ret < 1) { rig_debug(RIG_DEBUG_TRACE, "%s: ret=%d\n", __func__, ret); }
|
||||
|
||||
if (errno == 22) return -22;
|
||||
if (errno == 22) { return -22; }
|
||||
|
||||
if (ferror(fin)) { rig_debug(RIG_DEBUG_ERR, "%s: errno=%d, %s\n", __func__, errno, strerror(errno)); }
|
||||
|
||||
|
@ -1740,9 +1740,13 @@ readline_repeat:
|
|||
|
||||
// exception for get_vfo_info cmd which fails with log4om otherwise
|
||||
if (*vfo_opt && cmd != 0xf3)
|
||||
p1 == NULL ? a1[0] = '\0' : snprintf(a1, sizeof(a1), ":%s", p1);
|
||||
{
|
||||
p1 == NULL ? a1[0] = '\0' : snprintf(a1, sizeof(a1), ":%s", p1);
|
||||
}
|
||||
else
|
||||
p1 == NULL ? a1[0] = '\0' : snprintf(a1, sizeof(a1), " %s", p1);
|
||||
{
|
||||
p1 == NULL ? a1[0] = '\0' : snprintf(a1, sizeof(a1), " %s", p1);
|
||||
}
|
||||
|
||||
p2 == NULL ? a2[0] = '\0' : snprintf(a2, sizeof(a2), " %s", p2);
|
||||
p3 == NULL ? a3[0] = '\0' : snprintf(a3, sizeof(a3), " %s", p3);
|
||||
|
@ -4705,7 +4709,8 @@ declare_proto_rig(dump_state)
|
|||
fprintf(fout, "rig_model=%d\n", rig->caps->rig_model);
|
||||
fprintf(fout, "rigctld_version=%s\n", hamlib_version2);
|
||||
rig_sprintf_agc_levels(rig, buf, sizeof(buf));
|
||||
if (strlen(buf) > 0) fprintf(fout, "agc_levels=%s\n", buf);
|
||||
|
||||
if (strlen(buf) > 0) { fprintf(fout, "agc_levels=%s\n", buf); }
|
||||
|
||||
if (rig->caps->ctcss_list)
|
||||
{
|
||||
|
@ -5027,19 +5032,33 @@ static int hasbinary(char *s, int len)
|
|||
*
|
||||
* 'w' and 'W'
|
||||
*/
|
||||
extern int flrig_cat_string2(RIG *rig, const char *arg, char *value,
|
||||
int value_size);
|
||||
extern int flrig_cat_string(RIG *rig, const char *arg);
|
||||
|
||||
static void toLowerCase(char *s)
|
||||
{
|
||||
if (s == NULL) { return; } // Check if the pointer is NULL
|
||||
|
||||
while (*s) // Iterate until we hit the null terminator of the string
|
||||
{
|
||||
*s = tolower((unsigned char) * s); // Convert each character to lowercase
|
||||
s++; // Move to the next character
|
||||
}
|
||||
}
|
||||
|
||||
declare_proto_rig(send_cmd)
|
||||
{
|
||||
int retval;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
int backend_num, cmd_len;
|
||||
#define BUFSZ 512
|
||||
char bufcmd[BUFSZ * 5]; // allow for 5 chars for binary
|
||||
char bufcmd[BUFSZ * 5]; // allow for 5 chars for each binary
|
||||
unsigned char buf[BUFSZ];
|
||||
char eom_buf[4] = { 0xa, 0xd, 0, 0 };
|
||||
int binary = 0;
|
||||
int rxbytes = BUFSZ;
|
||||
int cmdcount = 1;
|
||||
int simulate = rig->caps->rig_model == RIG_MODEL_DUMMY ||
|
||||
rig->caps->rig_model == RIG_MODEL_NONE ||
|
||||
rp->rig == RIG_PORT_NONE;
|
||||
|
@ -5056,7 +5075,10 @@ declare_proto_rig(send_cmd)
|
|||
if (rig->caps->rig_model == RIG_MODEL_FLRIG)
|
||||
{
|
||||
// call flrig raw send function cat_string or cat_priority_string
|
||||
flrig_cat_string(rig, arg1);
|
||||
flrig_cat_string2(rig, arg1, (char*)buf, sizeof(buf));
|
||||
fwrite(cmd->arg2, 1, strlen(cmd->arg2), fout); /* i.e. "Frequency" */
|
||||
fprintf(fout, ": %s\n", buf);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
// need to move the eom_buf to rig-specifc backends
|
||||
|
@ -5070,11 +5092,17 @@ declare_proto_rig(send_cmd)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: arg1=%s\n", __func__, arg1);
|
||||
|
||||
// note that hex sscanf expectes at least 2 values to pass this check
|
||||
// is there any situation where only one x00 value would be written?
|
||||
unsigned int n, i1, i2;
|
||||
n = sscanf(arg1, "x%x x%x", &i1, &i2);
|
||||
|
||||
if (send_cmd_term == -1
|
||||
|| backend_num == RIG_ICOM
|
||||
|| backend_num == RIG_KACHINA
|
||||
|| backend_num == RIG_MICROTUNE
|
||||
|| (strstr(arg1, "\\0x") && (rig->caps->rig_model != RIG_MODEL_NETRIGCTL))
|
||||
|| ((strstr(arg1, "\\0x") || n == 2)
|
||||
&& (rig->caps->rig_model != RIG_MODEL_NETRIGCTL))
|
||||
)
|
||||
{
|
||||
|
||||
|
@ -5082,14 +5110,18 @@ declare_proto_rig(send_cmd)
|
|||
int i;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: send_cmd_term==-1, arg1=%s\n", __func__, arg1);
|
||||
|
||||
if (arg1[strlen(arg1) - 1] != ';' && strstr(arg1, "\\0x") == NULL)
|
||||
if (arg1[strlen(arg1) - 1] != ';' && strstr(arg1, "\\0x") == NULL
|
||||
&& sscanf(arg1, "x%x x%x", &i1, &i2) != 2)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: expecting binary hex string here\n", __func__);
|
||||
rig_debug(RIG_DEBUG_ERR,
|
||||
"%s: expecting binary hex string here, either x00 xff or \\0x00 \\0xff or x00xff\n",
|
||||
__func__);
|
||||
RETURNFUNC2(-RIG_EINVAL);
|
||||
}
|
||||
|
||||
for (i = 0; i < BUFSZ - 1 && p != pp; i++)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: p=%s\n", __func__, p);
|
||||
pp = p + 1;
|
||||
bufcmd[i] = strtol(p + 1, (char **) &p, 0);
|
||||
}
|
||||
|
@ -5183,27 +5215,59 @@ declare_proto_rig(send_cmd)
|
|||
|
||||
retval = 0;
|
||||
|
||||
if (strstr(arg1, ";") || arg2[0] == ';')
|
||||
{
|
||||
char *p = strchr(arg1, ';');
|
||||
|
||||
while (p)
|
||||
{
|
||||
cmdcount++;
|
||||
p = strchr(p + 1, ';');
|
||||
}
|
||||
|
||||
// Kenwood, Yaeus, and similar
|
||||
eom_buf[0] = ';';
|
||||
eom_buf[1] = 0;
|
||||
}
|
||||
else if (strstr(arg1, "xfd") || strstr(arg2, "xfd"))
|
||||
{
|
||||
char *s = strdup(arg1);
|
||||
toLowerCase(s);
|
||||
// ICOM answer terminator
|
||||
eom_buf[0] = 0xfd;
|
||||
eom_buf[1] = 0;
|
||||
char *p = strstr(s, "xfd");
|
||||
|
||||
while (p)
|
||||
{
|
||||
cmdcount++;
|
||||
p = strstr(p + 1, "xfd");
|
||||
}
|
||||
|
||||
free(s);
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (arg2) { sscanf(arg2, "%d", &rxbytes); }
|
||||
int hexval;
|
||||
rxbytes = BUFSZ; // leave room for CR
|
||||
|
||||
if (rxbytes > 0)
|
||||
if (arg2) // see if we have bytes or a hexval for terminating the 'W' command
|
||||
{
|
||||
sscanf(arg2, "%d", &rxbytes);
|
||||
|
||||
if (sscanf(arg2, "\\0x%2x", &hexval) == 1)
|
||||
{
|
||||
eom_buf[0] = hexval;
|
||||
}
|
||||
}
|
||||
|
||||
if (rxbytes > 0 && rxbytes != BUFSZ)
|
||||
{
|
||||
++rxbytes; // need length + 1 for end of string
|
||||
eom_buf[0] = 0;
|
||||
}
|
||||
|
||||
int hexval;
|
||||
|
||||
if (arg2[0] == ';') { eom_buf[0] = ';'; }
|
||||
else if (strstr(arg2, "fd")) { eom_buf[0] = 0xfd; } // ICOM answer terminator
|
||||
else
|
||||
{
|
||||
sscanf(arg2, "\\0x%2x", &hexval);
|
||||
eom_buf[0] = hexval;
|
||||
}
|
||||
|
||||
|
||||
if (simulate)
|
||||
{
|
||||
if (retval == 0)
|
||||
|
@ -5284,10 +5348,11 @@ declare_proto_rig(send_cmd)
|
|||
else
|
||||
{
|
||||
// we should be in printable ASCII here
|
||||
fprintf(fout, "%s\n", buf);
|
||||
fprintf(fout, "%s%c", buf, cmdcount == 1 ? '\n' : '\0');
|
||||
}
|
||||
}
|
||||
while (retval > 0 && rxbytes == BUFSZ);
|
||||
while ((retval > 0 && rxbytes == BUFSZ && eom_buf[0] != ';'
|
||||
&& eom_buf[0] != 0xfd) || --cmdcount > 1);
|
||||
|
||||
rig_flush_force(rp, 1);
|
||||
set_transaction_inactive(rig);
|
||||
|
|
Ładowanie…
Reference in New Issue