diff -r 000000000000 -r 2f259fa3e83a uifw/AknGlobalUI/AknDynamicSoftNote/src/AknDynamicNotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uifw/AknGlobalUI/AknDynamicSoftNote/src/AknDynamicNotifier.cpp Tue Feb 02 01:00:49 2010 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2008 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: RNotifier handler for dynamic soft notifications. +* +*/ + +#include "AknDynamicNotifier.h" +#include +#include +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#else +#include +#include +#endif + +//----------------------------------------------------------------------------- +// RDynNotifier::Connect +//----------------------------------------------------------------------------- +// +TInt RDynNotifier::Connect() + { + TInt ret = KErrNone; + if ( Handle() == NULL) + { + _LIT(KServerNameFormat, "%08x_%08x_AppServer"); + TFullName serverName; + TUid serviceUid = KAknNotifierServiceUid; + serverName.Format(KServerNameFormat, KUikonUidPluginInterfaceNotifiers, KAknCapServerUid); + ret = CreateSession(serverName,*reinterpret_cast(&serviceUid)); + } + return ret; + } + +//----------------------------------------------------------------------------- +// CAknDynamicNotifier::~CAknDynamicNotifier +//----------------------------------------------------------------------------- +// +CAknDynamicNotifier::~CAknDynamicNotifier() + { + if( iStarted ) + { + iNotify.CancelNotifier( iUid ); + } + iNotify.Close(); + } + +//----------------------------------------------------------------------------- +// CAknDynamicNotifier::CAknDynamicNotifier +//----------------------------------------------------------------------------- +// +CAknDynamicNotifier::CAknDynamicNotifier( TUid aUid ) : + iUid( aUid ) + { + } + +//----------------------------------------------------------------------------- +// CAknDynamicNotifier::StartOrUpdate +//----------------------------------------------------------------------------- +// +TInt CAknDynamicNotifier::StartOrUpdate( + const TDesC8& aBuffer, + TDes8& aResponse ) + { + TInt err = iNotify.Connect(); + if( !err ) + { + if( !iStarted ) + { + err = iNotify.StartNotifier( iUid, aBuffer, aResponse ); + if( !err ) + { + iStarted = ETrue; + } + } + else + { + err = iNotify.UpdateNotifier( iUid, aBuffer, aResponse ); + } + } + + return err; + } + +//----------------------------------------------------------------------------- +// CAknDynamicNotifier::StartOrUpdate +//----------------------------------------------------------------------------- +// +TInt CAknDynamicNotifier::StartOrUpdate( + TRequestStatus& aStatus, + const TDesC8& aBuffer, + TDes8& aResponse) + { + TInt err = iNotify.Connect(); + if( !err ) + { + iStarted = ETrue; + iNotify.StartNotifierAndGetResponse( aStatus, iUid, aBuffer, aResponse ); + } + return err; + } + + +// End of File