accessoryservices/accessoryremotecontrol/tsrc/remcontestcontrol/remcontestcontrolplugin/src/remconsync.cpp
changeset 0 4e1aa6a622a0
child 41 c87e5f80c17d
child 60 ccb4f6b3db21
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "remconcontrol.h"
       
    21 #include "remconactive.h"
       
    22 #include "siftrace.h"
       
    23 #include "remconsync.h"
       
    24 
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // 
       
    28 // 
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 CRemConSync::CRemConSync()
       
    32     {    
       
    33      iError = KErrNone;
       
    34      iEvent     = ETFRemConEvent_None;
       
    35      iParameter = KErrNone;	
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // 
       
    40 // 
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 void CRemConSync::ConstructL( CRemConInterfaceSelector* aTargetInterfaceSelector )
       
    44     {
       
    45     iSync = CRemConSynchronizationTarget::NewL( *aTargetInterfaceSelector, *this );
       
    46     iActive = CRemConActive::NewL( *this );
       
    47 	}
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // 
       
    51 // 
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CRemConSync* CRemConSync::NewL( CRemConInterfaceSelector* aTargetInterfaceSelector )
       
    55     {
       
    56     CRemConSync* self = new( ELeave ) CRemConSync();
       
    57     CleanupStack::PushL( self );
       
    58     self->ConstructL( aTargetInterfaceSelector );
       
    59     CleanupStack::Pop();
       
    60     return self;
       
    61     }
       
    62  
       
    63 // -----------------------------------------------------------------------------
       
    64 // 
       
    65 // 
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 CRemConSync::~CRemConSync()
       
    69     {
       
    70     delete iActive;
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // 
       
    75 // 
       
    76 // 
       
    77 // -----------------------------------------------------------------------------
       
    78 void CRemConSync::CompleteResponse( const TInt aError )
       
    79     {
       
    80 		if(aError != KErrNone)
       
    81 	    {
       
    82     	COMPONENT_TRACE( ( _L( "REMCONTESTCONTROL -  CRemConSync::CompleteResponse( %d)" ), aError) );
       
    83     	}
       
    84     	else
       
    85     	{
       
    86     	MRemConControl* aControl = GetRemConControl();
       
    87     	aControl->CompleteKeyEventResponse( iEvent, iParameter, aError );	
       
    88     	}	
       
    89      
       
    90      iEvent     = ETFRemConEvent_None;
       
    91      iParameter = KErrNone;	
       
    92 	}
       
    93 // -----------------------------------------------------------------------------
       
    94 // 
       
    95 // 
       
    96 // -----------------------------------------------------------------------------
       
    97 //	
       
    98 void CRemConSync::Synchronize()
       
    99 {
       
   100     iEvent = ETFRemConEvent_Sync;
       
   101     iParameter = KErrNone;
       
   102     MRemConControl* aControl = GetRemConControl();
       
   103 	aControl->NotifyKeyEvent(iEvent, iParameter);
       
   104 }
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // 
       
   108 // 
       
   109 // -----------------------------------------------------------------------------
       
   110 //	   
       
   111 void CRemConSync::SynchronizeResponse()
       
   112     {
       
   113 		iSync->SynchronizeResponse(iActive->iStatus, iError);
       
   114 		iActive->iStatus = KRequestPending;
       
   115 		iActive->SetActive();
       
   116 	}
       
   117    
       
   118 void CRemConSync::GetCommandSourceInfo(TRemConExtCmdSource& aSource)
       
   119     {
       
   120     iSync->GetCommandSourceInfo( aSource );
       
   121     }