Files
MuditaOS/module-utils/common_data/EventStore.cpp
alek aa5999b070 [EGD-2830] Dialog extended for multiple options.
One dialog window in sms app instead of mulitple ones.
Notifictaions about  No SIM card inserted.
2020-05-28 14:13:12 +02:00

53 lines
1.1 KiB
C++

#include "EventStore.hpp"
#include <log/log.hpp>
#include <memory>
#include <mutex.hpp>
namespace Store
{
// if it grows bigger than these few variables - consider moving it to ram with i.e.
// delayed construction singletone
Battery battery;
const Battery &Battery::get()
{
return battery;
}
Battery &Battery::modify()
{
return battery;
}
cpp_freertos::MutexStandard GSM::mutex;
GSM *GSM::get()
{
static auto ptr = new GSM();
return ptr;
}
void GSM::setSignalStrength(const SignalStrength &signalStrength)
{
cpp_freertos::LockGuard lock(mutex);
LOG_INFO("Setting signal strength to rssi = %d dBm (%d) : %d bars",
signalStrength.rssidBm,
signalStrength.rssi,
static_cast<int>(signalStrength.rssiBar));
this->signalStrength = signalStrength;
}
SignalStrength GSM::getSignalStrength()
{
cpp_freertos::LockGuard lock(mutex);
return signalStrength;
}
bool GSM::simCardInserted()
{
return (sim == SIM::SIM1 || sim == SIM::SIM2);
}
}; // namespace Store