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

Method Load

libs/map/power_management/power_manager.cpp:42–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42void PowerManager::Load()
43{
44 try
45 {
46 FileReader reader(GetConfigPath());
47 NonOwningReaderSource source(reader);
48
49 coding::DeserializerJson des(source);
50 Config result;
51 des(result);
52
53 m_config = result;
54
55 if (m_config.m_scheme == Scheme::Auto)
56 GetPlatform().GetBatteryTracker().Subscribe(this);
57
58 for (size_t i = 0; i < m_config.m_facilities.size(); ++i)
59 NotifySubscribers(m_subscribers, static_cast<Facility>(i), m_config.m_facilities[i]);
60
61 NotifySubscribers(m_subscribers, m_config.m_scheme);
62 return;
63 }
64 catch (base::Json::Exception & ex)
65 {
66 LOG(LERROR, ("Cannot deserialize power manager data from file. Exception:", ex.Msg()));
67 }
68 catch (FileReader::Exception const & ex)
69 {
70 LOG(LWARNING, ("Cannot read power manager config file. Exception:", ex.Msg()));
71 }
72
73 // Reset to default state.
74 m_config = {};
75}
76
77void PowerManager::SetFacility(Facility const facility, bool enabled)
78{

Callers 6

HasKeyMethod · 0.45
LoadLastBookmarkIdMethod · 0.45
LoadLastTrackIdMethod · 0.45
LoadLastCategoryIdMethod · 0.45
FrameworkMethod · 0.45

Calls 3

NotifySubscribersFunction · 0.85
SubscribeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected