OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "device/bluetooth/bluetooth_export.h" |
| 13 #include "device/bluetooth/bluetooth_gatt_service.h" |
| 14 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| 15 #include "device/bluetooth/bluetooth_uuid.h" |
| 16 |
| 17 namespace device { |
| 18 |
| 19 class BluetoothDevice; |
| 20 class BluetoothRemoteGattCharacteristic; |
| 21 class BluetoothRemoteGattDescriptor; |
| 22 |
| 23 // BluetoothRemoteGattService represents a remote GATT service. |
| 24 // |
| 25 // Instances of the BluetoothRemoteGATTService class are used to represent GATT |
| 26 // attribute hierarchies that have been received from a |
| 27 // remote Bluetooth GATT peripheral. Such BluetoothRemoteGattService instances |
| 28 // are constructed and owned by a BluetoothDevice. |
| 29 // |
| 30 // Note: We use virtual inheritance on the GATT service since it will be |
| 31 // inherited by platform specific versions of the GATT service classes also. The |
| 32 // platform specific remote GATT service classes will inherit both this class |
| 33 // and their GATT service class, hence causing an inheritance diamond. |
| 34 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattService |
| 35 : public virtual BluetoothGattService { |
| 36 public: |
| 37 ~BluetoothRemoteGattService() override; |
| 38 |
| 39 // The Bluetooth-specific UUID of the service. |
| 40 virtual BluetoothUUID GetUUID() const = 0; |
| 41 |
| 42 // Returns the BluetoothDevice that this GATT service was received from, which |
| 43 // also owns this service. |
| 44 virtual BluetoothDevice* GetDevice() const = 0; |
| 45 |
| 46 // Indicates whether the type of this service is primary or secondary. A |
| 47 // primary service describes the primary function of the peripheral that |
| 48 // hosts it, while a secondary service only makes sense in the presence of a |
| 49 // primary service. A primary service may include other primary or secondary |
| 50 // services. |
| 51 virtual bool IsPrimary() const = 0; |
| 52 |
| 53 // List of characteristics that belong to this service. |
| 54 virtual std::vector<BluetoothRemoteGattCharacteristic*> GetCharacteristics() |
| 55 const = 0; |
| 56 |
| 57 // List of GATT services that are included by this service. |
| 58 virtual std::vector<BluetoothRemoteGattService*> GetIncludedServices() |
| 59 const = 0; |
| 60 |
| 61 // Returns the GATT characteristic with identifier |identifier| if it belongs |
| 62 // to this GATT service. |
| 63 virtual BluetoothRemoteGattCharacteristic* GetCharacteristic( |
| 64 const std::string& identifier) const = 0; |
| 65 |
| 66 protected: |
| 67 BluetoothRemoteGattService(); |
| 68 |
| 69 private: |
| 70 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattService); |
| 71 }; |
| 72 |
| 73 } // namespace device |
| 74 |
| 75 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_H_ |
OLD | NEW |