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