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

Function main

tests/testrig.c:17–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16
17int main(int argc, const char *argv[])
18{
19 RIG *my_rig; /* handle to rig (instance) */
20 freq_t freq; /* frequency */
21 rmode_t rmode; /* radio mode of operation */
22 pbwidth_t width;
23 vfo_t vfo; /* vfo selection */
24 int strength; /* S-Meter level */
25 int rit = 0; /* RIT status */
26 int xit = 0; /* XIT status */
27 int retcode; /* generic return code from functions */
28
29 rig_model_t myrig_model;
30
31
32 printf("testrig: Hello, I am your main() !\n");
33
34 /* Turn off backend debugging output */
35 rig_set_debug_level(RIG_DEBUG_NONE);
36
37 /*
38 * allocate memory, setup & open port
39 */
40
41 hamlib_port_t myport;
42
43 if (argc < 2)
44 {
45 /* may be overridden by backend probe */
46 myport.type.rig = RIG_PORT_SERIAL;
47 myport.parm.serial.rate = 9600;
48 myport.parm.serial.data_bits = 8;
49 myport.parm.serial.stop_bits = 1;
50 myport.parm.serial.parity = RIG_PARITY_NONE;
51 myport.parm.serial.handshake = RIG_HANDSHAKE_NONE;
52
53 rig_load_all_backends();
54 myrig_model = rig_probe(&myport);
55 }
56 else
57 {
58 myrig_model = atoi(argv[1]);
59 }
60
61 my_rig = rig_init(myrig_model);
62 rig_set_conf(my_rig, rig_token_lookup(my_rig, "rig_pathname"), SERIAL_PORT);
63
64 if (!my_rig)
65 {
66 fprintf(stderr, "Unknown rig num: %u\n", myrig_model);
67 fprintf(stderr, "Please check riglist.h\n");
68 exit(1); /* whoops! something went wrong (mem alloc?) */
69 }
70
71 //strncpy(RIGPORT(my_rig)->pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1);
72
73 retcode = rig_open(my_rig);
74

Callers

nothing calls this directly

Calls 15

rig_load_all_backendsFunction · 0.85
rig_probeFunction · 0.85
rig_set_confFunction · 0.85
rig_token_lookupFunction · 0.85
rig_openFunction · 0.85
rigerrorFunction · 0.85
rig_get_caps_intFunction · 0.85
rig_get_conf2Function · 0.85
rig_debugFunction · 0.85
rig_set_vfoFunction · 0.85
rig_set_freqFunction · 0.85
rig_set_modeFunction · 0.85

Tested by

no test coverage detected