| 50 | |
| 51 | |
| 52 | int main(int argc, char *argv[]) |
| 53 | { |
| 54 | unsigned char buf[BUFSIZE], buf2[256]; |
| 55 | |
| 56 | int fd = openPort(argv[1]); |
| 57 | |
| 58 | while (1) |
| 59 | { |
| 60 | int bytes = _getmyline(fd, buf); |
| 61 | int n = 0; |
| 62 | |
| 63 | if (bytes == 0) |
| 64 | { |
| 65 | continue; |
| 66 | } |
| 67 | |
| 68 | if (bytes != 8) |
| 69 | { |
| 70 | printf("Not 8 bytes? bytes=%d\n", bytes); |
| 71 | } |
| 72 | |
| 73 | switch (buf[0]) |
| 74 | { |
| 75 | case 0x41: |
| 76 | if (buf[4] == 0x00) // set ptt |
| 77 | { |
| 78 | if (buf[1] == 1) |
| 79 | { |
| 80 | ptt = 1; |
| 81 | printf("PTT ON\n"); |
| 82 | } |
| 83 | else |
| 84 | { |
| 85 | ptt = 0; |
| 86 | printf("PTT OFF\n"); |
| 87 | } |
| 88 | |
| 89 | buf[0] = 0x06; |
| 90 | n = write(fd, buf, 1); |
| 91 | } |
| 92 | |
| 93 | if (buf[4] == 0x20) // get vfo |
| 94 | { |
| 95 | printf("Get VFO curr_vfo=%d\n", curr_vfo); |
| 96 | |
| 97 | if (curr_vfo == 1) |
| 98 | { |
| 99 | curr_vfo = 0; |
| 100 | } |
| 101 | else |
| 102 | { |
| 103 | curr_vfo = 1; |
| 104 | } |
| 105 | |
| 106 | printf("Get VFO curr_vfo=%d\n", curr_vfo); |
| 107 | buf2[0] = 0xaa; |
| 108 | buf2[1] = 0x53; |
| 109 | buf2[2] = 0x00; |
nothing calls this directly
no test coverage detected