locationtriggering/ltcontextsourceplugin/inc/lbtcontextsourceplugin.h
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 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:  CLBTContextSourcePlugin DLL source
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __LBTCONTEXTSOURCEPLUGIN_H__
       
    19 #define __LBTCONTEXTSOURCEPLUGIN_H__
       
    20 
       
    21 //  Include Files
       
    22 #include <cfcontextsourceplugin.h>
       
    23 #include <cfcontextsourceinterface.h>
       
    24 #include <cfcontextsourcesetting.h>
       
    25 #include <cfcontextsourcesettingarray.h>
       
    26 #include <cfcontextobject.h>
       
    27 #include <cfcontextsourceupgrade.h>
       
    28 #include <cfcontextsourcecommand.h>
       
    29 
       
    30 
       
    31 #include <e32capability.h>
       
    32 #include <cfcontextinterface.h>
       
    33 
       
    34 #include "lbttriggeradapter.h"
       
    35 #include "lbttriggermanager.h"
       
    36 
       
    37 _LIT_SECURITY_POLICY_C1( KLBTContextSec, ECapabilityLocalServices );
       
    38 
       
    39 /*
       
    40  * This class is responsible for parsing the input settings file. The parsed setting information is
       
    41  * passed to the CLocationTriggerAdapter class to create and monitor these triggers.
       
    42  */
       
    43 NONSHARABLE_CLASS( CLBTContextSourcePlugin ):
       
    44     public CCFContextSourcePlugIn,
       
    45     public MCFContextSourceUpgrade,
       
    46     private MLBTContextTriggerObserver
       
    47     {
       
    48     public:
       
    49     
       
    50         /*
       
    51          * Two phase constructor for CLBTContextSourcePlugin
       
    52          */
       
    53         static CLBTContextSourcePlugin* NewL( 
       
    54             TContextSourceInitParams* aParams );
       
    55         
       
    56         /*
       
    57          * Two phase constructor for CLBTContextSourcePlugin
       
    58          */
       
    59         static CLBTContextSourcePlugin* NewLC( 
       
    60             TContextSourceInitParams* aParams );
       
    61         
       
    62         /*
       
    63          * Create an instance of the CCFContextObject object here.
       
    64          * This object is used to define and publish contexts.
       
    65          */
       
    66         void ConstructL();
       
    67             
       
    68         /*
       
    69          * Default contructor for CLBTContextSourcePlugin.
       
    70          */
       
    71         CLBTContextSourcePlugin( TContextSourceInitParams* aParams );
       
    72         
       
    73         /*
       
    74          * Default destuctor for CLBTContextSourcePlugin class
       
    75          */
       
    76         ~CLBTContextSourcePlugin();
       
    77     
       
    78     public:
       
    79     
       
    80         /*
       
    81          * Derived from CCFContextSourcePlugIn
       
    82          * Context Framework parses the XML settings file and passes up the trigger data 
       
    83          */
       
    84         void HandleSettingL(
       
    85              CCFContextSourceSettingArray* aSettingList );
       
    86             
       
    87         /*
       
    88          * Derived from CCFContextSourcePlugIn
       
    89          * Called by Context Framework to define contexts. 
       
    90          * LBT Source plugin does not define contexts here, hence left empty.
       
    91          */
       
    92         void DefineContextsL();
       
    93         
       
    94         /*
       
    95          * Derived from CCFContextSourcePlugIn
       
    96          */
       
    97         void InitializeL();
       
    98         
       
    99         
       
   100         /*
       
   101          * @see MCFContextSourceUpgrade
       
   102          */
       
   103         TInt CheckValidity( RThread& aClientThread, 
       
   104                 const CCFContextSourceSettingArray& aSettingList); 
       
   105         /*
       
   106          * @see MCFContextSourceUpgrade
       
   107          */
       
   108         void UpdateSettingsL( CCFContextSourceSettingArray* aSettingList );
       
   109         
       
   110         /*
       
   111          * @see CCFContextSourcePlugIn
       
   112          */
       
   113         TAny* Extension( const TUid& aExtensionUid )const;
       
   114         
       
   115         
       
   116 
       
   117         /*
       
   118          * Derived from MLBTContextTriggerObserver
       
   119          * Callback for fired trigger
       
   120          * 
       
   121          * @param[in] aTriggerId Trigger id of fired trigger
       
   122          */
       
   123         void ContextTriggerFiredL( TLbtTriggerId aTriggerId );
       
   124         
       
   125         /*
       
   126          * Derived from MLBTContextTriggerObserver
       
   127          * Callback for error in trigger creation.
       
   128          */
       
   129         void NotifyError( TInt aError );
       
   130         
       
   131         
       
   132     private: 
       
   133         
       
   134         /*
       
   135          * Parse TriggerLocation node and extract required trigger information.
       
   136          * Information required for trigger creation like latitude, longitude, trigger name, etc.
       
   137          * are parsed and stored here. The parsed information is stored into an array of type TTriggerNode.
       
   138          * 
       
   139          * param[in] aItem TriggerLocation node
       
   140          */
       
   141         void ParseTriggerInformationL( const CCFContextSourceSetting& aItem );
       
   142         
       
   143         /*
       
   144          * Contexts are defined here. The list of created triggers is retrieved from iTriggerList array.
       
   145          */
       
   146         void DefineTriggerContexts( );
       
   147         
       
   148         /*
       
   149          * Calls CreateTrigger() from CLocationTriggerAdapter class with items from iTriggerNodeList
       
   150          */
       
   151         void CreateTriggersL();
       
   152         
       
   153         /*
       
   154          * Derived from MLBTContextTriggerObserver
       
   155          * List of triggers created is maintained here. After trigger creation the trigger ID, 
       
   156          * name and context name are maintained in an array here. 
       
   157          */
       
   158         void TriggerCreatedL( TLbtTriggerId& aTrigId , TPtrC& aContextName, TPtrC& aTriggerName );
       
   159         
       
   160     private: 
       
   161         
       
   162         /**
       
   163          * Holds the list of parsed values from input settings file
       
   164          */
       
   165         CCFContextSourceSettingArray* iSettingList;
       
   166     
       
   167         /*
       
   168          * Pointer to instance of CLocationTriggerAdapter class
       
   169          */
       
   170         CLocationTriggerAdapter *iLocationTrigger;
       
   171         
       
   172         /*
       
   173          * Pointer to class monitoring LBT ManagementUI operations
       
   174          */
       
   175         CLocationTriggerManager* iLbtManagerObserver;
       
   176         
       
   177          /*
       
   178           *  List of triggers.
       
   179           *  Used for keeping track of triggers defined in user file.
       
   180           */
       
   181          RPointerArray<TTriggerNode> iTriggerNodeList;
       
   182          
       
   183          /*
       
   184           * List of { trigger ID, context name, trigger name}
       
   185           */
       
   186          RPointerArray<TriggerList> iTriggerList;
       
   187        
       
   188          /*
       
   189           *  Index value of next trigger to be created
       
   190           */
       
   191          TInt iCurrentTriggerIndex;      
       
   192          
       
   193          /*
       
   194           * Flag to check for completion of all trigger creation requests.
       
   195           */
       
   196          TBool iTriggersCreated;
       
   197          
       
   198     };
       
   199 
       
   200 #endif  // __LBTCONTEXTSOURCEPLUGIN_H__
       
   201