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_REMOTE_GATT_CHARACTERISTIC_WIN_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 std::vector<uint8_t>& GetValue() const override; | 39 std::vector<uint8_t>& GetValue() const override; |
40 BluetoothRemoteGattService* GetService() const override; | 40 BluetoothRemoteGattService* GetService() const override; |
41 Properties GetProperties() const override; | 41 Properties GetProperties() const override; |
42 Permissions GetPermissions() const override; | 42 Permissions GetPermissions() const override; |
43 bool IsNotifying() const override; | 43 bool IsNotifying() const override; |
44 std::vector<BluetoothRemoteGattDescriptor*> GetDescriptors() const override; | 44 std::vector<BluetoothRemoteGattDescriptor*> GetDescriptors() const override; |
45 BluetoothRemoteGattDescriptor* GetDescriptor( | 45 BluetoothRemoteGattDescriptor* GetDescriptor( |
46 const std::string& identifier) const override; | 46 const std::string& identifier) const override; |
47 void StartNotifySession(const NotifySessionCallback& callback, | 47 void StartNotifySession(const NotifySessionCallback& callback, |
48 const ErrorCallback& error_callback) override; | 48 const ErrorCallback& error_callback) override; |
| 49 void StopNotifySession(BluetoothGattNotifySession* session, |
| 50 const base::Closure& callback) override; |
49 void ReadRemoteCharacteristic(const ValueCallback& callback, | 51 void ReadRemoteCharacteristic(const ValueCallback& callback, |
50 const ErrorCallback& error_callback) override; | 52 const ErrorCallback& error_callback) override; |
51 void WriteRemoteCharacteristic(const std::vector<uint8_t>& new_value, | 53 void WriteRemoteCharacteristic(const std::vector<uint8_t>& new_value, |
52 const base::Closure& callback, | 54 const base::Closure& callback, |
53 const ErrorCallback& error_callback) override; | 55 const ErrorCallback& error_callback) override; |
54 | 56 |
55 // Update included descriptors. | 57 // Update included descriptors. |
56 void Update(); | 58 void Update(); |
57 uint16_t GetAttributeHandle() const; | 59 uint16_t GetAttributeHandle() const; |
58 BluetoothRemoteGattServiceWin* GetWinService() { return parent_service_; } | 60 BluetoothRemoteGattServiceWin* GetWinService() { return parent_service_; } |
59 | 61 |
| 62 protected: |
| 63 void SubscribeToNotifications(BluetoothRemoteGattDescriptor* ccc_descriptor, |
| 64 const base::Closure& callback, |
| 65 const ErrorCallback& error_callback) override; |
| 66 void UnsubscribeFromNotifications( |
| 67 BluetoothRemoteGattDescriptor* ccc_descriptor, |
| 68 const base::Closure& callback, |
| 69 const ErrorCallback& error_callback) override; |
| 70 |
60 private: | 71 private: |
61 void OnGetIncludedDescriptorsCallback( | 72 void OnGetIncludedDescriptorsCallback( |
62 std::unique_ptr<BTH_LE_GATT_DESCRIPTOR> descriptors, | 73 std::unique_ptr<BTH_LE_GATT_DESCRIPTOR> descriptors, |
63 uint16_t num, | 74 uint16_t num, |
64 HRESULT hr); | 75 HRESULT hr); |
65 void UpdateIncludedDescriptors(PBTH_LE_GATT_DESCRIPTOR descriptors, | 76 void UpdateIncludedDescriptors(PBTH_LE_GATT_DESCRIPTOR descriptors, |
66 uint16_t num); | 77 uint16_t num); |
67 | 78 |
68 // Checks if the descriptor with |uuid| and |attribute_handle| has already | 79 // Checks if the descriptor with |uuid| and |attribute_handle| has already |
69 // been discovered as included descriptor. | 80 // been discovered as included descriptor. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // GATT event handle returned by GattEventRegistrationCallback. | 135 // GATT event handle returned by GattEventRegistrationCallback. |
125 PVOID gatt_event_handle_; | 136 PVOID gatt_event_handle_; |
126 | 137 |
127 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicWin> weak_ptr_factory_; | 138 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicWin> weak_ptr_factory_; |
128 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicWin); | 139 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicWin); |
129 }; | 140 }; |
130 | 141 |
131 } // namespace device | 142 } // namespace device |
132 | 143 |
133 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_ | 144 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_ |
OLD | NEW |