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

Function callback

tests/testmW2power.c:16–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14int nrigs = 0;
15
16int callback(const struct rig_caps *caps, rig_ptr_t rigp)
17{
18 RIG *rig = (RIG *) rigp;
19
20 switch (caps->rig_model)
21 {
22 case RIG_MODEL_NETRIGCTL:
23 return 1;
24 break;
25 }
26
27 rig = rig_init(caps->rig_model);
28
29 if (!rig)
30 {
31 fprintf(stderr, "Unknown rig num: %u\n", caps->rig_model);
32 fprintf(stderr, "Please check riglist.h\n");
33 exit(1); /* whoops! something went wrong (mem alloc?) */
34 }
35
36 if (caps->mW2power)
37 {
38 nrigs++;
39 printf("%20s:", caps->model_name);
40 fflush(stdout);
41 float fpow;
42 unsigned int mwpower = 1 * 1000;
43 freq_t freq = MHz(14);
44 int retcode = rig_mW2power(rig, &fpow, mwpower, freq, RIG_MODE_CW);
45
46 if (retcode != RIG_OK)
47 {
48 printf("rig_mW2power: error = %s \n", rigerror(retcode));
49 return 1;
50 }
51
52 if (fpow < 0.009 || fpow > .11)
53 {
54// printf("rig=%d, fpow=%g, min=%d, max=%d\n", caps->rig_model, fpow, caps->);
55 printf("rig=%u, fpow=%g\n", caps->rig_model, fpow);
56 // we call again to make debugging this section easier
57 rig_mW2power(rig, &fpow, mwpower, freq, RIG_MODE_CW);
58 }
59 else { printf("\n"); }
60 }
61
62 rig_cleanup(rig); /* if you care about memory */
63 return 1;
64}
65
66int main(int argc, char *argv[])
67{

Callers

nothing calls this directly

Calls 3

rig_mW2powerFunction · 0.85
rigerrorFunction · 0.85
rig_cleanupFunction · 0.85

Tested by

no test coverage detected