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