kopia lustrzana https://github.com/Hamlib/Hamlib
Annotate legacy (undocumented) commands in simts890.c
Allow them to be disabled Relevant to issues #1380 and #899pull/1628/head
rodzic
27767fcfc1
commit
d0b1925234
|
@ -21,7 +21,16 @@ struct ip_mreq
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
//#include <hamlib/rig.h>
|
//#include <hamlib/rig.h>
|
||||||
|
|
||||||
|
/* Definitions */
|
||||||
|
/* The TS-890S has some undocumented commands, left over from older
|
||||||
|
* Kenwood models. They have newer counterparts with more functionality,
|
||||||
|
* but are still around for legacy software. If you want to see if your
|
||||||
|
* app is only using the latest-and-greatest, comment out the next define.
|
||||||
|
*/
|
||||||
|
#define LEGACY
|
||||||
|
// Size of command buffer
|
||||||
#define BUFSIZE 256
|
#define BUFSIZE 256
|
||||||
|
// Number of selectable bands
|
||||||
#define NBANDS 11
|
#define NBANDS 11
|
||||||
/* Type we're emulating - K=The Americas(default), E=Europe */
|
/* Type we're emulating - K=The Americas(default), E=Europe */
|
||||||
#if !defined(TYPE)
|
#if !defined(TYPE)
|
||||||
|
@ -30,6 +39,7 @@ struct ip_mreq
|
||||||
/* Define a macro for sending response back to the app
|
/* Define a macro for sending response back to the app
|
||||||
* This will allow us to reroute output to a buffering routine
|
* This will allow us to reroute output to a buffering routine
|
||||||
* Needed to handle multiple commands in a single message
|
* Needed to handle multiple commands in a single message
|
||||||
|
* Also makes it easy to trace
|
||||||
*/
|
*/
|
||||||
#if defined(TRACE)
|
#if defined(TRACE)
|
||||||
#define OUTPUT(s) {printf("Resp:\"%s\"\n", s); write(fd, s, strlen(s)); }
|
#define OUTPUT(s) {printf("Resp:\"%s\"\n", s); write(fd, s, strlen(s)); }
|
||||||
|
@ -251,6 +261,7 @@ int main(int argc, char *argv[])
|
||||||
kvfop_t *const vfoAB[2] = {&vfoA, &vfoB}; // 0=A, 1=B, fixed
|
kvfop_t *const vfoAB[2] = {&vfoA, &vfoB}; // 0=A, 1=B, fixed
|
||||||
kvfop_t *vfoLR[2] = {&vfoA, &vfoB}; // 0=Left, 1=Right, can change
|
kvfop_t *vfoLR[2] = {&vfoA, &vfoB}; // 0=Left, 1=Right, can change
|
||||||
|
|
||||||
|
#if defined(LEGACY)
|
||||||
/* The IF command is not documented for the TS-890S, and is supposed
|
/* The IF command is not documented for the TS-890S, and is supposed
|
||||||
* to be supplanted by SF. However, it is still there for legacy S/W.
|
* to be supplanted by SF. However, it is still there for legacy S/W.
|
||||||
* This description is taken from the TS-590S/SG manual, with values
|
* This description is taken from the TS-590S/SG manual, with values
|
||||||
|
@ -312,12 +323,16 @@ int main(int argc, char *argv[])
|
||||||
buf[1] = toupper(buf[1]);
|
buf[1] = toupper(buf[1]);
|
||||||
|
|
||||||
if (strcmp(buf, "IF;") == 0)
|
if (strcmp(buf, "IF;") == 0)
|
||||||
{
|
{ // Reads the tranceiver status
|
||||||
|
#if defined(LEGACY)
|
||||||
char ifbuf[256];
|
char ifbuf[256];
|
||||||
hl_usleep(mysleep * 1000);
|
hl_usleep(mysleep * 1000);
|
||||||
sprintf(ifbuf, IFformat, (*vfoLR[0])->freq,
|
sprintf(ifbuf, IFformat, (*vfoLR[0])->freq,
|
||||||
(ptt + ptt_mic + ptt_data + ptt_tune) > 0 ? 1 : 0, (*vfoLR[0])->mode, sp);
|
(ptt + ptt_mic + ptt_data + ptt_tune) > 0 ? 1 : 0, (*vfoLR[0])->mode, sp);
|
||||||
OUTPUT(ifbuf);
|
OUTPUT(ifbuf);
|
||||||
|
#else
|
||||||
|
cmd_err = 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (strncmp(buf, "AN", 2) == 0)
|
else if (strncmp(buf, "AN", 2) == 0)
|
||||||
{
|
{
|
||||||
|
@ -938,6 +953,22 @@ int main(int argc, char *argv[])
|
||||||
sscanf(&buf[3], "%1X", &(*vfoLR[idx])->mode);
|
sscanf(&buf[3], "%1X", &(*vfoLR[idx])->mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (strncmp(buf, "MD", 2) == 0)
|
||||||
|
{ // Sets and reads the operating mode status
|
||||||
|
#if defined(LEGACY)
|
||||||
|
if (buf[2] == ';')
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "MD%X;", (*vfoLR[0])->mode);
|
||||||
|
OUTPUT(buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sscanf(buf, "MD%1X", &(*vfoLR[0])->mode);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
cmd_err = 1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
else if (strncmp(buf, "RM", 2) == 0)
|
else if (strncmp(buf, "RM", 2) == 0)
|
||||||
{
|
{
|
||||||
// Meter
|
// Meter
|
||||||
|
|
Ładowanie…
Reference in New Issue