OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_low_energy_device_mac.h" | 5 #include "device/bluetooth/bluetooth_low_energy_device_mac.h" |
6 | 6 |
7 #import <CoreFoundation/CoreFoundation.h> | 7 #import <CoreFoundation/CoreFoundation.h> |
| 8 #include <stddef.h> |
8 | 9 |
9 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
10 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
11 #include "base/mac/sdk_forward_declarations.h" | 12 #include "base/mac/sdk_forward_declarations.h" |
12 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
14 #include "device/bluetooth/bluetooth_adapter_mac.h" | 15 #include "device/bluetooth/bluetooth_adapter_mac.h" |
15 #include "device/bluetooth/bluetooth_device.h" | 16 #include "device/bluetooth/bluetooth_device.h" |
16 | 17 |
17 using device::BluetoothDevice; | 18 using device::BluetoothDevice; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 for (CBUUID* uuid in overflow_service_uuids) { | 74 for (CBUUID* uuid in overflow_service_uuids) { |
74 advertised_uuids_.insert( | 75 advertised_uuids_.insert( |
75 BluetoothUUID(std::string([[uuid UUIDString] UTF8String]))); | 76 BluetoothUUID(std::string([[uuid UUIDString] UTF8String]))); |
76 } | 77 } |
77 } | 78 } |
78 | 79 |
79 std::string BluetoothLowEnergyDeviceMac::GetIdentifier() const { | 80 std::string BluetoothLowEnergyDeviceMac::GetIdentifier() const { |
80 return identifier_; | 81 return identifier_; |
81 } | 82 } |
82 | 83 |
83 uint32 BluetoothLowEnergyDeviceMac::GetBluetoothClass() const { | 84 uint32_t BluetoothLowEnergyDeviceMac::GetBluetoothClass() const { |
84 return 0x1F00; // Unspecified Device Class | 85 return 0x1F00; // Unspecified Device Class |
85 } | 86 } |
86 | 87 |
87 std::string BluetoothLowEnergyDeviceMac::GetAddress() const { | 88 std::string BluetoothLowEnergyDeviceMac::GetAddress() const { |
88 return hash_address_; | 89 return hash_address_; |
89 } | 90 } |
90 | 91 |
91 BluetoothDevice::VendorIDSource BluetoothLowEnergyDeviceMac::GetVendorIDSource() | 92 BluetoothDevice::VendorIDSource BluetoothLowEnergyDeviceMac::GetVendorIDSource() |
92 const { | 93 const { |
93 return VENDOR_ID_UNKNOWN; | 94 return VENDOR_ID_UNKNOWN; |
94 } | 95 } |
95 | 96 |
96 uint16 BluetoothLowEnergyDeviceMac::GetVendorID() const { | 97 uint16_t BluetoothLowEnergyDeviceMac::GetVendorID() const { |
97 return 0; | 98 return 0; |
98 } | 99 } |
99 | 100 |
100 uint16 BluetoothLowEnergyDeviceMac::GetProductID() const { | 101 uint16_t BluetoothLowEnergyDeviceMac::GetProductID() const { |
101 return 0; | 102 return 0; |
102 } | 103 } |
103 | 104 |
104 uint16 BluetoothLowEnergyDeviceMac::GetDeviceID() const { | 105 uint16_t BluetoothLowEnergyDeviceMac::GetDeviceID() const { |
105 return 0; | 106 return 0; |
106 } | 107 } |
107 | 108 |
108 int BluetoothLowEnergyDeviceMac::GetRSSI() const { | 109 int BluetoothLowEnergyDeviceMac::GetRSSI() const { |
109 return rssi_; | 110 return rssi_; |
110 } | 111 } |
111 | 112 |
112 bool BluetoothLowEnergyDeviceMac::IsPaired() const { | 113 bool BluetoothLowEnergyDeviceMac::IsPaired() const { |
113 return false; | 114 return false; |
114 } | 115 } |
(...skipping 12 matching lines...) Expand all Loading... |
127 | 128 |
128 bool BluetoothLowEnergyDeviceMac::IsConnecting() const { | 129 bool BluetoothLowEnergyDeviceMac::IsConnecting() const { |
129 return false; | 130 return false; |
130 } | 131 } |
131 | 132 |
132 BluetoothDevice::UUIDList BluetoothLowEnergyDeviceMac::GetUUIDs() const { | 133 BluetoothDevice::UUIDList BluetoothLowEnergyDeviceMac::GetUUIDs() const { |
133 return BluetoothDevice::UUIDList(advertised_uuids_.begin(), | 134 return BluetoothDevice::UUIDList(advertised_uuids_.begin(), |
134 advertised_uuids_.end()); | 135 advertised_uuids_.end()); |
135 } | 136 } |
136 | 137 |
137 int16 BluetoothLowEnergyDeviceMac::GetInquiryRSSI() const { | 138 int16_t BluetoothLowEnergyDeviceMac::GetInquiryRSSI() const { |
138 return kUnknownPower; | 139 return kUnknownPower; |
139 } | 140 } |
140 | 141 |
141 int16 BluetoothLowEnergyDeviceMac::GetInquiryTxPower() const { | 142 int16_t BluetoothLowEnergyDeviceMac::GetInquiryTxPower() const { |
142 NOTIMPLEMENTED(); | 143 NOTIMPLEMENTED(); |
143 return kUnknownPower; | 144 return kUnknownPower; |
144 } | 145 } |
145 | 146 |
146 bool BluetoothLowEnergyDeviceMac::ExpectingPinCode() const { | 147 bool BluetoothLowEnergyDeviceMac::ExpectingPinCode() const { |
147 return false; | 148 return false; |
148 } | 149 } |
149 | 150 |
150 bool BluetoothLowEnergyDeviceMac::ExpectingPasskey() const { | 151 bool BluetoothLowEnergyDeviceMac::ExpectingPasskey() const { |
151 return false; | 152 return false; |
(...skipping 12 matching lines...) Expand all Loading... |
164 PairingDelegate* pairing_delegate, | 165 PairingDelegate* pairing_delegate, |
165 const base::Closure& callback, | 166 const base::Closure& callback, |
166 const ConnectErrorCallback& error_callback) { | 167 const ConnectErrorCallback& error_callback) { |
167 NOTIMPLEMENTED(); | 168 NOTIMPLEMENTED(); |
168 } | 169 } |
169 | 170 |
170 void BluetoothLowEnergyDeviceMac::SetPinCode(const std::string& pincode) { | 171 void BluetoothLowEnergyDeviceMac::SetPinCode(const std::string& pincode) { |
171 NOTIMPLEMENTED(); | 172 NOTIMPLEMENTED(); |
172 } | 173 } |
173 | 174 |
174 void BluetoothLowEnergyDeviceMac::SetPasskey(uint32 passkey) { | 175 void BluetoothLowEnergyDeviceMac::SetPasskey(uint32_t passkey) { |
175 NOTIMPLEMENTED(); | 176 NOTIMPLEMENTED(); |
176 } | 177 } |
177 | 178 |
178 void BluetoothLowEnergyDeviceMac::ConfirmPairing() { | 179 void BluetoothLowEnergyDeviceMac::ConfirmPairing() { |
179 NOTIMPLEMENTED(); | 180 NOTIMPLEMENTED(); |
180 } | 181 } |
181 | 182 |
182 void BluetoothLowEnergyDeviceMac::RejectPairing() { | 183 void BluetoothLowEnergyDeviceMac::RejectPairing() { |
183 NOTIMPLEMENTED(); | 184 NOTIMPLEMENTED(); |
184 } | 185 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 instanceMethodSignatureForSelector:@selector(state)] retain]); | 265 instanceMethodSignatureForSelector:@selector(state)] retain]); |
265 base::scoped_nsobject<NSInvocation> invocation( | 266 base::scoped_nsobject<NSInvocation> invocation( |
266 [[NSInvocation invocationWithMethodSignature:signature] retain]); | 267 [[NSInvocation invocationWithMethodSignature:signature] retain]); |
267 [invocation setTarget:peripheral_]; | 268 [invocation setTarget:peripheral_]; |
268 [invocation setSelector:@selector(state)]; | 269 [invocation setSelector:@selector(state)]; |
269 [invocation invoke]; | 270 [invocation invoke]; |
270 CBPeripheralState state = CBPeripheralStateDisconnected; | 271 CBPeripheralState state = CBPeripheralStateDisconnected; |
271 [invocation getReturnValue:&state]; | 272 [invocation getReturnValue:&state]; |
272 return state; | 273 return state; |
273 } | 274 } |
OLD | NEW |