1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Braille display access private API.
6 namespace brailleDisplayPrivate
{
7 // Braille display keyboard command.
21 // A keyboard event. This is not a standard keyboard event because
22 // braille display keyboards look significantly different from standard
26 // 0-based display position for commands that involve a routing key.
27 long? displayPosition
;
28 // Braille dot keys that were pressed, stored in the low-order bits.
29 // Dot 1 is stored in bit 0, dot2 in bit 1, etc.
31 // DOM keyboard event code. This is present when command is standard_key
32 // and the braille display event represents a non-alphanumeric key such
33 // as an arrow key or function key.
34 // The value is as defined by the |code| property in
35 // http://www.w3.org/TR/uievents/#keyboard-event-interface
36 DOMString? standardKeyCode
;
37 // DOM keyboard event character value. This is present if the
38 // braille key event corresponds to a character.
39 DOMString? standardKeyChar
;
40 // Whether the space key was pressed.
42 // Whether the alt key was pressed.
44 // Whether the shift key was pressed.
46 // Whether the ctrl key was pressed.
50 // The current braille display state.
51 dictionary DisplayState
{
52 // Whether a braille display is currently available.
54 // Number of braille cells on the currently connected display.
58 callback DisplayStateCallback
= void(DisplayState result
);
61 // Gets the current display state.
62 static
void getDisplayState
(DisplayStateCallback
callback);
63 // Write the given dot patterns to the display. The buffer contains one
64 // byte for each braille cell on the display, starting from the leftmost
65 // cell. Each byte contains a bit pattern indicating which dots should be
66 // raised in the corresponding cell with the low-order bit representing
67 // dot 1 and so on until bit 7 which corresponds to dot 8. If the number
68 // of bytes in the buffer is not equal to the display size, the buffer
69 // will either be clipped or padded with blank cells on the right.
70 static
void writeDots
(ArrayBuffer cells
);
74 // Fired when a braille display is connected or disconnected.
75 static
void onDisplayStateChanged
(DisplayState state
);
76 // Fired when an input event is received from the display.
77 static
void onKeyEvent
(KeyEvent event
);