PECengine/PluginServer2/SrvSrc/CPEngPlgSess.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Implementation of class CPEngPlgSess
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  Include Files
       
    20 #include <e32base.h>
       
    21 #include <e32svr.h>
       
    22 #include <s32mem.h>
       
    23 #include "CPEngPlgSess.h"
       
    24 #include "MPEngPlgSrv.h"
       
    25 #include "PEngPlgSrvCommon.h"
       
    26 
       
    27 // CONSTRUCTION
       
    28 // Static constructor
       
    29 CPEngPlgSess* CPEngPlgSess::NewL( MPEngPlgSrv& aServer )
       
    30     {
       
    31     CPEngPlgSess* self = new( ELeave ) CPEngPlgSess( aServer );
       
    32 
       
    33     return self;
       
    34     }
       
    35 
       
    36 // Destructor (virtual by CBase)
       
    37 CPEngPlgSess::~CPEngPlgSess()
       
    38     {
       
    39     }
       
    40 
       
    41 // Default constructor, protected
       
    42 CPEngPlgSess::CPEngPlgSess( MPEngPlgSrv& aServer )
       
    43         : iPlgServer( aServer )
       
    44     {
       
    45     }
       
    46 
       
    47 TBool CPEngPlgSess::DispatchMessageL( const RMessage2 &aMessage )
       
    48     {
       
    49     // by default, complete the message
       
    50     TBool completeMsg( ETrue );
       
    51 
       
    52     switch ( aMessage.Function() )
       
    53         {
       
    54         case EPEngPlgShutdownServer:
       
    55             {
       
    56             iPlgServer.SetStateL( EPEngPlgSvrStateUnknown );
       
    57             iPlgServer.StopServer();
       
    58             break;
       
    59             }
       
    60         case EPEngPlgSetStateOffline:
       
    61             {
       
    62             iPlgServer.SetStateL( EPEngPlgSvrStateOffline );
       
    63             break;
       
    64             }
       
    65         case EPEngPlgSetStateOnline:
       
    66             {
       
    67             iPlgServer.SetStateL( EPEngPlgSvrStateOnline );
       
    68             break;
       
    69             }
       
    70         case EPEngPlgPluginCount:
       
    71             {
       
    72             // complete the message here with the plugin count value
       
    73             aMessage.Complete( iPlgServer.PluginCount() );
       
    74             completeMsg = EFalse;
       
    75             break;
       
    76             }
       
    77         case EPEngPlgPluginUid:
       
    78             {
       
    79             // complete the message here with the plugin count value
       
    80             aMessage.Complete( iPlgServer.Plugin( aMessage.Int0() ) );
       
    81             completeMsg = EFalse;
       
    82             break;
       
    83             }
       
    84         default:
       
    85             {
       
    86             PanicClient( aMessage, EBadRequest );
       
    87             break;
       
    88             }
       
    89         }
       
    90 
       
    91     return completeMsg;
       
    92     }
       
    93 
       
    94 void CPEngPlgSess::PanicClient( const RMessage2& aMessage, const TInt aPanic ) const
       
    95     {
       
    96     aMessage.Panic( KSessionName, aPanic );
       
    97     }
       
    98 
       
    99 void CPEngPlgSess::ServiceL( const RMessage2 &aMessage )
       
   100     {
       
   101     if ( DispatchMessageL( aMessage ) )
       
   102         {
       
   103         aMessage.Complete( KErrNone );
       
   104         }
       
   105     }
       
   106 
       
   107 void CPEngPlgSess::ServiceError( const RMessage2& aMessage, TInt aError )
       
   108     {
       
   109     aMessage.Complete( aError );
       
   110     }
       
   111 
       
   112 
       
   113 // END OF FILE
       
   114 
       
   115