javaextensions/location/position/inc/ctrackingpositioner.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Handles position request from LocationListener
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CTRACKINGPOSITIONER_H
       
    20 #define CTRACKINGPOSITIONER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "cpositionerbase.h"
       
    24 #include "locationfunctionserver.h"
       
    25 #include <jni.h>
       
    26 
       
    27 namespace java
       
    28 {
       
    29 namespace location
       
    30 {
       
    31 
       
    32 //  FORWARD DECLARATIONS
       
    33 class CTimeoutTimer;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38  *  Handles position requests with LocationListener.
       
    39  */
       
    40 class CTrackingPositioner: public CPositionerBase
       
    41 {
       
    42 public:
       
    43     // Constructors and destructor
       
    44 
       
    45     /**
       
    46      * Two-phased constructor.
       
    47      */
       
    48     static CTrackingPositioner* NewL(LocationFunctionServer* aFunctionSource,
       
    49                                      RPositionServer& aServer, TPositionModuleId aModuleId,
       
    50                                      TPositionModuleInfo::TCapabilities aCapabilities);
       
    51 
       
    52     /**
       
    53      * Destructor.
       
    54      */
       
    55     ~CTrackingPositioner();
       
    56 
       
    57 public:
       
    58     // New functions
       
    59 
       
    60     TInt StartTracking(TInt aInterval, TInt aTimeout, TInt aMaxAge);
       
    61 
       
    62     void StopTracking();
       
    63 
       
    64     void SetDefaultValues(const TTimeIntervalMicroSeconds& aTimeToFix,
       
    65                           TBool aNetworkbased);
       
    66 
       
    67 protected:
       
    68     // Functions from base classes
       
    69 
       
    70     /**
       
    71      * From CActive
       
    72      */
       
    73     void RunL();
       
    74 
       
    75     /**
       
    76      * From CActive
       
    77      */
       
    78     void DoCancel();
       
    79 
       
    80     /**
       
    81      * From CActive
       
    82      */
       
    83     TInt RunError(TInt aError);
       
    84 
       
    85 private:
       
    86 
       
    87     /**
       
    88      * C++ default constructor.
       
    89      */
       
    90     CTrackingPositioner(LocationFunctionServer* aFunctionSource);
       
    91 
       
    92     /**
       
    93      * Symbian 2nd phase constructor.
       
    94      */
       
    95     void ConstructL(RPositionServer& aServer, TPositionModuleId aModuleId,
       
    96                     TPositionModuleInfo::TCapabilities aCapabilities);
       
    97 
       
    98     // Prohibit copy constructor if not deriving from CBase.
       
    99     // ?classname( const ?classname& );
       
   100     // Prohibit assigment operator if not deriving from CBase.
       
   101     // ?classname& operator=( const ?classname& );
       
   102 
       
   103 private:
       
   104     void CallBack();
       
   105     static TInt StaticCallBack(TAny* aTrackingPositioner);
       
   106 
       
   107 public:
       
   108     // JNI Environment Data
       
   109     JNIEnv* mJni;
       
   110     jobject mPeer;
       
   111 
       
   112     // Location Updated Callback JNI Method ID
       
   113     jmethodID mLocationUpdatedMethod;
       
   114 
       
   115 private:
       
   116     // Data
       
   117 
       
   118     CTimeoutTimer* iTimer;
       
   119     TBool iNetworkBased;
       
   120     TInt64 iTimeToFix;
       
   121     TInt64 iInterval;
       
   122     TInt64 iTimeout;
       
   123 };
       
   124 
       
   125 }
       
   126 }
       
   127 
       
   128 #endif // CTRACKINGPOSITIONER_H
       
   129 // End of File