Files.app: Provide detailed change information on onDirectoryChanged event
[chromium-blink-merge.git] / device / bluetooth / bluetooth_channel_mac.h
blob588a45c555817c79aaa628c048bec8e3a6ed7b59
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.
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_CHANNEL_MAC_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_CHANNEL_MAC_H_
8 #import <IOKit/IOReturn.h>
10 #include <string>
12 #include "base/macros.h"
14 @class IOBluetoothDevice;
16 namespace device {
18 class BluetoothSocketMac;
20 // Wraps a native RFCOMM or L2CAP channel.
21 class BluetoothChannelMac {
22 public:
23 BluetoothChannelMac();
24 virtual ~BluetoothChannelMac();
26 // Sets the channel's owning socket to |socket|. Should only be called if the
27 // socket was previously unset. Note: This can synchronously call back into
28 // socket->OnChannelOpenComplete().
29 virtual void SetSocket(BluetoothSocketMac* socket);
31 // Returns the Bluetooth address for the device associated with |this|
32 // channel.
33 std::string GetDeviceAddress();
35 // Returns the Bluetooth device associated with |this| channel.
36 virtual IOBluetoothDevice* GetDevice() = 0;
38 // Returns the outgoing MTU (maximum transmission unit) for the channel.
39 virtual uint16_t GetOutgoingMTU() = 0;
41 // Writes |data| of length |length| bytes into the channel. The |refcon| is a
42 // user-supplied value that gets passed to the write callback.
43 // Returns kIOReturnSuccess if the data was buffered successfully.
44 // If the return value is an error condition none of the data was sent.
45 // The number of bytes to be sent must not exceed the channel MTU.
47 // Once the data has been successfully passed to the hardware to be
48 // transmitted, the socket's method OnChannelWriteComplete() will be called
49 // with the |refcon| that was passed to this method.
50 virtual IOReturn WriteAsync(void* data, uint16_t length, void* refcon) = 0;
52 protected:
53 BluetoothSocketMac* socket() { return socket_; }
55 private:
56 // The socket that owns |this|.
57 BluetoothSocketMac* socket_;
59 DISALLOW_COPY_AND_ASSIGN(BluetoothChannelMac);
62 } // namespace device
64 #endif // DEVICE_BLUETOOTH_BLUETOOTH_CHANNEL_MAC_H_