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/bluetooth_advertisement_bluez.h" | 5 #include "device/bluetooth/bluetooth_advertisement_bluez.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 dbus::ObjectPath advertisement_object_path = | 82 dbus::ObjectPath advertisement_object_path = |
83 dbus::ObjectPath("/org/chromium/bluetooth_advertisement/" + GuidString); | 83 dbus::ObjectPath("/org/chromium/bluetooth_advertisement/" + GuidString); |
84 | 84 |
85 DCHECK(bluez::BluezDBusManager::Get()); | 85 DCHECK(bluez::BluezDBusManager::Get()); |
86 provider_ = bluez::BluetoothLEAdvertisementServiceProvider::Create( | 86 provider_ = bluez::BluetoothLEAdvertisementServiceProvider::Create( |
87 bluez::BluezDBusManager::Get()->GetSystemBus(), advertisement_object_path, | 87 bluez::BluezDBusManager::Get()->GetSystemBus(), advertisement_object_path, |
88 this, | 88 this, |
89 static_cast< | 89 static_cast< |
90 bluez::BluetoothLEAdvertisementServiceProvider::AdvertisementType>( | 90 bluez::BluetoothLEAdvertisementServiceProvider::AdvertisementType>( |
91 data->type()), | 91 data->type()), |
92 data->service_uuids().Pass(), data->manufacturer_data().Pass(), | 92 data->service_uuids(), data->manufacturer_data(), data->solicit_uuids(), |
93 data->solicit_uuids().Pass(), data->service_data().Pass()); | 93 data->service_data()); |
94 } | 94 } |
95 | 95 |
96 void BluetoothAdvertisementBlueZ::Register( | 96 void BluetoothAdvertisementBlueZ::Register( |
97 const base::Closure& success_callback, | 97 const base::Closure& success_callback, |
98 const device::BluetoothAdapter::CreateAdvertisementErrorCallback& | 98 const device::BluetoothAdapter::CreateAdvertisementErrorCallback& |
99 error_callback) { | 99 error_callback) { |
100 DCHECK(bluez::BluezDBusManager::Get()); | 100 DCHECK(bluez::BluezDBusManager::Get()); |
101 bluez::BluezDBusManager::Get() | 101 bluez::BluezDBusManager::Get() |
102 ->GetBluetoothLEAdvertisingManagerClient() | 102 ->GetBluetoothLEAdvertisingManagerClient() |
103 ->RegisterAdvertisement( | 103 ->RegisterAdvertisement( |
(...skipping 26 matching lines...) Expand all Loading... |
130 } | 130 } |
131 | 131 |
132 void BluetoothAdvertisementBlueZ::Released() { | 132 void BluetoothAdvertisementBlueZ::Released() { |
133 LOG(WARNING) << "Advertisement released."; | 133 LOG(WARNING) << "Advertisement released."; |
134 provider_.reset(); | 134 provider_.reset(); |
135 FOR_EACH_OBSERVER(BluetoothAdvertisement::Observer, observers_, | 135 FOR_EACH_OBSERVER(BluetoothAdvertisement::Observer, observers_, |
136 AdvertisementReleased(this)); | 136 AdvertisementReleased(this)); |
137 } | 137 } |
138 | 138 |
139 } // namespace bluez | 139 } // namespace bluez |
OLD | NEW |