mmsharing/livecommsui/lcui/tsrc/ipvtengine/src/mccdatasender.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
child 35 6c57ef9392d2
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
     1 /*
       
     2 * Copyright (c) 2006 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:  
       
    15 *
       
    16 */
       
    17 
       
    18         
       
    19 // INCLUDE FILES
       
    20 #include "mccdatasender.h"
       
    21 
       
    22 
       
    23 // ============================ MEMBER FUNCTIONS ===============================
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CMccDataSender::CMccDataSender
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 CMccDataSender::CMccDataSender( )
       
    30 	: CActive( EPriorityStandard )
       
    31 	{
       
    32 	CActiveScheduler::Add(this);
       
    33 	}
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CMccDataSender::ConstructL
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 void CMccDataSender::ConstructL()
       
    40     {
       
    41     TInt err = iMsgQueue.CreateGlobal(_L("IP-VT-Queue1"), 5, EOwnerProcess );
       
    42     if ( err )
       
    43         {
       
    44         User::LeaveIfError( iMsgQueue.OpenGlobal(_L("IP-VT-Queue1")));
       
    45         }
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CMccDataSender::NewL
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CMccDataSender* CMccDataSender::NewL( )
       
    53     {
       
    54     CMccDataSender* self = 
       
    55     	new ( ELeave ) CMccDataSender();
       
    56     CleanupStack::PushL( self );
       
    57     self->ConstructL();
       
    58     CleanupStack::Pop( self );
       
    59     return self;
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CMccDataSender::Send
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 void CMccDataSender::Send( const TDataMessage& aData )
       
    67 {	
       
    68     TInt err = iMsgQueue.Send( aData );
       
    69     
       
    70     if ( err == KErrOverflow )
       
    71         {
       
    72         if ( !IsActive() )
       
    73             {
       
    74             iBuffer = aData;            
       
    75             iMsgQueue.NotifySpaceAvailable( iStatus );    
       
    76     	    SetActive();
       
    77             }
       
    78         else
       
    79             {
       
    80             // TODO
       
    81             // BUFFER OR DROP
       
    82             }
       
    83         }
       
    84 	}
       
    85 	
       
    86 // -----------------------------------------------------------------------------
       
    87 // CMccDataSender::~CMccDataSender
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 CMccDataSender::~CMccDataSender()
       
    91     {
       
    92     Cancel();
       
    93 	iMsgQueue.Close();
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CMccDataSender::DoCancel
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 void CMccDataSender::DoCancel()
       
   101 	{
       
   102 	iMsgQueue.CancelSpaceAvailable();	
       
   103 	}
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CMccDataSender::RunL
       
   107 // -----------------------------------------------------------------------------
       
   108 //	
       
   109 void CMccDataSender::RunL()
       
   110 	{
       
   111     iMsgQueue.Send( iBuffer );
       
   112     iBuffer.iDataId = EUninitialized;
       
   113     }
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // CMccDataSender::RunError
       
   117 // -----------------------------------------------------------------------------
       
   118 //	
       
   119 TInt CMccDataSender::RunError(TInt /*aError*/)
       
   120 	{
       
   121 	return KErrNone;
       
   122 	}