OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "device/bluetooth/bluetooth_rfcomm_channel_mac.h" | 5 #include "device/bluetooth/bluetooth_rfcomm_channel_mac.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "device/bluetooth/bluetooth_device_mac.h" | 8 #include "device/bluetooth/bluetooth_device_mac.h" |
9 #include "device/bluetooth/bluetooth_socket_mac.h" | 9 #include "device/bluetooth/bluetooth_socket_mac.h" |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return; | 103 return; |
104 | 104 |
105 // Now that the socket is set, it's safe to associate a delegate, which can | 105 // Now that the socket is set, it's safe to associate a delegate, which can |
106 // call back to the socket. | 106 // call back to the socket. |
107 DCHECK(!delegate_); | 107 DCHECK(!delegate_); |
108 delegate_.reset( | 108 delegate_.reset( |
109 [[BluetoothRfcommChannelDelegate alloc] initWithChannel:this]); | 109 [[BluetoothRfcommChannelDelegate alloc] initWithChannel:this]); |
110 [channel_ setDelegate:delegate_]; | 110 [channel_ setDelegate:delegate_]; |
111 } | 111 } |
112 | 112 |
113 std::string BluetoothRfcommChannelMac::GetDeviceAddress() { | 113 IOBluetoothDevice* BluetoothRfcommChannelMac::GetDevice() { |
114 return BluetoothDeviceMac::GetDeviceAddress([channel_ getDevice]); | 114 return [channel_ getDevice]; |
115 } | 115 } |
116 | 116 |
117 uint16_t BluetoothRfcommChannelMac::GetOutgoingMTU() { | 117 uint16_t BluetoothRfcommChannelMac::GetOutgoingMTU() { |
118 return [channel_ getMTU]; | 118 return [channel_ getMTU]; |
119 } | 119 } |
120 | 120 |
121 IOReturn BluetoothRfcommChannelMac::WriteAsync(void* data, | 121 IOReturn BluetoothRfcommChannelMac::WriteAsync(void* data, |
122 uint16_t length, | 122 uint16_t length, |
123 void* refcon) { | 123 void* refcon) { |
124 DCHECK_LE(length, GetOutgoingMTU()); | 124 DCHECK_LE(length, GetOutgoingMTU()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 void* refcon, | 159 void* refcon, |
160 IOReturn status) { | 160 IOReturn status) { |
161 // Note: We use "CHECK" below to ensure we never run into unforeseen | 161 // Note: We use "CHECK" below to ensure we never run into unforeseen |
162 // occurrences of asynchronous callbacks, which could lead to data | 162 // occurrences of asynchronous callbacks, which could lead to data |
163 // corruption. | 163 // corruption. |
164 CHECK_EQ(channel_, channel); | 164 CHECK_EQ(channel_, channel); |
165 socket()->OnChannelWriteComplete(refcon, status); | 165 socket()->OnChannelWriteComplete(refcon, status); |
166 } | 166 } |
167 | 167 |
168 } // namespace device | 168 } // namespace device |
OLD | NEW |