sysstatemgmt/systemstatemgr/sus/src/suspluginframe.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-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 #include <ssm/ssmutility.h>
       
    17 #include "suspluginframe.h"
       
    18 #include "ssmdebug.h"
       
    19 #include "suspanic.h"
       
    20 
       
    21 /**
       
    22  */
       
    23 typedef MSsmUtility* (*TFuncNewL)(void);
       
    24 
       
    25 /**
       
    26  */
       
    27 CSusPluginFrame::CSusPluginFrame()
       
    28  	{
       
    29  	}
       
    30 
       
    31 /**
       
    32  */
       
    33 CSusPluginFrame* CSusPluginFrame::NewL(TLibraryFunction aNewLFunc, TInt32 aNewLOrdinal)
       
    34  	{
       
    35  	CSusPluginFrame* self = new (ELeave) CSusPluginFrame();
       
    36  	CleanupStack::PushL(self);
       
    37  	self->ConstructL(aNewLFunc, aNewLOrdinal);
       
    38  	CleanupStack::Pop(self);
       
    39  	return self;
       
    40  	}
       
    41 
       
    42 /**
       
    43 */
       
    44 void CSusPluginFrame::ConstructL(TLibraryFunction aNewLFunc, TInt32 aNewLOrdinal)
       
    45  	{
       
    46  	TFuncNewL newL = reinterpret_cast<TFuncNewL>( aNewLFunc );
       
    47  	iPlugin = newL();
       
    48  	iNewLOrdinal = aNewLOrdinal;
       
    49  	SSMLOGLEAVEIFNULL(iPlugin);
       
    50  	}
       
    51 
       
    52 /**
       
    53  */
       
    54  CSusPluginFrame::~CSusPluginFrame() 
       
    55   	{
       
    56   	Release();
       
    57   	iPlugin = NULL;
       
    58  	if(KNullHandle != iLibrary.Handle())
       
    59  		{
       
    60  		//release the dll
       
    61 		iLibrary.Close(); 
       
    62  		}
       
    63   	}
       
    64 
       
    65 /**
       
    66  */	
       
    67 void CSusPluginFrame::SetLibrary(RLibrary& aLibrary)
       
    68 	{
       
    69 	iLibrary = aLibrary;
       
    70 	}
       
    71 
       
    72 /**
       
    73  */	
       
    74 void CSusPluginFrame::InitializeL()
       
    75 	{
       
    76 	__ASSERT_ALWAYS(iPlugin, User::Panic(KPanicSsmSus, EPluginFrameError1));
       
    77  	iPlugin->InitializeL();
       
    78 	}
       
    79 
       
    80 /**
       
    81  */	
       
    82 void CSusPluginFrame::StartL()
       
    83 	{
       
    84 	__ASSERT_ALWAYS(iPlugin, User::Panic(KPanicSsmSus, EPluginFrameError2));
       
    85  	iPlugin->StartL();
       
    86 	}
       
    87 
       
    88 /**
       
    89  */	
       
    90 void CSusPluginFrame::Release()
       
    91 	{
       
    92 	if(iPlugin)
       
    93  		{
       
    94  		iPlugin->Release();
       
    95  		iPlugin = NULL;
       
    96  		}
       
    97 	}
       
    98 
       
    99 /**
       
   100  */
       
   101 TFileName CSusPluginFrame::FileName() const
       
   102 	{
       
   103 	return iLibrary.FileName();
       
   104 	}
       
   105 
       
   106 TInt CSusPluginFrame::NewLOrdinal() const
       
   107 	{
       
   108 	return iNewLOrdinal;
       
   109 	}
       
   110