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

Function frameParse

simulators/simic7200.c:101–784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void frameParse(int fd, unsigned char *frame, int len)
102{
103 double freq;
104 int n = 0;
105
106 if (len == 0)
107 {
108 printf("%s: len==0\n", __func__);
109 return;
110 }
111
112 dumphex(frame, len);
113
114 if (frame[0] != 0xfe && frame[1] != 0xfe)
115 {
116 printf("expected fe fe, got ");
117 dumphex(frame, len);
118 return;
119 }
120
121 // reverse the addressing
122 frame[3] = frame[2];
123 frame[2] = 0xe0;
124
125 switch (frame[4])
126 {
127 case 0x03:
128
129 //from_bcd(frameackbuf[2], (civ_731_mode ? 4 : 5) * 2);
130 if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN)
131 {
132 printf("get_freqA\n");
133 to_bcd(&frame[5], (long long)freqA, (civ_731_mode ? 4 : 5) * 2);
134 }
135 else
136 {
137 printf("get_freqB\n");
138 to_bcd(&frame[5], (long long)freqB, (civ_731_mode ? 4 : 5) * 2);
139 }
140
141 frame[10] = 0xfd;
142
143 if (powerstat)
144 {
145 n = write(fd, frame, 11);
146
147 if (n <= 0) { fprintf(stderr, "%s(%d) write error %s\n", __func__, __LINE__, strerror(errno)); }
148 }
149
150 break;
151
152 case 0x04:
153 if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN)
154 {
155 printf("get_modeA\n");
156 frame[5] = modeA;
157 frame[6] = widthA;
158 }

Callers 1

mainFunction · 0.70

Calls 6

dumphexFunction · 0.85
to_bcdFunction · 0.85
from_bcdFunction · 0.85
rig_strvfoFunction · 0.85
dump_hexFunction · 0.85
hl_usleepFunction · 0.85

Tested by

no test coverage detected