Msrp/MsrpClient/inc/CMSRPSessionImplementation.h
branchMSRP_FrameWork
changeset 58 cdb720e67852
parent 25 505ad3f0ce5c
equal deleted inserted replaced
25:505ad3f0ce5c 58:cdb720e67852
    30 class CMSRPSendResultListener;
    30 class CMSRPSendResultListener;
    31 class CMSRPMessage;
    31 class CMSRPMessage;
    32 class RMSRP;
    32 class RMSRP;
    33 class CMSRPSessionParams;
    33 class CMSRPSessionParams;
    34 
    34 
    35 
    35 // CLASS DECLARATION
       
    36 /**
       
    37 * This is an implementation class for CMSRPSession class.
       
    38 *
       
    39 */
    36 class CMSRPSessionImplementation : public CBase
    40 class CMSRPSessionImplementation : public CBase
    37     {
    41     {
    38 public:       
    42     public:       
    39     static CMSRPSessionImplementation* NewL( RMSRP& aRMSRP,
       
    40                                              MMSRPSessionObserver& aObserver,
       
    41                                              const TUint aIapId );
       
    42     
    43     
    43     static CMSRPSessionImplementation* NewLC( RMSRP& aRMSRP,
    44         /** 
    44                                               MMSRPSessionObserver& aObserver,
    45          * Object Creation. This is not exported to the client. It is called
    45                                               const TUint aIapId );
    46          * while attempting to create an msrp session.
       
    47          * @param aRMSRP an instance of the client server session
       
    48          * @param aObserver the session observer that is created by the client
       
    49          * @param aIapId IAP id of the application
       
    50          * @param aSessionId session id of this MSRP session. This comes from the
       
    51          *        path SDP attribute where session id is used
       
    52          * @return session object
       
    53          */
       
    54          static CMSRPSessionImplementation* NewL( RMSRP& aRMSRP,
       
    55                                                  MMSRPSessionObserver& aObserver,
       
    56                                                  const TUint aIapId,
       
    57                                                  const TDesC8& aSessionId );
       
    58         
       
    59          /** 
       
    60           * Object Creation. This is not exported to the client. It is called
       
    61           * while attempting to create an msrp session.
       
    62           * @param aRMSRP an instance of the client server session
       
    63           * @param aObserver the session observer that is created by the client
       
    64           * @param aIapId IAP id of the application
       
    65           * @param aSessionId session id of this MSRP session. This comes from the
       
    66           *        path SDP attribute where session id is used
       
    67           * @return session object
       
    68           */
       
    69         static CMSRPSessionImplementation* NewLC( RMSRP& aRMSRP,
       
    70                                                   MMSRPSessionObserver& aObserver,
       
    71                                                   const TUint aIapId,
       
    72                                                   const TDesC8& aSessionId );
       
    73         
       
    74         ~CMSRPSessionImplementation();
       
    75         
       
    76     public:
       
    77         
       
    78         TDesC8& LocalMSRPPath();
       
    79         
       
    80         void SetSessionParams( CMSRPSessionParams& aSessionParams );
       
    81         
       
    82         void ConnectL( const TDesC8& aRemoteMsrpPath );
       
    83         
       
    84         void ListenL( const TDesC8& aRemoteMsrpPath );
       
    85             
       
    86         HBufC8* SendBufferL( const TDesC8& aMessage, const TDesC8& aMimeType );
       
    87             
       
    88         void CancelSendingL( TDesC8& aMessageId );
       
    89         
       
    90         void CancelReceivingL( TDesC8& aMessageId );
    46     
    91     
    47     ~CMSRPSessionImplementation();
    92         void ConnectionEstablishedL( TInt aStatus );
       
    93         
       
    94         void HandleIncomingMessageL( const TDesC8& aIncomingMessage,
       
    95                                      TInt aStatus );
       
    96         void ReceiveProgress( const TDesC8& aMessageId, TInt aBytesReceived, TInt aTotalBytes);
       
    97         
       
    98         void SendProgress(const TDesC8& aMessageId, TInt aBytesSent, TInt aTotalBytes);
       
    99         
       
   100         void SendStatusL( TInt aStatus, const TDesC8& aMessageid );
       
   101         
       
   102         void HandleConnectionErrors( TInt aErrorStatus );
       
   103         
       
   104         HBufC8* SendFileL( const TFileName& aFileName,const TDesC8& aMimeType );
       
   105         
       
   106         void NotifyProgress(TBool aFlag);
    48     
   107     
    49 public:
   108     private:
    50     
       
    51     TDesC8& LocalMSRPPath();
       
    52     
       
    53     void SetSessionParams( CMSRPSessionParams& aSessionParams );
       
    54     
       
    55     void ConnectL( const TDesC8& aRemoteMsrpPath );
       
    56     
       
    57     void ListenL( const TDesC8& aRemoteMsrpPath );
       
    58         
   109         
    59     HBufC8* SendBufferL( const TDesC8& aMessage, const TDesC8& aMimeType );
   110         CMSRPMessage* CreateMsrpMessageL( const TDesC8& aMessage, const TDesC8& aToPath, 
       
   111                                           const TDesC8& aFromPath, const TDesC8& aMimeType );
    60         
   112         
    61     void CancelSendingL( TDesC8& aMessageId );
   113         void SendMessageL( CMSRPMessage* aMessage );
    62     
       
    63         
   114         
    64     void ConnectionEstablishedL( TInt aStatus );
   115         void GetRemotePathComponentsL( TPtrC8& aRemoteHost, TUint& aRemotePort, TPtrC8& aRemoteSessionID );
    65     
   116         
    66     void HandleIncomingMessageL( const TDesC8& aIncomingMessage,
   117         CMSRPMessage* SetFileParamsL(const TFileName& aFileName,const TDesC8& aToPath,
    67                                  TInt aStatus );
   118                                                                    const TDesC8& aFromPath, 
    68     void ReceiveProgress(TInt aBytesReceived, TInt aTotalBytes);
   119                                                                    const TDesC8& aMimeType );
    69     
   120     private:
    70     void SendProgress(TInt aBytesSent, TInt aTotalBytes);
   121         
    71     
   122         CMSRPSessionImplementation( RMSRP& aRMSRP,
    72     void SendStatusL( TInt aStatus, const TDesC8& aMessageid );
   123                                     MMSRPSessionObserver& aObserver );
    73 	
   124         
    74     void HandleConnectionErrors( TInt aErrorStatus );
   125         /** 
    75     
   126          * Second phase constructor
    76 	void SendFileL( const TFileName& aFileName,const TDesC8& aMimeType );
   127          * @param aIapId IAP id of the application
    77 	 
   128          * @param aSessionId session id of this MSRP session. This comes from the
    78 	void NotifyProgress(TBool aFlag);
   129          *        path SDP attribute where session id is used
       
   130          */
       
   131         void ConstructL( const TUint aIapId, const TDesC8& aSessionId );
       
   132             
       
   133     private:
       
   134         
       
   135         RMSRP& iRMSRP;
       
   136         
       
   137         MMSRPSessionObserver& iSessionObserver;
    79 
   138 
    80 	void ReceiveFileL(const TFileName& aFileName,const TInt aFileSize, const TDesC8& aMimeType);
   139         // session to server, owned
       
   140         RMSRPSession* iMSRPSession;
       
   141         
       
   142         RBuf8 iLocalMsrpPath;
       
   143         
       
   144         RBuf8 iRemoteMsrpPath;
       
   145         
       
   146         TReportStatus iSuccessReport;
       
   147         
       
   148         TReportStatus iFailureReport;
       
   149                 
       
   150         TBuf8< KMaxLengthOfIncomingMessageExt > iExtMessageBuffer;
    81 
   151 
    82 private:
   152         // connection to other party server listener, owned
    83     
   153         CMSRPConnectionListener* iConnectionListener;
    84     CMSRPMessage* CreateMsrpMessageL( const TDesC8& aMessage, const TDesC8& aToPath, 
       
    85                                       const TDesC8& aFromPath, const TDesC8& aMimeType );
       
    86     
       
    87     void SendMessageL( CMSRPMessage* aMessage );
       
    88     
       
    89     void GetRemotePathComponentsL( TPtrC8& aRemoteHost, TUint& aRemotePort, TPtrC8& aRemoteSessionID );
       
    90     
       
    91     CMSRPMessage* SetFileParamsL(const TFileName& aFileName,const TDesC8& aToPath,
       
    92                                                                const TDesC8& aFromPath, 
       
    93                                                                const TDesC8& aMimeType );
       
    94 private:
       
    95     
       
    96     CMSRPSessionImplementation( RMSRP& aRMSRP,
       
    97                                 MMSRPSessionObserver& aObserver );
       
    98     
       
    99     void ConstructL( const TUint aIapId );
       
   100         
   154         
   101 private:
   155         // incoming messages listener instance, owned
   102     
   156         CMSRPIncomingListener* iIncomingListener;
   103     RMSRP& iRMSRP;
   157         
   104     
   158         // result of send message request listener, owned
   105     MMSRPSessionObserver& iSessionObserver;
   159         CMSRPSendResultListener* iSendResultListener;
   106     
   160         
   107     RMSRPSession* iMSRPSession;
   161         // array of sent messages, owned
   108     
   162         RPointerArray< CMSRPMessage > iSentMessages;
   109     RBuf8 iLocalMsrpPath;
       
   110     
       
   111     RBuf8 iRemoteMsrpPath;
       
   112     
       
   113     TReportStatus iSuccessReport;
       
   114     
       
   115     TReportStatus iFailureReport;
       
   116             
       
   117     TBuf8< KMaxLengthOfIncomingMessageExt > iExtMessageBuffer;
       
   118     
       
   119     CMSRPConnectionListener* iConnectionListener;
       
   120     
       
   121     CMSRPIncomingListener* iIncomingListener;
       
   122     
       
   123     CMSRPSendResultListener* iSendResultListener;
       
   124     
       
   125     RPointerArray< CMSRPMessage > iSentMessages;
       
   126     
       
   127     TBool iProgress;
       
   128     
       
   129     TBool  isSendFile;
       
   130     TBool  isReceiveFile;
       
   131     };
   163     };
   132 
   164 
   133 #endif /* CMSRPSESSIONIMPLEMENTATION_H_ */
   165 #endif /* CMSRPSESSIONIMPLEMENTATION_H_ */
       
   166 
       
   167 // End of file