author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
permissions | -rw-r--r-- |
williamr@4 | 1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
williamr@4 | 2 |
// All rights reserved. |
williamr@4 | 3 |
// This component and the accompanying materials are made available |
williamr@4 | 4 |
// under the terms of "Eclipse Public License v1.0" |
williamr@4 | 5 |
// which accompanies this distribution, and is available |
williamr@4 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@4 | 7 |
// |
williamr@4 | 8 |
// Initial Contributors: |
williamr@4 | 9 |
// Nokia Corporation - initial contribution. |
williamr@4 | 10 |
// |
williamr@4 | 11 |
// Contributors: |
williamr@4 | 12 |
// |
williamr@4 | 13 |
// Description: |
williamr@4 | 14 |
// ULogger output plug-in interface |
williamr@4 | 15 |
// |
williamr@4 | 16 |
// |
williamr@4 | 17 |
|
williamr@4 | 18 |
/** |
williamr@4 | 19 |
@file |
williamr@4 | 20 |
@publishedPartner |
williamr@4 | 21 |
@prototype |
williamr@4 | 22 |
*/ |
williamr@4 | 23 |
|
williamr@4 | 24 |
#ifndef ULOGGEROUTPUTPLUGIN_H |
williamr@4 | 25 |
#define ULOGGEROUTPUTPLUGIN_H |
williamr@4 | 26 |
|
williamr@4 | 27 |
#include <e32base.h> |
williamr@4 | 28 |
#include "uloggerplugin.h" |
williamr@4 | 29 |
#include "uloggerdatatypes.h" |
williamr@4 | 30 |
|
williamr@4 | 31 |
namespace Ulogger |
williamr@4 | 32 |
{ |
williamr@4 | 33 |
|
williamr@4 | 34 |
//! Abstract class for ULogger output plug-ins. |
williamr@4 | 35 |
/*! |
williamr@4 | 36 |
A ULogger output plug-in is responsible for writing Trace log data to some |
williamr@4 | 37 |
output medium. Examples for output media are files, serial ports or TCP sockets. |
williamr@4 | 38 |
Whenever ULogger needs to output Trace log data, it passes this to the currently |
williamr@4 | 39 |
selected output plug-in, which then handles the actual writing to an output |
williamr@4 | 40 |
medium. |
williamr@4 | 41 |
|
williamr@4 | 42 |
All output plug-ins must derive from this class in order to be compatible with |
williamr@4 | 43 |
ULogger. They must also derive from ULogger::CPlugin (whose header is already |
williamr@4 | 44 |
included by this header, for convenience) in order to be compatible with the |
williamr@4 | 45 |
ECom framework, which ULogger uses to load its output plug-ins. |
williamr@4 | 46 |
*/ |
williamr@4 | 47 |
class MOutputPlugin |
williamr@4 | 48 |
{ |
williamr@4 | 49 |
public: |
williamr@4 | 50 |
/** |
williamr@4 | 51 |
Writes the given data to the output media that is represented by the |
williamr@4 | 52 |
plug-in implementation. This method is called by ULogger whenever Trace log |
williamr@4 | 53 |
data becomes available. How much data is passed to this function depends |
williamr@4 | 54 |
on how ULogger is configured; the length of the given descriptor |
williamr@4 | 55 |
indicates the size of the data packet. The intervals at which |
williamr@4 | 56 |
this method is called depends on the amount of Trace data that is logged |
williamr@4 | 57 |
from code in the currently running processes. |
williamr@4 | 58 |
|
williamr@4 | 59 |
@param aData the Trace data to output, in BTrace format |
williamr@4 | 60 |
@return KErrNone, if successful; otherwise one of the other system wide |
williamr@4 | 61 |
error codes. |
williamr@4 | 62 |
*/ |
williamr@4 | 63 |
virtual TInt Write(const TDesC8& aData) = 0; |
williamr@4 | 64 |
|
williamr@4 | 65 |
/** |
williamr@4 | 66 |
Called by ULogger as first method after construction or after changes in |
williamr@4 | 67 |
config file. This allows the output plug-in to initialize itself with its |
williamr@4 | 68 |
private settings. |
williamr@4 | 69 |
|
williamr@4 | 70 |
@param aConfigs actual configurations valid for this instance |
williamr@4 | 71 |
@return KErrNone, if successful; otherwise one of the other system wide |
williamr@4 | 72 |
error codes. |
williamr@4 | 73 |
*/ |
williamr@4 | 74 |
virtual TInt ConfigureOutputPlugin(const RPointerArray<TPluginConfiguration>& aConfigs) = 0; |
williamr@4 | 75 |
|
williamr@4 | 76 |
/** |
williamr@4 | 77 |
Called by ULogger to indicate that the output plug-in must flush all buffers |
williamr@4 | 78 |
and release any locked resources. Any resources may be locked only after any |
williamr@4 | 79 |
other method is called. |
williamr@4 | 80 |
*/ |
williamr@4 | 81 |
virtual void CloseOutputPlugin() = 0; |
williamr@4 | 82 |
|
williamr@4 | 83 |
/** Virtual destructor. */ |
williamr@4 | 84 |
virtual ~MOutputPlugin(){} |
williamr@4 | 85 |
|
williamr@4 | 86 |
/** |
williamr@4 | 87 |
Output plug-in interface id. This is for ULogger to distinguish between the |
williamr@4 | 88 |
different types of plug-ins (e.g. Output vs Input plug-ins). |
williamr@4 | 89 |
*/ |
williamr@4 | 90 |
static const CPlugin::TPluginInterface iInterfaceId = CPlugin::EOutput; |
williamr@4 | 91 |
}; |
williamr@4 | 92 |
|
williamr@4 | 93 |
} //end of namespace |
williamr@4 | 94 |
|
williamr@4 | 95 |
#endif // ULOGGEROUTPUTPLUGIN_H |