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

Side by Side Diff: device/bluetooth/bluetooth_socket_experimental_chromeos.h

Issue 14487002: Bluetooth: Profile support for Chrome OS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unit tests, and class comments Created 7 years, 7 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 | Annotate | Revision Log
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 DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_EXPERIMENTAL_CHROMEOS_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_EXPERIMENTAL_CHROMEOS_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "chromeos/chromeos_export.h"
13 #include "device/bluetooth/bluetooth_socket.h"
14
15 namespace dbus {
16
17 class FileDescriptor;
18
19 } // namespace dbus
20
21 namespace net {
22
23 class DrainableIOBuffer;
24 class GrowableIOBuffer;
25
26 } // namespace net
27
28 namespace chromeos {
29
30 // The BluetoothSocketExperimentalChromeOS class is an alternate implementation
31 // of BluetoothSocket for the Chrome OS platform using the Bluetooth Smart
32 // capable backend. It will become the sole implementation for Chrome OS, and
33 // be renamed to BluetoothSocketChromeOS, once the backend is switched.
34 class CHROMEOS_EXPORT BluetoothSocketExperimentalChromeOS
35 : public device::BluetoothSocket {
36 public:
37 // BluetoothSocket override.
38 virtual bool Receive(net::GrowableIOBuffer* buffer) OVERRIDE;
39 virtual bool Send(net::DrainableIOBuffer* buffer) OVERRIDE;
40 virtual std::string GetLastErrorMessage() const OVERRIDE;
41
42 // Create an instance of a BluetoothSocket from the passed file descriptor
43 // received over D-Bus in |fd|, the descriptor will be taken from that object
44 // and ownership passed to the returned object.
45 static scoped_refptr<device::BluetoothSocket> Create(
46 dbus::FileDescriptor* fd);
47
48 protected:
49 virtual ~BluetoothSocketExperimentalChromeOS();
50
51 private:
52 BluetoothSocketExperimentalChromeOS(int fd);
53
54 // The different socket types have different reading patterns; l2cap sockets
55 // have to be read with boundaries between datagrams preserved while rfcomm
56 // sockets do not.
57 enum SocketType {
58 L2CAP,
59 RFCOMM
60 };
61
62 // File descriptor and socket type of the socket.
63 const int fd_;
64 SocketType socket_type_;
65
66 // Last error message, set during Receive() and Send() and retrieved using
67 // GetLastErrorMessage().
68 std::string error_message_;
69
70 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketExperimentalChromeOS);
71 };
72
73 } // namespace chromeos
74
75 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_EXPERIMENTAL_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698