OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ADAPTER_OBSERVER_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_TEST_BLUETOOTH_ADAPTER_OBSERVER_H_ |
6 #define DEVICE_BLUETOOTH_TEST_TEST_BLUETOOTH_ADAPTER_OBSERVER_H_ | 6 #define DEVICE_BLUETOOTH_TEST_TEST_BLUETOOTH_ADAPTER_OBSERVER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 BluetoothRemoteGattDescriptor* descriptor) override; | 71 BluetoothRemoteGattDescriptor* descriptor) override; |
72 void GattCharacteristicValueChanged( | 72 void GattCharacteristicValueChanged( |
73 BluetoothAdapter* adapter, | 73 BluetoothAdapter* adapter, |
74 BluetoothRemoteGattCharacteristic* characteristic, | 74 BluetoothRemoteGattCharacteristic* characteristic, |
75 const std::vector<uint8_t>& value) override; | 75 const std::vector<uint8_t>& value) override; |
76 void GattDescriptorValueChanged(BluetoothAdapter* adapter, | 76 void GattDescriptorValueChanged(BluetoothAdapter* adapter, |
77 BluetoothRemoteGattDescriptor* descriptor, | 77 BluetoothRemoteGattDescriptor* descriptor, |
78 const std::vector<uint8_t>& value) override; | 78 const std::vector<uint8_t>& value) override; |
79 | 79 |
80 // Adapter related: | 80 // Adapter related: |
81 int present_changed_count() { return present_changed_count_; } | 81 int present_changed_count() const { return present_changed_count_; } |
82 int powered_changed_count() { return powered_changed_count_; } | 82 int powered_changed_count() const { return powered_changed_count_; } |
83 int discoverable_changed_count() { return discoverable_changed_count_; } | 83 int discoverable_changed_count() const { return discoverable_changed_count_; } |
84 int discovering_changed_count() { return discovering_changed_count_; } | 84 int discovering_changed_count() const { return discovering_changed_count_; } |
85 bool last_present() { return last_present_; } | 85 bool last_present() const { return last_present_; } |
86 bool last_powered() { return last_powered_; } | 86 bool last_powered() const { return last_powered_; } |
87 bool last_discovering() { return last_discovering_; } | 87 bool last_discovering() const { return last_discovering_; } |
88 | 88 |
89 // Device related: | 89 // Device related: |
90 int device_added_count() { return device_added_count_; } | 90 int device_added_count() const { return device_added_count_; } |
91 int device_changed_count() { return device_changed_count_; } | 91 int device_changed_count() const { return device_changed_count_; } |
92 int device_address_changed_count() { return device_address_changed_count_; } | 92 int device_address_changed_count() const { |
| 93 return device_address_changed_count_; |
| 94 } |
93 #if defined(OS_CHROMEOS) || defined(OS_LINUX) | 95 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
94 int device_paired_changed_count() { return device_paired_changed_count_; } | 96 int device_paired_changed_count() const { |
95 bool device_new_paired_status() { return device_new_paired_status_; } | 97 return device_paired_changed_count_; |
| 98 } |
| 99 bool device_new_paired_status() const { return device_new_paired_status_; } |
96 #endif | 100 #endif |
97 int device_removed_count() { return device_removed_count_; } | 101 int device_removed_count() const { return device_removed_count_; } |
98 BluetoothDevice* last_device() { return last_device_; } | 102 BluetoothDevice* last_device() const { return last_device_; } |
99 std::string last_device_address() { return last_device_address_; } | 103 std::string last_device_address() const { return last_device_address_; } |
100 | 104 |
101 // GATT related: | 105 // GATT related: |
102 int gatt_service_added_count() { return gatt_service_added_count_; } | 106 int gatt_service_added_count() const { return gatt_service_added_count_; } |
103 int gatt_service_removed_count() { return gatt_service_removed_count_; } | 107 int gatt_service_removed_count() const { return gatt_service_removed_count_; } |
104 int gatt_services_discovered_count() { | 108 int gatt_services_discovered_count() const { |
105 return gatt_services_discovered_count_; | 109 return gatt_services_discovered_count_; |
106 } | 110 } |
107 int gatt_service_changed_count() { return gatt_service_changed_count_; } | 111 int gatt_service_changed_count() const { return gatt_service_changed_count_; } |
108 int gatt_discovery_complete_count() { return gatt_discovery_complete_count_; } | 112 int gatt_discovery_complete_count() const { |
109 int gatt_characteristic_added_count() { | 113 return gatt_discovery_complete_count_; |
| 114 } |
| 115 int gatt_characteristic_added_count() const { |
110 return gatt_characteristic_added_count_; | 116 return gatt_characteristic_added_count_; |
111 } | 117 } |
112 int gatt_characteristic_removed_count() { | 118 int gatt_characteristic_removed_count() const { |
113 return gatt_characteristic_removed_count_; | 119 return gatt_characteristic_removed_count_; |
114 } | 120 } |
115 int gatt_characteristic_value_changed_count() const { | 121 int gatt_characteristic_value_changed_count() const { |
116 return gatt_characteristic_value_changed_count_; | 122 return gatt_characteristic_value_changed_count_; |
117 } | 123 } |
118 int gatt_descriptor_added_count() { return gatt_descriptor_added_count_; } | 124 int gatt_descriptor_added_count() const { |
119 int gatt_descriptor_removed_count() { return gatt_descriptor_removed_count_; } | 125 return gatt_descriptor_added_count_; |
120 int gatt_descriptor_value_changed_count() { | 126 } |
| 127 int gatt_descriptor_removed_count() const { |
| 128 return gatt_descriptor_removed_count_; |
| 129 } |
| 130 int gatt_descriptor_value_changed_count() const { |
121 return gatt_descriptor_value_changed_count_; | 131 return gatt_descriptor_value_changed_count_; |
122 } | 132 } |
123 std::string last_gatt_service_id() { return last_gatt_service_id_; } | 133 std::string last_gatt_service_id() const { return last_gatt_service_id_; } |
124 BluetoothUUID last_gatt_service_uuid() { return last_gatt_service_uuid_; } | 134 BluetoothUUID last_gatt_service_uuid() const { |
125 std::string last_gatt_characteristic_id() { | 135 return last_gatt_service_uuid_; |
| 136 } |
| 137 std::string last_gatt_characteristic_id() const { |
126 return last_gatt_characteristic_id_; | 138 return last_gatt_characteristic_id_; |
127 } | 139 } |
128 BluetoothUUID last_gatt_characteristic_uuid() { | 140 BluetoothUUID last_gatt_characteristic_uuid() const { |
129 return last_gatt_characteristic_uuid_; | 141 return last_gatt_characteristic_uuid_; |
130 } | 142 } |
131 std::vector<uint8_t> last_changed_characteristic_value() { | 143 std::vector<uint8_t> last_changed_characteristic_value() const { |
132 return last_changed_characteristic_value_; | 144 return last_changed_characteristic_value_; |
133 } | 145 } |
134 std::string last_gatt_descriptor_id() { return last_gatt_descriptor_id_; } | 146 std::string last_gatt_descriptor_id() const { |
135 BluetoothUUID last_gatt_descriptor_uuid() { | 147 return last_gatt_descriptor_id_; |
| 148 } |
| 149 BluetoothUUID last_gatt_descriptor_uuid() const { |
136 return last_gatt_descriptor_uuid_; | 150 return last_gatt_descriptor_uuid_; |
137 } | 151 } |
138 std::vector<uint8_t> last_changed_descriptor_value() { | 152 std::vector<uint8_t> last_changed_descriptor_value() const { |
139 return last_changed_descriptor_value_; | 153 return last_changed_descriptor_value_; |
140 } | 154 } |
141 | 155 |
142 private: | 156 private: |
143 // Some tests use a message loop since background processing is simulated; | 157 // Some tests use a message loop since background processing is simulated; |
144 // break out of those loops. | 158 // break out of those loops. |
145 void QuitMessageLoop(); | 159 void QuitMessageLoop(); |
146 | 160 |
147 scoped_refptr<BluetoothAdapter> adapter_; | 161 scoped_refptr<BluetoothAdapter> adapter_; |
148 | 162 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 std::string last_gatt_descriptor_id_; | 201 std::string last_gatt_descriptor_id_; |
188 BluetoothUUID last_gatt_descriptor_uuid_; | 202 BluetoothUUID last_gatt_descriptor_uuid_; |
189 std::vector<uint8_t> last_changed_descriptor_value_; | 203 std::vector<uint8_t> last_changed_descriptor_value_; |
190 | 204 |
191 DISALLOW_COPY_AND_ASSIGN(TestBluetoothAdapterObserver); | 205 DISALLOW_COPY_AND_ASSIGN(TestBluetoothAdapterObserver); |
192 }; | 206 }; |
193 | 207 |
194 } // namespace device | 208 } // namespace device |
195 | 209 |
196 #endif // DEVICE_BLUETOOTH_TEST_TEST_BLUETOOTH_ADAPTER_OBSERVER_H_ | 210 #endif // DEVICE_BLUETOOTH_TEST_TEST_BLUETOOTH_ADAPTER_OBSERVER_H_ |
OLD | NEW |