OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |