diff options
author | armansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-30 01:21:38 +0000 |
---|---|---|
committer | armansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-30 01:21:38 +0000 |
commit | 29b3d6276a95365d73bb16c376d0824145fb6549 (patch) | |
tree | a432a85e9554d1e2dccf13c6ad5cd0269a8b1447 /device/bluetooth/bluetooth_gatt_service.h | |
parent | c8c1c1fc1371d366b338136d657ac8998070fc91 (diff) | |
download | chromium_src-29b3d6276a95365d73bb16c376d0824145fb6549.zip chromium_src-29b3d6276a95365d73bb16c376d0824145fb6549.tar.gz chromium_src-29b3d6276a95365d73bb16c376d0824145fb6549.tar.bz2 |
device/bluetooth: Move GATT observer methods to BluetoothAdapter::Observer.
This CL merges BluetoothDevice::Observer and BluetoothGattService::Observer
interfaces to BluetoothAdapter::Observer. This makes adding and removing
observers much cleaner for users of the library. It also removes the problem of
adding observers on platforms where instances are temporary and aren't kept
alive for long.
BUG=384664
TEST=device_unittests; browser_tests:BluetoothLowEnergyApiTest
Review URL: https://codereview.chromium.org/418483003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286371 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device/bluetooth/bluetooth_gatt_service.h')
-rw-r--r-- | device/bluetooth/bluetooth_gatt_service.h | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/device/bluetooth/bluetooth_gatt_service.h b/device/bluetooth/bluetooth_gatt_service.h index 583c136..a62278f 100644 --- a/device/bluetooth/bluetooth_gatt_service.h +++ b/device/bluetooth/bluetooth_gatt_service.h @@ -125,87 +125,11 @@ class BluetoothGattService { const ErrorCallback& error_callback) = 0; }; - // Interface for observing changes from a BluetoothGattService. Properties - // of remote services are received asynchronously. The Observer interface can - // be used to be notified when the initial values of a service are received - // as well as when successive changes occur during its life cycle. - class Observer { - public: - // Called when all characteristic and descriptor discovery procedures are - // known to be completed for the GATT service |service|. This method will be - // called after the initial discovery of a GATT service and will usually be - // preceded by calls to GattCharacteristicAdded and GattDescriptorAdded. - virtual void GattDiscoveryCompleteForService( - BluetoothGattService* service) {} - - // Called when properties of the remote GATT service |service| have changed. - // This will get called for properties such as UUID, as well as for changes - // to the list of known characteristics and included services. Observers - // should read all GATT characteristic and descriptors objects and do any - // necessary set up required for a changed service. - virtual void GattServiceChanged(BluetoothGattService* service) {} - - // Called when the remote GATT characteristic |characteristic| belonging to - // GATT service |service| has been discovered. Use this to issue any initial - // read/write requests to the characteristic but don't cache the pointer as - // it may become invalid. Instead, use the specially assigned identifier - // to obtain a characteristic and cache that identifier as necessary, as it - // can be used to retrieve the characteristic from its GATT service. The - // number of characteristics with the same UUID belonging to a service - // depends on the particular profile the remote device implements, hence the - // client of a GATT based profile will usually operate on the whole set of - // characteristics and not just one. - virtual void GattCharacteristicAdded( - BluetoothGattService* service, - BluetoothGattCharacteristic* characteristic) {} - - // Called when a GATT characteristic |characteristic| belonging to GATT - // service |service| has been removed. - virtual void GattCharacteristicRemoved( - BluetoothGattService* service, - BluetoothGattCharacteristic* characteristic) {} - - // Called when the remote GATT characteristic descriptor |descriptor| - // belonging to characteristic |characteristic| has been discovered. Don't - // cache the arguments as the pointers may become invalid. Instead, use the - // specially assigned identifier to obtain a descriptor and cache that - // identifier as necessary. - virtual void GattDescriptorAdded( - BluetoothGattCharacteristic* characteristic, - BluetoothGattDescriptor* descriptor) {} - - // Called when a GATT characteristic descriptor |descriptor| belonging to - // characteristic |characteristic| has been removed. - virtual void GattDescriptorRemoved( - BluetoothGattCharacteristic* characteristic, - BluetoothGattDescriptor* descriptor) {} - - // Called when the value of a characteristic has changed. This might be a - // result of a read/write request to, or a notification/indication from, a - // remote GATT characteristic. - virtual void GattCharacteristicValueChanged( - BluetoothGattService* service, - BluetoothGattCharacteristic* characteristic, - const std::vector<uint8>& value) {} - - // Called when the value of a characteristic descriptor has been updated. - virtual void GattDescriptorValueChanged( - BluetoothGattCharacteristic* characteristic, - BluetoothGattDescriptor* descriptor, - const std::vector<uint8>& value) {} - }; - // The ErrorCallback is used by methods to asynchronously report errors. typedef base::Closure ErrorCallback; virtual ~BluetoothGattService(); - // Adds and removes observers for events on this GATT service. If monitoring - // multiple services, check the |service| parameter of observer methods to - // determine which service is issuing the event. - virtual void AddObserver(Observer* observer) = 0; - virtual void RemoveObserver(Observer* observer) = 0; - // Constructs a BluetoothGattService that can be locally hosted when the local // adapter is in the peripheral role. The resulting object can then be made // available by calling the "Register" method. This method constructs a |