kerneltest/e32test/usb/t_usb_device/src/transfersession.cpp
changeset 247 d8d70de2bd36
child 253 d37db4dcc88d
equal deleted inserted replaced
201:43365a9b78a3 247:d8d70de2bd36
       
     1 /*
       
     2 * Copyright (c) 1997-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:
       
    15 * Implements a Session of a Symbian OS server for the RUsb API
       
    16 *
       
    17 */
       
    18 
       
    19 /**
       
    20  @file
       
    21 */
       
    22 
       
    23 #define __E32TEST_EXTENSION__
       
    24 
       
    25 #include <e32test.h>
       
    26 #include <usb.h>
       
    27 #include "transfersession.h"
       
    28 #include "transferserver.h"
       
    29 #include "transfersrv.h"
       
    30 #include "tranhandlesrv.h"
       
    31 
       
    32 
       
    33 
       
    34 CTransferSession* CTransferSession::NewL(CTransferServer* aServer)
       
    35 	{
       
    36 	return (new (ELeave) CTransferSession(aServer));
       
    37 	}
       
    38 
       
    39 
       
    40 CTransferSession::CTransferSession(CTransferServer* aServer)
       
    41 	: iTransferServer(aServer)
       
    42 	{
       
    43 	iTransferServer->IncrementSessionCount();
       
    44 	}
       
    45 
       
    46 
       
    47 CTransferSession::~CTransferSession()
       
    48 	{
       
    49 	TUSB_PRINT("CTransferSession::~CTransferSession");
       
    50 	iTransferServer->DecrementSessionCount();
       
    51 	TUSB_PRINT("<<CTransferSession::~CTransferSession");
       
    52 	}
       
    53 
       
    54 
       
    55 void CTransferSession::ServiceL(const RMessage2& aMessage)
       
    56 	{
       
    57 	DispatchMessageL(aMessage);
       
    58 	}
       
    59 
       
    60 void CTransferSession::CreateL()
       
    61 	{
       
    62 	}
       
    63 
       
    64 void CTransferSession::DispatchMessageL(const RMessage2& aMessage)
       
    65 	{
       
    66 	TInt ret = KErrNone;
       
    67 	TName string;
       
    68 
       
    69 	switch (aMessage.Function())
       
    70 		{
       
    71 	case ESetConfigFileName:
       
    72 		ret = aMessage.Read(0, string);
       
    73 		if (ret != KErrNone)
       
    74 			break;
       
    75 		ret = iTransferServer->SetupLdds(string);
       
    76 		break;
       
    77 
       
    78 	default:
       
    79 		ret = KErrNotSupported;
       
    80 		break;
       
    81 		}
       
    82 
       
    83 	aMessage.Complete(ret);
       
    84 	}
       
    85