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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ 5 #ifndef COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_
6 #define COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ 6 #define COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 device::BluetoothAdapter* adapter, 111 device::BluetoothAdapter* adapter,
112 device::BluetoothRemoteGattCharacteristic* characteristic, 112 device::BluetoothRemoteGattCharacteristic* characteristic,
113 const std::vector<uint8_t>& value) override; 113 const std::vector<uint8_t>& value) override;
114 114
115 void GattDescriptorValueChanged( 115 void GattDescriptorValueChanged(
116 device::BluetoothAdapter* adapter, 116 device::BluetoothAdapter* adapter,
117 device::BluetoothRemoteGattDescriptor* descriptor, 117 device::BluetoothRemoteGattDescriptor* descriptor,
118 const std::vector<uint8_t>& value) override; 118 const std::vector<uint8_t>& value) override;
119 119
120 // Overridden from device::BluetoothLocalGattService::Delegate 120 // Overridden from device::BluetoothLocalGattService::Delegate
121 template <class T>
122 void OnGattAttributeReadRequest(const device::BluetoothDevice* device,
123 const T* gatt_obj,
124 int offset,
125 const ValueCallback& callback,
126 const ErrorCallback& error_callback);
127
128 template <class T>
129 void OnGattAttributeWriteRequest(
130 const device::BluetoothDevice* device,
131 const T* gatt_obj,
132 const std::vector<uint8_t>& value,
133 int offset,
134 const base::Closure& callback,
135 const ErrorCallback& error_callback) override;
136
121 void OnCharacteristicReadRequest( 137 void OnCharacteristicReadRequest(
122 const device::BluetoothDevice* device, 138 const device::BluetoothDevice* device,
123 const device::BluetoothLocalGattCharacteristic* characteristic, 139 const device::BluetoothLocalGattCharacteristic* characteristic,
124 int offset, 140 int offset,
125 const ValueCallback& callback, 141 const ValueCallback& callback,
126 const ErrorCallback& error_callback) override; 142 const ErrorCallback& error_callback) override;
127 143
128 void OnCharacteristicWriteRequest( 144 void OnCharacteristicWriteRequest(
129 const device::BluetoothDevice* device, 145 const device::BluetoothDevice* device,
130 const device::BluetoothLocalGattCharacteristic* characteristic, 146 const device::BluetoothLocalGattCharacteristic* characteristic,
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 mojom::BluetoothAddressPtr remote_addr, 362 mojom::BluetoothAddressPtr remote_addr,
347 mojom::BluetoothGattServiceIDPtr service_id, 363 mojom::BluetoothGattServiceIDPtr service_id,
348 mojom::BluetoothGattIDPtr char_id, 364 mojom::BluetoothGattIDPtr char_id,
349 mojom::BluetoothGattIDPtr desc_id) const; 365 mojom::BluetoothGattIDPtr desc_id) const;
350 366
351 // Propagates the list of paired device to Android. 367 // Propagates the list of paired device to Android.
352 void SendCachedPairedDevices() const; 368 void SendCachedPairedDevices() const;
353 369
354 template <class T> 370 template <class T>
355 int32_t CreateGattAttributeHandle(T* gatt_obj); 371 int32_t CreateGattAttributeHandle(T* gatt_obj);
372 int32_t CreateGattReadTransaction(const ValueCallback& successCallback,
373 const ErrorCallback& errorCallback);
374 int32_t CreateGattWriteTransaction(const base::Closure& successCallback,
375 const ErrorCallback& errorCallback);
356 376
357 mojo::Binding<mojom::BluetoothHost> binding_; 377 mojo::Binding<mojom::BluetoothHost> binding_;
358 378
359 scoped_refptr<bluez::BluetoothAdapterBlueZ> bluetooth_adapter_; 379 scoped_refptr<bluez::BluetoothAdapterBlueZ> bluetooth_adapter_;
360 scoped_refptr<device::BluetoothAdvertisement> advertisment_; 380 scoped_refptr<device::BluetoothAdvertisement> advertisment_;
361 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session_; 381 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session_;
362 std::map<std::string, std::unique_ptr<device::BluetoothGattNotifySession>> 382 std::map<std::string, std::unique_ptr<device::BluetoothGattNotifySession>>
363 notification_session_; 383 notification_session_;
364 // Map from android int handle to Chrome (BlueZ) string identifier. 384 // Map from android int handle to Chrome (BlueZ) string identifier.
365 std::map<int32_t, std::string> gatt_identifier_; 385 std::map<int32_t, std::string> gatt_identifier_;
386 std::map<int32_t, std::pair<ValueCallback, ErrorCallback>>
rkc 2016/07/01 22:51:32 Can we have this aliased with using? It would also
puthik_chromium 2016/07/14 22:45:12 Done.
387 gatt_read_callbacks_;
388 std::map<int32_t, std::pair<base::Closure, ErrorCallback>>
389 gatt_write_callbacks_;
366 390
367 // WeakPtrFactory to use for callbacks. 391 // WeakPtrFactory to use for callbacks.
368 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; 392 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_;
369 393
370 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); 394 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge);
371 }; 395 };
372 396
373 } // namespace arc 397 } // namespace arc
374 398
375 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ 399 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_
OLDNEW
« 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