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

Function frameGet

simulators/simic7100.c:42–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40int keyspd = 20;
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#ifdef ECHO
60 // echo
61 n = write(fd, buf, i);
62#endif
63
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