diff --git a/tests/rigmatrix.c b/tests/rigmatrix.c index e2683e665..467510f6b 100644 --- a/tests/rigmatrix.c +++ b/tests/rigmatrix.c @@ -1,9 +1,10 @@ /* * rigmatric.c - Copyright (C) 2000 Stephane Fillod * This program generates the supported rig matrix in HTML format. + * The code is rather ugly since this is only a try out. * * - * $Id: rigmatrix.c,v 1.2 2001-01-05 18:22:40 f4cfe Exp $ + * $Id: rigmatrix.c,v 1.3 2001-01-28 22:24:27 f4cfe Exp $ * * * This program is free software; you can redistribute it and/or @@ -22,7 +23,6 @@ * */ - #include #include #include @@ -32,7 +32,6 @@ #include #include - #include @@ -93,12 +92,21 @@ int print_caps_sum(const struct rig_caps *caps, void *data) } printf("range" "parms" - "caps\n", - caps->rig_model, caps->rig_model, caps->rig_model); + "caps" + "func" + "levels" + "set levels" + "\n", + caps->rig_model, caps->rig_model, caps->rig_model, + caps->rig_model, caps->rig_model, caps->rig_model + ); return 1; /* !=0, we want them all ! */ } +/* + * IO params et al. + */ int print_caps_parms(const struct rig_caps *caps, void *data) { printf("%s", @@ -112,7 +120,8 @@ int print_caps_parms(const struct rig_caps *caps, void *data) case RIG_PTT_PARALLEL: printf("parallel"); break; - case RIG_PTT_SERIAL: + case RIG_PTT_SERIAL_RTS: + case RIG_PTT_SERIAL_DTR: printf("serial"); break; case RIG_PTT_NONE: @@ -138,14 +147,18 @@ int print_caps_parms(const struct rig_caps *caps, void *data) return 1; } +/* used by print_caps_caps and print_caps_level */ +#define print_yn(fn) printf("%c", (fn) ? 'Y':'N') + +/* + * backend functions definied + */ int print_caps_caps(const struct rig_caps *caps, void *data) { printf("%s", caps->rig_model, caps->model_name); -#define print_yn(fn) printf("%c", (fn) ? 'Y':'N') - /* targetable_vfo is not a function, but a boolean */ print_yn(caps->targetable_vfo); @@ -182,6 +195,98 @@ int print_caps_caps(const struct rig_caps *caps, void *data) return 1; } +/* + * Get/Set level abilities + */ +int print_caps_level(const struct rig_caps *caps, void *data) +{ + setting_t level; + + if (!data) + return 0; + + level = (*(int*)data)? caps->has_set_level : caps->has_level; + + printf("%s", + (*(int*)data)? "set":"get", + caps->rig_model, + caps->model_name); + + print_yn(level & RIG_LEVEL_PREAMP); + print_yn(level & RIG_LEVEL_ATT); + print_yn(level & RIG_LEVEL_ANT); + print_yn(level & RIG_LEVEL_AF); + print_yn(level & RIG_LEVEL_RF); + print_yn(level & RIG_LEVEL_SQL); + print_yn(level & RIG_LEVEL_IF); + print_yn(level & RIG_LEVEL_APF); + print_yn(level & RIG_LEVEL_NR); + print_yn(level & RIG_LEVEL_PBT_IN); + print_yn(level & RIG_LEVEL_PBT_OUT); + print_yn(level & RIG_LEVEL_CWPITCH); + print_yn(level & RIG_LEVEL_RFPOWER); + print_yn(level & RIG_LEVEL_MICGAIN); + print_yn(level & RIG_LEVEL_KEYSPD); + print_yn(level & RIG_LEVEL_NOTCHF); + print_yn(level & RIG_LEVEL_COMP); + print_yn(level & RIG_LEVEL_AGC); + print_yn(level & RIG_LEVEL_BKINDL); + print_yn(level & RIG_LEVEL_BALANCE); + print_yn(level & RIG_LEVEL_ANN); + + /* get only levels */ + print_yn(level & RIG_LEVEL_SWR); + print_yn(level & RIG_LEVEL_ALC); + print_yn(level & RIG_LEVEL_SQLSTAT); + print_yn(level & RIG_LEVEL_STRENGTH); + + printf("\n"); + + return 1; +} + +/* + * Get/Set func abilities + */ +int print_caps_func(const struct rig_caps *caps, void *data) +{ + setting_t func; + + if (!data) + return 0; + + func = caps->has_func; + + printf("%s", + (*(int*)data)? "set":"get", + caps->rig_model, + caps->model_name); + + print_yn(func & RIG_FUNC_FAGC); + print_yn(func & RIG_FUNC_NB); + print_yn(func & RIG_FUNC_COMP); + print_yn(func & RIG_FUNC_VOX); + print_yn(func & RIG_FUNC_TONE); + print_yn(func & RIG_FUNC_TSQL); + print_yn(func & RIG_FUNC_SBKIN); + print_yn(func & RIG_FUNC_FBKIN); + print_yn(func & RIG_FUNC_ANF); + print_yn(func & RIG_FUNC_NR); + print_yn(func & RIG_FUNC_AIP); + print_yn(func & RIG_FUNC_APF); + print_yn(func & RIG_FUNC_MON); + print_yn(func & RIG_FUNC_MN); + print_yn(func & RIG_FUNC_RFN); + + printf("\n"); + + return 1; +} + + +/* + * inlined PNG graphics + */ int print_caps_range(const struct rig_caps *caps, void *data) { create_png_range(caps->rx_range_list, caps->tx_range_list, caps->rig_model); @@ -342,6 +447,7 @@ int main (int argc, char *argv[]) { int status; time_t gentime; + int set_or_get; status = rig_load_backend("icom"); if (status != RIG_OK ) { @@ -358,6 +464,11 @@ int main (int argc, char *argv[]) printf("rig_load_backend: ft847 error = %s \n", rigerror(status)); exit(3); } + status = rig_load_backend("kenwood"); + if (status != RIG_OK ) { + printf("rig_load_backend: kenwood error = %s \n", rigerror(status)); + exit(3); + } status = rig_load_backend("aor"); if (status != RIG_OK ) { printf("rig_load_backend: aor error = %s \n", rigerror(status)); @@ -367,7 +478,11 @@ int main (int argc, char *argv[]) printf(""); printf("" "" - "\n"); + "" + "" + "" + "" + "\n"); status = rig_list_foreach(print_caps_sum,NULL); printf("
ModelMfgVers.StatusTypeFreq. rangeParametersCapabilities
CapabilitiesHas funcGet levelSet level
\n"); @@ -409,6 +524,69 @@ int main (int argc, char *argv[]) status = rig_list_foreach(print_caps_caps,NULL); printf("\n"); + printf("

"); + + printf("Has func"); + printf("\n"); + printf("" + "" + "" + "" + "" + "" + "" + "" + "" + "\n"); + set_or_get = 0; + status = rig_list_foreach(print_caps_func,&set_or_get); + printf("
ModelFAGCNBCOMPVOXTONETSQLSBKINFBKINANFNRAIPAPFMONMNRFN
\n"); + + printf("

"); + + printf("Set level"); + printf("\n"); + printf("" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "\n"); + set_or_get = 1; + status = rig_list_foreach(print_caps_level,&set_or_get); + printf("
ModelPreampAttAntAFRFSQLIFAPFNRPBT INPBT OUTCW pitchRF PowerMic gainKey speedNotchCompAGCBKin delayBalanceAnnSWRALCSQLstatSMeter
\n"); + + printf("

"); + + printf("Get level"); + printf("\n"); + printf("" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "\n"); + set_or_get = 0; + status = rig_list_foreach(print_caps_level,&set_or_get); + printf("
ModelPreampAttAntAFRFSQLIFAPFNRPBT INPBT OUTCW pitchRF PowerMic gainKey speedNotchCompAGCBKin delayBalanceAnnSWRALCSQLstatSMeter
\n"); printf("

");