epoc-indicator.hpp

Go to the documentation of this file.
00001 #ifndef __epoc_indicator_hpp__
00002 #define __epoc_indicator_hpp__
00003 
00004 #include "application_config.h"
00005 
00006 #if __INDICATOR_ENABLED__
00007 
00008 #include "ac_app_context.h"
00009 #include "utils_cl2.h"
00010 
00011 #include <e32base.h>
00012 #include <etel3rdparty.h>
00013 
00014 #include <glib.h>
00015 
00016 /***koog 
00017 (require codegen/symbian-cxx)
00018 (ctor-defines/spec
00019  "CSensor_indicator" ;; name
00020  "ac_AppContext* aAppContext" ;; args
00021  "CActive(EPriorityStandard), iAppContext(aAppContext), iIndicatorDes(iIndicator)" ;; inits
00022  "CActiveScheduler::Add(this);" ;; ctor
00023  #t ;; ConstructL
00024 )
00025  ***/
00026 #define CTOR_DECL_CSensor_indicator  \
00027 public: static CSensor_indicator* NewLC(ac_AppContext* aAppContext); \
00028 public: static CSensor_indicator* NewL(ac_AppContext* aAppContext); \
00029 private: CSensor_indicator(ac_AppContext* aAppContext); \
00030 private: void ConstructL();
00031 
00032 #define CTOR_IMPL_CSensor_indicator  \
00033 CSensor_indicator* CSensor_indicator::NewLC(ac_AppContext* aAppContext) \
00034 { \
00035   CSensor_indicator* obj = new (ELeave) CSensor_indicator(aAppContext); \
00036   CleanupStack::PushL(obj); \
00037   obj->ConstructL(); \
00038   return obj; \
00039 } \
00040  \
00041 CSensor_indicator* CSensor_indicator::NewL(ac_AppContext* aAppContext) \
00042 { \
00043   CSensor_indicator* obj = CSensor_indicator::NewLC(aAppContext); \
00044   CleanupStack::Pop(obj); \
00045   return obj; \
00046 } \
00047  \
00048 CSensor_indicator::CSensor_indicator(ac_AppContext* aAppContext) : CActive(EPriorityStandard), iAppContext(aAppContext), iIndicatorDes(iIndicator) \
00049 {CActiveScheduler::Add(this);}
00050 /***end***/
00051 
00052 NONSHARABLE_CLASS(CSensor_indicator) :
00053   public CActive
00054 {
00055   CTOR_DECL_CSensor_indicator;
00056 
00057  public:
00058   virtual ~CSensor_indicator();
00059 
00060   // Produces a leave or a GError if starting fails. No harm calling
00061   // this if already started.
00062   gboolean StartL(GError** error);
00063 
00064   // Stops observing for changes and logging them. No harm calling
00065   // this if already stopped.
00066   void Stop();
00067 
00068  private: // CActive
00069 
00070   virtual void RunL();
00071   
00072   virtual void DoCancel();
00073   
00074  private:
00075 
00076   void MakeRequest();
00077 
00078   void SetTimer();
00079   
00080   void HandleTimer();
00081   
00082   void HandleRead();
00083 
00084  private:
00085 
00086   ac_AppContext* iAppContext; // not owned
00087 
00088   CTelephony::TIndicatorV1 iOldIndicator;
00089 
00090   CTelephony::TIndicatorV1 iIndicator;
00091 
00092   CTelephony::TIndicatorV1Pckg iIndicatorDes;
00093 
00094   // Actually, we probably do not require retry support in this
00095   // sensor, but here it is anyway, for now.
00096 
00097   TInt iNumScanFailures;
00098 
00099   enum TState {
00100     EInactive = 0,
00101     EQuerying,
00102     ERetryWaiting
00103   };
00104   TState iState;
00105 
00106   DEF_SESSION(RTimer, iTimer);
00107 
00108 };
00109 
00110 #endif // __INDICATOR_ENABLED__
00111 
00112 #endif /* __epoc_indicator_hpp__ */
00113 
00114 /**
00115 
00116 epoc-indicator.hpp
00117 
00118 Copyright 2009 Helsinki Institute for Information Technology (HIIT)
00119 and the authors. All rights reserved.
00120 
00121 Authors: Tero Hasu <tero.hasu@hut.fi>
00122 
00123 Permission is hereby granted, free of charge, to any person
00124 obtaining a copy of this software and associated documentation files
00125 (the "Software"), to deal in the Software without restriction,
00126 including without limitation the rights to use, copy, modify, merge,
00127 publish, distribute, sublicense, and/or sell copies of the Software,
00128 and to permit persons to whom the Software is furnished to do so,
00129 subject to the following conditions:
00130 
00131 The above copyright notice and this permission notice shall be
00132 included in all copies or substantial portions of the Software.
00133 
00134 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00135 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00136 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00137 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
00138 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00139 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00140 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00141 SOFTWARE.
00142 
00143  **/

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