sapi_sysinfo/tsrc/testing/tsysconnectivity/src/tsysconnectivitynot.cpp
changeset 0 14df0fbfcc4e
equal deleted inserted replaced
-1:000000000000 0:14df0fbfcc4e
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Tests battery notifications
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "tsysconnectivity.h"
       
    21 #include "entitykeys.h"
       
    22 #include "tsysconnectivitynot.h"
       
    23 
       
    24 using namespace SysInfo;
       
    25 
       
    26 CConnectivityNot* CConnectivityNot::NewL(CStifLogger* aLog, TInt aCmdId)
       
    27 	{
       
    28 	CConnectivityNot* self = new(ELeave) CConnectivityNot(aLog,aCmdId );
       
    29 	self->ConstructL();
       
    30 	return self;
       
    31 	}
       
    32 
       
    33 CConnectivityNot::~CConnectivityNot()
       
    34 	{
       
    35 	Cancel();
       
    36 	
       
    37 	if(iWaitScheduler->IsStarted())
       
    38 		iWaitScheduler->AsyncStop();
       
    39 	
       
    40 	delete iSysInfoService;
       
    41 	delete iWaitScheduler;
       
    42 	
       
    43 	}
       
    44 
       
    45 void CConnectivityNot::ConstructL()
       
    46 	{
       
    47 	iSysInfoService = CSysInfoService::NewL();
       
    48 	iWaitScheduler  = new(ELeave) CActiveSchedulerWait();
       
    49 	CActiveScheduler::Add(this);
       
    50 	}
       
    51 
       
    52 CConnectivityNot::CConnectivityNot(CStifLogger* aLog, TInt aCmdId)
       
    53 							 :CActive(EPriorityStandard),
       
    54 								 iCmdId(aCmdId),iLog(aLog)
       
    55 	{
       
    56 	}
       
    57 
       
    58 void CConnectivityNot::DoCancel()
       
    59 	{
       
    60 	}
       
    61 
       
    62 void CConnectivityNot::RunL()
       
    63 	{
       
    64 	if(iCmdId == EWrongKey)
       
    65 		{
       
    66 		TRAP(iResult,TestFuncL());	
       
    67 		}
       
    68 	iWaitScheduler->AsyncStop();
       
    69 	}
       
    70 
       
    71 void CConnectivityNot::Start()
       
    72 	{
       
    73 	SetActive();
       
    74 	TRequestStatus* temp = &iStatus;
       
    75 	User::RequestComplete(temp, KErrNone);
       
    76 	iWaitScheduler->Start();	
       
    77 	}
       
    78 
       
    79 TInt CConnectivityNot::Result()
       
    80 	{
       
    81 	return iResult ;
       
    82 	}
       
    83 
       
    84 void CConnectivityNot::TestFuncL()
       
    85 	{
       
    86 	iSysInfoService->GetNotificationL(KConnectivity,KUserInactivity,1,this);
       
    87 	}
       
    88 
       
    89 
       
    90 	
       
    91 void CConnectivityNot::HandleResponseL(const TDesC& /*aEntity*/,const TDesC& /*aKey*/,
       
    92 	 					CSysData* aOutput, TInt32 /*aTransID*/, TSysRequest::TRequestType /*aType*/,TInt /*aError*/)
       
    93 	{
       
    94 	
       
    95 	delete aOutput ;
       
    96 	
       
    97 	}
       
    98