diff -r 000000000000 -r 14df0fbfcc4e sapi_sysinfo/tsrc/testing/tsysgeneral/src/tasyncaccstatus.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sapi_sysinfo/tsrc/testing/tsysgeneral/src/tasyncaccstatus.cpp Mon Mar 30 12:51:10 2009 +0300 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "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: ?Description +* +*/ + + +#include "tsysgeneral.h" +#include "sysinfoservice.h" +#include "tasyncaccstatus.h" +#include "entitykeys.h" +#include "watchtimer.h" +#include + +using namespace SysInfo; + +CAsyncStatus* CAsyncStatus::NewL(CStifLogger* aLog) + { + CAsyncStatus* self = new(ELeave) CAsyncStatus(aLog); + self->ConstructL(); + return self; + } + +CAsyncStatus::~CAsyncStatus() + { + Cancel(); + if(iWaitScheduler->IsStarted()) + iWaitScheduler->AsyncStop(); + + delete iTimer; + delete iSysInfoService; + delete iWaitScheduler; + } + +void CAsyncStatus::ConstructL() + { + iSysInfoService = CSysInfoService::NewL(); + iWaitScheduler = new(ELeave) CActiveSchedulerWait(); + iTimer = CWatchTimer::NewL(EPriorityNormal,this); + CActiveScheduler::Add(this); + } + +CAsyncStatus::CAsyncStatus(CStifLogger* aLog) : + CActive(EPriorityStandard),iLog(aLog) + { + } + +void CAsyncStatus::DoCancel() + { + //TRAPD(err1,iSysInfoService->GetInfoL(req1)); + } + +void CAsyncStatus::RunL() + { + TestFuncL(); + } + +void CAsyncStatus::Start() + { + SetActive(); + TRequestStatus* temp = &iStatus; + User::RequestComplete(temp, KErrNone); + iWaitScheduler->Start(); + } + +TInt CAsyncStatus::Result() + { + return iResult; + } + +void CAsyncStatus::TestFuncL() + { + + TInt retValue = KErrNone ; + CSysData* input = CDriveInfo::NewL(retValue); + TRAPD(err,iSysInfoService->GetInfoL(KGeneral,KAccessoryStatus,1,this,input)); + + if (KErrNotSupported == err) + { + TRAP(err,iSysInfoService->GetInfoL(KGeneral,KInputLanguage,1,this,input)); + + if(KErrNotSupported == err) + { + TRAP(err,iSysInfoService->GetInfoL(KGeneral,KFlipStatus,1,this,input)); + if(KErrNotSupported != err) + { + retValue = KErrGeneral ; + } + } + else + { + retValue = KErrGeneral ; + } + + } + else + { + retValue = KErrGeneral ; + } + iResult = retValue ; + delete input ; + iWaitScheduler->AsyncStop(); + } + +void CAsyncStatus::HandleResponseL(const TDesC& /*aEntity*/,const TDesC& /*aKey*/, + CSysData* /*aOutput*/, TInt32 /*aTransID*/,TSysRequest::TRequestType /*aType*/, TInt /*aError*/) + { + + } + +void CAsyncStatus::HandleTimeOut() +{ +} + +TInt TestAsyncStatus(CStifLogger* aLog ) +{ + + CAsyncStatus* test = CAsyncStatus::NewL(aLog); + + test->Start(); + TInt retval = test->Result(); + delete test; + + return retval; +} \ No newline at end of file