kopia lustrzana https://github.com/Hamlib/Hamlib
added dynamic loading support, and rig_get_strength call
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@200 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.1.0
rodzic
f0330a7bf5
commit
942de4b6f4
|
@ -2,7 +2,7 @@
|
|||
* Hamlib sample program
|
||||
*/
|
||||
|
||||
#include <rig.h>
|
||||
#include <hamlib/rig.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -14,6 +14,7 @@ int main ()
|
|||
freq_t freq; /* frequency */
|
||||
rmode_t rmode; /* radio mode of operation */
|
||||
vfo_t vfo; /* vfo selection */
|
||||
int strength; /* S-Meter level */
|
||||
int retcode; /* generic return code from functions */
|
||||
|
||||
|
||||
|
@ -23,6 +24,12 @@ int main ()
|
|||
* allocate memory, setup & open port
|
||||
*/
|
||||
|
||||
retcode = rig_load_backend("icom");
|
||||
if (retcode != RIG_OK ) {
|
||||
printf("rig_load_backend: error = %s \n", rigerror(retcode));
|
||||
exit(3);
|
||||
}
|
||||
|
||||
my_rig = rig_init(RIG_MODEL_IC706MKIIG);
|
||||
if (!my_rig)
|
||||
exit(1); /* whoops! something went wrong (mem alloc?) */
|
||||
|
@ -93,6 +100,15 @@ int main ()
|
|||
printf("rig_get_mode: error = %s \n", rigerror(retcode));
|
||||
}
|
||||
|
||||
retcode = rig_get_strength(my_rig, &strength);
|
||||
|
||||
if (retcode == RIG_OK ) {
|
||||
printf("rig_get_strength: strength = %i \n", strength);
|
||||
} else {
|
||||
printf("rig_get_strength: error = %s \n", rigerror(retcode));
|
||||
}
|
||||
|
||||
|
||||
rig_close(my_rig); /* close port */
|
||||
rig_cleanup(my_rig); /* if you care about memory */
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue