| 53 | } |
| 54 | |
| 55 | void Reporter::AddLocation(location::GpsInfo const & info, traffic::SpeedGroup traffic) |
| 56 | { |
| 57 | lock_guard<mutex> lg(m_mutex); |
| 58 | |
| 59 | if (info.m_horizontalAccuracy > kRequiredHorizontalAccuracy) |
| 60 | return; |
| 61 | |
| 62 | if (info.m_timestamp < m_lastGpsTime + kMinDelaySeconds) |
| 63 | return; |
| 64 | |
| 65 | if (Platform::GetChargingStatus() != Platform::ChargingStatus::Plugged) |
| 66 | { |
| 67 | double const currentTime = base::Timer::LocalTime(); |
| 68 | if (currentTime < m_lastNotChargingEvent + kNotChargingEventPeriod) |
| 69 | return; |
| 70 | |
| 71 | m_lastNotChargingEvent = currentTime; |
| 72 | return; |
| 73 | } |
| 74 | |
| 75 | m_lastGpsTime = info.m_timestamp; |
| 76 | m_input.push_back(DataPoint(info.m_timestamp, ms::LatLon(info.m_latitude, info.m_longitude), |
| 77 | static_cast<std::underlying_type<traffic::SpeedGroup>::type>(traffic))); |
| 78 | } |
| 79 | |
| 80 | void Reporter::Run() |
| 81 | { |