|
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 <e32capability.h> |
|
17 #include <ssm/ssmswp.h> |
|
18 |
|
19 #include "ssmdebug.h" |
|
20 #include "ssmswppolicysrv.h" |
|
21 #include "ssmswppolicysess.h" |
|
22 #include "ssmswppolicyconst.h" |
|
23 #include "ssmcommandutilprovider.h" |
|
24 |
|
25 void CSsmSwpPolicySession::ServiceL(const RMessage2& aMessage) |
|
26 { |
|
27 switch(aMessage.Function()) |
|
28 { |
|
29 case ESsmPolicySrvSetSwpPolicyDllHandleAndInitialize: |
|
30 { |
|
31 DEBUGPRINT1(_L("CSsmSwpPolicySession: ESsmPolicySrvSetSwpPolicyDllHandleAndInitialize")); |
|
32 iSsmSwpPolicySvr.CallSetDllHandleAndInitializeL(aMessage, iSessionIndex); |
|
33 break; |
|
34 } |
|
35 |
|
36 case ESsmPolicySrvInitializeCancel: |
|
37 { |
|
38 DEBUGPRINT1(_L("CSsmSwpPolicySession: ESsmPolicySrvInitializeCancel")); |
|
39 iSsmSwpPolicySvr.CallInitializeCancel(iSessionIndex); |
|
40 aMessage.Complete(KErrNone); |
|
41 break; |
|
42 } |
|
43 |
|
44 case ESsmPolicySrvPrepareCommandList: |
|
45 { |
|
46 DEBUGPRINT1(_L("CSsmSwpPolicySession: ESsmPolicySrvPrepareCommandList")); |
|
47 iSsmSwpPolicySvr.CallPrepareCommandListL(aMessage, iSessionIndex); |
|
48 break; |
|
49 } |
|
50 |
|
51 case ESsmPolicySrvPrepareCommandListCancel: |
|
52 { |
|
53 DEBUGPRINT1(_L("CSsmSwpPolicySession: ESsmPolicySrvPrepareCommandListCancel")); |
|
54 iSsmSwpPolicySvr.CallPrepareCommandListCancel(iSessionIndex); |
|
55 aMessage.Complete(KErrNone); |
|
56 break; |
|
57 } |
|
58 |
|
59 case ESsmPolicySrvCommandList: |
|
60 { |
|
61 DEBUGPRINT1(_L("CSsmSwpPolicySession: ESsmPolicySrvCommandList")); |
|
62 iSsmSwpPolicySvr.CallCommandListL(aMessage, iSessionIndex); |
|
63 break; |
|
64 } |
|
65 |
|
66 case ESsmPolicySrvHandleCleReturnValue: |
|
67 { |
|
68 DEBUGPRINT1(_L("CSsmSwpPolicySession: ESsmPolicySrvHandleCleReturnValue")); |
|
69 iSsmSwpPolicySvr.CallHandleCleReturnValueL(aMessage, iSessionIndex); |
|
70 break; |
|
71 } |
|
72 |
|
73 case ESsmPolicySrvHandleCleReturnValueCancel: |
|
74 { |
|
75 DEBUGPRINT1(_L("CSsmSwpPolicySession: ESsmPolicySrvHandleCleReturnValueCancel")); |
|
76 iSsmSwpPolicySvr.CallHandleCleReturnValueCancel(iSessionIndex); |
|
77 aMessage.Complete(KErrNone); |
|
78 break; |
|
79 } |
|
80 |
|
81 case EDebugMarkHeap: |
|
82 { |
|
83 #ifdef _DEBUG |
|
84 __UHEAP_MARK; |
|
85 DEBUGPRINT2(_L("CSsmSwpPolicySession - EDebugMarkHeap: Alloc Cells: %d."), User::CountAllocCells()); |
|
86 #endif |
|
87 aMessage.Complete(KErrNone); |
|
88 break; |
|
89 } |
|
90 |
|
91 case EDeleteSSwpPolicySessionInfo: |
|
92 { |
|
93 #ifdef TEST_SSM_SERVER |
|
94 iSsmSwpPolicySvr.DeleteSSwpPolicySessionInfo(iSessionIndex); |
|
95 DEBUGPRINT1(_L("CSsmSwpPolicySession - EDeleteSSwpPolicySessionInfo")); |
|
96 #endif //TEST_SSM_SERVER |
|
97 aMessage.Complete(KErrNone); |
|
98 break; |
|
99 } |
|
100 |
|
101 case EDebugMarkHeapEnd: |
|
102 { |
|
103 #ifdef _DEBUG |
|
104 __UHEAP_MARKEND; |
|
105 DEBUGPRINT2(_L("CSsmSwpPolicySession - EDebugMarkHeapEnd: Alloc Cells: %d."), User::CountAllocCells()); |
|
106 #endif |
|
107 aMessage.Complete(KErrNone); |
|
108 break; |
|
109 } |
|
110 |
|
111 case EDebugSetHeapFailure: |
|
112 { |
|
113 #ifdef TEST_SSM_SERVER |
|
114 //User::__DbgSetAllocFail(RHeap::EUser,(RHeap::TAllocFail)aMessage.Int0(),aMessage.Int1()); |
|
115 __UHEAP_SETFAIL(RAllocator::EFailNext,aMessage.Int0()); |
|
116 DEBUGPRINT2(_L("CSsmSwpPolicySession - EDebugSetHeapFailure: Value of Failure Rate: %d."), aMessage.Int0()); |
|
117 #endif |
|
118 aMessage.Complete(KErrNone); |
|
119 break; |
|
120 } |
|
121 case EDebugHeapReset: |
|
122 { |
|
123 #ifdef _DEBUG |
|
124 __UHEAP_RESET; |
|
125 DEBUGPRINT1(_L("CSsmSwpPolicySession - EDebugHeapReset")); |
|
126 #endif |
|
127 aMessage.Complete(KErrNone); |
|
128 break; |
|
129 } |
|
130 default: |
|
131 { |
|
132 DEBUGPRINT1(_L("CSsmSwpPolicySession: Opcode not supported")); |
|
133 aMessage.Complete(KErrNotSupported); |
|
134 break; |
|
135 } |
|
136 } |
|
137 } |
|
138 |
|
139 /** |
|
140 Constructs and returns a pointer to CSsmSwpPolicySession. |
|
141 */ |
|
142 CSsmSwpPolicySession* CSsmSwpPolicySession::NewL(CSsmSwpPolicyServer& aSsmPolicyServer) |
|
143 { |
|
144 DEBUGPRINT1(_L("CSsmSwpPolicySession: Constructs Server side session for RSsmSwpPolicySession")); |
|
145 CSsmSwpPolicySession* self = new(ELeave) CSsmSwpPolicySession(aSsmPolicyServer); |
|
146 CleanupStack::PushL(self); |
|
147 self->ConstructL(); |
|
148 CleanupStack::Pop(); |
|
149 return self; |
|
150 } |
|
151 |
|
152 CSsmSwpPolicySession::CSsmSwpPolicySession(CSsmSwpPolicyServer& aSsmPolicyServer) |
|
153 : iSsmSwpPolicySvr(aSsmPolicyServer) |
|
154 { |
|
155 } |
|
156 |
|
157 /** |
|
158 Registers the session with SsmSwpPolicyServer |
|
159 */ |
|
160 void CSsmSwpPolicySession::ConstructL() |
|
161 { |
|
162 DEBUGPRINT1(_L("CSsmSwpPolicySession: Registers the session with SsmSwpPolicyServer")); |
|
163 iSsmSwpPolicySvr.RegisterSessionL(iSessionIndex); |
|
164 } |
|
165 |
|
166 /** |
|
167 Deregisters the session from SsmSwpPolicyServer |
|
168 */ |
|
169 CSsmSwpPolicySession::~CSsmSwpPolicySession() |
|
170 { |
|
171 DEBUGPRINT1(_L("CSsmSwpPolicySession: Deregisters the session from SsmSwpPolicyServer")); |
|
172 iSsmSwpPolicySvr.DeregisterSession(iSessionIndex); |
|
173 } |
|
174 |