Hotwheels-Cluster 1.2
Creation of Cluster APP for SEA:ME project.
 
Loading...
Searching...
No Matches
SystemManager Class Reference

Class that manages the system time, status, and battery. QObject. More...

#include <SystemManager.hpp>

Public Slots

void updateTime ()
 Updates the current time.
 
void updateSystemStatus ()
 Updates the system status.
 

Signals

void timeUpdated (const QString &currentDate, const QString &currentTime, const QString &currentDay)
 
void wifiStatusUpdated (const QString &status, const QString &wifiName)
 
void temperatureUpdated (const QString &temperature)
 
void batteryPercentageUpdated (float batteryPercentage)
 
void ipAddressUpdated (const QString &ipAddress)
 

Public Member Functions

 SystemManager (IBatteryController *batteryController=nullptr, ISystemInfoProvider *systemInfoProvider=nullptr, ISystemCommandExecutor *systemCommandExecutor=nullptr, QObject *parent=nullptr)
 Constructor for the SystemManager class.
 
 ~SystemManager ()
 Destructor for the SystemManager class.
 
void initialize ()
 Initializes the SystemManager object.
 
void shutdown ()
 Shuts down the SystemManager object.
 
QTimer & getTimeTimer ()
 
QTimer & getStatusTimer ()
 

Private Attributes

QTimer m_timeTimer
 
QTimer m_statusTimer
 
IBatteryControllerm_batteryController
 
ISystemInfoProviderm_systemInfoProvider
 
ISystemCommandExecutorm_systemCommandExecutor
 
bool m_ownBatteryController
 
bool m_ownSystemInfoProvider
 
bool m_ownSystemCommandExecutor
 

Detailed Description

Class that manages the system time, status, and battery. QObject.

Definition at line 30 of file SystemManager.hpp.

Constructor & Destructor Documentation

◆ SystemManager()

SystemManager::SystemManager ( IBatteryController * batteryController = nullptr,
ISystemInfoProvider * systemInfoProvider = nullptr,
ISystemCommandExecutor * systemCommandExecutor = nullptr,
QObject * parent = nullptr )
explicit

Constructor for the SystemManager class.

Allocates a BatteryController, SystemInfoProvider, and SystemCommandExecutor if the ones provided are nullptr.

Parameters
batteryControllerThe battery controller to use. If nullptr, a new BatteryController is allocated.
systemInfoProviderThe system info provider to use. If nullptr, a new SystemInfoProvider is allocated.
systemCommandExecutorThe system command executor to use. If nullptr, a new SystemCommandExecutor is allocated.
parentThe parent object of this SystemManager.

Definition at line 39 of file SystemManager.cpp.

◆ ~SystemManager()

SystemManager::~SystemManager ( )

Destructor for the SystemManager class.

Calls shutdown() to stop all threads and then deletes the BatteryController, SystemInfoProvider, and SystemCommandExecutor objects if they were allocated by the SystemManager.

Definition at line 59 of file SystemManager.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ batteryPercentageUpdated

void SystemManager::batteryPercentageUpdated ( float batteryPercentage)
signal
Here is the caller graph for this function:

◆ getStatusTimer()

QTimer & SystemManager::getStatusTimer ( )
inline

Definition at line 44 of file SystemManager.hpp.

◆ getTimeTimer()

QTimer & SystemManager::getTimeTimer ( )
inline

Definition at line 43 of file SystemManager.hpp.

◆ initialize()

void SystemManager::initialize ( )

Initializes the SystemManager object.

This method initializes the SystemManager object by starting two timers: one to update the time every second and another to update the system status every 5 seconds. It also calls updateSystemStatus() to update the system status immediately.

Definition at line 77 of file SystemManager.cpp.

Here is the call graph for this function:

◆ ipAddressUpdated

void SystemManager::ipAddressUpdated ( const QString & ipAddress)
signal
Here is the caller graph for this function:

◆ shutdown()

void SystemManager::shutdown ( )

Shuts down the SystemManager object.

This method stops the time and status timers to halt periodic updates.

Definition at line 91 of file SystemManager.cpp.

Here is the caller graph for this function:

◆ temperatureUpdated

void SystemManager::temperatureUpdated ( const QString & temperature)
signal
Here is the caller graph for this function:

◆ timeUpdated

void SystemManager::timeUpdated ( const QString & currentDate,
const QString & currentTime,
const QString & currentDay )
signal
Here is the caller graph for this function:

◆ updateSystemStatus

void SystemManager::updateSystemStatus ( )
slot

Updates the system status.

This function updates the system status by calling the getters on the

SystemInfoProvider and BatteryController objects and emitting the corresponding signals. It does not block and is intended to be called regularly.

Definition at line 117 of file SystemManager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateTime

void SystemManager::updateTime ( )
slot

Updates the current time.

This function retrieves the current date and time and emits the timeUpdated signal with the formatted date, time, and weekday.

Definition at line 102 of file SystemManager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wifiStatusUpdated

void SystemManager::wifiStatusUpdated ( const QString & status,
const QString & wifiName )
signal
Here is the caller graph for this function:

Field Documentation

◆ m_batteryController

IBatteryController* SystemManager::m_batteryController
private

Definition at line 62 of file SystemManager.hpp.

◆ m_ownBatteryController

bool SystemManager::m_ownBatteryController
private

Definition at line 65 of file SystemManager.hpp.

◆ m_ownSystemCommandExecutor

bool SystemManager::m_ownSystemCommandExecutor
private

Definition at line 67 of file SystemManager.hpp.

◆ m_ownSystemInfoProvider

bool SystemManager::m_ownSystemInfoProvider
private

Definition at line 66 of file SystemManager.hpp.

◆ m_statusTimer

QTimer SystemManager::m_statusTimer
private

Definition at line 61 of file SystemManager.hpp.

◆ m_systemCommandExecutor

ISystemCommandExecutor* SystemManager::m_systemCommandExecutor
private

Definition at line 64 of file SystemManager.hpp.

◆ m_systemInfoProvider

ISystemInfoProvider* SystemManager::m_systemInfoProvider
private

Definition at line 63 of file SystemManager.hpp.

◆ m_timeTimer

QTimer SystemManager::m_timeTimer
private

Definition at line 60 of file SystemManager.hpp.


The documentation for this class was generated from the following files: