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

Function frameGet

simulators/simic7300.c:43–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41int keyertype = 0;
42
43int
44frameGet(int fd, unsigned char *buf)
45{
46 int i = 0;
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 printf("\n");
61 // echo
62 //n = write(fd, buf, i);
63 //if (n != i) { printf("%s: error on write: %s\n", __func__, strerror(errno)); }
64 return i;
65 }
66
67 if (i > 2 && c == 0xfe)
68 {
69 printf("Turning power on due to 0xfe string\n");
70 powerstat = 1;
71 int j;
72
73 for (j = i; j < 175; ++j)
74 {
75 if (read(fd, &c, 1) < 0) { break; }
76 }
77
78 i = 0;
79 continue;
80 }
81 }
82
83 printf("Error %s\n", strerror(errno));
84
85 return 0;
86}
87
88void frameParse(int fd, unsigned char *frame, int len)
89{

Callers 1

mainFunction · 0.70

Calls 2

date_strgetFunction · 0.85
dumphexFunction · 0.85

Tested by

no test coverage detected