bluetooth/btstack/l2cap/L2CapSDU.h
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef L2CAPSDU_H_
       
    17 #define L2CAPSDU_H_
       
    18 
       
    19 #include <e32def.h>
       
    20 #include <e32base.h>
       
    21 #include <es_mbuf.h>
       
    22 
       
    23 #include "L2CapPDU.h"
       
    24 
       
    25 class CL2CapSDU;
       
    26 class ML2CapSDUHandler
       
    27 	{
       
    28 public:
       
    29 	virtual void ProcessFlushTimerExpiry(CL2CapSDU& aL2CapSDU) = 0;
       
    30 	};
       
    31 
       
    32 
       
    33 
       
    34 NONSHARABLE_CLASS(CL2CapSDU) : public CBase
       
    35 	{
       
    36 public:		
       
    37 	// MBuf based descriptor creation.
       
    38 	static CL2CapSDU* NewLC(RMBufChain& aSDUData,
       
    39                             ML2CapSDUHandler& aParent,
       
    40 			                TUint16 aPDUSize,
       
    41                             TBool aIsBasicDataVersion = ETrue,
       
    42 			                TUint16 aTimerDuration = KInfiniteFlush);
       
    43 	static CL2CapSDU* NewL(RMBufChain& aSDUData,
       
    44 		                   ML2CapSDUHandler& aParent,
       
    45 			               TUint16 aPDUSize,
       
    46 		                   TBool aIsBasicDataVersion = ETrue,
       
    47 			               TUint16 aTimerDuration = KInfiniteFlush);
       
    48 
       
    49 	static TInt FlushTimerExpired(TAny* aL2CapSDU);
       
    50 	
       
    51 	
       
    52 	virtual ~CL2CapSDU();
       
    53 
       
    54 	static TInt GetSDUOverhead(TBool aBasicMode);
       
    55 
       
    56 	TBool GetPDU(HL2CapPDU*& aReturnedPDU);
       
    57 	
       
    58 	TBool IsSDUEmpty() const;
       
    59 	TBool CurrentPDUIsFirstPDU();
       
    60 
       
    61 	void StartFlushTimer(TUint16 aTimerDuration);
       
    62 	
       
    63 	TInt ChangeSDUSegmentation(TBool aIsBasicDataVersion, TUint16 aPDUSize);
       
    64 #ifdef _DEBUG
       
    65 	TInt DebugManualFlush();
       
    66 #endif
       
    67 
       
    68 		
       
    69 private:
       
    70 	CL2CapSDU(ML2CapSDUHandler& aParent, RMBufChain& aDataFrame, TUint16 aReassembledSDULength);
       
    71 	CL2CapSDU(ML2CapSDUHandler& aParent);
       
    72 
       
    73 	void ConstructL(RMBufChain& aSDUData, TBool aIsBasicDataVersion, TUint16 aTimerDuration, TUint16 aPDUSize); 
       
    74 	TInt SegmentSDUIntoPDUs(RMBufChain& aSDUData, TBool aIsBasicDataVersion, TUint16 aPDUSize);
       
    75 	void HandleFlushTimerExpired();
       
    76 
       
    77 public:
       
    78 	TDblQueLink iLink;
       
    79 	
       
    80 private:
       
    81 	ML2CapSDUHandler& iParent;
       
    82 
       
    83 	TDblQue<HL2CapPDU> iPDUs;
       
    84 	TDblQueIter<HL2CapPDU> iCurrentPDU;
       
    85 
       
    86 	TDeltaTimerEntry iFlushTimerEntry;
       
    87 	TBool iFlushTimerRunning;
       
    88 	
       
    89 	RMBufChain iIncomingSDU;
       
    90 	};
       
    91 
       
    92 
       
    93 #endif