Msrp/MsrpClient/inc/CMSRPSessionImplementation.h
author shivsood
Sat, 12 Jun 2010 14:30:11 +0530
branchMSRP_FrameWork
changeset 25 505ad3f0ce5c
child 58 cdb720e67852
permissions -rw-r--r--
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia. MSRP Implementation as per RFC 4975 and RCS specifications that supports 1. Multiple one to one chat data sessions as per RCS/RFC 4975 specifications. 2. Multiple file Sharing sessions as per RCS. 3. Data Chunking requirements as per 4975. 3. MSRP Connection sharing requirements as per RFC 4975

/*
* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "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:
* Nokia Corporation - initial contribution.
* Contributors:
*
* Description:
* MSRP Implementation
*
*/

#ifndef CMSRPSESSIONIMPLEMENTATION_H_
#define CMSRPSESSIONIMPLEMENTATION_H_

// INCLUDES
#include "MsrpCommon.h"

// Forward declarations.
class CMSRP;
class MMSRPSessionObserver;
class CUri8;
class RMSRPSession;
class CMSRPConnectionListener;
class CMSRPIncomingListener;
class CMSRPSendResultListener;
class CMSRPMessage;
class RMSRP;
class CMSRPSessionParams;


class CMSRPSessionImplementation : public CBase
    {
public:       
    static CMSRPSessionImplementation* NewL( RMSRP& aRMSRP,
                                             MMSRPSessionObserver& aObserver,
                                             const TUint aIapId );
    
    static CMSRPSessionImplementation* NewLC( RMSRP& aRMSRP,
                                              MMSRPSessionObserver& aObserver,
                                              const TUint aIapId );
    
    ~CMSRPSessionImplementation();
    
public:
    
    TDesC8& LocalMSRPPath();
    
    void SetSessionParams( CMSRPSessionParams& aSessionParams );
    
    void ConnectL( const TDesC8& aRemoteMsrpPath );
    
    void ListenL( const TDesC8& aRemoteMsrpPath );
        
    HBufC8* SendBufferL( const TDesC8& aMessage, const TDesC8& aMimeType );
        
    void CancelSendingL( TDesC8& aMessageId );
    
        
    void ConnectionEstablishedL( TInt aStatus );
    
    void HandleIncomingMessageL( const TDesC8& aIncomingMessage,
                                 TInt aStatus );
    void ReceiveProgress(TInt aBytesReceived, TInt aTotalBytes);
    
    void SendProgress(TInt aBytesSent, TInt aTotalBytes);
    
    void SendStatusL( TInt aStatus, const TDesC8& aMessageid );
	
    void HandleConnectionErrors( TInt aErrorStatus );
    
	void SendFileL( const TFileName& aFileName,const TDesC8& aMimeType );
	 
	void NotifyProgress(TBool aFlag);

	void ReceiveFileL(const TFileName& aFileName,const TInt aFileSize, const TDesC8& aMimeType);

private:
    
    CMSRPMessage* CreateMsrpMessageL( const TDesC8& aMessage, const TDesC8& aToPath, 
                                      const TDesC8& aFromPath, const TDesC8& aMimeType );
    
    void SendMessageL( CMSRPMessage* aMessage );
    
    void GetRemotePathComponentsL( TPtrC8& aRemoteHost, TUint& aRemotePort, TPtrC8& aRemoteSessionID );
    
    CMSRPMessage* SetFileParamsL(const TFileName& aFileName,const TDesC8& aToPath,
                                                               const TDesC8& aFromPath, 
                                                               const TDesC8& aMimeType );
private:
    
    CMSRPSessionImplementation( RMSRP& aRMSRP,
                                MMSRPSessionObserver& aObserver );
    
    void ConstructL( const TUint aIapId );
        
private:
    
    RMSRP& iRMSRP;
    
    MMSRPSessionObserver& iSessionObserver;
    
    RMSRPSession* iMSRPSession;
    
    RBuf8 iLocalMsrpPath;
    
    RBuf8 iRemoteMsrpPath;
    
    TReportStatus iSuccessReport;
    
    TReportStatus iFailureReport;
            
    TBuf8< KMaxLengthOfIncomingMessageExt > iExtMessageBuffer;
    
    CMSRPConnectionListener* iConnectionListener;
    
    CMSRPIncomingListener* iIncomingListener;
    
    CMSRPSendResultListener* iSendResultListener;
    
    RPointerArray< CMSRPMessage > iSentMessages;
    
    TBool iProgress;
    
    TBool  isSendFile;
    TBool  isReceiveFile;
    };

#endif /* CMSRPSESSIONIMPLEMENTATION_H_ */