MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / frameGet

Function frameGet

simulators/simic7200.c:53–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51int vox = 0;
52
53int
54frameGet(int fd, unsigned char *buf)
55{
56 int i = 0;
57 memset(buf, 0, BUFSIZE);
58 unsigned char c;
59
60 while (read(fd, &c, 1) > 0)
61 {
62 buf[i++] = c;
63 //printf("i=%d, c=0x%02x\n",i,c);
64
65 if (c == 0xfd)
66 {
67 char mytime[256];
68 date_strget(mytime, sizeof(mytime), 1);
69 printf("%s: %s ", mytime, __func__); dumphex(buf, i);
70#if 0
71 // echo
72 n = write(fd, buf, i);
73
74 if (n != i) { printf("%s: error on write: %s\n", __func__, strerror(errno)); }
75
76#endif
77 return i;
78 }
79
80 if (i > 2 && c == 0xfe)
81 {
82 printf("Turning power on due to 0xfe string\n");
83 powerstat = 1;
84 int j;
85
86 for (j = i; j < 175; ++j)
87 {
88 if (read(fd, &c, 1) < 0) { break; }
89 }
90
91 i = 0;
92 continue;
93 }
94 }
95
96 printf("Error %s\n", strerror(errno));
97
98 return 0;
99}
100
101void frameParse(int fd, unsigned char *frame, int len)
102{

Callers 1

mainFunction · 0.70

Calls 2

date_strgetFunction · 0.85
dumphexFunction · 0.85

Tested by

no test coverage detected