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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
/*
* 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_GENERIC
#define BRLTTY_INCLUDED_IO_GENERIC
#include "gio_types.h"
#include "async_io.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
extern void gioInitializeDescriptor (GioDescriptor *descriptor);
extern void gioInitializeSerialParameters (SerialParameters *parameters);
extern GioEndpoint *gioConnectResource (
const char *identifier,
const GioDescriptor *descriptor
);
extern int gioDisconnectResource (GioEndpoint *endpoint);
extern const void *gioGetApplicationData (GioEndpoint *endpoint);
extern char *gioGetResourceName (GioEndpoint *endpoint);
extern ssize_t gioWriteData (GioEndpoint *endpoint, const void *data, size_t size);
extern int gioAwaitInput (GioEndpoint *endpoint, int timeout);
extern ssize_t gioReadData (GioEndpoint *endpoint, void *buffer, size_t size, int wait);
extern int gioReadByte (GioEndpoint *endpoint, unsigned char *byte, int wait);
extern int gioDiscardInput (GioEndpoint *endpoint);
extern int gioReconfigureResource (
GioEndpoint *endpoint,
const SerialParameters *parameters
);
extern unsigned int gioGetBytesPerSecond (GioEndpoint *endpoint);
extern unsigned int gioGetMillisecondsToTransfer (GioEndpoint *endpoint, size_t bytes);
extern ssize_t gioTellResource (
GioEndpoint *endpoint,
uint8_t recipient, uint8_t type,
uint8_t request, uint16_t value, uint16_t index,
const void *data, uint16_t size
);
extern ssize_t gioAskResource (
GioEndpoint *endpoint,
uint8_t recipient, uint8_t type,
uint8_t request, uint16_t value, uint16_t index,
void *buffer, uint16_t size
);
extern size_t gioGetHidReportSize (GioEndpoint *endpoint, unsigned char report);
extern ssize_t gioSetHidReport (
GioEndpoint *endpoint, unsigned char report,
const void *data, uint16_t size
);
extern ssize_t gioWriteHidReport (
GioEndpoint *endpoint,
const unsigned char *data, uint16_t size
);
extern ssize_t gioGetHidReport (
GioEndpoint *endpoint, unsigned char report,
void *buffer, uint16_t size
);
extern ssize_t gioSetHidFeature (
GioEndpoint *endpoint, unsigned char report,
const void *data, uint16_t size
);
extern ssize_t gioWriteHidFeature (
GioEndpoint *endpoint,
const unsigned char *data, uint16_t size
);
extern ssize_t gioGetHidFeature (
GioEndpoint *endpoint, unsigned char report,
void *buffer, uint16_t size
);
extern int gioMonitorInput (GioEndpoint *endpoint, AsyncMonitorCallback *callback, void *data);
typedef struct {
void *const data;
int error;
} GioHandleInputParameters;
#define GIO_INPUT_HANDLER(name) int name (GioHandleInputParameters *parameters)
typedef GIO_INPUT_HANDLER(GioInputHandler);
typedef struct GioHandleInputObjectStruct GioHandleInputObject;
extern GioHandleInputObject *gioNewHandleInputObject (
GioEndpoint *endpoint, int pollInterval,
GioInputHandler *handler, void *data
);
extern void gioDestroyHandleInputObject (GioHandleInputObject *hio);
typedef enum {
GIO_RESOURCE_UNTYPED = 0,
GIO_RESOURCE_SERIAL,
GIO_RESOURCE_USB,
GIO_RESOURCE_BLUETOOTH
} GioResourceType;
extern GioResourceType gioGetResourceType (GioEndpoint *endpoint);
extern void *gioGetResourceObject (GioEndpoint *endpoint);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* BRLTTY_INCLUDED_IO_GENERIC */
|