1 /* |
|
2 * Copyright (c) 2002-2006 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 the License "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: Call Control specific test class. Inherits CSatBase. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <etelsat.h> |
|
22 #include <satcs.h> |
|
23 #include "satsimsessionend.h" |
|
24 |
|
25 |
|
26 const TUint KSessionEndTimeOut = 500000; // 1/2 second |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // CSatSimSessionEnd::CSatSimSessionEnd |
|
30 // C++ default constructor can NOT contain any code, that |
|
31 // might leave. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CSatSimSessionEnd::CSatSimSessionEnd( const RSat& aSat ) : iSat( aSat ) |
|
35 { |
|
36 } |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CSatSimSessionEnd::~CSatSimSessionEnd |
|
39 // Destructor |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 CSatSimSessionEnd::~CSatSimSessionEnd() |
|
43 { |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CSatSimSessionEnd::NotifySat |
|
48 // Send a notify request to Etel |
|
49 // (other items were commented in a header). |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 void CSatSimSessionEnd::NotifySat() |
|
53 { |
|
54 if ( iSessionEndStatus != KRequestPending ) |
|
55 { |
|
56 iSessionEndCompleted = EFalse; |
|
57 iSat.NotifyProactiveSimSessionEnd( iSessionEndStatus ); |
|
58 } |
|
59 else |
|
60 { |
|
61 // None |
|
62 } |
|
63 } |
|
64 |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CSatSimSessionEnd::Cancel |
|
68 // Cancels pending Etel request |
|
69 // (other items were commented in a header). |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 void CSatSimSessionEnd::Cancel() |
|
73 { |
|
74 iSessionEndCompleted = ETrue; |
|
75 |
|
76 if ( iSessionEndStatus == KRequestPending ) |
|
77 { |
|
78 iSat.CancelAsyncRequest( ESatNotifyProactiveSimSessionEnd ); |
|
79 } |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CSatSimSessionEnd::WaitSessionEnd |
|
84 // Waits for a SessionEnd notification from a SIM for a while |
|
85 // (other items were commented in a header). |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 TInt CSatSimSessionEnd::WaitSessionEnd() |
|
89 { |
|
90 TInt ret( KErrNone ); |
|
91 |
|
92 // In case the request is still pending. Wait for SimSessionEnd for one |
|
93 // second. |
|
94 RTimer timeOutTimer; |
|
95 TRequestStatus timeOutStatus; |
|
96 timeOutTimer.CreateLocal(); |
|
97 timeOutTimer.After( timeOutStatus, KSessionEndTimeOut ); |
|
98 |
|
99 User::WaitForRequest( iSessionEndStatus, timeOutStatus ); |
|
100 |
|
101 if ( iSessionEndStatus == KRequestPending ) |
|
102 { |
|
103 // Timeout, no SessionEnd received in time. |
|
104 iSessionEndCompleted = EFalse; |
|
105 ret = KErrTimedOut; |
|
106 } |
|
107 else |
|
108 { |
|
109 // SessionEnded successfully. |
|
110 iSessionEndCompleted = ETrue; |
|
111 |
|
112 // Cancel the timer |
|
113 timeOutTimer.Cancel(); |
|
114 User::WaitForRequest( timeOutStatus ); |
|
115 } |
|
116 |
|
117 timeOutTimer.Close(); |
|
118 |
|
119 return ret; |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // CSatSimSessionEnd::TimedOut |
|
124 // Return true if SessionEnd was timed out |
|
125 // (other items were commented in a header). |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 TBool CSatSimSessionEnd::TimedOut() |
|
129 { |
|
130 TBool ret( EFalse ); |
|
131 |
|
132 if ( !iSessionEndCompleted ) |
|
133 { |
|
134 // Request is still pending |
|
135 if ( KErrTimedOut == WaitSessionEnd() ) |
|
136 { |
|
137 ret = ETrue; |
|
138 } |
|
139 else |
|
140 { |
|
141 ret = EFalse; |
|
142 } |
|
143 } |
|
144 |
|
145 return ret; |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CSatSimSessionEnd::Status |
|
150 // Returns the status of SessionEnd notification |
|
151 // (other items were commented in a header). |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 TInt CSatSimSessionEnd::Status() |
|
155 { |
|
156 return iSessionEndStatus.Int(); |
|
157 } |
|
158 |
|
159 // End of file |
|