OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_MAC_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_MAC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_MAC_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 public: | 36 public: |
37 // TODO(youngki): This method is deprecated; remove this method when | 37 // TODO(youngki): This method is deprecated; remove this method when |
38 // BluetoothServiceRecord is removed. | 38 // BluetoothServiceRecord is removed. |
39 static scoped_refptr<BluetoothSocket> CreateBluetoothSocket( | 39 static scoped_refptr<BluetoothSocket> CreateBluetoothSocket( |
40 const BluetoothServiceRecord& service_record); | 40 const BluetoothServiceRecord& service_record); |
41 | 41 |
42 static scoped_refptr<BluetoothSocket> CreateBluetoothSocket( | 42 static scoped_refptr<BluetoothSocket> CreateBluetoothSocket( |
43 IOBluetoothSDPServiceRecord* record); | 43 IOBluetoothSDPServiceRecord* record); |
44 | 44 |
45 // BluetoothSocket override | 45 // BluetoothSocket override |
46 virtual bool Receive(net::GrowableIOBuffer* buffer) OVERRIDE; | 46 virtual void Connect(const base::Closure& success_callback, |
47 virtual bool Send(net::DrainableIOBuffer* buffer) OVERRIDE; | 47 const ErrorCompletionCallback& error_callback) OVERRIDE; |
48 virtual std::string GetLastErrorMessage() const OVERRIDE; | 48 virtual void Disconnect(const base::Closure& callback) OVERRIDE; |
| 49 virtual void Receive(int count, |
| 50 const ReceiveCompletionCallback& success_callback, |
| 51 const ReceiveErrorCompletionCallback& error_callback) |
| 52 OVERRIDE; |
| 53 virtual void Send(scoped_refptr<net::DrainableIOBuffer> buffer, |
| 54 const SendCompletionCallback& success_callback, |
| 55 const ErrorCompletionCallback& error_callback) OVERRIDE; |
49 | 56 |
50 // called by BluetoothRFCOMMChannelDelegate. | 57 // called by BluetoothRFCOMMChannelDelegate. |
51 void OnDataReceived(IOBluetoothRFCOMMChannel* rfcomm_channel, | 58 void OnDataReceived(IOBluetoothRFCOMMChannel* rfcomm_channel, |
52 void* data, | 59 void* data, |
53 size_t length); | 60 size_t length); |
54 | 61 |
55 protected: | 62 protected: |
56 virtual ~BluetoothSocketMac(); | 63 virtual ~BluetoothSocketMac(); |
57 | 64 |
58 private: | 65 private: |
59 explicit BluetoothSocketMac(IOBluetoothRFCOMMChannel* rfcomm_channel); | 66 explicit BluetoothSocketMac(IOBluetoothRFCOMMChannel* rfcomm_channel); |
60 | 67 |
61 void ResetIncomingDataBuffer(); | 68 void ResetIncomingDataBuffer(); |
62 | 69 |
63 IOBluetoothRFCOMMChannel* rfcomm_channel_; | 70 IOBluetoothRFCOMMChannel* rfcomm_channel_; |
64 BluetoothRFCOMMChannelDelegate* delegate_; | 71 BluetoothRFCOMMChannelDelegate* delegate_; |
65 scoped_refptr<net::GrowableIOBuffer> incoming_data_buffer_; | 72 scoped_refptr<net::GrowableIOBuffer> incoming_data_buffer_; |
66 std::string error_message_; | 73 std::string error_message_; |
67 | 74 |
68 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketMac); | 75 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketMac); |
69 }; | 76 }; |
70 | 77 |
71 } // namespace device | 78 } // namespace device |
72 | 79 |
73 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_MAC_H_ | 80 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_MAC_H_ |
OLD | NEW |