| 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 DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 const std::string error_name); | 68 const std::string error_name); |
| 69 | 69 |
| 70 // Returns the adapter associated with this service. | 70 // Returns the adapter associated with this service. |
| 71 BluetoothAdapterChromeOS* GetAdapter() const; | 71 BluetoothAdapterChromeOS* GetAdapter() const; |
| 72 | 72 |
| 73 // Notifies its observers that the GATT service has changed. This is mainly | 73 // Notifies its observers that the GATT service has changed. This is mainly |
| 74 // used by BluetoothRemoteGattCharacteristicChromeOS instances to notify | 74 // used by BluetoothRemoteGattCharacteristicChromeOS instances to notify |
| 75 // service observers when characteristic descriptors get added and removed. | 75 // service observers when characteristic descriptors get added and removed. |
| 76 void NotifyServiceChanged(); | 76 void NotifyServiceChanged(); |
| 77 | 77 |
| 78 // Notifies its observers that the value of a characteristic has changed. | |
| 79 // Called by BluetoothRemoteGattCharacteristicChromeOS instances to notify | |
| 80 // service observers when their cached value is updated after a successful | |
| 81 // read request or when a "ValueUpdated" signal is received. | |
| 82 void NotifyCharacteristicValueChanged( | |
| 83 BluetoothRemoteGattCharacteristicChromeOS* characteristic, | |
| 84 const std::vector<uint8>& value); | |
| 85 | |
| 86 // Notifies its observers that a descriptor |descriptor| belonging to | 78 // Notifies its observers that a descriptor |descriptor| belonging to |
| 87 // characteristic |characteristic| has been added or removed. This is used | 79 // characteristic |characteristic| has been added or removed. This is used |
| 88 // by BluetoothRemoteGattCharacteristicChromeOS instances to notify service | 80 // by BluetoothRemoteGattCharacteristicChromeOS instances to notify service |
| 89 // observers when characteristic descriptors get added and removed. If |added| | 81 // observers when characteristic descriptors get added and removed. If |added| |
| 90 // is true, an "Added" event will be sent. Otherwise, a "Removed" event will | 82 // is true, an "Added" event will be sent. Otherwise, a "Removed" event will |
| 91 // be sent. | 83 // be sent. |
| 92 void NotifyDescriptorAddedOrRemoved( | 84 void NotifyDescriptorAddedOrRemoved( |
| 93 BluetoothRemoteGattCharacteristicChromeOS* characteristic, | 85 BluetoothRemoteGattCharacteristicChromeOS* characteristic, |
| 94 BluetoothRemoteGattDescriptorChromeOS* descriptor, | 86 BluetoothRemoteGattDescriptorChromeOS* descriptor, |
| 95 bool added); | 87 bool added); |
| 96 | 88 |
| 97 // Notifies its observers that the value of a descriptor has changed. Called | 89 // Notifies its observers that the value of a descriptor has changed. Called |
| 98 // by BluetoothRemoteGattDescriptorChromeOS instances to notify service | 90 // by BluetoothRemoteGattCharacteristicChromeOS instances to notify service |
| 99 // observers when their cached value gets updated after a read request. | 91 // observers. |
| 100 void NotifyDescriptorValueChanged( | 92 void NotifyDescriptorValueChanged( |
| 101 BluetoothRemoteGattCharacteristicChromeOS* characteristic, | 93 BluetoothRemoteGattCharacteristicChromeOS* characteristic, |
| 102 BluetoothRemoteGattDescriptorChromeOS* descriptor, | 94 BluetoothRemoteGattDescriptorChromeOS* descriptor, |
| 103 const std::vector<uint8>& value); | 95 const std::vector<uint8>& value); |
| 104 | 96 |
| 105 private: | 97 private: |
| 106 friend class BluetoothDeviceChromeOS; | 98 friend class BluetoothDeviceChromeOS; |
| 107 | 99 |
| 108 BluetoothRemoteGattServiceChromeOS(BluetoothAdapterChromeOS* adapter, | 100 BluetoothRemoteGattServiceChromeOS(BluetoothAdapterChromeOS* adapter, |
| 109 BluetoothDeviceChromeOS* device, | 101 BluetoothDeviceChromeOS* device, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // Note: This should remain the last member so it'll be destroyed and | 142 // Note: This should remain the last member so it'll be destroyed and |
| 151 // invalidate its weak pointers before any other members are destroyed. | 143 // invalidate its weak pointers before any other members are destroyed. |
| 152 base::WeakPtrFactory<BluetoothRemoteGattServiceChromeOS> weak_ptr_factory_; | 144 base::WeakPtrFactory<BluetoothRemoteGattServiceChromeOS> weak_ptr_factory_; |
| 153 | 145 |
| 154 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceChromeOS); | 146 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceChromeOS); |
| 155 }; | 147 }; |
| 156 | 148 |
| 157 } // namespace chromeos | 149 } // namespace chromeos |
| 158 | 150 |
| 159 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ | 151 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ |
| OLD | NEW |