|
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 input plug-in interface |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @publishedPartner |
|
21 @prototype |
|
22 */ |
|
23 |
|
24 #ifndef ULOGGERINPUTPLUGIN_H |
|
25 #define ULOGGERINPUTPLUGIN_H |
|
26 |
|
27 #include <e32base.h> |
|
28 #include "uloggerplugin.h" |
|
29 #include "uloggerdatatypes.h" |
|
30 |
|
31 namespace Ulogger |
|
32 { |
|
33 |
|
34 //! Abstract class for input plug-ins. |
|
35 /*! |
|
36 A ULogger input plug-in listens for ULogger commands on some communication |
|
37 medium, such as serial, usb or a TCP socket. Whenever a command is received |
|
38 by the input plug-in, it passes this command to ULogger, which then interprets |
|
39 the command, acts on it, and returns a response to the input plug-in. The input |
|
40 plug-in sends any response coming from ULogger back to the client that sent |
|
41 the command in the first place. |
|
42 |
|
43 All input plug-ins must derive from this class in order to be compatible with |
|
44 ULogger. They must also derive from ULogger::CPlugin (whose header is already |
|
45 included by this header, for convenience) in order to be compatible with the |
|
46 ECom framework, which ULogger uses to load its input plug-ins. |
|
47 */ |
|
48 class MInputPlugin |
|
49 { |
|
50 public: |
|
51 /** |
|
52 Asynchronous method that reads command data from the input medium. ULogger |
|
53 calls this when it's ready to receive command data from the input plug-in. |
|
54 When the input plug-in completes the read operation it notifies the caller |
|
55 via the TRequestStatus that is passed into this method by reference. It |
|
56 provides the command data that has been received in the descriptor that is |
|
57 passed into this method by reference. |
|
58 Input plug-ins typically implement this method by simply passing the |
|
59 TRequestStatus and descriptor arguments on to another asynchronous method, |
|
60 such as for example a socket's ReadOneOrMore method. |
|
61 |
|
62 @param aStatus The request status used to contain completion information for |
|
63 the function. On completion, contains a system-wide error |
|
64 code. |
|
65 @param aData A descriptor reference to store data obtained from input |
|
66 channel. |
|
67 @return KErrNone if operation was finished without any problems, system wide |
|
68 error code otherwise. |
|
69 */ |
|
70 virtual TInt ReadData(TRequestStatus& aStatus, TDes8& aData) = 0; |
|
71 |
|
72 /** Cancels asynchronous operation issued by ReadData method. */ |
|
73 virtual void CancelReadData() = 0; |
|
74 |
|
75 /** |
|
76 Synchronous Method that sends the given acknowledgment data back to the |
|
77 client that is sending command data to the input plug-in. ULogger calls this |
|
78 method whenever it needs to send a response to a previously received |
|
79 command. |
|
80 |
|
81 @param aData A descriptor which contains error code or other results, for |
|
82 example, array of filters. |
|
83 Format of this data depends on previously obtained command. |
|
84 @return KErrNone is send operation finished with success otherwise |
|
85 system wide error code. |
|
86 */ |
|
87 virtual TInt SendAcknowledgment(const TDesC8& aData) = 0; |
|
88 |
|
89 /** |
|
90 Called by ULogger as first method after construction or after changes in |
|
91 config file. This allows the input plug-in to initialize itself with its |
|
92 private settings. |
|
93 |
|
94 @param aConfigs actual configurations valid for this instance |
|
95 @return KErrNone, if successful; otherwise one of the other system wide |
|
96 error codes. |
|
97 */ |
|
98 virtual TInt ConfigureInputPlugin(const RPointerArray<TPluginConfiguration>& aConfigs) = 0; |
|
99 |
|
100 /** |
|
101 Called by ULogger to indicate that the input plug-in must flush all buffers |
|
102 and release any locked resources. Any resources may be locked only after any |
|
103 other method is called. |
|
104 */ |
|
105 virtual void CloseInputPlugin() = 0; |
|
106 |
|
107 /** Virtual destructor. */ |
|
108 virtual ~MInputPlugin(){} |
|
109 |
|
110 /** |
|
111 Input plug-in interface id. This is for ULogger to distinguish between the |
|
112 different types of plug-ins (e.g. Intput vs Output plug-ins). |
|
113 */ |
|
114 static const CPlugin::TPluginInterface iInterfaceId = CPlugin::EInput; |
|
115 }; |
|
116 |
|
117 } //end of namespace |
|
118 |
|
119 #endif /* ULOGGERINPUTPLUGIN_H */ |