diff -r 000000000000 -r 3553901f7fa8 telephonyserverplugins/ctsydispatchlayer/test/dispatchertests/dispatchsrc/config.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/telephonyserverplugins/ctsydispatchlayer/test/dispatchertests/dispatchsrc/config.cpp Tue Feb 02 01:41:59 2010 +0200 @@ -0,0 +1,176 @@ +// Copyright (c) 2008-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 "config.h" + +TConfig::TConfig() + { + } + +TBool TConfig::IsSupported(TInt aIpc) + { + TBool ret= ETrue; + + RFs fs; + RFile file; + + if( fs.Connect() == KErrNone) + { + if( file.Open(fs, KConfigFile, EFileRead) == KErrNone) + { + TBuf8<1000> buf; + TBuf<100> temp; + TInt bufLength=1000; + TBuf<100> ipc; + ipc.Num(aIpc); + + TBool commentFlag=EFalse; + TBool valueFlag=EFalse; + TBool storeFlag=EFalse; + TBool valueRetrieved=EFalse; + + + while (bufLength==1000) + { + file.Read(buf,1000); + bufLength=buf.Length(); + + for (TInt i=0; i buf; + _LIT8(KTemp, "%d "); + _LIT8(KSupported, "supported"); + _LIT8(KNotSupported, "notsupported"); + + buf.Format(KTemp,aIpc); + if (aSupported) + { + buf.Append(KSupported); + } + else + { + buf.Append(KNotSupported); + } + ret = file.Write(buf); + } + } + + file.Close(); + fs.Close(); + return ret; + } + +TInt TConfig::Reset() + { + TInt ret=KErrGeneral; + RFs fs; + + if(fs.Connect() == KErrNone) + { + ret = fs.Delete(KConfigFile); + } + + fs.Close(); + return ret; + } + +/* static */ +void TConfig::ResetThis(TAny* aThis) + { + (void)(static_cast(aThis))->Reset(); + } + +void TConfig::PushL() + { + CleanupStack::PushL(TCleanupItem(ResetThis, this)); + } +