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 |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 UUIDList advertised_uuids, | 533 UUIDList advertised_uuids, |
534 ServiceDataMap service_data, | 534 ServiceDataMap service_data, |
535 const int8_t* tx_power); | 535 const int8_t* tx_power); |
536 | 536 |
537 // Called by BluetoothAdapter when it stops discoverying. | 537 // Called by BluetoothAdapter when it stops discoverying. |
538 void ClearAdvertisementData(); | 538 void ClearAdvertisementData(); |
539 | 539 |
540 // Return associated BluetoothAdapter. | 540 // Return associated BluetoothAdapter. |
541 BluetoothAdapter* GetAdapter() { return adapter_; } | 541 BluetoothAdapter* GetAdapter() { return adapter_; } |
542 | 542 |
| 543 // Returns true if there is a pending read or write GATT operation for any |
| 544 // characteristic or descriptor in the device. It's checked before |
| 545 // performing any GATT operations. |
| 546 bool HasPendingGattOperation() const; |
| 547 // Sets whether or not there is a pending GATT operation for any |
| 548 // characteristic or descriptor in the device. It is set to true when a new |
| 549 // GATT operation is about to be performed and to false once the operation has |
| 550 // finished. |
| 551 void SetPendingGattOperation(bool pending); |
| 552 |
543 std::vector<BluetoothRemoteGattService*> GetPrimaryServices(); | 553 std::vector<BluetoothRemoteGattService*> GetPrimaryServices(); |
544 | 554 |
545 std::vector<BluetoothRemoteGattService*> GetPrimaryServicesByUUID( | 555 std::vector<BluetoothRemoteGattService*> GetPrimaryServicesByUUID( |
546 const BluetoothUUID& service_uuid); | 556 const BluetoothUUID& service_uuid); |
547 | 557 |
548 protected: | 558 protected: |
549 // BluetoothGattConnection is a friend to call Add/RemoveGattConnection. | 559 // BluetoothGattConnection is a friend to call Add/RemoveGattConnection. |
550 friend BluetoothGattConnection; | 560 friend BluetoothGattConnection; |
551 FRIEND_TEST_ALL_PREFIXES( | 561 FRIEND_TEST_ALL_PREFIXES( |
552 BluetoothTest, | 562 BluetoothTest, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 | 662 |
653 // Class that holds the union of Advertised UUIDs and Service UUIDs. | 663 // Class that holds the union of Advertised UUIDs and Service UUIDs. |
654 DeviceUUIDs device_uuids_; | 664 DeviceUUIDs device_uuids_; |
655 | 665 |
656 // Map of BluetoothUUIDs to their advertised Service Data. | 666 // Map of BluetoothUUIDs to their advertised Service Data. |
657 ServiceDataMap service_data_; | 667 ServiceDataMap service_data_; |
658 | 668 |
659 // Map of Manufacturer IDs to their advertised Manufacturer Data. | 669 // Map of Manufacturer IDs to their advertised Manufacturer Data. |
660 ManufacturerDataMap manufacturer_data_; | 670 ManufacturerDataMap manufacturer_data_; |
661 | 671 |
| 672 // Indicates if there are any pending GATT operations. |
| 673 bool pending_gatt_operation_; |
| 674 |
662 // Timestamp for when an advertisement was last seen. | 675 // Timestamp for when an advertisement was last seen. |
663 base::Time last_update_time_; | 676 base::Time last_update_time_; |
664 | 677 |
665 private: | 678 private: |
666 // Returns a localized string containing the device's bluetooth address and | 679 // Returns a localized string containing the device's bluetooth address and |
667 // a device type for display when |name_| is empty. | 680 // a device type for display when |name_| is empty. |
668 base::string16 GetAddressWithLocalizedDeviceTypeName() const; | 681 base::string16 GetAddressWithLocalizedDeviceTypeName() const; |
669 | 682 |
670 DISALLOW_COPY_AND_ASSIGN(BluetoothDevice); | 683 DISALLOW_COPY_AND_ASSIGN(BluetoothDevice); |
671 }; | 684 }; |
672 | 685 |
673 } // namespace device | 686 } // namespace device |
674 | 687 |
675 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 688 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |