uiacceltk/hitchcock/plugins/alfcrpplugin/src/alfcrpplugin.cpp
branchRCL_3
changeset 3 d8a3531bc6b8
equal deleted inserted replaced
0:15bf7259bb7c 3:d8a3531bc6b8
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Alf CRP ECOM plugin
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <bldvariant.hrh>
       
    20 
       
    21 #include "alfcrpplugin.h"
       
    22 #include <ecom/implementationproxy.h>
       
    23 #include <s32mem.h> //RDesReadStream
       
    24 
       
    25 #include "alfsynchronizer.h"
       
    26 #include "alfrenderstageutils.h"
       
    27 
       
    28 // CONSTANTS
       
    29 const TInt KImpId( 0x2002C358 );
       
    30 const TInt KAlfCrpSynchronize = 0;
       
    31 
       
    32 // --------------------------------------------------------------------------
       
    33 // CAlfCrpPlugin::CreateL
       
    34 // --------------------------------------------------------------------------
       
    35 //
       
    36 CWsGraphicDrawer* CAlfCrpPlugin::CreateL()
       
    37     {
       
    38     CAlfCrpPlugin* crp = new (ELeave) CAlfCrpPlugin();
       
    39     return crp;
       
    40     }
       
    41 
       
    42 // --------------------------------------------------------------------------
       
    43 // CAlfCrpPlugin::~CAlfCrpPlugin
       
    44 // --------------------------------------------------------------------------
       
    45 //    
       
    46 CAlfCrpPlugin::~CAlfCrpPlugin()    
       
    47     {
       
    48     }
       
    49 
       
    50 // --------------------------------------------------------------------------
       
    51 // CAlfCrpPlugin::DoDraw
       
    52 // --------------------------------------------------------------------------
       
    53 //
       
    54 void CAlfCrpPlugin::DoDraw( MWsGc& /*aGc*/, const TRect& /*aRect*/, 
       
    55     const TDesC8& /*aData*/) const
       
    56     {
       
    57     // Draws nothing
       
    58     }
       
    59 
       
    60 // --------------------------------------------------------------------------
       
    61 // CAlfCrpPlugin::HandleMessage
       
    62 // --------------------------------------------------------------------------
       
    63 //    
       
    64 void CAlfCrpPlugin::HandleMessage( const TDesC8& aData )
       
    65     {
       
    66     TRAP_IGNORE( DoHandleMessageL( aData ) );
       
    67     }
       
    68     
       
    69 // --------------------------------------------------------------------------
       
    70 // CAlfCrpPlugin::DoHandleMessageL
       
    71 // --------------------------------------------------------------------------
       
    72 //    
       
    73 void CAlfCrpPlugin::DoHandleMessageL( const TDesC8& aData )
       
    74     {  
       
    75     RDesReadStream in( aData );
       
    76     switch( in.ReadInt32L() )
       
    77         {
       
    78         case KAlfCrpSynchronize:
       
    79             {
       
    80             MAlfSynchronizationInterface* synchronizer = NULL;            
       
    81             if ( Env().ScreenCount() )
       
    82                 {
       
    83                 MWsScreen* screen = Env().Screen(0);
       
    84                 if ( screen )
       
    85                     {
       
    86                     synchronizer = 
       
    87                         (MAlfSynchronizationInterface*)screen->ResolveObjectInterface(
       
    88                             KAlfSynchronizationInterfaceUid);
       
    89                     }
       
    90                 }
       
    91             
       
    92             if ( synchronizer )
       
    93                 {
       
    94                 _LIT_SECURITY_POLICY_S0(KAlfSynchronizerPolicy, 0x10003B20);
       
    95                 RProperty::Define( KAlfPSUidSynchronizer, KAlfPSKeySynchronizer, RProperty::EInt, KAlfSynchronizerPolicy, KAlfSynchronizerPolicy );
       
    96                 RProperty::Set( KAlfPSUidSynchronizer, KAlfPSKeySynchronizer, 0 );
       
    97                     
       
    98                 CAlfSynchronizer* synch = CAlfSynchronizer::NewL();
       
    99                 CleanupStack::PushL( synch );
       
   100                 TInt syncId = 0;
       
   101                 synchronizer->Synchronize(syncId);
       
   102                 synch->Start( syncId );
       
   103                             
       
   104                 CleanupStack::PopAndDestroy( synch );
       
   105                 }
       
   106             }
       
   107             break;
       
   108         default:
       
   109             break;
       
   110         }
       
   111     }
       
   112 
       
   113 // --------------------------------------------------------------------------
       
   114 // CAlfCrpPlugin::ConstructL
       
   115 // --------------------------------------------------------------------------
       
   116 //    
       
   117 void CAlfCrpPlugin::ConstructL( MWsGraphicDrawerEnvironment& aEnv,
       
   118     const TGraphicDrawerId& aId, MWsClient& aOwner, const TDesC8& /*aData*/ )
       
   119     {
       
   120     BaseConstructL( aEnv, aId, aOwner );
       
   121 
       
   122     ShareGlobally();
       
   123     }
       
   124 
       
   125 // --------------------------------------------------------------------------
       
   126 // KImplementationTable
       
   127 // --------------------------------------------------------------------------
       
   128 //    
       
   129 LOCAL_C const TImplementationProxy KImplementationTable[] = 
       
   130     {
       
   131     IMPLEMENTATION_PROXY_ENTRY(KImpId, CAlfCrpPlugin::CreateL)
       
   132     };
       
   133 
       
   134 // --------------------------------------------------------------------------
       
   135 // ImplementationGroupProxy
       
   136 // --------------------------------------------------------------------------
       
   137 //    
       
   138 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
   139     {
       
   140     aTableCount = (sizeof(KImplementationTable) / sizeof(TImplementationProxy));
       
   141     return KImplementationTable;
       
   142     }
       
   143 
       
   144 // End of file