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

Function callback

tests/testrigopen.c:19–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17#define SERIAL_PORT "/dev/ttyUSB0"
18
19int callback(const struct rig_caps *caps, rig_ptr_t rigp)
20{
21 RIG *rig = (RIG *) rigp;
22
23 rig = rig_init(caps->rig_model);
24
25 if (!rig)
26 {
27 fprintf(stderr, "Unknown rig num: %u\n", caps->rig_model);
28 fprintf(stderr, "Please check riglist.h\n");
29 exit(1); /* whoops! something went wrong (mem alloc?) */
30 }
31
32 const char *port = "/dev/pts/3";
33 rig_set_conf(rig, rig_token_lookup(rig, "rig_pathname"), port);
34
35 printf("%20s:", caps->model_name);
36 fflush(stdout);
37 struct timeval start, end;
38 gettimeofday(&start, NULL);
39 rig_open(rig);
40 gettimeofday(&end, NULL);
41 double dstart = start.tv_sec + start.tv_usec / 1e6;
42 double dend = end.tv_sec + end.tv_usec / (double)1e6;
43 printf(" %.1f\n", dend - dstart);
44
45 rig_close(rig); /* close port */
46 rig_cleanup(rig); /* if you care about memory */
47 return 1;
48}
49
50int main(int argc, char *argv[])
51{

Callers

nothing calls this directly

Calls 6

rig_set_confFunction · 0.85
rig_token_lookupFunction · 0.85
gettimeofdayFunction · 0.85
rig_openFunction · 0.85
rig_closeFunction · 0.85
rig_cleanupFunction · 0.85

Tested by

no test coverage detected