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

Function frameParse

simulators/simic705.c:88–565  ·  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 unsigned char acknak = ACK; // Hope for the best
93
94 if (len == 0)
95 {
96 printf("%s: len==0\n", __func__);
97 return;
98 }
99
100 printf("Here#1\n");
101 dumphex(frame, len);
102
103 if (frame[0] != 0xfe || frame[1] != 0xfe)
104 {
105 printf("expected fe fe, got ");
106 dumphex(frame, len);
107 return;
108 }
109
110 switch (frame[4])
111 {
112 case C_RD_FREQ: // 0x03
113
114 //from_bcd(frameackbuf[2], (civ_731_mode ? 4 : 5) * 2);
115 if (current_vfo == S_VFOA || current_vfo == S_MAIN)
116 {
117 printf("get_freqA\n");
118 to_bcd(&frame[5], (long long)freqA, (civ_731_mode ? 4 : 5) * 2);
119 }
120 else
121 {
122 printf("get_freqB\n");
123 to_bcd(&frame[5], (long long)freqB, (civ_731_mode ? 4 : 5) * 2);
124 }
125
126 frame[10] = FI;
127
128 if (powerstat)
129 {
130 n = write(fd, frame, 11);
131 }
132
133 break;
134
135 case C_RD_MODE: // 0x04
136 if (current_vfo == S_VFOA || current_vfo == S_MAIN)
137 {
138 printf("get_modeA\n");
139 frame[5] = modeA;
140 frame[6] = widthA;
141 }
142 else
143 {
144 printf("get_modeB\n");
145 frame[5] = modeB;

Callers 1

mainFunction · 0.70

Calls 4

dumphexFunction · 0.85
to_bcdFunction · 0.85
from_bcdFunction · 0.85
dump_hexFunction · 0.85

Tested by

no test coverage detected