epoc-gps-positioner.hpp

Go to the documentation of this file.
00001 #ifndef __epoc_gps_positioner_hpp__
00002 #define __epoc_gps_positioner_hpp__
00003 
00004 #include "epoc-gps-observer.hpp"
00005 
00006 #include "ac_app_context.h"
00007 #include "epoc-ao-gerror.hpp"
00008 #include "ld_log_db.h"
00009 #include "utils_cl2.h"
00010 
00011 #include <e32std.h>
00012 #include <lbs.h> // link against lbs.lib
00013 #include <lbssatellite.h>
00014 
00015 #include <glib.h>
00016 
00017 /***koog 
00018 (require racket/class)
00019 (require codegen/symbian-ctor)
00020 
00021 (ctor-defines (new 
00022   (class ctor%
00023     (super-new)
00024     (define/override (class-name) "CPositioner_gps")
00025     (define/override (args/string) "RPositionServer& aPositionServer, MObserver_gps& aObserver, TPositionModuleId aModuleId, TInt aUpdateIntervalSecs/constructl, TInt aUpdateTimeoutSecs/constructl, TInt aMaxAgeSecs/constructl")
00026     (define/override (init-expr) "CActiveRunG(EPriorityStandard), iPositionServer(aPositionServer), iObserver(aObserver), iModuleId(aModuleId)")
00027     (define/override (ctor-code) "CActiveScheduler::Add(this);")
00028    )))
00029  ***/
00030 #define CTOR_DECL_CPositioner_gps  \
00031 public: static CPositioner_gps* NewLC(RPositionServer& aPositionServer, MObserver_gps& aObserver, TPositionModuleId aModuleId, TInt aUpdateIntervalSecs, TInt aUpdateTimeoutSecs, TInt aMaxAgeSecs); \
00032 public: static CPositioner_gps* NewL(RPositionServer& aPositionServer, MObserver_gps& aObserver, TPositionModuleId aModuleId, TInt aUpdateIntervalSecs, TInt aUpdateTimeoutSecs, TInt aMaxAgeSecs); \
00033 private: CPositioner_gps(RPositionServer& aPositionServer, MObserver_gps& aObserver, TPositionModuleId aModuleId); \
00034 private: void ConstructL(TInt aUpdateIntervalSecs, TInt aUpdateTimeoutSecs, TInt aMaxAgeSecs);
00035 
00036 #define CTOR_IMPL_CPositioner_gps  \
00037 CPositioner_gps* CPositioner_gps::NewLC(RPositionServer& aPositionServer, MObserver_gps& aObserver, TPositionModuleId aModuleId, TInt aUpdateIntervalSecs, TInt aUpdateTimeoutSecs, TInt aMaxAgeSecs) \
00038 { \
00039   CPositioner_gps* obj = new (ELeave) CPositioner_gps(aPositionServer, aObserver, aModuleId); \
00040   CleanupStack::PushL(obj); \
00041   obj->ConstructL(aUpdateIntervalSecs, aUpdateTimeoutSecs, aMaxAgeSecs); \
00042   return obj; \
00043 } \
00044  \
00045 CPositioner_gps* CPositioner_gps::NewL(RPositionServer& aPositionServer, MObserver_gps& aObserver, TPositionModuleId aModuleId, TInt aUpdateIntervalSecs, TInt aUpdateTimeoutSecs, TInt aMaxAgeSecs) \
00046 { \
00047   CPositioner_gps* obj = CPositioner_gps::NewLC(aPositionServer, aObserver, aModuleId, aUpdateIntervalSecs, aUpdateTimeoutSecs, aMaxAgeSecs); \
00048   CleanupStack::Pop(obj); \
00049   return obj; \
00050 } \
00051  \
00052 CPositioner_gps::CPositioner_gps(RPositionServer& aPositionServer, MObserver_gps& aObserver, TPositionModuleId aModuleId) : CActiveRunG(EPriorityStandard), iPositionServer(aPositionServer), iObserver(aObserver), iModuleId(aModuleId) \
00053 {CActiveScheduler::Add(this);}
00054 /***end***/
00055 
00056 // An active object for dealing with a single RPositioner.
00057 NONSHARABLE_CLASS(CPositioner_gps) : 
00058   public CActiveRunG
00059 {
00060  public:
00061 
00062   virtual ~CPositioner_gps();
00063 
00064   CTOR_DECL_CPositioner_gps;
00065 
00066  public:
00067 
00068   // Makes the next positioning request.
00069   void MakeRequest();
00070 
00071   TInt StatusCode() const { return iStatus.Int(); }
00072 
00073   const TPositionSatelliteInfo& PositionInfo() const { return iPositionInfo; }
00074 
00075   TPositionModuleId ModuleId() const { return iModuleId; }
00076   
00077  private: // CActiveRunG
00078 
00079   virtual gboolean RunGL(GError** error);
00080   
00081   virtual const char* Description();
00082   
00083   virtual void DoCancel();
00084 
00085  private:
00086 
00087   RPositionServer& iPositionServer;
00088   MObserver_gps& iObserver;
00089   TPositionModuleId iModuleId;
00090 
00091   DEF_SESSION(RPositioner, iPositioner);
00092 
00093   TPositionUpdateOptions iUpdateOptions;
00094 
00095   // Supertype of both TPositionCourseInfo and TPositionInfo.
00096   TPositionSatelliteInfo iPositionInfo;
00097 };
00098 
00099 #endif /* __epoc_gps_positioner_hpp__ */
00100 
00101 /**
00102 
00103 Copyright 2009-2011 Helsinki Institute for Information Technology
00104 (HIIT) and the authors. All rights reserved.
00105 
00106 Authors: Tero Hasu <tero.hasu@hut.fi>
00107 
00108 Permission is hereby granted, free of charge, to any person
00109 obtaining a copy of this software and associated documentation files
00110 (the "Software"), to deal in the Software without restriction,
00111 including without limitation the rights to use, copy, modify, merge,
00112 publish, distribute, sublicense, and/or sell copies of the Software,
00113 and to permit persons to whom the Software is furnished to do so,
00114 subject to the following conditions:
00115 
00116 The above copyright notice and this permission notice shall be
00117 included in all copies or substantial portions of the Software.
00118 
00119 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00120 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00121 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00122 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
00123 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00124 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00125 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00126 SOFTWARE.
00127 
00128  **/

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