usbmgmt/usbmgrtest/t_charging_emu/src/tbatterycharging.cpp
changeset 28 f1fd07aa74c9
parent 26 f3a1ae528dee
equal deleted inserted replaced
27:2fefb5a2b416 28:f1fd07aa74c9
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   126 		}
   126 		}
   127 
   127 
   128 	iPlugin = iExtensionPlugins[0];
   128 	iPlugin = iExtensionPlugins[0];
   129 
   129 
   130 	iDummyLdd.Initialise();
   130 	iDummyLdd.Initialise();
   131 	//iRepository = CRepository::NewL(KUsbBatteryChargingCentralRepositoryUid);
       
   132 	User::LeaveIfError(iTimer.CreateLocal());
   131 	User::LeaveIfError(iTimer.CreateLocal());
   133 	
   132 	
   134 	DefinePropertyL(KBattChargWriteRepositoryUid, KBattChargWriteRepositoryKey,RProperty::EInt);
   133 	DefinePropertyL(KBattChargWriteRepositoryUid, KBattChargWriteRepositoryKey,RProperty::EInt);
   135 	DefinePropertyL(KBattChargReadPropertyCurrentUid,KBattChargReadCurrentChargingKey,RProperty::EInt);
   134 	DefinePropertyL(KBattChargReadPropertyCurrentUid,KBattChargReadCurrentChargingKey,RProperty::EInt);
   136 	
   135 	
   343 	CleanupStack::PopAndDestroy(); // fs
   342 	CleanupStack::PopAndDestroy(); // fs
   344 	}
   343 	}
   345 
   344 
   346 TInt CDummyUsbDevice::GetNextLine()
   345 TInt CDummyUsbDevice::GetNextLine()
   347 	{
   346 	{
   348 	TInt newLineOffset = (iPtr.Mid(iFileOffset)).Locate(13);//Find(_L("\r\n"));
   347 	TInt newLineOffset = (iPtr.Mid(iFileOffset)).Locate(13);
   349 	if (newLineOffset < 0)
   348 	if (newLineOffset < 0)
   350 		{
   349 		{
   351 		return newLineOffset;
   350 		return newLineOffset;
   352 		}
   351 		}
   353 	if (newLineOffset == 0)
   352 	if (newLineOffset == 0)
   424 			break;
   423 			break;
   425 		case EUsbChargingTestCommandUserSetting:
   424 		case EUsbChargingTestCommandUserSetting:
   426 			{
   425 			{
   427 			TInt err = WriteToRepositoryProperty(iCommandValue);
   426 			TInt err = WriteToRepositoryProperty(iCommandValue);
   428 			
   427 			
   429 			//TInt err = iRepository->Set(KUsbBatteryChargingKeyEnabledUserSetting, iCommandValue);
       
   430 			iTest(err == KErrNone);
   428 			iTest(err == KErrNone);
   431 			}
   429 			}
   432 			break;
   430 			break;
   433 		default:
   431 		default:
   434 			User::Panic(KUsbChargingTestPanic, EUsbChargingTestPanicBadCommand);
   432 			User::Panic(KUsbChargingTestPanic, EUsbChargingTestPanicBadCommand);
   480 		case EUsbChargingTestCheckCharging:
   478 		case EUsbChargingTestCheckCharging:
   481 			{
   479 			{
   482 			TInt current;			
   480 			TInt current;			
   483 			TInt err = GetChargingCurrentFromProperty(current);
   481 			TInt err = GetChargingCurrentFromProperty(current);
   484 			
   482 			
   485 			//TInt err = RProperty::Get(KPropertyUidUsbBatteryChargingCategory,
       
   486 			//	KPropertyUidUsbBatteryChargingChargingCurrent, current);
       
   487 			iTest(err == KErrNone);
   483 			iTest(err == KErrNone);
   488 			iTest(current == iCheckValue);
   484 			iTest(current == iCheckValue);
   489 			}
   485 			}
   490 			break;
   486 			break;
   491 		default:
   487 		default: