| 23 | |
| 24 | |
| 25 | int main(int argc, char *argv[]) |
| 26 | { |
| 27 | char buf[BUFSIZE]; |
| 28 | char *pbuf; |
| 29 | int n; |
| 30 | int fd = openPort(argv[1]); |
| 31 | int freqa = 14074000, freqb = 140735000; |
| 32 | int modeA = 0; // , modeB = 0; |
| 33 | |
| 34 | while (1) |
| 35 | { |
| 36 | buf[0] = 0; |
| 37 | |
| 38 | if (getmyline(fd, buf) > 0) { printf("Cmd:%s\n", buf); } |
| 39 | |
| 40 | // else { return 0; } |
| 41 | |
| 42 | if (strcmp(buf, "RM5;") == 0) |
| 43 | { |
| 44 | printf("%s\n", buf); |
| 45 | hl_usleep(50 * 1000); |
| 46 | pbuf = "RM5100000;"; |
| 47 | n = write(fd, pbuf, strlen(pbuf)); |
| 48 | // printf("n=%d\n", n); |
| 49 | |
| 50 | if (n <= 0) { perror("RM5"); } |
| 51 | } |
| 52 | |
| 53 | else if (strcmp(buf, "AN0;") == 0) |
| 54 | { |
| 55 | printf("%s\n", buf); |
| 56 | hl_usleep(50 * 1000); |
| 57 | pbuf = "AN030;"; |
| 58 | n = write(fd, pbuf, strlen(pbuf)); |
| 59 | // printf("n=%d\n", n); |
| 60 | |
| 61 | if (n <= 0) { perror("AN"); } |
| 62 | } |
| 63 | else if (strcmp(buf, "IF;") == 0) |
| 64 | { |
| 65 | char ifbuf[256]; |
| 66 | printf("%s\n", buf); |
| 67 | hl_usleep(50 * 1000); |
| 68 | pbuf = "IF000503130001000+0000000000030000000;"; |
| 69 | sprintf(ifbuf, "IF%011d0001000+0000000000030000000;", freqa); |
| 70 | //pbuf = "IF00010138698 +00000000002000000 ; |
| 71 | n = write(fd, ifbuf, strlen(ifbuf)); |
| 72 | // printf("n=%d\n", n); |
| 73 | |
| 74 | if (n <= 0) { perror("IF"); } |
| 75 | |
| 76 | continue; |
| 77 | } |
| 78 | else if (strcmp(buf, "FV;") == 0) |
| 79 | { |
| 80 | hl_usleep(50 * 1000); |
| 81 | pbuf = "FV1.2;"; |
| 82 | n = write(fd, pbuf, strlen(pbuf)); |