1 /* |
|
2 * Copyright (c) 2007 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: Contains the implementation of class |
|
15 * CSPCipheringStatusMonitor. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <rmmcustomapi.h> |
|
22 #include "cspcipheringstatusmonitor.h" |
|
23 #include "csplogger.h" |
|
24 #include "mcspsecuritysettingobserver.h" |
|
25 |
|
26 // ================= MEMBER FUNCTIONS ======================= |
|
27 |
|
28 // C++ default constructor can NOT contain any code, that |
|
29 // might leave. |
|
30 // |
|
31 CSPCipheringStatusMonitor::CSPCipheringStatusMonitor( |
|
32 RMmCustomAPI& aMmCustom, MCSPSecuritySettingObserver& aObs ) |
|
33 : CActive( EPriorityStandard ), |
|
34 iMmCustom( aMmCustom ), |
|
35 iObserver( aObs ), |
|
36 iIsInitialised( EFalse ), |
|
37 iCallsSecured( EFalse ), |
|
38 iSecureSpecified( ETrue ) |
|
39 { |
|
40 CActiveScheduler::Add( this ); |
|
41 } |
|
42 |
|
43 // Destructor |
|
44 CSPCipheringStatusMonitor::~CSPCipheringStatusMonitor() |
|
45 { |
|
46 Cancel(); |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CSPCipheringStatusMonitor::NewL |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 CSPCipheringStatusMonitor* CSPCipheringStatusMonitor::NewL( |
|
54 RMmCustomAPI& aMmCustom, MCSPSecuritySettingObserver& aObs ) |
|
55 { |
|
56 CSPLOGSTRING(CSPOBJECT, |
|
57 "CSPCipheringStatusMonitor::NewL()" ); |
|
58 CSPCipheringStatusMonitor* self = new ( ELeave ) CSPCipheringStatusMonitor( |
|
59 aMmCustom, aObs ); |
|
60 return self; |
|
61 } |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CSPCipheringStatusMonitor::StartMonitoring |
|
65 // Starts ciphering status monitoring |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 void CSPCipheringStatusMonitor::StartMonitoring() |
|
69 { |
|
70 if ( !IsActive() ) |
|
71 { |
|
72 if ( !iIsInitialised ) |
|
73 { |
|
74 // Monitor not initialized, get the initial ciphering status |
|
75 iMmCustom.GetCipheringInfo( iStatus, iCipheringInfo ); |
|
76 } |
|
77 else |
|
78 { |
|
79 // Monitor already initialized, monitor changes |
|
80 iMmCustom.NotifyCipheringInfoChange( iStatus, iCipheringInfo ); |
|
81 } |
|
82 SetActive(); |
|
83 } |
|
84 else |
|
85 { |
|
86 CSPLOGSTRING( CSPINT, |
|
87 "CSP: CSPCipheringStatusMonitor::StartMonitoring: \ |
|
88 not done, already active"); |
|
89 } |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CSPCipheringStatusMonitor::DoCancel |
|
94 // Cancels active object requests |
|
95 // Method calls CancelAsyncRequest from the CustomaEtel object |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 void CSPCipheringStatusMonitor::DoCancel() |
|
99 { |
|
100 CSPLOGSTRING( CSPINT, "CSP: CSPCipheringStatusMonitor::DoCancel" ); |
|
101 |
|
102 if ( IsActive() ) |
|
103 { |
|
104 if( iIsInitialised ) |
|
105 { |
|
106 iMmCustom.CancelAsyncRequest( ECustomNotifyCipheringInfoChangeIPC ); |
|
107 } |
|
108 else |
|
109 { |
|
110 iMmCustom.CancelAsyncRequest( ECustomGetCipheringInfoIPC ); |
|
111 } |
|
112 } |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CPESupplementaryServicesMonitor::RunL |
|
117 // Method gets notification from etel that asyncronous request is completed. |
|
118 // Method sends possible messages to the owner object and |
|
119 // Method makes a new issue request to the CustomEtel. |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 void CSPCipheringStatusMonitor::RunL() |
|
123 { |
|
124 CSPLOGSTRING2(CSPINT, |
|
125 "CSP: CSPCipheringStatusMonitor::RunL: iStatus: %d", iStatus.Int() ); |
|
126 |
|
127 if ( iStatus == KErrNone ) |
|
128 { |
|
129 TBool secureSpecifiedChanged = iSecureSpecified != iCipheringInfo.iIndStatus; |
|
130 |
|
131 // Notify only on secure specified status changes |
|
132 if ( secureSpecifiedChanged ) |
|
133 { |
|
134 // Is set when secure indicator showing is allowed. |
|
135 iSecureSpecified = iCipheringInfo.iIndStatus; |
|
136 |
|
137 if ( !iSecureSpecified ) |
|
138 { |
|
139 iObserver.SecuritySettingChanged( |
|
140 MCSPSecuritySettingObserver::ESecureNotSpecified ); |
|
141 } |
|
142 } |
|
143 |
|
144 TBool callsSecuredChanged = ( iCallsSecured != iCipheringInfo.iCiphStatus ); |
|
145 |
|
146 // Notify secure status changes only when secure has been specified |
|
147 if ( iSecureSpecified && callsSecuredChanged ) |
|
148 { |
|
149 iCallsSecured = iCipheringInfo.iCiphStatus; |
|
150 |
|
151 if ( iCallsSecured ) |
|
152 { |
|
153 iObserver.SecuritySettingChanged( MCSPSecuritySettingObserver::ESecureCall ); |
|
154 } |
|
155 else |
|
156 { |
|
157 iObserver.SecuritySettingChanged( MCSPSecuritySettingObserver::ENotSecureCall ); |
|
158 } |
|
159 } |
|
160 |
|
161 iIsInitialised = ETrue; |
|
162 StartMonitoring(); |
|
163 } |
|
164 else |
|
165 { |
|
166 CSPLOGSTRING( CSPINT, |
|
167 "CSPCipheringStatusMonitor::RunL: Ciphering Off MONITOR OFF" ); |
|
168 } |
|
169 |
|
170 if ( iStatus == KErrNotFound && !iIsInitialised ) |
|
171 { |
|
172 // Network was not ready while fetching ciphering info |
|
173 iIsInitialised = ETrue; |
|
174 StartMonitoring(); |
|
175 CSPLOGSTRING( CSPINT, |
|
176 "CALL: CSPCipheringStatusMonitor::RunL: StartMonitoring()" ); |
|
177 } |
|
178 } |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // CSPCipheringStatusMonitor::NetworkSecurityStatus |
|
182 // Network security status. |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 TBool CSPCipheringStatusMonitor::NetworkSecurityStatus() const |
|
186 { |
|
187 return iCallsSecured; |
|
188 } |
|
189 |
|
190 // ----------------------------------------------------------------------------- |
|
191 // CSPCipheringStatusMonitor::SecureSpecified |
|
192 // Secure specified status. |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 TBool CSPCipheringStatusMonitor::SecureSpecified() const |
|
196 { |
|
197 return iSecureSpecified; |
|
198 } |
|
199 |
|
200 // End of File |
|
201 |
|