MCPcopy Create free account
hub / github.com/comaps/comaps / AddLocation

Method AddLocation

libs/tracking/reporter.cpp:55–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55void 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
80void Reporter::Run()
81{

Callers 1

TransferLocationFunction · 0.80

Calls 3

DataPointClass · 0.85
LatLonClass · 0.50
push_backMethod · 0.45

Tested by 1

TransferLocationFunction · 0.64