|
1 /* |
|
2 * Copyright (c) 2008 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: Implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "MCEConstants.h" |
|
21 #include "TCmdSetProperty.h" |
|
22 #include "CTcMCEContext.h" |
|
23 #include "mcetesterpskeys.h" |
|
24 |
|
25 #include <e32property.h> |
|
26 |
|
27 |
|
28 void TCmdSetProperty::ExecuteL() |
|
29 { |
|
30 // ---------- Setup -------------------------------------------------------- |
|
31 |
|
32 // Getting Uids and value |
|
33 TInt uidValue = ExtractIntegerL( KParamPropertyUid, 0, EFalse ); |
|
34 TInt key = ExtractIntegerL( KParamPropertyKey, 0, ETrue ); |
|
35 |
|
36 TInt propertyAttr = RProperty::EText; |
|
37 TInt intValue( 0 ); |
|
38 TPtrC8 descrValue = ExtractTextL( KParamPropertyTextValue, EFalse ); |
|
39 if ( descrValue == KNullDesC8 ) |
|
40 { |
|
41 // As text parameter was not specified, integer parameter is now |
|
42 // mandatory, except for KMceTesterNatPluginResourceReservationStatus |
|
43 // which does not require a value. |
|
44 TBool isMandatory = ( key != KMceTesterNatPluginResourceReservationStatus ); |
|
45 intValue = ExtractIntegerL( KParamPropertyValue, 0, isMandatory ); |
|
46 |
|
47 propertyAttr = RProperty::EInt; |
|
48 } |
|
49 |
|
50 TUid uidkey = KUidMceTesterPSKeys; |
|
51 if ( uidValue != 0 ) |
|
52 { |
|
53 uidkey = TUid::Uid( uidValue ); |
|
54 } |
|
55 |
|
56 // ---------- Execution ---------------------------------------------------- |
|
57 |
|
58 _LIT_SECURITY_POLICY_PASS( KAllowAllPolicy ); |
|
59 User::LeaveIfError( RProperty::Define( uidkey, key, propertyAttr, |
|
60 KAllowAllPolicy, KAllowAllPolicy ) ); |
|
61 if ( propertyAttr == RProperty::EInt ) |
|
62 { |
|
63 User::LeaveIfError( RProperty::Set( uidkey, key, intValue ) ); |
|
64 } |
|
65 else |
|
66 { |
|
67 User::LeaveIfError( RProperty::Set( uidkey, key, descrValue ) ); |
|
68 } |
|
69 |
|
70 // ---------- Response creation -------------------------------------------- |
|
71 |
|
72 } |
|
73 |
|
74 TBool TCmdSetProperty::Match( const TTcIdentifier& aId ) |
|
75 { |
|
76 return TTcMceCommandBase::Match( aId, _L8("SetProperty") ); |
|
77 } |
|
78 |
|
79 TTcCommandBase* TCmdSetProperty::CreateL( MTcTestContext& aContext ) |
|
80 { |
|
81 return new( ELeave ) TCmdSetProperty( aContext ); |
|
82 } |