eventsui/eventsengine/inc/evteventmanager.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     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:  Interface to store and access the Location Events.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_EVTEVENTMANAGER_H
       
    20 #define C_EVTEVENTMANAGER_H
       
    21 
       
    22 // System Includes
       
    23 #include <e32base.h>
       
    24 
       
    25 // User Includes
       
    26 #include "evtbasiceventinfo.h"
       
    27 #include "evtevent.h"
       
    28 
       
    29 // Forward Declarations
       
    30 class CEvtDatabase;
       
    31 class CEvtBasicEventInfo;
       
    32 class CEvtEvent;
       
    33 class MEvtStorageDbObserver;
       
    34 
       
    35 // extern data types
       
    36 
       
    37 // global Functions
       
    38 
       
    39 // constants go here
       
    40 
       
    41 /**
       
    42  *  Interface class to store and access the Location Events.
       
    43  *  This class allows for Events to be stored in persistent database. 
       
    44  *  Events can be added, deleted and modified from database.
       
    45  *  This class also allows for monitoring any changes to the database. This
       
    46  *  is achieved by setting observer to the database.
       
    47  *
       
    48  *  @lib evtstorage.lib
       
    49  *  @since S60 v9.1
       
    50  */
       
    51 class CEvtEventManager : public CBase
       
    52     {        
       
    53 public:  // Exported Functions
       
    54     /**
       
    55      * Constructs a new instance of Event Storage Manager interface.
       
    56      *
       
    57      * @return The new instance of Event Storage Manager object.
       
    58      * @leave System wide error code if the object creation fails.         
       
    59      */
       
    60     IMPORT_C static CEvtEventManager* NewL();
       
    61     
       
    62     /**
       
    63      * Constructs a new instance of Event Storage Manager interface.
       
    64      * Leaves the created instance on the cleanup stack.
       
    65      *
       
    66      * @return The new instance of Event Storage Manager object.
       
    67      * @leave System wide error code if the object creation fails.         
       
    68      */
       
    69     IMPORT_C static CEvtEventManager* NewLC();  
       
    70 
       
    71     /**
       
    72     * Destructor.
       
    73     */
       
    74     virtual ~CEvtEventManager();
       
    75 
       
    76     /**
       
    77      * Gets a sorted list of Events based on Event Status Criteria. The sort
       
    78      * is based on Event's Subject Field.
       
    79      *
       
    80      * The application can decide upon the list of Events returned.
       
    81      * This can be achieved by passing a Event Status as the parameter
       
    82      * to this function. The status of the Events is defined by 
       
    83      * @ref TEvtEventStatus      
       
    84      *  
       
    85      * The ownership of the list of Events is transferred to the caller.
       
    86      * 
       
    87      * @since S60 v9.1
       
    88      * @param[in] TEvtEventStatus Event Status that decides the 
       
    89      *                    list of Events to be returned.   
       
    90      * @param[out] aEventArray Reference to an array of pointers to Event.
       
    91      *                           This Array would be updated with the
       
    92      *                           @ref CEvtBasicEventInfo objects.
       
    93      * @return One of the following error values.
       
    94      *         - KErrNone, If the Events were successfully retrieved.
       
    95      *         - System wide error code if the database operation
       
    96      *                fails for any other reason.     
       
    97      */
       
    98     IMPORT_C void GetEventsL( 
       
    99     						TEvtEventStatus 	aEvtStatus,
       
   100                      		RPointerArray<CEvtBasicEventInfo>& aEvtEventArray );
       
   101 
       
   102     /**
       
   103      * Gets a sorted list of ALL Events. The sort is based on Event's 
       
   104      * Subject Field.
       
   105      *
       
   106      * The application gets all the Events entry from the database.     
       
   107      *  
       
   108      * The ownership of the list of Events is transferred to the caller.
       
   109      * 
       
   110      * @since S60 v9.1  
       
   111      * @param[out] aEventArray Reference to an array of pointers to Event.
       
   112      *                           This Array would be updated with the
       
   113      *                           @ref CEvtBasicEventInfo objects.
       
   114      * @return One of the following error values.
       
   115      *         - KErrNone, If the Events were successfully retrieved.
       
   116      *         - System wide error code if the database operation
       
   117      *                fails for any other reason.    
       
   118      */
       
   119     IMPORT_C void GetEventsL( 
       
   120                      		RPointerArray<CEvtBasicEventInfo>& aEvtEventArray );
       
   121 
       
   122     /**
       
   123      * Gets an Event based on Event Id passed.
       
   124      *
       
   125      * The application can get the Event info based on the EventId passed.  
       
   126      *  
       
   127      * The ownership of the returned Event is transferred to the caller.
       
   128      * 
       
   129      * @since S60 v9.1
       
   130      * @param[in] aEvtId EventId that decides the Event to be returned.   
       
   131      * @return CEvtEvent - Pointer to @ref CEvtEvent, if the Event was found
       
   132                          in the database.
       
   133                          - NULL, if the event was not present in the database.
       
   134      */
       
   135     IMPORT_C CEvtEvent* GetEventL( TEvtEventId            aEvtId );
       
   136 
       
   137     /**
       
   138      * Deletes the List of Events from Database.
       
   139      *
       
   140      * The application delete the list of Events from the database.     
       
   141      * 
       
   142      * @since S60 v9.1
       
   143      * @param[in] aEventArray Reference to the Events Id array that are to 
       
   144      *                          be removed form the database.  
       
   145      * @return One of the following error values.
       
   146      *         - KErrNone, If the Event was successfully deleted.
       
   147      *         - System wide error code if the database operation
       
   148      *                fails for any other reason. 
       
   149      */
       
   150     IMPORT_C void RemoveEventsL( 
       
   151                             const RArray<TEvtEventId>&     aEvtIdArray );
       
   152     
       
   153     /**
       
   154      * Update the status of events in Database.
       
   155      *
       
   156      * The application will pass the list of Events whose status are updated in the 
       
   157      * database.  
       
   158      * 
       
   159      * @since S60 v9.1
       
   160      * @param[in] aEventArray Reference to the Events Id array that are to 
       
   161      *                          be updated in database.  
       
   162      * @param[in] TEvtEventStatus Event Status that decides the 
       
   163      *                    list of Events to be returned.      
       
   164      * @return One of the following error values.
       
   165      *         - KErrNone, If the Event was successfully deleted.
       
   166      *         - System wide error code if the database operation
       
   167      *                fails for any other reason. 
       
   168      */
       
   169     IMPORT_C void UpdateEventsStatusL( 
       
   170                                 const RArray<TEvtEventId>&     aEvtIdArray,
       
   171                                 TEvtEventStatus    aEvtStatus );
       
   172 
       
   173     /**
       
   174      * Updates the given Event to Database.
       
   175      *
       
   176      * The application will pass the Event that has to be updated in the 
       
   177      * database.    
       
   178      * 
       
   179      * @since S60 v9.1
       
   180      * @param[in] aEvtEvent Reference to the Event that is to be updated in
       
   181      *                          the database.  
       
   182      * @return One of the following error values.
       
   183      *         - KErrNone, If the Event was successfully updated.
       
   184      *         - System wide error code if the database operation
       
   185      *                fails for any other reason. 
       
   186      */
       
   187     IMPORT_C void UpdateEventL( 
       
   188                             CEvtEvent&          aEvtEvent );
       
   189 
       
   190     /**
       
   191      * Inserts a new Event to Database.
       
   192      *
       
   193      * The application will pass the Event that has to be inserted in the 
       
   194      * database.
       
   195      *  
       
   196      * @since S60 v9.1
       
   197      * @param[in] CEvtEvent Reference to the Event that has to 
       
   198      *                          be inserted into the database. 
       
   199      * @return One of the following error values.
       
   200      *         - KErrNone, If the Event was successfully inserted.
       
   201      *         - System wide error code if the database operation
       
   202      *                fails for any other reason.
       
   203      */
       
   204     IMPORT_C void AddEventL( CEvtEvent&     aEvtEvent );
       
   205 
       
   206     /**
       
   207      * Update the status of an Event in Database.
       
   208      *
       
   209      * The application will pass the Event whose status is updated in the 
       
   210      * database.
       
   211      *  
       
   212      * @since S60 v9.1
       
   213      * @param[in] TEvtEventStatus Event Status that decides the 
       
   214      *                    list of Events to be returned.   
       
   215      * @param[in] CEvtEvent Reference to the Event that has to 
       
   216      *                          be updated into the database. 
       
   217      * @return One of the following error values.
       
   218      *         - KErrNone, If the Event was successfully updated.
       
   219      *         - System wide error code if the database update
       
   220      *                fails for any other reason.  
       
   221      */
       
   222     IMPORT_C void UpdateEventStatusL(
       
   223                             TEvtEventId      aEvtId,
       
   224                             TEvtEventStatus    aEvtStatus);
       
   225     
       
   226     /**
       
   227      * Delete an Event from Database.
       
   228      *
       
   229      * The application will pass the Event that has to be deleted from the
       
   230      * database.
       
   231      *  
       
   232      * @since S60 v9.1
       
   233      * @param[in] aEventId Id of the Event that is to be removed form
       
   234      *                          the database. 
       
   235      * @return One of the following error values.
       
   236      *         - KErrNone, If the Event was successfully deleted.
       
   237      *         - System wide error code if the database operation
       
   238      *                fails for any other reason.  
       
   239      */
       
   240     IMPORT_C void RemoveEventL( TEvtEventId      aEvtId );
       
   241     
       
   242     /**
       
   243      * Set the Observer for the Storage Database.
       
   244      *
       
   245      * The application can listen to the change in the Storage database 
       
   246      * by setting the Observer.
       
   247      *  
       
   248      * @since S60 v9.1
       
   249      * @param[in] aDbObserver An Observer to listen to Storage database
       
   250      * 						changes. 
       
   251      */
       
   252     IMPORT_C void SetObserver( MEvtStorageDbObserver*      aDbObserver );
       
   253 
       
   254 private:
       
   255     /**
       
   256      * Default C++ Constructor.
       
   257      */
       
   258     CEvtEventManager();
       
   259 
       
   260     /**
       
   261      * Second phase of the two phase constructor.
       
   262      */
       
   263     void ConstructL();
       
   264 
       
   265 private: // data
       
   266     /**
       
   267      *  CEvtDatabaseRequest Instance
       
   268      */
       
   269     CEvtDatabase* iEvtDb;
       
   270 
       
   271     };
       
   272 
       
   273 #endif // C_EVTEVENTMANAGER_H