1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/traceservices/tracefw/ulogger/inc/uloggerinputplugin.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,119 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// ULogger input plug-in interface
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file
1.23 + @publishedPartner
1.24 + @prototype
1.25 +*/
1.26 +
1.27 +#ifndef ULOGGERINPUTPLUGIN_H
1.28 +#define ULOGGERINPUTPLUGIN_H
1.29 +
1.30 +#include <e32base.h>
1.31 +#include "uloggerplugin.h"
1.32 +#include "uloggerdatatypes.h"
1.33 +
1.34 +namespace Ulogger
1.35 +{
1.36 +
1.37 +//! Abstract class for input plug-ins.
1.38 +/*!
1.39 +A ULogger input plug-in listens for ULogger commands on some communication
1.40 +medium, such as serial, usb or a TCP socket. Whenever a command is received
1.41 +by the input plug-in, it passes this command to ULogger, which then interprets
1.42 +the command, acts on it, and returns a response to the input plug-in. The input
1.43 +plug-in sends any response coming from ULogger back to the client that sent
1.44 +the command in the first place.
1.45 +
1.46 +All input plug-ins must derive from this class in order to be compatible with
1.47 +ULogger. They must also derive from ULogger::CPlugin (whose header is already
1.48 +included by this header, for convenience) in order to be compatible with the
1.49 +ECom framework, which ULogger uses to load its input plug-ins.
1.50 +*/
1.51 +class MInputPlugin
1.52 + {
1.53 +public:
1.54 + /**
1.55 + Asynchronous method that reads command data from the input medium. ULogger
1.56 + calls this when it's ready to receive command data from the input plug-in.
1.57 + When the input plug-in completes the read operation it notifies the caller
1.58 + via the TRequestStatus that is passed into this method by reference. It
1.59 + provides the command data that has been received in the descriptor that is
1.60 + passed into this method by reference.
1.61 + Input plug-ins typically implement this method by simply passing the
1.62 + TRequestStatus and descriptor arguments on to another asynchronous method,
1.63 + such as for example a socket's ReadOneOrMore method.
1.64 +
1.65 + @param aStatus The request status used to contain completion information for
1.66 + the function. On completion, contains a system-wide error
1.67 + code.
1.68 + @param aData A descriptor reference to store data obtained from input
1.69 + channel.
1.70 + @return KErrNone if operation was finished without any problems, system wide
1.71 + error code otherwise.
1.72 + */
1.73 + virtual TInt ReadData(TRequestStatus& aStatus, TDes8& aData) = 0;
1.74 +
1.75 + /** Cancels asynchronous operation issued by ReadData method. */
1.76 + virtual void CancelReadData() = 0;
1.77 +
1.78 + /**
1.79 + Synchronous Method that sends the given acknowledgment data back to the
1.80 + client that is sending command data to the input plug-in. ULogger calls this
1.81 + method whenever it needs to send a response to a previously received
1.82 + command.
1.83 +
1.84 + @param aData A descriptor which contains error code or other results, for
1.85 + example, array of filters.
1.86 + Format of this data depends on previously obtained command.
1.87 + @return KErrNone is send operation finished with success otherwise
1.88 + system wide error code.
1.89 + */
1.90 + virtual TInt SendAcknowledgment(const TDesC8& aData) = 0;
1.91 +
1.92 + /**
1.93 + Called by ULogger as first method after construction or after changes in
1.94 + config file. This allows the input plug-in to initialize itself with its
1.95 + private settings.
1.96 +
1.97 + @param aConfigs actual configurations valid for this instance
1.98 + @return KErrNone, if successful; otherwise one of the other system wide
1.99 + error codes.
1.100 + */
1.101 + virtual TInt ConfigureInputPlugin(const RPointerArray<TPluginConfiguration>& aConfigs) = 0;
1.102 +
1.103 + /**
1.104 + Called by ULogger to indicate that the input plug-in must flush all buffers
1.105 + and release any locked resources. Any resources may be locked only after any
1.106 + other method is called.
1.107 + */
1.108 + virtual void CloseInputPlugin() = 0;
1.109 +
1.110 + /** Virtual destructor. */
1.111 + virtual ~MInputPlugin(){}
1.112 +
1.113 + /**
1.114 + Input plug-in interface id. This is for ULogger to distinguish between the
1.115 + different types of plug-ins (e.g. Intput vs Output plug-ins).
1.116 + */
1.117 + static const CPlugin::TPluginInterface iInterfaceId = CPlugin::EInput;
1.118 + };
1.119 +
1.120 +} //end of namespace
1.121 +
1.122 +#endif /* ULOGGERINPUTPLUGIN_H */