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

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

Issue 1927803002: arc: bluetooth: Add gatt client functionality (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add more code comment Created 4 years, 7 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 f6843005123a85680d3ae5d3ab015cc477a09b39..846ea990b343f041a8ce5df410f7caf96bda3106 100644
--- a/components/arc/bluetooth/arc_bluetooth_bridge.h
+++ b/components/arc/bluetooth/arc_bluetooth_bridge.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include <map>
#include <memory>
#include <string>
#include <vector>
@@ -136,6 +137,51 @@ class ArcBluetoothBridge
void GetConnectionState(mojom::BluetoothAddressPtr addr,
const GetConnectionStateCallback& callback) override;
+ // Bluetooth Mojo host interface - Bluetooth Gatt Client functions
+ void StartLEScan() override;
+ void StopLEScan() override;
+ void ConnectLEDevice(mojom::BluetoothAddressPtr remote_addr) override;
+ void DisconnectLEDevice(mojom::BluetoothAddressPtr remote_addr) override;
+ void StartLEListen(const StartLEListenCallback& callback) override;
+ void StopLEListen(const StopLEListenCallback& callback) override;
+ void SearchService(mojom::BluetoothAddressPtr remote_addr) override;
+ void GetGattDB(mojom::BluetoothAddressPtr remote_addr) override;
+ void ReadGattCharacteristic(
+ mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothGattServiceIDPtr service_id,
+ mojom::BluetoothGattIDPtr char_id,
+ const ReadGattCharacteristicCallback& callback) override;
+ void WriteGattCharacteristic(
+ mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothGattServiceIDPtr service_id,
+ mojom::BluetoothGattIDPtr char_id,
+ mojom::BluetoothGattValuePtr value,
+ const WriteGattCharacteristicCallback& callback) override;
+ void ReadGattDescriptor(mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothGattServiceIDPtr service_id,
+ mojom::BluetoothGattIDPtr char_id,
+ mojom::BluetoothGattIDPtr desc_id,
+ const ReadGattDescriptorCallback& callback) override;
+ void WriteGattDescriptor(
+ mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothGattServiceIDPtr service_id,
+ mojom::BluetoothGattIDPtr char_id,
+ mojom::BluetoothGattIDPtr desc_id,
+ mojom::BluetoothGattValuePtr value,
+ const WriteGattDescriptorCallback& callback) override;
+ void RegisterForGattNotification(
+ mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothGattServiceIDPtr service_id,
+ mojom::BluetoothGattIDPtr char_id,
+ const RegisterForGattNotificationCallback& callback) override;
+ void DeregisterForGattNotification(
+ mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothGattServiceIDPtr service_id,
+ mojom::BluetoothGattIDPtr char_id,
+ const DeregisterForGattNotificationCallback& callback) override;
+ void ReadRemoteRssi(mojom::BluetoothAddressPtr remote_addr,
+ const ReadRemoteRssiCallback& callback) override;
+
// Chrome observer callbacks
void OnPoweredOn(
const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const;
@@ -155,23 +201,80 @@ class ArcBluetoothBridge
void OnForgetDone(mojom::BluetoothAddressPtr addr) const;
void OnForgetError(mojom::BluetoothAddressPtr addr) const;
+ void OnGattConnected(
+ mojom::BluetoothAddressPtr addr,
+ std::unique_ptr<device::BluetoothGattConnection> connection) const;
+ void OnGattConnectError(
+ mojom::BluetoothAddressPtr addr,
+ device::BluetoothDevice::ConnectErrorCode error_code) const;
+ void OnGattDisconnected(mojom::BluetoothAddressPtr addr) const;
+
+ void OnStartLEListenDone(const StartLEListenCallback& callback,
+ scoped_refptr<device::BluetoothAdvertisement> adv);
+ void OnStartLEListenError(
+ const StartLEListenCallback& callback,
+ device::BluetoothAdvertisement::ErrorCode error_code);
+
+ void OnStopLEListenDone(const StopLEListenCallback& callback);
+ void OnStopLEListenError(
+ const StopLEListenCallback& callback,
+ device::BluetoothAdvertisement::ErrorCode error_code);
+
+ using GattReadCallback = mojo::Callback<void(mojom::BluetoothGattValuePtr)>;
+ 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 = mojo::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(
mojom::BluetoothPropertyType type,
device::BluetoothDevice* device) const;
mojo::Array<mojom::BluetoothPropertyPtr> GetAdapterProperties(
mojom::BluetoothPropertyType type) const;
+ mojo::Array<uint8_t> GetAdvData(device::BluetoothDevice* device) const;
Luis Héctor Chávez 2016/06/01 21:12:03 GetAdvertisingData.
void SendCachedDevicesFound() const;
bool HasBluetoothInstance() const;
+ device::BluetoothRemoteGattCharacteristic* FindGattCharacteristic(
+ mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothGattServiceIDPtr service_id,
+ mojom::BluetoothGattIDPtr char_id) const;
+
+ device::BluetoothRemoteGattDescriptor* FindGattDescriptor(
+ mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothGattServiceIDPtr service_id,
+ mojom::BluetoothGattIDPtr char_id,
+ mojom::BluetoothGattIDPtr desc_id) const;
+
// Propagates the list of paired device to Android.
void SendCachedPairedDevices() const;
mojo::Binding<mojom::BluetoothHost> binding_;
scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_;
+ scoped_refptr<device::BluetoothAdvertisement> advertisment_;
std::unique_ptr<device::BluetoothDiscoverySession> discovery_session_;
+ std::map<std::string, std::unique_ptr<device::BluetoothGattNotifySession>>
+ notification_session_;
// 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