epoc-callstatus.hpp

Go to the documentation of this file.
00001 #ifndef __epoc_callstatus_hpp__
00002 #define __epoc_callstatus_hpp__
00003 
00004 #include "application_config.h"
00005 
00006 #if __CALLSTATUS_ENABLED__
00007 
00008 #include "ac_app_context.h"
00009 #include "ut_retry_epoc.hpp"
00010 #include "ut_telephony_epoc.h"
00011 #include "utils_cl2.h"
00012 
00013 #include <e32base.h>
00014 #include <etel3rdparty.h>
00015 
00016 #include <glib.h>
00017 
00018 /***koog 
00019 (require codegen/symbian-cxx)
00020 (ctor-defines/spec
00021  "CSensor_callstatus" ;; name
00022  "ac_AppContext* aAppContext" ;; args
00023  "iAppContext(aAppContext)" ;; inits
00024  "" ;; ctor
00025  #t ;; ConstructL
00026 )
00027  ***/
00028 #define CTOR_DECL_CSensor_callstatus  \
00029 public: static CSensor_callstatus* NewLC(ac_AppContext* aAppContext); \
00030 public: static CSensor_callstatus* NewL(ac_AppContext* aAppContext); \
00031 private: CSensor_callstatus(ac_AppContext* aAppContext); \
00032 private: void ConstructL();
00033 
00034 #define CTOR_IMPL_CSensor_callstatus  \
00035 CSensor_callstatus* CSensor_callstatus::NewLC(ac_AppContext* aAppContext) \
00036 { \
00037   CSensor_callstatus* obj = new (ELeave) CSensor_callstatus(aAppContext); \
00038   CleanupStack::PushL(obj); \
00039   obj->ConstructL(); \
00040   return obj; \
00041 } \
00042  \
00043 CSensor_callstatus* CSensor_callstatus::NewL(ac_AppContext* aAppContext) \
00044 { \
00045   CSensor_callstatus* obj = CSensor_callstatus::NewLC(aAppContext); \
00046   CleanupStack::Pop(obj); \
00047   return obj; \
00048 } \
00049  \
00050 CSensor_callstatus::CSensor_callstatus(ac_AppContext* aAppContext) : iAppContext(aAppContext) \
00051 {}
00052 /***end***/
00053 
00054 NONSHARABLE_CLASS(CSensor_callstatus) :
00055   public CBase,
00056   public MRetryAoObserver,
00057   public MGetterObs_FlightMode,
00058   public MNotifyObs_FlightMode,
00059   public MNotifyObs_CallStatus
00060 {
00061   CTOR_DECL_CSensor_callstatus;
00062 
00063  public:
00064   virtual ~CSensor_callstatus();
00065 
00066   // Produces a leave or a GError if starting fails. No harm calling
00067   // this if already started.
00068   gboolean StartL(GError** error);
00069 
00070   // Stops observing for changes and logging them. No harm calling
00071   // this if already stopped.
00072   void Stop();
00073 
00074  private: // MRetryAoObserver
00075 
00076   virtual void RetryTimerExpired(CRetryAo* src, TInt errCode);
00077 
00078  private: // MGetterObs_FlightMode
00079 
00080   virtual void GotData_FlightMode(TInt aError);
00081 
00082  private: // MNotifyObs_FlightMode
00083 
00084   virtual void ChangedData_FlightMode(TInt aError);
00085 
00086  private: // MNotifyObs_CallStatus
00087 
00088   virtual void ChangedData_CallStatus(TInt aError);
00089 
00090  private:
00091 
00092   void Cancel();
00093 
00094  private:
00095 
00096   ac_AppContext* iAppContext; // not owned
00097 
00098   CTelephony *iTelephony; // owned
00099 
00100   CRetryAo* iRetryAo; // owned
00101 
00102   CGetterAo_FlightMode* iFlightModeGetter; // owned
00103 
00104   CNotifyAo_FlightMode* iFlightModeNotifier; // owned
00105 
00106   CNotifyAo_CallStatus* iCallStatusNotifier; // owned
00107 
00108   enum TState {
00109     EInactive = 0, // not started
00110     EQueryingFlightMode, // querying flight mode, after start only
00111     EQueryingCallStatus, // querying call status
00112     ERetryWaiting, // waiting to retry call status query
00113     EInFlightMode // in flight mode, so no point in querying or retrying
00114   };
00115   TState iState;
00116 
00117  public:
00118 
00119   TBool IsActive() const { return iState != EInactive; }
00120 
00121  private:
00122 
00123   LogDb* GetLogDb() const { return ac_LogDb(iAppContext); }
00124 
00125 };
00126 
00127 #endif // __CALLSTATUS_ENABLED__
00128 
00129 // --------------------------------------------------
00130 // sensor array integration
00131 // --------------------------------------------------
00132 
00133 #if defined(SA_ARRAY_INTEGRATION)
00134 #if __CALLSTATUS_ENABLED__
00135 #define DECLARE_SENSOR_callstatus CSensor_callstatus* iSensor_callstatus
00136 #define SENSOR_CALLSTATUS_START sa_typical_symbian_sensor_start(self->iSensor_callstatus, "failed to start callstatus scanning")
00137 #define SENSOR_CALLSTATUS_STOP { self->iSensor_callstatus->Stop(); }
00138 #define SENSOR_CALLSTATUS_IS_RUNNING (self->iSensor_callstatus->IsActive())
00139 #define SENSOR_CALLSTATUS_DESTROY { delete self->iSensor_callstatus; self->iSensor_callstatus = NULL; }
00140 #define SENSOR_CALLSTATUS_CREATE sa_typical_symbian_sensor_create(self->iSensor_callstatus = CSensor_callstatus::NewL(self->ac), "callstatus sensor initialization")
00141 #define SENSOR_CALLSTATUS_RECONFIGURE(key,value) sa_reconfigure_ignore_all_keys
00142 #else
00143 #define DECLARE_SENSOR_callstatus
00144 #endif
00145 #endif /* SA_ARRAY_INTEGRATION */
00146 
00147 #endif /* __epoc_callstatus_hpp__ */
00148 
00149 /**
00150 
00151 epoc-callstatus.hpp
00152 
00153 Copyright 2009 Helsinki Institute for Information Technology (HIIT)
00154 and the authors. All rights reserved.
00155 
00156 Authors: Tero Hasu <tero.hasu@hut.fi>
00157 
00158 Permission is hereby granted, free of charge, to any person
00159 obtaining a copy of this software and associated documentation files
00160 (the "Software"), to deal in the Software without restriction,
00161 including without limitation the rights to use, copy, modify, merge,
00162 publish, distribute, sublicense, and/or sell copies of the Software,
00163 and to permit persons to whom the Software is furnished to do so,
00164 subject to the following conditions:
00165 
00166 The above copyright notice and this permission notice shall be
00167 included in all copies or substantial portions of the Software.
00168 
00169 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00170 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00171 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00172 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
00173 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00174 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00175 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00176 SOFTWARE.
00177 
00178  **/

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