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

Function frameGet

simulators/simic2730.c:43–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls 2

date_strgetFunction · 0.85
dumphexFunction · 0.85

Tested by

no test coverage detected