Add support for RIG_PORT_UDP_NETWORK

Also some copyright year update,
and default serial device on MacOSX
Hamlib-1.2.15
Stephane Fillod 2012-01-06 09:28:24 +01:00
rodzic 070beccf37
commit da80137819
8 zmienionych plików z 39 dodań i 15 usunięć

Wyświetl plik

@ -1,7 +1,7 @@
/* /*
* Hamlib Interface - API header * Hamlib Interface - API header
* Copyright (c) 2000-2003 by Frank Singleton * Copyright (c) 2000-2003 by Frank Singleton
* Copyright (c) 2000-2011 by Stephane Fillod * Copyright (c) 2000-2012 by Stephane Fillod
* *
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -170,7 +170,8 @@ typedef enum rig_port_e {
RIG_PORT_ULTRA, /*!< IrDA Ultra protocol! */ RIG_PORT_ULTRA, /*!< IrDA Ultra protocol! */
RIG_PORT_RPC, /*!< RPC wrapper */ RIG_PORT_RPC, /*!< RPC wrapper */
RIG_PORT_PARALLEL, /*!< Parallel port */ RIG_PORT_PARALLEL, /*!< Parallel port */
RIG_PORT_USB /*!< USB port */ RIG_PORT_USB, /*!< USB port */
RIG_PORT_UDP_NETWORK /*!< UDP Network socket type */
} rig_port_t; } rig_port_t;
/** /**

Wyświetl plik

@ -1,6 +1,6 @@
/* /*
* Hamlib Interface - generic file based io functions * Hamlib Interface - generic file based io functions
* Copyright (c) 2000-2009 by Stephane Fillod * Copyright (c) 2000-2012 by Stephane Fillod
* Copyright (c) 2000-2003 by Frank Singleton * Copyright (c) 2000-2003 by Frank Singleton
* *
* *
@ -119,6 +119,7 @@ int HAMLIB_API port_open(hamlib_port_t *p)
break; /* ez :) */ break; /* ez :) */
case RIG_PORT_NETWORK: case RIG_PORT_NETWORK:
case RIG_PORT_UDP_NETWORK:
/* FIXME: hardcoded network port */ /* FIXME: hardcoded network port */
status = network_open(p, 4532); status = network_open(p, 4532);
if (status < 0) if (status < 0)
@ -156,6 +157,7 @@ int HAMLIB_API port_close(hamlib_port_t *p, rig_port_t port_type)
ret = usb_port_close(p); ret = usb_port_close(p);
break; break;
case RIG_PORT_NETWORK: case RIG_PORT_NETWORK:
case RIG_PORT_UDP_NETWORK:
ret = network_close(p); ret = network_close(p);
break; break;
@ -193,7 +195,7 @@ static ssize_t port_read(hamlib_port_t *p, void *buf, size_t count)
} }
} }
return ret; return ret;
} else if (p->type.rig == RIG_PORT_NETWORK) } else if (p->type.rig == RIG_PORT_NETWORK || p->type.rig == RIG_PORT_UDP_NETWORK)
return recv(p->fd, buf, count, 0); return recv(p->fd, buf, count, 0);
else else
return read(p->fd, buf, count); return read(p->fd, buf, count);
@ -203,7 +205,7 @@ static ssize_t port_write(hamlib_port_t *p, const void *buf, size_t count)
{ {
if (p->type.rig == RIG_PORT_SERIAL) if (p->type.rig == RIG_PORT_SERIAL)
return win32_serial_write(p->fd, buf, count); return win32_serial_write(p->fd, buf, count);
else if (p->type.rig == RIG_PORT_NETWORK) else if (p->type.rig == RIG_PORT_NETWORK || p->type.rig == RIG_PORT_UDP_NETWORK)
return send(p->fd, buf, count, 0); return send(p->fd, buf, count, 0);
else else
return write(p->fd, buf, count); return write(p->fd, buf, count);

Wyświetl plik

@ -1,6 +1,6 @@
/* /*
* Hamlib Interface - network communication low-level support * Hamlib Interface - network communication low-level support
* Copyright (c) 2000-2010 by Stephane Fillod * Copyright (c) 2000-2012 by Stephane Fillod
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -102,7 +102,10 @@ int network_open(hamlib_port_t *rp, int default_port)
memset(&hints, 0, sizeof(hints)); memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC; hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM; if (rp->type.rig == RIG_PORT_UDP_NETWORK)
hints.ai_socktype = SOCK_DGRAM;
else
hints.ai_socktype = SOCK_STREAM;
if (rp->pathname[0] == ':') { if (rp->pathname[0] == ':') {
portstr = rp->pathname+1; portstr = rp->pathname+1;

Wyświetl plik

@ -1,6 +1,6 @@
/* /*
* Hamlib Interface - main file * Hamlib Interface - main file
* Copyright (c) 2000-2011 by Stephane Fillod * Copyright (c) 2000-2012 by Stephane Fillod
* Copyright (c) 2000-2003 by Frank Singleton * Copyright (c) 2000-2003 by Frank Singleton
* *
* *
@ -30,7 +30,7 @@
* \brief Ham Radio Control Libraries interface * \brief Ham Radio Control Libraries interface
* \author Stephane Fillod * \author Stephane Fillod
* \author Frank Singleton * \author Frank Singleton
* \date 2000-2011 * \date 2000-2012
* *
* Hamlib provides a user-callable API, a set of "front-end" routines that * Hamlib provides a user-callable API, a set of "front-end" routines that
* call rig-specific "back-end" routines which actually communicate with * call rig-specific "back-end" routines which actually communicate with
@ -82,7 +82,7 @@ const char hamlib_version[21] = "Hamlib " PACKAGE_VERSION;
* \brief Hamlib copyright notice * \brief Hamlib copyright notice
*/ */
const char hamlib_copyright[231] = /* hamlib 1.2 ABI specifies 231 bytes */ const char hamlib_copyright[231] = /* hamlib 1.2 ABI specifies 231 bytes */
"Copyright (C) 2000-2011 Stephane Fillod\n" "Copyright (C) 2000-2012 Stephane Fillod\n"
"Copyright (C) 2000-2003 Frank Singleton\n" "Copyright (C) 2000-2003 Frank Singleton\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.";
@ -94,6 +94,8 @@ const char hamlib_copyright[231] = /* hamlib 1.2 ABI specifies 231 bytes */
#define DEFAULT_SERIAL_PORT "\\\\.\\COM1" #define DEFAULT_SERIAL_PORT "\\\\.\\COM1"
#elif BSD #elif BSD
#define DEFAULT_SERIAL_PORT "/dev/cuaa0" #define DEFAULT_SERIAL_PORT "/dev/cuaa0"
#elif MACOSX
#define DEFAULT_SERIAL_PORT "/dev/cu.usbserial"
#else #else
#define DEFAULT_SERIAL_PORT "/dev/ttyS0" #define DEFAULT_SERIAL_PORT "/dev/ttyS0"
#endif #endif
@ -303,6 +305,7 @@ RIG * HAMLIB_API rig_init(rig_model_t rig_model)
break; break;
case RIG_PORT_NETWORK: case RIG_PORT_NETWORK:
case RIG_PORT_UDP_NETWORK:
strncpy(rs->rigport.pathname, "127.0.0.1:4532", FILPATHLEN); strncpy(rs->rigport.pathname, "127.0.0.1:4532", FILPATHLEN);
break; break;

Wyświetl plik

@ -1,6 +1,6 @@
/* /*
* Hamlib Interface - main file * Hamlib Interface - main file
* Copyright (c) 2000-2011 by Stephane Fillod * Copyright (c) 2000-2012 by Stephane Fillod
* Copyright (c) 2000-2003 by Frank Singleton * Copyright (c) 2000-2003 by Frank Singleton
* *
* *
@ -29,7 +29,7 @@
* \file src/rotator.c * \file src/rotator.c
* \brief Rotator interface * \brief Rotator interface
* \author Stephane Fillod * \author Stephane Fillod
* \date 2000-2011 * \date 2000-2012
* *
* Hamlib interface is a frontend implementing rotator wrapper functions. * Hamlib interface is a frontend implementing rotator wrapper functions.
*/ */
@ -69,6 +69,8 @@
#define DEFAULT_SERIAL_PORT "\\\\.\\COM1" #define DEFAULT_SERIAL_PORT "\\\\.\\COM1"
#elif BSD #elif BSD
#define DEFAULT_SERIAL_PORT "/dev/cuaa0" #define DEFAULT_SERIAL_PORT "/dev/cuaa0"
#elif MACOSX
#define DEFAULT_SERIAL_PORT "/dev/cu.usbserial"
#else #else
#define DEFAULT_SERIAL_PORT "/dev/ttyS0" #define DEFAULT_SERIAL_PORT "/dev/ttyS0"
#endif #endif
@ -234,6 +236,7 @@ ROT * HAMLIB_API rot_init(rot_model_t rot_model)
break; break;
case RIG_PORT_NETWORK: case RIG_PORT_NETWORK:
case RIG_PORT_UDP_NETWORK:
strncpy(rs->rotport.pathname, "127.0.0.1:4533", FILPATHLEN); strncpy(rs->rotport.pathname, "127.0.0.1:4533", FILPATHLEN);
break; break;
@ -333,6 +336,8 @@ int HAMLIB_API rot_open(ROT *rot)
break; /* ez :) */ break; /* ez :) */
case RIG_PORT_NETWORK: case RIG_PORT_NETWORK:
case RIG_PORT_UDP_NETWORK:
/* FIXME: default port */
status = network_open(&rs->rotport, 4533); status = network_open(&rs->rotport, 4533);
if (status < 0) if (status < 0)
return status; return status;
@ -411,6 +416,7 @@ int HAMLIB_API rot_close(ROT *rot)
usb_port_close(&rs->rotport); usb_port_close(&rs->rotport);
break; break;
case RIG_PORT_NETWORK: case RIG_PORT_NETWORK:
case RIG_PORT_UDP_NETWORK:
network_close(&rs->rotport); network_close(&rs->rotport);
break; break;
default: default:

Wyświetl plik

@ -1,5 +1,5 @@
/* /*
* dumpcaps.c - Copyright (C) 2000-2011 Stephane Fillod * dumpcaps.c - Copyright (C) 2000-2012 Stephane Fillod
* This programs dumps the capabilities of a backend rig. * This programs dumps the capabilities of a backend rig.
* *
* *
@ -175,6 +175,9 @@ int dumpcaps (RIG* rig, FILE *fout)
case RIG_PORT_NETWORK: case RIG_PORT_NETWORK:
fprintf(fout, "Network link\n"); fprintf(fout, "Network link\n");
break; break;
case RIG_PORT_UDP_NETWORK:
fprintf(fout, "UDP Network link\n");
break;
case RIG_PORT_NONE: case RIG_PORT_NONE:
fprintf(fout, "None\n"); fprintf(fout, "None\n");
break; break;

Wyświetl plik

@ -1,5 +1,5 @@
/* /*
* dumpcaps_rot.c - Copyright (C) 2000-2010 Stephane Fillod * dumpcaps_rot.c - Copyright (C) 2000-2012 Stephane Fillod
* This programs dumps the capabilities of a backend rig. * This programs dumps the capabilities of a backend rig.
* *
* *
@ -99,6 +99,9 @@ int dumpcaps_rot (ROT* rot, FILE *fout)
case RIG_PORT_NETWORK: case RIG_PORT_NETWORK:
fprintf(fout, "Network link\n"); fprintf(fout, "Network link\n");
break; break;
case RIG_PORT_UDP_NETWORK:
fprintf(fout, "UDP Network link\n");
break;
case RIG_PORT_NONE: case RIG_PORT_NONE:
fprintf(fout, "None\n"); fprintf(fout, "None\n");
break; break;

Wyświetl plik

@ -1,5 +1,5 @@
/* /*
* rigmatrix.c - Copyright (C) 2000,2001,2002 Stephane Fillod * rigmatrix.c - Copyright (C) 2000-2012 Stephane Fillod
* This program generates the supported rig matrix in HTML format. * This program generates the supported rig matrix in HTML format.
* The code is rather ugly since this is only a try out. * The code is rather ugly since this is only a try out.
* *
@ -154,6 +154,9 @@ int print_caps_parameters(const struct rig_caps *caps, void *data)
case RIG_PORT_NETWORK: case RIG_PORT_NETWORK:
printf("network"); printf("network");
break; break;
case RIG_PORT_UDP_NETWORK:
printf("UDP network");
break;
case RIG_PORT_NONE: case RIG_PORT_NONE:
printf("None"); printf("None");
break; break;