Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <unordered_map> | |
| 14 #include <unordered_set> | 15 #include <unordered_set> |
| 15 #include <vector> | 16 #include <vector> |
| 16 | 17 |
| 17 #include "base/callback.h" | 18 #include "base/callback.h" |
| 18 #include "base/containers/scoped_ptr_hash_map.h" | 19 #include "base/containers/scoped_ptr_hash_map.h" |
| 19 #include "base/gtest_prod_util.h" | 20 #include "base/gtest_prod_util.h" |
| 20 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
| 21 #include "base/optional.h" | 22 #include "base/optional.h" |
| 22 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
| 23 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 | 313 |
| 313 // Returns the UUIDs of services for which the device advertises Service Data. | 314 // Returns the UUIDs of services for which the device advertises Service Data. |
| 314 // Returns an empty set if the adapter is not discovering. | 315 // Returns an empty set if the adapter is not discovering. |
| 315 UUIDSet GetServiceDataUUIDs() const; | 316 UUIDSet GetServiceDataUUIDs() const; |
| 316 | 317 |
| 317 // Returns a pointer to the Service Data for Service with |uuid|. Returns | 318 // Returns a pointer to the Service Data for Service with |uuid|. Returns |
| 318 // nullptr if |uuid| has no Service Data. | 319 // nullptr if |uuid| has no Service Data. |
| 319 const std::vector<uint8_t>* GetServiceDataForUUID( | 320 const std::vector<uint8_t>* GetServiceDataForUUID( |
| 320 const BluetoothUUID& uuid) const; | 321 const BluetoothUUID& uuid) const; |
| 321 | 322 |
| 323 // Returns advertised Manufacturer Data. Keys are 16 bits Manufacturer ID | |
|
ortuno
2016/10/14 00:15:10
s/ID/IDs/
puthik_chromium
2016/10/17 23:30:31
Done.
| |
| 324 // followed by its byte array value. Returns an empty map if the device | |
| 325 // does not advertise any Manufacturer Data. | |
| 326 // | |
| 327 // Note that only BlueZ support this now. This method returns an empty map | |
|
ortuno
2016/10/14 00:15:10
s/support/supports/
puthik_chromium
2016/10/17 23:30:31
Done.
| |
| 328 // on platform without BlueZ. | |
|
ortuno
2016/10/14 00:15:10
nit: on platforms that don't use BlueZ.
puthik_chromium
2016/10/17 23:30:31
Done.
| |
| 329 virtual std::unordered_map<uint16_t, std::vector<uint8_t>> | |
|
ortuno
2016/10/14 00:15:10
Please match the pattern of ServiceData i.e. same
puthik_chromium
2016/10/17 23:30:31
Done.
| |
| 330 GetManufacturerData() const; | |
| 331 | |
| 322 // The received signal strength, in dBm. This field is avaliable and valid | 332 // The received signal strength, in dBm. This field is avaliable and valid |
| 323 // only during discovery. | 333 // only during discovery. |
| 324 // TODO(http://crbug.com/580406): Devirtualize once BlueZ sets inquiry_rssi_. | 334 // TODO(http://crbug.com/580406): Devirtualize once BlueZ sets inquiry_rssi_. |
| 325 virtual base::Optional<int8_t> GetInquiryRSSI() const; | 335 virtual base::Optional<int8_t> GetInquiryRSSI() const; |
| 326 | 336 |
| 327 // The transmitted power level. This field is avaliable only for LE devices | 337 // The transmitted power level. This field is avaliable only for LE devices |
| 328 // that include this field in AD. It is avaliable and valid only during | 338 // that include this field in AD. It is avaliable and valid only during |
| 329 // discovery. | 339 // discovery. |
| 330 // TODO(http://crbug.com/580406): Devirtualize once BlueZ sets | 340 // TODO(http://crbug.com/580406): Devirtualize once BlueZ sets |
| 331 // inquiry_tx_power_. | 341 // inquiry_tx_power_. |
| 332 virtual base::Optional<int8_t> GetInquiryTxPower() const; | 342 virtual base::Optional<int8_t> GetInquiryTxPower() const; |
| 333 | 343 |
| 344 // Returns Bluetooth flags in Advertise Data. | |
|
ortuno
2016/10/14 00:15:10
s/Advertise/Advertising/ and also I think you can
puthik_chromium
2016/10/17 23:30:31
Done.
| |
| 345 // | |
| 346 // Note that only BlueZ support this now. This method returns base::nullopt | |
|
ortuno
2016/10/14 00:15:10
s/support/supports/
puthik_chromium
2016/10/17 23:30:31
Done.
| |
| 347 // on platform without BlueZ. | |
|
ortuno
2016/10/14 00:15:10
nit: on platforms that don't use BlueZ.
puthik_chromium
2016/10/17 23:30:31
Done.
| |
| 348 virtual base::Optional<uint8_t> GetFlags() const; | |
|
ortuno
2016/10/14 00:15:10
There are a lot of flags in Bluetooth ^.^ so you m
puthik_chromium
2016/10/17 23:30:31
Done.
| |
| 349 | |
| 334 // The ErrorCallback is used for methods that can fail in which case it | 350 // The ErrorCallback is used for methods that can fail in which case it |
| 335 // is called, in the success case the callback is simply not called. | 351 // is called, in the success case the callback is simply not called. |
| 336 typedef base::Callback<void()> ErrorCallback; | 352 typedef base::Callback<void()> ErrorCallback; |
| 337 | 353 |
| 338 // The ConnectErrorCallback is used for methods that can fail with an error, | 354 // The ConnectErrorCallback is used for methods that can fail with an error, |
| 339 // passed back as an error code argument to this callback. | 355 // passed back as an error code argument to this callback. |
| 340 // In the success case this callback is not called. | 356 // In the success case this callback is not called. |
| 341 typedef base::Callback<void(enum ConnectErrorCode)> ConnectErrorCallback; | 357 typedef base::Callback<void(enum ConnectErrorCode)> ConnectErrorCallback; |
| 342 | 358 |
| 343 typedef base::Callback<void(const ConnectionInfo&)> ConnectionInfoCallback; | 359 typedef base::Callback<void(const ConnectionInfo&)> ConnectionInfoCallback; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 630 | 646 |
| 631 private: | 647 private: |
| 632 // Returns a localized string containing the device's bluetooth address and | 648 // Returns a localized string containing the device's bluetooth address and |
| 633 // a device type for display when |name_| is empty. | 649 // a device type for display when |name_| is empty. |
| 634 base::string16 GetAddressWithLocalizedDeviceTypeName() const; | 650 base::string16 GetAddressWithLocalizedDeviceTypeName() const; |
| 635 }; | 651 }; |
| 636 | 652 |
| 637 } // namespace device | 653 } // namespace device |
| 638 | 654 |
| 639 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 655 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
| OLD | NEW |