| 16 | |
| 17 | |
| 18 | int main(int argc, const char *argv[]) |
| 19 | { |
| 20 | RIG *my_rig; /* handle to rig (instance) */ |
| 21 | int retcode; /* generic return code from functions */ |
| 22 | rig_model_t myrig_model; |
| 23 | unsigned i; |
| 24 | struct timeval tv1, tv2; |
| 25 | float elapsed; |
| 26 | |
| 27 | rig_set_debug(RIG_DEBUG_ERR); |
| 28 | |
| 29 | /* |
| 30 | * allocate memory, setup & open port |
| 31 | */ |
| 32 | |
| 33 | if (argc < 2) |
| 34 | { |
| 35 | hamlib_port_t myport; |
| 36 | /* may be overridden by backend probe */ |
| 37 | myport.type.rig = RIG_PORT_SERIAL; |
| 38 | myport.parm.serial.rate = 19200; |
| 39 | myport.parm.serial.data_bits = 8; |
| 40 | myport.parm.serial.stop_bits = 1; |
| 41 | myport.parm.serial.parity = RIG_PARITY_NONE; |
| 42 | myport.parm.serial.handshake = RIG_HANDSHAKE_NONE; |
| 43 | strncpy(myport.pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1); |
| 44 | |
| 45 | rig_load_all_backends(); |
| 46 | myrig_model = rig_probe(&myport); |
| 47 | } |
| 48 | else |
| 49 | { |
| 50 | myrig_model = atoi(argv[1]); |
| 51 | } |
| 52 | |
| 53 | my_rig = rig_init(myrig_model); |
| 54 | |
| 55 | if (!my_rig) |
| 56 | { |
| 57 | fprintf(stderr, "Unknown rig num: %u\n", myrig_model); |
| 58 | fprintf(stderr, "Please check riglist.h\n"); |
| 59 | exit(1); /* whoops! something went wrong (mem alloc?) */ |
| 60 | } |
| 61 | |
| 62 | printf("Opened rig model %u, '%s'\n", |
| 63 | my_rig->caps->rig_model, |
| 64 | my_rig->caps->model_name); |
| 65 | |
| 66 | printf("Backend version: %s, Status: %s\n", |
| 67 | my_rig->caps->version, |
| 68 | rig_strstatus(my_rig->caps->status)); |
| 69 | |
| 70 | printf("Serial speed: %d baud\n", RIGPORT(my_rig)->parm.serial.rate); |
| 71 | #if 0 // if we want to bench serial or network I/O use this time |
| 72 | rig_set_cache_timeout_ms(my_rig, HAMLIB_CACHE_ALL, 0); |
| 73 | #endif |
| 74 | |
| 75 | strncpy(RIGPORT(my_rig)->pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1); |
nothing calls this directly
no test coverage detected