sl@0: /* sl@0: * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include "mmcldd.h" sl@0: #include "d_mmcsdif.h" sl@0: sl@0: /** sl@0: * Do a kernel side control for DMMCMediChange sl@0: * sl@0: * @param TInt aFunction - Request Function ID sl@0: * @param TAny* a1 - Given parameter sl@0: * @param TAny* a2 - Given parameter sl@0: * sl@0: * @return TInt the error code sl@0: * sl@0: * @leave N/A sl@0: */ sl@0: TInt DLddMmcCntrlInterface::MediaChangeDoControl(TInt aFunction, TAny* a1, TAny* a2) sl@0: { sl@0: MMCSDLOG("<--MediaChangeDoControl-->"); sl@0: TInt r = KErrNone; sl@0: sl@0: if (!iSocket) sl@0: { sl@0: MMCSDLOG("DLddMmcCntrlInterface::MediaChangeDoControl - iSocket is NULL"); sl@0: return KErrGeneral; sl@0: } sl@0: else if (!iClient) sl@0: { sl@0: MMCSDLOG("DLddMmcCntrlInterface::MediaChangeDoControl - iClient is NULL"); sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: switch(TTCFunctionId(aFunction).FunctionId()) sl@0: { sl@0: case RMMCSDTestControllerInterface::EMediaChange: sl@0: { sl@0: r = Kern::ThreadRawWrite(iClient, a1, &iMediaChange, sizeof(iMediaChange)); sl@0: } sl@0: break; sl@0: sl@0: case RMMCSDTestControllerInterface::EMediaStateInfo: sl@0: { sl@0: TMediaState doorState; sl@0: doorState = iMediaChange->MediaState(); sl@0: MMCSDLOG2("EMediaStateInfo : %d",doorState); sl@0: r = Kern::ThreadRawWrite(iClient, a1, &doorState, sizeof(TMediaState)); sl@0: break; sl@0: } sl@0: case RMMCSDTestControllerInterface::EForceMediaChange: sl@0: { sl@0: iMediaChange->ForceMediaChange(); sl@0: MMCSDLOG("Force MediaChange"); sl@0: break; sl@0: } sl@0: case RMMCSDTestControllerInterface::EMediaChangeCounter: sl@0: { sl@0: r = Kern::ThreadRawWrite(iClient, a1, &iMediaChange->iReplyCount, sizeof(iMediaChange->iReplyCount)); sl@0: MMCSDLOG2("EMediaChangeCounter : %d",&iMediaChange->iReplyCount); sl@0: break; sl@0: } sl@0: default: sl@0: r = KErrNotFound; sl@0: break; sl@0: sl@0: } sl@0: return(r); sl@0: }