locationmanager/locationtrail/inc/cpositioninfo.h
changeset 0 c53acadfccc6
child 3 b73a2e62868f
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CPOSITIONINFO_H
       
    20 #define C_CPOSITIONINFO_H
       
    21 
       
    22 #include <Lbs.h>
       
    23 #include <LbsSatellite.h>
       
    24 #include "rlocationtrail.h"
       
    25 
       
    26 /**
       
    27 *  An observer interface, which is used for getting current position info.
       
    28 *
       
    29 *  @since S60 3.1
       
    30 */
       
    31 class MPositionInfoObserver
       
    32     {
       
    33 public:    
       
    34     /**
       
    35      * This method is used for setting the network cell id to the 
       
    36      * location trail.
       
    37      */
       
    38     virtual void Position( const TPositionInfo& aPositionInfo, 
       
    39                            const TInt aError ) = 0;
       
    40     };
       
    41 
       
    42 /**
       
    43  *
       
    44  *  @since S60 3.1
       
    45  */
       
    46 class CPositionInfo : public CActive
       
    47     {
       
    48 public:  
       
    49     /**
       
    50      * 2-phased constructor.
       
    51      * @since S60 3.1
       
    52      */
       
    53     IMPORT_C static CPositionInfo* NewL( MPositionInfoObserver* aTrail );
       
    54 
       
    55     /**
       
    56      * C++ destructor.
       
    57      * @since S60 3.1
       
    58      */    
       
    59     IMPORT_C virtual ~CPositionInfo();
       
    60 
       
    61 public:
       
    62     /**
       
    63      * Start collecing positions.
       
    64      * @since S60 3.1
       
    65      * @param None.
       
    66      * @return None.
       
    67      */    
       
    68     void StartL( RLocationTrail::TTrailCaptureSetting aCaptureSetting, TInt aUpdateInterval );
       
    69     
       
    70     /**
       
    71      * Get next position.
       
    72      * @since S60 3.1
       
    73      * @param None.
       
    74      * @return None.
       
    75      */  
       
    76     void NextPosition();   
       
    77     
       
    78     /**
       
    79      * Stop collecing positions.
       
    80      * @since S60 3.1
       
    81      * @param None.
       
    82      * @return None.
       
    83      */    
       
    84     void Stop();
       
    85         
       
    86 protected:
       
    87     /**
       
    88      * Run error implementation in case of RunL leaving.
       
    89      * @since S60 3.1
       
    90      */
       
    91     TInt RunError( TInt aError );
       
    92     
       
    93 private:
       
    94     /**
       
    95      * C++ constructor.
       
    96      */  
       
    97     CPositionInfo( MPositionInfoObserver* aTrail );
       
    98     
       
    99     /**
       
   100      * 2nd phase constructor.
       
   101      */
       
   102     void ConstructL();
       
   103     
       
   104 private:
       
   105     /**
       
   106     * From CActive.
       
   107     */        
       
   108     void DoCancel();
       
   109     
       
   110     /**
       
   111     * From CActive.
       
   112     */        
       
   113     void RunL(); 
       
   114 
       
   115 private:
       
   116     /**
       
   117      * An observer interface to set current position to the location trail.
       
   118      * Not own.
       
   119      */
       
   120     MPositionInfoObserver* iTrail;
       
   121     
       
   122     /**
       
   123      * Position server.
       
   124      * Own.
       
   125      */
       
   126     RPositionServer iPosServer;
       
   127 
       
   128     /**
       
   129      * Positioner.
       
   130      * Own.
       
   131      */
       
   132     RPositioner iPositioner;
       
   133 
       
   134     TPositionSatelliteInfo iPositionInfo; 
       
   135     TPositionUpdateOptions iUpdateOptions;
       
   136     RLocationTrail::TTrailCaptureSetting   iTrailCaptureSetting;
       
   137     
       
   138     TInt iUpdateInterval;
       
   139     
       
   140     TBool iFirstInterval;
       
   141     };
       
   142 
       
   143 #endif // C_CPOSITIONINFO_H
       
   144 
       
   145 // End of file.