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