2000-10-08 21:20:44 +00:00
|
|
|
/*
|
2008-10-25 11:10:24 +00:00
|
|
|
* listrigs.c - Copyright (C) 2000-2008 Stephane Fillod
|
2000-10-08 21:20:44 +00:00
|
|
|
* This programs list all the available the rig capabilities.
|
|
|
|
*
|
|
|
|
*
|
2011-08-22 01:51:06 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2000-10-08 21:20:44 +00:00
|
|
|
*
|
2011-08-22 01:51:06 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2000-10-08 21:20:44 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include <hamlib/rig.h>
|
|
|
|
|
|
|
|
|
|
|
|
int print_caps_sum(const struct rig_caps *caps, void *data)
|
|
|
|
{
|
|
|
|
|
2008-11-09 14:26:04 +00:00
|
|
|
printf("%d\t%-10s\t%-12s\t%s\t",caps->rig_model,caps->mfg_name,
|
2000-10-08 21:20:44 +00:00
|
|
|
caps->model_name, caps->version);
|
|
|
|
|
2008-11-09 14:26:04 +00:00
|
|
|
printf("%-10s\t", rig_strstatus(caps->status));
|
2001-08-08 06:08:33 +00:00
|
|
|
switch (caps->rig_type & RIG_TYPE_MASK) {
|
2000-10-08 21:20:44 +00:00
|
|
|
case RIG_TYPE_TRANSCEIVER:
|
|
|
|
printf("Transceiver\n");
|
|
|
|
break;
|
|
|
|
case RIG_TYPE_HANDHELD:
|
|
|
|
printf("Handheld\n");
|
|
|
|
break;
|
|
|
|
case RIG_TYPE_MOBILE:
|
|
|
|
printf("Mobile\n");
|
|
|
|
break;
|
|
|
|
case RIG_TYPE_RECEIVER:
|
|
|
|
printf("Receiver\n");
|
|
|
|
break;
|
2001-02-11 23:20:33 +00:00
|
|
|
case RIG_TYPE_PCRECEIVER:
|
|
|
|
printf("PC Receiver\n");
|
|
|
|
break;
|
2000-10-08 21:20:44 +00:00
|
|
|
case RIG_TYPE_SCANNER:
|
|
|
|
printf("Scanner\n");
|
|
|
|
break;
|
2001-06-02 18:11:21 +00:00
|
|
|
case RIG_TYPE_TRUNKSCANNER:
|
|
|
|
printf("Trunking scanner\n");
|
|
|
|
break;
|
2000-10-08 21:20:44 +00:00
|
|
|
case RIG_TYPE_COMPUTER:
|
|
|
|
printf("Computer\n");
|
|
|
|
break;
|
2001-02-14 01:12:59 +00:00
|
|
|
case RIG_TYPE_OTHER:
|
|
|
|
printf("Other\n");
|
|
|
|
break;
|
2000-10-08 21:20:44 +00:00
|
|
|
default:
|
|
|
|
printf("Unknown\n");
|
|
|
|
}
|
|
|
|
return -1; /* !=0, we want them all ! */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int main (int argc, char *argv[])
|
2011-08-22 01:51:06 +00:00
|
|
|
{
|
2000-10-08 21:20:44 +00:00
|
|
|
int status;
|
|
|
|
|
2001-06-04 21:17:53 +00:00
|
|
|
rig_load_all_backends();
|
2000-10-08 21:20:44 +00:00
|
|
|
|
2008-11-09 14:26:04 +00:00
|
|
|
printf("Rig#\tMfg \tModel \tVers.\tStatus \tType\n");
|
2000-10-08 21:20:44 +00:00
|
|
|
status = rig_list_foreach(print_caps_sum,NULL);
|
|
|
|
if (status != RIG_OK ) {
|
|
|
|
printf("rig_list_foreach: error = %s \n", rigerror(status));
|
|
|
|
exit(3);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|