alarmui/inc/alarmcontextfwsupport.h
changeset 0 f979ecb2b13e
child 18 d68a4b5d5885
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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 
       
    19 
       
    20 #ifndef CALARMCONTEXTFWSUPPORT_H
       
    21 #define CALARMCONTEXTFWSUPPORT_H
       
    22 
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <cflistener.h>
       
    26 
       
    27 #include "alarmsourcecontextdef.h"
       
    28 #include "AlmAlertVariant.hrh"
       
    29 
       
    30 
       
    31 class CCFClient;
       
    32 class CAlmAlarmControl;
       
    33 class CCFActionSubscription;
       
    34 class CCFContextSubscription;
       
    35 
       
    36 /**
       
    37 * Context Framework support for Alarm UI.
       
    38 *
       
    39 * This class interfaces with Context Framework Client API to
       
    40 * define, subscribe and register contexts, actions and scripts 
       
    41 * for Alarm UI.
       
    42 *
       
    43 *  @lib AknAlarmService
       
    44 *  @since S60 5.0
       
    45 **/
       
    46 NONSHARABLE_CLASS( CAlarmContextFwSupport ) : public CBase, 
       
    47                                               public MCFListener
       
    48 {
       
    49 public: // constructors and destructor
       
    50 
       
    51     /** 
       
    52     * Symbian constructor 
       
    53     */
       
    54     static CAlarmContextFwSupport* NewL(CAlmAlarmControl* aAlarmControl);
       
    55 
       
    56     /** 
       
    57     * c++ destructor 
       
    58     */
       
    59     virtual ~CAlarmContextFwSupport();
       
    60 
       
    61 private: // from base class MCFListener
       
    62 
       
    63     /**
       
    64     * Indicates a change in context for subscribed clients.
       
    65     * If client has subscribed to partial context class path,
       
    66     * only the changed context will be indicated.
       
    67     * @since S60 5.0
       
    68     * @param aChangedContext: Context indication.
       
    69     */
       
    70     void ContextIndicationL(const CCFContextIndication& aChangedContext);
       
    71 
       
    72     /**
       
    73     * Indicates that specified action is needed to be executed.
       
    74     * When action indication is received certain rule has been triggered
       
    75     * and action is needed to be performed.
       
    76     * @since S60 5.0
       
    77     * @param aActionToExecute Action indication.
       
    78     */
       
    79     void ActionIndicationL(const CCFActionIndication& aActionToExecute);
       
    80 
       
    81     /**
       
    82     * Indicates that specified action is needed to be executed.
       
    83     * When action indication is received certain rule has been triggered
       
    84     * and action is needed to be performed.
       
    85     * @since S60 5.0
       
    86     * @param aError  Error code.
       
    87     * @param aSource Error source.
       
    88     * @param aType   Error type.
       
    89     */
       
    90     void HandleContextFrameworkError( TCFError aError, 
       
    91                                       const TDesC& aSource, 
       
    92                                       const TDesC& aType );
       
    93 
       
    94 	// Changes made for Context Framework API changes (SCB Id: MKAN-765D93)
       
    95 		
       
    96 	/**
       
    97 	* Returns an extension interface.
       
    98 	* The extension interface is mapped with the extension UID.
       
    99 	*
       
   100 	* The default implemementation returns NULL.
       
   101 	*
       
   102 	* @since S60 5.0
       
   103 	* @param aExtensionUid: The identifier of the extension.
       
   104 	* @return Pointer to the extension.
       
   105 	*/
       
   106 	TAny* Extension( const TUid& aExtensionUid ) const;
       
   107                                           
       
   108 private:
       
   109     /**
       
   110     * @brief Defines a new context
       
   111     * @since S60 5.0
       
   112     * @param aContextSource  Source of the context.
       
   113     * @param aContextType    Type of the context.
       
   114     * @param aSecurityPolicy Needed capabilities for the context.
       
   115     * @return None  
       
   116     */
       
   117     void DefineContextL( const TDesC& aContextSource,
       
   118                          const TDesC& aContextType,
       
   119                          const TSecurityPolicy& aSecurityPolicy );
       
   120     /**
       
   121     * @brief Defines an action
       
   122     * @since S60 5.0
       
   123     * @param aAction Action identifier
       
   124     * @return None
       
   125     */
       
   126     void DefineActionL(const TAlarmUIActionValues aAction);
       
   127 
       
   128     /**
       
   129     * @brief Subscribe an action
       
   130     * @since S60 5.0
       
   131     * @param aAction Action identifier
       
   132     * @return None
       
   133     */
       
   134     void SubscribeActionL(const TAlarmUIActionValues aAction);
       
   135 
       
   136     /**
       
   137     * @brief Unsusbscribe all actions.
       
   138     * @since S60 5.0
       
   139     */
       
   140     void UnsubscribeActions();
       
   141 
       
   142 	
       
   143     /**
       
   144     * @brief Publish a context.
       
   145     * @since S60 5.0
       
   146     * @param aSource	Source of context
       
   147     * @param aType		Type of context
       
   148     * @param aValue		Value of context
       
   149     * @return None
       
   150     */
       
   151     void PublishContextL( const TDesC& aSource, 
       
   152                           const TDesC& aType,
       
   153                           const TDesC& aValue );
       
   154     
       
   155 
       
   156     /**
       
   157     * @brief Subscribe a context.
       
   158     * @since S60 5.0
       
   159     * @param aSource	Source of context
       
   160     * @param aType		Type of context
       
   161     * @return
       
   162     */
       
   163     void SubscribeContextL( const TDesC& aSource, 
       
   164                           const TDesC& aType );
       
   165     
       
   166                           
       
   167     /**
       
   168     * @brief Unsubscribe all contexts
       
   169     * @since S60 5.0
       
   170     */
       
   171     void UnsubscribeContexts();
       
   172 
       
   173 
       
   174     /**
       
   175     * @brief Create a connection to Context Framework Server 
       
   176     * @since S60 5.0
       
   177     */
       
   178     void OpenCFClientL();
       
   179 
       
   180     /**
       
   181     * @brief Unsusbscribe all actions and close the CCFClient session.
       
   182     * @since S60 5.0
       
   183     */
       
   184     void CloseCFClient();
       
   185 
       
   186 public:
       
   187     /**
       
   188     * @brief Subscribe to actions and publish the new alarm status.
       
   189     * @since S60 5.0
       
   190     */
       
   191     void StartL(const TAlarmSourceStateValues aEvent);
       
   192 
       
   193     /**
       
   194     * @brief Publish 'alaram inactive' state and close the session
       
   195     * @since S60 5.0
       
   196     */
       
   197     void StopL();
       
   198 
       
   199     /**
       
   200     * 
       
   201     * @since S60 5.0
       
   202     */
       
   203     void PublishAlarmResultL(const TAlarmSourceResultValues aResult);
       
   204 
       
   205 private: // constructors
       
   206 
       
   207     /** 
       
   208     * hidden default contructor 
       
   209     */
       
   210     CAlarmContextFwSupport(CAlmAlarmControl* aAlarmControl);
       
   211 
       
   212     /** 
       
   213     * Symbian 2nd phase constructor 
       
   214     */
       
   215     void ConstructL();
       
   216 
       
   217 private: // data
       
   218 
       
   219     /**
       
   220     * Pointer to the Context Framework's client side API
       
   221     * Own.
       
   222     **/
       
   223     CCFClient* iCFClient;
       
   224 
       
   225     /** 
       
   226     * Array of subscribed actions.
       
   227     * Own.
       
   228     */
       
   229     RPointerArray<CCFActionSubscription> iSubscribedActions;
       
   230     
       
   231     /** 
       
   232     * Array of subscribed contexts.
       
   233     * Own.
       
   234     */
       
   235     RPointerArray<CCFContextSubscription> iSubscribedContexts;
       
   236 
       
   237     /**
       
   238     * Pointer to the alarm control.
       
   239     * Not own.
       
   240     */
       
   241     CAlmAlarmControl* iAlarmControl;
       
   242 
       
   243 };
       
   244 
       
   245 #endif // CALARMCONTEXTFWSUPPORT_H
       
   246 
       
   247 
       
   248 // End of File