brlapi_par...Management(3)

โœจ NAME โœจ

brlapi_parameterManagement โ€” Parameter management ๐Ÿ’–

Okay so hi bestie, welcome to brlapi_par...Management(3) ๐ŸŽ€ this whole page is literally just how to manage BrlAPI parameters. That's it. That's the vibe. Let's get into it ๐Ÿฆ‹


๐ŸŒธ SYNOPSIS ๐ŸŒธ

๐Ÿงš Macros

#define BRLAPI_PARAMF_LOCAL   0X00
#define BRLAPI_PARAMF_GLOBAL   0X01
#define BRLAPI_PARAMF_SELF   0X02

๐Ÿฆ‹ Typedefs

typedef uint32_t brlapi_param_flags_t
typedef void(* brlapi_paramCallback_t) (brlapi_param_t parameter,
    brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, void
    *priv, const void *data, size_t len)
typedef void * brlapi_paramCallbackDescriptor_t

๐Ÿ’… Functions

ssize_t BRLAPI_STDCALL brlapi_getParameter (brlapi_param_t parameter,
    brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, void
    *data, size_t len)
ssize_t BRLAPI_STDCALL brlapi__getParameter (brlapi_handle_t *handle,
    brlapi_param_t parameter, brlapi_param_subparam_t subparam,
    brlapi_param_flags_t flags, void *data, size_t len)
void *BRLAPI_STDCALL brlapi_getParameterAlloc (brlapi_param_t parameter,
    brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, size_t
    *len)
void *BRLAPI_STDCALL brlapi__getParameterAlloc (brlapi_handle_t *handle,
    brlapi_param_t parameter, brlapi_param_subparam_t subparam,
    brlapi_param_flags_t flags, size_t *len)
int BRLAPI_STDCALL brlapi_setParameter (brlapi_param_t parameter,
    brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, const
    void *data, size_t len)
int BRLAPI_STDCALL brlapi__setParameter (brlapi_handle_t *handle,
    brlapi_param_t parameter, brlapi_param_subparam_t subparam,
    brlapi_param_flags_t flags, const void *data, size_t len)
brlapi_paramCallbackDescriptor_t BRLAPI_STDCALL brlapi_watchParameter
    (brlapi_param_t parameter, brlapi_param_subparam_t subparam,
    brlapi_param_flags_t flags, brlapi_paramCallback_t func, void *priv,
    void *data, size_t len)
brlapi_paramCallbackDescriptor_t BRLAPI_STDCALL brlapi__watchParameter
    (brlapi_handle_t *handle, brlapi_param_t parameter,
    brlapi_param_subparam_t subparam, brlapi_param_flags_t flags,
    brlapi_paramCallback_t func, void *priv, void *data, size_t len)
int BRLAPI_STDCALL brlapi_unwatchParameter
    (brlapi_paramCallbackDescriptor_t descriptor)
int BRLAPI_STDCALL brlapi__unwatchParameter (brlapi_handle_t *handle,
    brlapi_paramCallbackDescriptor_t descriptor)
enum brlapi_param_t { BRLAPI_PARAM_SERVER_VERSION = 0,
    BRLAPI_PARAM_CLIENT_PRIORITY = 1, BRLAPI_PARAM_DRIVER_NAME = 2,
    BRLAPI_PARAM_DRIVER_CODE = 3, BRLAPI_PARAM_DRIVER_VERSION = 4,
    BRLAPI_PARAM_DEVICE_MODEL = 5, BRLAPI_PARAM_DEVICE_CELL_SIZE = 31,
    BRLAPI_PARAM_DISPLAY_SIZE = 6, BRLAPI_PARAM_DEVICE_IDENTIFIER = 7,
    BRLAPI_PARAM_DEVICE_SPEED = 8, BRLAPI_PARAM_DEVICE_ONLINE = 9,
    BRLAPI_PARAM_RETAIN_DOTS = 10,
    BRLAPI_PARAM_COMPUTER_BRAILLE_CELL_SIZE = 11,
    BRLAPI_PARAM_LITERARY_BRAILLE = 12, BRLAPI_PARAM_CURSOR_DOTS = 13,
    BRLAPI_PARAM_CURSOR_BLINK_PERIOD = 14,
    BRLAPI_PARAM_CURSOR_BLINK_PERCENTAGE = 15,
    BRLAPI_PARAM_RENDERED_CELLS = 16, BRLAPI_PARAM_SKIP_IDENTICAL_LINES
    = 17, BRLAPI_PARAM_AUDIBLE_ALERTS = 18,
    BRLAPI_PARAM_CLIPBOARD_CONTENT = 19,
    BRLAPI_PARAM_BOUND_COMMAND_KEYCODES = 20,
    BRLAPI_PARAM_COMMAND_KEYCODE_NAME = 21,
    BRLAPI_PARAM_COMMAND_KEYCODE_SUMMARY = 22,
    BRLAPI_PARAM_DEFINED_DRIVER_KEYCODES = 23,
    BRLAPI_PARAM_DRIVER_KEYCODE_NAME = 24,
    BRLAPI_PARAM_DRIVER_KEYCODE_SUMMARY = 25,
    BRLAPI_PARAM_COMPUTER_BRAILLE_ROWS_MASK = 26,
    BRLAPI_PARAM_COMPUTER_BRAILLE_ROW_CELLS = 27,
    BRLAPI_PARAM_COMPUTER_BRAILLE_TABLE = 28,
    BRLAPI_PARAM_LITERARY_BRAILLE_TABLE = 29,
    BRLAPI_PARAM_MESSAGE_LOCALE = 30, BRLAPI_PARAM_DRIVER_PROPERTY_VALUE
    = 32, BRLAPI_PARAM_COUNT = 33 }

๐Ÿซถ Detailed Description ๐Ÿซถ

So like, there are several kinds of parameters, and you need to know which kind you're dealing with, iykyk:

  • states that are tied to the braille device itself โ€” its size, parameters of the device port, all of that ๐Ÿ’ซ
  • states of the BrlAPI connection itself, like the displaying level or key passing preferences โœจ
  • general states, for example the cut buffer ๐Ÿ“
  • braille parameters: braille table, contraction, cursor shape, etc ๐ŸŒธ
  • browse parameters: line skip, beep, etc ๐ŸŽ€

Some of them are subdivided in subparameters, bestie. Others have only subparameter 0. Yep, just the one. Not me living my single-subparam truth ๐Ÿ’…

Some of them are read-only, others are read/write.

A client can either:

  • request the immediate content of a parameter by using brlapi_getParameter() ๐Ÿ”
  • set the content of a parameter by using brlapi_setParameter() โœ๏ธ
  • or register a callback that may be called immediately and on each change of a given parameter, by using brlapi_watchParameter() ๐Ÿ‘€

๐Ÿ’– Macro Definition Documentation ๐Ÿ’–

๐ŸŽ€ #define BRLAPI_PARAMF_GLOBAL 0X01

Refer to the global value instead of the value local to the connection ๐ŸŒ

๐ŸŽ€ #define BRLAPI_PARAMF_LOCAL 0X00

Refer to the value local to the connection instead of the global value ๐Ÿ 

๐ŸŽ€ #define BRLAPI_PARAMF_SELF 0X02

Specify whether to receive notifications of value self-changes ๐Ÿ””


๐Ÿฆ‹ Typedef Documentation ๐Ÿฆ‹

โœจ typedef uint32_t brlapi_param_flags_t

Flags for parameter requests ๐Ÿšฉ

โœจ typedef void(* brlapi_paramCallback_t) (brlapi_param_t parameter, brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, void *priv, const void *data, size_t len)

Callback for parameter changes ๐Ÿ’ซ

When a parameter gets changed, application-defined callbacks set by the brlapi_watchParameter() function are called. Like, that's the whole point. ๐Ÿซถ

Parameters

  • parameter is the parameter that changed;
  • subparam is a specific instance of the parameter;
  • flags specify which value and how it was changed;
  • priv is the void pointer that was passed to the brlapi_watchParameter call which registered the callback;
  • data is a buffer containing the new value of the parameter;
  • len is the size of the data.
Okay ngl this part is important bestie: this callback only gets called when the application calls some brlapi_ function (i.e. BrlAPI gets direct control of the execution). BrlAPI itself does not start a separate thread or such. ๐Ÿ˜ญ

If an application wants to see such event trigger a callback getting called e.g. in another thread, it can use brlapi_pause() to give BrlAPI an opportunity to receive messages and call the callbacks. Slay โœจ

โœจ typedef void* brlapi_paramCallbackDescriptor_t

Type for callback descriptors ๐ŸŽŸ๏ธ This is returned by brlapi_watchParameter, to be passed to brlapi_unwatchParameter. Keep it safe, it's your receipt ๐Ÿงพ


๐Ÿ‘‘ Enumeration Type Documentation ๐Ÿ‘‘

๐ŸŒˆ enum brlapi_param_t

Enumerator

  • BRLAPI_PARAM_SERVER_VERSION โ€” Version of the server: uint32_t โญ
  • BRLAPI_PARAM_CLIENT_PRIORITY โ€” Priority of the client: uint32_t (from 0 through 100, default is 50) ๐Ÿ’…
  • BRLAPI_PARAM_DRIVER_NAME โ€” Full name of the driver: string ๐Ÿ“›
  • BRLAPI_PARAM_DRIVER_CODE โ€” Code (short name) of the driver: string ๐Ÿ”ค
  • BRLAPI_PARAM_DRIVER_VERSION โ€” Version of the driver: string ๐Ÿท๏ธ
  • BRLAPI_PARAM_DEVICE_MODEL โ€” Model of the device: string ๐Ÿ“ฑ
  • BRLAPI_PARAM_DEVICE_CELL_SIZE โ€” Number of dots in a cell: uint8_t โšซ
  • BRLAPI_PARAM_DISPLAY_SIZE โ€” Dimensions of the braille display: { uint32_t columns; uint32_t rows; } ๐Ÿ“
  • BRLAPI_PARAM_DEVICE_IDENTIFIER โ€” Identifier of the device: string ๐Ÿ†”
  • BRLAPI_PARAM_DEVICE_SPEED โ€” Speed of the device: uint32_t ๐ŸŽ๏ธ
  • BRLAPI_PARAM_DEVICE_ONLINE โ€” Device is online: boolean ๐ŸŸข
  • BRLAPI_PARAM_RETAIN_DOTS โ€” Pass dot combinations (rather than characters): boolean โšช
  • BRLAPI_PARAM_COMPUTER_BRAILLE_CELL_SIZE โ€” Number of dots used to render a computer braille character: uint8_t (8 or 6) ๐Ÿงฎ
  • BRLAPI_PARAM_LITERARY_BRAILLE โ€” Whether braille is literary (rather than computer): boolean ๐Ÿ“–
  • BRLAPI_PARAM_CURSOR_DOTS โ€” Representation of the cursor: uint8_t (ISO 11548-1) ๐Ÿ–ฑ๏ธ
  • BRLAPI_PARAM_CURSOR_BLINK_PERIOD โ€” Blinking period of the cursor: uint32_t (milliseconds) โฑ๏ธ
  • BRLAPI_PARAM_CURSOR_BLINK_PERCENTAGE โ€” Portion of the blinking period that the cursor is visible: uint8_t (from 0 through 100) ๐Ÿ‘๏ธ
  • BRLAPI_PARAM_RENDERED_CELLS โ€” Cells rendered by the client: uint8_t[] (ISO 11548-1), one cell per element ๐Ÿ”ก
  • BRLAPI_PARAM_SKIP_IDENTICAL_LINES โ€” Whether to skip identical screen lines: boolean ๐Ÿ“ƒ
  • BRLAPI_PARAM_AUDIBLE_ALERTS โ€” Whether to use audible alerts: boolean ๐Ÿ”Š
  • BRLAPI_PARAM_CLIPBOARD_CONTENT โ€” Content of the clipboard: UTF-8 string ๐Ÿ“‹
  • BRLAPI_PARAM_BOUND_COMMAND_KEYCODES โ€” Commands bound by the driver: uint64_t[], one command keycode per element โŒจ๏ธ
  • BRLAPI_PARAM_COMMAND_KEYCODE_NAME โ€” Name for a command keycode (specified via the subparam argument): string (usually a few characters) ๐Ÿท๏ธ
  • BRLAPI_PARAM_COMMAND_KEYCODE_SUMMARY โ€” Description for a command keycode (specified via the subparam argument): string (usually a few words) ๐Ÿ’ฌ
  • BRLAPI_PARAM_DEFINED_DRIVER_KEYCODES โ€” Keycodes defined by the driver: uint64_t[], one keycode per element ๐Ÿ”ข
  • BRLAPI_PARAM_DRIVER_KEYCODE_NAME โ€” Name for a driver keycode (specified via the subparam argument): string (usually a few characters) ๐ŸŽซ
  • BRLAPI_PARAM_DRIVER_KEYCODE_SUMMARY โ€” Description for a driver keycode (specified via the subparam argument): string (usually a few words) ๐Ÿ—’๏ธ
  • BRLAPI_PARAM_COMPUTER_BRAILLE_ROWS_MASK โ€” Set of Unicode rows that are defined for computer braille (from U+0000 through U+10FFFF): uint8_t[544], one bit per row, eight rows per element ๐Ÿงฉ
  • BRLAPI_PARAM_COMPUTER_BRAILLE_ROW_CELLS โ€” Computer braille cells for a Unicode row (specified via the subparam argument): uint8_t[256] (ISO 11548-1), one cell per element ๐Ÿ” 
  • BRLAPI_PARAM_COMPUTER_BRAILLE_TABLE โ€” Name of the computer braille table: string ๐Ÿ—‚๏ธ
  • BRLAPI_PARAM_LITERARY_BRAILLE_TABLE โ€” Name of the literary braille table: string ๐Ÿ“š
  • BRLAPI_PARAM_MESSAGE_LOCALE โ€” Locale to use for messages: string ๐ŸŒ
  • BRLAPI_PARAM_DRIVER_PROPERTY_VALUE โ€” Value of a driver-specific property: uint32_t ๐Ÿ”ง
  • BRLAPI_PARAM_COUNT โ€” (no description, she's just the counter, periodt โœ‹)

and that's where this half of the page ends, bestie ๐Ÿ‘€ keep scrolling for the rest ๐Ÿ’–

๐Ÿ’ซ Function Documentation ๐Ÿ’ซ

Okay bestie, this is the part where we actually call the functions. Grab a snack, we're going through them one by one. ๐Ÿ“


๐Ÿซถ brlapi__getParameter ๐Ÿซถ

ssize_t BRLAPI_STDCALL brlapi__getParameter (brlapi_handle_t * handle,
    brlapi_param_t parameter, brlapi_param_subparam_t subparam,
    brlapi_param_flags_t flags, void * data, size_t len)

References BRLAPI_STDCALL.


๐Ÿซถ brlapi__getParameterAlloc ๐Ÿซถ

void *BRLAPI_STDCALL brlapi__getParameterAlloc (brlapi_handle_t * handle,
    brlapi_param_t parameter, brlapi_param_subparam_t subparam,
    brlapi_param_flags_t flags, size_t * len)

References BRLAPI_STDCALL.


๐Ÿซถ brlapi__setParameter ๐Ÿซถ

int BRLAPI_STDCALL brlapi__setParameter (brlapi_handle_t * handle,
    brlapi_param_t parameter, brlapi_param_subparam_t subparam,
    brlapi_param_flags_t flags, const void * data, size_t len)

References BRLAPI_STDCALL.


๐Ÿซถ brlapi__unwatchParameter ๐Ÿซถ

int BRLAPI_STDCALL brlapi__unwatchParameter (brlapi_handle_t * handle,
    brlapi_paramCallbackDescriptor_t descriptor)

References BRLAPI_STDCALL.


๐Ÿซถ brlapi__watchParameter ๐Ÿซถ

brlapi_paramCallbackDescriptor_t BRLAPI_STDCALL brlapi__watchParameter
    (brlapi_handle_t * handle, brlapi_param_t parameter,
    brlapi_param_subparam_t subparam, brlapi_param_flags_t flags,
    brlapi_paramCallback_t func, void * priv, void * data, size_t len)

References BRLAPI_STDCALL.


โœจ brlapi_getParameter โœจ

Get the content of a parameter
ssize_t BRLAPI_STDCALL brlapi_getParameter (brlapi_param_t parameter,
    brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, void *
    data, size_t len)

No cap, brlapi_getParameter gets the current content of a parameter. Like, right now, the actual vibe of it. ๐Ÿฆ‹

Parameters

  • parameter is the parameter whose content shall be gotten;
  • subparam is a specific instance of the parameter;
  • flags specify which value and how it should be returned;
  • data is a buffer where content of the parameter shall be stored;
  • len is the size of the buffer.

Returns

the real size of the parameter's content. Now listen โ€” if the parameter does not fit in the provided buffer, it is truncated to len bytes (but the real size of the parameter is still returned). So yes bestie, you get the truth even when the buffer lied. ๐Ÿ˜ญ In that case, the client must call brlapi_getParameter again with a big enough buffer.

References BRLAPI_STDCALL.


โœจ brlapi_getParameterAlloc โœจ

Return the content of a parameter
void *BRLAPI_STDCALL brlapi_getParameterAlloc (brlapi_param_t parameter,
    brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, size_t *
    len)

brlapi_getParameterAlloc gets the current content of a parameter, by returning it as a newly-allocated buffer. The buffer is allocated to one byte more than the parameter value. This byte is set to zero. This allows, for string parameters, to be able to immediately use it as a C string. Honestly? Iconic behaviour. ๐ŸŽ€

Parameters

  • parameter is the parameter whose content shall be gotten;
  • subparam is a specific instance of the parameter;
  • flags specify which value and how it should be returned;
  • len is the address where to store the size of the parameter value.

Returns

a newly-allocated buffer that contains the value of the parameter. The caller must call free() on it after use. NULL is returned on errors.

References BRLAPI_STDCALL.


โœจ brlapi_setParameter โœจ

Set the content of a parameter
int BRLAPI_STDCALL brlapi_setParameter (brlapi_param_t parameter,
    brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, const void
    * data, size_t len)

brlapi_setParameter sets the content of a parameter. You're the main character here, you decide what goes in. ๐Ÿ’…

Parameters

  • parameter is the parameter to set;
  • subparam is a specific instance of the parameter;
  • flags specify which value and how it should be set;
  • data is a buffer containing the data to store in the parameter;
  • len is the size of the data.

Returns

0 on success, -1 on error (read-only parameter for instance). Yeah, if it's read-only it's giving no and you just have to accept that. ๐Ÿ™ˆ

References BRLAPI_STDCALL.


โœจ brlapi_unwatchParameter โœจ

Clear a parameter change callback
int BRLAPI_STDCALL brlapi_unwatchParameter (brlapi_paramCallbackDescriptor_t
    descriptor)

brlapi_unwatchParameter unregisters a parameter change callback: the callback function previously registered with brlapi_watchParameter will not be called any longer. It's the โœจ we're-so-done โœจ of function calls.

Parameters

  • descriptor refers to the callback to be removed.

Returns

0 on success, -1 on error.

References BRLAPI_STDCALL.


โœจ brlapi_watchParameter โœจ

Set a parameter change callback
brlapi_paramCallbackDescriptor_t BRLAPI_STDCALL brlapi_watchParameter
    (brlapi_param_t parameter, brlapi_param_subparam_t subparam,
    brlapi_param_flags_t flags, brlapi_paramCallback_t func, void * priv,
    void * data, size_t len)

brlapi_watchParameter registers a parameter change callback: whenever the given parameter changes, the given function is called. It's literally the "notify me bestie ๐Ÿ‘€" of the API.

Parameters

  • parameter is the parameter to watch;
  • subparam is a specific instance of the parameter;
  • flags specify which value and how it should be monitored;
  • func is the function to call on parameter change;
  • priv is a void pointer which will be passed as such to the function;
  • data is a buffer where the current content of the parameter shall be stored;
  • len is the size of the buffer.

Returns

the callback descriptor (to be passed to brlapi_unwatchParameter to unregister the callback), or NULL on error.

Note Default parameter callbacks don't do anything, except the ones for display size which just raise SIGWINCH. So like, lowkey quiet, except the display size one who is so dramatic. ๐Ÿ’€ If data is NULL, the callback will be called immediately by brlapi_watchParameter, for providing the initial value.

References BRLAPI_STDCALL.


๐Ÿ‘‘ Author ๐Ÿ‘‘

Generated automatically by Doxygen for BrlAPI from the source code.


And that's a wrap, bestie! ๐Ÿ’– This page came from BrlAPI, Version 0.8, and the footer's date stamp is its own little timestamp of destiny โ€” same source, same version, same energy. Go forth and parameter-manage, you absolute legend. ๐ŸŒˆ๐Ÿฆ‹โœจ

๐Ÿ“ฆ where this page comes from