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

Method Subscribe

libs/platform/battery_tracker.cpp:17–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15namespace platform
16{
17void BatteryLevelTracker::Subscribe(Subscriber * subscriber)
18{
19 m_subscribers.push_back(subscriber);
20
21 if (!IsLevelExpired(m_lastRequestTime))
22 subscriber->OnBatteryLevelReceived(m_lastReceivedLevel);
23
24 if (!m_isTrackingInProgress)
25 {
26 m_isTrackingInProgress = true;
27 RequestBatteryLevel();
28 }
29}
30
31void BatteryLevelTracker::Unsubscribe(Subscriber * subscriber)
32{

Callers

nothing calls this directly

Calls 3

IsLevelExpiredFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected