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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth.gyp ('k') | device/bluetooth/bluetooth_channel_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_channel_mac.h
diff --git a/device/bluetooth/bluetooth_channel_mac.h b/device/bluetooth/bluetooth_channel_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..fa54d565cb7a1d2d113ad83931b29a567780fea1
--- /dev/null
+++ b/device/bluetooth/bluetooth_channel_mac.h
@@ -0,0 +1,59 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_CHANNEL_MAC_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_CHANNEL_MAC_H_
+
+#import <IOKit/IOReturn.h>
+
+#include <string>
+
+#include "base/macros.h"
+
+namespace device {
+
+class BluetoothSocketMac;
+
+// Wraps a native RFCOMM or L2CAP channel.
+class BluetoothChannelMac {
+ public:
+ BluetoothChannelMac();
+ virtual ~BluetoothChannelMac();
+
+ // Sets the channel's owning socket to |socket|. Should only be called if the
+ // socket was previously unset. Note: This can synchronously call back into
+ // socket->OnChannelOpenComplete().
+ virtual void SetSocket(BluetoothSocketMac* socket);
+
+ // Returns the Bluetooth address for the device associated with |this|
+ // channel.
+ virtual std::string GetDeviceAddress() = 0;
+
+ // Returns the outgoing MTU (maximum transmission unit) for the channel.
+ virtual uint16_t GetOutgoingMTU() = 0;
+
+ // Writes |data| of length |length| bytes into the channel. The |refcon| is a
+ // user-supplied value that gets passed to the write callback.
+ // Returns kIOReturnSuccess if the data was buffered successfully.
+ // If the return value is an error condition none of the data was sent.
+ // The number of bytes to be sent must not exceed the channel MTU.
+ //
+ // Once the data has been successfully passed to the hardware to be
+ // transmitted, the socket's method OnChannelWriteComplete() will be called
+ // with the |refcon| that was passed to this method.
+ virtual IOReturn WriteAsync(void* data, uint16_t length, void* refcon) = 0;
+
+ protected:
+ BluetoothSocketMac* socket() { return socket_; }
+
+ private:
+ // The socket that owns |this|.
+ BluetoothSocketMac* socket_;
+
+ DISALLOW_COPY_AND_ASSIGN(BluetoothChannelMac);
+};
+
+} // namespace device
+
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_CHANNEL_MAC_H_
« 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