sysstatemgmt/systemstarter/src/amastarter.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2006-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 #include "amastarter.h"
       
    18 #include <ssm/ssmloadamastart.h>
       
    19 #include "ssmdebug.h"
       
    20 
       
    21 /*
       
    22 loadamastart.dll will load amastart.dll.
       
    23 loadamastart.dll is common symbian component which is used to
       
    24 remove the dependency on MW layer.
       
    25  * 
       
    26  */
       
    27 
       
    28 _LIT( KAmaStartDLL, "loadamastart.dll" );
       
    29 typedef CSsmLoadAmaStart* (*TFuncCreateAmaStartL)(void);
       
    30 
       
    31 CAmaStarter* CAmaStarter::NewL(const TUid aDscId)
       
    32 	{
       
    33 	CAmaStarter* self = new(ELeave) CAmaStarter(aDscId);
       
    34 	return self;
       
    35 	}
       
    36 
       
    37 void CAmaStarter::Execute(TRequestStatus& aCallerStatus)
       
    38 	{
       
    39 	TRAPD(err, DoExecuteL());
       
    40 	
       
    41 	TRequestStatus* statusValue = &aCallerStatus;
       
    42 	User::RequestComplete(statusValue, err); 
       
    43 	}
       
    44 
       
    45 /*
       
    46 All the AMAs are loaded from the DSC that corresponds to the iDscId
       
    47 */
       
    48 void CAmaStarter::DoExecuteL()
       
    49 	{
       
    50 	LoadAmaStartLibraryL();
       
    51 	iAmaStart->StartL(iDscId); // even if StartL doesn't leave, it does not mean all AMAs have been started correctly
       
    52 	}
       
    53 
       
    54 CAmaStarter::~CAmaStarter()
       
    55 	{
       
    56 	delete iAmaStart;
       
    57     iAmaStartLib.Close();
       
    58 	}
       
    59 
       
    60 CAmaStarter::CAmaStarter(TUid aDscId) 
       
    61 	:iDscId(aDscId)
       
    62 	{
       
    63 	}
       
    64 
       
    65 void CAmaStarter::Release() 
       
    66 	{
       
    67 	delete this;
       
    68 	}
       
    69 
       
    70 /**
       
    71 Load loadamastart.dll
       
    72 */
       
    73 void CAmaStarter::LoadAmaStartLibraryL()
       
    74     {
       
    75     SSMLOGLEAVEIFERROR(iAmaStartLib.Load(KAmaStartDLL));
       
    76     TFuncCreateAmaStartL amaStart = reinterpret_cast<TFuncCreateAmaStartL>(iAmaStartLib.Lookup(1));
       
    77     SSMLOGLEAVEIFTRUE(amaStart == NULL, KErrArgument);
       
    78     iAmaStart = amaStart();
       
    79     SSMLOGLEAVEIFNULL(iAmaStart);
       
    80     }
       
    81