From 748d949556016dfe578c3fae6bfd34ef75028b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Fillod=2C=20F8CFE?= Date: Tue, 5 Dec 2000 22:04:44 +0000 Subject: [PATCH] * updates since the new API now requires a target VFO to be specified. Mainly, RIG_VFO_CURR is used, which should ensure the same behaviour of the tests programs as before. git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@286 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- tests/rigctl.c | 54 ++++++++++++++++++++++++------------------------- tests/testrig.c | 38 +++++++++++++--------------------- tests/testtrn.c | 6 +++--- 3 files changed, 44 insertions(+), 54 deletions(-) diff --git a/tests/rigctl.c b/tests/rigctl.c index 4db316772..ec323a7a1 100644 --- a/tests/rigctl.c +++ b/tests/rigctl.c @@ -7,7 +7,7 @@ * TODO: be more generic and add command line option to run * in non-interactive mode * - * $Id: rigctl.c,v 1.3 2000-12-04 23:39:18 f4cfe Exp $ + * $Id: rigctl.c,v 1.4 2000-12-05 22:04:44 f4cfe Exp $ * * * This program is free software; you can redistribute it and/or @@ -205,7 +205,7 @@ static int set_freq(RIG *rig) printf("Frequency: "); scanf("%Ld", &freq); - return rig_set_freq(rig, freq); + return rig_set_freq(rig, RIG_VFO_CURR, freq); } static int get_freq(RIG *rig) @@ -213,7 +213,7 @@ static int get_freq(RIG *rig) int status; freq_t freq; - status = rig_get_freq(rig, &freq); + status = rig_get_freq(rig, RIG_VFO_CURR, &freq); printf("Frequency: %Ld\n", freq); return status; } @@ -227,7 +227,7 @@ static int set_mode(RIG *rig) scanf("%d", &mode); printf("Passband: "); scanf("%d", (int*)&width); - return rig_set_mode(rig, mode, width); + return rig_set_mode(rig, RIG_VFO_CURR, mode, width); } @@ -237,7 +237,7 @@ static int get_mode(RIG *rig) rmode_t mode; pbwidth_t width; - status = rig_get_mode(rig, &mode, &width); + status = rig_get_mode(rig, RIG_VFO_CURR, &mode, &width); printf("Mode: %d\nPassband: %d\n", mode, width); return status; } @@ -270,7 +270,7 @@ static int set_ptt(RIG *rig) printf("PTT: "); scanf("%d", (int*)&ptt); - return rig_set_ptt(rig, ptt); + return rig_set_ptt(rig, RIG_VFO_CURR, ptt); } @@ -279,7 +279,7 @@ static int get_ptt(RIG *rig) int status; ptt_t ptt; - status = rig_get_ptt(rig, &ptt); + status = rig_get_ptt(rig, RIG_VFO_CURR, &ptt); printf("PTT: %d\n", ptt); return status; } @@ -291,7 +291,7 @@ static int set_rptr_shift(RIG *rig) printf("Repeater shift: "); scanf("%d", (int*)&rptr_shift); - return rig_set_rptr_shift(rig, rptr_shift); + return rig_set_rptr_shift(rig, RIG_VFO_CURR, rptr_shift); } @@ -300,7 +300,7 @@ static int get_rptr_shift(RIG *rig) int status; rptr_shift_t rptr_shift; - status = rig_get_rptr_shift(rig, &rptr_shift); + status = rig_get_rptr_shift(rig, RIG_VFO_CURR, &rptr_shift); printf("Repeater shift: %d\n", rptr_shift); return status; } @@ -312,7 +312,7 @@ static int set_rptr_offs(RIG *rig) printf("Repeater shift offset: "); scanf("%ld", &rptr_offs); - return rig_set_rptr_offs(rig, rptr_offs); + return rig_set_rptr_offs(rig, RIG_VFO_CURR, rptr_offs); } @@ -321,7 +321,7 @@ static int get_rptr_offs(RIG *rig) int status; unsigned long rptr_offs; - status = rig_get_rptr_offs(rig, &rptr_offs); + status = rig_get_rptr_offs(rig, RIG_VFO_CURR, &rptr_offs); printf("Repeater shift offset: %ld\n", rptr_offs); return status; } @@ -333,7 +333,7 @@ static int set_ctcss(RIG *rig) printf("CTCSS tone: "); scanf("%d", &tone); - return rig_set_ctcss(rig, tone); + return rig_set_ctcss(rig, RIG_VFO_CURR, tone); } @@ -342,7 +342,7 @@ static int get_ctcss(RIG *rig) int status; unsigned int tone; - status = rig_get_ctcss(rig, &tone); + status = rig_get_ctcss(rig, RIG_VFO_CURR, &tone); printf("CTCSS tone: %d\n", tone); return status; } @@ -354,7 +354,7 @@ static int set_dcs(RIG *rig) printf("DCS code: "); scanf("%d", &code); - return rig_set_dcs(rig, code); + return rig_set_dcs(rig, RIG_VFO_CURR, code); } @@ -363,7 +363,7 @@ static int get_dcs(RIG *rig) int status; unsigned int code; - status = rig_get_dcs(rig, &code); + status = rig_get_dcs(rig, RIG_VFO_CURR, &code); printf("DCS code: %d\n", code); return status; } @@ -377,7 +377,7 @@ static int set_split_freq(RIG *rig) scanf("%Ld", &rxfreq); printf("Transmit frequency: "); scanf("%Ld", &txfreq); - return rig_set_split_freq(rig, rxfreq, txfreq); + return rig_set_split_freq(rig, RIG_VFO_CURR, rxfreq, txfreq); } @@ -386,7 +386,7 @@ static int get_split_freq(RIG *rig) int status; freq_t rxfreq,txfreq; - status = rig_get_split_freq(rig, &rxfreq, &txfreq); + status = rig_get_split_freq(rig, RIG_VFO_CURR, &rxfreq, &txfreq); printf("Receive frequency: %Ld\n", rxfreq); printf("Transmit frequency: %Ld\n", txfreq); return status; @@ -399,7 +399,7 @@ static int set_split(RIG *rig) printf("Split mode: "); scanf("%d", (int*)&split); - return rig_set_split(rig, split); + return rig_set_split(rig, RIG_VFO_CURR, split); } @@ -408,7 +408,7 @@ static int get_split(RIG *rig) int status; split_t split; - status = rig_get_split(rig, &split); + status = rig_get_split(rig, RIG_VFO_CURR, &split); printf("Split mode: %d\n", split); return status; } @@ -420,7 +420,7 @@ static int set_ts(RIG *rig) printf("Tuning step: "); scanf("%ld", &ts); - return rig_set_ts(rig, ts); + return rig_set_ts(rig, RIG_VFO_CURR, ts); } @@ -429,7 +429,7 @@ static int get_ts(RIG *rig) int status; unsigned long ts; - status = rig_get_ts(rig, &ts); + status = rig_get_ts(rig, RIG_VFO_CURR, &ts); printf("Tuning step: %ld\n", ts); return status; } @@ -484,7 +484,7 @@ static int set_bank(RIG *rig) printf("Bank: "); scanf("%d", &bank); - return rig_set_bank(rig, bank); + return rig_set_bank(rig, RIG_VFO_CURR, bank); } @@ -494,7 +494,7 @@ static int set_mem(RIG *rig) printf("Memory#: "); scanf("%d", &ch); - return rig_set_mem(rig, ch); + return rig_set_mem(rig, RIG_VFO_CURR, ch); } @@ -503,7 +503,7 @@ static int get_mem(RIG *rig) int status; int ch; - status = rig_get_mem(rig, &ch); + status = rig_get_mem(rig, RIG_VFO_CURR, &ch); printf("Memory#: %d\n", ch); return status; } @@ -515,7 +515,7 @@ static int mv_ctl(RIG *rig) printf("Mem/VFO op: "); scanf("%d", (int*)&op); - return rig_mv_ctl(rig, op); + return rig_mv_ctl(rig, RIG_VFO_CURR, op); } @@ -537,7 +537,7 @@ static int set_trn(RIG *rig) printf("Transceive: "); scanf("%d", &trn); - return rig_set_trn(rig, trn); + return rig_set_trn(rig, RIG_VFO_CURR, trn); } @@ -546,7 +546,7 @@ static int get_trn(RIG *rig) int status; int trn; - status = rig_get_trn(rig, &trn); + status = rig_get_trn(rig, RIG_VFO_CURR, &trn); printf("Transceive: %d\n", trn); return status; } diff --git a/tests/testrig.c b/tests/testrig.c index 8d00bb16a..6ac913cfd 100644 --- a/tests/testrig.c +++ b/tests/testrig.c @@ -5,6 +5,7 @@ #include #include #include +#include #define SERIAL_PORT "/dev/ttyS0" @@ -71,24 +72,24 @@ int main () * Lets try some frequencies */ - retcode = rig_set_freq(my_rig, 28350125); /* 10m */ + retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 28350125); /* 10m */ sleep(2); - retcode = rig_set_freq(my_rig, 21235175); /* 15m */ + retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 21235175); /* 15m */ sleep(2); - retcode = rig_set_freq(my_rig, 770000); /* KAAM */ + retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 770000); /* KAAM */ sleep(2); - retcode = rig_set_freq(my_rig, 7250100); /* 40m */ + retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 7250100); /* 40m */ sleep(2); - retcode = rig_set_freq(my_rig, 3980000); /* 80m */ + retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 3980000); /* 80m */ sleep(2); - retcode = rig_set_freq(my_rig, 1875000); /* 160m */ + retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 1875000); /* 160m */ sleep(2); - retcode = rig_set_freq(my_rig, 14250375); /* cq de vk3fcs */ + retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 14250375); /* cq de vk3fcs */ sleep(2); #if 0 - retcode = rig_set_freq(my_rig, 145100000); /* 2m */ + retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 145100000); /* 2m */ sleep(2); - retcode = rig_set_freq(my_rig, 435125000); /* 70cm */ + retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 435125000); /* 70cm */ sleep(2); #endif @@ -96,7 +97,7 @@ int main () printf("rig_set_freq: error = %s \n", rigerror(retcode)); } - retcode = rig_set_mode(my_rig, RIG_MODE_LSB, RIG_PASSBAND_NORMAL); + retcode = rig_set_mode(my_rig, RIG_VFO_CURR, RIG_MODE_LSB, RIG_PASSBAND_NORMAL); if (retcode != RIG_OK ) { printf("rig_set_mode: error = %s \n", rigerror(retcode)); @@ -115,7 +116,7 @@ int main () printf("rig_get_vfo: error = %s \n", rigerror(retcode)); } - retcode = rig_get_freq(my_rig, &freq); + retcode = rig_get_freq(my_rig, RIG_VFO_CURR, &freq); if (retcode == RIG_OK ) { printf("rig_get_freq: freq = %Li \n", freq); @@ -123,7 +124,7 @@ int main () printf("rig_get_freq: error = %s \n", rigerror(retcode)); } - retcode = rig_get_mode(my_rig, &rmode, &width); + retcode = rig_get_mode(my_rig, RIG_VFO_CURR, &rmode, &width); if (retcode == RIG_OK ) { printf("rig_get_mode: mode = %i \n", rmode); @@ -131,7 +132,7 @@ int main () printf("rig_get_mode: error = %s \n", rigerror(retcode)); } - retcode = rig_get_strength(my_rig, &strength); + retcode = rig_get_strength(my_rig, RIG_VFO_CURR, &strength); if (retcode == RIG_OK ) { printf("rig_get_strength: strength = %i \n", strength); @@ -148,14 +149,3 @@ int main () return 0; } - - - - - - - - - - - diff --git a/tests/testtrn.c b/tests/testtrn.c index c8ce6ab9c..6c0f0c53b 100644 --- a/tests/testtrn.c +++ b/tests/testtrn.c @@ -9,7 +9,7 @@ #define SERIAL_PORT "/dev/ttyS0" -int myfreq_event(RIG *rig, freq_t freq) +int myfreq_event(RIG *rig, vfo_t vfo, freq_t freq) { printf("Rig changed freq to %LiHz\n",freq); return 0; @@ -53,7 +53,7 @@ int main () */ - retcode = rig_set_freq(my_rig, 439700000); + retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 439700000); if (retcode != RIG_OK ) { printf("rig_set_freq: error = %s \n", rigerror(retcode)); @@ -61,7 +61,7 @@ int main () my_rig->callbacks.freq_event = myfreq_event; - retcode = rig_set_trn(my_rig, RIG_TRN_ON); + retcode = rig_set_trn(my_rig, RIG_VFO_CURR, RIG_TRN_ON); if (retcode != RIG_OK ) { printf("rig_set_trn: error = %s \n", rigerror(retcode));