Go to the documentation of this file.00001
00035 #ifndef QMSYSTEMSTATE_H
00036 #define QMSYSTEMSTATE_H
00037
00038 #include "system_global.h"
00039 #include <QtCore/qobject.h>
00040
00041 QT_BEGIN_HEADER
00042
00043 namespace MeeGo {
00044
00045 class QmSystemStatePrivate;
00046
00053 class MEEGO_SYSTEM_EXPORT QmSystemState : public QObject
00054 {
00055 Q_OBJECT
00056 Q_ENUMS(NextState)
00057 Q_ENUMS(StateIndication)
00058 Q_ENUMS(RunState)
00059 Q_ENUMS(BootReason)
00060
00061 public:
00063 enum NextState
00064 {
00065 Powerup = 0,
00066 Reboot,
00067 ShuttingDown
00068 };
00069
00071 enum StateIndication
00072 {
00073 Shutdown = 0,
00074 ThermalStateFatal,
00075 BatteryStateEmpty,
00076 SaveData,
00077 RebootDeniedUSB,
00078 ShutdownDeniedUSB
00079 };
00080
00081 enum RunState
00082 {
00083 RunState_User = 0,
00084 RunState_ActDead,
00085 RunState_Test,
00086 RunState_Local,
00087 RunState_Malf,
00088 RunState_Flash,
00089 RunState_Shutdown,
00090 RunState_Unknown
00091 };
00092
00093 enum BootReason
00094 {
00095 BootReason_Unknown = -1,
00096 BootReason_SwdgTimeout = 0,
00097 BootReason_SecViolation,
00098 BootReason_Wdg32kTimeout,
00099 BootReason_PowerOnReset,
00100 BootReason_PowerKey,
00101 BootReason_MBus,
00102 BootReason_Charger,
00103 BootReason_Usb,
00104 BootReason_SWReset,
00105 BootReason_RTCAlarm,
00106 BootReason_NSU
00107 };
00108
00109 public:
00114 QmSystemState(QObject *parent = 0);
00115 ~QmSystemState();
00116
00123 bool set(NextState nextState);
00124
00129 RunState getRunState();
00130
00135 BootReason getBootReason();
00136
00141 unsigned int getPowerOnTimeInSeconds();
00142
00143 Q_SIGNALS:
00148 void systemStateChanged(MeeGo::QmSystemState::StateIndication what);
00149
00150 protected:
00151 void connectNotify(const char *signal);
00152 void disconnectNotify(const char *signal);
00153
00154 private:
00155 Q_DISABLE_COPY(QmSystemState)
00156 MEEGO_DECLARE_PRIVATE(QmSystemState)
00157 };
00158
00159 }
00160
00161 QT_END_HEADER
00162
00163 #endif // QMSYSTEMSTATE_H
00164
00165
00166