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_TEST_TEST_BLUETOOTH_LOCAL_GATT_SERVICE_DELEGATE_H_ |
| 6 #define DEVICE_BLUETOOTH_TEST_TEST_BLUETOOTH_LOCAL_GATT_SERVICE_DELEGATE_H_ |
| 7 |
| 8 #include <cstdint> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/callback_forward.h" |
| 12 #include "base/macros.h" |
| 13 #include "device/bluetooth/bluetooth_local_gatt_characteristic.h" |
| 14 #include "device/bluetooth/bluetooth_local_gatt_descriptor.h" |
| 15 #include "device/bluetooth/bluetooth_local_gatt_service.h" |
| 16 |
| 17 namespace device { |
| 18 |
| 19 class TestBluetoothLocalGattServiceDelegate |
| 20 : public BluetoothLocalGattService::Delegate { |
| 21 public: |
| 22 TestBluetoothLocalGattServiceDelegate(); |
| 23 |
| 24 void OnCharacteristicReadRequest( |
| 25 const BluetoothLocalGattService* service, |
| 26 const BluetoothLocalGattCharacteristic* characteristic, |
| 27 int offset, |
| 28 const ValueCallback& callback, |
| 29 const ErrorCallback& error_callback) override; |
| 30 void OnCharacteristicWriteRequest( |
| 31 const BluetoothLocalGattService* service, |
| 32 const BluetoothLocalGattCharacteristic* characteristic, |
| 33 const std::vector<uint8_t>& value, |
| 34 int offset, |
| 35 const base::Closure& callback, |
| 36 const ErrorCallback& error_callback) override; |
| 37 void OnDescriptorReadRequest(const BluetoothLocalGattService* service, |
| 38 const BluetoothLocalGattDescriptor* descriptor, |
| 39 int offset, |
| 40 const ValueCallback& callback, |
| 41 const ErrorCallback& error_callback) override; |
| 42 |
| 43 void OnDescriptorWriteRequest(const BluetoothLocalGattService* service, |
| 44 const BluetoothLocalGattDescriptor* descriptor, |
| 45 const std::vector<uint8_t>& value, |
| 46 int offset, |
| 47 const base::Closure& callback, |
| 48 const ErrorCallback& error_callback) override; |
| 49 |
| 50 void set_expected_service(BluetoothLocalGattService* service) { |
| 51 expected_service_ = service; |
| 52 } |
| 53 |
| 54 void set_expected_characteristic( |
| 55 BluetoothLocalGattCharacteristic* characteristic) { |
| 56 expected_characteristic_ = characteristic; |
| 57 } |
| 58 |
| 59 void set_expected_descriptor(BluetoothLocalGattDescriptor* descriptor) { |
| 60 expected_descriptor_ = descriptor; |
| 61 } |
| 62 |
| 63 bool should_fail_; |
| 64 uint64_t last_written_value_; |
| 65 uint64_t value_to_write_; |
| 66 |
| 67 private: |
| 68 BluetoothLocalGattService* expected_service_; |
| 69 BluetoothLocalGattCharacteristic* expected_characteristic_; |
| 70 BluetoothLocalGattDescriptor* expected_descriptor_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(TestBluetoothLocalGattServiceDelegate); |
| 73 }; |
| 74 |
| 75 } // namespace device |
| 76 |
| 77 #endif // DEVICE_BLUETOOTH_TEST_TEST_BLUETOOTH_LOCAL_GATT_SERVICE_DELEGATE_H_ |
OLD | NEW |