Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: chrome/browser/extensions/api/braille_display_private/brlapi_connection.h

Issue 13355002: Implement chrome.brailleDisplayPrivate API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 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.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRLAPI_BRLAPI_CONN ECTION_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRLAPI_BRLLAPI_CON NECTION_H_
7
8 #include "base/basictypes.h"
9 #include "base/callback_forward.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "library_loaders/libbrlapi.h"
12
13 namespace extensions {
14 namespace api {
15 namespace braille_display_private {
16
17 // A connection to the brlapi server.
18 class BrlapiConnection {
19 public:
20 typedef base::Closure OnDataReadyCallback;
21
22 static scoped_ptr<BrlapiConnection> Create(LibBrlapiLoader* loader);
23
24 virtual ~BrlapiConnection();
25
26 virtual bool Connect(const OnDataReadyCallback& onDataReady) = 0;
27
28 virtual void Disconnect() = 0;
29
30 virtual bool Connected() = 0;
31
32 // Gets the last brlapi error on this thread.
dmazzoni 2013/09/10 19:50:08 What do you mean by thread here? How are there mul
33 virtual brlapi_error_t* BrlapiError() = 0;
34
35 // Gets a description of the last brlapi error for this thread, useful
36 // for logging.
37 virtual std::string BrlapiStrError() = 0;
38
39 // Gets the total size of the display, which may be 0 if no display is
40 // present, returning true on success. Note that this is cached in the
41 // brlapi client so it is cheap.
42 virtual bool GetDisplaySize(size_t* size) = 0;
43
44 // Sends the specified cells to the display. The array size must
45 // be equal to what GetDisplaySize() last returned for this connection.
46 virtual bool WriteDots(const unsigned char* cells) = 0;
47
48 // Reads the next keyboard command, returning true on success.
49 // Returns < 0 on error, 0 if no more keys are pending and > 0
50 // on success, in which case keyCode will be set to the key command
51 // value.
52 virtual int ReadKey(brlapi_keyCode_t* keyCode) = 0;
53
54 protected:
55 BrlapiConnection();
56 DISALLOW_COPY_AND_ASSIGN(BrlapiConnection);
57 };
58
59 } // braille_display_private
60 } // api
61 } // extensions
62
63 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRLAPI_BRLAPI_CO NNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698