OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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. |
| 4 |
| 5 // Braille display access private API. |
| 6 namespace brailleDisplayPrivate { |
| 7 // Braille display keyboard command. |
| 8 enum KeyCommand { |
| 9 line_up, |
| 10 line_down, |
| 11 pan_left, |
| 12 pan_right, |
| 13 top, |
| 14 bottom, |
| 15 routing, |
| 16 secondary_routing, |
| 17 dots, |
| 18 standard_key |
| 19 }; |
| 20 |
| 21 // A keyboard event. This is not a standard keyboard event because |
| 22 // braille display keyboards look significantly different from standard |
| 23 // keyboards. |
| 24 dictionary KeyEvent { |
| 25 KeyCommand command; |
| 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. |
| 30 long? brailleDots; |
| 31 // DOM keyboard event for a key that corresponds to a standard key. |
| 32 DOMString? standardKeyName; |
| 33 // Whether the space key was pressed. |
| 34 boolean? spaceKey; |
| 35 // Whether the alt key was pressed. |
| 36 boolean? altKey; |
| 37 // Whether the shift key was pressed. |
| 38 boolean? shiftKey; |
| 39 // Whether the ctrl key was pressed. |
| 40 boolean? ctrlKey; |
| 41 }; |
| 42 |
| 43 // The current braille display state. |
| 44 dictionary DisplayState { |
| 45 // Whether a braille display is currently available. |
| 46 boolean available; |
| 47 // Number of braille cells on the currently connected display. |
| 48 long? textCellCount; |
| 49 }; |
| 50 |
| 51 callback DisplayStateCallback = void(DisplayState result); |
| 52 |
| 53 interface Functions { |
| 54 // Gets the current display state. |
| 55 static void getDisplayState(DisplayStateCallback callback); |
| 56 // Write the given dot patterns to the display. The buffer contains one |
| 57 // byte for each braille cell on the display, starting from the leftmost |
| 58 // cell. Each byte contains a bit pattern indicating which dots should be |
| 59 // raised in the corresponding cell with the low-order bit representing |
| 60 // dot 1 and so on until bit 7 which corresponds to dot 8. If the number |
| 61 // of bytes in the buffer is not equal to the display size, the buffer |
| 62 // will either be clipped or padded with blank cells on the right. |
| 63 static void writeDots(ArrayBuffer cells); |
| 64 }; |
| 65 |
| 66 interface Events { |
| 67 // Fired when a braille display is connected or disconnected. |
| 68 static void onDisplayStateChanged(DisplayState state); |
| 69 // Fired when an input event is received from the display. |
| 70 static void onKeyEvent(KeyEvent event); |
| 71 }; |
| 72 }; |
OLD | NEW |