mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-01-24 13:58:00 -05:00
* [EGD-2566] refactored cellular notification recogniton * [EGD-2566] add new conversion to dBm * [EGD-2566] added dBm to bar calculations some minor fixes connected to signal strength put static data in event store * [EGD-2566] removed magic number * [EGD-2566] PR fixes * [EGD-2566] PR fixes * [EGD-2566] missing rebase fix * [EGD-2566] moved Signal Strength to separate file. * [EGD-2566] missing return * [EGD-2566] update signalstrength without message sending * [EGD-2566] reverted USE_DAEFAULT_BAUDRATE to 1 * [EGD-2566][fix] missing change for closing end call window * [EGD-2566] fix for proper checking for CSQ. Verbose setting of singla strength in Store * [EGD-2566] fixed inlude in ScopeDTime. * [EGD-2566] added mutex in GSM store * [EGD-2566] missing change * [EGD-2566] reverted USE_DAEFAULT_BAUDRATE * [EGD-2566] PR fixy
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#include "EventStore.hpp"
|
|
#include <log/log.hpp>
|
|
#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 mutex;
|
|
|
|
GSM *GSM::get()
|
|
{
|
|
cpp_freertos::LockGuard lock(mutex);
|
|
static GSM *ptr = nullptr;
|
|
if (ptr == nullptr)
|
|
{
|
|
ptr = new GSM();
|
|
}
|
|
return ptr;
|
|
}
|
|
|
|
void GSM::setSignalStrength(const SignalStrength &signalStrength)
|
|
{
|
|
cpp_freertos::LockGuard lock(mutex);
|
|
LOG_INFO("Setting signal strenth to rssi = %d dBm (%d) : %u bars", signalStrength.rssidBm, signalStrength.rssi, signalStrength.rssiBar);
|
|
|
|
get()->signalStrength = signalStrength;
|
|
}
|
|
|
|
SignalStrength GSM::getSignalStrength()
|
|
{
|
|
cpp_freertos::LockGuard lock(mutex);
|
|
|
|
return get()->signalStrength;
|
|
}
|
|
}; // namespace Store
|