![]() |
Home · All Namespaces · All Classes |
00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary (-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of systemui. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 #ifndef BATTERYBUSINESSLOGIC_H 00020 #define BATTERYBUSINESSLOGIC_H 00021 00022 #include <QObject> 00023 #include <QTime> 00024 00025 #ifdef HAVE_QMSYSTEM 00026 #include <qmled.h> 00027 #include <qmbattery.h> 00028 #include <qmdevicemode.h> 00029 #include <qmdisplaystate.h> 00030 #endif 00031 00032 class QTimer; 00033 class MNotification; 00034 00041 class LowBatteryNotifier : public QObject 00042 { 00043 Q_OBJECT 00044 00045 public: 00046 LowBatteryNotifier (QObject* parent = 0); 00047 virtual ~LowBatteryNotifier (); 00048 00049 public slots: 00050 void showLowBatteryNotification (); 00051 00052 private slots: 00053 #ifdef HAVE_QMSYSTEM 00054 void displayStateChanged (MeeGo::QmDisplayState::DisplayState state); 00055 #endif 00056 00057 signals: 00058 void lowBatteryAlert (); 00059 00060 private: 00061 #ifdef HAVE_QMSYSTEM 00062 MeeGo::QmDisplayState *m_Display; 00063 #endif 00064 QTimer *m_Timer; 00065 QTime m_Time; 00066 bool m_Sleep; 00067 int m_ActiveInterval; 00068 int m_InactiveInterval; 00069 00070 #ifdef UNIT_TEST 00071 friend class Ut_LowBatteryNotifier; 00072 #endif 00073 }; 00074 00078 class BatteryBusinessLogic : public QObject 00079 { 00080 Q_OBJECT 00081 00082 public: 00083 BatteryBusinessLogic (QObject* parent = 0); 00084 virtual ~BatteryBusinessLogic (); 00085 00086 typedef enum { 00087 NotificationCharging, 00088 NotificationChargingComplete, 00089 NotificationRemoveCharger, 00090 NotificationChargingNotStarted, 00091 NotificationRechargeBattery, 00092 NotificationEnteringPSM, 00093 NotificationExitingPSM, 00094 NotificationLowBattery, 00095 NotificationNoEnoughPower, 00096 } NotificationID; 00097 00098 signals: 00099 /* 00100 * To simplify the test case we use this signal that we can catch. See 00101 * NB#171466 for further details. 00102 */ 00103 void notificationSent ( 00104 QString eventType, 00105 QString text, 00106 QString icon); 00107 00108 public slots: 00109 void initBattery (); 00110 void lowBatteryAlert (); 00111 00112 private slots: 00113 #ifdef HAVE_QMSYSTEM 00114 void batteryStateChanged (MeeGo::QmBattery::BatteryState state); 00115 void chargingStateChanged (MeeGo::QmBattery::ChargingState state); 00116 void batteryChargerEvent (MeeGo::QmBattery::ChargerType type); 00117 void devicePSMStateChanged (MeeGo::QmDeviceMode::PSMState PSMState); 00118 #endif 00119 void utiliseLED (bool activate, const QString &pattern); 00120 00121 private: 00122 void sendNotification (BatteryBusinessLogic::NotificationID id); 00123 void sendNotification ( 00124 const QString &eventType, 00125 const QString &text, 00126 const QString &icon = QString("")); 00127 QString chargingImageId (); 00128 00129 LowBatteryNotifier *m_LowBatteryNotifier; 00130 MNotification *m_notification; 00131 #ifdef HAVE_QMSYSTEM 00132 MeeGo::QmBattery *m_Battery; 00133 MeeGo::QmDeviceMode *m_DeviceMode; 00134 MeeGo::QmLED *m_Led; 00135 MeeGo::QmBattery::ChargerType m_ChargerType; 00136 #endif 00137 00138 #ifdef UNIT_TEST 00139 friend class Ut_BatteryBusinessLogic; 00140 friend class Ft_BatteryBusinessLogic; 00141 #endif 00142 }; 00143 00144 00145 #endif 00146
| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:19:34 Doxygen 1.7.1 |
MeeGo Touch |
