|
1 // Copyright (c) 2008-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 #include "ssmswppolicyproxy.h" |
|
17 #include "ssmpanic.h" |
|
18 |
|
19 /** |
|
20 Constructs and returns a pointer to CSsmSwpPolicyCliSession |
|
21 */ |
|
22 CSsmSwpPolicyCliSession* CSsmSwpPolicyCliSession::NewL() |
|
23 { |
|
24 CSsmSwpPolicyCliSession* self = new (ELeave) CSsmSwpPolicyCliSession; |
|
25 return self; |
|
26 } |
|
27 |
|
28 /** |
|
29 Sets the swppolicy dll handle and initializes the swppolicy. The policyhandle which is loaded in |
|
30 swppolicyresovler is passed to the swppolicyserver, where it is used to open the handle to swppolicy |
|
31 and forward the calls from policy frame to the swppolicy. |
|
32 |
|
33 @param aPolicyHandle The swppolicy policyhandle |
|
34 @param aStatus Request status |
|
35 */ |
|
36 void CSsmSwpPolicyCliSession::CallSetDllHandleAndInitialize(TInt aPolicyHandle, TRequestStatus& aStatus) |
|
37 { |
|
38 DEBUGPRINT1(_L("CSsmSwpPolicyCliSession: Sets the swppolicy Dll Hanlde and Initializes it")); |
|
39 iSsmSwpPolicySession.CallSetDllHandleAndInitialize(aPolicyHandle, aStatus); |
|
40 } |
|
41 |
|
42 /** |
|
43 Cancels the Initialization of the swppolicy, if any Initialization request is pending. |
|
44 @return KErrNone, if successful; otherwise one of the other system-wide error codes. |
|
45 */ |
|
46 TInt CSsmSwpPolicyCliSession::CallInitializeCancel() |
|
47 { |
|
48 DEBUGPRINT1(_L("CSsmSwpPolicyCliSession: Cancel Initialization of the swp policy")); |
|
49 return (iSsmSwpPolicySession.CallInitializeCancel()); |
|
50 } |
|
51 |
|
52 /** |
|
53 Prepares the commandlist in swppolicy |
|
54 @param aSwp Swp value |
|
55 @param aStatus Request status |
|
56 */ |
|
57 void CSsmSwpPolicyCliSession::CallPrepareCommandList(const TSsmSwp& aSwp, TRequestStatus& aStatus) |
|
58 { |
|
59 DEBUGPRINT1(_L("CSsmSwpPolicyCliSession: Call Prepare command list in swppolicy")); |
|
60 iSsmSwpPolicySession.CallPrepareCommandList(aSwp, aStatus); |
|
61 } |
|
62 |
|
63 /** |
|
64 Cancels the preparation of the commandlist, if any PrepareCommandList request is pending. |
|
65 @return KErrNone, if successful; otherwise one of the other system-wide error codes. |
|
66 */ |
|
67 TInt CSsmSwpPolicyCliSession::CallPrepareCommandListCancel() |
|
68 { |
|
69 DEBUGPRINT1(_L("CSsmSwpPolicyCliSession: Cancel prepare command list in swppolicy")); |
|
70 return (iSsmSwpPolicySession.CallPrepareCommandListCancel()); |
|
71 } |
|
72 |
|
73 /** |
|
74 Returns the commandlist to the client from swppolicy. |
|
75 @return A pointer to commandlist if successfull, else returns NULL pointer. |
|
76 */ |
|
77 CSsmCommandList* CSsmSwpPolicyCliSession::CallCommandList() |
|
78 { |
|
79 CSsmCommandList* ssmCommandList = NULL; |
|
80 |
|
81 // To avoid a warning of variable not used. |
|
82 TInt err = KErrNone; |
|
83 |
|
84 // We are ignoring the error here, as we return a NULL pointer in case of error |
|
85 TRAP(err, ssmCommandList = iSsmSwpPolicySession.CallCommandListL()); |
|
86 |
|
87 DEBUGPRINT2(_L("CSsmSwpPolicyCliSession: CallCommandList completed with %d"), err); |
|
88 return ssmCommandList; |
|
89 } |
|
90 |
|
91 /** |
|
92 Handles the value returned by Cle. |
|
93 @param aSwp swp value |
|
94 @param aError Error returned by cle as result of the command execution |
|
95 @param aSeverity Severity of the command |
|
96 @param aStatus Request status |
|
97 */ |
|
98 void CSsmSwpPolicyCliSession::CallHandleCleReturnValue(const TSsmSwp& aSwp, TInt aError, TInt aSeverity, TRequestStatus& aStatus) |
|
99 { |
|
100 DEBUGPRINT1(_L("CSsmSwpPolicyCliSession: Call HandleCleReturn Value of the swppolicy")); |
|
101 iSsmSwpPolicySession.CallHandleCleReturnValue(aSwp, aError, aSeverity, aStatus); |
|
102 } |
|
103 |
|
104 /** |
|
105 Cancels the HandleCleReturnValue, if any HandleCleReturnValue request is pending. |
|
106 @return KErrNone, if successful; otherwise one of the other system-wide error codes. |
|
107 */ |
|
108 TInt CSsmSwpPolicyCliSession::CallHandleCleReturnValueCancel() |
|
109 { |
|
110 DEBUGPRINT1(_L("RSsmSwpPolicySession: Cancel Call HandleCleReturn Value of the swppolicy")); |
|
111 return (iSsmSwpPolicySession.CallHandleCleReturnValueCancel()); |
|
112 } |
|
113 |
|
114 _LIT(KSsmSwpPolicyTestServerName, "TestSsmSwpPolicyServer"); |
|
115 |
|
116 /** |
|
117 Connects to the ssmswppolicy server. |
|
118 |
|
119 @leave KErrNoMemory if no memory. |
|
120 */ |
|
121 void CSsmSwpPolicyCliSession::ConnectL() |
|
122 { |
|
123 iSsmSwpPolicySession.ConnectL(KSsmSwpPolicyTestServerName); |
|
124 DEBUGPRINT1(_L("CSsmSwpPolicyCliSession Connect Completed with KErrNone")); |
|
125 } |
|
126 |
|
127 /** |
|
128 Closes the RSsmSwpPolicySession handle. |
|
129 */ |
|
130 void CSsmSwpPolicyCliSession::Close() |
|
131 { |
|
132 iSsmSwpPolicySession.Close(); |
|
133 } |
|
134 |
|
135 /** |
|
136 Returns ETrue if there is a connected session else returns EFalse. |
|
137 */ |
|
138 TBool CSsmSwpPolicyCliSession::IsConnected() |
|
139 { |
|
140 return iSsmSwpPolicySession.Handle() ? ETrue : EFalse; |
|
141 } |
|
142 |
|
143 /** |
|
144 Constructor |
|
145 */ |
|
146 CSsmSwpPolicyCliSession::CSsmSwpPolicyCliSession() |
|
147 { |
|
148 } |
|
149 |
|
150 /** |
|
151 Destructor |
|
152 */ |
|
153 CSsmSwpPolicyCliSession::~CSsmSwpPolicyCliSession() |
|
154 { |
|
155 Close(); |
|
156 } |
|
157 |
|
158 |
|
159 |