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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Reading key presses</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.18 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> </center>
<hr><h1>Reading key presses</h1>How to read key presses from the braille terminal.
<a href="#_details">More...</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
<tr><td nowrap align=right valign=top>struct </td><td valign=bottom><a class="el" href="structbrlapi__keybinding__t.html">brlapi_keybinding_t</a></td></tr>
<tr><td> </td><td><font size=-1><em>Key binding structure.</em> <a href="structbrlapi__keybinding__t.html#_details">More...</a><em></em></font><br><br></td></tr>
<tr><td colspan=2><br><h2>Defines</h2></td></tr>
<tr><td nowrap align=right valign=top>#define </td><td valign=bottom><a class="el" href="group__brlapi__keys.html#a6">BRL_KEYBUF_SIZE</a> 256</td></tr>
<tr><td nowrap align=right valign=top>#define </td><td valign=bottom><a class="el" href="group__brlapi__keys.html#a7">BRL_KEYCODE_MAX</a> ((<a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a>) (UINT32_MAX))</td></tr>
<tr><td nowrap align=right valign=top>#define </td><td valign=bottom><a class="el" href="group__brlapi__keys.html#a8">BRLAPI_HOMEKEYDIR</a> ".brlkeys"</td></tr>
<tr><td nowrap align=right valign=top>#define </td><td valign=bottom><a class="el" href="group__brlapi__keys.html#a9">BRLAPI_HOMEKEYEXT</a> ".kbd"</td></tr>
<tr><td nowrap align=right valign=top>#define </td><td valign=bottom><a class="el" href="group__brlapi__keys.html#a10">BRLAPI_ETCKEYFILE</a> "brlkeys"</td></tr>
<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
<tr><td nowrap align=right valign=top>typedef uint32_t </td><td valign=bottom><a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a></td></tr>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__brlapi__keys.html#a1">brlapi_readKey</a> (int block, <a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a> *code)</td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__brlapi__keys.html#a2">brlapi_readCommand</a> (int block, <a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a> *code)</td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__brlapi__keys.html#a3">brlapi_readBinding</a> (int block, const char **code)</td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__brlapi__keys.html#a4">brlapi_ignoreKeys</a> (<a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a> x, <a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a> y)</td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__brlapi__keys.html#a5">brlapi_unignoreKeys</a> (<a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a> x, <a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a> y)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Once <a class="el" href="group__brlapi__tty.html#a0">brlapi_getTty()</a> is called, the application can call <a class="el" href="group__brlapi__keys.html#a1">brlapi_readKey()</a>, <a class="el" href="group__brlapi__keys.html#a2">brlapi_readCommand()</a> or <a class="el" href="group__brlapi__keys.html#a3">brlapi_readBinding()</a> to read key presses. Not everyone can be called, it depends on parameters given to <a class="el" href="group__brlapi__tty.html#a0">brlapi_getTty()</a>.
<p>
key presses are buffered, so that calling <a class="el" href="group__brlapi__keys.html#a1">brlapi_readKey()</a> in non-blocking mode from times to times should suffice. <hr><h2>Define Documentation</h2>
<a name="a6" doxytag="brlapi.h::BRL_KEYBUF_SIZE"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> #define BRL_KEYBUF_SIZE 256
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
buffer size
<p>
key presses won't be lost provided no more than BRL_KEYBUF_SIZE key presses are done between two calls to brlapi_read* if a call to another function is done in the meanwhile (which needs somewhere to put them before being able to get responses from the server) </td>
</tr>
</table>
<a name="a7" doxytag="brlapi.h::BRL_KEYCODE_MAX"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> #define BRL_KEYCODE_MAX ((<a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a>) (UINT32_MAX))
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
brl_keycode_t's biggest value
<p>
As defined in <code><inttypes.h></code> </td>
</tr>
</table>
<a name="a10" doxytag="brlapi.h::BRLAPI_ETCKEYFILE"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> #define BRLAPI_ETCKEYFILE "brlkeys"
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Prefix for driver-dependent key names header files
<p>
Driver-dependent key names header files are stored in BRLAPI_ETCDIR/BRLAPI_ETCKEYFILE-xy.h where <code>xy</code> is the driver code, as returned by <a class="el" href="group__brlapi__info.html#a0">brlapi_getDriverId()</a> </td>
</tr>
</table>
<a name="a8" doxytag="brlapi.h::BRLAPI_HOMEKEYDIR"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> #define BRLAPI_HOMEKEYDIR ".brlkeys"
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<em>BrlAPI</em> 's $HOME settings directory
<p>
this directory will contain per-user configuration </td>
</tr>
</table>
<a name="a9" doxytag="brlapi.h::BRLAPI_HOMEKEYEXT"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> #define BRLAPI_HOMEKEYEXT ".kbd"
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<em>BrlAPI</em> 's key binding suffix </td>
</tr>
</table>
<hr><h2>Typedef Documentation</h2>
<a name="a0" doxytag="brlapi.h::brl_keycode_t"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> typedef uint32_t brl_keycode_t
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
type for key codes
<p>
Its size is 32 bits, so driver implementors have to restrict themselves to a 32 bit space. </td>
</tr>
</table>
<hr><h2>Function Documentation</h2>
<a name="a4" doxytag="brlapi.h::brlapi_ignoreKeys"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int brlapi_ignoreKeys </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a> </td>
<td class="mdname" nowrap> <em>x</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap><a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a> </td>
<td class="mdname" nowrap> <em>y</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Ignore some key presses from the braille keyboard
<p>
This function asks the server to give keys between x and y to <em>brltty</em>, rather than returning them to the application via brlapi_read(Key|Command|Binding)()
<p>
<dl compact><dt><b>Note: </b></dt><dd>
The given codes are either raw keycodes if BRLKEYCODES was given to <a class="el" href="group__brlapi__tty.html#a0">brlapi_getTty()</a>, or <em>brltty</em> commands if BRLCOMMANDS was given. </dl> </td>
</tr>
</table>
<a name="a3" doxytag="brlapi.h::brlapi_readBinding"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int brlapi_readBinding </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">int </td>
<td class="mdname" nowrap> <em>block</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap>const char ** </td>
<td class="mdname" nowrap> <em>code</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
read a key binding from the braille keyboard
<p>
This function returns a command name, as bound in user's configuration file: if the read is successful, a pointer on a string is returned, this is the string defined in $HOME/.brlkeys/appli-xy.kbd for the key which was read, else <code>NULL</code> is returned<dl compact><dt><b>Parameters: </b></dt><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>block</em> </td><td>
tells whether the call should block until a key is pressed (1) or should only probe key presses (0). </td></tr>
<tr><td valign=top><em>code</em> </td><td>
holds the key string if a key press is indeed read.</td></tr>
</table>
</dl>It can be called only if a <a class="el" href="structbrlapi__keybinding__t.html">brlapi_keybinding_t</a> structure was filled and given to <a class="el" href="group__brlapi__tty.html#a0">brlapi_getTty()</a>
<p>
<dl compact><dt><b>Returns: </b></dt><dd>
-1 on error and *code is then undefined, 0 if block was 0 and no key was pressed so far, or 1 and *code holds the key string. </dl> </td>
</tr>
</table>
<a name="a2" doxytag="brlapi.h::brlapi_readCommand"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int brlapi_readCommand </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">int </td>
<td class="mdname" nowrap> <em>block</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap><a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a> * </td>
<td class="mdname" nowrap> <em>code</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Read a command from the braille keyboard
<p>
This function returns <em>brltty</em> commands, as described in <code><brltty/brldefs.h></code> . These are hence pretty driver-independent, and should be used by default when no other option is possible.
<p>
It can be called only if BRLCOMMANDS was given to <a class="el" href="group__brlapi__tty.html#a0">brlapi_getTty()</a>
<p>
By default, all commands but those which restart drivers and switch virtual terminals are returned to the application and not to brltty. If the application doesn't want to see some command events, it should call <a class="el" href="group__brlapi__keys.html#a4">brlapi_ignoreKeys()</a><dl compact><dt><b>Parameters: </b></dt><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>block</em> </td><td>
tells whether the call should block until a key is pressed (1) or should only probe key presses (0). </td></tr>
<tr><td valign=top><em>code</em> </td><td>
holds the command code if a key press is indeed read.</td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>
-1 on error and *code is then undefined, 0 if block was 0 and no key was pressed so far, or 1 and *code holds the command code. </dl> </td>
</tr>
</table>
<a name="a1" doxytag="brlapi.h::brlapi_readKey"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int brlapi_readKey </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">int </td>
<td class="mdname" nowrap> <em>block</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap><a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a> * </td>
<td class="mdname" nowrap> <em>code</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Read a key from the braille keyboard
<p>
This function returns raw keycodes, as specified by the terminal driver. It generally corresponds to the code the terminal tells to the driver.
<p>
This should only be used to application which are dedicated to a particular braille terminal. Hence, checking the terminal type thanks to a call to <a class="el" href="group__brlapi__info.html#a0">brlapi_getDriverId()</a> or even <a class="el" href="group__brlapi__info.html#a1">brlapi_getDriverName()</a> before getting tty control is a pretty good idea.
<p>
It can be called only if BRLKEYCODES was given to <a class="el" href="group__brlapi__tty.html#a0">brlapi_getTty()</a>
<p>
By default, all the keypresses will be passed to the client, none will go through brltty, so the application will have to handle console switching itself.<dl compact><dt><b>Parameters: </b></dt><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>block</em> </td><td>
tells whether the call should block until a key is pressed (1) or should only probe key presses (0), </td></tr>
<tr><td valign=top><em>code</em> </td><td>
holds the key code if a key press is indeed read.</td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>
-1 on error and *code is then undefined, 0 if block was 0 and no key was pressed so far, or 1 and *code holds the key code. </dl> </td>
</tr>
</table>
<a name="a5" doxytag="brlapi.h::brlapi_unignoreKeys"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int brlapi_unignoreKeys </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a> </td>
<td class="mdname" nowrap> <em>x</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap><a class="el" href="group__brlapi__keys.html#a0">brl_keycode_t</a> </td>
<td class="mdname" nowrap> <em>y</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Unignore some key presses from the braille keyboard
<p>
This function asks the server to return keys between x and y to the application, and not give them to <em>brltty</em>.
<p>
<dl compact><dt><b>Note: </b></dt><dd>
You shouldn't ask the server to give you key presses which are usually used to switch between TTYs, unless you really know what you are doing !</dl><dl compact><dt><b>Note: </b></dt><dd>
The given codes are either raw keycodes if BRLKEYCODES was given to <a class="el" href="group__brlapi__tty.html#a0">brlapi_getTty()</a>, or <em>brltty</em> commands if BRLCOMMANDS was given. </dl> </td>
</tr>
</table>
<hr><address style="align: right;"><small>Generated on Thu Jan 15 13:21:28 2004 for BrlAPI by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.2.18 </small></address>
</body>
</html>
|