Skip to content

Commit

Permalink
Add sendraw.c to test directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mdblack98 committed Nov 22, 2022
1 parent 6679eaf commit 93d3a9e
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/sendraw.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* should work with simts2000 emulator */
#include <stdio.h>
#include <stdlib.h>
#include <hamlib/rig.h>

int
main()
{
RIG *my_rig;
unsigned char sendCmd[] = "FA;";
int sendCmdLen = 3;
unsigned char term[] = ";";
unsigned char rcvdCmd[100];
int rcvdCmdLen = sizeof(rcvdCmd);
int retcode;

my_rig = rig_init(2048);
strcpy(my_rig->state.rigport.pathname, "/dev/pts/4");

retcode = rig_open(my_rig);

if (retcode != RIG_OK)
{
printf("rig_open: error = %s\n", rigerror(retcode));
exit(2);
}
freq_t f;
rig_get_freq(my_rig, RIG_VFO_A, &f);

int nbytes = rig_send_raw(my_rig, sendCmd, sendCmdLen, rcvdCmd, rcvdCmdLen, term);
if (nbytes >= 0) printf("Response(%d bytes): %s\n", nbytes, rcvdCmd);
else printf("Error occurred = %s\n", rigerror(retcode));
return retcode;
}

0 comments on commit 93d3a9e

Please sign in to comment.