haitest/bspsvs/suite/bsp/mmc/ldd/src/mmclddmediachange.cpp
changeset 0 cec860690d41
equal deleted inserted replaced
-1:000000000000 0:cec860690d41
       
     1 /*
       
     2 * Copyright (c) 2005-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 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <kernel.h>
       
    20 #include <mmc.h>
       
    21 #include <locmedia.h>
       
    22 
       
    23 #include "mmcldd.h"
       
    24 #include "d_mmcsdif.h"
       
    25 
       
    26 /**
       
    27  * Do a kernel side control for DMMCMediChange
       
    28  *
       
    29  * @param TInt aFunction - Request Function ID
       
    30  * @param TAny* a1 - Given parameter
       
    31  * @param TAny* a2 - Given parameter
       
    32  *
       
    33  * @return TInt the error code
       
    34  *
       
    35  * @leave N/A
       
    36  */
       
    37 TInt DLddMmcCntrlInterface::MediaChangeDoControl(TInt aFunction, TAny* a1, TAny* a2)
       
    38 	{
       
    39 	MMCSDLOG("<--MediaChangeDoControl-->");
       
    40 	TInt r = KErrNone;
       
    41 	
       
    42 	if (!iSocket)
       
    43 		{
       
    44   		MMCSDLOG("DLddMmcCntrlInterface::MediaChangeDoControl - iSocket is NULL");		
       
    45 		return KErrGeneral;
       
    46 		}
       
    47 	else if (!iClient)
       
    48 		{
       
    49   		MMCSDLOG("DLddMmcCntrlInterface::MediaChangeDoControl - iClient is NULL");		
       
    50 		return KErrGeneral;
       
    51 		}
       
    52 
       
    53 	switch(TTCFunctionId(aFunction).FunctionId())
       
    54 		{
       
    55       	case RMMCSDTestControllerInterface::EMediaChange:
       
    56       		{
       
    57 			r = Kern::ThreadRawWrite(iClient, a1, &iMediaChange, sizeof(iMediaChange));
       
    58       		}
       
    59 	  		break;
       
    60 
       
    61 		case RMMCSDTestControllerInterface::EMediaStateInfo:
       
    62 	     	{
       
    63 			TMediaState doorState;
       
    64 			doorState = iMediaChange->MediaState();
       
    65 			MMCSDLOG2("EMediaStateInfo : %d",doorState);
       
    66 			r = Kern::ThreadRawWrite(iClient, a1, &doorState, sizeof(TMediaState));
       
    67 			break;
       
    68 	       	}
       
    69 		case RMMCSDTestControllerInterface::EForceMediaChange:
       
    70         	{
       
    71 			iMediaChange->ForceMediaChange();
       
    72 			MMCSDLOG("Force MediaChange");
       
    73         	break;
       
    74 			}
       
    75 		case RMMCSDTestControllerInterface::EMediaChangeCounter:
       
    76         	{
       
    77     		r = Kern::ThreadRawWrite(iClient, a1, &iMediaChange->iReplyCount, sizeof(iMediaChange->iReplyCount));
       
    78     		MMCSDLOG2("EMediaChangeCounter : %d",&iMediaChange->iReplyCount);
       
    79         	break;
       
    80 			}
       
    81 		default:
       
    82 			r = KErrNotFound;
       
    83 			break;
       
    84 
       
    85 		}
       
    86 	return(r);
       
    87 	}