Fix some simulators to use new WRITE function

Update simts590.c
pull/1404/head
Mike Black W9MDB 2023-10-18 15:37:28 -05:00
rodzic cb5e9ec853
commit 60356f5774
7 zmienionych plików z 245 dodań i 295 usunięć

Wyświetl plik

@ -135,12 +135,12 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(50 * 1000);
pbuf = "RM5100000;";
write(fd, pbuf, strlen(pbuf));
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "AI;") == 0)
{
SNPRINTF(buf, sizeof(buf), "AI%d;", ai);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "AI", 2) == 0)
{
@ -152,7 +152,7 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(50 * 1000);
pbuf = "AN030;";
write(fd, pbuf, strlen(pbuf));
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "IF;") == 0)
{
@ -160,7 +160,7 @@ int main(int argc, char *argv[])
hl_usleep(50 * 1000);
//pbuf = "IF059014200000+000000700000;";
pbuf = "IF00007230000 -000000 0001000001 ;" ;
write(fd, pbuf, strlen(pbuf));
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "ID;") == 0)
{
@ -168,18 +168,18 @@ int main(int argc, char *argv[])
hl_usleep(50 * 1000);
int id = 24;
SNPRINTF(buf, sizeof(buf), "ID%03d;", id);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strcmp(buf, "PS;") == 0)
{
SNPRINTF(buf, sizeof(buf), "PS1;");
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strcmp(buf, "BW$;") == 0)
{
fprintf(stderr, "***** %d\n", __LINE__);
SNPRINTF(buf, sizeof(buf), "BW$%04d;", bandwidthB);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "BW$", 3) == 0)
{
@ -188,7 +188,7 @@ int main(int argc, char *argv[])
else if (strcmp(buf, "BW;") == 0)
{
SNPRINTF(buf, sizeof(buf), "BW%04d;", bandwidthA);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "BW", 2) == 0)
{
@ -197,7 +197,7 @@ int main(int argc, char *argv[])
else if (strcmp(buf, "DT;") == 0)
{
SNPRINTF(buf, sizeof(buf), "DT%d;", dt);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "DT", 2) == 0)
{
@ -206,7 +206,7 @@ int main(int argc, char *argv[])
else if (strcmp(buf, "BN;") == 0)
{
SNPRINTF(buf, sizeof(buf), "BN03;");
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strcmp(buf, "SM;") == 0)
{
@ -215,12 +215,12 @@ int main(int argc, char *argv[])
if (meter > 15) { meter = 0; }
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strcmp(buf, "RG;") == 0)
{
SNPRINTF(buf, sizeof(buf), "RG%03d;", rfgain);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "RG", 2) == 0)
{
@ -229,7 +229,7 @@ int main(int argc, char *argv[])
else if (strcmp(buf, "MG;") == 0)
{
SNPRINTF(buf, sizeof(buf), "MG%03d;", micgain);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "MG", 2) == 0)
{
@ -238,7 +238,7 @@ int main(int argc, char *argv[])
else if (strcmp(buf, "AG;") == 0)
{
SNPRINTF(buf, sizeof(buf), "MG%03d;", afgain);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "AG", 2) == 0)
{
@ -247,7 +247,7 @@ int main(int argc, char *argv[])
else if (strcmp(buf, "NB;") == 0)
{
SNPRINTF(buf, sizeof(buf), "NB%d;", noiseblanker);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "NB", 2) == 0)
{
@ -256,7 +256,7 @@ int main(int argc, char *argv[])
else if (strcmp(buf, "IS;") == 0)
{
SNPRINTF(buf, sizeof(buf), "IS %04d;", ifshift);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "IS", 2) == 0)
{
@ -283,7 +283,7 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(50 * 1000);
pbuf = "VS0;";
write(fd, pbuf, strlen(pbuf));
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "EX032;") == 0)
{
@ -292,36 +292,36 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(50 * 1000);
SNPRINTF(buf, sizeof(buf), "EX032%1d;", ant);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strcmp(buf, "OM;") == 0)
{
// KPA3 SNPRINTF(buf, sizeof(buf), "OM AP----L-----;");
// K4+KPA3
SNPRINTF(buf, sizeof(buf), "OM AP-S----4---;");
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strcmp(buf, "K2;") == 0)
{
write(fd, "K20;", 4);
WRITE(fd, "K20;", 4);
}
else if (strcmp(buf, "K3;") == 0)
{
write(fd, "K30;", 4);
WRITE(fd, "K30;", 4);
}
else if (strcmp(buf, "RVM;") == 0)
{
write(fd, "RV02.37;", 8);
WRITE(fd, "RV02.37;", 8);
}
else if (strcmp(buf, "MD;") == 0)
{
SNPRINTF(buf, sizeof(buf), "MD%d;", modea);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strcmp(buf, "MD$;") == 0)
{
SNPRINTF(buf, sizeof(buf), "MD$%d;", modeb);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "MD", 2) == 0)
{
@ -331,12 +331,12 @@ int main(int argc, char *argv[])
else if (strcmp(buf, "FA;") == 0)
{
SNPRINTF(buf, sizeof(buf), "FA%011d;", freqa);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strcmp(buf, "FB;") == 0)
{
SNPRINTF(buf, sizeof(buf), "FB%011d;", freqb);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "FA", 2) == 0)
@ -350,7 +350,7 @@ int main(int argc, char *argv[])
else if (strncmp(buf, "FR;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "FR0;");
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "FR", 2) == 0)
{
@ -359,12 +359,12 @@ int main(int argc, char *argv[])
else if (strncmp(buf, "FT;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "FT0;");
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "KS;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "KS%03d;", keyspd);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "KS", 2) == 0)
{
@ -373,22 +373,22 @@ int main(int argc, char *argv[])
else if (strncmp(buf, "TQ;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "TQ0;");
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "PC;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "PC0980;");
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "PA;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "PA%d;", preampA);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "PA$;", 4) == 0)
{
SNPRINTF(buf, sizeof(buf), "PA$%d;", preampB);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "PA", 2) == 0)
{
@ -401,12 +401,12 @@ int main(int argc, char *argv[])
else if (strncmp(buf, "RA;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "RA%02d;", rxattenuatorA);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "RA$;", 4) == 0)
{
SNPRINTF(buf, sizeof(buf), "RA$%02d;", rxattenuatorA);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "RA", 2) == 0)
{
@ -421,7 +421,7 @@ int main(int argc, char *argv[])
int status = 0;
printf("KY query\n");
SNPRINTF(buf, sizeof(buf), "KY%d;", status);
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "KY", 2) == 0)
{

Wyświetl plik

@ -143,7 +143,7 @@ void frameParse(int fd, unsigned char *frame, int len)
if (powerstat)
{
write(fd, frame, 11);
WRITE(fd, frame, 11);
}
break;
@ -163,7 +163,7 @@ void frameParse(int fd, unsigned char *frame, int len)
}
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
case 0x05:
@ -175,7 +175,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x06:
@ -184,7 +184,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x07:
@ -204,7 +204,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x0f:
@ -213,7 +213,7 @@ void frameParse(int fd, unsigned char *frame, int len)
printf("get split %d\n", split);
frame[5] = split;
frame[6] = 0xfd;
write(fd, frame, 7);
WRITE(fd, frame, 7);
}
else
{
@ -221,7 +221,7 @@ void frameParse(int fd, unsigned char *frame, int len)
split = frame[5];
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
}
break;
@ -242,9 +242,9 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[5] = ant_curr;
frame[6] = ant_option;
frame[7] = 0xfd;
printf("write 8 bytes\n");
printf("WRITE 8 bytes\n");
dump_hex(frame, 8);
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
case 0x14:
@ -258,7 +258,7 @@ void frameParse(int fd, unsigned char *frame, int len)
{
frame[6] = 0xfb;
dumphex(frame, 7);
write(fd, frame, 7);
WRITE(fd, frame, 7);
printf("ACK x14 x08\n");
}
else
@ -266,7 +266,7 @@ void frameParse(int fd, unsigned char *frame, int len)
to_bcd(&frame[6], (long long)128, 2);
frame[8] = 0xfb;
dumphex(frame, 9);
write(fd, frame, 9);
WRITE(fd, frame, 9);
printf("SEND x14 x08\n");
}
@ -280,7 +280,7 @@ void frameParse(int fd, unsigned char *frame, int len)
to_bcd(&frame[6], (long long)power_level, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
break;
case 0x0c:
@ -292,14 +292,14 @@ void frameParse(int fd, unsigned char *frame, int len)
printf("subcmd=0x0c #1\n");
keyspd = from_bcd(&frame[6], 2);
frame[6] = 0xfb;
write(fd, frame, 7);
WRITE(fd, frame, 7);
}
else
{
printf("subcmd=0x0c #1\n");
to_bcd(&frame[6], keyspd, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
}
break;
@ -316,7 +316,7 @@ void frameParse(int fd, unsigned char *frame, int len)
case 0x07:
frame[6] = ovf_status;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
ovf_status = ovf_status == 0 ? 1 : 0;
break;
@ -328,7 +328,7 @@ void frameParse(int fd, unsigned char *frame, int len)
to_bcd(&frame[6], (long long)meter_level, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
break;
}
@ -344,7 +344,7 @@ void frameParse(int fd, unsigned char *frame, int len)
{
frame[6] = satmode;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
}
break;
@ -355,13 +355,13 @@ void frameParse(int fd, unsigned char *frame, int len)
case 0x18: // miscellaneous things
frame[5] = 1;
frame[6] = 0xfd;
write(fd, frame, 7);
WRITE(fd, frame, 7);
break;
case 0x19: // miscellaneous things
frame[5] = 0x94;
frame[6] = 0xfd;
write(fd, frame, 7);
WRITE(fd, frame, 7);
break;
case 0x1a: // miscellaneous things
@ -372,7 +372,7 @@ void frameParse(int fd, unsigned char *frame, int len)
else { frame[6] = widthB; }
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
case 0x04: // AGC TIME
@ -382,7 +382,7 @@ void frameParse(int fd, unsigned char *frame, int len)
{
frame[6] = agc_time;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
}
else
{
@ -390,7 +390,7 @@ void frameParse(int fd, unsigned char *frame, int len)
agc_time = frame[6];
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
}
break;
@ -401,7 +401,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[6] = datamode;
frame[7] = filter;
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
}
else
{
@ -409,13 +409,13 @@ void frameParse(int fd, unsigned char *frame, int len)
filter = frame[7];
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
}
case 0x07: // satmode
frame[4] = 0;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
}
@ -433,7 +433,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[3] = tmp;
frame[6] = ptt;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
}
else
{
@ -443,7 +443,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[3] = tmp;
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
}
break;
@ -467,7 +467,7 @@ void frameParse(int fd, unsigned char *frame, int len)
to_bcd(&frame[6], (long long)freqA, freq_len * 2);
printf("X25 get_freqA=%.0f\n", freqA);
frame[6 + freq_len] = 0xfd;
write(fd, frame, 7 + freq_len);
WRITE(fd, frame, 7 + freq_len);
}
else
{
@ -476,7 +476,7 @@ void frameParse(int fd, unsigned char *frame, int len)
to_bcd(&frame[6], (long long)freqB, freq_len * 2);
printf("X25 get_freqB=%.0f\n", freqB);
frame[6 + freq_len] = 0xfd;
write(fd, frame, 7 + freq_len);
WRITE(fd, frame, 7 + freq_len);
}
//unsigned char frame2[12];
@ -494,7 +494,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame2[9] = 0x00;
frame2[10] = 0x00;
frame2[11] = 0xfd;
write(fd, frame2, 12);
WRITE(fd, frame2, 12);
#endif
}
else
@ -514,7 +514,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[3] = tmp;
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
#if 0
// send async frame
frame[2] = 0x00; // async freq
@ -526,7 +526,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[8] = 0x96;
frame[9] = 0x12;
frame[10] = 0xfd;
write(fd, frame, 11);
WRITE(fd, frame, 11);
#endif
}
@ -543,7 +543,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[7] = frame[5] == 0 ? datamodeA : datamodeB;
frame[8] = frame[5] == 0 ? filterA : filterB;
frame[9] = 0xfd;
write(fd, frame, 10);
WRITE(fd, frame, 10);
}
else
{
@ -562,7 +562,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
}
printf("\n");
@ -573,14 +573,14 @@ void frameParse(int fd, unsigned char *frame, int len)
printf("x25 send nak\n");
frame[4] = 0xfa;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x26:
printf("x26 send nak\n");
frame[4] = 0xfa;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
#endif

Wyświetl plik

@ -131,7 +131,7 @@ void frameParse(int fd, unsigned char *frame, int len)
if (powerstat)
{
write(fd, frame, 11);
WRITE(fd, frame, 11);
}
break;
@ -151,7 +151,7 @@ void frameParse(int fd, unsigned char *frame, int len)
}
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
case 0x05:
@ -163,7 +163,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x06:
@ -172,7 +172,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x07:
@ -192,7 +192,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x0f:
@ -204,14 +204,14 @@ void frameParse(int fd, unsigned char *frame, int len)
{
printf("get split %d\n", 1);
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
}
else
{
printf("set split %d\n", 1);
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
}
break;
@ -232,9 +232,9 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[5] = ant_curr;
frame[6] = ant_option;
frame[7] = 0xfd;
printf("write 8 bytes\n");
printf("WRITE 8 bytes\n");
dump_hex(frame, 8);
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
case 0x14:
@ -248,7 +248,7 @@ void frameParse(int fd, unsigned char *frame, int len)
{
frame[6] = 0xfb;
dumphex(frame, 7);
write(fd, frame, 7);
WRITE(fd, frame, 7);
printf("ACK x14 x08\n");
}
else
@ -256,7 +256,7 @@ void frameParse(int fd, unsigned char *frame, int len)
to_bcd(&frame[6], (long long)128, 2);
frame[8] = 0xfb;
dumphex(frame, 9);
write(fd, frame, 9);
WRITE(fd, frame, 9);
printf("SEND x14 x08\n");
}
@ -270,7 +270,7 @@ void frameParse(int fd, unsigned char *frame, int len)
to_bcd(&frame[6], (long long)power_level, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
break;
}
@ -284,7 +284,7 @@ void frameParse(int fd, unsigned char *frame, int len)
case 0x07:
frame[6] = ovf_status;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
ovf_status = ovf_status == 0 ? 1 : 0;
break;
@ -296,7 +296,7 @@ void frameParse(int fd, unsigned char *frame, int len)
to_bcd(&frame[6], (long long)meter_level, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
break;
}
@ -312,7 +312,7 @@ void frameParse(int fd, unsigned char *frame, int len)
{
frame[6] = satmode;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
}
break;
@ -323,13 +323,13 @@ void frameParse(int fd, unsigned char *frame, int len)
case 0x18: // miscellaneous things
frame[5] = 1;
frame[6] = 0xfd;
write(fd, frame, 7);
WRITE(fd, frame, 7);
break;
case 0x19: // miscellaneous things
frame[5] = 0x94;
frame[6] = 0xfd;
write(fd, frame, 7);
WRITE(fd, frame, 7);
break;
case 0x1a: // miscellaneous things
@ -340,7 +340,7 @@ void frameParse(int fd, unsigned char *frame, int len)
else { frame[6] = widthB; }
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
case 0x04: // AGC TIME
@ -350,7 +350,7 @@ void frameParse(int fd, unsigned char *frame, int len)
{
frame[6] = agc_time;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
}
else
{
@ -358,7 +358,7 @@ void frameParse(int fd, unsigned char *frame, int len)
agc_time = frame[6];
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
}
break;
@ -366,7 +366,7 @@ void frameParse(int fd, unsigned char *frame, int len)
case 0x07: // satmode
frame[4] = 0;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
}
@ -381,14 +381,14 @@ void frameParse(int fd, unsigned char *frame, int len)
{
frame[6] = ptt;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
}
else
{
ptt = frame[6];
frame[7] = 0xfb;
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
}
break;
@ -428,8 +428,8 @@ void frameParse(int fd, unsigned char *frame, int len)
frame2[8] = 0x03;
frame2[9] = 0x00;
frame2[10] = 0xfd;
write(fd, frame2, 11);
write(fd, frame, 12);
WRITE(fd, frame2, 11);
WRITE(fd, frame, 12);
}
else
{
@ -441,7 +441,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
// send async frame
frame[2] = 0x00; // async freq
frame[3] = 0xa2;
@ -452,7 +452,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[8] = 0x96;
frame[9] = 0x12;
frame[10] = 0xfd;
write(fd, frame, 11);
WRITE(fd, frame, 11);
}
break;
@ -468,7 +468,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[7] = frame[5] == 0 ? datamodeA : datamodeB;
frame[8] = 0xfb;
frame[9] = 0xfd;
write(fd, frame, 10);
WRITE(fd, frame, 10);
}
else
{
@ -487,7 +487,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
}
printf("\n");
@ -498,14 +498,14 @@ void frameParse(int fd, unsigned char *frame, int len)
printf("x25 send nak\n");
frame[4] = 0xfa;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x26:
printf("x26 send nak\n");
frame[4] = 0xfa;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
#endif

Wyświetl plik

@ -133,7 +133,7 @@ void frameParse(int fd, unsigned char *frame, int len)
if (powerstat)
{
write(fd, frame, 11);
WRITE(fd, frame, 11);
}
break;
@ -153,7 +153,7 @@ void frameParse(int fd, unsigned char *frame, int len)
}
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
case 0x05:
@ -165,7 +165,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x06:
@ -174,7 +174,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x07:
@ -194,7 +194,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x0f:
@ -206,14 +206,14 @@ void frameParse(int fd, unsigned char *frame, int len)
{
printf("get split %d\n", 1);
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
}
else
{
printf("set split %d\n", 1);
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
}
break;
@ -234,9 +234,9 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[5] = ant_curr;
frame[6] = ant_option;
frame[7] = 0xfd;
printf("write 8 bytes\n");
printf("WRITE 8 bytes\n");
dump_hex(frame, 8);
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
case 0x14:
@ -250,7 +250,7 @@ void frameParse(int fd, unsigned char *frame, int len)
{
frame[6] = 0xfb;
dumphex(frame, 7);
write(fd, frame, 7);
WRITE(fd, frame, 7);
printf("ACK x14 x08\n");
}
else
@ -258,7 +258,7 @@ void frameParse(int fd, unsigned char *frame, int len)
to_bcd(&frame[6], (long long)128, 2);
frame[8] = 0xfb;
dumphex(frame, 9);
write(fd, frame, 9);
WRITE(fd, frame, 9);
printf("SEND x14 x08\n");
}
@ -272,7 +272,7 @@ void frameParse(int fd, unsigned char *frame, int len)
to_bcd(&frame[6], (long long)power_level, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
break;
}
@ -286,7 +286,7 @@ void frameParse(int fd, unsigned char *frame, int len)
case 0x07:
frame[6] = ovf_status;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
ovf_status = ovf_status == 0 ? 1 : 0;
break;
@ -298,7 +298,7 @@ void frameParse(int fd, unsigned char *frame, int len)
to_bcd(&frame[6], (long long)meter_level, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
break;
}
@ -314,7 +314,7 @@ void frameParse(int fd, unsigned char *frame, int len)
{
frame[6] = dualwatch;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
}
break;
@ -328,7 +328,7 @@ void frameParse(int fd, unsigned char *frame, int len)
{
frame[6] = satmode;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
}
break;
@ -339,13 +339,13 @@ void frameParse(int fd, unsigned char *frame, int len)
case 0x18: // miscellaneous things
frame[5] = 1;
frame[6] = 0xfd;
write(fd, frame, 7);
WRITE(fd, frame, 7);
break;
case 0x19: // miscellaneous things
frame[5] = 0x94;
frame[6] = 0xfd;
write(fd, frame, 7);
WRITE(fd, frame, 7);
break;
case 0x1a: // miscellaneous things
@ -356,7 +356,7 @@ void frameParse(int fd, unsigned char *frame, int len)
else { frame[6] = widthB; }
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
case 0x04: // AGC TIME
@ -366,7 +366,7 @@ void frameParse(int fd, unsigned char *frame, int len)
{
frame[6] = agc_time;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
}
else
{
@ -374,7 +374,7 @@ void frameParse(int fd, unsigned char *frame, int len)
agc_time = frame[6];
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
}
break;
@ -382,7 +382,7 @@ void frameParse(int fd, unsigned char *frame, int len)
case 0x07: // satmode
frame[4] = 0;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
}
@ -397,14 +397,14 @@ void frameParse(int fd, unsigned char *frame, int len)
{
frame[6] = ptt;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
}
else
{
ptt = frame[6];
frame[7] = 0xfb;
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
}
break;
@ -444,8 +444,8 @@ void frameParse(int fd, unsigned char *frame, int len)
frame2[8] = 0x03;
frame2[9] = 0x00;
frame2[10] = 0xfd;
write(fd, frame2, 11);
write(fd, frame, 12);
WRITE(fd, frame2, 11);
WRITE(fd, frame, 12);
}
else
{
@ -457,7 +457,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
// send async frame
frame[2] = 0x00; // async freq
frame[3] = 0xa2;
@ -468,7 +468,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[8] = 0x96;
frame[9] = 0x12;
frame[10] = 0xfd;
write(fd, frame, 11);
WRITE(fd, frame, 11);
}
break;
@ -484,7 +484,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[7] = frame[5] == 0 ? datamodeA : datamodeB;
frame[8] = 0xfb;
frame[9] = 0xfd;
write(fd, frame, 10);
WRITE(fd, frame, 10);
}
else
{
@ -503,7 +503,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
}
printf("\n");
@ -514,14 +514,14 @@ void frameParse(int fd, unsigned char *frame, int len)
printf("x25 send nak\n");
frame[4] = 0xfa;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x26:
printf("x26 send nak\n");
frame[4] = 0xfa;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
#endif

Wyświetl plik

@ -104,7 +104,7 @@ void frameParse(int fd, unsigned char *frame, int len)
}
frame[10] = 0xfd;
write(fd, frame, 11);
WRITE(fd, frame, 11);
break;
@ -123,7 +123,7 @@ void frameParse(int fd, unsigned char *frame, int len)
}
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
case 0x05:
@ -135,7 +135,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x06:
@ -144,7 +144,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x07:
@ -164,7 +164,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x0f:
@ -174,7 +174,7 @@ void frameParse(int fd, unsigned char *frame, int len)
printf("set split %d\n", 1);
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
break;
case 0x12: // we're simulating the 3-byte version -- not the 2-byte
@ -193,9 +193,9 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[5] = ant_curr;
frame[6] = ant_option;
frame[7] = 0xfd;
printf("n=write 8 bytes\n");
printf("n=WRITE 8 bytes\n");
dump_hex(frame, 8);
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
case 0x14:
@ -209,7 +209,7 @@ void frameParse(int fd, unsigned char *frame, int len)
printf("Using AF level %d\n", level);
to_bcd(&frame[6], (long long) level, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
break;
case 0x0a:
@ -220,7 +220,7 @@ void frameParse(int fd, unsigned char *frame, int len)
to_bcd(&frame[6], (long long)power_level, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
break;
}
@ -239,7 +239,7 @@ void frameParse(int fd, unsigned char *frame, int len)
to_bcd(&frame[6], (long long)meter_level, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
break;
}
@ -248,7 +248,7 @@ void frameParse(int fd, unsigned char *frame, int len)
case 0x18: // miscellaneous things
frame[5] = 1;
frame[6] = 0xfd;
write(fd, frame, 7);
WRITE(fd, frame, 7);
break;
case 0x1a: // miscellaneous things
@ -259,20 +259,20 @@ void frameParse(int fd, unsigned char *frame, int len)
else { frame[6] = widthB; }
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
case 0x04: // IC7200 data mode
frame[6] = 0;
frame[7] = 0;
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
break;
case 0x07: // satmode
frame[6] = 0;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
break;
}
@ -287,14 +287,14 @@ void frameParse(int fd, unsigned char *frame, int len)
{
frame[6] = ptt;
frame[7] = 0xfd;
write(fd, frame, 8);
WRITE(fd, frame, 8);
}
else
{
ptt = frame[6];
frame[7] = 0xfb;
frame[8] = 0xfd;
write(fd, frame, 9);
WRITE(fd, frame, 9);
}
break;
@ -321,7 +321,7 @@ void frameParse(int fd, unsigned char *frame, int len)
}
frame[11] = 0xfd;
write(fd, frame, 12);
WRITE(fd, frame, 12);
}
else
{
@ -333,7 +333,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
}
break;
@ -349,7 +349,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[7] = frame[5] == 0 ? datamodeA : datamodeB;
frame[8] = 0xfb;
frame[9] = 0xfd;
write(fd, frame, 10);
WRITE(fd, frame, 10);
}
else
{
@ -368,7 +368,7 @@ void frameParse(int fd, unsigned char *frame, int len)
frame[4] = 0xfb;
frame[5] = 0xfd;
write(fd, frame, 6);
WRITE(fd, frame, 6);
}
printf("\n");

Wyświetl plik

@ -106,7 +106,7 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(mysleep * 1000);
pbuf = "RM5100000;";
write(fd, pbuf, strlen(pbuf));
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "AN0;") == 0)
@ -114,7 +114,7 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(mysleep * 1000);
pbuf = "AN030;";
write(fd, pbuf, strlen(pbuf));
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "IF;") == 0)
{
@ -124,97 +124,83 @@ int main(int argc, char *argv[])
pbuf = "IF000503130001000+0000000000030000000;";
sprintf(ifbuf, "IF%011d0001000+0000000000030000000;", freqa);
//pbuf = "IF00010138698 +00000000002000000 ;
write(fd, ifbuf, strlen(ifbuf));
continue;
WRITE(fd, ifbuf, strlen(ifbuf));
}
else if (strcmp(buf, "NB;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "NB0;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "RA;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "RA01;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "RG;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "RG055;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "MG;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "MG050;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "AG;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "AG100;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "FV;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "FV1.2;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strncmp(buf, "IS;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "IS+0000;");
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
printf("%s\n", buf);
continue;
}
else if (strncmp(buf, "IS", 2) == 0)
{
continue;
}
else if (strncmp(buf, "SM;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "SM0035;");
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
printf("%s\n", buf);
continue;
}
else if (strncmp(buf, "PC;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "PC100;");
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
printf("%s\n", buf);
continue;
}
else if (strcmp(buf, "FW;") == 0)
{
//usleep(mysleep * 1000);
pbuf = "FW240";
write(fd, pbuf, strlen(pbuf));
WRITE(fd, pbuf, strlen(pbuf));
hl_usleep(20 * 1000);
pbuf = "0;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strncmp(buf, "FW", 2) == 0)
{
continue;
}
else if (strcmp(buf, "ID;") == 0)
{
printf("%s\n", buf);
hl_usleep(mysleep * 1000);
SNPRINTF(buf, sizeof(buf), "ID%03d;", 10);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "AI", 2) == 0)
@ -224,7 +210,7 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(mysleep * 1000);
pbuf = "AI0;";
write(fd, pbuf, strlen(pbuf));
WRITE(fd, pbuf, strlen(pbuf));
}
}
@ -233,8 +219,7 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(mysleep * 1000);
pbuf = "VS0;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "EX032;") == 0)
{
@ -243,60 +228,51 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(mysleep * 1000);
SNPRINTF(buf, sizeof(buf), "EX032%1d;", ant);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "EX", 2) == 0)
{
continue;
}
else if (strcmp(buf, "FA;") == 0)
{
SNPRINTF(buf, sizeof(buf), "FA%011d;", freqa);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strcmp(buf, "FB;") == 0)
{
SNPRINTF(buf, sizeof(buf), "FB%011d;", freqb);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
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;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "PS;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "PS1;");
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "SA;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "SA0;");
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (buf[3] == ';' && strncmp(buf, "SF", 2) == 0)
{
SNPRINTF(buf, sizeof(buf), "SF%c%011.0f%c;", buf[2],
buf[2] == '0' ? freqA : freqB,
buf[2] == '0' ? modeA + '0' : modeB + '0');
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "SF", 2) == 0)
{
@ -307,36 +283,30 @@ int main(int argc, char *argv[])
printf("modeA=%c, modeB=%c\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;
WRITE(fd, buf, strlen(buf));
}
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;", filternum);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "FL", 2) == 0)
{
sscanf(buf, "FL%d", &filternum);
continue;
}
else if (strcmp(buf, "FR;") == 0)
{
SNPRINTF(buf, sizeof(buf), "FR%d;", vfo);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "FR", 2) == 0)
{
@ -345,8 +315,7 @@ int main(int argc, char *argv[])
else if (strcmp(buf, "FT;") == 0)
{
SNPRINTF(buf, sizeof(buf), "FR%d;", vfo_tx);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "FT", 2) == 0)
{
@ -355,28 +324,23 @@ int main(int argc, char *argv[])
else if (strncmp(buf, "DA;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "DA%d;", datamode);
write(fd, buf, strlen(buf));
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, "TO;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "TO%d;", tomode);
continue;
}
else if (strncmp(buf, "BD;", 3) == 0)
{
continue;
}
else if (strncmp(buf, "BU;", 3) == 0)
{
continue;
}
else if (strncmp(buf, "TX", 2) == 0)
{
@ -393,7 +357,6 @@ int main(int argc, char *argv[])
case '2': ptt_tune = 1;
}
continue;
}
else if (strlen(buf) > 0)
{

Wyświetl plik

@ -15,6 +15,7 @@ struct ip_mreq
#include <string.h>
#include <unistd.h>
#include <hamlib/rig.h>
#include "sim.h"
#define BUFSIZE 256
@ -25,6 +26,9 @@ float freqB = 14074500;
int filternum = 7;
int datamode = 0;
int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune;
int keyspd = 25;
int width_high = 0;
int width_low = 0;
int
getmyline(int fd, char *buf)
@ -104,7 +108,7 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(mysleep * 1000);
pbuf = "RM5100000;";
write(fd, pbuf, strlen(pbuf));
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "AN0;") == 0)
@ -112,7 +116,7 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(mysleep * 1000);
pbuf = "AN030;";
write(fd, pbuf, strlen(pbuf));
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "IF;") == 0)
{
@ -120,91 +124,71 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(mysleep * 1000);
pbuf = "IF000503130001000+0000000000030000000;";
sprintf(ifbuf, "IF%011d0001000+0000000000030000000;", freqa);
sprintf(ifbuf, "IF%011d1000+0000000000030000000;", freqa);
//pbuf = "IF00010138698 +00000000002000000 ;
write(fd, ifbuf, strlen(ifbuf));
continue;
WRITE(fd, ifbuf, strlen(ifbuf));
}
else if (strcmp(buf, "NB;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "NB0;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "RA;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "RA01;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "RG;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "RG055;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "MG;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "MG050;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "AG;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "AG100;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "FV;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "FV1.2;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strncmp(buf, "IS;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "IS+0000;");
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
printf("%s\n", buf);
continue;
}
else if (strncmp(buf, "IS", 2) == 0)
{
continue;
}
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;");
write(fd, buf, strlen(buf));
printf("%s\n", buf);
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strcmp(buf, "FW;") == 0)
{
//usleep(mysleep * 1000);
pbuf = "FW240";
write(fd, pbuf, strlen(pbuf));
WRITE(fd, pbuf, strlen(pbuf));
hl_usleep(20 * 1000);
pbuf = "0;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strncmp(buf, "FW", 2) == 0)
{
continue;
}
else if (strcmp(buf, "ID;") == 0)
{
@ -212,8 +196,7 @@ int main(int argc, char *argv[])
hl_usleep(mysleep * 1000);
int id = 24;
SNPRINTF(buf, sizeof(buf), "ID%03d;", id);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
#if 0
@ -233,8 +216,7 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(mysleep * 1000);
pbuf = "VS0;";
write(fd, pbuf, strlen(pbuf));
continue;
WRITE(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "EX032;") == 0)
{
@ -243,60 +225,51 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
hl_usleep(mysleep * 1000);
SNPRINTF(buf, sizeof(buf), "EX032%1d;", ant);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "EX", 2) == 0)
{
continue;
}
else if (strcmp(buf, "FA;") == 0)
{
SNPRINTF(buf, sizeof(buf), "FA%011d;", freqa);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strcmp(buf, "FB;") == 0)
{
SNPRINTF(buf, sizeof(buf), "FB%011d;", freqb);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
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;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "PS;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "PS1;");
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "SA;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "SA0;");
write(fd, buf, strlen(buf));
WRITE(fd, buf, strlen(buf));
}
else if (buf[3] == ';' && strncmp(buf, "SF", 2) == 0)
{
SNPRINTF(buf, sizeof(buf), "SF%c%011.0f%c;", buf[2],
buf[2] == '0' ? freqA : freqB,
buf[2] == '0' ? modeA + '0' : modeB + '0');
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "SF", 2) == 0)
{
@ -307,36 +280,30 @@ int main(int argc, char *argv[])
printf("modeA=%c, modeB=%c\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;
WRITE(fd, buf, strlen(buf));
}
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;", filternum);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "FL", 2) == 0)
{
sscanf(buf, "FL%d", &filternum);
continue;
}
else if (strcmp(buf, "FR;") == 0)
{
SNPRINTF(buf, sizeof(buf), "FR%d;", vfo);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "FR", 2) == 0)
{
@ -345,8 +312,7 @@ int main(int argc, char *argv[])
else if (strcmp(buf, "FT;") == 0)
{
SNPRINTF(buf, sizeof(buf), "FR%d;", vfo_tx);
write(fd, buf, strlen(buf));
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "FT", 2) == 0)
{
@ -355,23 +321,17 @@ int main(int argc, char *argv[])
else if (strncmp(buf, "DA;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "DA%d;", datamode);
write(fd, buf, strlen(buf));
printf("%s\n", buf);
continue;
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "DA", 2) == 0)
{
sscanf(buf, "DA%d", &datamode);
printf("%s\n", buf);
continue;
}
else if (strncmp(buf, "BD;", 3) == 0)
{
continue;
}
else if (strncmp(buf, "BU;", 3) == 0)
{
continue;
}
else if (strncmp(buf, "TX", 2) == 0)
{
@ -388,8 +348,35 @@ int main(int argc, char *argv[])
case '2': ptt_tune = 1;
}
continue;
}
else if (strncmp(buf, "KS;", 3) == 0)
{
sprintf(buf, "KS%03d;", keyspd);
WRITE(fd, buf, strlen(buf));
}
else if (strncmp(buf, "KS", 2) == 0)
{
sscanf(buf, "KS%03d", &keyspd);
}
else if (strncmp(buf, "SH", 2) == 0 && strlen(buf) > 4)
{
}
else if (strncmp(buf, "SH", 2) == 0)
{
SNPRINTF(buf, sizeof(buf), "SH%02d;", width_high);
WRITE(fd,buf,strlen(buf));
}
else if (strncmp(buf, "SL", 2) == 0 && strlen(buf) > 4)
{
sscanf(buf, "SL%d", &width_low);
printf("width_main=%d, width_sub=%d\n", width_high, width_low);
}
else if (strncmp(buf, "SL", 2) == 0)
{
SNPRINTF(buf, sizeof(buf), "SL%02d;", width_low);
WRITE(fd,buf,strlen(buf));
}
else if (strlen(buf) > 0)
{
fprintf(stderr, "Unknown command: %s\n", buf);