|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : LandmarksPositionRequest.h 00004 * Part of : Landmark Reference Application 00005 * Interface : - 00006 * Description : See class description below 00007 * Version : 1.0 00008 * 00009 * Copyright (c) 2004-2006 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 00016 #ifndef __LANDMARKS_POSITION_REQUEST_H__ 00017 #define __LANDMARKS_POSITION_REQUEST_H__ 00018 00019 // INCLUDES 00020 #include <e32base.h> 00021 #include <aknprogressdialog.h> 00022 #include <lbs.h> 00023 00024 // FORWARD DECLARATIONS 00025 class MLandmarksOperationObserver; 00026 class CAknWaitDialog; 00027 00028 // CLASS DECLARATION 00029 00030 /** 00031 * Provides an interface for retrieving the current location. 00032 * It also manages a floating progress ball for indicating the progress of the 00033 * location retrieval. 00034 */ 00035 class CLandmarksPositionRequest: public CActive, public MProgressDialogCallback 00036 { 00037 public: // Constructors and destructor 00038 00039 /** 00040 * Two-phased constructor. 00041 * 00042 * @param aAppName the name of this application 00043 * @param aObserver observer to callback when locations are retrieved 00044 */ 00045 static CLandmarksPositionRequest* NewL( 00046 const TDesC& aAppName, 00047 MLandmarksOperationObserver* aObserver); 00048 00049 /** 00050 * Destructor. 00051 */ 00052 ~CLandmarksPositionRequest(); 00053 00054 public: // New Functions 00055 00056 /** 00057 * Starts the fetching of a location. In the first place the default 00058 * proxy is used for retrieving a location. If fetching default location 00059 * fails the last known location is fetched. If fetching last known 00060 * location fails, an error code is returned to the observer. 00061 * 00062 * @param aMessage the message to present in the progress dialog. 00063 * @param aPositionInfo contains the fetched location 00064 */ 00065 void FetchPositionInfoL( 00066 const TDesC& aMessage, 00067 TPositionInfo& aPositionInfo); 00068 00069 /** 00070 * Dismisses the wait note. 00071 */ 00072 void DismissWaitNote(); 00073 00074 protected: // from CActive 00075 00076 /** 00077 * Implements cancellation of an outstanding request. 00078 */ 00079 void DoCancel(); 00080 00081 /** 00082 * Handles an active object’s request completion event. 00083 */ 00084 void RunL(); 00085 00086 /** 00087 * Handles a leave occurring in the request completion event 00088 * handler RunL(). 00089 * 00090 * @return KErrNone 00091 */ 00092 TInt RunError(TInt aError); 00093 00094 public: // from MProgressDialogCallback 00095 00096 //! Inherited from MProgressDialogCallback 00097 void DialogDismissedL(TInt aButtonId); 00098 00099 private: 00100 00101 /** 00102 * C++ constructor. 00103 * 00104 * @param aObserver observer to callback when locations are retrieved 00105 */ 00106 CLandmarksPositionRequest( 00107 MLandmarksOperationObserver* aObserver); 00108 00109 /** 00110 * By default Symbian 2nd phase constructor is private. 00111 */ 00112 void ConstructL(const TDesC& aAppName); 00113 00114 /** 00115 * Executes the next step of the location retrieval. 00116 */ 00117 void ExecuteNextStep(); 00118 00119 /** 00120 * Notifies the observer that the location retrieval is complete. 00121 * 00122 * @param aError the status of the location retrieval 00123 */ 00124 void NotifyOperationCompleteL(TInt aError); 00125 00126 /** 00127 * Initializes the class to be ready for location acquisition. 00128 */ 00129 void InitializeL(); 00130 00131 /** 00132 * Informs user about location request failure. 00133 */ 00134 void ShowErrorL(TInt aError); 00135 00136 private: // Data types 00137 00138 /** 00139 * TState defines the different states this object may enter. 00140 */ 00141 enum TState 00142 { 00143 EIdle, 00144 EAcquiringDefaultLocation, 00145 EAcquiringLastKnownLocation, 00146 EDismissingDialog 00147 }; 00148 00149 private: // Data 00150 00151 //! Contains the location 00152 TPositionInfo* iPositionInfo; 00153 00154 //! The observer to callback when location retieval is ready 00155 MLandmarksOperationObserver* iObserver; 00156 00157 //! Reference to the Location Server session 00158 RPositionServer iLocationServer; 00159 00160 //! Reference to the Location Server subsession 00161 RPositioner iPositioner; 00162 00163 //! The current state this object has entered 00164 TState iState; 00165 00166 //! The progress bar displayed when active 00167 CAknWaitDialog* iWaitNote; 00168 00169 //! The name of this application 00170 HBufC* iAppName; 00171 00172 }; 00173 00174 #endif // __LANDMARKS_POSITION_REQUEST_H__ 00175 00176 // End of File 00177
|
© Nokia 2006 |