OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "device/bluetooth/bluetooth_export.h" | |
13 #include "device/bluetooth/bluetooth_uuid.h" | 12 #include "device/bluetooth/bluetooth_uuid.h" |
14 | 13 |
15 namespace device { | 14 namespace device { |
16 | 15 |
17 class BluetoothDevice; | 16 class BluetoothDevice; |
18 class BluetoothGattCharacteristic; | 17 class BluetoothGattCharacteristic; |
19 class BluetoothGattDescriptor; | 18 class BluetoothGattDescriptor; |
20 | 19 |
21 // BluetoothGattService represents a local or remote GATT service. A GATT | 20 // BluetoothGattService represents a local or remote GATT service. A GATT |
22 // service is hosted by a peripheral and represents a collection of data in | 21 // service is hosted by a peripheral and represents a collection of data in |
23 // the form of GATT characteristics and a set of included GATT services if this | 22 // the form of GATT characteristics and a set of included GATT services if this |
24 // service is what is called "a primary service". | 23 // service is what is called "a primary service". |
25 // | 24 // |
26 // Instances of the BluetoothGattService class are used for two functions: | 25 // Instances of the BluetoothGattService class are used for two functions: |
27 // 1. To represent GATT attribute hierarchies that have been received from a | 26 // 1. To represent GATT attribute hierarchies that have been received from a |
28 // remote Bluetooth GATT peripheral. Such BluetoothGattService instances | 27 // remote Bluetooth GATT peripheral. Such BluetoothGattService instances |
29 // are constructed and owned by a BluetoothDevice. | 28 // are constructed and owned by a BluetoothDevice. |
30 // | 29 // |
31 // 2. To represent a locally hosted GATT attribute hierarchy when the local | 30 // 2. To represent a locally hosted GATT attribute hierarchy when the local |
32 // adapter is used in the "peripheral" role. Such instances are meant to be | 31 // adapter is used in the "peripheral" role. Such instances are meant to be |
33 // constructed directly and registered. Once registered, a GATT attribute | 32 // constructed directly and registered. Once registered, a GATT attribute |
34 // hierarchy will be visible to remote devices in the "central" role. | 33 // hierarchy will be visible to remote devices in the "central" role. |
35 class DEVICE_BLUETOOTH_EXPORT BluetoothGattService { | 34 class BluetoothGattService { |
36 public: | 35 public: |
37 // The Delegate class is used to send certain events that need to be handled | 36 // The Delegate class is used to send certain events that need to be handled |
38 // when the device is in peripheral mode. The delegate handles read and write | 37 // when the device is in peripheral mode. The delegate handles read and write |
39 // requests that are issued from remote clients. | 38 // requests that are issued from remote clients. |
40 class Delegate { | 39 class Delegate { |
41 public: | 40 public: |
42 // Callbacks used for communicating GATT request responses. | 41 // Callbacks used for communicating GATT request responses. |
43 typedef base::Callback<void(const std::vector<uint8>)> ValueCallback; | 42 typedef base::Callback<void(const std::vector<uint8>)> ValueCallback; |
44 typedef base::Closure ErrorCallback; | 43 typedef base::Closure ErrorCallback; |
45 | 44 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 protected: | 220 protected: |
222 BluetoothGattService(); | 221 BluetoothGattService(); |
223 | 222 |
224 private: | 223 private: |
225 DISALLOW_COPY_AND_ASSIGN(BluetoothGattService); | 224 DISALLOW_COPY_AND_ASSIGN(BluetoothGattService); |
226 }; | 225 }; |
227 | 226 |
228 } // namespace device | 227 } // namespace device |
229 | 228 |
230 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_H_ | 229 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_H_ |
OLD | NEW |