| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/proximity_auth/proximity_monitor_impl.h" | 5 #include "components/proximity_auth/proximity_monitor_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 weight * connection_info.rssi + (1 - weight) * (*rssi_rolling_average_); | 185 weight * connection_info.rssi + (1 - weight) * (*rssi_rolling_average_); |
| 186 } | 186 } |
| 187 | 187 |
| 188 CheckForProximityStateChange(); | 188 CheckForProximityStateChange(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void ProximityMonitorImpl::CheckForProximityStateChange() { | 191 void ProximityMonitorImpl::CheckForProximityStateChange() { |
| 192 bool is_now_in_proximity = | 192 bool is_now_in_proximity = |
| 193 rssi_rolling_average_ && *rssi_rolling_average_ > kRssiThreshold; | 193 rssi_rolling_average_ && *rssi_rolling_average_ > kRssiThreshold; |
| 194 | 194 |
| 195 if (rssi_rolling_average_) { | 195 if (rssi_rolling_average_) |
| 196 LOG(WARNING) << "RSSI: " << *rssi_rolling_average_; | 196 PA_LOG(INFO) << " Rolling RSSI: " << *rssi_rolling_average_; |
| 197 } | |
| 198 | 197 |
| 199 if (remote_device_is_in_proximity_ != is_now_in_proximity) { | 198 if (remote_device_is_in_proximity_ != is_now_in_proximity) { |
| 200 PA_LOG(INFO) << "[Proximity] Updated proximity state: " | 199 PA_LOG(INFO) << "[Proximity] Updated proximity state: " |
| 201 << (is_now_in_proximity ? "proximate" : "distant"); | 200 << (is_now_in_proximity ? "proximate" : "distant"); |
| 202 remote_device_is_in_proximity_ = is_now_in_proximity; | 201 remote_device_is_in_proximity_ = is_now_in_proximity; |
| 203 for (auto& observer : observers_) | 202 for (auto& observer : observers_) |
| 204 observer.OnProximityStateChanged(); | 203 observer.OnProximityStateChanged(); |
| 205 } | 204 } |
| 206 } | 205 } |
| 207 | 206 |
| 208 } // namespace proximity_auth | 207 } // namespace proximity_auth |
| OLD | NEW |