|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 @released |
|
20 */ |
|
21 |
|
22 #include "cmdcoopsysperformrfsactions.h" |
|
23 #include <barsread2.h> |
|
24 |
|
25 CCustomCmdCoopSysPerformRfsActions* CCustomCmdCoopSysPerformRfsActions::NewL() |
|
26 { |
|
27 CCustomCmdCoopSysPerformRfsActions* self = new (ELeave) CCustomCmdCoopSysPerformRfsActions(); |
|
28 return self; |
|
29 } |
|
30 |
|
31 CCustomCmdCoopSysPerformRfsActions::CCustomCmdCoopSysPerformRfsActions() |
|
32 { |
|
33 } |
|
34 |
|
35 CCustomCmdCoopSysPerformRfsActions::~CCustomCmdCoopSysPerformRfsActions() |
|
36 { |
|
37 } |
|
38 |
|
39 TInt CCustomCmdCoopSysPerformRfsActions::Initialize(CSsmCustomCommandEnv* /*aCmdEnv*/) |
|
40 { |
|
41 //Connect to RSsmStateAdaptation |
|
42 return iSsmStateAdaptation.Connect(); |
|
43 } |
|
44 |
|
45 void CCustomCmdCoopSysPerformRfsActions::Close() |
|
46 { |
|
47 //Cancel the request if there is any |
|
48 iSsmStateAdaptation.RequestCancel(); |
|
49 |
|
50 //Close RSsmStateAdaptation |
|
51 iSsmStateAdaptation.Close(); |
|
52 } |
|
53 |
|
54 void CCustomCmdCoopSysPerformRfsActions::Release() |
|
55 { |
|
56 delete this; |
|
57 } |
|
58 |
|
59 void CCustomCmdCoopSysPerformRfsActions::Execute(const TDesC8& aParams, TRequestStatus& aStatus) |
|
60 { |
|
61 TSsmRfsType ssmRfsType = ESsmShallowRfs; |
|
62 |
|
63 //Internalise the param in to TSsmState |
|
64 TRAPD(err, ssmRfsType = ExecuteL(aParams)); |
|
65 |
|
66 if(KErrNone == err) |
|
67 { |
|
68 //Request coop system to perform Rfs actions |
|
69 iSsmStateAdaptation.RequestCoopSysPerformRfsActions(ssmRfsType, aStatus); |
|
70 } |
|
71 else |
|
72 { |
|
73 //In case of error complete the request with error code |
|
74 TRequestStatus* status = &aStatus; |
|
75 User::RequestComplete(status, err); |
|
76 } |
|
77 } |
|
78 |
|
79 TSsmRfsType CCustomCmdCoopSysPerformRfsActions::ExecuteL(const TDesC8& aParams) |
|
80 { |
|
81 RResourceReader reader; |
|
82 |
|
83 //Open the descriptor data to be internalised |
|
84 reader.OpenLC(aParams); |
|
85 |
|
86 //Read the type from descriptor data |
|
87 TInt32 type = reader.ReadInt32L(); |
|
88 CleanupStack::PopAndDestroy(&reader); |
|
89 |
|
90 //Check for valid enum value |
|
91 if (type != ESsmShallowRfs && type != ESsmDeepRfs && |
|
92 type < ESsmRfsTypeExtensionBase) |
|
93 { |
|
94 //Leave incase of a invalid enum value |
|
95 User::Leave(KErrArgument); |
|
96 } |
|
97 |
|
98 //Read the main state from param data |
|
99 TSsmRfsType ssmRfsType = static_cast<TSsmRfsType>(type); |
|
100 |
|
101 //Create a TSsmState object and return |
|
102 return ssmRfsType; |
|
103 } |
|
104 |
|
105 void CCustomCmdCoopSysPerformRfsActions::ExecuteCancel() |
|
106 { |
|
107 //Cancel the request if there is any |
|
108 iSsmStateAdaptation.RequestCancel(); |
|
109 } |