contextframework/cfw/inc/cfserver/CFMessageHandlerScript.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2006-2006 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_CFMESSAGEHANDLERSCRIPT_H
       
    20 #define C_CFMESSAGEHANDLERSCRIPT_H
       
    21 
       
    22 #include <f32file.h>
       
    23 
       
    24 #include "CFMessageHandlerBase.h"
       
    25 #include "CFActionSubscriptionListener.h"
       
    26 #include "cfscriptowner.h"
       
    27 
       
    28 class CCFActionIndication;
       
    29 
       
    30 /**
       
    31  * Action messages related handler class.
       
    32  */
       
    33 NONSHARABLE_CLASS( CCFMessageHandlerScript ):
       
    34 public CCFMessageHandlerBase,
       
    35 public MCFScriptOwner
       
    36     {
       
    37 public:
       
    38 
       
    39     // Two phased constructors
       
    40     static CCFMessageHandlerScript* NewL( MCFExtendedContextInterface& aCF,
       
    41         MCFActionInterface& aActivatorEngine,
       
    42         MCFScriptInterface& aScriptInterface );
       
    43     static CCFMessageHandlerScript* NewLC( MCFExtendedContextInterface& aCF,
       
    44         MCFActionInterface& aActivatorEngine,
       
    45         MCFScriptInterface& aScriptInterface );
       
    46 
       
    47     // Destructor
       
    48     ~CCFMessageHandlerScript();
       
    49 
       
    50 protected: // From base classes
       
    51 
       
    52     // From CCFMessageHandlerBase
       
    53     TBool HandleMessageL( const RMessage2& aMessage );
       
    54     
       
    55     // From MCFScriptOwner
       
    56     void HandleScriptsRemoved( const RArray<TInt>& aScriptIds );
       
    57 
       
    58 private:
       
    59 
       
    60     // C++ constructor
       
    61     CCFMessageHandlerScript( MCFExtendedContextInterface& aCFContext,
       
    62         MCFActionInterface& aCFAction,
       
    63         MCFScriptInterface& aScriptInterface );
       
    64     
       
    65     // 2nd phase constructor
       
    66     void ConstructL();
       
    67 
       
    68     // Loads a script from a file
       
    69     HBufC8* LoadScriptFromFile( RFile& aFile );
       
    70     
       
    71     // Registers a new script
       
    72     TInt RegisterScript( const RThread& aClient, const TDesC& aName,
       
    73         const TDesC8& aScript, TInt& aScriptId );
       
    74     
       
    75     // Updates an existing script from the client
       
    76     TInt UpgradeScript( const TDesC& aName, const TDesC8& aScript );
       
    77     
       
    78     // Check if there are new removed scripts which needs to be notified
       
    79     void NotifyRemovedScriptsL( const RMessage2& aMessage );
       
    80     
       
    81 private: // Data
       
    82 
       
    83     /** Script message from client */
       
    84     RMessage2 iMessage;
       
    85 
       
    86     /** Array containing removed script ids */
       
    87     RArray<TInt> iScriptIds;
       
    88     };
       
    89 
       
    90 #endif //C_CFMESSAGEHANDLERSCRIPT_H
       
    91