git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@408 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.1
Stéphane Fillod, F8CFE 2001-02-28 20:24:44 +00:00
rodzic 59ce5b695a
commit 16418f4409
7 zmienionych plików z 0 dodań i 693 usunięć

Wyświetl plik

@ -1,65 +0,0 @@
# hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
#
# testlibft747 - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
# This program uses libft747.so to test an API for communicating
# via serial interface to an FT-747GX using the "CAT" interface
# box (FIF-232C) or similar
#
#
# Make file for libft747.so shared lib test suite.
#
#
# $Id: Makefile,v 1.3 2000-09-03 23:38:23 javabear Exp $
#
#
#
#
#TEST_LIBDIR = ../lib
#TEST_INCLUDEDIR = ../include
LIB_NAME = libft747.so
LIB_HEADER = ft747.h
# access to common stuff
COMMON_DIR = ../../common/
CC = gcc
INCLUDE = -I/usr/include -I/usr/local/include -I. -I../include -I$(COMMON_DIR)
OBJ = testlibft747.o $(COMMON_DIR)serial.o
LDFLAG = -lm -lft747 -L../lib
CFLAGS = -g -Wall -ansi -pedantic -O2 -D__USE_FIXED_PROTOTYPES__
MAKEALL = testlibft747
all: $(MAKEALL)
testlibft747: $(OBJ)
$(CC) $(CFLAGS) $(INCLUDE) $(LDFLAG) -o testlibft747 $(OBJ)
testlibft747.o: testlibft747.c testlibft747.h
$(CC) $(CFLAGS) $(INCLUDE) -c testlibft747.c
# what common stuff I need.
serial.o:
(cd $(COMMON_DIR) && $(MAKE))
# clean up
clean:
make cleanlocal
# clean up local directory
.PHONY: cleanlocal
cleanlocal:
rm -f *.o testlibft747
# run test program in local directory
.PHONY: runtest
runtest:
(LD_LIBRARY_PATH="../lib" ./testlibft747 )

Wyświetl plik

@ -1,244 +0,0 @@
/* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
*
* testlibft747.c - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
* This program tests the libft747.so API for communicating
* via serial interface to an FT-747GX using the "CAT" interface
* box (FIF-232C) or similar.
*
*
* $Id: testlibft747.c,v 1.10 2000-09-04 19:58:55 javabear Exp $
*
*
* 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.
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <stdlib.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <sys/ioctl.h>
#include "testlibft747.h"
#include "ft747.h"
#include "rig.h"
static unsigned char datain[350]; /* data read from rig */
struct ft747_update_data {
unsigned char displayed_status;
unsigned char displayed_freq[5];
unsigned char current_band_data;
unsigned char vfo_a_status;
unsigned char vfo_a_freq_block[5];
};
/*
* Decode routines for status update map
*/
static void decode_status_flags(unsigned char flags) {
if((flags & SF_DLOCK) != 0 ) {
printf("Dial Lock = SET \n");
} else {
printf("Dial Lock = CLEAR \n");
}
if((flags & SF_SPLIT) != 0 ) {
printf("Split = SET \n");
} else {
printf("Split = CLEAR \n");
}
if((flags & SF_CLAR) != 0 ) {
printf("Clar = SET \n");
} else {
printf("Clar = CLEAR \n");
}
if((flags & SF_VFOAB) != 0 ) {
printf("VFO = B \n");
} else {
printf("VFO = A \n");
}
if((flags & SF_VFOMR) != 0 ) {
printf("VFO/MR = MR \n");
} else {
printf("VFO/MR = VFO \n");
}
if((flags & SF_RXTX) != 0 ) {
printf("RX/TX = TX \n");
} else {
printf("RX/TX = RX \n");
}
if((flags & SF_PRI) != 0 ) {
printf("Priority Monitoring = ON \n");
} else {
printf("Priority Monitoring = OFF \n");
}
}
/*
* Decode routines for status update map
*/
static void decode_mode_bit_map(unsigned char mbm) {
unsigned char mask = 0x1f;
unsigned char mode = mbm & mask; /* grab operating mode */
printf("mbm = %x, mode = %x \n",mbm, mode);
switch(mode) {
case MODE_FM:
printf("Current Mode = FM \n");
break;
case MODE_AM:
printf("Current Mode = AM \n");
break;
case MODE_CW:
printf("Current Mode = CW \n");
printf("MODE_CW = %i \n", MODE_CW);
break;
case MODE_USB:
printf("Current Mode = USB \n");
break;
case MODE_LSB:
printf("Current Mode = LSB \n");
break;
default:
printf("Current mode = XXXXX \n");
break;
}
if((mbm & MODE_NAR) != 0 ) {
printf("Narrow = SET \n");
} else {
printf("Narrow = CLEAR \n");
}
}
/*
* Decode routines for status update map
*/
static void decode_band_data(unsigned char data) {
unsigned char mask = 0x0f;
unsigned char bd = data & mask; /* grab band data */
printf("Band data is %f - %f \n", band_data[bd], band_data[bd+1]);
}
/*
* Simple test to see if we are talking to the RIG.
*/
static int test(fd) {
struct ft747_update_data *header;
cmd_set_split_yes(fd);
sleep(1);
cmd_set_split_no(fd);
sleep(1);
cmd_set_dlock_on(fd);
sleep(1);
cmd_set_dlock_off(fd);
sleep(1);
cmd_set_select_vfo_a(fd);
sleep(1);
cmd_set_up500k(fd);
sleep(1);
cmd_set_down500k(fd);
sleep(1);
/* cmd_memory_to_vfo(fd,1); */
sleep(1);
/* cmd_vfo_to_memory(fd,2); */
sleep(1);
cmd_set_mode(fd,3); /* cw */
cmd_set_ptt_on(fd); /* stand back .. */
sleep(1);
cmd_set_ptt_off(fd); /* phew.. */
sleep(1);
cmd_set_pacing(fd,0); /* set pacing */
cmd_get_update_store(fd,datain); /* read (sleep) and store in datain */
header = (struct ft747_update_data *) &datain; /* overlay header onto datain */
printf("Frequency = %x.%.2x%.2x%.2x \n", header->displayed_freq[1],
header->displayed_freq[2],
header->displayed_freq[3],
header->displayed_freq[4]
);
decode_status_flags(datain[0]); /* decode flags */
printf("Displayed Memory = %i \n", datain[23]);
decode_mode_bit_map(datain[24]); /* decode mode bit map */
decode_band_data(datain[6]); /* decode current band data */
return 0;
}
/*
* Main program starts here..
*/
int main(void) {
struct rig_caps *rc; /* points to rig caps */
int fd;
rc = rig_get_caps(); /* find capabilities */
printf("rig_name = %s \n", rc->rig_name);
strcpy(rc->serial_port_name,SERIAL_PORT); /* put wanted serial port in caps */
/* fd = rig_open(SERIAL_PORT); */
/* printf("port opened ok \n"); */
fd = rig_open(rc);
printf("port %s opened ok \n", rc->serial_port_name);
test(fd);
printf("testing communication result ok \n");
rig_close(fd);
printf("port closed ok \n");
return 0;
}

Wyświetl plik

@ -1,30 +0,0 @@
/*
* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
*
* testlibft747.h - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
* This program tests the libft747.so API for communicating
* via serial interface to an FT-747GX using the "CAT" interface
* box (FIF-232C) or similar.
*
*
* $Id: testlibft747.h,v 1.3 2000-08-19 04:07:00 javabear Exp $
*
* 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.
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#define SERIAL_PORT "/dev/ttyS0"

Wyświetl plik

@ -1,91 +0,0 @@
# hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
#
# testlibft847 - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
# This program uses libft847.so to test an API for communicating
# via serial interface to an FT-847 using the "CAT" interface.
#
#
# Make file for libft847.so shared lib test suite.
#
#
# $Id: Makefile,v 1.2 2000-09-03 23:36:46 javabear Exp $
#
#
#
#
#TEST_LIBDIR = ../lib
#TEST_INCLUDEDIR = ../include
LIB_NAME = libft847.so
LIB_HEADER = ft847.h
# access to common stuff
COMMON_DIR = ../../common/
#LIB_SONAME = libft847.so.1
#LIB_RELEASE = libft847.so.1.0.1
CC = gcc
INCLUDE = -I/usr/include -I/usr/local/include -I. -I../include -I$(COMMON_DIR)
OBJ = testlibft847.o $(COMMON_DIR)serial.o
LDFLAG = -lm -lft847 -L../lib
CFLAGS = -g -Wall -ansi -pedantic -O2 -D__USE_FIXED_PROTOTYPES__
MAKEALL = testlibft847
all: $(MAKEALL)
testlibft847: $(OBJ)
$(CC) $(CFLAGS) $(INCLUDE) $(LDFLAG) -o testlibft847 $(OBJ)
testlibft847.o: testlibft847.c testlibft847.h
$(CC) $(CFLAGS) $(INCLUDE) -c testlibft847.c
# what common stuff I need.
serial.o:
(cd $(COMMON_DIR) && $(MAKE))
# clean up
clean:
make cleanlocal
# clean up local directory
.PHONY: cleanlocal
cleanlocal:
rm -f *.o testlibft847
# run test program in local directory
.PHONY: runtest
runtest:
(LD_LIBRARY_PATH="../lib" ./testlibft847 )

Wyświetl plik

@ -1,233 +0,0 @@
/* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
*
* testlibft847.c - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
* This program tests the libft847.so API for communicating
* via serial interface to an FT-847 using the "CAT" interface.
*
*
* $Id: testlibft847.c,v 1.16 2000-09-04 19:58:56 javabear Exp $
*
*
* 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.
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <stdlib.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <sys/ioctl.h>
#include "rig.h"
#include "testlibft847.h"
#include "ft847.h"
static unsigned char datain[5]; /* data read from rig */
/*
* Decode routine for TX status update map
*/
static void decode_tx_status_flags(unsigned char txflag) {
printf("TX Status = %i \n", txflag);
printf("TXSF_PTT_STATUS = %i \n",TXSF_PTT_STATUS);
if((txflag & TXSF_PTT_STATUS) != 0 ) {
printf("PTT = OFF (RX) \n");
} else {
printf("PTT = ON (TX) \n");
}
printf("PO/ALC Meter Data = %i \n", txflag & TXSF_POALC_METER_MASK);
}
/*
* Decode routine for RX status update map
*/
static void decode_rx_status_flags(unsigned char rxflag) {
if((rxflag & RXSF_DISC_CENTER) != 0 ) {
printf("Discriminator = Off Center \n");
} else {
printf("Discriminator = Centered \n");
}
if((rxflag & RXSF_SQUELCH_STATUS) != 0 ) {
printf("Squelch = Squelch On (no signal) \n");
} else {
printf("Squelch = Squelch Off (signal present) \n");
}
if((rxflag & RXSF_CTCSS_DCS_CODE) != 0 ) {
printf("CTCSS/DCS Code = Un-Matched \n");
} else {
printf("CTCSS/DCS Code = Matched \n");
}
printf("S-Meter Meter Data = %i \n", rxflag & RXSF_SMETER_MASK);
}
/*
* Decode routine for Mode Status
*/
static void decode_mode(unsigned char mode) {
switch(mode) {
case 0:
printf("Current Mode = LSB \n");
break;
case 1:
printf("Current Mode = USB \n");
break;
case 2:
printf("Current Mode = CW \n");
break;
case 3:
printf("Current Mode = CWR \n");
break;
case 4:
printf("Current Mode = AM \n");
break;
case 8:
printf("Current Mode = FM \n");
break;
case 82:
printf("Current Mode = CW(N) \n");
break;
case 83:
printf("Current Mode = CW(N)-R \n");
break;
case 84:
printf("Current Mode = AM(N) \n");
break;
case 88:
printf("Current Mode = FM(N) \n");
break;
default:
printf("Current mode = XXXXX \n");
break;
}
}
/*
* Simple test to see if we are talking to the RIG.
*/
static int test(fd) {
unsigned char data1;
unsigned char mode;
int i;
long int frq; /* freq */
cmd_set_cat_off(fd); /* cat off */
sleep(1);
cmd_set_cat_on(fd); /* cat on */
sleep(1);
cmd_set_sat_on(fd); /* sat mode on */
sleep(5);
cmd_set_sat_off(fd); /* sat mode off */
sleep(3);
cmd_set_opmode_main_vfo(fd,MODE_AM);
sleep(1);
data1 = cmd_get_rx_status(fd);
printf("data1 = %i \n", data1);
decode_rx_status_flags(data1);
/* decode_rx_status_flags(data1); */
sleep(1);
for (i=0; i<4; i++) {
data1 = cmd_get_rx_status(fd);
decode_rx_status_flags(data1);
sleep(1);
frq = cmd_get_freq_mode_status_main_vfo(fd, &mode);
printf("freq = %ld Hz and mode = %x \n",frq, mode );
sleep(1);
}
cmd_set_freq_main_vfo_hz(fd,439700000,MODE_FM);
sleep(5);
cmd_set_freq_main_vfo_hz(fd,123456780,MODE_CW);
sleep(5);
cmd_set_freq_main_vfo_hz(fd,770000,MODE_AM);
sleep(5);
cmd_set_freq_sat_rx_vfo_hz(fd,137125000,MODE_FM);
sleep(5);
cmd_set_freq_sat_rx_vfo_hz(fd,137125000,MODE_FM);
sleep(5);
cmd_set_freq_sat_tx_vfo_hz(fd,437875000,MODE_FMN);
sleep(5);
cmd_set_cat_off(fd); /* cat off */
return 0;
}
/*
* Main program starts here..
*/
int main(void) {
struct rig_caps *rc; /* points to rig caps */
int fd;
rc = rig_get_caps(); /* find capabilities */
printf("rig_name = %s \n", rc->rig_name);
printf("Initial serial_port_name = %s \n", rc->serial_port_name);
strcpy(rc->serial_port_name,SERIAL_PORT); /* put wanted serial port in caps */
/* fd = rig_open(SERIAL_PORT); */
/* printf("port %s opened ok \n",SERIAL_PORT); */
fd = rig_open(rc);
printf("port %s opened ok \n", rc->serial_port_name);
test(fd);
printf("testing communication result ok \n");
rig_close(fd);
printf("port %s closed ok \n", rc->serial_port_name);
return 0;
}

Wyświetl plik

@ -1,30 +0,0 @@
/*
* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
*
* testlibft847.h - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
* This program tests the libft847.so API for communicating
* via serial interface to an FT-847 using the "CAT" interface.
*
*
* $Id: testlibft847.h,v 1.2 2000-08-19 04:07:00 javabear Exp $
*
*
* 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.
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#define SERIAL_PORT "/dev/ttyS1"