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