multimediacommscontroller/mmccsubcontroller/src/msrpcallbackmgrobserver.cpp
branchrcs
changeset 49 64c62431ac08
child 50 1d8943dd8be6
equal deleted inserted replaced
44:fb024d5e35fa 49:64c62431ac08
       
     1 /*
       
     2 * Copyright (c) 2004-2008 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 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    UL/DL Session abstraction for Mcc Subthread clients
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "msrpcallbackmgrobserver.h"
       
    20 #include "mccsubcontrollerlogs.h"
       
    21 #include <e32base.h>
       
    22 #include "mccinternalevents.h"
       
    23 #include "mmcccodecinformation.h"
       
    24 
       
    25 CMsrpCallbackMgrObserver* CMsrpCallbackMgrObserver::NewL(MAsyncEventHandler& aEventHandler)
       
    26 	{
       
    27     CMsrpCallbackMgrObserver* self = new(ELeave) CMsrpCallbackMgrObserver(aEventHandler);
       
    28     CleanupStack::PushL( self );
       
    29     self->ConstructL();
       
    30     CleanupStack::Pop( self );
       
    31     return self;
       
    32 	}
       
    33 
       
    34 
       
    35 void CMsrpCallbackMgrObserver::ConstructL()
       
    36     {
       
    37     
       
    38     }
       
    39 
       
    40 
       
    41 CMsrpCallbackMgrObserver::CMsrpCallbackMgrObserver(
       
    42     MAsyncEventHandler& aEventHandler) : 
       
    43     iEventHandler( aEventHandler )
       
    44     {
       
    45     iDataObserver = NULL;
       
    46     iConnObserver = NULL;
       
    47     }
       
    48 
       
    49 // ============================= LOCAL FUNCTIONS ===============================
       
    50 
       
    51 void CMsrpCallbackMgrObserver::IncomingMessage( HBufC8* aMessageContent, TInt aStatus )
       
    52     {
       
    53     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::IncomingMessage" )
       
    54     
       
    55     if(iDataObserver)
       
    56         {
       
    57         iDataObserver->IncomingMessage(aMessageContent,aStatus);
       
    58         }
       
    59     }
       
    60     
       
    61 void CMsrpCallbackMgrObserver::IncomingReport( TInt aStatus, TInt aRangeStart,
       
    62                                            TInt aRangeEnd, TInt aTotal )
       
    63 	{
       
    64     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::IncomingReport" )
       
    65             
       
    66     if(iDataObserver)
       
    67         {
       
    68         iDataObserver->IncomingReport( aStatus, aRangeStart, aRangeEnd,  aTotal );
       
    69         }
       
    70 	}
       
    71     
       
    72 void CMsrpCallbackMgrObserver::SendResult( TInt aStatus, const TDesC8& aMessageid )
       
    73 	{
       
    74     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::SendResult" )
       
    75             
       
    76     if(iDataObserver)
       
    77         {
       
    78         iDataObserver->SendResult(aStatus, aMessageid );
       
    79         }
       
    80 	}
       
    81     
       
    82 void CMsrpCallbackMgrObserver::ListenPortFailure( TInt aStatus )
       
    83 	{
       
    84     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::ListenPortFailure" )
       
    85             
       
    86     if(iDataObserver)
       
    87         {
       
    88         iDataObserver->ListenPortFailure(aStatus);
       
    89         }
       
    90 	}
       
    91     
       
    92 void CMsrpCallbackMgrObserver::ConnectStatus( TInt aStatus )
       
    93 	{
       
    94     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::ConnectStatus" )
       
    95             
       
    96     if(iConnObserver)    
       
    97         {
       
    98         iConnObserver->ConnectStatus(aStatus);
       
    99         }
       
   100 	}
       
   101 		
       
   102 void CMsrpCallbackMgrObserver::RegisterConnectionObserver (MMsrpConnectionObserver& aObserver)
       
   103 	{
       
   104     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::RegisterConnectionObserver" )
       
   105 	iConnObserver = &aObserver;
       
   106 	}
       
   107 		
       
   108 		
       
   109 void CMsrpCallbackMgrObserver::RegisterDataObserver (MMsrpDataObserver& aObserver)
       
   110 	{
       
   111     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::RegisterDataObserver" )
       
   112 	iDataObserver = &aObserver;
       
   113 	}
       
   114 
       
   115 //
       
   116 //
       
   117 //
       
   118 void CMsrpCallbackMgrObserver::SendFileNotification(TBool aStatus)
       
   119     {
       
   120     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::SendFileNotification : Entry" )
       
   121     iMccEvent = TMccEvent();
       
   122     
       
   123     iMccEvent.iEndpointId = KErrNone;
       
   124     iMccEvent.iEventCategory = 0;
       
   125     iMccEvent.iEventType = KMccFileSendCompleted;
       
   126     iMccEvent.iErrorCode = (TInt)aStatus;
       
   127     iMccEvent.iEventNumData = 0;
       
   128     
       
   129     TMccInternalEvent internalEvent( KUidMediaTypeMessage, 
       
   130                                              EMccInternalEventNone,
       
   131                                              iMccEvent );
       
   132     iEventHandler.SendEventToClient(internalEvent);
       
   133     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::SendFileNotification : Exit" )
       
   134     }
       
   135 
       
   136 /* Notifies that the entire file has been received successfully */
       
   137 void CMsrpCallbackMgrObserver::ReceiveFileNotification(TBool status)
       
   138     {
       
   139     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::ReceiveFileNotification : Entry" )
       
   140     iMccEvent = TMccEvent();
       
   141     
       
   142     iMccEvent.iEndpointId = KErrNone;
       
   143     iMccEvent.iEventCategory = 0;
       
   144     iMccEvent.iEventType = KMccFileReceiveCompleted;
       
   145     iMccEvent.iErrorCode = (TInt)status;
       
   146     iMccEvent.iEventNumData = 0;
       
   147     
       
   148     TMccInternalEvent internalEvent( KUidMediaTypeMessage, 
       
   149                                              EMccInternalEventNone,
       
   150                                              iMccEvent );
       
   151     iEventHandler.SendEventToClient(internalEvent);
       
   152     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::ReceiveFileNotification : Exit" )
       
   153     }
       
   154 /**
       
   155 * File data transfer progress. returns the progress of data transfer
       
   156 * @param aTransferred number of bytes transferred
       
   157 * @param aTotal Total amount of bytes to be transferred
       
   158 */
       
   159 void CMsrpCallbackMgrObserver::FileSendProgress( TInt aTransferred, TInt aTotal )
       
   160     {
       
   161     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::FileSendProgress : Entry" )
       
   162     iMccEvent = TMccEvent();
       
   163     
       
   164     iMccEvent.iEndpointId = KErrNone;
       
   165     iMccEvent.iEventCategory = 0;
       
   166     iMccEvent.iEventType = KMccFileSendProgressNotification;
       
   167     iMccEvent.iErrorCode = (TInt)aTransferred;
       
   168     iMccEvent.iEventNumData = aTotal;
       
   169     
       
   170     TMccInternalEvent internalEvent( KUidMediaTypeMessage, 
       
   171                                              EMccInternalEventNone,
       
   172                                              iMccEvent );
       
   173     iEventHandler.SendEventToClient(internalEvent);
       
   174     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::FileSendProgress : Exit" )
       
   175     
       
   176     }
       
   177 
       
   178 /**
       
   179 * File receive progress, number of bytes received from incoming data
       
   180 * @param aReceived number of bytes received
       
   181 * @param aTotal Total amount of bytes to be received
       
   182 */
       
   183 void CMsrpCallbackMgrObserver::FileReceiveProgress( TInt aReceived, TInt aTotal )
       
   184     {
       
   185     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::FileReceiveProgress : Entry" )
       
   186     iMccEvent = TMccEvent();
       
   187     
       
   188     iMccEvent.iEndpointId = KErrNone;
       
   189     iMccEvent.iEventCategory = 0;
       
   190     iMccEvent.iEventType = KMccFileReceiveProgressNotification;
       
   191     iMccEvent.iErrorCode = (TInt)aReceived;
       
   192     iMccEvent.iEventNumData = aTotal;
       
   193     
       
   194     TMccInternalEvent internalEvent( KUidMediaTypeMessage, EMccInternalEventNone, iMccEvent );
       
   195     iEventHandler.SendEventToClient(internalEvent);
       
   196     __SUBCONTROLLER( "CMsrpCallbackMgrObserver::FileReceiveProgress : Exit" )
       
   197     }