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

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: Use scoped_ptr and base::Passed() 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 class CHROMEOS_EXPORT BluetoothSocketExperimentalChromeOS
31 : public device::BluetoothSocket {
32 public:
33 // BluetoothSocket override.
34 virtual bool Receive(net::GrowableIOBuffer* buffer) OVERRIDE;
35 virtual bool Send(net::DrainableIOBuffer* buffer) OVERRIDE;
36 virtual std::string GetLastErrorMessage() const OVERRIDE;
37
38 // Create an instance of a BluetoothSocket from the passed file descriptor
39 // received over D-Bus in |fd|, the descriptor will be taken from that object
40 // and ownership passed to the returned object.
41 static scoped_refptr<device::BluetoothSocket> Create(
42 dbus::FileDescriptor* fd);
43
44 protected:
45 virtual ~BluetoothSocketExperimentalChromeOS();
46
47 private:
48 BluetoothSocketExperimentalChromeOS(int fd);
49
50 // The different socket types have different reading patterns; l2cap sockets
51 // have to be read with boundaries between datagrams preserved while rfcomm
52 // sockets do not.
53 enum SocketType {
54 L2CAP,
55 RFCOMM
56 };
57
58 // File descriptor and socket type of the socket.
59 const int fd_;
60 SocketType socket_type_;
61
62 // Last error message, set during Receive() and Send() and retrieved using
63 // GetLastErrorMessage().
64 std::string error_message_;
65
66 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketExperimentalChromeOS);
67 };
68
69 } // namespace chromeos
70
71 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_EXPERIMENTAL_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698