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

Unified Diff: device/bluetooth/bluetooth_device.h

Issue 2421713002: arc: bluetooth: Expose missing advertise data. (Closed)
Patch Set: fix comment 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_device.h
diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h
index 803dd8f8ef32600f8deb24f241aa066c0721a02c..d47d2e895e8238460e08d8d04e13bd2b0cbc3dd9 100644
--- a/device/bluetooth/bluetooth_device.h
+++ b/device/bluetooth/bluetooth_device.h
@@ -11,6 +11,7 @@
#include <memory>
#include <set>
#include <string>
+#include <unordered_map>
#include <unordered_set>
#include <vector>
@@ -102,6 +103,10 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
std::vector<uint8_t>,
BluetoothUUIDHash>
ServiceDataMap;
+ typedef uint16_t ManufacturerID;
ortuno 2016/10/18 01:41:18 nit: s/ID/Id/ here and below. Though it really doe
puthik_chromium 2016/11/02 23:20:38 Done.
+ typedef std::unordered_map<ManufacturerID, std::vector<uint8_t>>
+ ManufacturerDataMap;
+ typedef std::unordered_set<ManufacturerID> ManufacturerIDSet;
// Mapping from the platform-specific GATT service identifiers to
// BluetoothRemoteGattService objects.
@@ -319,6 +324,26 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
const std::vector<uint8_t>* GetServiceDataForUUID(
const BluetoothUUID& uuid) const;
+ // Returns advertised Manufacturer Data. Keys are 16 bits Manufacturer IDs
+ // followed by its byte array value. Returns an empty map if the device
+ // does not advertise any Manufacturer Data.
+ // Returns cached value if the adapter is not discovering.
ortuno 2016/10/18 01:41:18 What about changing Manufacturer Data? Does BlueZ
puthik_chromium 2016/11/02 23:20:38 Done.
+ //
+ // Note that only BlueZ supports this now. This method returns an empty map
+ // on platforms that don't use BlueZ.
ortuno 2016/10/18 01:41:18 Could you open an issue to implement this on other
puthik_chromium 2016/11/02 23:20:38 Done.
+ const ManufacturerDataMap& GetManufacturerData() const;
+
+ // Returns the Manufacturer Data IDs of Manufacturers for which the device
+ // advertises Manufacturer Data.
+ // Returns cached value if the adapter is not discovering.
+ ManufacturerIDSet GetManufacturerDataIDs() const;
+
+ // Returns a pointer to the Manufacturer Data for Manufacturer with
+ // |manufacturerID|. Returns nullptr if |manufacturerID| has no Manufacturer
+ // Data. Returns cached value if the adapter is not discovering.
+ const std::vector<uint8_t>* GetManufacturerDataForID(
+ const ManufacturerID manufacturerID) const;
+
// The received signal strength, in dBm. This field is avaliable and valid
// only during discovery.
// TODO(http://crbug.com/580406): Devirtualize once BlueZ sets inquiry_rssi_.
@@ -331,6 +356,13 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
// inquiry_tx_power_.
virtual base::Optional<int8_t> GetInquiryTxPower() const;
+ // Returns Advertising Data Flags.
+ // Returns cached value if the adapter is not discovering.
+ //
+ // Note that only BlueZ supports this now. This method returns base::nullopt
ortuno 2016/10/18 01:41:18 s/BlueZ/Chrome OS/ Also could you open an issue re
puthik_chromium 2016/11/02 23:20:38 Done.
+ // on platforms that don't use BlueZ.
+ virtual base::Optional<uint8_t> GetAdvertisingDataFlags() const;
+
// The ErrorCallback is used for methods that can fail in which case it
// is called, in the success case the callback is simply not called.
typedef base::Callback<void()> ErrorCallback;
@@ -625,6 +657,9 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
// Map of BluetoothUUIDs to their advertised Service Data.
ServiceDataMap service_data_;
+ // Map of Manufacturer IDs to their advertised Manufacturer Data.
+ ManufacturerDataMap manufacturer_data_;
+
// Timestamp for when an advertisement was last seen.
base::Time last_update_time_;

Powered by Google App Engine
This is Rietveld 408576698