epoc-inactivity.hpp

Go to the documentation of this file.
00001 #ifndef __epoc_inactivity_hpp__
00002 #define __epoc_inactivity_hpp__
00003 
00004 #include "application_config.h"
00005 
00006 #if __INACTIVITY_ENABLED__
00007 
00008 #include "ac_app_context.h"
00009 #include "utils_cl2.h"
00010 
00011 #include <e32std.h>
00012 
00013 #include <glib.h>
00014 
00015 /***koog 
00016 (require codegen/symbian-cxx)
00017 (ctor-defines/spec
00018  "CSensor_inactivity" ;; name
00019  "ac_AppContext* aC" ;; args
00020  "CActive(EPriorityHigh), iC(aC)" ;; inits
00021  "CActiveScheduler::Add(this);" ;; ctor
00022  #t ;; ConstructL
00023 )
00024  ***/
00025 #define CTOR_DECL_CSensor_inactivity  \
00026 public: static CSensor_inactivity* NewLC(ac_AppContext* aC); \
00027 public: static CSensor_inactivity* NewL(ac_AppContext* aC); \
00028 private: CSensor_inactivity(ac_AppContext* aC); \
00029 private: void ConstructL();
00030 
00031 #define CTOR_IMPL_CSensor_inactivity  \
00032 CSensor_inactivity* CSensor_inactivity::NewLC(ac_AppContext* aC) \
00033 { \
00034   CSensor_inactivity* obj = new (ELeave) CSensor_inactivity(aC); \
00035   CleanupStack::PushL(obj); \
00036   obj->ConstructL(); \
00037   return obj; \
00038 } \
00039  \
00040 CSensor_inactivity* CSensor_inactivity::NewL(ac_AppContext* aC) \
00041 { \
00042   CSensor_inactivity* obj = CSensor_inactivity::NewLC(aC); \
00043   CleanupStack::Pop(obj); \
00044   return obj; \
00045 } \
00046  \
00047 CSensor_inactivity::CSensor_inactivity(ac_AppContext* aC) : CActive(EPriorityHigh), iC(aC) \
00048 {CActiveScheduler::Add(this);}
00049 /***end***/
00050 NONSHARABLE_CLASS(CSensor_inactivity) : public CActive
00051 {
00052   CTOR_DECL_CSensor_inactivity;
00053 
00054  public:
00055   virtual ~CSensor_inactivity();
00056 
00057   gboolean StartL(GError** error);
00058 
00059   void Stop();
00060 
00061  private: // CActive
00062   virtual void RunL();
00063 
00064   virtual void DoCancel();
00065 
00066  private:
00067   void MakeRequest();
00068   void GetState();
00069 
00070  private:
00071   ac_AppContext* iC;
00072   DEF_SESSION(RTimer, iTimer);
00073 
00074   enum EState { EUnknown, EIdle, EActive };
00075   EState iCurrentState;
00076 };
00077 
00078 #endif // __INACTIVITY_ENABLED__
00079 
00080 #endif /* __epoc_inactivity_hpp__ */
00081 
00082 /**
00083 
00084 epoc-inactivity.hpp
00085 
00086 Copyright 2009 Helsinki Institute for Information Technology (HIIT)
00087 and the authors. All rights reserved.
00088 
00089 Authors: Tero Hasu <tero.hasu@hut.fi>
00090 
00091 Permission is hereby granted, free of charge, to any person
00092 obtaining a copy of this software and associated documentation files
00093 (the "Software"), to deal in the Software without restriction,
00094 including without limitation the rights to use, copy, modify, merge,
00095 publish, distribute, sublicense, and/or sell copies of the Software,
00096 and to permit persons to whom the Software is furnished to do so,
00097 subject to the following conditions:
00098 
00099 The above copyright notice and this permission notice shall be
00100 included in all copies or substantial portions of the Software.
00101 
00102 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00103 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00104 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00105 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
00106 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00107 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00108 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00109 SOFTWARE.
00110 
00111  **/

ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:52 2011 by Doxygen 1.6.1