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

Function frameParse

simulators/simic7100.c:88–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88void frameParse(int fd, unsigned char *frame, int len)
89{
90 double freq;
91 int n = 0;
92
93 if (len == 0)
94 {
95 printf("%s: len==0\n", __func__);
96 return;
97 }
98
99 dumphex(frame, len);
100
101 if (frame[0] != 0xfe && frame[1] != 0xfe)
102 {
103 printf("expected fe fe, got ");
104 dumphex(frame, len);
105 return;
106 }
107
108 switch (frame[4])
109 {
110 case 0x03:
111
112 //from_bcd(frameackbuf[2], (civ_731_mode ? 4 : 5) * 2);
113 if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN)
114 {
115 printf("get_freqA\n");
116 to_bcd(&frame[5], (long long)freqA, (civ_731_mode ? 4 : 5) * 2);
117 }
118 else
119 {
120 printf("get_freqB\n");
121 to_bcd(&frame[5], (long long)freqB, (civ_731_mode ? 4 : 5) * 2);
122 }
123
124 frame[10] = 0xfd;
125
126 if (powerstat)
127 {
128 unsigned char frame2[11];
129 memcpy(frame2, frame, 11);
130 frame2[2] = 0xe1;
131 frame2[3] = 0x88;
132 dump_hex(frame2, 11);
133 n = write(fd, frame2, 11);
134 dump_hex(frame, 11);
135 n += write(fd, frame, 11);
136 }
137
138 break;
139
140 case 0x04:
141 if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN)
142 {
143 printf("get_modeA\n");
144 frame[5] = modeA;
145 frame[6] = widthA;

Callers 1

mainFunction · 0.70

Calls 6

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

Tested by

no test coverage detected