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

Function frameGet

simulators/simic705.c:49–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47const char *vfonames[2] = {"VFOA", "VFOB"};
48
49int
50frameGet(int fd, unsigned char *buf)
51{
52 int i = 0;
53 memset(buf, 0, BUFSIZE);
54 unsigned char c;
55
56 while (read(fd, &c, 1) > 0)
57 {
58 buf[i++] = c;
59 //printf("i=%d, c=0x%02x\n",i,c);
60
61 if (c == FI) // End of message (EOM)
62 {
63 dumphex(buf, i);
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 1

dumphexFunction · 0.85

Tested by

no test coverage detected