diff -r 000000000000 -r b497e44ab2fc syncmlfw/syncmlnotifier/src/SyncMLNotifierMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/syncmlfw/syncmlnotifier/src/SyncMLNotifierMain.cpp Thu Dec 17 09:07:52 2009 +0200 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Methods for the SyncML Appserver starter notifier +* +*/ + + + +// INCLUDE FILES +#include + +// All provided notifiers +#include "SyncMLAppLaunchNotifier.h" +#include "SyncMLDlgNotifier.h" +#include "SyncMLFwUpdNotifier.h" + +#include "SyncMLNotifDebug.h" + +// CONSTANTS + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CleanupArray +// Deletes notifiers +// ----------------------------------------------------------------------------- +LOCAL_C void CleanupArray( TAny* aArray ) + { + FLOG(_L("[SmlNotif]\t CleanupArray()")); + + CArrayPtrFlat* + subjects = static_cast*>(aArray); + TInt lastInd = subjects->Count() - 1; + for ( TInt i = lastInd; i >= 0; i-- ) + { + subjects->At(i)->Release(); + } + delete subjects; + + FLOG(_L("[SmlNotif]\t CleanupArray() completed")); + } + +// ----------------------------------------------------------------------------- +// CreateSmlNotifiersL +// Instantiate notifiers +// ----------------------------------------------------------------------------- +LOCAL_C CArrayPtrFlat* CreateSmlNotifiersL() + { + FLOG(_L("[SmlNotif]\t CreateSmlNotifiersL")); + + CArrayPtrFlat* notifiers = + new ( ELeave ) CArrayPtrFlat + ( KSmlNotifierArrayIncrement ); + + CleanupStack::PushL( TCleanupItem( CleanupArray, notifiers ) ); + + CSyncMLAppLaunchNotifier* appLaunchNotifier = CSyncMLAppLaunchNotifier::NewL(); + CleanupStack::PushL( appLaunchNotifier ); + notifiers->AppendL( appLaunchNotifier ); + CleanupStack::Pop( appLaunchNotifier ); + + CSyncMLDlgNotifier* dlgNotifier = CSyncMLDlgNotifier::NewL( appLaunchNotifier ); + CleanupStack::PushL( dlgNotifier ); + notifiers->AppendL( dlgNotifier ); + CleanupStack::Pop( dlgNotifier ); + + CSyncMLFwUpdNotifier* fwUpdNotifier = CSyncMLFwUpdNotifier::NewL(); + CleanupStack::PushL( fwUpdNotifier ); + notifiers->AppendL( fwUpdNotifier ); + CleanupStack::Pop( fwUpdNotifier ); + + CleanupStack::Pop( notifiers ); + + FLOG(_L("[SmlNotif]\t CreateSmlNotifiersL completed")); + return notifiers; + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// NotifierArray +// Lib main entry point: Creates a notifiers array. +// ----------------------------------------------------------------------------- +EXPORT_C CArrayPtr* NotifierArray() + { + FLOG( _L("[SMLNOTIF]\t NotifierArray") ); + + CArrayPtrFlat* notifiers = NULL; + TRAPD( err, notifiers = CreateSmlNotifiersL() ); + + if( err != KErrNone ) + { + FTRACE(FPrint(_L("[SmlNotif]\t Notifier creation failure! Error code: %d"), err)); + err = KErrNone; + } + + FLOG(_L("[SmlNotif]\t NotifierArray completed")); + + return notifiers; + } + +// End of File