calendarui/controller/inc/calencontextfwlistener.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     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: This class interfaces with Context Framework Client API  
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CALENCONTEXTFWLISTENER_H
       
    19 #define CALENCONTEXTFWLISTENER_H
       
    20 
       
    21 // System includes.
       
    22 #include <e32base.h>
       
    23 #include <cflistener.h>
       
    24 
       
    25 
       
    26 class CCFClient;
       
    27 class CCFContextSubscription;
       
    28 class CCalenAlarmManager;
       
    29 
       
    30 /**
       
    31 * This class interfaces with Context Framework Client API to
       
    32 * define, subscribe and register contexts, actions and scripts 
       
    33 * for Calendar Editors and Viewers.
       
    34 *
       
    35 *  @lib CalenDefaultEditors
       
    36 *  @since S60 5.0
       
    37 **/
       
    38 NONSHARABLE_CLASS( CCalenContextFWListener ) : public CBase, 
       
    39                                        public MCFListener
       
    40 {
       
    41 public: // constructors and destructor
       
    42 
       
    43     /** Symbian constructor */
       
    44     static CCalenContextFWListener* NewL(CCalenAlarmManager& aAlarmManager );
       
    45 
       
    46     /** c++ destructor */
       
    47     virtual ~CCalenContextFWListener();
       
    48 
       
    49 public: // from base class MCFListener
       
    50 
       
    51     /**
       
    52     * Indicates a change in context for subscribed clients.
       
    53     * If client has subscribed to partial context class path,
       
    54     * only the changed context will be indicated.
       
    55     * @since S60 5.0
       
    56     * @param aChangedContext: Context indication.
       
    57     */
       
    58     void ContextIndicationL(const CCFContextIndication& aChangedContext);
       
    59 
       
    60     /**
       
    61     * Indicates that specified action is needed to be executed.
       
    62     * When action indication is received certain rule has been triggered
       
    63     * and action is needed to be performed.
       
    64     * @since S60 5.0
       
    65     * @param aActionToExecute Action indication.
       
    66     */
       
    67     void ActionIndicationL(const CCFActionIndication& aActionToExecute);
       
    68 
       
    69     /**
       
    70     * Indicates that specified action is needed to be executed.
       
    71     * When action indication is received certain rule has been triggered
       
    72     * and action is needed to be performed.
       
    73     * @since S60 5.0
       
    74     * @param aError  Error code.
       
    75     * @param aSource Error source.
       
    76     * @param aType   Error type.
       
    77     */
       
    78     void HandleContextFrameworkError( TCFError aError, 
       
    79                                       const TDesC& aSource, 
       
    80                                       const TDesC& aType );
       
    81                                       
       
    82     /**
       
    83     * Returns an extension interface.
       
    84     * The extension interface is mapped with the extension UID.
       
    85     *
       
    86     * If the client does not support the requested interface,
       
    87     * client must return NULL. Otherwise client needs to return
       
    88     * the correct interface combined with the UID.
       
    89     *
       
    90     * @since S60 5.0
       
    91     * @param aExtensionUid: The identifier of the extension.
       
    92     * @return Pointer to the extension.
       
    93     */
       
    94   	TAny* Extension( const TUid& aExtensionUid ) const;
       
    95       
       
    96 private:
       
    97     /**
       
    98     * Unsusbscribe all context subscriptions.
       
    99     * @since S60 5.0
       
   100     */
       
   101     void UnsubscribeContexts();
       
   102 
       
   103     /**
       
   104     * Publish a context.
       
   105     * @since S60 5.0
       
   106     */
       
   107     void PublishContextL( const TDesC& aSource, 
       
   108                           const TDesC& aType,
       
   109                           const TDesC& aValue );
       
   110 
       
   111     /**
       
   112     * Open the CCFClient session.
       
   113     * @since S60 5.0
       
   114     */
       
   115     void OpenCFClientL();
       
   116 
       
   117     /**
       
   118     * Unsusbscribe all actions and close the CCFClient session.
       
   119     * @since S60 5.0
       
   120     */
       
   121     void CloseCFClient();
       
   122 
       
   123 public:
       
   124     /**
       
   125     * Publish a context to stop alarm
       
   126     * @since S60 5.0
       
   127     */
       
   128     void AlarmStopL();
       
   129     
       
   130     /**
       
   131     * Publish a context to snooze alarm
       
   132     * @since S60 5.0
       
   133     */
       
   134     void AlarmSnoozeL();
       
   135     
       
   136     /**
       
   137     * Check if a calendar alarm is still active
       
   138     * @since S60 5.0
       
   139     **/
       
   140     TBool IsCalendarAlarmActiveL();
       
   141 
       
   142 private: // constructors
       
   143 
       
   144     /** hidden default contructor */
       
   145     CCalenContextFWListener(CCalenAlarmManager& aAlarmManager);
       
   146 
       
   147     /** Symbian 2nd phase constructor */
       
   148     void ConstructL();
       
   149 
       
   150 private: // data
       
   151 
       
   152     /**
       
   153     * Pointer to the Context Framework's client side API
       
   154     * Own.
       
   155     **/
       
   156     CCFClient* iCFClient;
       
   157     
       
   158     CCalenAlarmManager& iAlarmManager;  
       
   159     
       
   160     /** 
       
   161     * Array of subscribed contexts.
       
   162     * Own.
       
   163     */
       
   164     RPointerArray<CCFContextSubscription> iSubscribedContexts;  
       
   165 
       
   166 };
       
   167 
       
   168 #endif // CALENCONTEXTFWLISTENER_H
       
   169 
       
   170 
       
   171 // End of File