| 1 |
/* |
| 2 |
* cwdaemon - morse sounding daemon for the parallel or serial port |
| 3 |
* Copyright (C) 2002 - 2005 Joop Stakenborg <[email protected]> |
| 4 |
* and many authors, see the AUTHORS file. |
| 5 |
* Copyright (C) 2012 - 2015 Kamil Ignacak <[email protected]> |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
* (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU Library General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software |
| 19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 20 |
* 02110-1301, USA. |
| 21 |
*/ |
| 22 |
|
| 23 |
#ifndef _CWDAEMON_H |
| 24 |
#define _CWDAEMON_H |
| 25 |
|
| 26 |
#ifndef OFF |
| 27 |
# define OFF 0 |
| 28 |
#endif |
| 29 |
#ifndef ON |
| 30 |
# define ON 1 |
| 31 |
#endif |
| 32 |
#define MICROPHONE 0 |
| 33 |
#define SOUNDCARD 1 |
| 34 |
|
| 35 |
#define MAX_DEVICE 20 |
| 36 |
|
| 37 |
typedef struct cwdev_s { |
| 38 |
int (*init) (struct cwdev_s *, int fd); |
| 39 |
int (*free) (struct cwdev_s *); |
| 40 |
int (*reset) (struct cwdev_s *); |
| 41 |
int (*cw) (struct cwdev_s *, int onoff); |
| 42 |
int (*ptt) (struct cwdev_s *, int onoff); |
| 43 |
int (*ssbway) (struct cwdev_s *, int onoff); |
| 44 |
int (*switchband) (struct cwdev_s *, unsigned char bandswitch); |
| 45 |
int (*footswitch) (struct cwdev_s *); |
| 46 |
int fd; |
| 47 |
char *desc; /* "parport0", "ttyS0", "null" - name of device used for keying. */ |
| 48 |
} |
| 49 |
cwdevice; |
| 50 |
|
| 51 |
|
| 52 |
/* cwdaemon debug verbosity levels. */ |
| 53 |
enum cwdaemon_verbosity { |
| 54 |
CWDAEMON_VERBOSITY_N, /* None. Don't display any debug information. */ |
| 55 |
CWDAEMON_VERBOSITY_E, /* Error */ |
| 56 |
CWDAEMON_VERBOSITY_W, /* Warning */ |
| 57 |
CWDAEMON_VERBOSITY_I, /* Info */ |
| 58 |
CWDAEMON_VERBOSITY_D /* Debug */ |
| 59 |
}; |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
void cwdaemon_errmsg(const char *info, ...); |
| 65 |
void cwdaemon_debug(int verbosity, const char *func, int line, const char *format, ...); |
| 66 |
|
| 67 |
int dev_get_tty(const char *fname); |
| 68 |
int dev_get_null(const char *fname); |
| 69 |
int dev_get_parport(const char *fname); |
| 70 |
|
| 71 |
#if defined (HAVE_LINUX_PPDEV_H) || defined (HAVE_DEV_PPBUS_PPI_H) |
| 72 |
int lp_init (cwdevice * dev, int fd); |
| 73 |
int lp_free (cwdevice * dev); |
| 74 |
int lp_reset (cwdevice * dev); |
| 75 |
int lp_cw (cwdevice * dev, int onoff); |
| 76 |
int lp_ptt (cwdevice * dev, int onoff); |
| 77 |
int lp_ssbway (cwdevice * dev, int onoff); |
| 78 |
int lp_switchband (cwdevice * dev, unsigned char bandswitch); |
| 79 |
int lp_footswitch (cwdevice * dev); |
| 80 |
#endif |
| 81 |
|
| 82 |
int ttys_init (cwdevice * dev, int fd); |
| 83 |
int ttys_free (cwdevice * dev); |
| 84 |
int ttys_reset (cwdevice * dev); |
| 85 |
int ttys_cw (cwdevice * dev, int onoff); |
| 86 |
int ttys_ptt (cwdevice * dev, int onoff); |
| 87 |
|
| 88 |
int null_init (cwdevice * dev, int fd); |
| 89 |
int null_free (cwdevice * dev); |
| 90 |
int null_reset (cwdevice * dev); |
| 91 |
int null_cw (cwdevice * dev, int onoff); |
| 92 |
int null_ptt (cwdevice * dev, int onoff); |
| 93 |
|
| 94 |
#endif /* _CWDAEMON_H */ |