os/boardsupport/haitest/bspsvs/suite/bsp/mmc/ldd/inc/LddAsyncRequest.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 #ifndef LDDASYNCREQUEST_H_
    20 #define LDDASYNCREQUEST_H_
    21 
    22 #include <mmc.h>
    23 
    24 
    25 class DLddAsyncRequest ;
    26 
    27 /**
    28  * DLddAsyncRequest observer interface
    29  *
    30  */
    31 class MAsyncRequestObserver
    32 	{
    33 public:
    34 	virtual void Notify(DLddAsyncRequest& aRequest) = 0; 
    35 	};
    36 
    37 /**
    38  * Wraps a TRequestStatus along with a function (command) id
    39  *
    40  */
    41 class DLddAsyncRequest 
    42 	{
    43 public:
    44 	DLddAsyncRequest(TInt aFunctionId, TRequestStatus* aStatus, MAsyncRequestObserver& aObserver);
    45 	virtual ~DLddAsyncRequest();
    46 	TRequestStatus* Status();
    47 	TInt Error();
    48 	TInt FunctionId();
    49 	
    50 protected:
    51 	TInt iFunctionId;	
    52 	TRequestStatus* iStatus;	
    53 	MAsyncRequestObserver& iObserver;
    54 	
    55 	TInt iError;
    56 	};
    57 
    58 /**
    59  * Extends DLddAsyncRequest to add DMMCSession async functionality
    60  *
    61  */
    62 class DMmcSessionAsyncRequest : public DLddAsyncRequest 
    63 	{
    64 public:	
    65 	DMmcSessionAsyncRequest(TInt aFunctionId, TRequestStatus* aStatus, 
    66 			MAsyncRequestObserver& aObserver, TDynamicDfcQue* aDfcQ, DMMCStack& aStack, TMMCard& aCard);
    67 	~DMmcSessionAsyncRequest();
    68 	DMMCSession& Session();	
    69 public:
    70 	static void SessionEndCallBack(TAny *aPtr);
    71     static void SessionEndDfc(TAny *aPtr);
    72 	void Reset();
    73 
    74 private:
    75 	DMMCSession* iSession;
    76     TMMCCallBack iSessionEndCallBack;
    77 	TDfc iSessionEndDfc;
    78 	
    79 public:
    80 	TAny* iClientDesPtr;
    81 	TUint32 iBlkOffet;
    82 	TUint8* iBuf;
    83 
    84 private:
    85 	void SessionEndCallBack();
    86 	void SessionEndDfc();
    87 	};
    88 
    89 
    90 /**
    91  * Extends DLddAsyncRequest to add TPBusCallBack (DMMCSocket) async functionality
    92  * used to handle callbacks for Bus events
    93  *
    94  */
    95 class DBusEventRequest : public DMmcSessionAsyncRequest
    96 	{
    97 public:
    98 	DBusEventRequest(TInt aFunctionId, TRequestStatus* aStatus, MAsyncRequestObserver& aObserver, TInt aUnit,
    99 						TDynamicDfcQue* aDfcQ, DMMCStack& aStack, TMMCard& aCard);
   100 	~DBusEventRequest();
   101 	
   102 	TPBusState BusState() const { return (TPBusState) iBusState; }
   103 	TInt BusError() const { return iBusError; }
   104 public:
   105 	static void BusEventCallBack(TAny* aPtr, TInt aReason, TAny* a1, TAny* a2);
   106 private:
   107 	TPBusCallBack	iBusEventCallBack;
   108 private:
   109 	void BusEventCallBack(TInt aReason, TAny* a1, TAny* a2);
   110 	TPBusState iBusState;
   111 	TInt iBusError;	
   112 	};
   113 
   114 #endif /*LDDASYNCREQUEST_H_*/