| 16 | |
| 17 | |
| 18 | int main(int argc, char *argv[]) |
| 19 | { |
| 20 | RIG *my_rig; |
| 21 | char *rig_file, *info_buf; |
| 22 | int retcode; |
| 23 | int model; |
| 24 | int cache_timeout = 0; |
| 25 | |
| 26 | model = 1; // we'll just use the dummy rig by default |
| 27 | rig_file = "127.0.0.1:4532"; // default if we use model#2 |
| 28 | |
| 29 | if (argc == 2) |
| 30 | { |
| 31 | model = atoi(argv[1]); |
| 32 | |
| 33 | if (model == 1) { rig_file = ""; } |
| 34 | } |
| 35 | |
| 36 | if (argc == 3) |
| 37 | { |
| 38 | rig_file = argv[2]; |
| 39 | } |
| 40 | |
| 41 | printf("Model#%d\n", model); |
| 42 | rig_set_debug(RIG_DEBUG_CACHE); |
| 43 | |
| 44 | /* Instantiate a rig */ |
| 45 | my_rig = rig_init(model); // your rig model. |
| 46 | |
| 47 | /* Set up serial port, baud rate */ |
| 48 | |
| 49 | rig_set_conf(my_rig, rig_token_lookup(my_rig, "rig_pathname"), rig_file); |
| 50 | |
| 51 | /* Open my rig */ |
| 52 | retcode = rig_open(my_rig); |
| 53 | |
| 54 | if (retcode != RIG_OK) |
| 55 | { |
| 56 | fprintf(stderr, "%s: rig_open failed %s\n", __func__, |
| 57 | rigerror(retcode)); |
| 58 | return 1; |
| 59 | } |
| 60 | |
| 61 | rig_set_cache_timeout_ms(my_rig, HAMLIB_CACHE_ALL, cache_timeout); |
| 62 | /* Give me ID info, e.g., firmware version. */ |
| 63 | info_buf = (char *)rig_get_info(my_rig); |
| 64 | |
| 65 | if (info_buf) |
| 66 | { |
| 67 | char *s = strdup(info_buf); |
| 68 | strtok(s, "\r\n"); |
| 69 | printf("Rig_info: '%s'\n", s); |
| 70 | free(s); |
| 71 | } |
| 72 | |
| 73 | vfo_t vfo; |
| 74 | retcode = rig_get_vfo(my_rig, &vfo); |
| 75 |
nothing calls this directly
no test coverage detected