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

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

Issue 2104043002: arc: bluetooth: Implement Gatt Server add/delete/start/stop service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gs1
Patch Set: Use running id / implement add descriptor 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 79d45a52fe720c16e44da13dc17c9d242f7971b8..e0092d15faa6d9dbe06f7b3eed17982e524ff230 100644
--- a/components/arc/bluetooth/arc_bluetooth_bridge.h
+++ b/components/arc/bluetooth/arc_bluetooth_bridge.h
@@ -40,6 +40,9 @@ class ArcBluetoothBridge
public device::BluetoothLocalGattService::Delegate,
public mojom::BluetoothHost {
public:
+ using GattStatusCallback = base::Callback<void(mojom::BluetoothGattStatus)>;
+ using GattReadCallback = base::Callback<void(mojom::BluetoothGattValuePtr)>;
+
explicit ArcBluetoothBridge(ArcBridgeService* bridge_service);
~ArcBluetoothBridge() override;
@@ -313,28 +316,21 @@ class ArcBluetoothBridge
const StopLEListenCallback& callback,
device::BluetoothAdvertisement::ErrorCode error_code);
- using GattReadCallback = base::Callback<void(mojom::BluetoothGattValuePtr)>;
+ void OnGattOperationDone(const GattStatusCallback& callback) const;
+ void OnGattOperationError(
+ const GattStatusCallback& callback,
+ device::BluetoothGattService::GattErrorCode error_code) const;
+
void OnGattReadDone(const GattReadCallback& callback,
const std::vector<uint8_t>& result) const;
void OnGattReadError(
const GattReadCallback& callback,
device::BluetoothGattService::GattErrorCode error_code) const;
- using GattWriteCallback = base::Callback<void(mojom::BluetoothGattStatus)>;
- void OnGattWriteDone(const GattWriteCallback& callback) const;
- void OnGattWriteError(
- const GattWriteCallback& callback,
- device::BluetoothGattService::GattErrorCode error_code) const;
-
void OnGattNotifyStartDone(
const RegisterForGattNotificationCallback& callback,
const std::string char_string_id,
std::unique_ptr<device::BluetoothGattNotifySession> notify_session);
- void OnGattNotifyStartError(
- const RegisterForGattNotificationCallback& callback,
- device::BluetoothGattService::GattErrorCode error_code) const;
- void OnGattNotifyStopDone(
- const DeregisterForGattNotificationCallback& callback) const;
private:
mojo::Array<mojom::BluetoothPropertyPtr> GetDeviceProperties(
@@ -366,6 +362,9 @@ class ArcBluetoothBridge
// Propagates the list of paired device to Android.
void SendCachedPairedDevices() const;
+ template <class T>
+ int32_t CreateGattAttributeHandle(T* gatt_obj);
+
mojo::Binding<mojom::BluetoothHost> binding_;
scoped_refptr<bluez::BluetoothAdapterBlueZ> bluetooth_adapter_;
@@ -373,6 +372,12 @@ class ArcBluetoothBridge
std::unique_ptr<device::BluetoothDiscoverySession> discovery_session_;
std::map<std::string, std::unique_ptr<device::BluetoothGattNotifySession>>
notification_session_;
+ // Map from android int handle to Chrome (BlueZ) string identifier.
+ std::map<int32_t, std::string> gatt_identifier_;
+ // Store last GattCharacteristic added to each GattService for GattServer.
+ std::map<int32_t, int32_t> last_characteristic_;
+ // Running number for handle to give to Android side.
+ int32_t gatt_server_obj_handle = 0;
// WeakPtrFactory to use for callbacks.
base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_;
« 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