libraries/qr3/src/halListboxdata.cpp
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // halListboxdata.cpp
       
     2 // 
       
     3 // Copyright (c) 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "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 // Accenture - Initial contribution
       
    11 //
       
    12 #include "KernLbxModel.h"
       
    13 #include "Utils.h"
       
    14 #include <fshell/clogger.h>
       
    15 #include <fshell/memoryaccess.h>
       
    16 #include <HAL.h>
       
    17 
       
    18 CHalListBoxData::CHalListBoxData(CKernListBoxModel* aModel)
       
    19 	: CKernListBoxData(aModel)
       
    20 	{
       
    21 	}
       
    22 
       
    23 void CHalListBoxData::DoFormatL(TObjectKernelInfo* aInfo, RBuf& name, RBuf& more, TInt& itemId)
       
    24 	{
       
    25 	SHalInfo& info = *reinterpret_cast<SHalInfo*>(aInfo);
       
    26 	name.Copy(ToStringHal(info.iAttribute));
       
    27 	ToStringHalVal(more, info.iAttribute, info.iValue);
       
    28 	if (info.iProperties & HAL::EEntryDynamic)
       
    29 		{
       
    30 		more.Append(_L(" (Dynamic)"));
       
    31 		}
       
    32 	itemId = info.iAttribute;
       
    33 	}
       
    34 
       
    35 void CHalListBoxData::DumpToCloggerL(RClogger& clogger, TInt i, TInt /*count*/)
       
    36 	{
       
    37 	_LIT(KHalDesc,"HAL;Number;Name;Value;ValueHumanReadable;Flags");
       
    38 	_LIT(KHalFmt,"HAL;%i;%S;%i;%S;%i");
       
    39 
       
    40 	if (i == 0) clogger.Log(KHalDesc);
       
    41 	SHalInfo& info = *reinterpret_cast<SHalInfo*>(iInfo);
       
    42 	TPtrC name = ToStringHal(info.iAttribute);
       
    43 	RBuf val;
       
    44 	val.CreateL(256);
       
    45 	ToStringHalVal(val, info.iAttribute, info.iValue);
       
    46 	clogger.Log(KHalFmt, info.iAttribute, &name, info.iValue, &val, info.iProperties);
       
    47 	val.Close();
       
    48 	}
       
    49 
       
    50 void CHalListBoxData::DoInfoForDialogL(RBuf& aTitle, RBuf& inf, TDes* /*aName*/)
       
    51 	{
       
    52 	SHalInfo& info = *reinterpret_cast<SHalInfo*>(iInfo);
       
    53 	_LIT(KInfo, "HAL info");
       
    54 	aTitle.Copy(KInfo);
       
    55 	TPtrC name = ToStringHal(info.iAttribute);
       
    56 	RBuf val;
       
    57 	val.CreateL(256);
       
    58 	ToStringHalVal(val, info.iAttribute, info.iValue);
       
    59 	_LIT(KHalFmt, "%S\n%S\n\n(Id: %i Val: %i/0x%x)");
       
    60 	inf.Format(KHalFmt, &name, &val, info.iAttribute, info.iValue, info.iValue);
       
    61 	val.Close();
       
    62 	}