multimediacommsengine/mmcecli/src/mcemediastream.cpp
branchrcs
changeset 49 64c62431ac08
parent 0 1bce908db942
equal deleted inserted replaced
44:fb024d5e35fa 49:64c62431ac08
    27 #include "mcefactory.h"
    27 #include "mcefactory.h"
    28 #include "mceserial.h"
    28 #include "mceserial.h"
    29 #include "mceevents.h"
    29 #include "mceevents.h"
    30 #include "mceclilogs.h"
    30 #include "mceclilogs.h"
    31 #include "mcesessionobserver.h"
    31 #include "mcesessionobserver.h"
       
    32 #include "mcefilesharingobserver.h"
    32 
    33 
    33 #define _FLAT_DATA static_cast<CMceComMediaStream*>( iFlatData )
    34 #define _FLAT_DATA static_cast<CMceComMediaStream*>( iFlatData )
    34 #define FLAT_DATA( data ) _FLAT_DATA->data
    35 #define FLAT_DATA( data ) _FLAT_DATA->data
    35 
    36 
    36 // ============================ MEMBER FUNCTIONS ===============================
    37 // ============================ MEMBER FUNCTIONS ===============================
   950             {
   951             {
   951             observer->RRReceived( *iSession, *this );
   952             observer->RRReceived( *iSession, *this );
   952             }
   953             }
   953         status = KMceEventConsumed;
   954         status = KMceEventConsumed;
   954         }
   955         }
   955     else if ( aEvent.Action() == EMceItcLinkCreated )
   956     else if (aEvent.Action() == EMceItcFileSendCompleted )
   956         {
   957         {
   957         MCECLI_DEBUG("CMceMediaStream::HandleEvent, link created");
   958         // state will be changed automatically so send state change event
   958         _FLAT_DATA->SetLocalMediaPort( aEvent.ActionData() );
   959         MCECLI_DEBUG("CMceMediaStream::HandleEvent, media state changed");
       
   960         SetState( static_cast<CMceMediaStream::TState>( aEvent.ActionData() ) );
       
   961             
       
   962         if ( !HandleMediaError( FLAT_DATA( iState ), 
       
   963                 FLAT_DATA( iIsEnabled ), 
       
   964                 aEvent.Id().iStatus ) )
       
   965             {
       
   966             Updated();
       
   967             }
       
   968     
       
   969         MCECLI_DEBUG("CMceMediaStream::HandleEvent, EMceItcFileSendCompleted  received");
       
   970         MMceFileSharingObserver* observer = iSession->Manager().FileSharingObserver();
       
   971         if (observer )
       
   972             {
       
   973             observer->SendFileCompleted(aEvent.Id().iStatus);
       
   974             }
   959         status = KMceEventConsumed;
   975         status = KMceEventConsumed;
   960         }
   976         }
   961     else
   977     else if (aEvent.Action() == EMceFileSendInProgress )
   962         {
   978         {
   963         //NOP
   979         // state will be changed automatically so send state change event
   964         MCECLI_DEBUG("CMceMediaStream::HandleEvent, not consumed");
   980         MCECLI_DEBUG("CMceMediaStream::HandleEvent, media state changed");
   965         }    
   981         SetState( static_cast<CMceMediaStream::TState>( aEvent.ActionData() ) );
       
   982                          
       
   983         if ( !HandleMediaError( FLAT_DATA( iState ), 
       
   984                 FLAT_DATA( iIsEnabled ), 
       
   985                 aEvent.Id().iStatus ) )
       
   986             {
       
   987             Updated();
       
   988             }        
       
   989         
       
   990         MCECLI_DEBUG("CMceMediaStream::HandleEvent, EMceFileSendInProgress  received");
       
   991         MMceFileSharingObserver* observer = iSession->Manager().FileSharingObserver();
       
   992         if (observer )
       
   993             {
       
   994             observer->SendFileProgressNotification(aEvent.Id().iSpare1, aEvent.Id().iSpare2);
       
   995             }
       
   996         status = KMceEventConsumed;
       
   997         }
       
   998     else if (aEvent.Action() == EMceItcFileReceiveCompleted )
       
   999         {
       
  1000         // state will be changed automatically so send state change event
       
  1001         MCECLI_DEBUG("CMceMediaStream::HandleEvent, media state changed");
       
  1002         SetState( static_cast<CMceMediaStream::TState>( aEvent.ActionData() ) );
       
  1003                                     
       
  1004         if ( !HandleMediaError( FLAT_DATA( iState ), 
       
  1005                 FLAT_DATA( iIsEnabled ), 
       
  1006                 aEvent.Id().iStatus ) )
       
  1007             {
       
  1008             Updated();
       
  1009             }
       
  1010         
       
  1011         MCECLI_DEBUG("CMceMediaStream::HandleEvent, EMceItcFileReceiveCompleted  received");
       
  1012         MMceFileSharingObserver* observer = iSession->Manager().FileSharingObserver();
       
  1013         if (observer )
       
  1014             {
       
  1015             observer->ReceiveFileCompleted(aEvent.Id().iStatus);
       
  1016             }
       
  1017         status = KMceEventConsumed;
       
  1018         }
       
  1019         else if (aEvent.Action() == EMceFileReceiveInProgress )
       
  1020             {
       
  1021             // state will be changed automatically so send state change event
       
  1022             MCECLI_DEBUG("CMceMediaStream::HandleEvent, media state changed");
       
  1023             SetState( static_cast<CMceMediaStream::TState>( aEvent.ActionData() ) );
       
  1024                                 
       
  1025             if ( !HandleMediaError( FLAT_DATA( iState ), 
       
  1026                     FLAT_DATA( iIsEnabled ), 
       
  1027                     aEvent.Id().iStatus ) )
       
  1028                 {
       
  1029                 Updated();
       
  1030                 }
       
  1031             
       
  1032             MCECLI_DEBUG("CMceMediaStream::HandleEvent, EMceFileReceiveInProgress  received");
       
  1033             MMceFileSharingObserver* observer = iSession->Manager().FileSharingObserver();
       
  1034             if (observer )
       
  1035                 {
       
  1036                 observer->ReceiveFileProgressNotification(aEvent.Id().iSpare1, aEvent.Id().iSpare2);
       
  1037                 }
       
  1038             status = KMceEventConsumed;
       
  1039             }
       
  1040         else if ( aEvent.Action() == EMceItcLinkCreated )
       
  1041             {
       
  1042             MCECLI_DEBUG("CMceMediaStream::HandleEvent, link created");
       
  1043             _FLAT_DATA->SetLocalMediaPort( aEvent.ActionData() );
       
  1044             status = KMceEventConsumed;
       
  1045             }
       
  1046         else
       
  1047             {
       
  1048             //NOP
       
  1049             MCECLI_DEBUG("CMceMediaStream::HandleEvent, not consumed");
       
  1050             }    
   966         
  1051         
   967     MCECLI_DEBUG_DVALUE("CMceMediaStream::HandleEvent, Exit. status", status );
  1052     MCECLI_DEBUG_DVALUE("CMceMediaStream::HandleEvent, Exit. status", status );
   968     
  1053     
   969     return status;
  1054     return status;
   970     }
  1055     }