tracesrv/tracecore/btrace_handler/inc/TraceCoreOstLddIf.h
changeset 56 aa2539c91954
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
       
     1 // Copyright (c) 2007-2010 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 // Interface class for the TraceCoreOstLdd component. 
       
    15 // 
       
    16 
       
    17 #ifndef __TraceCoreOstLddIf_H__
       
    18 #define __TraceCoreOstLddIf_H__
       
    19 
       
    20 
       
    21 // Include files
       
    22 #include <kernel/kernel.h>
       
    23 #include "TraceCoreMediaIf.h"
       
    24 #include "TraceCoreOstConnectionIf.h"
       
    25 
       
    26 /**
       
    27  * ETraceCoreOstLddIfGetSet function to choosed in DTraceCoreOstLddI::GetSet.
       
    28  */
       
    29 enum TTraceCoreOstLddIfGetSet
       
    30     {
       
    31     EGetDfc = 0, // Return type TDfc*
       
    32     EGetBuf = 1,     // Return type TDes8*
       
    33     ESetWriter = 2,   // Return type 0
       
    34     ERegister  // Return type 0
       
    35     };
       
    36 
       
    37 /**
       
    38  * Interface class for XTI
       
    39  */
       
    40 class DTraceCoreOstLddIf : public DTraceCoreMediaIf
       
    41     {
       
    42 public:
       
    43 
       
    44     /**
       
    45      * Constructor
       
    46      */
       
    47     DTraceCoreOstLddIf();
       
    48     
       
    49     /**
       
    50      * Destructor
       
    51      */
       
    52     ~DTraceCoreOstLddIf();
       
    53     
       
    54     /**
       
    55      * Initializes this interface
       
    56      * 
       
    57      * @param aCallback Callback interface which is notified when a message is received from the XTI driver
       
    58      */
       
    59 	TInt Init( MTraceCoreMediaIfCallback& aCallback );
       
    60 	
       
    61 	/**
       
    62 	 * Sends a message
       
    63 	 *
       
    64 	 * @param aMessage The message to be sent
       
    65 	 */
       
    66 	TInt Send( TTraceMessage &aMessage );
       
    67 
       
    68 	/**
       
    69 	 * 
       
    70 	 * @param aFunc Function choosed (@see ETraceCoreOstLddIfGetSet)
       
    71 	 * @return TDfc* if aFunc is EGetDfc, TDes8* EGetBuf and 0 with ESetWriter.
       
    72 	 */
       
    73 	IMPORT_C static TUint32 GetSet(TTraceCoreOstLddIfGetSet aFunc, TUint32 aParam);
       
    74 	
       
    75 private:
       
    76     
       
    77     /**
       
    78      * DFC function for incoming data from XTI driver
       
    79      */
       
    80     static void ReceiveDfc( TAny* aPtr );
       
    81     
       
    82     /**
       
    83      * Called from the static DFC function to process incoming data
       
    84      */
       
    85     void ReceiveDfc();
       
    86     
       
    87     /**
       
    88      * Forwards incoming message to callback
       
    89      */
       
    90     void NotifyCallback();
       
    91 
       
    92     /**
       
    93      * Sends message to XTI
       
    94      * 
       
    95      * @param aMsg Message to be sent.
       
    96      * @return KErrNone if send successful
       
    97      */
       
    98     void SendData( TTraceMessage& aMsg );
       
    99    
       
   100     /**
       
   101     * Similar to send, except does not generate traces, since they would loop back to this function
       
   102     * 
       
   103     * @param aMsg Message to be sent.
       
   104     * @return KErrNone if send successful
       
   105     */
       
   106     TInt SendTrace( const TDesC8& aMsg );
       
   107     
       
   108 private:
       
   109 
       
   110     /**
       
   111      * DFC which is used for incoming ISI-messages
       
   112      */
       
   113     TDfc iReceiveDfc;
       
   114     
       
   115     /**
       
   116      * ISA Kernel IF Initialisation status
       
   117      */
       
   118     TInt iStatus;
       
   119     
       
   120     /** 
       
   121      * Length variable for ISA Kernel interface usage
       
   122      */
       
   123     TUint16 iNeededLength;
       
   124     
       
   125     TBool iTraceCoreOstConnectionRegistered;
       
   126     
       
   127      /**
       
   128      * Buffer for sending data
       
   129      **/
       
   130     TBuf8< 8204 > iSendBuffer;
       
   131        
       
   132     /**
       
   133      * Buffer for incoming data
       
   134      **/
       
   135     TBuf8< 8204 > iReceiveBuffer;
       
   136     
       
   137     /**
       
   138      * Pointer to TraceCoreOstConnectionIf
       
   139      **/
       
   140     MTraceCoreOstConnectionIf *iTraceCoreOstConnection;
       
   141     
       
   142     };
       
   143 
       
   144 #endif // __TraceCoreOstLddIf_H__
       
   145 
       
   146 // End of File