Msrp/MsrpClient/inc/CMSRPSession.h
branchMSRP_FrameWork
changeset 25 505ad3f0ce5c
child 58 cdb720e67852
equal deleted inserted replaced
22:f1578314b8da 25:505ad3f0ce5c
       
     1 /*
       
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html."
       
     8 * Initial Contributors:
       
     9 * Nokia Corporation - initial contribution.
       
    10 * Contributors:
       
    11 *
       
    12 * Description:
       
    13 * MSRP Implementation
       
    14 *
       
    15 */
       
    16 
       
    17 #ifndef CMSRPSESSION_H_
       
    18 #define CMSRPSESSION_H_
       
    19 
       
    20 // System Includes
       
    21 #include <e32base.h>
       
    22 
       
    23 // Forward Declarations
       
    24 class CMSRPSessionImplementation;
       
    25 class MMSRPSessionObserver;
       
    26 class RMSRP;
       
    27 class CMSRPMessage;
       
    28 class CMSRPSessionParams;
       
    29 
       
    30 
       
    31 class CMSRPSession : public CBase
       
    32     {
       
    33     friend class CMSRPImplementation;
       
    34     
       
    35 public:    
       
    36     
       
    37     /** 
       
    38      * Object Creation. This is not exported to the client. It is called
       
    39      * while attempting to create an msrp session.
       
    40      * @param aRMSRP an instance of the client server session
       
    41      * @param aObserver the session observer that is created by the client
       
    42      * @param aIapId IAP id of the application
       
    43      * @return session object
       
    44      */
       
    45     static CMSRPSession* NewL( RMSRP& aRMSRP,
       
    46                                         MMSRPSessionObserver& aObserver, 
       
    47                                         const TUint aIapId );
       
    48         
       
    49     /** 
       
    50      * Object Creation. This is not exported to the client. It is called
       
    51      * while attempting to create an msrp session.
       
    52      * @param aRMSRP an instance of the client server session
       
    53      * @param aObserver the session observer that is created by the client
       
    54      * @param aIapId IAP id of the application
       
    55      * @return session object
       
    56      */
       
    57     static CMSRPSession* NewLC( RMSRP& aRMSRP,
       
    58                                          MMSRPSessionObserver& aObserver,
       
    59                                          const TUint aIapId );
       
    60     
       
    61 public:
       
    62 
       
    63     // === Post Creation; SDP negotiation parameter fetching.
       
    64                 
       
    65     /**
       
    66      * Gives the local MSRP path that is used in the "a" line of SDP
       
    67      * @return local msrp path
       
    68      */    
       
    69     IMPORT_C TDesC8& LocalMSRPPath();
       
    70 
       
    71     /**
       
    72      * Sets the various parameters related to an MSRP session
       
    73      * @param aSessionParams the session settings object from which the 
       
    74      * settings need to be incorporated into the msrp session.
       
    75      * Eg. SR and FR report headers can be set using this
       
    76      */    
       
    77     IMPORT_C void SetSessionParams( CMSRPSessionParams& aSessionParams );
       
    78     
       
    79     
       
    80     // === Post SDP Negotiation; Connection Setup.
       
    81         
       
    82     /**
       
    83      * Connects to the remote node
       
    84      * @param aRemoteMsrpPath the msrp path of the remote node
       
    85      * This is obtained through the SDP negotiation
       
    86      * @return KErrNone or system wide error codes
       
    87      */
       
    88     IMPORT_C TInt Connect( const TDesC8& aRemoteMsrpPath );
       
    89     
       
    90     /**
       
    91      * Listens for connections from the remote node
       
    92      * @param aRemoteMsrpPath the msrp path of the remote node
       
    93      * This is obtained through the SDP negotiation
       
    94      * @return KErrNone or system wide error codes
       
    95      */
       
    96     IMPORT_C TInt Listen ( const TDesC8& aRemoteMsrpPath );
       
    97     
       
    98     
       
    99     // === Post Connection setup; Data Trasfer. 
       
   100    
       
   101     /**
       
   102      * Sends a message to the remote note that is connected
       
   103      * @param aMessage the data that needs to be sent
       
   104      * @param aMimeType the mime type of the data
       
   105      * @return the id of the message that was sent by the msrp stack
       
   106      */
       
   107     IMPORT_C HBufC8* SendBuffer( const TDesC8& aMessage, const TDesC8& aMimeType );
       
   108         
       
   109     /**
       
   110      * Cancels the send operation initiated by the client
       
   111      * @param aMessageId the id of the message that needs to be cancelled
       
   112      * @return KErrNone or system wide error codes
       
   113      */
       
   114     IMPORT_C TInt CancelSending( TDesC8& aMessageId );
       
   115 
       
   116     IMPORT_C TInt SendFile( const TFileName& aFileName, const TDesC8& aMimeType );
       
   117     
       
   118     IMPORT_C TInt CancelFileSending();
       
   119     
       
   120     IMPORT_C TInt ReceiveFile(const TFileName& aFileName,const TInt aFileSize, const TDesC8& aMimeType );
       
   121 
       
   122     IMPORT_C TInt CancelReceiveFile();
       
   123     
       
   124     IMPORT_C void NotifyProgress(TBool aFlag);
       
   125     
       
   126 
       
   127 private:
       
   128     void ConstructL( RMSRP& aRMSRP,
       
   129                      MMSRPSessionObserver& aObserver,
       
   130                      const TUint aIapId );
       
   131     
       
   132     ~CMSRPSession();
       
   133         
       
   134 private:
       
   135            
       
   136     CMSRPSessionImplementation* iMSRPSessionImpl;
       
   137     
       
   138     };
       
   139 
       
   140 #endif /* CMSRPSESSION_H_ */