smf/smfservermodule/smfclient/smfclientsymbian.h
author cgandhi
Thu, 23 Sep 2010 17:43:31 +0530
changeset 25 a180113055cb
parent 18 013a02bf2bb0
child 26 83d6a149c755
permissions -rw-r--r--
Music Events are now normal Fetcher APIs added All APIs now return SmfError Canceling Request now supported Music Search now based on category Providerinfo added in DSM Added secondary ID, count, location to SMFAlbum Tags for Artist added Get tracks for album and artist added Added URL to subtitle DSM Bug fixes Detailed debugging logs filtered in server, pluginmgr, transportmgr playlistsOf() method changed in smfclient and plugin interfaces. RVCT B686 compilation issues resolved.

/**
 * Copyright (c) 2010 Sasken Communication Technologies Ltd.
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the "Eclipse Public License v1.0" 
 * which accompanies  this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html"
 *
 * Initial Contributors:
 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
 *
 * Contributors:
 * Manasij Roy, Nalina Hariharan
 * 
 * Describes the classes that implement the symbian client part of Smf server.
 * Private client implementation for Symbian.
 * 
 */

#ifndef SMFCLIENTSYMBIAN_H_
#define SMFCLIENTSYMBIAN_H_

#include <e32base.h>
#include <e32cmn.h>
#include <QStringList>
#include <smfglobal.h>
#include <smfobserver.h>
#include <smfprovider.h>

#include "smfclientsymbiansession.h"

/**
 * Private client implementation for Symbian.
 */
class CSmfClientSymbian : public CActive
{

public: // Constructors and destructors
	/**
	 * Two phase contruction - NewL
	 * @param aObserver For callback
	 */
	static CSmfClientSymbian* NewL(smfObserver* aObserver=NULL);
	
	/**
	 * Two phase contruction - NewLC
	 * @param aObserver For callback
	 */
	static CSmfClientSymbian* NewLC(smfObserver* aObserver);
	
	/**
	 * Destructor.
	 * Destroys the object and release all memory objects.
	 */
	virtual ~CSmfClientSymbian();
	
public: 
	/**
	* This overloaded API is for Synchronous calls to plugin APIs
	* @param aSerializedData serialized by the caller.
	* @param aInterfaceName Interface name
	* @param requestType Opcode
	* @param aMaxAllocation Max data size that is allocated in the client side for
	* receiving this data
	* @return QByteArray
	*/
	QByteArray sendRequest(QString aInterfaceName, SmfRequestTypeID requestType,
	TInt aMaxAllocation, QByteArray& aSerializedData);
	
	/**
	* This API is for Synchronous calls to server
	* @param aInterfaceName Interface name
	* @param requestType Opcode
	* @param maxSize Max data size that is allocated in the client side for
	* receiving this data
	* @param aSerializedData serialized by the caller.
	* @return QByteArray
	*/
	QByteArray sendSyncRequest ( QString aInterfaceName, 
			SmfRequestTypeID requestType, TInt maxSize, 
			QByteArray &aSerializedData );
	
	/**
	* For sending request specific to DSM. These are used by SmfRelationMngr API
	* @param requestType Opcode
	* @param aSerializedData Data to be passed to DSM through server, interpretation
	* depends on Relation manager and DSM
	* @maxSize Size to be allocated in the client side
	* @return Data received from server, interpretation depends on SmfRelationMngr and DSM
	*/
	QByteArray sendDSMSyncRequest ( SmfRequestTypeID requestType, 
			QByteArray& aSerializedData, SmfError& aErr, TInt maxSize = 10 );
	
	/**
	 * Calls SendReceive (Asynchronous) of the RSessionBase object.
	 * @param aSerializedData serialized by the caller.
	 * @param aInterfaceName Interface name
	 * @param requestType Opcode
	 * @param aMaxAllocation Max data size that is allocated in the 
	 * client side for receiving this data
	 * @param xtraInfo XtraInfo when required by server other than smfProvider
	 */
	TInt sendRequest( QByteArray& aSerializedData, QString aInterfaceName, 
			SmfRequestTypeID requestType, TInt aMaxAllocation );
		
	/**
	* CancelRequest.
	* Cancels an outstanding request.
	*/
	void CancelRequest() ;
	
protected: // Functions from the base class CActive
	/**
	 * From CActive, RunL.
	 * Callback function.
	 * Invoked to handle responses from the server.
	 */
	void RunL();
	
	/**
	 * From CActive, DoCancel.
	 * Cancels any outstanding operation.
	 */
	void DoCancel();
	
	/**
	 * From CActive, RunError.
	 */
	TInt RunError(TInt aError);
	
private: // Constructors
	/**
	 * CSmfClientSymbian.
	 * Performs the first phase of two phase construction.
	 */
	CSmfClientSymbian(smfObserver* aObserver);
	
	/**
	 * ConstructL.
	 * Performs the second phase construction of a
	 * CSmfClientSymbian object.
	 */
	void ConstructL();
	
private: // Data
	/**
	 * iSession, the server session.
	 */
	RSmfClientSymbianSession iSession;
	
	/**
	 * For callback, when the client gets serviced by the server
	 */
	smfObserver* iObserver;
	
	//Interface name, to be passed to the server
	TBuf<128> iInterfaceName;
	QString iInterfaceNameQt;
	//Data ptr
	TPtr iDataPtr;
	//Bytearray
	QByteArray* iBytearray;
	HBufC* iBuffer;
	TInt iMaxMessageSize;

	};

#endif /* SMFCLIENTSYMBIAN_H_ */