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

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

Issue 2039773005: 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,
139 const dbus::ObjectPath& characteristic_path, 140 const dbus::ObjectPath& characteristic_path,
140 const std::vector<uint8_t>& value) { 141 const std::vector<uint8_t>& value,
142 bool indicate) {
141 auto characteristic = std::find_if( 143 auto characteristic = std::find_if(
142 characteristic_providers_.begin(), characteristic_providers_.end(), 144 characteristic_providers_.begin(), characteristic_providers_.end(),
143 [&](const std::unique_ptr<BluetoothGattCharacteristicServiceProvider>& 145 [&](const std::unique_ptr<BluetoothGattCharacteristicServiceProvider>&
144 p) { return p->object_path() == characteristic_path; }); 146 p) { return p->object_path() == characteristic_path; });
145 if (characteristic == characteristic_providers_.end()) { 147 if (characteristic == characteristic_providers_.end()) {
146 LOG(ERROR) << "Couldn't find characteristic provider for: " 148 LOG(ERROR) << "Couldn't find characteristic provider for: "
147 << characteristic_path.value(); 149 << characteristic_path.value();
148 return; 150 return;
149 } 151 }
150 characteristic->get()->SendValueChanged(value); 152 characteristic->get()->SendValueChanged(device_path, value, indicate);
151 } 153 }
152 154
153 // static 155 // static
154 std::unique_ptr<BluetoothGattApplicationServiceProvider> 156 std::unique_ptr<BluetoothGattApplicationServiceProvider>
155 BluetoothGattApplicationServiceProvider::Create( 157 BluetoothGattApplicationServiceProvider::Create(
156 dbus::Bus* bus, 158 dbus::Bus* bus,
157 const dbus::ObjectPath& object_path, 159 const dbus::ObjectPath& object_path,
158 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& 160 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>&
159 services) { 161 services) {
160 if (!bluez::BluezDBusManager::Get()->IsUsingFakes()) { 162 if (!bluez::BluezDBusManager::Get()->IsUsingFakes()) {
161 return base::WrapUnique(new BluetoothGattApplicationServiceProviderImpl( 163 return base::WrapUnique(new BluetoothGattApplicationServiceProviderImpl(
162 bus, object_path, services)); 164 bus, object_path, services));
163 } 165 }
164 return base::WrapUnique( 166 return base::WrapUnique(
165 new FakeBluetoothGattApplicationServiceProvider(object_path, services)); 167 new FakeBluetoothGattApplicationServiceProvider(object_path, services));
166 } 168 }
167 169
168 } // namespace bluez 170 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698