1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
/*
* BRLTTY - A background process providing access to the console screen (when in
* text mode) for a blind person using a refreshable braille display.
*
* Copyright (C) 1995-2014 by The BRLTTY Developers.
*
* BRLTTY comes with ABSOLUTELY NO WARRANTY.
*
* This is free software, placed 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. Please see the file LICENSE-GPL for details.
*
* Web Page: http://mielke.cc/brltty/
*
* This software is maintained by Dave Mielke <dave@mielke.cc>.
*/
#ifndef BRLTTY_INCLUDED_IO_SERIAL
#define BRLTTY_INCLUDED_IO_SERIAL
#include <stdio.h>
#include "serial_types.h"
#include "async_io.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef struct SerialDeviceStruct SerialDevice;
extern int isSerialDevice (const char **identifier);
extern int serialValidateBaud (unsigned int *baud, const char *description, const char *word, const unsigned int *choices);
extern SerialDevice *serialOpenDevice (const char *identifier);
extern void serialCloseDevice (SerialDevice *serial);
extern int serialRestartDevice (SerialDevice *serial, unsigned int baud);
extern FILE *serialGetStream (SerialDevice *serial);
extern int serialDiscardInput (SerialDevice *serial);
extern int serialDiscardOutput (SerialDevice *serial);
extern int serialFlushOutput (SerialDevice *serial);
extern int serialMonitorInput (SerialDevice *serial, AsyncMonitorCallback *callback, void *data);
extern int serialAwaitInput (SerialDevice *serial, int timeout);
extern int serialAwaitOutput (SerialDevice *serial);
extern ssize_t serialReadData (
SerialDevice *serial,
void *buffer, size_t size,
int initialTimeout, int subsequentTimeout
);
extern int serialReadChunk (
SerialDevice *serial,
void *buffer, size_t *offset, size_t count,
int initialTimeout, int subsequentTimeout
);
extern ssize_t serialWriteData (
SerialDevice *serial,
const void *data, size_t size
);
extern int serialParseBaud (unsigned int *baud, const char *string);
extern int serialParseDataBits (unsigned int *bits, const char *string);
extern int serialParseStopBits (unsigned int *bits, const char *string);
extern int serialParseParity (SerialParity *parity, const char *string);
extern int serialParseFlowControl (SerialFlowControl *flow, const char *string);
extern int serialSetParameters (SerialDevice *serial, const SerialParameters *parameters);
extern int serialSetBaud (SerialDevice *serial, unsigned int baud);
extern int serialSetDataBits (SerialDevice *serial, unsigned int bits);
extern int serialSetStopBits (SerialDevice *serial, SerialStopBits bits);
extern int serialSetParity (SerialDevice *serial, SerialParity parity);
extern int serialSetFlowControl (SerialDevice *serial, SerialFlowControl flow);
extern unsigned int serialGetCharacterSize (const SerialParameters *parameters);
extern unsigned int serialGetCharacterBits (SerialDevice *serial);
extern int serialSetLineRTS (SerialDevice *serial, int up);
extern int serialSetLineDTR (SerialDevice *serial, int up);
extern int serialTestLineCTS (SerialDevice *serial);
extern int serialTestLineDSR (SerialDevice *serial);
extern int serialWaitLineCTS (SerialDevice *serial, int up, int flank);
extern int serialWaitLineDSR (SerialDevice *serial, int up, int flank);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* BRLTTY_INCLUDED_IO_SERIAL */
|