diff -r 000000000000 -r bde4ae8d615e os/persistentdata/traceservices/tracefw/ulogger/src/pluginframework/outputframework.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/persistentdata/traceservices/tracefw/ulogger/src/pluginframework/outputframework.cpp Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,84 @@ +// Copyright (c) 2007-2009 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: +// + +#include "outputframework.h" +#include "uloggeroutputplugin.h" // MOutputPlugin, ... + + +namespace Ulogger +{ +/** Static Factory Construction +@param aOutputPlugin the output plugin reference. This plugin will be used to send data. +@return a pointer to the created object +@leave KErrNoMemory if not enough memory available +*/ +EXPORT_C COutputFramework* COutputFramework::NewL(MOutputPlugin& aOutputPlugin, const RPointerArray& aOutputSettings) + { + COutputFramework* me = new (ELeave) COutputFramework(aOutputPlugin); + CleanupStack::PushL(me); + me->ConstructL(aOutputSettings); + CleanupStack::Pop(); + return me; + } + +/** +Public Destructor +*/ +EXPORT_C COutputFramework::~COutputFramework() + { + iOutputPlugin.CloseOutputPlugin(); + iOutputSettings.ResetAndDestroy(); + iOutputSettings.Close(); + } + +/*!This function send data trough active output channel. +@param aData reference to data +@return KErrNone if successfull otherwise Symbian OS error code +*/ +EXPORT_C TInt COutputFramework::SendData(const TDesC8& aData) + { + return iOutputPlugin.Write(aData); + } + +//Default constructor +COutputFramework::COutputFramework(MOutputPlugin& aOutputPlugin) +: iOutputPlugin(aOutputPlugin) + { + } + +//Second stage constructL function +//This will create a local mutex and initialize all the channels +void COutputFramework::ConstructL(const RPointerArray& aOutputSettings) + { + //copy settings + for(TInt i=0; iSetKey(aOutputSettings[i]->Key()); + pluginConfig->SetValue(aOutputSettings[i]->Value()); + iOutputSettings.AppendL(pluginConfig); + } + + User::LeaveIfError(iOutputPlugin.ConfigureOutputPlugin(iOutputSettings)); + } + +/**Unconfigure active output channel and release all locked resources. +*/ +EXPORT_C void COutputFramework::ReleaseOutputResources() + { + iOutputPlugin.CloseOutputPlugin(); + } + +} // namespace