| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_LOCAL_GATT_SERVICE_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_SERVICE_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_SERVICE_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // |error_callback|. If neither callback parameter is invoked, the request | 117 // |error_callback|. If neither callback parameter is invoked, the request |
| 118 // will time out and result in an error. Therefore, delegates MUST invoke | 118 // will time out and result in an error. Therefore, delegates MUST invoke |
| 119 // either |callback| or |error_callback|. | 119 // either |callback| or |error_callback|. |
| 120 virtual void OnDescriptorWriteRequest( | 120 virtual void OnDescriptorWriteRequest( |
| 121 const BluetoothLocalGattService* service, | 121 const BluetoothLocalGattService* service, |
| 122 const BluetoothLocalGattDescriptor* descriptor, | 122 const BluetoothLocalGattDescriptor* descriptor, |
| 123 const std::vector<uint8_t>& value, | 123 const std::vector<uint8_t>& value, |
| 124 int offset, | 124 int offset, |
| 125 const base::Closure& callback, | 125 const base::Closure& callback, |
| 126 const ErrorCallback& error_callback) = 0; | 126 const ErrorCallback& error_callback) = 0; |
| 127 |
| 128 // Called when a remote device requests notifications to start for |
| 129 // |characteristic|. This is only called if the characteristic has |
| 130 // specified the notify or indicate property. |
| 131 virtual void OnNotificationsStart( |
| 132 const BluetoothLocalGattService* service, |
| 133 const BluetoothLocalGattCharacteristic* characteristic) = 0; |
| 134 |
| 135 // Called when a remote device requests notifications to stop for |
| 136 // |characteristic|. This is only called if the characteristic has |
| 137 // specified the notify or indicate property. |
| 138 virtual void OnNotificationsStop( |
| 139 const BluetoothLocalGattService* service, |
| 140 const BluetoothLocalGattCharacteristic* characteristic) = 0; |
| 127 }; | 141 }; |
| 128 | 142 |
| 129 // Creates a local GATT service to be used with |adapter| (which will own | 143 // Creates a local GATT service to be used with |adapter| (which will own |
| 130 // the created service object). A service can register or unregister itself | 144 // the created service object). A service can register or unregister itself |
| 131 // at any time by calling its Register/Unregister methods. |delegate| | 145 // at any time by calling its Register/Unregister methods. |delegate| |
| 132 // receives read/write requests for characteristic/descriptor values. It | 146 // receives read/write requests for characteristic/descriptor values. It |
| 133 // needs to outlive this object. | 147 // needs to outlive this object. |
| 134 // TODO(rkc): Implement included services. | 148 // TODO(rkc): Implement included services. |
| 135 static base::WeakPtr<BluetoothLocalGattService> Create( | 149 static base::WeakPtr<BluetoothLocalGattService> Create( |
| 136 BluetoothAdapter* adapter, | 150 BluetoothAdapter* adapter, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 164 BluetoothLocalGattService(); | 178 BluetoothLocalGattService(); |
| 165 ~BluetoothLocalGattService() override; | 179 ~BluetoothLocalGattService() override; |
| 166 | 180 |
| 167 private: | 181 private: |
| 168 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattService); | 182 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattService); |
| 169 }; | 183 }; |
| 170 | 184 |
| 171 } // namespace device | 185 } // namespace device |
| 172 | 186 |
| 173 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_SERVICE_H_ | 187 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_SERVICE_H_ |
| OLD | NEW |