Main Page | Modules | Data Structures | File List | Data Fields | Globals

BrlAPI's protocol

Instructions and constants for BrlAPI 's protocol. More...

Defines

#define BRLAPI_MAXPACKETSIZE   512
#define BRLPACKET_AUTHKEY   'K'
#define BRLPACKET_BYE   'B'
#define BRLPACKET_GETDRIVERID   'd'
#define BRLPACKET_GETDRIVERNAME   'n'
#define BRLPACKET_GETDISPLAYSIZE   's'
#define BRLPACKET_GETTTY   't'
#define BRLPACKET_LEAVETTY   'L'
#define BRLPACKET_KEY   'k'
#define BRLPACKET_COMMAND   'c'
#define BRLPACKET_MASKKEYS   'm'
#define BRLPACKET_UNMASKKEYS   'u'
#define BRLPACKET_WRITE   'W'
#define BRLPACKET_WRITEDOTS   'D'
#define BRLPACKET_STATWRITE   'S'
#define BRLPACKET_GETRAW   '*'
#define BRLPACKET_LEAVERAW   '#'
#define BRLPACKET_PACKET   'p'
#define BRLPACKET_ACK   'A'
#define BRLPACKET_ERROR   'E'
#define BRLRAW_MAGIC   (0xdeadbeefL)

Typedefs

typedef uint32_t brl_type_t

Functions

int brlapi_writePacket (int fd, brl_type_t type, const void *buf, size_t size)
int brlapi_readPacket (int fd, brl_type_t *type, void *buf, size_t size)

Variables

pthread_mutex_t brlapi_fd_mutex

Detailed Description

These are defines for the protocol between BrlAPI 's server and clients. Understanding is not needed to use the BrlAPI library, so reading this is not needed unless really wanting to connect to BrlAPI without BrlAPI 's library.

Define Documentation

#define BRLAPI_MAXPACKETSIZE   512
 

Maximum packet size for packets exchanged on sockets and with braille terminal

#define BRLPACKET_ACK   'A'
 

Acknowledgement

#define BRLPACKET_AUTHKEY   'K'
 

Authentication key

#define BRLPACKET_BYE   'B'
 

Bye

#define BRLPACKET_COMMAND   'c'
 

braille command

#define BRLPACKET_ERROR   'E'
 

Error in protocol

#define BRLPACKET_GETDISPLAYSIZE   's'
 

Dimensions of brl display

#define BRLPACKET_GETDRIVERID   'd'
 

Ask which driver is used

#define BRLPACKET_GETDRIVERNAME   'n'
 

Ask which driver is used

#define BRLPACKET_GETRAW   '*'
 

Enter in raw mode

#define BRLPACKET_GETTTY   't'
 

asks for a specified tty

#define BRLPACKET_KEY   'k'
 

braille key

#define BRLPACKET_LEAVERAW   '#'
 

Leave raw mode

#define BRLPACKET_LEAVETTY   'L'
 

release the tty

#define BRLPACKET_MASKKEYS   'm'
 

Mask a key-range

#define BRLPACKET_PACKET   'p'
 

Raw packets

#define BRLPACKET_STATWRITE   'S'
 

Write Status Cells

#define BRLPACKET_UNMASKKEYS   'u'
 

Unmask key range

#define BRLPACKET_WRITE   'W'
 

Write On Braille Display

#define BRLPACKET_WRITEDOTS   'D'
 

Write Dots On Braille Display

#define BRLRAW_MAGIC   (0xdeadbeefL)
 

Magic number to give when sending a BRLPACKET_GETRAW packet


Typedef Documentation

typedef uint32_t brl_type_t
 

type for packet type. Only unsigned can cross networks, 32bits


Function Documentation

int brlapi_readPacket int  fd,
brl_type_t type,
void *  buf,
size_t  size
 

Read a packet from BrlAPI server

This function is for internal use, but one might use it if one really knows what one is doing...

type is where the function will store the packet type; it should always be one of the above defined BRLPACKET_* (or else something very nasty must have happened :/).

The syntax is the same as read()'s.

Returns:
packet's size, -2 if EOF occurred, -1 on error

int brlapi_writePacket int  fd,
brl_type_t  type,
const void *  buf,
size_t  size
 

Send a packet to BrlAPI server

This function is for internal use, but one might use it if one really knows what one is doing...

type should only be one of the above defined BRLPACKET_*.

The syntax is the same as write()'s.

Returns:
0 on success, -1 on failure


Variable Documentation

pthread_mutex_t brlapi_fd_mutex
 

Mutex for protecting concurrent fd access

In order to regulate concurrent access to the library's file descriptor and requests to / answers from BrlAPI server, every function of the library locks this mutex, namely

If both these functions and brlapi_writePacket() or brlapi_readPacket() are used in a multithreaded application, this mutex must be locked before calling brlapi_writePacket() or brlapi_readPacket(), and unlocked afterwards.


Generated on Thu Oct 28 22:18:23 2004 for BrlAPI by  doxygen 1.3.9.1