contextframework/cfw/inc/cfserver/CFMessageHandlerAction.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2006-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:  Base class for message handlers.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CFMESSAGEHANDLERACTION_H
       
    20 #define C_CFMESSAGEHANDLERACTION_H
       
    21 
       
    22 #include "CFMessageHandlerBase.h"
       
    23 #include "CFActionSubscriptionListener.h"
       
    24 #include "cfactionowner.h"
       
    25 
       
    26 class CCFActionIndication;
       
    27 
       
    28 /**
       
    29  * Action messages related handler class.
       
    30  */
       
    31 NONSHARABLE_CLASS( CCFMessageHandlerAction ): public CCFMessageHandlerBase,
       
    32 public MCFActionSubscriptionListener,
       
    33 public MCFActionOwner
       
    34     {
       
    35 public:
       
    36 
       
    37     // Two phased constructors
       
    38     static CCFMessageHandlerAction* NewL( MCFExtendedContextInterface& aCF,
       
    39         MCFActionInterface& aActivatorEngine,
       
    40         MCFScriptInterface& aScriptInterface );
       
    41     static CCFMessageHandlerAction* NewLC( MCFExtendedContextInterface& aCF,
       
    42         MCFActionInterface& aActivatorEngine,
       
    43         MCFScriptInterface& aScriptInterface );
       
    44 
       
    45     // Destructor
       
    46     ~CCFMessageHandlerAction();
       
    47 
       
    48 protected: // From base classes
       
    49 
       
    50     // From CCFMessageHandlerBase
       
    51     TBool HandleMessageL( const RMessage2& aMessage );
       
    52 
       
    53     // From MCFContextSubscriptionListener
       
    54     void ActionIndicationL( CCFActionIndication* aIndication );
       
    55     
       
    56     // From MCFActionOwner
       
    57     TCFActionOwner ActionOwner() const;
       
    58 
       
    59 private: // New methods
       
    60 
       
    61     // Checks if there is action indication waiting
       
    62     void CheckActionQueueL();
       
    63 
       
    64     // Stream and send action indication to client
       
    65     void IndicateCurrentActionL();
       
    66 
       
    67     // Streams indication from object to descriptor
       
    68     HBufC8* ExternalizeIndicationLC( CCFActionIndication& aIndication );
       
    69 
       
    70 private:
       
    71 
       
    72     CCFMessageHandlerAction( MCFExtendedContextInterface& aCFContext,
       
    73         MCFActionInterface& aCFAction,
       
    74         MCFScriptInterface& aScriptInterface );
       
    75     void ConstructL();
       
    76 
       
    77 private:
       
    78 
       
    79     // Own: Subscription message
       
    80     RMessage2 iSubscriptionListenMessage;
       
    81 
       
    82     // Own: Action indications array
       
    83     RPointerArray<CCFActionIndication> iActionQueue;
       
    84 
       
    85     // Own: Current action indciation
       
    86     CCFActionIndication* iCurrentAction;
       
    87     };
       
    88 
       
    89 #endif//C_CFMESSAGEHANDLERACTION_H
       
    90