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_l2cap_channel_mac.h" | 5 #include "device/bluetooth/bluetooth_l2cap_channel_mac.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/sdk_forward_declarations.h" | 8 #include "base/mac/sdk_forward_declarations.h" |
9 #include "device/bluetooth/bluetooth_device_mac.h" | 9 #include "device/bluetooth/bluetooth_device_mac.h" |
10 #include "device/bluetooth/bluetooth_socket_mac.h" | 10 #include "device/bluetooth/bluetooth_socket_mac.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 return; | 108 return; |
109 | 109 |
110 // Now that the socket is set, it's safe to associate a delegate, which can | 110 // Now that the socket is set, it's safe to associate a delegate, which can |
111 // call back to the socket. | 111 // call back to the socket. |
112 DCHECK(!delegate_); | 112 DCHECK(!delegate_); |
113 delegate_.reset( | 113 delegate_.reset( |
114 [[BluetoothL2capChannelDelegate alloc] initWithChannel:this]); | 114 [[BluetoothL2capChannelDelegate alloc] initWithChannel:this]); |
115 [channel_ setDelegate:delegate_]; | 115 [channel_ setDelegate:delegate_]; |
116 } | 116 } |
117 | 117 |
118 std::string BluetoothL2capChannelMac::GetDeviceAddress() { | 118 IOBluetoothDevice* BluetoothL2capChannelMac::GetDevice() { |
119 return BluetoothDeviceMac::GetDeviceAddress([channel_ getDevice]); | 119 return [channel_ getDevice]; |
120 } | 120 } |
121 | 121 |
122 uint16_t BluetoothL2capChannelMac::GetOutgoingMTU() { | 122 uint16_t BluetoothL2capChannelMac::GetOutgoingMTU() { |
123 return [channel_ outgoingMTU]; | 123 return [channel_ outgoingMTU]; |
124 } | 124 } |
125 | 125 |
126 IOReturn BluetoothL2capChannelMac::WriteAsync(void* data, | 126 IOReturn BluetoothL2capChannelMac::WriteAsync(void* data, |
127 uint16_t length, | 127 uint16_t length, |
128 void* refcon) { | 128 void* refcon) { |
129 DCHECK_LE(length, GetOutgoingMTU()); | 129 DCHECK_LE(length, GetOutgoingMTU()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 void* refcon, | 164 void* refcon, |
165 IOReturn status) { | 165 IOReturn status) { |
166 // Note: We use "CHECK" below to ensure we never run into unforeseen | 166 // Note: We use "CHECK" below to ensure we never run into unforeseen |
167 // occurrences of asynchronous callbacks, which could lead to data | 167 // occurrences of asynchronous callbacks, which could lead to data |
168 // corruption. | 168 // corruption. |
169 CHECK_EQ(channel_, channel); | 169 CHECK_EQ(channel_, channel); |
170 socket()->OnChannelWriteComplete(refcon, status); | 170 socket()->OnChannelWriteComplete(refcon, status); |
171 } | 171 } |
172 | 172 |
173 } // namespace device | 173 } // namespace device |
OLD | NEW |