hti/HtiCommPlugins/HtiIPCommPlugin/src/HtiIPCommserverSession.cpp
changeset 36 813b186005b6
parent 30 86a2e675b80a
child 41 838cdffd57ce
equal deleted inserted replaced
30:86a2e675b80a 36:813b186005b6
     1 /*
       
     2 * Copyright (c) 2009 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 CHtiIPCommServerSession class. This class
       
    15 *                represents the client session in server.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "HtiIPCommServerCommon.h"
       
    23 #include "HtiIPCommServerSession.h"
       
    24 #include "HtiIPCommLogging.h"
       
    25 
       
    26 CHtiIPCommServerSession::CHtiIPCommServerSession( CHtiIPCommServer* aServer )
       
    27     :iServer( aServer )
       
    28     {
       
    29     HTI_LOG_TEXT( "CHtiIPCommServerSession::CHtiIPCommServerSession");
       
    30     iServer->SessionOpened();
       
    31     }
       
    32 
       
    33 CHtiIPCommServerSession::~CHtiIPCommServerSession()
       
    34     {
       
    35     HTI_LOG_TEXT( "CHtiIPCommServerSession::~CHtiIPCommServerSession");
       
    36     if ( iServer )
       
    37         {
       
    38         iServer->SessionClosed();
       
    39         }
       
    40     }
       
    41 
       
    42 void CHtiIPCommServerSession::ServiceL( const RMessage2& aMessage )
       
    43     {
       
    44     switch ( aMessage.Function() )
       
    45         {
       
    46         case EIPCommServerRecv:
       
    47             HandleReceiveRequestL( aMessage );
       
    48             break;
       
    49 
       
    50         case EIPCommServerSend:
       
    51             HandleSendRequestL( aMessage );
       
    52             break;
       
    53 
       
    54         case EIPCommServerCancelRecv:
       
    55             HandleCancelReceiveRequestL( aMessage );
       
    56             break;
       
    57 
       
    58         case EIPCommServerCancelSend:
       
    59             HandleCancelSendRequestL( aMessage );
       
    60             break;
       
    61 
       
    62         default:
       
    63             aMessage.Panic( _L("IPCommServer"), KErrNotFound );
       
    64             break;
       
    65         }
       
    66     }
       
    67 
       
    68 void CHtiIPCommServerSession::HandleReceiveRequestL( const RMessage2& aMessage )
       
    69     {
       
    70     iServer->iConnectionManager->Receive( aMessage );
       
    71     }
       
    72 
       
    73 void CHtiIPCommServerSession::HandleSendRequestL( const RMessage2& aMessage )
       
    74     {
       
    75     iServer->iConnectionManager->Send( aMessage );
       
    76     }
       
    77 
       
    78 void CHtiIPCommServerSession::HandleCancelReceiveRequestL( const RMessage2& aMessage )
       
    79     {
       
    80     iServer->iConnectionManager->CancelReceive();
       
    81     aMessage.Complete( KErrNone );
       
    82     }
       
    83 
       
    84 void CHtiIPCommServerSession::HandleCancelSendRequestL( const RMessage2& aMessage )
       
    85     {
       
    86     iServer->iConnectionManager->CancelSend();
       
    87     aMessage.Complete( KErrNone );
       
    88     }