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

Unified Diff: components/arc/bluetooth/arc_bluetooth_bridge.h

Issue 2101283003: arc: bluetooth: Implement Gatt server request to read/write (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gs2
Patch Set: rebase Created 4 years, 5 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: components/arc/bluetooth/arc_bluetooth_bridge.h
diff --git a/components/arc/bluetooth/arc_bluetooth_bridge.h b/components/arc/bluetooth/arc_bluetooth_bridge.h
index c545b21a47fbca5cbcbc9ac95012edf227da30d8..cf0926b23e92a6ccf763754b4d4ed3ea0185e958 100644
--- a/components/arc/bluetooth/arc_bluetooth_bridge.h
+++ b/components/arc/bluetooth/arc_bluetooth_bridge.h
@@ -43,8 +43,7 @@ class ArcBluetoothBridge
explicit ArcBluetoothBridge(ArcBridgeService* bridge_service);
~ArcBluetoothBridge() override;
- // Overridden from
- // InstanceHolder<mojom::BluetoothInstance>::Observer:
+ // Overridden from InstanceHolder<mojom::BluetoothInstance>::Observer:
void OnInstanceReady() override;
void OnAdapterInitialized(scoped_refptr<device::BluetoothAdapter> adapter);
@@ -341,6 +340,23 @@ class ArcBluetoothBridge
template <class LocalGattAttribute>
int32_t CreateGattAttributeHandle(LocalGattAttribute* gatt_attr);
+ // Common code for OnCharacteristicReadRequest and OnDescriptorReadRequest
+ template <class LocalGattAttribute>
+ void OnGattAttributeReadRequest(const device::BluetoothDevice* device,
+ const LocalGattAttribute* gatt_attr,
+ int offset,
+ const ValueCallback& success_callback,
+ const ErrorCallback& error_callback);
+
+ // Common code for OnCharacteristicWriteRequest and OnDescriptorWriteRequest
+ template <class LocalGattAttribute>
+ void OnGattAttributeWriteRequest(const device::BluetoothDevice* device,
+ const LocalGattAttribute* gatt_attr,
+ const std::vector<uint8_t>& value,
+ int offset,
+ const base::Closure& success_callback,
+ const ErrorCallback& error_callback);
+
bool CalledOnValidThread();
int32_t next_gatt_server_attribute_handle() {
@@ -357,6 +373,8 @@ class ArcBluetoothBridge
notification_session_;
// Map from android int handle to Chrome (BlueZ) string identifier.
std::unordered_map<int32_t, std::string> gatt_identifier_;
+ // Map from Chrome (BlueZ) string identifier to android int handle.
+ std::unordered_map<std::string, int32_t> gatt_handle_;
// Store last GattCharacteristic added to each GattService for GattServer.
std::unordered_map<int32_t, int32_t> last_characteristic_;
// Monotonically increasing value to use as handle to give to Android side.
« no previous file with comments | « no previous file | components/arc/bluetooth/arc_bluetooth_bridge.cc » ('j') | components/arc/bluetooth/arc_bluetooth_bridge.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698