os/persistentdata/featuremgmt/featuremgr/test/helper/test_plugins/src/hangingplugin.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 
    17 
    18 #include "hangingplugin.h"
    19 #include <featmgr/featureinfoplugin.h>
    20 #include "featmgrdebug.h"
    21 #include "efm_test_consts.h"     
    22 #include <ecom/implementationproxy.h>
    23 #include "featmgrconfiguration.h"
    24 
    25 
    26 // Map the interface implementation UIDs to implementation factory functions
    27 const TImplementationProxy ImplementationTable[] =
    28     {
    29     IMPLEMENTATION_PROXY_ENTRY(0x102836FA,	CFeatMgrHangingPlugin::NewL),
    30     };
    31 
    32 // Exported proxy for instantiation method resolution.
    33 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
    34     {
    35     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
    36     return ImplementationTable;
    37     }
    38 
    39 CFeatMgrHangingPlugin* CFeatMgrHangingPlugin::NewL()
    40     {
    41     CFeatMgrHangingPlugin* self = new(ELeave) CFeatMgrHangingPlugin();
    42     CleanupStack::PushL(self);
    43     self->ConstructL();
    44     CleanupStack::Pop(self);
    45     return self;
    46     }
    47 
    48 CFeatMgrHangingPlugin::~CFeatMgrHangingPlugin()
    49     {
    50     }
    51 
    52 CFeatMgrHangingPlugin::CFeatMgrHangingPlugin()
    53     {
    54     }
    55 
    56 void CFeatMgrHangingPlugin::ConstructL()
    57     {
    58     }
    59     
    60 void CFeatMgrHangingPlugin::ProcessCommandL( const FeatureInfoCommand::TFeatureInfoCmd aCommandId,
    61                                       const TUint8 aTransId,
    62                                       TDesC8& /*aData*/ )
    63     {
    64     INFO_LOG2( "FeatMgr Hanging Plugin: Processing command: 0x%x, TransId: 0x%x", 
    65                          aCommandId, aTransId );
    66            
    67     switch ( aCommandId )
    68         {
    69         case FeatureInfoCommand::ELoadFeatureInfoCmdId:
    70             {
    71             INFO_LOG( "FeatMgr Hanging Plugin: Processed ELoadFeatureInfoCmdId" );
    72             // Load feature info
    73             }
    74             break;
    75         case FeatureInfoCommand::ELoadEnhancedFeatureInfoCmdId:
    76             {
    77 			INFO_LOG( "FeatMgr Hanging Plugin: extended command interface not supported");
    78 			User::Leave(KErrNotSupported);
    79             }
    80         default :
    81             {
    82             INFO_LOG1( "FeatMgr Hanging Plugin: Unknown Command: 0x%x", aCommandId );
    83             User::Leave(KErrNotSupported);
    84             }
    85             break;
    86         }
    87         
    88     TInt retval(KErrNone);
    89     TInt timeout( 1.5*KDefaultFeatMgrTimer ); // microseconds
    90 
    91     // create new timer
    92 
    93 
    94     if ( iTimer && !iTimer->IsActive() )
    95         {
    96         delete iTimer;
    97         iTimer = NULL;
    98         }
    99         
   100     iTimer = CPluginTimer::NewL(timeout, *iResponseCallback, aCommandId, aTransId, retval,this);
   101     }
   102     
   103     
   104 void CFeatMgrHangingPlugin::GenericTimerFiredL(
   105 	    MFeatureInfoPluginCallback& aService,
   106 	    FeatureInfoCommand::TFeatureInfoCmd aCommandId,
   107 	    TUint8 aTransId,
   108 	    TInt aRetVal )
   109 	    {
   110 	    CFeatMgrBasePlugin::GenericTimerFiredL(aService,aCommandId,aTransId,aRetVal);
   111 	    INFO_LOG2( "FeatMgr Hanging Plugin: GenericTimerFiredL (0x%x, 0x%x)", 
   112 	                         aCommandId, aTransId );
   113 	    
   114 	    TInt err( KErrNone );
   115 	    
   116 	    switch ( aCommandId )
   117 	        {
   118 	        case FeatureInfoCommand::ELoadFeatureInfoCmdId:
   119 	            {
   120 	            // Return some features and KErrNone.
   121 	            FeatureInfoCommand::TFeatureInfo featureList;
   122 	            TInt err( KErrNone );
   123 	            RArray<FeatureInfoCommand::TFeature> list;
   124 	            CleanupClosePushL( list );
   125 	            FeatureInfoCommand::TFeature feature1; 
   126 
   127 	            feature1.iFeatureID = KHangingPluginUid.iUid;
   128 	            feature1.iValue = ETrue;
   129 	            list.AppendL(feature1);
   130 	            
   131 	            featureList.iErrorCode = KErrNone;
   132 	            featureList.iList = list;
   133 	                
   134 	            FeatureInfoCommand::TFeatureInfoRespPckg resPackage(featureList);
   135 	            
   136 	            TRAP(err, aService.ProcessResponseL(aCommandId, aTransId, resPackage));    
   137 	            
   138 	            CleanupStack::PopAndDestroy( &list );
   139 	            break;
   140 	            }
   141 	            
   142 	        default :
   143 	            break;
   144 	        }
   145 	    
   146 	    // TEST CASES END
   147 	 
   148 	    if ( err != KErrNone )
   149 	        {
   150 	        ERROR_LOG1( "FeatMgr Plugin: Error in ProcessResponseL: %d", err );
   151 	        }	    
   152 	    }