williamr@4: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: // All rights reserved. williamr@4: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@4: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: // williamr@4: // Initial Contributors: williamr@4: // Nokia Corporation - initial contribution. williamr@4: // williamr@4: // Contributors: williamr@4: // williamr@4: // Description: williamr@4: // ULogger input plug-in interface williamr@4: // williamr@4: // williamr@4: williamr@4: /** williamr@4: @file williamr@4: @publishedPartner williamr@4: @prototype williamr@4: */ williamr@4: williamr@4: #ifndef ULOGGERINPUTPLUGIN_H williamr@4: #define ULOGGERINPUTPLUGIN_H williamr@4: williamr@4: #include williamr@4: #include "uloggerplugin.h" williamr@4: #include "uloggerdatatypes.h" williamr@4: williamr@4: namespace Ulogger williamr@4: { williamr@4: williamr@4: //! Abstract class for input plug-ins. williamr@4: /*! williamr@4: A ULogger input plug-in listens for ULogger commands on some communication williamr@4: medium, such as serial, usb or a TCP socket. Whenever a command is received williamr@4: by the input plug-in, it passes this command to ULogger, which then interprets williamr@4: the command, acts on it, and returns a response to the input plug-in. The input williamr@4: plug-in sends any response coming from ULogger back to the client that sent williamr@4: the command in the first place. williamr@4: williamr@4: All input plug-ins must derive from this class in order to be compatible with williamr@4: ULogger. They must also derive from ULogger::CPlugin (whose header is already williamr@4: included by this header, for convenience) in order to be compatible with the williamr@4: ECom framework, which ULogger uses to load its input plug-ins. williamr@4: */ williamr@4: class MInputPlugin williamr@4: { williamr@4: public: williamr@4: /** williamr@4: Asynchronous method that reads command data from the input medium. ULogger williamr@4: calls this when it's ready to receive command data from the input plug-in. williamr@4: When the input plug-in completes the read operation it notifies the caller williamr@4: via the TRequestStatus that is passed into this method by reference. It williamr@4: provides the command data that has been received in the descriptor that is williamr@4: passed into this method by reference. williamr@4: Input plug-ins typically implement this method by simply passing the williamr@4: TRequestStatus and descriptor arguments on to another asynchronous method, williamr@4: such as for example a socket's ReadOneOrMore method. williamr@4: williamr@4: @param aStatus The request status used to contain completion information for williamr@4: the function. On completion, contains a system-wide error williamr@4: code. williamr@4: @param aData A descriptor reference to store data obtained from input williamr@4: channel. williamr@4: @return KErrNone if operation was finished without any problems, system wide williamr@4: error code otherwise. williamr@4: */ williamr@4: virtual TInt ReadData(TRequestStatus& aStatus, TDes8& aData) = 0; williamr@4: williamr@4: /** Cancels asynchronous operation issued by ReadData method. */ williamr@4: virtual void CancelReadData() = 0; williamr@4: williamr@4: /** williamr@4: Synchronous Method that sends the given acknowledgment data back to the williamr@4: client that is sending command data to the input plug-in. ULogger calls this williamr@4: method whenever it needs to send a response to a previously received williamr@4: command. williamr@4: williamr@4: @param aData A descriptor which contains error code or other results, for williamr@4: example, array of filters. williamr@4: Format of this data depends on previously obtained command. williamr@4: @return KErrNone is send operation finished with success otherwise williamr@4: system wide error code. williamr@4: */ williamr@4: virtual TInt SendAcknowledgment(const TDesC8& aData) = 0; williamr@4: williamr@4: /** williamr@4: Called by ULogger as first method after construction or after changes in williamr@4: config file. This allows the input plug-in to initialize itself with its williamr@4: private settings. williamr@4: williamr@4: @param aConfigs actual configurations valid for this instance williamr@4: @return KErrNone, if successful; otherwise one of the other system wide williamr@4: error codes. williamr@4: */ williamr@4: virtual TInt ConfigureInputPlugin(const RPointerArray& aConfigs) = 0; williamr@4: williamr@4: /** williamr@4: Called by ULogger to indicate that the input plug-in must flush all buffers williamr@4: and release any locked resources. Any resources may be locked only after any williamr@4: other method is called. williamr@4: */ williamr@4: virtual void CloseInputPlugin() = 0; williamr@4: williamr@4: /** Virtual destructor. */ williamr@4: virtual ~MInputPlugin(){} williamr@4: williamr@4: /** williamr@4: Input plug-in interface id. This is for ULogger to distinguish between the williamr@4: different types of plug-ins (e.g. Intput vs Output plug-ins). williamr@4: */ williamr@4: static const CPlugin::TPluginInterface iInterfaceId = CPlugin::EInput; williamr@4: }; williamr@4: williamr@4: } //end of namespace williamr@4: williamr@4: #endif /* ULOGGERINPUTPLUGIN_H */