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

Side by Side Diff: chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc

Issue 1307153002: Fixed bluetooth read write not supported errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | chromeos/dbus/fake_bluetooth_gatt_descriptor_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h" 5 #include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 error_callback.Run("org.bluez.Error.NotPaired", "Please login"); 142 error_callback.Run("org.bluez.Error.NotPaired", "Please login");
143 return; 143 return;
144 } 144 }
145 145
146 if (!authorized_) { 146 if (!authorized_) {
147 error_callback.Run("org.bluez.Error.NotAuthorized", "Authorize first"); 147 error_callback.Run("org.bluez.Error.NotAuthorized", "Authorize first");
148 return; 148 return;
149 } 149 }
150 150
151 if (object_path.value() == heart_rate_control_point_path_) { 151 if (object_path.value() == heart_rate_control_point_path_) {
152 error_callback.Run("org.bluez.Error.ReadNotPermitted", 152 error_callback.Run("org.bluez.Error.NotPermitted",
153 "Reads of this value are not allowed"); 153 "Reads of this value are not allowed");
154 return; 154 return;
155 } 155 }
156 156
157 if (object_path.value() == heart_rate_measurement_path_) { 157 if (object_path.value() == heart_rate_measurement_path_) {
158 error_callback.Run("org.bluez.Error.NotSupported", 158 error_callback.Run("org.bluez.Error.NotSupported",
159 "Action not supported on this characteristic"); 159 "Action not supported on this characteristic");
160 return; 160 return;
161 } 161 }
162 162
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 return; 219 return;
220 } 220 }
221 221
222 if (object_path.value() == heart_rate_measurement_path_) { 222 if (object_path.value() == heart_rate_measurement_path_) {
223 error_callback.Run("org.bluez.Error.NotSupported", 223 error_callback.Run("org.bluez.Error.NotSupported",
224 "Action not supported on this characteristic"); 224 "Action not supported on this characteristic");
225 return; 225 return;
226 } 226 }
227 227
228 if (object_path.value() != heart_rate_control_point_path_) { 228 if (object_path.value() != heart_rate_control_point_path_) {
229 error_callback.Run("org.bluez.Error.WriteNotPermitted", 229 error_callback.Run("org.bluez.Error.NotPermitted",
230 "Writes of this value are not allowed"); 230 "Writes of this value are not allowed");
231 return; 231 return;
232 } 232 }
233 233
234 DCHECK(heart_rate_control_point_properties_.get()); 234 DCHECK(heart_rate_control_point_properties_.get());
235 if (action_extra_requests_.find("WriteValue") != 235 if (action_extra_requests_.find("WriteValue") !=
236 action_extra_requests_.end()) { 236 action_extra_requests_.end()) {
237 DelayedCallback* delayed = action_extra_requests_["WriteValue"]; 237 DelayedCallback* delayed = action_extra_requests_["WriteValue"];
238 delayed->delay_--; 238 delayed->delay_--;
239 error_callback.Run("org.bluez.Error.InProgress", 239 error_callback.Run("org.bluez.Error.InProgress",
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 DCHECK(heart_rate_visible_ != heart_rate_measurement_path_.empty()); 559 DCHECK(heart_rate_visible_ != heart_rate_measurement_path_.empty());
560 DCHECK(heart_rate_visible_ != body_sensor_location_path_.empty()); 560 DCHECK(heart_rate_visible_ != body_sensor_location_path_.empty());
561 DCHECK(heart_rate_visible_ != heart_rate_control_point_path_.empty()); 561 DCHECK(heart_rate_visible_ != heart_rate_control_point_path_.empty());
562 DCHECK(heart_rate_visible_ == !!heart_rate_measurement_properties_.get()); 562 DCHECK(heart_rate_visible_ == !!heart_rate_measurement_properties_.get());
563 DCHECK(heart_rate_visible_ == !!body_sensor_location_properties_.get()); 563 DCHECK(heart_rate_visible_ == !!body_sensor_location_properties_.get());
564 DCHECK(heart_rate_visible_ == !!heart_rate_control_point_properties_.get()); 564 DCHECK(heart_rate_visible_ == !!heart_rate_control_point_properties_.get());
565 return heart_rate_visible_; 565 return heart_rate_visible_;
566 } 566 }
567 567
568 } // namespace chromeos 568 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chromeos/dbus/fake_bluetooth_gatt_descriptor_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698