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