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

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

Issue 2282763004: bluetooth: mac: Improve classic device discovery and update (Closed)
Patch Set: Override getlastupdate and make constexpr Created 4 years, 3 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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // Returns the GATT service with device-specific identifier |identifier|. 506 // Returns the GATT service with device-specific identifier |identifier|.
507 // Returns NULL, if no such service exists. 507 // Returns NULL, if no such service exists.
508 virtual BluetoothRemoteGattService* GetGattService( 508 virtual BluetoothRemoteGattService* GetGattService(
509 const std::string& identifier) const; 509 const std::string& identifier) const;
510 510
511 // Returns the |address| in the canonical format: XX:XX:XX:XX:XX:XX, where 511 // Returns the |address| in the canonical format: XX:XX:XX:XX:XX:XX, where
512 // each 'X' is a hex digit. If the input |address| is invalid, returns an 512 // each 'X' is a hex digit. If the input |address| is invalid, returns an
513 // empty string. 513 // empty string.
514 static std::string CanonicalizeAddress(const std::string& address); 514 static std::string CanonicalizeAddress(const std::string& address);
515 515
516 // Update the last time this device was seen.
517 void UpdateTimestamp();
518
516 // Return the timestamp for when this device was last seen. 519 // Return the timestamp for when this device was last seen.
Jeffrey Yasskin 2016/09/23 22:25:21 Mention what the default return value is.
ortuno 2016/09/26 08:45:29 What do you mean? The default value of base::Time(
Jeffrey Yasskin 2016/09/26 18:35:59 The base implementation value; probably something
ortuno 2016/09/26 23:58:18 Done. Thanks for the suggestion :)
517 base::Time GetLastUpdateTime() const { return last_update_time_; } 520 virtual base::Time GetLastUpdateTime() const;
518 521
519 // Called by BluetoothAdapter when a new Advertisement is seen for this 522 // Called by BluetoothAdapter when a new Advertisement is seen for this
520 // device. This replaces previously seen Advertisement Data. 523 // device. This replaces previously seen Advertisement Data.
521 void UpdateAdvertisementData(int8_t rssi, 524 void UpdateAdvertisementData(int8_t rssi,
522 UUIDList advertised_uuids, 525 UUIDList advertised_uuids,
523 ServiceDataMap service_data, 526 ServiceDataMap service_data,
524 const int8_t* tx_power); 527 const int8_t* tx_power);
525 528
526 // Called by BluetoothAdapter when it stops discoverying. 529 // Called by BluetoothAdapter when it stops discoverying.
527 void ClearAdvertisementData(); 530 void ClearAdvertisementData();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 private: 573 private:
571 void UpdateDeviceUUIDs(); 574 void UpdateDeviceUUIDs();
572 575
573 BluetoothDevice::UUIDSet advertised_uuids_; 576 BluetoothDevice::UUIDSet advertised_uuids_;
574 BluetoothDevice::UUIDSet service_uuids_; 577 BluetoothDevice::UUIDSet service_uuids_;
575 BluetoothDevice::UUIDSet device_uuids_; 578 BluetoothDevice::UUIDSet device_uuids_;
576 }; 579 };
577 580
578 BluetoothDevice(BluetoothAdapter* adapter); 581 BluetoothDevice(BluetoothAdapter* adapter);
579 582
580 // Update the last time this device was seen.
581 void UpdateTimestamp();
582
583 // Implements platform specific operations to initiate a GATT connection. 583 // Implements platform specific operations to initiate a GATT connection.
584 // Subclasses must also call DidConnectGatt, DidFailToConnectGatt, or 584 // Subclasses must also call DidConnectGatt, DidFailToConnectGatt, or
585 // DidDisconnectGatt immediately or asynchronously as the connection state 585 // DidDisconnectGatt immediately or asynchronously as the connection state
586 // changes. 586 // changes.
587 virtual void CreateGattConnectionImpl() = 0; 587 virtual void CreateGattConnectionImpl() = 0;
588 588
589 // Disconnects GATT connection on platforms that maintain a specific GATT 589 // Disconnects GATT connection on platforms that maintain a specific GATT
590 // connection. 590 // connection.
591 virtual void DisconnectGatt() = 0; 591 virtual void DisconnectGatt() = 0;
592 592
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 642
643 private: 643 private:
644 // Returns a localized string containing the device's bluetooth address and 644 // Returns a localized string containing the device's bluetooth address and
645 // a device type for display when |name_| is empty. 645 // a device type for display when |name_| is empty.
646 base::string16 GetAddressWithLocalizedDeviceTypeName() const; 646 base::string16 GetAddressWithLocalizedDeviceTypeName() const;
647 }; 647 };
648 648
649 } // namespace device 649 } // namespace device
650 650
651 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ 651 #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