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

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

Issue 2369423003: bluetooth: Expose service data from BlueZ (Closed)
Patch Set: Change scope to not cover just dbus property 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
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
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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // a device stops advertising a service this function will still return 323 // a device stops advertising a service this function will still return
323 // its UUID. 324 // its UUID.
324 virtual UUIDSet GetUUIDs() const; 325 virtual UUIDSet GetUUIDs() const;
325 326
326 // Returns the last advertised Service Data. Returns an empty map if the 327 // Returns the last advertised Service Data. Returns an empty map if the
327 // adapter is not discovering. 328 // adapter is not discovering.
328 const ServiceDataMap& GetServiceData() const; 329 const ServiceDataMap& GetServiceData() const;
329 330
330 // Returns the UUIDs of services for which the device advertises Service Data. 331 // Returns the UUIDs of services for which the device advertises Service Data.
331 // Returns an empty set if the adapter is not discovering. 332 // Returns an empty set if the adapter is not discovering.
332 UUIDSet GetServiceDataUUIDs() const; 333 virtual UUIDSet GetServiceDataUUIDs() const;
ortuno 2016/09/28 08:39:24 Please also implement GetServiceData()
puthik_chromium 2016/10/05 00:11:33 Fix this by use Property change event to update se
333 334
334 // Returns a pointer to the Service Data for Service with |uuid|. Returns 335 // Returns a pointer to the Service Data for Service with |uuid|. Returns
335 // nullptr if |uuid| has no Service Data. 336 // nullptr if |uuid| has no Service Data.
336 const std::vector<uint8_t>* GetServiceDataForUUID( 337 virtual const std::vector<uint8_t>* GetServiceDataForUUID(
337 const BluetoothUUID& uuid) const; 338 const BluetoothUUID& uuid) const;
338 339
339 // The received signal strength, in dBm. This field is avaliable and valid 340 // The received signal strength, in dBm. This field is avaliable and valid
340 // only during discovery. 341 // only during discovery.
341 // TODO(http://crbug.com/580406): Devirtualize once BlueZ sets inquiry_rssi_. 342 // TODO(http://crbug.com/580406): Devirtualize once BlueZ sets inquiry_rssi_.
342 virtual base::Optional<int8_t> GetInquiryRSSI() const; 343 virtual base::Optional<int8_t> GetInquiryRSSI() const;
343 344
344 // The transmitted power level. This field is avaliable only for LE devices 345 // The transmitted power level. This field is avaliable only for LE devices
345 // that include this field in AD. It is avaliable and valid only during 346 // that include this field in AD. It is avaliable and valid only during
346 // discovery. 347 // discovery.
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 const UUIDSet& GetUUIDs() const; 577 const UUIDSet& GetUUIDs() const;
577 578
578 private: 579 private:
579 void UpdateDeviceUUIDs(); 580 void UpdateDeviceUUIDs();
580 581
581 BluetoothDevice::UUIDSet advertised_uuids_; 582 BluetoothDevice::UUIDSet advertised_uuids_;
582 BluetoothDevice::UUIDSet service_uuids_; 583 BluetoothDevice::UUIDSet service_uuids_;
583 BluetoothDevice::UUIDSet device_uuids_; 584 BluetoothDevice::UUIDSet device_uuids_;
584 }; 585 };
585 586
586 BluetoothDevice(BluetoothAdapter* adapter); 587 explicit BluetoothDevice(BluetoothAdapter* adapter);
587 588
588 // Implements platform specific operations to initiate a GATT connection. 589 // Implements platform specific operations to initiate a GATT connection.
589 // Subclasses must also call DidConnectGatt, DidFailToConnectGatt, or 590 // Subclasses must also call DidConnectGatt, DidFailToConnectGatt, or
590 // DidDisconnectGatt immediately or asynchronously as the connection state 591 // DidDisconnectGatt immediately or asynchronously as the connection state
591 // changes. 592 // changes.
592 virtual void CreateGattConnectionImpl() = 0; 593 virtual void CreateGattConnectionImpl() = 0;
593 594
594 // Disconnects GATT connection on platforms that maintain a specific GATT 595 // Disconnects GATT connection on platforms that maintain a specific GATT
595 // connection. 596 // connection.
596 virtual void DisconnectGatt() = 0; 597 virtual void DisconnectGatt() = 0;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 648
648 private: 649 private:
649 // Returns a localized string containing the device's bluetooth address and 650 // Returns a localized string containing the device's bluetooth address and
650 // a device type for display when |name_| is empty. 651 // a device type for display when |name_| is empty.
651 base::string16 GetAddressWithLocalizedDeviceTypeName() const; 652 base::string16 GetAddressWithLocalizedDeviceTypeName() const;
652 }; 653 };
653 654
654 } // namespace device 655 } // namespace device
655 656
656 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ 657 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698