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

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

Issue 328903002: Factor out a BluetoothChannelMac base class and a BluetoothRfcommChannelMac subclass. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git-add new files Created 6 years, 6 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
« no previous file with comments | « device/bluetooth/bluetooth.gyp ('k') | device/bluetooth/bluetooth_channel_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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_CHANNEL_MAC_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_CHANNEL_MAC_H_
7
8 #import <IOKit/IOReturn.h>
9
10 #include <string>
11
12 #include "base/macros.h"
13
14 namespace device {
15
16 class BluetoothSocketMac;
17
18 // Wraps a native RFCOMM or L2CAP channel.
19 class BluetoothChannelMac {
20 public:
21 BluetoothChannelMac();
22 virtual ~BluetoothChannelMac();
23
24 // Sets the channel's owning socket to |socket|. Should only be called if the
25 // socket was previously unset. Note: This can synchronously call back into
26 // socket->OnChannelOpenComplete().
27 virtual void SetSocket(BluetoothSocketMac* socket);
28
29 // Returns the Bluetooth address for the device associated with |this|
30 // channel.
31 virtual std::string GetDeviceAddress() = 0;
32
33 // Returns the outgoing MTU (maximum transmission unit) for the channel.
34 virtual uint16_t GetOutgoingMTU() = 0;
35
36 // Writes |data| of length |length| bytes into the channel. The |refcon| is a
37 // user-supplied value that gets passed to the write callback.
38 // Returns kIOReturnSuccess if the data was buffered successfully.
39 // If the return value is an error condition none of the data was sent.
40 // The number of bytes to be sent must not exceed the channel MTU.
41 //
42 // Once the data has been successfully passed to the hardware to be
43 // transmitted, the socket's method OnChannelWriteComplete() will be called
44 // with the |refcon| that was passed to this method.
45 virtual IOReturn WriteAsync(void* data, uint16_t length, void* refcon) = 0;
46
47 protected:
48 BluetoothSocketMac* socket() { return socket_; }
49
50 private:
51 // The socket that owns |this|.
52 BluetoothSocketMac* socket_;
53
54 DISALLOW_COPY_AND_ASSIGN(BluetoothChannelMac);
55 };
56
57 } // namespace device
58
59 #endif // DEVICE_BLUETOOTH_BLUETOOTH_CHANNEL_MAC_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth.gyp ('k') | device/bluetooth/bluetooth_channel_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698