Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: device/bluetooth/bluez/bluetooth_adapter_bluez.cc

Issue 1973703002: Implement //device/bt changes for notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notifications_dbus
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/bluez/bluetooth_adapter_bluez.h" 5 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/sequenced_task_runner.h" 16 #include "base/sequenced_task_runner.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/thread_task_runner_handle.h" 19 #include "base/thread_task_runner_handle.h"
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 #include "device/bluetooth/bluetooth_device.h" 21 #include "device/bluetooth/bluetooth_device.h"
22 #include "device/bluetooth/bluetooth_discovery_session_outcome.h" 22 #include "device/bluetooth/bluetooth_discovery_session_outcome.h"
23 #include "device/bluetooth/bluetooth_socket_thread.h" 23 #include "device/bluetooth/bluetooth_socket_thread.h"
24 #include "device/bluetooth/bluetooth_uuid.h" 24 #include "device/bluetooth/bluetooth_uuid.h"
25 #include "device/bluetooth/bluez/bluetooth_adapter_profile_bluez.h" 25 #include "device/bluetooth/bluez/bluetooth_adapter_profile_bluez.h"
26 #include "device/bluetooth/bluez/bluetooth_advertisement_bluez.h" 26 #include "device/bluetooth/bluez/bluetooth_advertisement_bluez.h"
27 #include "device/bluetooth/bluez/bluetooth_audio_sink_bluez.h" 27 #include "device/bluetooth/bluez/bluetooth_audio_sink_bluez.h"
28 #include "device/bluetooth/bluez/bluetooth_device_bluez.h" 28 #include "device/bluetooth/bluez/bluetooth_device_bluez.h"
29 #include "device/bluetooth/bluez/bluetooth_gatt_service_bluez.h" 29 #include "device/bluetooth/bluez/bluetooth_gatt_service_bluez.h"
30 #include "device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.h"
30 #include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h" 31 #include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h"
31 #include "device/bluetooth/bluez/bluetooth_pairing_bluez.h" 32 #include "device/bluetooth/bluez/bluetooth_pairing_bluez.h"
32 #include "device/bluetooth/bluez/bluetooth_socket_bluez.h" 33 #include "device/bluetooth/bluez/bluetooth_socket_bluez.h"
33 #include "device/bluetooth/dbus/bluetooth_adapter_client.h" 34 #include "device/bluetooth/dbus/bluetooth_adapter_client.h"
34 #include "device/bluetooth/dbus/bluetooth_agent_manager_client.h" 35 #include "device/bluetooth/dbus/bluetooth_agent_manager_client.h"
35 #include "device/bluetooth/dbus/bluetooth_agent_service_provider.h" 36 #include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
36 #include "device/bluetooth/dbus/bluetooth_device_client.h" 37 #include "device/bluetooth/dbus/bluetooth_device_client.h"
37 #include "device/bluetooth/dbus/bluetooth_gatt_application_service_provider.h" 38 #include "device/bluetooth/dbus/bluetooth_gatt_application_service_provider.h"
38 #include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h" 39 #include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h"
39 #include "device/bluetooth/dbus/bluetooth_input_client.h" 40 #include "device/bluetooth/dbus/bluetooth_input_client.h"
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 1134
1134 registered_gatt_services_.erase(service->object_path()); 1135 registered_gatt_services_.erase(service->object_path());
1135 UpdateRegisteredApplication(false, callback, error_callback); 1136 UpdateRegisteredApplication(false, callback, error_callback);
1136 } 1137 }
1137 1138
1138 bool BluetoothAdapterBlueZ::IsGattServiceRegistered( 1139 bool BluetoothAdapterBlueZ::IsGattServiceRegistered(
1139 BluetoothLocalGattServiceBlueZ* service) { 1140 BluetoothLocalGattServiceBlueZ* service) {
1140 return registered_gatt_services_.count(service->object_path()) != 0; 1141 return registered_gatt_services_.count(service->object_path()) != 0;
1141 } 1142 }
1142 1143
1143 // Returns the object path of the adapter. 1144 bool BluetoothAdapterBlueZ::SendValueChanged(
1145 BluetoothLocalGattCharacteristicBlueZ* characteristic,
1146 const std::vector<uint8_t>& value) {
1147 if (registered_gatt_services_.count(
1148 characteristic->GetService()->object_path()) == 0)
1149 return false;
1150 gatt_application_provider_->SendValueChanged(characteristic->object_path(),
1151 value);
1152 return true;
1153 }
1154
1144 dbus::ObjectPath BluetoothAdapterBlueZ::GetApplicationObjectPath() const { 1155 dbus::ObjectPath BluetoothAdapterBlueZ::GetApplicationObjectPath() const {
1145 return dbus::ObjectPath(object_path_.value() + kGattApplicationObjectPath); 1156 return dbus::ObjectPath(object_path_.value() + kGattApplicationObjectPath);
1146 } 1157 }
1147 1158
1148 void BluetoothAdapterBlueZ::OnRegisterProfile( 1159 void BluetoothAdapterBlueZ::OnRegisterProfile(
1149 const BluetoothUUID& uuid, 1160 const BluetoothUUID& uuid,
1150 std::unique_ptr<BluetoothAdapterProfileBlueZ> profile) { 1161 std::unique_ptr<BluetoothAdapterProfileBlueZ> profile) {
1151 profiles_[uuid] = profile.release(); 1162 profiles_[uuid] = profile.release();
1152 1163
1153 if (profile_queues_.find(uuid) == profile_queues_.end()) 1164 if (profile_queues_.find(uuid) == profile_queues_.end())
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 1638
1628 void BluetoothAdapterBlueZ::RegisterApplicationOnError( 1639 void BluetoothAdapterBlueZ::RegisterApplicationOnError(
1629 const base::Closure& callback, 1640 const base::Closure& callback,
1630 const device::BluetoothGattService::ErrorCallback& error_callback, 1641 const device::BluetoothGattService::ErrorCallback& error_callback,
1631 const std::string& /* error_name */, 1642 const std::string& /* error_name */,
1632 const std::string& /* error_message */) { 1643 const std::string& /* error_message */) {
1633 RegisterApplication(callback, error_callback); 1644 RegisterApplication(callback, error_callback);
1634 } 1645 }
1635 1646
1636 } // namespace bluez 1647 } // namespace bluez
OLDNEW
« no previous file with comments | « device/bluetooth/bluez/bluetooth_adapter_bluez.h ('k') | device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698