usbmgmt/usbmgrtest/t_charging_emu/src/tbatterycharging.cpp
branchRCL_3
changeset 15 f92a4f87e424
parent 0 c9bc50fca66e
child 16 012cc2ee6408
equal deleted inserted replaced
14:d3e8e7d462dd 15:f92a4f87e424
     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".
    19 #include "musbdevicenotify.h"
    19 #include "musbdevicenotify.h"
    20 
    20 
    21 #include <e32svr.h>
    21 #include <e32svr.h>
    22 #include <e32base.h>
    22 #include <e32base.h>
    23 #include <e32std.h>
    23 #include <e32std.h>
    24 #include <usbman.rsg>
       
    25 #include <f32file.h>
    24 #include <f32file.h>
    26 #include <barsc.h>
    25 #include <barsc.h>
    27 #include <barsread.h>
    26 #include <barsread.h>
    28 #include <bautils.h>
    27 #include <bautils.h>
    29 #include "UsbUtils.h"
    28 #include "UsbUtils.h"
   127 		}
   126 		}
   128 
   127 
   129 	iPlugin = iExtensionPlugins[0];
   128 	iPlugin = iExtensionPlugins[0];
   130 
   129 
   131 	iDummyLdd.Initialise();
   130 	iDummyLdd.Initialise();
   132 	//iRepository = CRepository::NewL(KUsbBatteryChargingCentralRepositoryUid);
       
   133 	User::LeaveIfError(iTimer.CreateLocal());
   131 	User::LeaveIfError(iTimer.CreateLocal());
   134 	
   132 	
   135 	DefinePropertyL(KBattChargWriteRepositoryUid, KBattChargWriteRepositoryKey,RProperty::EInt);
   133 	DefinePropertyL(KBattChargWriteRepositoryUid, KBattChargWriteRepositoryKey,RProperty::EInt);
   136 	DefinePropertyL(KBattChargReadPropertyCurrentUid,KBattChargReadCurrentChargingKey,RProperty::EInt);
   134 	DefinePropertyL(KBattChargReadPropertyCurrentUid,KBattChargReadCurrentChargingKey,RProperty::EInt);
   137 	
   135 	
   344 	CleanupStack::PopAndDestroy(); // fs
   342 	CleanupStack::PopAndDestroy(); // fs
   345 	}
   343 	}
   346 
   344 
   347 TInt CDummyUsbDevice::GetNextLine()
   345 TInt CDummyUsbDevice::GetNextLine()
   348 	{
   346 	{
   349 	TInt newLineOffset = (iPtr.Mid(iFileOffset)).Locate(13);//Find(_L("\r\n"));
   347 	TInt newLineOffset = (iPtr.Mid(iFileOffset)).Locate(13);
   350 	if (newLineOffset < 0)
   348 	if (newLineOffset < 0)
   351 		{
   349 		{
   352 		return newLineOffset;
   350 		return newLineOffset;
   353 		}
   351 		}
   354 	if (newLineOffset == 0)
   352 	if (newLineOffset == 0)
   425 			break;
   423 			break;
   426 		case EUsbChargingTestCommandUserSetting:
   424 		case EUsbChargingTestCommandUserSetting:
   427 			{
   425 			{
   428 			TInt err = WriteToRepositoryProperty(iCommandValue);
   426 			TInt err = WriteToRepositoryProperty(iCommandValue);
   429 			
   427 			
   430 			//TInt err = iRepository->Set(KUsbBatteryChargingKeyEnabledUserSetting, iCommandValue);
       
   431 			iTest(err == KErrNone);
   428 			iTest(err == KErrNone);
   432 			}
   429 			}
   433 			break;
   430 			break;
   434 		default:
   431 		default:
   435 			User::Panic(KUsbChargingTestPanic, EUsbChargingTestPanicBadCommand);
   432 			User::Panic(KUsbChargingTestPanic, EUsbChargingTestPanicBadCommand);
   481 		case EUsbChargingTestCheckCharging:
   478 		case EUsbChargingTestCheckCharging:
   482 			{
   479 			{
   483 			TInt current;			
   480 			TInt current;			
   484 			TInt err = GetChargingCurrentFromProperty(current);
   481 			TInt err = GetChargingCurrentFromProperty(current);
   485 			
   482 			
   486 			//TInt err = RProperty::Get(KPropertyUidUsbBatteryChargingCategory,
       
   487 			//	KPropertyUidUsbBatteryChargingChargingCurrent, current);
       
   488 			iTest(err == KErrNone);
   483 			iTest(err == KErrNone);
   489 			iTest(current == iCheckValue);
   484 			iTest(current == iCheckValue);
   490 			}
   485 			}
   491 			break;
   486 			break;
   492 		default:
   487 		default: