kopia lustrzana https://github.com/Hamlib/Hamlib
Fix backwards compatibility of rotctl with rotctld
https://github.com/Hamlib/Hamlib/issues/1035pull/1148/head
rodzic
42f65cc5fb
commit
d7ab039573
|
@ -90,12 +90,7 @@ static int netrotctl_open(ROT *rot)
|
|||
}
|
||||
|
||||
prot_ver = atoi(buf);
|
||||
#define ROTCTLD_PROT_VER 0
|
||||
|
||||
if (prot_ver < ROTCTLD_PROT_VER)
|
||||
{
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
#define ROTCTLD_PROT_VER 1
|
||||
|
||||
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
|
||||
sizeof("\n"), 0, 1);
|
||||
|
@ -105,50 +100,9 @@ static int netrotctl_open(ROT *rot)
|
|||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
|
||||
sizeof("\n"), 0, 1);
|
||||
|
||||
if (ret <= 0)
|
||||
{
|
||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rs->min_az = rot->caps->min_az = atof(buf);
|
||||
|
||||
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
|
||||
sizeof("\n"), 0, 1);
|
||||
|
||||
if (ret <= 0)
|
||||
{
|
||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rs->max_az = rot->caps->max_az = atof(buf);
|
||||
|
||||
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
|
||||
sizeof("\n"), 0, 1);
|
||||
|
||||
if (ret <= 0)
|
||||
{
|
||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rs->min_el = rot->caps->min_el = atof(buf);
|
||||
|
||||
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
|
||||
sizeof("\n"), 0, 1);
|
||||
|
||||
if (ret <= 0)
|
||||
{
|
||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rs->max_el = rot->caps->max_el = atof(buf);
|
||||
|
||||
if (prot_ver == 0) { return (RIG_OK); }
|
||||
|
||||
// Prot 1 is tag=value format and should cover any needed additions
|
||||
// Automically parses
|
||||
do
|
||||
{
|
||||
char setting[32], value[1024];
|
||||
|
@ -161,19 +115,37 @@ static int netrotctl_open(ROT *rot)
|
|||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
// ignore the rot_model
|
||||
|
||||
if (strncmp(buf, "done", 4) == 0) { return (RIG_OK); }
|
||||
|
||||
if (sscanf(buf, "%31[^=]=%1023[^\t\n]", setting, value) == 2)
|
||||
{
|
||||
if (strcmp(setting,"south_zero")==0)
|
||||
if (strcmp(setting, "min_az") == 0)
|
||||
{
|
||||
rs->min_az = rot->caps->min_az = atof(value);
|
||||
}
|
||||
else if (strcmp(setting, "max_az") == 0)
|
||||
{
|
||||
rs->max_az = rot->caps->max_az = atof(value);
|
||||
}
|
||||
else if (strcmp(setting, "min_el") == 0)
|
||||
{
|
||||
rs->min_el = rot->caps->min_el = atof(value);
|
||||
}
|
||||
else if (strcmp(setting, "max_el") == 0)
|
||||
{
|
||||
rs->max_el = rot->caps->max_el = atof(value);
|
||||
}
|
||||
else if (strcmp(setting, "south_zero") == 0)
|
||||
{
|
||||
rs->south_zero = atoi(value);
|
||||
}
|
||||
else if (strcmp(setting, "rot_type")==0)
|
||||
else if (strcmp(setting, "rot_type") == 0)
|
||||
{
|
||||
if (strstr(buf, "AzEl")) { rot->caps->rot_type = ROT_TYPE_AZEL; }
|
||||
else if (strstr(buf, "Az")) { rot->caps->rot_type = ROT_TYPE_AZIMUTH; }
|
||||
else if (strstr(buf, "El")) { rot->caps->rot_type = ROT_TYPE_ELEVATION; }
|
||||
if (strcmp(value, "AzEl") == 0) { rot->caps->rot_type = ROT_TYPE_AZEL; }
|
||||
else if (strcmp(value, "Az") == 0) { rot->caps->rot_type = ROT_TYPE_AZIMUTH; }
|
||||
else if (strcmp(value, "El") == 0) { rot->caps->rot_type = ROT_TYPE_ELEVATION; }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2359,6 +2359,7 @@ declare_proto_rot(dump_caps)
|
|||
declare_proto_rot(dump_state)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
char *tag;
|
||||
|
||||
/*
|
||||
* - Protocol version
|
||||
|
@ -2379,40 +2380,45 @@ declare_proto_rot(dump_state)
|
|||
|
||||
fprintf(fout, "%d%c", rot->caps->rot_model, resp_sep);
|
||||
|
||||
tag = "min_az=";
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
{
|
||||
fprintf(fout, "Minimum Azimuth: ");
|
||||
tag = "Minimum Azimuth: ";
|
||||
}
|
||||
|
||||
fprintf(fout, "%lf%c", rs->min_az + rot->state.az_offset, resp_sep);
|
||||
fprintf(fout, "%s%lf%c", tag, rs->min_az + rot->state.az_offset, resp_sep);
|
||||
|
||||
tag = "max_az=";
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
{
|
||||
fprintf(fout, "Maximum Azimuth: ");
|
||||
tag= "Maximum Azimuth: ";
|
||||
}
|
||||
|
||||
fprintf(fout, "%lf%c", rs->max_az + rot->state.az_offset, resp_sep);
|
||||
fprintf(fout, "%s%lf%c", tag, rs->max_az + rot->state.az_offset, resp_sep);
|
||||
|
||||
tag = "min_el=";
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
{
|
||||
fprintf(fout, "Minimum Elevation: ");
|
||||
tag= "Minimum Elevation: ";
|
||||
}
|
||||
|
||||
fprintf(fout, "%lf%c", rs->min_el + rot->state.el_offset, resp_sep);
|
||||
fprintf(fout, "%s%lf%c", tag, rs->min_el + rot->state.el_offset, resp_sep);
|
||||
|
||||
tag = "max_el=";
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
{
|
||||
fprintf(fout, "Maximum Elevation: ");
|
||||
tag= "Maximum Elevation: ";
|
||||
}
|
||||
|
||||
fprintf(fout, "%lf%c", rs->max_el + rot->state.el_offset, resp_sep);
|
||||
fprintf(fout, "%s%lf%c", tag, rs->max_el + rot->state.el_offset, resp_sep);
|
||||
|
||||
tag = "south_zero=";
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
{
|
||||
fprintf(fout, "South Zero: ");
|
||||
tag= "South Zero: ";
|
||||
}
|
||||
|
||||
fprintf(fout, "%d%c", rs->south_zero, resp_sep);
|
||||
fprintf(fout, "%s%d%c", tag, rs->south_zero, resp_sep);
|
||||
|
||||
char *rtype = "Unknown";
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue