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

Side by Side Diff: trunk/src/device/bluetooth/bluetooth_device_mac.mm

Issue 227493006: Revert 262175 "* Replace "read" method with onReceiveXxx events." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "device/bluetooth/bluetooth_device_mac.h" 5 #include "device/bluetooth/bluetooth_device_mac.h"
6 6
7 #include <IOBluetooth/Bluetooth.h> 7 #include <IOBluetooth/Bluetooth.h>
8 #import <IOBluetooth/objc/IOBluetoothDevice.h> 8 #import <IOBluetooth/objc/IOBluetoothDevice.h>
9 #import <IOBluetooth/objc/IOBluetoothSDPServiceRecord.h> 9 #import <IOBluetooth/objc/IOBluetoothSDPServiceRecord.h>
10 #import <IOBluetooth/objc/IOBluetoothSDPUUID.h> 10 #import <IOBluetooth/objc/IOBluetoothSDPUUID.h>
(...skipping 18 matching lines...) Expand all
29 - (NSString*)addressString; 29 - (NSString*)addressString;
30 - (NSString*)name; 30 - (NSString*)name;
31 - (unsigned int)classOfDevice; 31 - (unsigned int)classOfDevice;
32 - (NSArray*)services; 32 - (NSArray*)services;
33 @end 33 @end
34 34
35 #endif // MAC_OS_X_VERSION_10_7 35 #endif // MAC_OS_X_VERSION_10_7
36 36
37 namespace { 37 namespace {
38 38
39 const char kFailedToConnect[] = "Connection failed";
40
41 // Converts |uuid| to a IOBluetoothSDPUUID instance. 39 // Converts |uuid| to a IOBluetoothSDPUUID instance.
42 // 40 //
43 // |uuid| must be in the format of XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX. 41 // |uuid| must be in the format of XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
44 IOBluetoothSDPUUID* GetIOBluetoothSDPUUID(const std::string& uuid) { 42 IOBluetoothSDPUUID* GetIOBluetoothSDPUUID(const std::string& uuid) {
45 DCHECK(uuid.size() == 36); 43 DCHECK(uuid.size() == 36);
46 DCHECK(uuid[8] == '-'); 44 DCHECK(uuid[8] == '-');
47 DCHECK(uuid[13] == '-'); 45 DCHECK(uuid[13] == '-');
48 DCHECK(uuid[18] == '-'); 46 DCHECK(uuid[18] == '-');
49 DCHECK(uuid[23] == '-'); 47 DCHECK(uuid[23] == '-');
50 std::string numbers_only = uuid; 48 std::string numbers_only = uuid;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (record != nil) { 187 if (record != nil) {
190 BluetoothServiceRecordMac service_record(record); 188 BluetoothServiceRecordMac service_record(record);
191 scoped_refptr<BluetoothSocket> socket( 189 scoped_refptr<BluetoothSocket> socket(
192 BluetoothSocketMac::CreateBluetoothSocket(service_record)); 190 BluetoothSocketMac::CreateBluetoothSocket(service_record));
193 if (socket.get() != NULL) 191 if (socket.get() != NULL)
194 callback.Run(socket); 192 callback.Run(socket);
195 } 193 }
196 } 194 }
197 195
198 void BluetoothDeviceMac::ConnectToProfile( 196 void BluetoothDeviceMac::ConnectToProfile(
199 BluetoothProfile* profile, 197 device::BluetoothProfile* profile,
200 const base::Closure& callback, 198 const base::Closure& callback,
201 const ConnectToProfileErrorCallback& error_callback) { 199 const ErrorCallback& error_callback) {
202 if (static_cast<BluetoothProfileMac*>(profile)->Connect(device_)) 200 if (static_cast<BluetoothProfileMac*>(profile)->Connect(device_))
203 callback.Run(); 201 callback.Run();
204 else 202 else
205 error_callback.Run(kFailedToConnect); 203 error_callback.Run();
206 } 204 }
207 205
208 void BluetoothDeviceMac::SetOutOfBandPairingData( 206 void BluetoothDeviceMac::SetOutOfBandPairingData(
209 const BluetoothOutOfBandPairingData& data, 207 const BluetoothOutOfBandPairingData& data,
210 const base::Closure& callback, 208 const base::Closure& callback,
211 const ErrorCallback& error_callback) { 209 const ErrorCallback& error_callback) {
212 NOTIMPLEMENTED(); 210 NOTIMPLEMENTED();
213 } 211 }
214 212
215 void BluetoothDeviceMac::ClearOutOfBandPairingData( 213 void BluetoothDeviceMac::ClearOutOfBandPairingData(
216 const base::Closure& callback, 214 const base::Closure& callback,
217 const ErrorCallback& error_callback) { 215 const ErrorCallback& error_callback) {
218 NOTIMPLEMENTED(); 216 NOTIMPLEMENTED();
219 } 217 }
220 218
221 } // namespace device 219 } // namespace device
OLDNEW
« no previous file with comments | « trunk/src/device/bluetooth/bluetooth_device_mac.h ('k') | trunk/src/device/bluetooth/bluetooth_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698