| 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_TEST_TEST_BLUETOOTH_LOCAL_GATT_SERVICE_DELEGATE_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_TEST_BLUETOOTH_LOCAL_GATT_SERVICE_DELEGATE_H_ |
| 6 #define DEVICE_BLUETOOTH_TEST_TEST_BLUETOOTH_LOCAL_GATT_SERVICE_DELEGATE_H_ | 6 #define DEVICE_BLUETOOTH_TEST_TEST_BLUETOOTH_LOCAL_GATT_SERVICE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "device/bluetooth/bluetooth_local_gatt_characteristic.h" | 13 #include "device/bluetooth/bluetooth_local_gatt_characteristic.h" |
| 14 #include "device/bluetooth/bluetooth_local_gatt_descriptor.h" | 14 #include "device/bluetooth/bluetooth_local_gatt_descriptor.h" |
| 15 #include "device/bluetooth/bluetooth_local_gatt_service.h" | 15 #include "device/bluetooth/bluetooth_local_gatt_service.h" |
| 16 | 16 |
| 17 namespace device { | 17 namespace device { |
| 18 | 18 |
| 19 class TestBluetoothLocalGattServiceDelegate | 19 class TestBluetoothLocalGattServiceDelegate |
| 20 : public BluetoothLocalGattService::Delegate { | 20 : public BluetoothLocalGattService::Delegate { |
| 21 public: | 21 public: |
| 22 TestBluetoothLocalGattServiceDelegate(); | 22 TestBluetoothLocalGattServiceDelegate(); |
| 23 virtual ~TestBluetoothLocalGattServiceDelegate(); | 23 virtual ~TestBluetoothLocalGattServiceDelegate(); |
| 24 | 24 |
| 25 // BluetoothLocalGattService::Delegate overrides: | 25 // BluetoothLocalGattService::Delegate overrides: |
| 26 void OnCharacteristicReadRequest( | 26 void OnCharacteristicReadRequest( |
| 27 const BluetoothLocalGattService* service, | 27 const BluetoothDevice* device, |
| 28 const BluetoothLocalGattCharacteristic* characteristic, | 28 const BluetoothLocalGattCharacteristic* characteristic, |
| 29 int offset, | 29 int offset, |
| 30 const ValueCallback& callback, | 30 const ValueCallback& callback, |
| 31 const ErrorCallback& error_callback) override; | 31 const ErrorCallback& error_callback) override; |
| 32 void OnCharacteristicWriteRequest( | 32 void OnCharacteristicWriteRequest( |
| 33 const BluetoothLocalGattService* service, | 33 const BluetoothDevice* device, |
| 34 const BluetoothLocalGattCharacteristic* characteristic, | 34 const BluetoothLocalGattCharacteristic* characteristic, |
| 35 const std::vector<uint8_t>& value, | 35 const std::vector<uint8_t>& value, |
| 36 int offset, | 36 int offset, |
| 37 const base::Closure& callback, | 37 const base::Closure& callback, |
| 38 const ErrorCallback& error_callback) override; | 38 const ErrorCallback& error_callback) override; |
| 39 void OnDescriptorReadRequest(const BluetoothLocalGattService* service, | 39 void OnDescriptorReadRequest(const BluetoothDevice* device, |
| 40 const BluetoothLocalGattDescriptor* descriptor, | 40 const BluetoothLocalGattDescriptor* descriptor, |
| 41 int offset, | 41 int offset, |
| 42 const ValueCallback& callback, | 42 const ValueCallback& callback, |
| 43 const ErrorCallback& error_callback) override; | 43 const ErrorCallback& error_callback) override; |
| 44 | 44 |
| 45 void OnDescriptorWriteRequest(const BluetoothLocalGattService* service, | 45 void OnDescriptorWriteRequest(const BluetoothDevice* device, |
| 46 const BluetoothLocalGattDescriptor* descriptor, | 46 const BluetoothLocalGattDescriptor* descriptor, |
| 47 const std::vector<uint8_t>& value, | 47 const std::vector<uint8_t>& value, |
| 48 int offset, | 48 int offset, |
| 49 const base::Closure& callback, | 49 const base::Closure& callback, |
| 50 const ErrorCallback& error_callback) override; | 50 const ErrorCallback& error_callback) override; |
| 51 void OnNotificationsStart( | 51 void OnNotificationsStart( |
| 52 const BluetoothLocalGattService* service, | 52 const BluetoothDevice* device, |
| 53 const BluetoothLocalGattCharacteristic* characteristic) override; | 53 const BluetoothLocalGattCharacteristic* characteristic) override; |
| 54 void OnNotificationsStop( | 54 void OnNotificationsStop( |
| 55 const BluetoothLocalGattService* service, | 55 const BluetoothDevice* device, |
| 56 const BluetoothLocalGattCharacteristic* characteristic) override; | 56 const BluetoothLocalGattCharacteristic* characteristic) override; |
| 57 | 57 |
| 58 bool NotificationStatusForCharacteristic( | 58 bool NotificationStatusForCharacteristic( |
| 59 BluetoothLocalGattCharacteristic* characteristic); | 59 BluetoothLocalGattCharacteristic* characteristic); |
| 60 | 60 |
| 61 void set_expected_service(BluetoothLocalGattService* service) { | 61 void set_expected_service(BluetoothLocalGattService* service) { |
| 62 expected_service_ = service; | 62 expected_service_ = service; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void set_expected_characteristic( | 65 void set_expected_characteristic( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 81 BluetoothLocalGattDescriptor* expected_descriptor_; | 81 BluetoothLocalGattDescriptor* expected_descriptor_; |
| 82 | 82 |
| 83 std::map<std::string, bool> notifications_started_for_characteristic_; | 83 std::map<std::string, bool> notifications_started_for_characteristic_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(TestBluetoothLocalGattServiceDelegate); | 85 DISALLOW_COPY_AND_ASSIGN(TestBluetoothLocalGattServiceDelegate); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace device | 88 } // namespace device |
| 89 | 89 |
| 90 #endif // DEVICE_BLUETOOTH_TEST_TEST_BLUETOOTH_LOCAL_GATT_SERVICE_DELEGATE_H_ | 90 #endif // DEVICE_BLUETOOTH_TEST_TEST_BLUETOOTH_LOCAL_GATT_SERVICE_DELEGATE_H_ |
| OLD | NEW |