Main Page   Modules   Data Structures   File List   Data Fields   Globals  

api.h

Go to the documentation of this file.
00001 /* Programs/api.h.  Generated by configure.  */
00002 /*
00003  * BRLTTY - A background process providing access to the Linux console (when in
00004  *          text mode) for a blind person using a refreshable braille display.
00005  *
00006  * Copyright (C) 1995-2004 by The BRLTTY Team. All rights reserved.
00007  *
00008  * BRLTTY comes with ABSOLUTELY NO WARRANTY.
00009  *
00010  * This is free software, placed under the terms of the
00011  * GNU General Public License, as published by the Free Software
00012  * Foundation.  Please see the file COPYING for details.
00013  *
00014  * Web Page: http://mielke.cc/brltty/
00015  *
00016  * This software is maintained by Dave Mielke <dave@mielke.cc>.
00017  */
00018 
00023 #ifndef _BRLAPI_H
00024 #define _BRLAPI_H
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif /* __cplusplus */
00029 
00030 /* Define this to be a string containing the library version. */
00031 #define BRLAPI_RELEASE "0.2.0"
00032 
00033 /* this is for UINT32_MAX */
00034 #include <inttypes.h>
00035 #ifndef UINT32_MAX
00036 #define UINT32_MAX (4294967295U)
00037 #endif /* UINT32_MAX */
00038 
00039 /* The type size_t is defined there! */
00040 #include <unistd.h>
00041 
00044 #define BRLAPI_MAXPACKETSIZE 512
00045 
00057 #define BRLAPI_SOCKETPORT "35751"
00058 
00063 #define BRLAPI_ETCDIR "/etc"
00064 
00068 #define BRLAPI_AUTHFILE "brlapi.key"
00069 
00071 #define BRLAPI_DEFAUTHPATH BRLAPI_ETCDIR "/" BRLAPI_AUTHFILE
00072 
00103 typedef struct {
00110   char *authKey;
00111 
00120   char *hostName;
00121 } brlapi_settings_t;
00122 
00123 /* brlapi_initializeConnection */
00167 int brlapi_initializeConnection(const brlapi_settings_t *clientSettings, brlapi_settings_t *usedSettings);
00168 
00169 /* brlapi_closeConnection */
00176 void brlapi_closeConnection(void);
00177 
00178 /* brlapi_loadAuthKey */
00191 int brlapi_loadAuthKey(const char *filename, size_t *authlength, void *auth);
00192 
00206 /* brlapi_getDriverId */
00218 int brlapi_getDriverId(unsigned char *id, size_t n);
00219 
00220 /* brlapi_getDriverName */
00232 int brlapi_getDriverName(unsigned char *name, size_t n);
00233 
00234 /* brlapi_getDisplaySize */
00236 int brlapi_getDisplaySize(unsigned int *x, unsigned int *y);
00237 
00262 /* brlapi_getTty */
00288 int brlapi_getTty(int tty, int how);
00289 
00291 #define BRLKEYCODES 1
00292 
00293 #define BRLCOMMANDS 2
00294 
00295 /* brlapi_leaveTty */
00302 int brlapi_leaveTty(void);
00303 
00318 /* brlapi_writeBrl */
00329 int brlapi_writeBrl(int cursor, const unsigned char *str);
00330 
00331 /* brlapi_writeBrlDots */
00339 int brlapi_writeBrlDots(const unsigned char *dots);
00340 
00341 /* brlapi_extWriteStruct */
00343 typedef struct {
00344   int displayNumber; 
00345   uint32_t regionBegin, regionEnd; 
00346   char *text; 
00347   char *attrAnd; 
00348   char *attrOr; 
00349   int cursor; /* -1 == don't touch, 0 == turn off, 1 = 1st char of display, ... */
00350 } brlapi_extWriteStruct;
00351 
00352 /* BRLAPI_EXTWRITESTRUCT_INITIALIZER */
00361 #define BRLAPI_EXTWRITESTRUCT_INITIALIZER \
00362   { -1, 0, 0, NULL, NULL, NULL, -1};
00363 
00364 /* brlapi_extWriteBrl */
00371 int brlapi_extWriteBrl(const brlapi_extWriteStruct *s);
00372 
00395 #define BRL_KEYBUF_SIZE 256
00396 
00401 typedef uint32_t brl_keycode_t;
00402 
00406 #define BRL_KEYCODE_MAX ((brl_keycode_t) (UINT32_MAX))
00407 
00408 /* brlapi_readKey */
00432 int brlapi_readKey(int block, brl_keycode_t *code);
00433 
00434 /* brlapi_readCommand */
00456 int brlapi_readCommand(int block, brl_keycode_t *code);
00457 
00458 /* brlapi_ignoreKeyRange */
00467 int brlapi_ignoreKeyRange(brl_keycode_t x, brl_keycode_t y);
00468 
00469 /* brlapi_ignoreKeySet */
00478 int brlapi_ignoreKeySet(const brl_keycode_t *s, uint32_t n);
00479 
00480 /* brlapi_unignoreKeyRange */
00491 int brlapi_unignoreKeyRange(brl_keycode_t x, brl_keycode_t y);
00492 
00493 /* brlapi_unignoreKeySet */
00504 int brlapi_unignoreKeySet(const brl_keycode_t *s, uint32_t n);
00505 
00526 /* brlapi_getRaw */
00529 int brlapi_getRaw(void);
00530 
00531 /* brlapi_leaveRaw */
00534 int brlapi_leaveRaw(void);
00535 
00536 /* brlapi_sendRaw */
00542 ssize_t brlapi_sendRaw(const unsigned char *buf, size_t size);
00543 
00544 /* brlapi_recvRaw */
00551 ssize_t brlapi_recvRaw(unsigned char *buf, size_t size);
00552 
00560 /* Error codes */
00561 #define BRLERR_SUCCESS                  0  
00562 #define BRLERR_NOMEM                    1  
00563 #define BRLERR_TTYBUSY                  2  
00564 #define BRLERR_UNKNOWN_INSTRUCTION      3  
00565 #define BRLERR_ILLEGAL_INSTRUCTION      4  
00566 #define BRLERR_INVALID_PARAMETER        5  
00567 #define BRLERR_INVALID_PACKET           6  
00568 #define BRLERR_RAWNOTSUPP               7  
00569 #define BRLERR_KEYSNOTSUPP              8  
00570 #define BRLERR_CONNREFUSED              9  
00571 #define BRLERR_OPNOTSUPP               10  
00572 #define BRLERR_GAIERR                  11  
00573 #define BRLERR_LIBCERR                 12  
00574 #define BRLERR_UNKNOWNTTY              13  
00575 #define BRLERR_PROTOCOL_VERSION        14  
00576 #define BRLERR_EOF                     15  
00578 /* brlapi_errlist */
00579 
00583 extern const char *brlapi_errlist[];
00584 
00585 /* brlapi_nerr */
00587 extern const int brlapi_nerr;
00588 
00589 /* brlapi_perror */
00594 void brlapi_perror(const char *s);
00595 
00604 int *brlapi_errno_location(void);
00605 
00611 extern int brlapi_errno;
00613 #define brlapi_errno (*brlapi_errno_location ())
00614 
00615 /* brlapi_strerror */
00621 extern const char *brlapi_strerror(void);
00622 
00626 #define BRLAPI_EWF_DISPLAYNUMBER 0X01   
00627 #define BRLAPI_EWF_REGION        0X02   
00628 #define BRLAPI_EWF_TEXT          0X04   
00629 #define BRLAPI_EWF_ATTR_AND      0X08   
00630 #define BRLAPI_EWF_ATTR_OR       0X10   
00631 #define BRLAPI_EWF_CURSOR        0X20   
00634 typedef struct {
00635   uint32_t flags;
00636   unsigned char data;
00637 } extWriteStruct;
00638 
00639 #include <pthread.h>
00640 
00641 /* brlapi_fd_mutex */
00667 extern pthread_mutex_t brlapi_fd_mutex;
00668 
00669 #ifdef __cplusplus
00670 }
00671 #endif /* __cplusplus */
00672 
00673 #endif /* _BRLAPI_H */

Generated on Tue Jul 13 07:08:02 2004 for BrlAPI by doxygen1.2.18