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

Side by Side Diff: device/bluetooth/bluetooth_remote_gatt_service_mac.mm

Issue 1948763003: Adding support for service scan on OS X (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup
Patch Set: Adding disconnect with error Created 4 years, 7 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
OLDNEW
(Empty)
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.
4
ortuno 2016/05/06 16:03:34 nit: #include <vector>
jlebel 2016/05/07 00:16:12 Done.
5 #include "device/bluetooth/bluetooth_remote_gatt_service_mac.h"
6
7 #import <CoreBluetooth/CoreBluetooth.h>
8
9 #include "base/logging.h"
10 #include "device/bluetooth/bluetooth_adapter_mac.h"
11 #include "device/bluetooth/bluetooth_low_energy_device_mac.h"
12 #include "device/bluetooth/bluetooth_uuid.h"
13
14 namespace device {
15
16 BluetoothRemoteGattServiceMac::BluetoothRemoteGattServiceMac(
17 BluetoothLowEnergyDeviceMac* bluetooth_device_mac,
18 CBService* service,
19 bool primary)
ortuno 2016/05/06 16:03:34 nit: is_primary
jlebel 2016/05/07 00:16:11 Done.
20 : bluetooth_device_mac_(bluetooth_device_mac),
21 service_(service, base::scoped_policy::RETAIN),
ortuno 2016/05/06 16:03:34 This might be my Objective-C ignorance showing, bu
jlebel 2016/05/07 00:16:11 BluetoothRemoteGattServiceMac needs CBService inst
ortuno 2016/05/09 19:54:00 Ah I see. Thanks for the explanation.
22 is_primary_(primary) {}
23
24 BluetoothRemoteGattServiceMac::~BluetoothRemoteGattServiceMac() {
25 bluetooth_device_mac_->GetAdapter()->NotifyGattServiceRemoved(this);
26 }
27
28 std::string BluetoothRemoteGattServiceMac::GetIdentifier() const {
29 const std::string string_uuid(
ortuno 2016/05/06 16:03:33 I think we should create and store the identifier
jlebel 2016/05/07 00:16:12 Done.
30 BluetoothAdapterMac::StringWithCBUUID([service_.get() UUID]));
31 return
32 [NSString stringWithFormat:@"%s-%p", string_uuid.c_str(), (void*)service_]
33 .UTF8String;
34 }
35
36 BluetoothUUID BluetoothRemoteGattServiceMac::GetUUID() const {
37 return BluetoothAdapterMac::BluetoothUUIDWithCBUUID([service_.get() UUID]);
ortuno 2016/05/06 16:03:34 I think we should also save the UUID.
jlebel 2016/05/07 00:16:12 Done.
38 }
39
40 bool BluetoothRemoteGattServiceMac::IsPrimary() const {
41 return is_primary_;
42 }
43
44 BluetoothDevice* BluetoothRemoteGattServiceMac::GetDevice() const {
45 return bluetooth_device_mac_;
46 }
47
48 std::vector<BluetoothRemoteGattCharacteristic*>
49 BluetoothRemoteGattServiceMac::GetCharacteristics() const {
50 NOTIMPLEMENTED();
51 std::vector<BluetoothRemoteGattCharacteristic*> characteristics;
52 return characteristics;
ortuno 2016/05/06 16:03:34 nit: I think you can just do: return std::vector<
jlebel 2016/05/07 00:16:11 Done.
53 }
54
55 std::vector<BluetoothRemoteGattService*>
56 BluetoothRemoteGattServiceMac::GetIncludedServices() const {
57 NOTIMPLEMENTED();
58 std::vector<BluetoothRemoteGattService*> included_services;
59 return included_services;
ortuno 2016/05/06 16:03:34 Same here.
jlebel 2016/05/07 00:16:12 Done.
60 }
61
62 BluetoothRemoteGattCharacteristic*
63 BluetoothRemoteGattServiceMac::GetCharacteristic(
64 const std::string& identifier) const {
65 NOTIMPLEMENTED();
66 return nil;
ortuno 2016/05/06 16:03:34 nit: return nullptr;
jlebel 2016/05/07 00:16:11 Done.
67 }
68
69 void BluetoothRemoteGattServiceMac::Register(
70 const base::Closure& callback,
71 const ErrorCallback& error_callback) {
72 NOTIMPLEMENTED();
73 }
74 void BluetoothRemoteGattServiceMac::Unregister(
ortuno 2016/05/06 16:03:33 As mentioned in the .h, you no longer need these t
jlebel 2016/05/07 00:16:12 Done.
75 const base::Closure& callback,
76 const ErrorCallback& error_callback) {
77 NOTIMPLEMENTED();
78 }
79
80 CBService* BluetoothRemoteGattServiceMac::GetService() const {
81 return service_.get();
82 }
83
84 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698