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

Side by Side Diff: device/bluetooth/dbus/bluetooth_gatt_application_service_provider.cc

Issue 2076433002: Revert of Add support in Chrome to send notifications to a specific device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_gatt_application_service_provider.h" 5 #include "device/bluetooth/dbus/bluetooth_gatt_application_service_provider.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 service.second, descriptor.get())), 129 service.second, descriptor.get())),
130 descriptor->GetUUID().value(), 130 descriptor->GetUUID().value(),
131 FlagsFromPermissions(descriptor->GetPermissions()), 131 FlagsFromPermissions(descriptor->GetPermissions()),
132 characteristic.second->object_path()))); 132 characteristic.second->object_path())));
133 } 133 }
134 } 134 }
135 } 135 }
136 } 136 }
137 137
138 void BluetoothGattApplicationServiceProvider::SendValueChanged( 138 void BluetoothGattApplicationServiceProvider::SendValueChanged(
139 const dbus::ObjectPath& device_path,
140 const dbus::ObjectPath& characteristic_path, 139 const dbus::ObjectPath& characteristic_path,
141 const std::vector<uint8_t>& value, 140 const std::vector<uint8_t>& value) {
142 bool indicate) {
143 auto characteristic = std::find_if( 141 auto characteristic = std::find_if(
144 characteristic_providers_.begin(), characteristic_providers_.end(), 142 characteristic_providers_.begin(), characteristic_providers_.end(),
145 [&](const std::unique_ptr<BluetoothGattCharacteristicServiceProvider>& 143 [&](const std::unique_ptr<BluetoothGattCharacteristicServiceProvider>&
146 p) { return p->object_path() == characteristic_path; }); 144 p) { return p->object_path() == characteristic_path; });
147 if (characteristic == characteristic_providers_.end()) { 145 if (characteristic == characteristic_providers_.end()) {
148 LOG(ERROR) << "Couldn't find characteristic provider for: " 146 LOG(ERROR) << "Couldn't find characteristic provider for: "
149 << characteristic_path.value(); 147 << characteristic_path.value();
150 return; 148 return;
151 } 149 }
152 characteristic->get()->SendValueChanged(device_path, value, indicate); 150 characteristic->get()->SendValueChanged(value);
153 } 151 }
154 152
155 // static 153 // static
156 std::unique_ptr<BluetoothGattApplicationServiceProvider> 154 std::unique_ptr<BluetoothGattApplicationServiceProvider>
157 BluetoothGattApplicationServiceProvider::Create( 155 BluetoothGattApplicationServiceProvider::Create(
158 dbus::Bus* bus, 156 dbus::Bus* bus,
159 const dbus::ObjectPath& object_path, 157 const dbus::ObjectPath& object_path,
160 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& 158 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>&
161 services) { 159 services) {
162 if (!bluez::BluezDBusManager::Get()->IsUsingFakes()) { 160 if (!bluez::BluezDBusManager::Get()->IsUsingFakes()) {
163 return base::WrapUnique(new BluetoothGattApplicationServiceProviderImpl( 161 return base::WrapUnique(new BluetoothGattApplicationServiceProviderImpl(
164 bus, object_path, services)); 162 bus, object_path, services));
165 } 163 }
166 return base::WrapUnique( 164 return base::WrapUnique(
167 new FakeBluetoothGattApplicationServiceProvider(object_path, services)); 165 new FakeBluetoothGattApplicationServiceProvider(object_path, services));
168 } 166 }
169 167
170 } // namespace bluez 168 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698