| 28 | #endif |
| 29 | |
| 30 | int main() |
| 31 | { |
| 32 | RIG *my_rig; |
| 33 | char *info_buf; |
| 34 | freq_t freq; |
| 35 | value_t rawstrength, power, strength; |
| 36 | float s_meter, rig_raw2val(int i, cal_table_t *t); |
| 37 | int status, retcode; |
| 38 | unsigned int mwpower; |
| 39 | rmode_t mode; |
| 40 | pbwidth_t width; |
| 41 | |
| 42 | /* Set verbosity level */ |
| 43 | rig_set_debug(RIG_DEBUG_TRACE); // Lots of output |
| 44 | |
| 45 | /* Instantiate a rig */ |
| 46 | my_rig = rig_init(MODEL); // your rig model. |
| 47 | |
| 48 | rig_set_conf(my_rig, rig_token_lookup(my_rig, "rig_pathname"), PATH); |
| 49 | |
| 50 | HAMLIB_RIGPORT(my_rig)->parm.serial.rate = BAUD; // your baud rate |
| 51 | |
| 52 | /* Open my rig */ |
| 53 | retcode = rig_open(my_rig); |
| 54 | |
| 55 | if (retcode != RIG_OK) |
| 56 | { |
| 57 | rig_debug(RIG_DEBUG_ERR, "%s: rig_open failed %s\n", __func__, |
| 58 | rigerror(retcode)); |
| 59 | return 1; |
| 60 | } |
| 61 | |
| 62 | /* Give me ID info, e.g., firmware version. */ |
| 63 | info_buf = (char *)rig_get_info(my_rig); |
| 64 | |
| 65 | printf("Rig_info: '%s'\n", info_buf); |
| 66 | |
| 67 | /* Note: As a general practice, we should check to see if a given |
| 68 | * function is within the rig's capabilities before calling it, but |
| 69 | * we are simplifying here. Also, we should check each call's returned |
| 70 | * status in case of error. (That's an inelegant way to catch an unsupported |
| 71 | * operation.) |
| 72 | */ |
| 73 | |
| 74 | if (my_rig->caps->rig_model == RIG_MODEL_NETRIGCTL) |
| 75 | { |
| 76 | status = rig_set_vfo_opt(my_rig, 1); |
| 77 | |
| 78 | if (status != RIG_OK) { printf("set_vfo_opt failed?? Err=%s\n", rigerror(status)); } |
| 79 | } |
| 80 | |
| 81 | /* Main VFO frequency */ |
| 82 | status = rig_get_freq(my_rig, RIG_VFO_CURR, &freq); |
| 83 | |
| 84 | if (status != RIG_OK) { printf("Get freq failed?? Err=%s\n", rigerror(status)); } |
| 85 | |
| 86 | printf("VFO freq. = %.1f Hz\n", freq); |
| 87 |
nothing calls this directly
no test coverage detected