kerneltest/f32test/shostmassstorage/msman/server/cusbhostsession.cpp
changeset 0 a41df078684a
child 297 b2826f67641f
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Implements a Session of a Symbian OS server for the RUsbMassStorage API
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalTechnology
       
    23 */
       
    24 
       
    25 #include <e32cmn.h>
       
    26 #include <e32base.h>
       
    27 
       
    28 #include "tmslog.h"
       
    29 #include "msmanclientserver.h"
       
    30 
       
    31 #include <f32file.h>
       
    32 #include <d32usbdi_hubdriver.h>
       
    33 #include <d32otgdi.h>
       
    34 #include "usbtypes.h"
       
    35 
       
    36 #include "cusbhostao.h"
       
    37 #include "cusbhost.h"
       
    38 
       
    39 
       
    40 #include "cusbhostserver.h"
       
    41 #include "cusbhostsession.h"
       
    42 
       
    43 
       
    44 CUsbHostSession* CUsbHostSession::NewL()
       
    45 	{
       
    46     __MSFNSLOG
       
    47 	CUsbHostSession* r = new (ELeave) CUsbHostSession();
       
    48 	CleanupStack::PushL(r);
       
    49 	r->ConstructL();
       
    50 	CleanupStack::Pop();
       
    51 	return r;
       
    52 	}
       
    53 
       
    54 
       
    55 CUsbHostSession::CUsbHostSession()
       
    56 	{
       
    57     __MSFNSLOG
       
    58 
       
    59 	}
       
    60 
       
    61 void CUsbHostSession::ConstructL()
       
    62 	{
       
    63     __MSFNSLOG
       
    64  	}
       
    65 
       
    66 
       
    67 void CUsbHostSession::CreateL()
       
    68 	{
       
    69     __MSFNSLOG
       
    70     Server().AddSession();
       
    71 	}
       
    72 
       
    73 
       
    74 CUsbHostSession::~CUsbHostSession()
       
    75 	{
       
    76     __MSFNSLOG
       
    77     Server().RemoveSession();
       
    78 	}
       
    79 
       
    80 
       
    81 void CUsbHostSession::ServiceL(const RMessage2& aMessage)
       
    82 	{
       
    83     __MSFNSLOG
       
    84 	DispatchMessageL(aMessage);
       
    85 	}
       
    86 
       
    87 
       
    88 void CUsbHostSession::DispatchMessageL(const RMessage2& aMessage)
       
    89 	{
       
    90     __MSFNSLOG
       
    91 	TInt ret = KErrNone;
       
    92 
       
    93 	switch (aMessage.Function())
       
    94 		{
       
    95 	case EUsbHostStart:
       
    96 		ret = Start(aMessage);
       
    97 		break;
       
    98 	default:
       
    99 		aMessage.Panic(KUsbHostClientPncCat, EUsbHostPanicIllegalIPC);
       
   100 		break;
       
   101 		}
       
   102 
       
   103 	aMessage.Complete(ret);
       
   104 	}
       
   105 
       
   106 
       
   107 TInt CUsbHostSession::Start(const RMessage2& aMessage)
       
   108 	{
       
   109     __MSFNSLOG
       
   110     Server().iUsbHost->Start();
       
   111 	return KErrNone;
       
   112 	}