tracesrv/tracecore/plugins/xti_if/common/inc/TraceCoreXtiIf.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 XTI IF. 
       
    15 
       
    16 
       
    17 #ifndef __TRACECOREXTIIF_H__
       
    18 #define __TRACECOREXTIIF_H__
       
    19 
       
    20 
       
    21 // Include files
       
    22 #include <kernel/kernel.h>
       
    23 #include <TraceCoreMediaPlugin.h>
       
    24 #include "TraceCoreMediaIf.h"
       
    25 
       
    26 /**
       
    27  * Interface class for XTI
       
    28  */
       
    29 NONSHARABLE_CLASS( DTraceCoreXtiIf ) : public DTraceCoreMediaPlugin
       
    30     {
       
    31 public:
       
    32 
       
    33     /**
       
    34      * Constructor
       
    35      */
       
    36     DTraceCoreXtiIf();
       
    37     
       
    38     /**
       
    39      * Destructor
       
    40      */
       
    41     ~DTraceCoreXtiIf();
       
    42     
       
    43     /**
       
    44      * Initializes this interface
       
    45      */
       
    46     TInt Init( );
       
    47         
       
    48 	 /**
       
    49 	  * Sends a message
       
    50 	  *
       
    51 	  * @param aMessage The message to be sent
       
    52 	  */
       
    53 	 TInt Send( TTraceMessage &aMessage );
       
    54     
       
    55     /**
       
    56      * Called by TraceCore to send a message out
       
    57      */
       
    58     virtual TInt SendMessage( TTraceMessage &aMsg );
       
    59     
       
    60 private:
       
    61 
       
    62     /**
       
    63      * Starts a timer which calls XtiRegister
       
    64      */
       
    65 	void StartTimer();
       
    66 	
       
    67 	/**
       
    68 	 * Timer callback function, register trace core to XTI driver
       
    69 	 */
       
    70     static void XtiRegister( TAny* aPtr );
       
    71     
       
    72     /**
       
    73      * Called from the static timer callback function to perform registration
       
    74      */
       
    75     void XtiRegister();
       
    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      * Add registering to own Dfc
       
    89      */
       
    90     static void XtiRegisterDfc( TAny* aPtr );
       
    91     
       
    92     /**
       
    93      * Forwards incoming message to callback
       
    94      */
       
    95     void NotifyCallback();
       
    96 
       
    97     /**
       
    98      * Sends message to XTI
       
    99      * 
       
   100      * @param aMsg Message to be sent.
       
   101      * @return KErrNone if send successful
       
   102      */
       
   103     void SendData( TTraceMessage& aMsg );
       
   104     
       
   105 private:
       
   106 
       
   107     /**
       
   108      * DFC which is used for incoming ISI-messages
       
   109      */
       
   110     TDfc iReceiveDfc;
       
   111     
       
   112     /**
       
   113      * DFC which is used to receive data from XTI driver
       
   114      */
       
   115     TDfc iXtiRegisterDfc;
       
   116     
       
   117     /**
       
   118      * Timer which is used for registration to XTI driver
       
   119      */
       
   120     TTickLink iXtiRegisterTimer;
       
   121     
       
   122     /**
       
   123      * ISA Kernel IF Initialisation status
       
   124      */
       
   125     TInt iStatus;
       
   126     
       
   127     /** 
       
   128      * Length variable for ISA Kernel interface usage
       
   129      */
       
   130     TUint16 iNeededLength;
       
   131  
       
   132      /**
       
   133      * Buffer for sending data
       
   134      **/
       
   135     TBuf8< 8204 > iSendBuffer;
       
   136        
       
   137     /**
       
   138      * Buffer for incoming data
       
   139      **/
       
   140     TBuf8< 8204 > iReceiveBuffer;
       
   141     };
       
   142 
       
   143 #endif // __TRACECOREXTIIF_H__
       
   144 
       
   145 // End of File