33
|
1 |
/*
|
|
2 |
* Copyright (c) 2004 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 "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: DM DevDetail Adapter Source Code, ARM implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
#include <sysutil.h>
|
|
23 |
#include "nsmldmdevdetailadapter.h"
|
|
24 |
#include "nsmldebug.h"
|
|
25 |
|
|
26 |
#if defined (_ENABLE_MULTIROFS_SUPPORT)
|
|
27 |
#include <sysversioninfo.h>
|
|
28 |
#else
|
|
29 |
// CONSTANTS
|
|
30 |
_LIT8( KNSmlSwVersionSeparator, " " );
|
|
31 |
#endif
|
|
32 |
|
|
33 |
// ---------------------------------------------------------------------------
|
|
34 |
// CNSmlDmDevDetailAdapter::GetDevDetailDataL( )
|
|
35 |
// Fetches device specific data using EInfo interface.
|
|
36 |
// ---------------------------------------------------------------------------
|
|
37 |
void CNSmlDmDevDetailAdapter::GetDevDetailDataL(
|
|
38 |
CBufBase& aObject,
|
|
39 |
TNSmlDevDetailData aElement ) const
|
|
40 |
{
|
|
41 |
_DBG_FILE("CNSmlDmDevDetailAdapter::GetDevDetailDataL(): begin (MARM)");
|
|
42 |
|
|
43 |
aObject.Reset();
|
|
44 |
|
|
45 |
switch( aElement )
|
|
46 |
{
|
|
47 |
case ESwVersion:
|
|
48 |
{
|
|
49 |
// buffers for data fetched from sysutil
|
|
50 |
#if defined (_ENABLE_MULTIROFS_SUPPORT)
|
|
51 |
|
|
52 |
TBuf16<KSysVersionInfoTextLength> temp;
|
|
53 |
TBuf8<KSysVersionInfoTextLength> temp8;
|
|
54 |
temp.Zero();
|
|
55 |
temp8.Zero();
|
|
56 |
SysVersionInfo::TVersionInfoType what = SysVersionInfo::EFWVersion;
|
|
57 |
TInt error = SysVersionInfo::GetVersionInfo(what,temp);
|
|
58 |
|
|
59 |
User::LeaveIfError(error);
|
|
60 |
|
|
61 |
//Ascii copy which is required
|
|
62 |
temp8.Copy(temp);
|
|
63 |
aObject.InsertL(0,temp8);
|
|
64 |
//Unicode copy if required
|
|
65 |
//aObject.InsertL(0,temp.Ptr(),temp.Length());
|
|
66 |
#else
|
|
67 |
HBufC* verBuf = HBufC::NewLC( KSysUtilVersionTextLength );
|
|
68 |
HBufC8* verBuf8 = HBufC8::NewLC( KSysUtilVersionTextLength );
|
|
69 |
|
|
70 |
TPtr ver = verBuf->Des();
|
|
71 |
TPtr8 ver8 = verBuf8->Des();
|
|
72 |
// fetch software version (sw.txt) from sysutil
|
|
73 |
SysUtil::GetSWVersion( ver );
|
|
74 |
ver8.Copy( ver );
|
|
75 |
|
|
76 |
// parse sw fields and append to aObject
|
|
77 |
TChar separator('\n');
|
|
78 |
TInt pos = ver8.Locate( separator );
|
|
79 |
|
|
80 |
if ( pos == KErrNotFound )
|
|
81 |
{
|
|
82 |
User::Leave( KErrNotFound );
|
|
83 |
}
|
|
84 |
|
|
85 |
// insert version (1st field) and separator to beginning
|
|
86 |
aObject.InsertL( 0, ver8.Mid( 0, pos ) );
|
|
87 |
aObject.InsertL( 0, KNSmlSwVersionSeparator );
|
|
88 |
|
|
89 |
// locate type designator (3rd field)
|
|
90 |
ver8 = ver8.Mid( pos + 1 );
|
|
91 |
pos = ver8.Locate( separator );
|
|
92 |
ver8 = ver8.Mid( pos + 1 );
|
|
93 |
pos = ver8.Locate( separator );
|
|
94 |
|
|
95 |
if ( pos == KErrNotFound )
|
|
96 |
{
|
|
97 |
// type designator (the rest of the string, since there was no \n found)
|
|
98 |
aObject.InsertL( 0, ver8 );
|
|
99 |
}
|
|
100 |
else
|
|
101 |
{
|
|
102 |
// type designator to beginning
|
|
103 |
aObject.InsertL( 0, ver8.Mid( 0, pos ) );
|
|
104 |
}
|
|
105 |
|
|
106 |
// fetch variant (lang.txt) from sysutil
|
|
107 |
ver.Zero();
|
|
108 |
SysUtil::GetLangVersion( ver );
|
|
109 |
ver8.Copy( ver );
|
|
110 |
|
|
111 |
// insert separator and variant to the end
|
|
112 |
aObject.InsertL( aObject.Size(), KNSmlSwVersionSeparator );
|
|
113 |
aObject.InsertL( aObject.Size(), ver8 );
|
|
114 |
|
|
115 |
CleanupStack::PopAndDestroy( verBuf8 );
|
|
116 |
CleanupStack::PopAndDestroy( verBuf );
|
|
117 |
#endif //_ENABLE_MULTIROFS_SUPPORT
|
|
118 |
break;
|
|
119 |
}
|
|
120 |
case EHwVersion:
|
|
121 |
{
|
|
122 |
break;
|
|
123 |
}
|
|
124 |
default:
|
|
125 |
User::Panic( KNSmlDevDetailPanic, KErrArgument );
|
|
126 |
break;
|
|
127 |
}
|
|
128 |
|
|
129 |
_DBG_FILE("CNSmlDmDevDetailAdapter::GetDevDetailDataL(): end (MARM)");
|
|
130 |
}
|
|
131 |
|
|
132 |
|