mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-06-16 12:29:00 -04:00
Egd 2566 signal strength indicator (#214)
* [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
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#include "EventStore.hpp"
|
||||
#include <log/log.hpp>
|
||||
#include <mutex.hpp>
|
||||
|
||||
namespace Store
|
||||
{
|
||||
@@ -16,15 +18,31 @@ namespace Store
|
||||
return battery;
|
||||
}
|
||||
|
||||
GSM *GSM::ptr = nullptr;
|
||||
cpp_freertos::MutexStandard mutex;
|
||||
|
||||
GSM *GSM::get()
|
||||
{
|
||||
if (!ptr)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user