BrlAPI 0.8

Data Structures | Macros | Functions
Writing on the braille display

Write text to the braille display. More...

## Data Structures
struct | brlapi_writeArguments_t

## Macros
#define | BRLAPI_DISPLAY_DEFAULT -1
#define | BRLAPI_CURSOR_LEAVE -1
#define | BRLAPI_CURSOR_OFF 0
#define | BRLAPI_WRITEARGUMENTS_INITIALIZER

## Functions
int BRLAPI_STDCALL | brlapi_writeText (int cursor, const char *text)
int BRLAPI_STDCALL | brlapi__writeText (brlapi_handle_t *handle, int cursor, const char *text)
int BRLAPI_STDCALL | brlapi_writeWText (int cursor, const wchar_t *text)
int BRLAPI_STDCALL | brlapi__writeWText (brlapi_handle_t *handle, int cursor, const wchar_t *text)
int BRLAPI_STDCALL | brlapi_writeDots (const unsigned char *dots)
int BRLAPI_STDCALL | brlapi__writeDots (brlapi_handle_t *handle, const unsigned char *dots)
int BRLAPI_STDCALL | brlapi_write (const brlapi_writeArguments_t *arguments)
int BRLAPI_STDCALL | brlapi__write (brlapi_handle_t *handle, const brlapi_writeArguments_t *arguments)

## Detailed Description

After brlapi_enterTtyMode() has been called, the application can call one of these functions to write things on the braille display.

Note
  Be sure to call brlapi_enterTtyMode() before calling brlapi_write(), or else you'll get an error. This is particularly not always trivial when writing multithreaded applications.
  Dots are coded as described in ISO/TR 11548-1: a dot pattern is coded by a byte in which bit 0 is set iff dot 1 is up, bit 1 is set iff dot 2 is up, ... bit 7 is set iff dot 8 is up. This also corresponds to the low-order byte of the coding of unicode's braille row U+2800.
  Text is translated by the server one to one, by just using a simple wchar_t to pattern table, i.e. no contraction/expansion is performed, because the client would then have no way to know how wide the output would be and thus the quantity of text to feed. If contraction/expansion is desired, the client should perform it itself (e.g. thanks to liblouis or gnome-braille) and send the resulting dot patterns. This is actually exactly the same problem as font rendering on a graphical display: for better control, nowadays all font rasterization is performed on the client side, and mere pixmaps are sent to the X server.
  For braille displays with multiple lines, text will be wrapped over the lines.

## Macro Definition Documentation

## ◆ BRLAPI_CURSOR_LEAVE

#define BRLAPI_CURSOR_LEAVE -1

Do not change the cursor's state or position.

See also
  brlapi_writeText() brlapi_write() brlapi_writeArguments_t

## ◆ BRLAPI_CURSOR_OFF

#define BRLAPI_CURSOR_OFF 0

Do not display the cursor.

See also
  brlapi_writeText() brlapi_write() brlapi_writeArguments_t

## ◆ BRLAPI_DISPLAY_DEFAULT

#define BRLAPI_DISPLAY_DEFAULT -1

Write to the default display on the braille device.

See also
  brlapi_write() brlapi_writeArguments_t

## ◆ BRLAPI_WRITEARGUMENTS_INITIALIZER

#define BRLAPI_WRITEARGUMENTS_INITIALIZER

Value:
{ \
.displayNumber = BRLAPI_DISPLAY_DEFAULT, \
.regionBegin = 0, \
.regionSize = 0, \
.text = NULL, \
.textSize = -1, \
.andMask = NULL, \
.orMask = NULL, \
.cursor = BRLAPI_CURSOR_LEAVE, \
.charset = NULL \
}
BRLAPI_CURSOR_LEAVE
#define BRLAPI_CURSOR_LEAVE
Definition brlapi.h:633
BRLAPI_DISPLAY_DEFAULT
#define BRLAPI_DISPLAY_DEFAULT
Definition brlapi.h:627

Allows to initialize a structure of type brlapi_writeArguments_t * with default values: displayNumber = BRLAPI_DISPLAY_DEFAULT; (unspecified) regionBegin = regionSize = 0; (update the whole display, DEPRECATED and will be forbidden in next release. You must always express the region you wish to update) text = andMask = orMask = NULL; (no text, no attribute) cursor = BRLAPI_CURSOR_LEAVE; (don't touch cursor)

## Function Documentation

## ◆ brlapi__write()

int BRLAPI_STDCALL brlapi__write | ( | brlapi_handle_t * | handle,
|  | const brlapi_writeArguments_t * | arguments )

References BRLAPI_STDCALL.

## ◆ brlapi__writeDots()

int BRLAPI_STDCALL brlapi__writeDots | ( | brlapi_handle_t * | handle,
|  | const unsigned char * | dots )

References BRLAPI_STDCALL.

## ◆ brlapi__writeText()

int BRLAPI_STDCALL brlapi__writeText | ( | brlapi_handle_t * | handle,
|  | int | cursor,
|  | const char * | text )

References BRLAPI_STDCALL.

## ◆ brlapi__writeWText()

int BRLAPI_STDCALL brlapi__writeWText | ( | brlapi_handle_t * | handle,
|  | int | cursor,
|  | const wchar_t * | text )

References BRLAPI_STDCALL.

## ◆ brlapi_write()

int BRLAPI_STDCALL brlapi_write | ( | const brlapi_writeArguments_t * | arguments | ) |

Update a specific region of the braille display and apply and/or masks

Parameters

  arguments | gives information necessary for the update

regionBegin and regionSize must be filled for specifying which part of the display will be updated, as well as the size (in characters, not bytes) of the text, andMask and orMask members.

If given, the "text" field holds the text that will be displayed in the region. The char string must hold exactly as many characters as the region fields express. For multibyte text, this is the number of multibyte characters. Notably, combining and double-width characters count for 1.

The actual length of the text in bytes may be specified thanks to textSize. If -1 is given, it will be computed thanks to strlen(), so "text" must then be a NUL-terminated string.

The "andMask" and "orMask" masks, if present, are then applied on top of the text, one byte per character. This hence permits the superimposing of attributes over the text. For instance, setting an andMask mask full of BRLAPI_DOTS(1,1,1,1,1,1,0,0) will only keep (logical AND) dots 1-6, hence dropping dots 7 and 8. On the contrary, setting an orMask full of BRLAPI_DOT7|BRLAPI_DOT8 will add (logical OR) dots 7 and 8.

The "charset" field, if present, specifies the charset of the "text" field. If it is "", the current locale's charset (if any) is assumed. Else, the 8-bit charset of the server is assumed.

A special invocation is with an unmodified initialized structure: this clears the client's whole display, letting the display of other applications on the same tty or of applications "under" the tty appear. See Concurrency management section of the BrlAPI documentation for more details.

Returns
  0 on success, -1 on error.

References BRLAPI_STDCALL.

## ◆ brlapi_writeDots()

int BRLAPI_STDCALL brlapi_writeDots | ( | const unsigned char * | dots | ) |

Write the given dots array to the display

Parameters

  dots | points on an array of dot information, one per character. Its size must hence be the same as what brlapi_getDisplaySize() returns.

Returns
  0 on success, -1 on error.

References BRLAPI_STDCALL.

## ◆ brlapi_writeText()

int BRLAPI_STDCALL brlapi_writeText | ( | int | cursor,
|  | const char * | text )

Write the given \0-terminated string to the braille display

If the string is too long, it is truncated. If it's too short, it is padded with spaces. The text is assumed to be in the current application locale charset set by setlocale(3) if it was called, or the locale charset from the application locale environment variables if setlocale(3) was not called.

Parameters

  cursor | gives the cursor position; if equal to BRLAPI_CURSOR_OFF, no cursor is shown at all; if cursor==BRLAPI_CURSOR_LEAVE, the cursor is left where it is
  text | points to the string to be displayed.

Returns
  0 on success, -1 on error.

References BRLAPI_STDCALL.

## ◆ brlapi_writeWText()

int BRLAPI_STDCALL brlapi_writeWText | ( | int | cursor,
|  | const wchar_t * | text )

Write the given \0-terminated unicode string to the braille display

If the string is too long, it is truncated. If it's too short, it is padded with spaces.

Parameters

  cursor | gives the cursor position; if equal to BRLAPI_CURSOR_OFF, no cursor is shown at all; if cursor==BRLAPI_CURSOR_LEAVE, the cursor is left where it is
  text | points to the string to be displayed.

Returns
  0 on success, -1 on error.

References BRLAPI_STDCALL.