Msrp/MsrpClient/src/CMSRPSession.cpp
branchMSRP_FrameWork
changeset 58 cdb720e67852
parent 25 505ad3f0ce5c
equal deleted inserted replaced
25:505ad3f0ce5c 58:cdb720e67852
    15 */
    15 */
    16 
    16 
    17 // System Includes
    17 // System Includes
    18 #include <e32base.h>
    18 #include <e32base.h>
    19 
    19 
    20 
       
    21 //  Include Files
    20 //  Include Files
    22 #include "CMSRPSession.h"
    21 #include "CMSRPSession.h"
    23 #include "CMSRPSessionImplementation.h"
    22 #include "CMSRPSessionImplementation.h"
    24 
    23 
    25 
    24 // -----------------------------------------------------------------------------
    26 //  Member Functions
    25 // CMSRPSession::NewL
    27 
    26 // -----------------------------------------------------------------------------
    28 CMSRPSession* CMSRPSession::NewL( RMSRP& aRMSRP,
    27 //
    29                                            MMSRPSessionObserver& aObserver,
    28 CMSRPSession* CMSRPSession::NewL( 
    30                                            const TUint aIapId )
    29     RMSRP& aRMSRP,
       
    30     MMSRPSessionObserver& aObserver,
       
    31     const TUint aIapId,
       
    32     const TDesC8& aSessionId )
    31 	{
    33 	{
    32 	MSRPLOG("CMSRP Session.. NewL");
    34 	MSRPLOG("CMSRP Session.. NewL");
    33 	CMSRPSession* self = CMSRPSession::NewLC( aRMSRP, aObserver, aIapId );
    35 	CMSRPSession* self = CMSRPSession::NewLC( aRMSRP, aObserver, aIapId, aSessionId );
    34 	CleanupStack::Pop(self);
    36 	CleanupStack::Pop(self);
    35 	return self;
    37 	return self;
    36 	}
    38 	}
    37 
    39 
    38 
    40 // -----------------------------------------------------------------------------
    39 CMSRPSession* CMSRPSession::NewLC( RMSRP& aRMSRP,
    41 // CMSRPSession::NewL
    40                                             MMSRPSessionObserver& aObserver,
    42 // -----------------------------------------------------------------------------
    41                                             const TUint aIapId )
    43 //
       
    44 CMSRPSession* CMSRPSession::NewLC( 
       
    45     RMSRP& aRMSRP,
       
    46     MMSRPSessionObserver& aObserver,
       
    47     const TUint aIapId,
       
    48     const TDesC8& aSessionId )
    42     {
    49     {
    43     MSRPLOG("CMSRP Session.. NewLC");
    50     MSRPLOG("CMSRP Session.. NewLC");
    44     CMSRPSession* self = new (ELeave) CMSRPSession;
    51     CMSRPSession* self = new (ELeave) CMSRPSession;
    45     CleanupStack::PushL(self);
    52     CleanupStack::PushL(self);
    46     self->ConstructL( aRMSRP, aObserver, aIapId );
    53     self->ConstructL( aRMSRP, aObserver, aIapId, aSessionId );
    47     return self;
    54     return self;
    48     }
    55     }
    49 
    56 
    50 
    57 // -----------------------------------------------------------------------------
    51 void CMSRPSession::ConstructL( RMSRP& aRMSRP,
    58 // CMSRPSession::NewL
    52                                MMSRPSessionObserver& aObserver,
    59 // -----------------------------------------------------------------------------
    53                                const TUint aIapId )
    60 //
       
    61 void CMSRPSession::ConstructL( 
       
    62     RMSRP& aRMSRP,
       
    63     MMSRPSessionObserver& aObserver,
       
    64     const TUint aIapId,
       
    65     const TDesC8& aSessionId )
    54 	{
    66 	{
    55 	MSRPLOG("CMSRP Session.. ConstructL");
    67 	MSRPLOG("CMSRP Session.. ConstructL");
    56 	iMSRPSessionImpl = CMSRPSessionImplementation::NewL( aRMSRP, aObserver, aIapId );	 
    68 	iMSRPSessionImpl = CMSRPSessionImplementation::NewL( aRMSRP, aObserver, aIapId, aSessionId );	 
    57 	}
    69 	}
    58 
    70 
    59 
    71 // -----------------------------------------------------------------------------
       
    72 // CMSRPSession::NewL
       
    73 // -----------------------------------------------------------------------------
       
    74 //
    60 CMSRPSession::~CMSRPSession()
    75 CMSRPSession::~CMSRPSession()
    61 	{
    76 	{
    62 	MSRPLOG("CMSRP Session.. Dtor");
    77 	MSRPLOG("-> CMSRPSession::~CMSRPSession()");
    63 	if(NULL != iMSRPSessionImpl)
    78 	delete iMSRPSessionImpl;
    64 		delete iMSRPSessionImpl;
    79     MSRPLOG("<- CMSRPSession::~CMSRPSession()");
    65 	}
    80 	}
    66 
    81 
    67 
    82 // -----------------------------------------------------------------------------
       
    83 // CMSRPSession::NewL
       
    84 // -----------------------------------------------------------------------------
       
    85 //
    68 EXPORT_C TDesC8& CMSRPSession::LocalMSRPPath()
    86 EXPORT_C TDesC8& CMSRPSession::LocalMSRPPath()
    69     {
    87     {
    70     MSRPLOG("CMSRP Session.. LocalMSRPPath");
    88     MSRPLOG("CMSRP Session.. LocalMSRPPath");
    71     return iMSRPSessionImpl->LocalMSRPPath();
    89     return iMSRPSessionImpl->LocalMSRPPath();
    72     }
    90     }
    73 
    91 
    74 
    92 // -----------------------------------------------------------------------------
       
    93 // CMSRPSession::NewL
       
    94 // -----------------------------------------------------------------------------
       
    95 //
    75 EXPORT_C void CMSRPSession::SetSessionParams( CMSRPSessionParams& aSessionParams )
    96 EXPORT_C void CMSRPSession::SetSessionParams( CMSRPSessionParams& aSessionParams )
    76     {
    97     {
    77     MSRPLOG("CMSRP Session.. SetSessionParams");
    98     MSRPLOG("CMSRP Session.. SetSessionParams");
    78     iMSRPSessionImpl->SetSessionParams( aSessionParams );
    99     iMSRPSessionImpl->SetSessionParams( aSessionParams );
    79     }
   100     }
    80 
   101 
    81     
   102 // -----------------------------------------------------------------------------
       
   103 // CMSRPSession::NewL
       
   104 // -----------------------------------------------------------------------------
       
   105 //
    82 EXPORT_C TInt CMSRPSession::Connect( const TDesC8& aRemoteMsrpPath )
   106 EXPORT_C TInt CMSRPSession::Connect( const TDesC8& aRemoteMsrpPath )
    83 	{
   107 	{
    84 	MSRPLOG("CMSRP Session.. Connect");
   108 	MSRPLOG("CMSRP Session.. Connect");
    85 	TRAPD( err, iMSRPSessionImpl->ConnectL( aRemoteMsrpPath ));
   109 	TRAPD( err, iMSRPSessionImpl->ConnectL( aRemoteMsrpPath ));
    86 	return err;
   110 	return err;
    87 	}
   111 	}
    88 
   112 
    89 
   113 // -----------------------------------------------------------------------------
       
   114 // CMSRPSession::NewL
       
   115 // -----------------------------------------------------------------------------
       
   116 //
    90 EXPORT_C TInt CMSRPSession::Listen( const TDesC8& aRemoteMsrpPath )
   117 EXPORT_C TInt CMSRPSession::Listen( const TDesC8& aRemoteMsrpPath )
    91 	{
   118 	{
    92 	MSRPLOG("CMSRP Session.. Listen");
   119 	MSRPLOG("CMSRP Session.. Listen");
    93 	TRAPD( err, iMSRPSessionImpl->ListenL( aRemoteMsrpPath ));
   120 	TRAPD( err, iMSRPSessionImpl->ListenL( aRemoteMsrpPath ));
    94 	return err;
   121 	return err;
    95 	}
   122 	}
    96 
   123 
    97 
   124 // -----------------------------------------------------------------------------
       
   125 // CMSRPSession::NewL
       
   126 // -----------------------------------------------------------------------------
       
   127 //
    98 EXPORT_C HBufC8* CMSRPSession::SendBuffer(
   128 EXPORT_C HBufC8* CMSRPSession::SendBuffer(
    99     const TDesC8& aMessage,
   129     const TDesC8& aMessage,
   100     const TDesC8& aMimeType )
   130     const TDesC8& aMimeType )
   101     {
   131     {
   102     MSRPLOG("CMSRP Session.. SendBuffer");
   132     MSRPLOG("CMSRP Session.. SendBuffer");
   103     // send the Message
   133     // send the Message
   104     HBufC8* messageId = NULL;
   134     HBufC8* messageId = NULL;
   105     TRAPD( err, messageId = iMSRPSessionImpl->SendBufferL( aMessage, aMimeType ) );
   135     TRAPD( err, messageId = iMSRPSessionImpl->SendBufferL( aMessage, aMimeType ) );
   106     if ( err )
   136     if ( err )
   107         {
   137         {
   108         return NULL;
   138         messageId = NULL;
   109         }
   139         }
   110     return messageId;
   140     return messageId;
   111     }
   141     }
   112 
   142 
   113 EXPORT_C TInt CMSRPSession::SendFile(
   143 // -----------------------------------------------------------------------------
       
   144 // CMSRPSession::NewL
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 EXPORT_C HBufC8* CMSRPSession::SendFile(
   114     const TFileName& aFileName,
   148     const TFileName& aFileName,
   115     const TDesC8& aMimeType )
   149     const TDesC8& aMimeType )
   116     {
   150     {
   117    
   151    
   118     MSRPLOG("CMSRP Session.. SendFile");
   152     MSRPLOG("CMSRP Session.. SendFile");
   119     TRAPD( err,iMSRPSessionImpl->SendFileL(aFileName, aMimeType ) );
   153     HBufC8* messageId = NULL;
   120     return err;
   154     TRAPD( err, messageId = iMSRPSessionImpl->SendFileL(aFileName, aMimeType ) );
   121     
   155     if ( err )
       
   156         {
       
   157         messageId = NULL;
       
   158         }
       
   159     return messageId;
   122     }
   160     }
   123 
   161 
   124 EXPORT_C TInt CMSRPSession::CancelFileSending( )
   162 // -----------------------------------------------------------------------------
       
   163 // CMSRPSession::NewL
       
   164 // -----------------------------------------------------------------------------
       
   165 //
       
   166 EXPORT_C TInt CMSRPSession::CancelReceiving( TDesC8& aMessageId )
   125     {
   167     {
   126     MSRPLOG("CMSRP Session.. CancelFileSending");
   168     MSRPLOG("-> CMSRPSession::CancelReceiveFile");
   127 /*    TInt err;
   169     TRAPD( err, iMSRPSessionImpl->CancelReceivingL( aMessageId ) );
   128     return err;*/
       
   129     return 0;
       
   130     }
       
   131 
       
   132 EXPORT_C TInt CMSRPSession::ReceiveFile(
       
   133         const TFileName& aFileName,
       
   134         const TInt aFileSize,
       
   135         const TDesC8& aMimeType)
       
   136     {
       
   137     MSRPLOG("CMSRP Session.. ReceiveFile");
       
   138     TRAPD( err,iMSRPSessionImpl->ReceiveFileL(aFileName,aFileSize,aMimeType ));
       
   139     return err;
   170     return err;
   140     }
   171     }
   141 
   172 
   142 EXPORT_C TInt CMSRPSession::CancelReceiveFile()
   173 // -----------------------------------------------------------------------------
       
   174 // CMSRPSession::NewL
       
   175 // -----------------------------------------------------------------------------
       
   176 //
       
   177 EXPORT_C void CMSRPSession::NotifyProgress(TBool aFlag)
   143     {
   178     {
   144     return 0;
   179     iMSRPSessionImpl->NotifyProgress( aFlag );
   145     }
   180     }
   146 
   181 
   147 EXPORT_C void CMSRPSession::NotifyProgress(TBool aFlag)
   182 // -----------------------------------------------------------------------------
   148     {
   183 // CMSRPSession::NewL
   149     iMSRPSessionImpl->NotifyProgress(aFlag);
   184 // -----------------------------------------------------------------------------
   150     }
   185 //
   151 
       
   152 EXPORT_C TInt CMSRPSession::CancelSending( TDesC8& aMessageId )
   186 EXPORT_C TInt CMSRPSession::CancelSending( TDesC8& aMessageId )
   153     {
   187     {
   154     MSRPLOG("CMSRP Session.. CancelSending");
   188     MSRPLOG("CMSRP Session.. CancelSending");
   155     TRAPD( err, iMSRPSessionImpl->CancelSendingL( aMessageId ) );
   189     TRAPD( err, iMSRPSessionImpl->CancelSendingL( aMessageId ) );
   156     return err;
   190     return err;
   157     }
   191     }
   158 
   192 
       
   193 // End of File