basiclocationinfodisplay/blid/engine/inc/CBlidEng.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2005 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 *     Implements interface for Blid Engine.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef BLID_ENG_H__
       
    21 #define BLID_ENG_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <s32std.h>
       
    26 #include <lbspositioninfo.h>
       
    27 #include <lbs.h>
       
    28 #include <hwrmlight.h>
       
    29 
       
    30 
       
    31 // FORWARD DECLARATION
       
    32 class MBlidSettings;
       
    33 class MBlidLocation;
       
    34 class MBlidRouter;
       
    35 class TNamedCoordinate;
       
    36 
       
    37 
       
    38 // CLASS DECLARATION
       
    39 /**
       
    40  *  Implements entry point class to BlidEng.dll
       
    41  */
       
    42 class CBlidEng : public CBase
       
    43     {
       
    44     public:
       
    45         /**
       
    46         * Enumerations for model creation
       
    47         */
       
    48         enum TBlidModelType
       
    49             {
       
    50             EBlidSettings,
       
    51             EBlidLocation,
       
    52             EBlidRouter
       
    53             };
       
    54        
       
    55        enum TAppMode
       
    56 			{
       
    57 			EAppForeground = 1,
       
    58 			EAppBackground
       
    59 			};
       
    60 			
       
    61 	   enum	TBacklightState
       
    62 		   {
       
    63 		   EBlidBacklightAlwaysOn,
       
    64 		   EBlidBacklightNormal
       
    65 		   };
       
    66 
       
    67     public:
       
    68         /**
       
    69          * Two-phased constructor.
       
    70          *
       
    71          * @return CBlidEng object.
       
    72          */
       
    73         IMPORT_C static CBlidEng* NewL();
       
    74 
       
    75         /**
       
    76          * Destructor.
       
    77          */
       
    78         virtual ~CBlidEng();
       
    79 
       
    80     private:
       
    81         /**
       
    82          * By default Symbian 2nd phase constructor is private.
       
    83          */
       
    84         void ConstructL();
       
    85 
       
    86         /**
       
    87          * C++ default constructor.
       
    88          */
       
    89         CBlidEng();
       
    90 
       
    91     public: //new functions
       
    92         /**
       
    93          * Create stream
       
    94          * @param aStore A reference to CStreamStore
       
    95          * @param aRestore A reference to CStreamStore
       
    96          * @return TStreamId
       
    97          */ 
       
    98         IMPORT_C TStreamId StoreL(CStreamStore& aStore,
       
    99                                   CStreamStore& aRestore);
       
   100 
       
   101         /**
       
   102          * Open Stream
       
   103          * @param aStore A reference to CStreamStore
       
   104          * @param aStreamId 
       
   105          */
       
   106         IMPORT_C void RestoreL( const CStreamStore& aStore,
       
   107                         TStreamId aStreamId );
       
   108 
       
   109         /**
       
   110          * Settings model getter.
       
   111          * Ownership not transferred.
       
   112          *
       
   113          * @return pointer to the settings model
       
   114          */
       
   115         IMPORT_C MBlidSettings* SettingsModel() const;
       
   116 
       
   117         /**
       
   118          * Location model getter.
       
   119          * Ownership not transferred.
       
   120          *
       
   121          * @return pointer to the location model
       
   122          */
       
   123         IMPORT_C MBlidLocation* LocationModel() const;
       
   124 
       
   125         /**
       
   126          * Router model getter.
       
   127          * Ownership not transferred.
       
   128          *
       
   129          * @return pointer to the router model
       
   130          */
       
   131         IMPORT_C MBlidRouter* RouterModel() const;
       
   132 
       
   133         /**
       
   134          * Model creator.
       
   135          *
       
   136          * @param aModel model identificator.
       
   137          */
       
   138         IMPORT_C void CreateModelL( TBlidModelType aModel );
       
   139         
       
   140         /**
       
   141          * Returns the distance to the currently set destination
       
   142          *
       
   143          * @param aDistance. Holds the distance to the destination 
       
   144          * on return.
       
   145          */
       
   146         IMPORT_C TInt GetDistanceToDestination(TReal32& aDistance);
       
   147         
       
   148         /**
       
   149          * Determines if user has arrived to the 
       
   150          * set destination using an algorithm described in the
       
   151          * defination. 
       
   152          *
       
   153          * @ return value
       
   154          * Returns ETrue if current position is in vicinity of the 
       
   155          * set destination 
       
   156          * 
       
   157          * EFalse otherwise.         
       
   158          */
       
   159         IMPORT_C TBool HasArrivedToDestination();
       
   160         
       
   161         /**
       
   162          * Sets the application mode (i.e Background or Foreground)
       
   163          *
       
   164          * @param aMode. 
       
   165          * EAppBackground if Background, 
       
   166          * EAppForeground if Foreground                 
       
   167          */
       
   168         IMPORT_C void SetAppMode(TAppMode aMode);
       
   169         
       
   170         /**
       
   171          * Sets the Backlight state
       
   172          *
       
   173          * @param aState. 
       
   174          * EBlidBacklightAlwaysOn if backlight should always be on
       
   175 		 * EBlidBacklightNormal if backlight should be as per general settings 
       
   176          */
       
   177         IMPORT_C void SetBackLightStateL(TBacklightState aState);
       
   178     
       
   179         /**
       
   180          * Returns the application mode
       
   181          * 
       
   182          * @return value
       
   183          * EAppForeground if application in foreground
       
   184          * EAppBackground if application in background
       
   185          */
       
   186         IMPORT_C TAppMode AppMode();
       
   187 
       
   188     private: // new functions
       
   189         /**
       
   190          * Save engine's data to file
       
   191          * @param aStream A reference to RWriteStream
       
   192          */ 
       
   193         void ExternalizeL( RWriteStream& aStream ) const;  
       
   194 
       
   195         /**
       
   196          * Load initial data from file 
       
   197          * @param aSteam A reference to RReadStream
       
   198          */
       
   199         void InternalizeL( RReadStream& aStream );
       
   200 
       
   201         /**
       
   202          * Load initial data from file 
       
   203          * @param aSteam A reference to RReadStream
       
   204          */
       
   205         void InternalizeV1L( RReadStream& aStream );
       
   206 
       
   207     private:    // data
       
   208         /// Own: Settings model
       
   209         MBlidSettings* iSettings;
       
   210 
       
   211         /// Own: Location model
       
   212         MBlidLocation* iLocation;
       
   213 
       
   214         /// Own: Router model
       
   215         MBlidRouter* iRouter;
       
   216 
       
   217         /// Own: iServer
       
   218         RPositionServer iServer; 
       
   219         
       
   220         /// stream id
       
   221         mutable TStreamId iStreamId;   
       
   222                 
       
   223         //Application mode (foreground/background)
       
   224         TAppMode iAppMode;
       
   225         
       
   226         //Own: Pointer to Backlight resource class
       
   227         CHWRMLight*     iHWRMLight;
       
   228     };
       
   229 
       
   230 #endif // BLID_ENG_H__
       
   231 
       
   232 // End of File