|
1 /* |
|
2 * Copyright (c) 2005 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: MPM Dual Transfer Mode watcher |
|
15 * |
|
16 */ |
|
17 |
|
18 /** |
|
19 @file mpmdtmwatcher.cpp |
|
20 Mobility Policy Manager Dual Transfer Mode watcher. |
|
21 */ |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include "mpmdtmwatcher.h" |
|
25 #include "mpmserver.h" |
|
26 #include "mpmlogger.h" |
|
27 #include <pcktcs.h> // This header has to be the last in the include file list |
|
28 // in order to avoid this error: |
|
29 // \EPOC32\include\pcktcs.h:26: undefined identifier 'TLitC' |
|
30 |
|
31 // ============================ MEMBER FUNCTIONS =============================== |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CMPMDtmWatcher::NewL |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CMPMDtmWatcher* CMPMDtmWatcher::NewL( RPacketService& aPacketService ) |
|
38 { |
|
39 CMPMDtmWatcher* self = new( ELeave ) CMPMDtmWatcher( aPacketService ); |
|
40 CleanupStack::PushL( self ); |
|
41 self->ConstructL(); |
|
42 CleanupStack::Pop( self ); |
|
43 return self; |
|
44 } |
|
45 |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CMPMDtmWatcher::CMPMDtmWatcher |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 CMPMDtmWatcher::CMPMDtmWatcher( RPacketService& aPacketService ) |
|
52 : CActive( CActive::EPriorityStandard ), |
|
53 iPacketService( aPacketService ), |
|
54 iMsClass( RPacketService::EMSClassUnknown ), |
|
55 iMaxMsClass( RPacketService::EMSClassUnknown ) |
|
56 { |
|
57 CActiveScheduler::Add( this ); |
|
58 } |
|
59 |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CMPMDtmWatcher::~CMPMDtmWatcher |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CMPMDtmWatcher::~CMPMDtmWatcher() |
|
66 { |
|
67 MPMLOGSTRING( "CMPMDtmWatcher::~CMPMDtmWatcher" ) |
|
68 Cancel(); |
|
69 } |
|
70 |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CMPMDtmWatcher::ConstructL |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 void CMPMDtmWatcher::ConstructL() |
|
77 { |
|
78 MPMLOGSTRING( "CMPMDtmWatcher::ConstructL" ) |
|
79 |
|
80 // Request current MS class from ETel |
|
81 // |
|
82 TRequestStatus status; |
|
83 MPMLOGSTRING( "CMPMDtmWatcher::ConstructL GetMSClass" ) |
|
84 iPacketService.GetMSClass( status, iMsClass, iMaxMsClass ); |
|
85 MPMLOGSTRING( "CMPMDtmWatcher::ConstructL WaitForRequest" ) |
|
86 // This information is needed before the server is started. |
|
87 // |
|
88 User::WaitForRequest( status ); |
|
89 MPMLOGSTRING2( "CMPMDtmWatcher::ConstructL LeaveIfError: %d", status.Int() ) |
|
90 User::LeaveIfError( status.Int() ); |
|
91 |
|
92 LogPacketClass(); |
|
93 |
|
94 // Request notification from ETel about MS class change |
|
95 iPacketService.NotifyMSClassChange( iStatus, iMsClass ); |
|
96 SetActive(); |
|
97 } |
|
98 |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CMPMDtmWatcher::IsInDualMode |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 TBool CMPMDtmWatcher::IsInDualMode() const |
|
105 { |
|
106 MPMLOGSTRING( "CMPMDtmWatcher::IsInDualMode" ) |
|
107 |
|
108 LogPacketClass(); |
|
109 |
|
110 return ( iMsClass == RPacketService::EMSClassDualMode ); |
|
111 } |
|
112 |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CMPMDtmWatcher::RunL |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 void CMPMDtmWatcher::RunL() |
|
119 { |
|
120 MPMLOGSTRING( "CMPMDtmWatcher::RunL" ) |
|
121 |
|
122 LogPacketClass(); |
|
123 |
|
124 // Request notification from ETel about MS class change |
|
125 iPacketService.NotifyMSClassChange( iStatus, iMsClass ); |
|
126 SetActive(); |
|
127 } |
|
128 |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CMPMDtmWatcher::DoCancel |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 void CMPMDtmWatcher::DoCancel() |
|
135 { |
|
136 MPMLOGSTRING( "CMPMDtmWatcher::DoCancel" ) |
|
137 |
|
138 iPacketService.CancelAsyncRequest( EPacketNotifyMSClassChange ); |
|
139 } |
|
140 |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // CMPMDtmWatcher::LogPacketClass |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 void CMPMDtmWatcher::LogPacketClass() const |
|
147 { |
|
148 #ifdef _DEBUG |
|
149 switch ( iMsClass ) |
|
150 { |
|
151 // Active simultaneous PS and CS calls supported (Class A) |
|
152 case RPacketService::EMSClassDualMode: |
|
153 { |
|
154 MPMLOGSTRING( "CMPMDtmWatcher::LogPacketClass EMSClassDualMode" ) |
|
155 break; |
|
156 } |
|
157 // Active CS and Suspended PS simultaneous calls supported (Class B) |
|
158 case RPacketService::EMSClassSuspensionRequired: |
|
159 { |
|
160 MPMLOGSTRING( |
|
161 "CMPMDtmWatcher::LogPacketClass EMSClassSuspensionRequired" ) |
|
162 break; |
|
163 } |
|
164 // Active CS or Active PS only call supported (Class C) |
|
165 case RPacketService::EMSClassAlternateMode: |
|
166 { |
|
167 MPMLOGSTRING( |
|
168 "CMPMDtmWatcher::LogPacketClass EMSClassAlternateMode" ) |
|
169 break; |
|
170 } |
|
171 // Active CS only call supported (Class C) |
|
172 case RPacketService::EMSClassCircuitSwitchedOnly: |
|
173 { |
|
174 MPMLOGSTRING( |
|
175 "CMPMDtmWatcher::LogPacketClass EMSClassCircuitSwitchedOnly" ) |
|
176 break; |
|
177 } |
|
178 // Active PS only call supported (Class C) |
|
179 case RPacketService::EMSClassPacketSwitchedOnly: |
|
180 { |
|
181 MPMLOGSTRING( |
|
182 "CMPMDtmWatcher::LogPacketClass EMSClassPacketSwitchedOnly" ) |
|
183 break; |
|
184 } |
|
185 // Unknown what configuration is supported |
|
186 case RPacketService::EMSClassUnknown: |
|
187 { |
|
188 MPMLOGSTRING( "CMPMDtmWatcher::LogPacketClass EMSClassUnknown" ) |
|
189 break; |
|
190 } |
|
191 default: |
|
192 { |
|
193 MPMLOGSTRING( |
|
194 "CMPMDtmWatcher::LogPacketClass Packet class unspecified" ) |
|
195 break; |
|
196 } |
|
197 } |
|
198 #endif // _DEBUG |
|
199 |
|
200 return; |
|
201 } |
|
202 |
|
203 // End of File |