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

Side by Side Diff: device/bluetooth/bluetooth_device.h

Issue 2282763004: bluetooth: mac: Improve classic device discovery and update (Closed)
Patch Set: Address moar comments Created 4 years, 2 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
« no previous file with comments | « device/bluetooth/bluetooth_classic_device_mac.mm ('k') | device/bluetooth/bluetooth_device.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // Returns the GATT service with device-specific identifier |identifier|. 510 // Returns the GATT service with device-specific identifier |identifier|.
511 // Returns NULL, if no such service exists. 511 // Returns NULL, if no such service exists.
512 virtual BluetoothRemoteGattService* GetGattService( 512 virtual BluetoothRemoteGattService* GetGattService(
513 const std::string& identifier) const; 513 const std::string& identifier) const;
514 514
515 // Returns the |address| in the canonical format: XX:XX:XX:XX:XX:XX, where 515 // Returns the |address| in the canonical format: XX:XX:XX:XX:XX:XX, where
516 // each 'X' is a hex digit. If the input |address| is invalid, returns an 516 // each 'X' is a hex digit. If the input |address| is invalid, returns an
517 // empty string. 517 // empty string.
518 static std::string CanonicalizeAddress(const std::string& address); 518 static std::string CanonicalizeAddress(const std::string& address);
519 519
520 // Return the timestamp for when this device was last seen. 520 // Update the last time this device was seen.
521 base::Time GetLastUpdateTime() const { return last_update_time_; } 521 void UpdateTimestamp();
522
523 // Returns the time of the last call to UpdateTimestamp(), or base::Time() if
524 // it hasn't been called yet.
525 virtual base::Time GetLastUpdateTime() const;
522 526
523 // Called by BluetoothAdapter when a new Advertisement is seen for this 527 // Called by BluetoothAdapter when a new Advertisement is seen for this
524 // device. This replaces previously seen Advertisement Data. 528 // device. This replaces previously seen Advertisement Data.
525 void UpdateAdvertisementData(int8_t rssi, 529 void UpdateAdvertisementData(int8_t rssi,
526 UUIDList advertised_uuids, 530 UUIDList advertised_uuids,
527 ServiceDataMap service_data, 531 ServiceDataMap service_data,
528 const int8_t* tx_power); 532 const int8_t* tx_power);
529 533
530 // Called by BluetoothAdapter when it stops discoverying. 534 // Called by BluetoothAdapter when it stops discoverying.
531 void ClearAdvertisementData(); 535 void ClearAdvertisementData();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 private: 578 private:
575 void UpdateDeviceUUIDs(); 579 void UpdateDeviceUUIDs();
576 580
577 BluetoothDevice::UUIDSet advertised_uuids_; 581 BluetoothDevice::UUIDSet advertised_uuids_;
578 BluetoothDevice::UUIDSet service_uuids_; 582 BluetoothDevice::UUIDSet service_uuids_;
579 BluetoothDevice::UUIDSet device_uuids_; 583 BluetoothDevice::UUIDSet device_uuids_;
580 }; 584 };
581 585
582 BluetoothDevice(BluetoothAdapter* adapter); 586 BluetoothDevice(BluetoothAdapter* adapter);
583 587
584 // Update the last time this device was seen.
585 void UpdateTimestamp();
586
587 // Implements platform specific operations to initiate a GATT connection. 588 // Implements platform specific operations to initiate a GATT connection.
588 // Subclasses must also call DidConnectGatt, DidFailToConnectGatt, or 589 // Subclasses must also call DidConnectGatt, DidFailToConnectGatt, or
589 // DidDisconnectGatt immediately or asynchronously as the connection state 590 // DidDisconnectGatt immediately or asynchronously as the connection state
590 // changes. 591 // changes.
591 virtual void CreateGattConnectionImpl() = 0; 592 virtual void CreateGattConnectionImpl() = 0;
592 593
593 // Disconnects GATT connection on platforms that maintain a specific GATT 594 // Disconnects GATT connection on platforms that maintain a specific GATT
594 // connection. 595 // connection.
595 virtual void DisconnectGatt() = 0; 596 virtual void DisconnectGatt() = 0;
596 597
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 647
647 private: 648 private:
648 // Returns a localized string containing the device's bluetooth address and 649 // Returns a localized string containing the device's bluetooth address and
649 // a device type for display when |name_| is empty. 650 // a device type for display when |name_| is empty.
650 base::string16 GetAddressWithLocalizedDeviceTypeName() const; 651 base::string16 GetAddressWithLocalizedDeviceTypeName() const;
651 }; 652 };
652 653
653 } // namespace device 654 } // namespace device
654 655
655 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ 656 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_classic_device_mac.mm ('k') | device/bluetooth/bluetooth_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698