OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h" | 5 #include "device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
10 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
11 #include "dbus/exported_object.h" | 12 #include "dbus/exported_object.h" |
12 #include "dbus/message.h" | 13 #include "dbus/message.h" |
13 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 14 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
14 #include "device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider
.h" | 15 #include "device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider
.h" |
15 #include "third_party/cros_system_api/dbus/service_constants.h" | 16 #include "third_party/cros_system_api/dbus/service_constants.h" |
16 | 17 |
17 namespace bluez { | 18 namespace bluez { |
18 | 19 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 AppendServiceData(&array_writer); | 237 AppendServiceData(&array_writer); |
237 | 238 |
238 writer.CloseContainer(&array_writer); | 239 writer.CloseContainer(&array_writer); |
239 return response; | 240 return response; |
240 } | 241 } |
241 | 242 |
242 // Called by the Delegate in response to a successful method call to get the | 243 // Called by the Delegate in response to a successful method call to get the |
243 // descriptor value. | 244 // descriptor value. |
244 void OnGet(dbus::MethodCall* method_call, | 245 void OnGet(dbus::MethodCall* method_call, |
245 dbus::ExportedObject::ResponseSender response_sender, | 246 dbus::ExportedObject::ResponseSender response_sender, |
246 const std::vector<uint8>& value) { | 247 const std::vector<uint8_t>& value) { |
247 VLOG(2) << "Returning descriptor value obtained from delegate."; | 248 VLOG(2) << "Returning descriptor value obtained from delegate."; |
248 scoped_ptr<dbus::Response> response = | 249 scoped_ptr<dbus::Response> response = |
249 dbus::Response::FromMethodCall(method_call); | 250 dbus::Response::FromMethodCall(method_call); |
250 dbus::MessageWriter writer(response.get()); | 251 dbus::MessageWriter writer(response.get()); |
251 dbus::MessageWriter variant_writer(NULL); | 252 dbus::MessageWriter variant_writer(NULL); |
252 | 253 |
253 writer.OpenVariant("ay", &variant_writer); | 254 writer.OpenVariant("ay", &variant_writer); |
254 variant_writer.AppendArrayOfBytes(value.data(), value.size()); | 255 variant_writer.AppendArrayOfBytes(value.data(), value.size()); |
255 writer.CloseContainer(&variant_writer); | 256 writer.CloseContainer(&variant_writer); |
256 | 257 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 return make_scoped_ptr(new BluetoothAdvertisementServiceProviderImpl( | 415 return make_scoped_ptr(new BluetoothAdvertisementServiceProviderImpl( |
415 bus, object_path, delegate, type, service_uuids.Pass(), | 416 bus, object_path, delegate, type, service_uuids.Pass(), |
416 manufacturer_data.Pass(), solicit_uuids.Pass(), service_data.Pass())); | 417 manufacturer_data.Pass(), solicit_uuids.Pass(), service_data.Pass())); |
417 } else { | 418 } else { |
418 return make_scoped_ptr( | 419 return make_scoped_ptr( |
419 new FakeBluetoothLEAdvertisementServiceProvider(object_path, delegate)); | 420 new FakeBluetoothLEAdvertisementServiceProvider(object_path, delegate)); |
420 } | 421 } |
421 } | 422 } |
422 | 423 |
423 } // namespace bluez | 424 } // namespace bluez |
OLD | NEW |