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

Function frameGet

simulators/simic7000.c:42–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls 2

date_strgetFunction · 0.85
dumphexFunction · 0.85

Tested by

no test coverage detected