OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
EVENT_ROUTER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
EVENT_ROUTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 namespace content { | 31 namespace content { |
32 | 32 |
33 class BrowserContext; | 33 class BrowserContext; |
34 | 34 |
35 } // namespace content | 35 } // namespace content |
36 | 36 |
37 namespace device { | 37 namespace device { |
38 | 38 |
39 class BluetoothGattNotifySession; | 39 class BluetoothGattNotifySession; |
| 40 class BluetoothLocalGattCharacteristic; |
40 | 41 |
41 } // namespace device | 42 } // namespace device |
42 | 43 |
43 namespace extensions { | 44 namespace extensions { |
44 | 45 |
45 class BluetoothLowEnergyConnection; | 46 class BluetoothLowEnergyConnection; |
46 class BluetoothLowEnergyNotifySession; | 47 class BluetoothLowEnergyNotifySession; |
47 class Extension; | 48 class Extension; |
48 | 49 |
49 // The BluetoothLowEnergyEventRouter is used by the bluetoothLowEnergy API to | 50 // The BluetoothLowEnergyEventRouter is used by the bluetoothLowEnergy API to |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 device::BluetoothRemoteGattDescriptor* descriptor) override; | 271 device::BluetoothRemoteGattDescriptor* descriptor) override; |
271 void GattCharacteristicValueChanged( | 272 void GattCharacteristicValueChanged( |
272 device::BluetoothAdapter* adapter, | 273 device::BluetoothAdapter* adapter, |
273 device::BluetoothRemoteGattCharacteristic* characteristic, | 274 device::BluetoothRemoteGattCharacteristic* characteristic, |
274 const std::vector<uint8_t>& value) override; | 275 const std::vector<uint8_t>& value) override; |
275 void GattDescriptorValueChanged( | 276 void GattDescriptorValueChanged( |
276 device::BluetoothAdapter* adapter, | 277 device::BluetoothAdapter* adapter, |
277 device::BluetoothRemoteGattDescriptor* descriptor, | 278 device::BluetoothRemoteGattDescriptor* descriptor, |
278 const std::vector<uint8_t>& value) override; | 279 const std::vector<uint8_t>& value) override; |
279 | 280 |
| 281 // Adds a mapping for a local characteristic ID to its service ID |
| 282 void AddLocalCharacteristic(const std::string& id, |
| 283 const std::string& service_id); |
| 284 // Returns a BluetoothGattCharacteristic by its ID |id|. |
| 285 // Returns NULL, if the characteristic cannot be found. |
| 286 device::BluetoothLocalGattCharacteristic* GetLocalCharacteristic( |
| 287 const std::string& id) const; |
| 288 |
280 device::BluetoothAdapter* adapter() { return adapter_.get(); } | 289 device::BluetoothAdapter* adapter() { return adapter_.get(); } |
281 | 290 |
282 private: | 291 private: |
283 // Called by BluetoothAdapterFactory. | 292 // Called by BluetoothAdapterFactory. |
284 void OnGetAdapter(const base::Closure& callback, | 293 void OnGetAdapter(const base::Closure& callback, |
285 scoped_refptr<device::BluetoothAdapter> adapter); | 294 scoped_refptr<device::BluetoothAdapter> adapter); |
286 | 295 |
287 // Initializes the identifier for all existing GATT objects and devices. | 296 // Initializes the identifier for all existing GATT objects and devices. |
288 // Called by OnGetAdapter and SetAdapterForTesting. | 297 // Called by OnGetAdapter and SetAdapterForTesting. |
289 void InitializeIdentifierMappings(); | 298 void InitializeIdentifierMappings(); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 // Note: This should remain the last member so it'll be destroyed and | 439 // Note: This should remain the last member so it'll be destroyed and |
431 // invalidate its weak pointers before any other members are destroyed. | 440 // invalidate its weak pointers before any other members are destroyed. |
432 base::WeakPtrFactory<BluetoothLowEnergyEventRouter> weak_ptr_factory_; | 441 base::WeakPtrFactory<BluetoothLowEnergyEventRouter> weak_ptr_factory_; |
433 | 442 |
434 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyEventRouter); | 443 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyEventRouter); |
435 }; | 444 }; |
436 | 445 |
437 } // namespace extensions | 446 } // namespace extensions |
438 | 447 |
439 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENER
GY_EVENT_ROUTER_H_ | 448 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENER
GY_EVENT_ROUTER_H_ |
OLD | NEW |