1 #ifndef OPERATIONMODETOGGLER_H_
2 #define OPERATIONMODETOGGLER_H_
4 #include "DeviceManager.h"
10 class DeviceConfigurator;
11 class DeviceDataStorage;
13 class OperationModeToggler : public QThread
20 * Constructor for HWKeyListener class
23 DeviceManager::OperationMode aMode,
24 StartupSettings *aSettings,
25 AlarmSender *aAlarmSender,
26 DeviceConfigurator *aConfigurator,
27 DeviceDataStorage *aDataStorage
31 virtual ~OperationModeToggler();
32 //! Run method of the class.
34 * Run method of the class.
37 //! Returns the success status of the operation mode change.
39 * Returns the success status of the operation mode change.
42 //! Stores the current operation mode.
44 * Stores the current operation mode by asking the DeviceDataStorage to write it to the internal
46 * \param aMode The operation mode that user wants to activate.
47 * \return True if operation mode storing succeeds; otherwise, false.
49 static bool storeOperationMode( DeviceManager::OperationMode aMode, DeviceDataStorage *aDataStorage );
52 //! Signal. Emitted if an error occurs during operation mode fetching or reading.
54 * Signal. Emitted if an error occurs during operation mode fetching or reading. Note that other
55 * possible errors are sent by the other instances e.g. alarm sender sents it's own errors.
56 * \param aCode The error code.
58 void error( DeviceManager::ErrorCode aCode );
59 //! Signal. Emitted if an error occurs during operation mode changing.
61 * Signal. Emitted if an error occurs during operation mode changing. If an error occurs, the operation
62 * mode changes made so far have to be rolled back. During this we don't want to show possible new
64 * \param aToggle Indicates if the errors are wanted to be shown.
66 void toggleErrorSending( bool aToggle );
67 //! Signal. Emitted during the operation mode change to explain the current sub-change.
69 * Signal. Emitted during the operation mode change to explain the current sub-change.
70 * \param aMessage Explains the sub-change
72 void changingMode( const QString &aMessage );
75 DeviceManager::OperationMode iMode;
76 StartupSettings *iSettings;
77 AlarmSender *iAlarmSender;
78 DeviceConfigurator *iConfigurator;
79 DeviceDataStorage *iDataStorage;
83 #endif /*OPERATIONMODETOGGLER_H_*/