os/persistentdata/traceservices/tracefw/ulogger/src/pluginframework/outputframework.cpp
Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "outputframework.h"
17 #include "uloggeroutputplugin.h" // MOutputPlugin, ...
22 /** Static Factory Construction
23 @param aOutputPlugin the output plugin reference. This plugin will be used to send data.
24 @return a pointer to the created object
25 @leave KErrNoMemory if not enough memory available
27 EXPORT_C COutputFramework* COutputFramework::NewL(MOutputPlugin& aOutputPlugin, const RPointerArray<TPluginConfiguration>& aOutputSettings)
29 COutputFramework* me = new (ELeave) COutputFramework(aOutputPlugin);
30 CleanupStack::PushL(me);
31 me->ConstructL(aOutputSettings);
39 EXPORT_C COutputFramework::~COutputFramework()
41 iOutputPlugin.CloseOutputPlugin();
42 iOutputSettings.ResetAndDestroy();
43 iOutputSettings.Close();
46 /*!This function send data trough active output channel.
47 @param aData reference to data
48 @return KErrNone if successfull otherwise Symbian OS error code
50 EXPORT_C TInt COutputFramework::SendData(const TDesC8& aData)
52 return iOutputPlugin.Write(aData);
56 COutputFramework::COutputFramework(MOutputPlugin& aOutputPlugin)
57 : iOutputPlugin(aOutputPlugin)
61 //Second stage constructL function
62 //This will create a local mutex and initialize all the channels
63 void COutputFramework::ConstructL(const RPointerArray<TPluginConfiguration>& aOutputSettings)
66 for(TInt i=0; i<aOutputSettings.Count(); ++i)
68 TPluginConfiguration* pluginConfig = new TPluginConfiguration();
69 pluginConfig->SetKey(aOutputSettings[i]->Key());
70 pluginConfig->SetValue(aOutputSettings[i]->Value());
71 iOutputSettings.AppendL(pluginConfig);
74 User::LeaveIfError(iOutputPlugin.ConfigureOutputPlugin(iOutputSettings));
77 /**Unconfigure active output channel and release all locked resources.
79 EXPORT_C void COutputFramework::ReleaseOutputResources()
81 iOutputPlugin.CloseOutputPlugin();