contextengine/plugins/locationplugin/inc/locationcontextplugin.h
changeset 0 c53acadfccc6
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2007-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:  A Context Engine Plug-in to get location context information.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CLOCATIONCONTEXTPLUGIN_H
       
    20 #define CLOCATIONCONTEXTPLUGIN_H
       
    21 
       
    22 #include <e32def.h>
       
    23 
       
    24 #include "contextplugin.h"
       
    25 #include "rlocationtrail.h"
       
    26 #include "rlocationobjectmanipulator.h"
       
    27 #include "locationdatatype.h"
       
    28 
       
    29 // forward declarations
       
    30 class TLocality;
       
    31 class CMdESession;
       
    32 class CHarvesterData;
       
    33 class CMdEProperty;
       
    34 
       
    35 /**
       
    36 * This class implements the context plugin interface for GPS
       
    37 * location information.
       
    38 *
       
    39 */
       
    40 class CLocationContextPlugin : public CContextPlugin
       
    41     {
       
    42 public:
       
    43 
       
    44     /**
       
    45      * Creates and constructs a new instance of CLocationContextPlugin.
       
    46      *
       
    47      * @return A pointer to the created instance.
       
    48      */
       
    49     static CLocationContextPlugin* NewL();
       
    50 
       
    51     /**
       
    52      * Destructor.
       
    53      */
       
    54     virtual ~CLocationContextPlugin();
       
    55 
       
    56 // from base class CContextPlugin
       
    57 
       
    58     /**
       
    59      * From CContextPlugin.
       
    60      * Initialization of Location Context Plugin.
       
    61      *
       
    62      * @param An observer to notify the completion of initialization to.
       
    63      */
       
    64     void Init( MContextPluginObserver& aObserver );
       
    65 
       
    66     /**
       
    67      * Set a pointer to MdESession.
       
    68      * Session is used to store harvested context data.
       
    69      *
       
    70      * @param aSession Session pointer to set.
       
    71      */
       
    72     void SetMdeSession( CMdESession& aSession );
       
    73 
       
    74     /**
       
    75      * From CContextPlugin.
       
    76      * This method takes a location context snapshot for one metadata object
       
    77      * and writes the information to the object received as parameter.
       
    78      * The observer will be informed about the status of the operation.
       
    79      *
       
    80      * @param aObserver  An interface class to inform about finishing context snapshot.
       
    81      * @param aMetadataObject An object to take the snapshot for.
       
    82      */
       
    83     void ContextSnapshot( MContextPluginObserver& aObserver, CHarvesterData& aHD );
       
    84 
       
    85     /**
       
    86      * From CContextPlugin.
       
    87      * This method takes a location context snapshot for several metadata objects
       
    88      * and writes the information to the all the objects received as parameter.
       
    89      * The observer will be informed about the status of the operation.
       
    90      *
       
    91      * @param aObserver  An interface class to inform about finishing context snapshot.
       
    92      * @param aMetadataObjectArray Array of objects to take the snapshot for.
       
    93      */
       
    94     void ContextSnapshot( MContextPluginObserver& aObserver,
       
    95                           RPointerArray<CHarvesterData>& aHDArray );
       
    96 
       
    97 private:
       
    98 
       
    99     /**
       
   100      * Constructor, called by NewL() only.
       
   101      */
       
   102     CLocationContextPlugin();
       
   103 
       
   104     /**
       
   105      * Second phase constructor called by NewL.
       
   106      */
       
   107     void ConstructL();
       
   108 
       
   109     /**
       
   110      * A simple method to get creation date/time from a mde object.
       
   111      *
       
   112      * @param aObject        A metadata object to get the date/time from.
       
   113      * @param aTimeProperty  A property to store the time information to.
       
   114      */    
       
   115     void GetMdeObjectCreationTimeL( CMdEObject& aObject, CMdEProperty*& aProperty );
       
   116 
       
   117 private: // data
       
   118 
       
   119     /** @var Observer to notify about finishing status of the context snapshot. */
       
   120     MContextPluginObserver* iObserver;
       
   121     
       
   122     /** @var Service to get GPS location information. */
       
   123     RLocationTrail iLocationTrail;
       
   124     
       
   125     /** @var Pointer to Mde session which is used to store context data. */
       
   126     CMdESession* iMdeSession;
       
   127     
       
   128     /** @var Location trail status flag to signal if Connect() was successful. */
       
   129     TBool iLocationTrailConnected;
       
   130     
       
   131     /** @var Service to modify location context objects. */
       
   132     RLocationObjectManipulator iManipulator;
       
   133     };
       
   134 
       
   135 #endif // CLOCATIONCONTEXTPLUGIN_H