bluetooth/btstack/l2cap/L2CapDebugControlInterface.h
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2003-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 L2CAP_DEBUG_CONTROL_INTERFACE_H_
       
    17 #define L2CAP_DEBUG_CONTROL_INTERFACE_H_
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <e32property.h>
       
    21 #include <bluetooth/l2capdebuginfo.h>
       
    22 
       
    23 using namespace L2capDebugInfo;
       
    24 
       
    25 #ifdef _DEBUG
       
    26 	#include "debug.h"
       
    27 	#define L2CAP_DEBUG(x) (static_cast<SBtTls*>(Dll::Tls()))->iDebugCtrlIF->x
       
    28 	//PDU tracking allocates memory on each PDU event an only free them on stack unload.
       
    29 	//Therefore it is by default macroed out to prevent udeb performance degradation.
       
    30 	#ifdef TRACK_L2CAP_PDU
       
    31 		#define L2CAP_DEBUG_PDU(x) L2CAP_DEBUG(x)
       
    32 	#else
       
    33 		#define L2CAP_DEBUG_PDU(x)
       
    34 	#endif
       
    35 #else
       
    36 	#define L2CAP_DEBUG(x)
       
    37 	#define L2CAP_DEBUG_PDU(x)
       
    38 #endif
       
    39 
       
    40 
       
    41 
       
    42 NONSHARABLE_CLASS(TPDUTimerRecord)
       
    43 	{
       
    44 public:
       
    45 	enum TPDUTimerType
       
    46 		{
       
    47 		EPDUBFrameTimer,
       
    48 		EPDUIFrameTimer,
       
    49 		EPDUUnsegmentedFrameTimer,
       
    50 		};
       
    51 		
       
    52 	TPDUTimerRecord(TAny* aUID, TUint16 aGroupID, TPDUTimerType aTimerType);
       
    53 
       
    54 	// Inlines
       
    55 	inline TAny* GetUID() const;
       
    56 	inline TUint16 GetGroupID() const;
       
    57 
       
    58 	inline const TTimeIntervalMicroSeconds& GetPDUTI() const;
       
    59 	inline const TTimeIntervalMicroSeconds& SentPDUTI() const;
       
    60 		
       
    61 	void MarkGetPDUCalled();
       
    62 	void MarkPDUSent();
       
    63 	
       
    64 private:
       
    65 	TTime iTime;
       
    66 	TAny* iUID;
       
    67 	TUint16 iGroupID;
       
    68 	TPDUTimerType iTimerType;
       
    69 	
       
    70 	TTimeIntervalMicroSeconds iGetPDUTI;
       
    71 	TTimeIntervalMicroSeconds iSentPDUTI;
       
    72 	};
       
    73 
       
    74 inline TAny* TPDUTimerRecord::GetUID() const	
       
    75 	{
       
    76 	return iUID;
       
    77 	}
       
    78 	
       
    79 inline TUint16 TPDUTimerRecord::GetGroupID() const	
       
    80 	{
       
    81 	return iGroupID;
       
    82 	}
       
    83 
       
    84 inline const TTimeIntervalMicroSeconds& TPDUTimerRecord::GetPDUTI() const
       
    85 	{
       
    86 	return iGetPDUTI;	
       
    87 	}
       
    88 	
       
    89 inline const TTimeIntervalMicroSeconds& TPDUTimerRecord::SentPDUTI() const
       
    90 	{
       
    91 	return iSentPDUTI;	
       
    92 	}
       
    93 
       
    94 
       
    95 NONSHARABLE_CLASS(TPDUGroupTimerRecord)
       
    96 	{
       
    97 public:
       
    98 	TPDUGroupTimerRecord(TUint16 aGroupID, RProperty& aProperty);
       
    99 
       
   100 	void UpdateGroup(const TTimeIntervalMicroSeconds& aGetPDUTime,
       
   101 					 const TTimeIntervalMicroSeconds& aSentPDUTime);
       
   102 	
       
   103 	inline TUint16 GetGroupID() const;				 	
       
   104 
       
   105 private:
       
   106 	TInt iMinGetPDU;
       
   107 	TInt iMinSentPDU;
       
   108 	TInt iMaxGetPDU;
       
   109 	TInt iMaxSentPDU;
       
   110 	TInt iAveGetPDU;
       
   111 	TInt iAveSentPDU;
       
   112 	TUint16 iSampleSize;
       
   113 	
       
   114 	TUint16 iGroupID;
       
   115 	RProperty& iProperty;
       
   116 	};
       
   117 	
       
   118 inline TUint16 TPDUGroupTimerRecord::GetGroupID() const	
       
   119 	{
       
   120 	return iGroupID;
       
   121 	}
       
   122 	
       
   123 
       
   124 
       
   125 	
       
   126 	
       
   127 NONSHARABLE_CLASS(CDebugControlInterface)
       
   128 	{
       
   129 public:
       
   130 	static CDebugControlInterface* NewL();
       
   131 	virtual ~CDebugControlInterface();
       
   132 
       
   133 	// Debug Interface.
       
   134 	void ObjectAllocation(TObjectType aObjectType, TAllocationType aAllocType);
       
   135 	void PDUTimer(TPDUTimerEvent aEvent, TAny* aUID, TUint16 aGrpID = 0);
       
   136 	void UpdateFlushCounters(TFlushCountersEvent aEvent);
       
   137 
       
   138 
       
   139 	static TBool UIDLinkMatch(const TPDUTimerRecord& aA, 
       
   140                               const TPDUTimerRecord& aB);
       
   141 
       
   142 	static TBool GroupLinkMatch(const TPDUGroupTimerRecord& aA, 
       
   143                                 const TPDUGroupTimerRecord& aB);
       
   144 	 
       
   145 private:
       
   146 	CDebugControlInterface();
       
   147 	void DefinePublications();
       
   148 	void DeletePublications();
       
   149 	
       
   150 private:
       
   151 	TUint16 iAllocations[EMaxType][EMaxAllocationType];
       
   152 
       
   153 	RPointerArray<TPDUTimerRecord> iPDUTimerRecords;
       
   154 	RPointerArray<TPDUGroupTimerRecord> iPDUGroupTimerRecords;
       
   155 
       
   156 	TUint16 iSDUFlushQueuedSDUFlushed;
       
   157 	TUint16 iSDUFlushPartialSentSDUFlushed;
       
   158 	TUint16 iSDUFlushSentSDUFlushed;
       
   159 	TUint16 iFlushedPDUMuxerResend;
       
   160 	TUint16 iFlushedPDUDataFlowResend;
       
   161 	TUint16 iFlushedPDUIFrame;
       
   162 	TUint16 iIncompleteErroredSDUReceived;
       
   163 	
       
   164 	RProperty iProperty;
       
   165 	};
       
   166 	
       
   167 #endif