![]() |
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 <QTimer> 00024 00025 #ifdef HAVE_QMSYSTEM 00026 #include <qmled.h> 00027 #include <qmbattery.h> 00028 #include <qmdevicemode.h> 00029 #endif 00030 00031 class LowBatteryNotifier; 00032 class MNotification; 00033 00037 class BatteryBusinessLogic : public QObject 00038 { 00039 Q_OBJECT 00040 00041 public: 00042 BatteryBusinessLogic (QObject* parent = 0); 00043 virtual ~BatteryBusinessLogic (); 00044 00045 typedef enum { 00046 NotificationCharging, 00047 NotificationChargingComplete, 00048 NotificationRemoveCharger, 00049 NotificationChargingNotStarted, 00050 NotificationRechargeBattery, 00051 NotificationEnteringPSM, 00052 NotificationExitingPSM, 00053 NotificationLowBattery, 00054 NotificationNoEnoughPower, 00055 } NotificationID; 00056 00057 signals: 00058 /* 00059 * To simplify the test case we use this signal that we can catch. See 00060 * NB#171466 for further details. 00061 */ 00062 void notificationSent ( 00063 QString eventType, 00064 QString text, 00065 QString icon); 00066 00067 public slots: 00068 void initBattery (); 00069 void lowBatteryAlert (); 00070 00076 void setTouchScreenLockActive(bool active); 00077 00078 private slots: 00079 #ifdef HAVE_QMSYSTEM 00080 void batteryStateChanged (MeeGo::QmBattery::BatteryState state); 00081 void chargingStateChanged (MeeGo::QmBattery::ChargingState state); 00082 void batteryChargerEvent (MeeGo::QmBattery::ChargerType type); 00083 void devicePSMStateChanged (MeeGo::QmDeviceMode::PSMState PSMState); 00084 #endif 00085 void utiliseLED (bool activate, const QString &pattern); 00086 00087 private: 00088 void sendNotification (BatteryBusinessLogic::NotificationID id); 00089 void sendNotification ( 00090 const QString &eventType, 00091 const QString &text, 00092 const QString &icon = QString("")); 00093 void removeNotification(const QString &eventType); 00094 QString chargingImageId (); 00095 void startLowBatteryNotifier(); 00096 void stopLowBatteryNotifier(); 00097 00098 LowBatteryNotifier *m_LowBatteryNotifier; 00099 MNotification *m_notification; 00100 QTimer notificationTimer; 00101 00103 bool touchScreenLockActive; 00104 00105 #ifdef HAVE_QMSYSTEM 00106 MeeGo::QmBattery *m_Battery; 00107 MeeGo::QmDeviceMode *m_DeviceMode; 00108 MeeGo::QmLED *m_Led; 00109 MeeGo::QmBattery::ChargerType m_ChargerType; 00110 #endif 00111 00112 #ifdef UNIT_TEST 00113 friend class Ut_BatteryBusinessLogic; 00114 friend class Ft_BatteryBusinessLogic; 00115 #endif 00116 }; 00117 00118 00119 #endif 00120
Copyright © 2011 Nokia Corporation | Generated on Tue Aug 30 2011 16:38:12 Doxygen 1.7.1 |
MeeGo Touch |