Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: device/bluetooth/bluetooth_adapter.h

Issue 2037173003: Notify the BluetoothAdapter::Observer when a bluetooth peripheral disconnects on Android and Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_adapter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_ADAPTER_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // is not. 75 // is not.
76 virtual void AdapterDiscoveringChanged(BluetoothAdapter* adapter, 76 virtual void AdapterDiscoveringChanged(BluetoothAdapter* adapter,
77 bool discovering) {} 77 bool discovering) {}
78 78
79 // Called when a new device |device| is added to the adapter |adapter|, 79 // Called when a new device |device| is added to the adapter |adapter|,
80 // either because it has been discovered or a connection made. |device| 80 // either because it has been discovered or a connection made. |device|
81 // should not be cached. Instead, copy its Bluetooth address. 81 // should not be cached. Instead, copy its Bluetooth address.
82 virtual void DeviceAdded(BluetoothAdapter* adapter, 82 virtual void DeviceAdded(BluetoothAdapter* adapter,
83 BluetoothDevice* device) {} 83 BluetoothDevice* device) {}
84 84
85 // Called when properties of the device |device| known to the adapter 85 // Called when the result of one of the following methods of the device
86 // |adapter| change. |device| should not be cached. Instead, copy its 86 // |device| changes:
87 // Bluetooth address. 87 // * GetAddress()
88 // * GetAppearance()
89 // * GetBluetoothClass()
90 // * GetInquiryRSSI()
91 // * GetInquiryTxPower()
92 // * GetUUIDs()
93 // * IsConnectable()
94 // * IsConnected()
95 // * IsConnecting()
96 // * IsGattConnected()
97 // * IsPaired()
98 // * IsTrustable()
99 //
100 // |device| should not be cached. Instead, copy its Bluetooth address.
88 virtual void DeviceChanged(BluetoothAdapter* adapter, 101 virtual void DeviceChanged(BluetoothAdapter* adapter,
89 BluetoothDevice* device) {} 102 BluetoothDevice* device) {}
90 103
91 // Called when address property of the device |device| known to the adapter 104 // Called when address property of the device |device| known to the adapter
92 // |adapter| change due to pairing. 105 // |adapter| change due to pairing.
93 virtual void DeviceAddressChanged(BluetoothAdapter* adapter, 106 virtual void DeviceAddressChanged(BluetoothAdapter* adapter,
94 BluetoothDevice* device, 107 BluetoothDevice* device,
95 const std::string& old_address) {} 108 const std::string& old_address) {}
96 109
97 #if defined(OS_CHROMEOS) || defined(OS_LINUX) 110 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 const CreateAdvertisementCallback& callback, 434 const CreateAdvertisementCallback& callback,
422 const CreateAdvertisementErrorCallback& error_callback) = 0; 435 const CreateAdvertisementErrorCallback& error_callback) = 0;
423 436
424 // Returns the local GATT services associated with this adapter with the 437 // Returns the local GATT services associated with this adapter with the
425 // given identifier. Returns NULL if the service doesn't exist. 438 // given identifier. Returns NULL if the service doesn't exist.
426 virtual BluetoothLocalGattService* GetGattService( 439 virtual BluetoothLocalGattService* GetGattService(
427 const std::string& identifier) const = 0; 440 const std::string& identifier) const = 0;
428 441
429 // The following methods are used to send various events to observers. 442 // The following methods are used to send various events to observers.
430 void NotifyAdapterStateChanged(bool powered); 443 void NotifyAdapterStateChanged(bool powered);
444 void NotifyDeviceChanged(BluetoothDevice* device);
445
431 #if defined(OS_CHROMEOS) || defined(OS_LINUX) 446 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
432 // This function is implemented for ChromeOS only, and the support on 447 // This function is implemented for ChromeOS only, and the support on
433 // Android, MaxOS and Windows should be added on demand in the future. 448 // Android, MaxOS and Windows should be added on demand in the future.
434 void NotifyDevicePairedChanged(BluetoothDevice* device, 449 void NotifyDevicePairedChanged(BluetoothDevice* device,
435 bool new_paired_status); 450 bool new_paired_status);
436 #endif 451 #endif
437 void NotifyGattServiceAdded(BluetoothRemoteGattService* service); 452 void NotifyGattServiceAdded(BluetoothRemoteGattService* service);
438 void NotifyGattServiceRemoved(BluetoothRemoteGattService* service); 453 void NotifyGattServiceRemoved(BluetoothRemoteGattService* service);
439 void NotifyGattServiceChanged(BluetoothRemoteGattService* service); 454 void NotifyGattServiceChanged(BluetoothRemoteGattService* service);
440 void NotifyGattServicesDiscovered(BluetoothDevice* device); 455 void NotifyGattServicesDiscovered(BluetoothDevice* device);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 std::set<BluetoothDiscoverySession*> discovery_sessions_; 598 std::set<BluetoothDiscoverySession*> discovery_sessions_;
584 599
585 // Note: This should remain the last member so it'll be destroyed and 600 // Note: This should remain the last member so it'll be destroyed and
586 // invalidate its weak pointers before any other members are destroyed. 601 // invalidate its weak pointers before any other members are destroyed.
587 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; 602 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_;
588 }; 603 };
589 604
590 } // namespace device 605 } // namespace device
591 606
592 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 607 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698