dbgagents/trkagent/dccdriver/TrkDccDriver.h
changeset 0 c6b0df440bee
equal deleted inserted replaced
-1:000000000000 0:c6b0df440bee
       
     1 /*
       
     2 * Copyright (c) 2006 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 __TRKDCCDRIVER_H__
       
    20 #define __TRKDCCDRIVER_H__
       
    21 
       
    22 // Debug messages
       
    23 #ifdef _DEBUG
       
    24 #define LOG_MSG(x) Kern::Printf(x)
       
    25 #define LOG_MSG2(x, y) Kern::Printf(x, y)
       
    26 #else
       
    27 #define LOG_MSG(x)
       
    28 #define LOG_MSG2(x, y)
       
    29 #endif
       
    30 
       
    31 
       
    32 //
       
    33 // Macros
       
    34 //
       
    35 #define MAXMESSAGESIZE	0x0880
       
    36 
       
    37 //
       
    38 // class DTrkDccDriverFactory
       
    39 //
       
    40 class DTrkDccDriverFactory : public DLogicalDevice
       
    41 {
       
    42 public:
       
    43 
       
    44 	DTrkDccDriverFactory();
       
    45 	virtual TInt Install();
       
    46 	virtual void GetCaps(TDes8& aDes) const;
       
    47 	virtual TInt Create(DLogicalChannelBase*& aChannel);
       
    48 };
       
    49 
       
    50 //
       
    51 // DTrkDccChannel
       
    52 //
       
    53 class DTrkDccChannel : public DLogicalChannel
       
    54 {
       
    55 public:
       
    56 
       
    57 	DTrkDccChannel(DLogicalDevice* aLogicalDevice);
       
    58 	~DTrkDccChannel();
       
    59 
       
    60 	virtual TInt DoCreate(TInt aUnit, const TDesC* anInfo, const TVersion& aVer);	
       
    61 	virtual void HandleMsg(TMessageBase* aMsg);
       
    62 	
       
    63 	
       
    64 protected:
       
    65 	virtual void DoCancel(TInt aReqNo);
       
    66 	virtual void DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2);
       
    67 	virtual TInt DoControl(TInt aFunction, TAny *a1, TAny *a2);
       
    68 	
       
    69 	
       
    70 private:
       
    71 	TInt DoWrite(TUint32 aLength, TAny* a2);
       
    72 	TInt DoRead();
       
    73 
       
    74 	TInt WriteDccChannel(const TDesC8& aDes);
       
    75 	void ReadDccChannel();
       
    76 
       
    77 	void DoCompleteRx();
       
    78 	
       
    79 	static void RxTimerDfc(TAny* aPtr);
       
    80 	static void RxTimerCallBack(TAny* aPtr);
       
    81 		
       
    82 private:
       
    83 	DThread* iClientThread;
       
    84 	
       
    85 	TRequestStatus* iRequestGetEventStatus;
       
    86 
       
    87 	NTimer iRxTimer;
       
    88 	
       
    89 	TBuf8<MAXMESSAGESIZE> iTxBuffer;
       
    90 	//TBuf8<MAXMESSAGESIZE*2> iRxBuffer;
       
    91 	TUint8 *iRxBuffer;
       
    92 	TInt iRxBufSize;
       
    93 	
       
    94 	TRequestStatus* iRxRequestStatus;
       
    95 	TAny* iRxClientBuffer;
       
    96 	TUint32 iRxClientBufferLength;
       
    97 	TInt iRxGetIndx, iRxPutIndx;
       
    98 	
       
    99 	TDfc iRxCompleteDfc;
       
   100 
       
   101 	TInt iInterruptId;
       
   102 	TInt iRxTimeOut;
       
   103 	TUint32 iPageSize;
       
   104 	
       
   105 	TBool iPacketStarted;
       
   106 	TBool iPacketEnded;
       
   107 	
       
   108 	/** Lock serialising calls to event handler */
       
   109 	DSemaphore* iLock;
       
   110 	
       
   111 	TDfcQue* iDFCQue;
       
   112 
       
   113 };
       
   114 
       
   115 #endif //__TRKDCCDRIVER_H__