| 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 EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ |
| 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ | 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event
_router.h" | 9 #include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event
_router.h" |
| 10 #include "extensions/browser/browser_context_keyed_api_factory.h" | 10 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 static BrowserContextKeyedAPIFactory<BluetoothLowEnergyAPI>* | 21 static BrowserContextKeyedAPIFactory<BluetoothLowEnergyAPI>* |
| 22 GetFactoryInstance(); | 22 GetFactoryInstance(); |
| 23 | 23 |
| 24 // Convenience method to get the BluetoothLowEnergy API for a browser context. | 24 // Convenience method to get the BluetoothLowEnergy API for a browser context. |
| 25 static BluetoothLowEnergyAPI* Get(content::BrowserContext* context); | 25 static BluetoothLowEnergyAPI* Get(content::BrowserContext* context); |
| 26 | 26 |
| 27 explicit BluetoothLowEnergyAPI(content::BrowserContext* context); | 27 explicit BluetoothLowEnergyAPI(content::BrowserContext* context); |
| 28 virtual ~BluetoothLowEnergyAPI(); | 28 virtual ~BluetoothLowEnergyAPI(); |
| 29 | 29 |
| 30 // KeyedService implementation.. | 30 // KeyedService implementation.. |
| 31 virtual void Shutdown() OVERRIDE; | 31 virtual void Shutdown() override; |
| 32 | 32 |
| 33 BluetoothLowEnergyEventRouter* event_router() const { | 33 BluetoothLowEnergyEventRouter* event_router() const { |
| 34 return event_router_.get(); | 34 return event_router_.get(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 // BrowserContextKeyedAPI implementation. | 37 // BrowserContextKeyedAPI implementation. |
| 38 static const char* service_name() { return "BluetoothLowEnergyAPI"; } | 38 static const char* service_name() { return "BluetoothLowEnergyAPI"; } |
| 39 static const bool kServiceRedirectedInIncognito = true; | 39 static const bool kServiceRedirectedInIncognito = true; |
| 40 static const bool kServiceIsNULLWhileTesting = true; | 40 static const bool kServiceIsNULLWhileTesting = true; |
| 41 | 41 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 55 // the common logic involved in all API functions, such as checking for | 55 // the common logic involved in all API functions, such as checking for |
| 56 // platform support and returning the correct error. | 56 // platform support and returning the correct error. |
| 57 class BluetoothLowEnergyExtensionFunction : public AsyncExtensionFunction { | 57 class BluetoothLowEnergyExtensionFunction : public AsyncExtensionFunction { |
| 58 public: | 58 public: |
| 59 BluetoothLowEnergyExtensionFunction(); | 59 BluetoothLowEnergyExtensionFunction(); |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 virtual ~BluetoothLowEnergyExtensionFunction(); | 62 virtual ~BluetoothLowEnergyExtensionFunction(); |
| 63 | 63 |
| 64 // ExtensionFunction override. | 64 // ExtensionFunction override. |
| 65 virtual bool RunAsync() OVERRIDE; | 65 virtual bool RunAsync() override; |
| 66 | 66 |
| 67 // Implemented by individual bluetoothLowEnergy extension functions to perform | 67 // Implemented by individual bluetoothLowEnergy extension functions to perform |
| 68 // the body of the function. This invoked asynchonously after RunAsync after | 68 // the body of the function. This invoked asynchonously after RunAsync after |
| 69 // the BluetoothLowEnergyEventRouter has obtained a handle on the | 69 // the BluetoothLowEnergyEventRouter has obtained a handle on the |
| 70 // BluetoothAdapter. | 70 // BluetoothAdapter. |
| 71 virtual bool DoWork() = 0; | 71 virtual bool DoWork() = 0; |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyExtensionFunction); | 74 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyExtensionFunction); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 class BluetoothLowEnergyConnectFunction | 77 class BluetoothLowEnergyConnectFunction |
| 78 : public BluetoothLowEnergyExtensionFunction { | 78 : public BluetoothLowEnergyExtensionFunction { |
| 79 public: | 79 public: |
| 80 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.connect", | 80 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.connect", |
| 81 BLUETOOTHLOWENERGY_CONNECT); | 81 BLUETOOTHLOWENERGY_CONNECT); |
| 82 | 82 |
| 83 protected: | 83 protected: |
| 84 virtual ~BluetoothLowEnergyConnectFunction() {} | 84 virtual ~BluetoothLowEnergyConnectFunction() {} |
| 85 | 85 |
| 86 // BluetoothLowEnergyExtensionFunction override. | 86 // BluetoothLowEnergyExtensionFunction override. |
| 87 virtual bool DoWork() OVERRIDE; | 87 virtual bool DoWork() override; |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 // Success and error callbacks, called by | 90 // Success and error callbacks, called by |
| 91 // BluetoothLowEnergyEventRouter::Connect. | 91 // BluetoothLowEnergyEventRouter::Connect. |
| 92 void SuccessCallback(); | 92 void SuccessCallback(); |
| 93 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); | 93 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 class BluetoothLowEnergyDisconnectFunction | 96 class BluetoothLowEnergyDisconnectFunction |
| 97 : public BluetoothLowEnergyExtensionFunction { | 97 : public BluetoothLowEnergyExtensionFunction { |
| 98 public: | 98 public: |
| 99 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.disconnect", | 99 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.disconnect", |
| 100 BLUETOOTHLOWENERGY_DISCONNECT); | 100 BLUETOOTHLOWENERGY_DISCONNECT); |
| 101 | 101 |
| 102 protected: | 102 protected: |
| 103 virtual ~BluetoothLowEnergyDisconnectFunction() {} | 103 virtual ~BluetoothLowEnergyDisconnectFunction() {} |
| 104 | 104 |
| 105 // BluetoothLowEnergyExtensionFunction override. | 105 // BluetoothLowEnergyExtensionFunction override. |
| 106 virtual bool DoWork() OVERRIDE; | 106 virtual bool DoWork() override; |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 // Success and error callbacks, called by | 109 // Success and error callbacks, called by |
| 110 // BluetoothLowEnergyEventRouter::Disconnect. | 110 // BluetoothLowEnergyEventRouter::Disconnect. |
| 111 void SuccessCallback(); | 111 void SuccessCallback(); |
| 112 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); | 112 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 class BluetoothLowEnergyGetServiceFunction | 115 class BluetoothLowEnergyGetServiceFunction |
| 116 : public BluetoothLowEnergyExtensionFunction { | 116 : public BluetoothLowEnergyExtensionFunction { |
| 117 public: | 117 public: |
| 118 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getService", | 118 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getService", |
| 119 BLUETOOTHLOWENERGY_GETSERVICE); | 119 BLUETOOTHLOWENERGY_GETSERVICE); |
| 120 | 120 |
| 121 protected: | 121 protected: |
| 122 virtual ~BluetoothLowEnergyGetServiceFunction() {} | 122 virtual ~BluetoothLowEnergyGetServiceFunction() {} |
| 123 | 123 |
| 124 // BluetoothLowEnergyExtensionFunction override. | 124 // BluetoothLowEnergyExtensionFunction override. |
| 125 virtual bool DoWork() OVERRIDE; | 125 virtual bool DoWork() override; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 class BluetoothLowEnergyGetServicesFunction | 128 class BluetoothLowEnergyGetServicesFunction |
| 129 : public BluetoothLowEnergyExtensionFunction { | 129 : public BluetoothLowEnergyExtensionFunction { |
| 130 public: | 130 public: |
| 131 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getServices", | 131 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getServices", |
| 132 BLUETOOTHLOWENERGY_GETSERVICES); | 132 BLUETOOTHLOWENERGY_GETSERVICES); |
| 133 | 133 |
| 134 protected: | 134 protected: |
| 135 virtual ~BluetoothLowEnergyGetServicesFunction() {} | 135 virtual ~BluetoothLowEnergyGetServicesFunction() {} |
| 136 | 136 |
| 137 // BluetoothLowEnergyExtensionFunction override. | 137 // BluetoothLowEnergyExtensionFunction override. |
| 138 virtual bool DoWork() OVERRIDE; | 138 virtual bool DoWork() override; |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 class BluetoothLowEnergyGetCharacteristicFunction | 141 class BluetoothLowEnergyGetCharacteristicFunction |
| 142 : public BluetoothLowEnergyExtensionFunction { | 142 : public BluetoothLowEnergyExtensionFunction { |
| 143 public: | 143 public: |
| 144 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getCharacteristic", | 144 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getCharacteristic", |
| 145 BLUETOOTHLOWENERGY_GETCHARACTERISTIC); | 145 BLUETOOTHLOWENERGY_GETCHARACTERISTIC); |
| 146 | 146 |
| 147 protected: | 147 protected: |
| 148 virtual ~BluetoothLowEnergyGetCharacteristicFunction() {} | 148 virtual ~BluetoothLowEnergyGetCharacteristicFunction() {} |
| 149 | 149 |
| 150 // BluetoothLowEnergyExtensionFunction override. | 150 // BluetoothLowEnergyExtensionFunction override. |
| 151 virtual bool DoWork() OVERRIDE; | 151 virtual bool DoWork() override; |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 class BluetoothLowEnergyGetCharacteristicsFunction | 154 class BluetoothLowEnergyGetCharacteristicsFunction |
| 155 : public BluetoothLowEnergyExtensionFunction { | 155 : public BluetoothLowEnergyExtensionFunction { |
| 156 public: | 156 public: |
| 157 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getCharacteristics", | 157 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getCharacteristics", |
| 158 BLUETOOTHLOWENERGY_GETCHARACTERISTICS); | 158 BLUETOOTHLOWENERGY_GETCHARACTERISTICS); |
| 159 | 159 |
| 160 protected: | 160 protected: |
| 161 virtual ~BluetoothLowEnergyGetCharacteristicsFunction() {} | 161 virtual ~BluetoothLowEnergyGetCharacteristicsFunction() {} |
| 162 | 162 |
| 163 // BluetoothLowEnergyExtensionFunction override. | 163 // BluetoothLowEnergyExtensionFunction override. |
| 164 virtual bool DoWork() OVERRIDE; | 164 virtual bool DoWork() override; |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 class BluetoothLowEnergyGetIncludedServicesFunction | 167 class BluetoothLowEnergyGetIncludedServicesFunction |
| 168 : public BluetoothLowEnergyExtensionFunction { | 168 : public BluetoothLowEnergyExtensionFunction { |
| 169 public: | 169 public: |
| 170 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getIncludedServices", | 170 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getIncludedServices", |
| 171 BLUETOOTHLOWENERGY_GETINCLUDEDSERVICES); | 171 BLUETOOTHLOWENERGY_GETINCLUDEDSERVICES); |
| 172 | 172 |
| 173 protected: | 173 protected: |
| 174 virtual ~BluetoothLowEnergyGetIncludedServicesFunction() {} | 174 virtual ~BluetoothLowEnergyGetIncludedServicesFunction() {} |
| 175 | 175 |
| 176 // BluetoothLowEnergyExtensionFunction override. | 176 // BluetoothLowEnergyExtensionFunction override. |
| 177 virtual bool DoWork() OVERRIDE; | 177 virtual bool DoWork() override; |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 class BluetoothLowEnergyGetDescriptorFunction | 180 class BluetoothLowEnergyGetDescriptorFunction |
| 181 : public BluetoothLowEnergyExtensionFunction { | 181 : public BluetoothLowEnergyExtensionFunction { |
| 182 public: | 182 public: |
| 183 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getDescriptor", | 183 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getDescriptor", |
| 184 BLUETOOTHLOWENERGY_GETDESCRIPTOR); | 184 BLUETOOTHLOWENERGY_GETDESCRIPTOR); |
| 185 | 185 |
| 186 protected: | 186 protected: |
| 187 virtual ~BluetoothLowEnergyGetDescriptorFunction() {} | 187 virtual ~BluetoothLowEnergyGetDescriptorFunction() {} |
| 188 | 188 |
| 189 // BluetoothLowEnergyExtensionFunction override. | 189 // BluetoothLowEnergyExtensionFunction override. |
| 190 virtual bool DoWork() OVERRIDE; | 190 virtual bool DoWork() override; |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 class BluetoothLowEnergyGetDescriptorsFunction | 193 class BluetoothLowEnergyGetDescriptorsFunction |
| 194 : public BluetoothLowEnergyExtensionFunction { | 194 : public BluetoothLowEnergyExtensionFunction { |
| 195 public: | 195 public: |
| 196 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getDescriptors", | 196 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getDescriptors", |
| 197 BLUETOOTHLOWENERGY_GETDESCRIPTORS); | 197 BLUETOOTHLOWENERGY_GETDESCRIPTORS); |
| 198 | 198 |
| 199 protected: | 199 protected: |
| 200 virtual ~BluetoothLowEnergyGetDescriptorsFunction() {} | 200 virtual ~BluetoothLowEnergyGetDescriptorsFunction() {} |
| 201 | 201 |
| 202 // BluetoothLowEnergyExtensionFunction override. | 202 // BluetoothLowEnergyExtensionFunction override. |
| 203 virtual bool DoWork() OVERRIDE; | 203 virtual bool DoWork() override; |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 class BluetoothLowEnergyReadCharacteristicValueFunction | 206 class BluetoothLowEnergyReadCharacteristicValueFunction |
| 207 : public BluetoothLowEnergyExtensionFunction { | 207 : public BluetoothLowEnergyExtensionFunction { |
| 208 public: | 208 public: |
| 209 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.readCharacteristicValue", | 209 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.readCharacteristicValue", |
| 210 BLUETOOTHLOWENERGY_READCHARACTERISTICVALUE); | 210 BLUETOOTHLOWENERGY_READCHARACTERISTICVALUE); |
| 211 | 211 |
| 212 protected: | 212 protected: |
| 213 virtual ~BluetoothLowEnergyReadCharacteristicValueFunction() {} | 213 virtual ~BluetoothLowEnergyReadCharacteristicValueFunction() {} |
| 214 | 214 |
| 215 // BluetoothLowEnergyExtensionFunction override. | 215 // BluetoothLowEnergyExtensionFunction override. |
| 216 virtual bool DoWork() OVERRIDE; | 216 virtual bool DoWork() override; |
| 217 | 217 |
| 218 private: | 218 private: |
| 219 // Success and error callbacks, called by | 219 // Success and error callbacks, called by |
| 220 // BluetoothLowEnergyEventRouter::ReadCharacteristicValue. | 220 // BluetoothLowEnergyEventRouter::ReadCharacteristicValue. |
| 221 void SuccessCallback(); | 221 void SuccessCallback(); |
| 222 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); | 222 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); |
| 223 | 223 |
| 224 // The instance ID of the requested characteristic. | 224 // The instance ID of the requested characteristic. |
| 225 std::string instance_id_; | 225 std::string instance_id_; |
| 226 }; | 226 }; |
| 227 | 227 |
| 228 class BluetoothLowEnergyWriteCharacteristicValueFunction | 228 class BluetoothLowEnergyWriteCharacteristicValueFunction |
| 229 : public BluetoothLowEnergyExtensionFunction { | 229 : public BluetoothLowEnergyExtensionFunction { |
| 230 public: | 230 public: |
| 231 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.writeCharacteristicValue", | 231 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.writeCharacteristicValue", |
| 232 BLUETOOTHLOWENERGY_WRITECHARACTERISTICVALUE); | 232 BLUETOOTHLOWENERGY_WRITECHARACTERISTICVALUE); |
| 233 | 233 |
| 234 protected: | 234 protected: |
| 235 virtual ~BluetoothLowEnergyWriteCharacteristicValueFunction() {} | 235 virtual ~BluetoothLowEnergyWriteCharacteristicValueFunction() {} |
| 236 | 236 |
| 237 // BluetoothLowEnergyExtensionFunction override. | 237 // BluetoothLowEnergyExtensionFunction override. |
| 238 virtual bool DoWork() OVERRIDE; | 238 virtual bool DoWork() override; |
| 239 | 239 |
| 240 private: | 240 private: |
| 241 // Success and error callbacks, called by | 241 // Success and error callbacks, called by |
| 242 // BluetoothLowEnergyEventRouter::WriteCharacteristicValue. | 242 // BluetoothLowEnergyEventRouter::WriteCharacteristicValue. |
| 243 void SuccessCallback(); | 243 void SuccessCallback(); |
| 244 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); | 244 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); |
| 245 | 245 |
| 246 // The instance ID of the requested characteristic. | 246 // The instance ID of the requested characteristic. |
| 247 std::string instance_id_; | 247 std::string instance_id_; |
| 248 }; | 248 }; |
| 249 | 249 |
| 250 class BluetoothLowEnergyStartCharacteristicNotificationsFunction | 250 class BluetoothLowEnergyStartCharacteristicNotificationsFunction |
| 251 : public BluetoothLowEnergyExtensionFunction { | 251 : public BluetoothLowEnergyExtensionFunction { |
| 252 public: | 252 public: |
| 253 DECLARE_EXTENSION_FUNCTION( | 253 DECLARE_EXTENSION_FUNCTION( |
| 254 "bluetoothLowEnergy.startCharacteristicNotifications", | 254 "bluetoothLowEnergy.startCharacteristicNotifications", |
| 255 BLUETOOTHLOWENERGY_STARTCHARACTERISTICNOTIFICATIONS); | 255 BLUETOOTHLOWENERGY_STARTCHARACTERISTICNOTIFICATIONS); |
| 256 | 256 |
| 257 protected: | 257 protected: |
| 258 virtual ~BluetoothLowEnergyStartCharacteristicNotificationsFunction() {} | 258 virtual ~BluetoothLowEnergyStartCharacteristicNotificationsFunction() {} |
| 259 | 259 |
| 260 // BluetoothLowEnergyExtensionFunction override. | 260 // BluetoothLowEnergyExtensionFunction override. |
| 261 virtual bool DoWork() OVERRIDE; | 261 virtual bool DoWork() override; |
| 262 | 262 |
| 263 private: | 263 private: |
| 264 // Success and error callbacks, called by | 264 // Success and error callbacks, called by |
| 265 // BluetoothLowEnergyEventRouter::StartCharacteristicNotifications. | 265 // BluetoothLowEnergyEventRouter::StartCharacteristicNotifications. |
| 266 void SuccessCallback(); | 266 void SuccessCallback(); |
| 267 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); | 267 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); |
| 268 }; | 268 }; |
| 269 | 269 |
| 270 class BluetoothLowEnergyStopCharacteristicNotificationsFunction | 270 class BluetoothLowEnergyStopCharacteristicNotificationsFunction |
| 271 : public BluetoothLowEnergyExtensionFunction { | 271 : public BluetoothLowEnergyExtensionFunction { |
| 272 public: | 272 public: |
| 273 DECLARE_EXTENSION_FUNCTION( | 273 DECLARE_EXTENSION_FUNCTION( |
| 274 "bluetoothLowEnergy.stopCharacteristicNotifications", | 274 "bluetoothLowEnergy.stopCharacteristicNotifications", |
| 275 BLUETOOTHLOWENERGY_STOPCHARACTERISTICNOTIFICATIONS); | 275 BLUETOOTHLOWENERGY_STOPCHARACTERISTICNOTIFICATIONS); |
| 276 | 276 |
| 277 protected: | 277 protected: |
| 278 virtual ~BluetoothLowEnergyStopCharacteristicNotificationsFunction() {} | 278 virtual ~BluetoothLowEnergyStopCharacteristicNotificationsFunction() {} |
| 279 | 279 |
| 280 // BluetoothLowEnergyExtensionFunction override. | 280 // BluetoothLowEnergyExtensionFunction override. |
| 281 virtual bool DoWork() OVERRIDE; | 281 virtual bool DoWork() override; |
| 282 | 282 |
| 283 private: | 283 private: |
| 284 // Success and error callbacks, called by | 284 // Success and error callbacks, called by |
| 285 // BluetoothLowEnergyEventRouter::StopCharacteristicNotifications. | 285 // BluetoothLowEnergyEventRouter::StopCharacteristicNotifications. |
| 286 void SuccessCallback(); | 286 void SuccessCallback(); |
| 287 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); | 287 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); |
| 288 }; | 288 }; |
| 289 | 289 |
| 290 class BluetoothLowEnergyReadDescriptorValueFunction | 290 class BluetoothLowEnergyReadDescriptorValueFunction |
| 291 : public BluetoothLowEnergyExtensionFunction { | 291 : public BluetoothLowEnergyExtensionFunction { |
| 292 public: | 292 public: |
| 293 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.readDescriptorValue", | 293 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.readDescriptorValue", |
| 294 BLUETOOTHLOWENERGY_READDESCRIPTORVALUE); | 294 BLUETOOTHLOWENERGY_READDESCRIPTORVALUE); |
| 295 | 295 |
| 296 protected: | 296 protected: |
| 297 virtual ~BluetoothLowEnergyReadDescriptorValueFunction() {} | 297 virtual ~BluetoothLowEnergyReadDescriptorValueFunction() {} |
| 298 | 298 |
| 299 // BluetoothLowEnergyExtensionFunction override. | 299 // BluetoothLowEnergyExtensionFunction override. |
| 300 virtual bool DoWork() OVERRIDE; | 300 virtual bool DoWork() override; |
| 301 | 301 |
| 302 private: | 302 private: |
| 303 // Success and error callbacks, called by | 303 // Success and error callbacks, called by |
| 304 // BluetoothLowEnergyEventRouter::ReadDescriptorValue. | 304 // BluetoothLowEnergyEventRouter::ReadDescriptorValue. |
| 305 void SuccessCallback(); | 305 void SuccessCallback(); |
| 306 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); | 306 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); |
| 307 | 307 |
| 308 // The instance ID of the requested descriptor. | 308 // The instance ID of the requested descriptor. |
| 309 std::string instance_id_; | 309 std::string instance_id_; |
| 310 }; | 310 }; |
| 311 | 311 |
| 312 class BluetoothLowEnergyWriteDescriptorValueFunction | 312 class BluetoothLowEnergyWriteDescriptorValueFunction |
| 313 : public BluetoothLowEnergyExtensionFunction { | 313 : public BluetoothLowEnergyExtensionFunction { |
| 314 public: | 314 public: |
| 315 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.writeDescriptorValue", | 315 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.writeDescriptorValue", |
| 316 BLUETOOTHLOWENERGY_WRITEDESCRIPTORVALUE); | 316 BLUETOOTHLOWENERGY_WRITEDESCRIPTORVALUE); |
| 317 | 317 |
| 318 protected: | 318 protected: |
| 319 virtual ~BluetoothLowEnergyWriteDescriptorValueFunction() {} | 319 virtual ~BluetoothLowEnergyWriteDescriptorValueFunction() {} |
| 320 | 320 |
| 321 // BluetoothLowEnergyExtensionFunction override. | 321 // BluetoothLowEnergyExtensionFunction override. |
| 322 virtual bool DoWork() OVERRIDE; | 322 virtual bool DoWork() override; |
| 323 | 323 |
| 324 private: | 324 private: |
| 325 // Success and error callbacks, called by | 325 // Success and error callbacks, called by |
| 326 // BluetoothLowEnergyEventRouter::WriteDescriptorValue. | 326 // BluetoothLowEnergyEventRouter::WriteDescriptorValue. |
| 327 void SuccessCallback(); | 327 void SuccessCallback(); |
| 328 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); | 328 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); |
| 329 | 329 |
| 330 // The instance ID of the requested descriptor. | 330 // The instance ID of the requested descriptor. |
| 331 std::string instance_id_; | 331 std::string instance_id_; |
| 332 }; | 332 }; |
| 333 | 333 |
| 334 } // namespace core_api | 334 } // namespace core_api |
| 335 } // namespace extensions | 335 } // namespace extensions |
| 336 | 336 |
| 337 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_
H_ | 337 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_
H_ |
| OLD | NEW |