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