|
1 /* |
|
2 * Copyright (c) 2002-2004 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: USSD handler class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "RPhCltServer.h" |
|
21 #include "rphcltussd.h" |
|
22 #include "PhCltClientServer.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // RPhCltUssd::RPhCltUssd |
|
29 // Constructor |
|
30 // |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 RPhCltUssd::RPhCltUssd() |
|
34 : RSubSessionBase() |
|
35 { |
|
36 } |
|
37 |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // RPhCltUssd::Open |
|
41 // Open USSD subsession to the Phone Server. |
|
42 // |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 TInt RPhCltUssd::Open( RPhCltServer& aServer ) |
|
46 { |
|
47 return CreateSubSession( |
|
48 aServer, |
|
49 EPhoneServerUSSDSubSessionOpen, |
|
50 TIpcArgs() ); |
|
51 } |
|
52 |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // RPhCltUssd::Close |
|
56 // |
|
57 // Closes the subsession |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 void RPhCltUssd::Close() |
|
61 { |
|
62 CloseSubSession( EPhoneServerUSSDSubSessionClose ); |
|
63 } |
|
64 |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // RPhCltUssd::StartUssdEditor |
|
68 // |
|
69 // Request Ussd App to start |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 TInt RPhCltUssd::StartUssdEditor() const |
|
73 { |
|
74 return SendReceive( |
|
75 EPhoneServerUSSDSubSessionStartEditing, |
|
76 TIpcArgs() ); |
|
77 } |
|
78 |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // RPhCltUssd::AppStarting |
|
82 // |
|
83 // App informs the server about the start-up. |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 TInt RPhCltUssd::AppStarting() |
|
87 { |
|
88 return SendReceive( |
|
89 EPhoneServerUSSDSubSessionAppStarting, |
|
90 TIpcArgs() ); |
|
91 } |
|
92 |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // RPhCltUssd::AppTerminating |
|
96 // |
|
97 // App informs the server about the termination |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 TInt RPhCltUssd::AppTerminating( |
|
101 TPhCltUssdAppExitReason aExitReason ) |
|
102 { |
|
103 TPckg< TPhCltUssdAppExitReason > exitReasonPckg( aExitReason ); |
|
104 |
|
105 return SendReceive( |
|
106 EPhoneServerUSSDSubSessionAppTerminating, |
|
107 TIpcArgs( &exitReasonPckg ) ); |
|
108 } |
|
109 |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // RPhCltUssd::AppToForeground |
|
113 // |
|
114 // App informs the server about the foreground event |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 TBool RPhCltUssd::AppToForeground() |
|
118 { |
|
119 TInt ret = SendReceive( |
|
120 EPhoneServerUSSDSubSessionAppToForeground, |
|
121 TIpcArgs() ); |
|
122 if ( ret > 0 ) |
|
123 { |
|
124 return ETrue; |
|
125 } |
|
126 return EFalse; |
|
127 } |
|
128 |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // RPhCltUssd::AppToBackgroud |
|
132 // |
|
133 // App informs the server about the background event |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 TInt RPhCltUssd::AppToBackground() |
|
137 { |
|
138 return SendReceive( |
|
139 EPhoneServerUSSDSubSessionAppToBackground, |
|
140 TIpcArgs() ); |
|
141 } |
|
142 |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // RPhCltUssd::SendUssd |
|
146 // |
|
147 // Send Ussd string to the server - async |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 void RPhCltUssd::SendUssd( |
|
151 TRequestStatus& aReqStatus, |
|
152 const TDesC8& aMsgData, |
|
153 const TDesC8& aMsgAttribute ) |
|
154 { |
|
155 SendReceive( |
|
156 EPhoneServerUSSDSubSessionSendMessage, |
|
157 TIpcArgs( |
|
158 &aMsgData, |
|
159 aMsgData.Length(), |
|
160 &aMsgAttribute ), |
|
161 aReqStatus ); |
|
162 } |
|
163 |
|
164 |
|
165 // ----------------------------------------------------------------------------- |
|
166 // RPhCltUssd::CancelSend |
|
167 // |
|
168 // Cancels the send |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 void RPhCltUssd::CancelSend() |
|
172 { |
|
173 SendReceive( |
|
174 EPhoneServerUSSDSubSessionSendMessageCancel, |
|
175 TIpcArgs() ); |
|
176 } |
|
177 |
|
178 |
|
179 // ----------------------------------------------------------------------------- |
|
180 // RPhCltUssd::StartSAT |
|
181 // |
|
182 // Starts SAT interaction. |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 void RPhCltUssd::StartSAT( |
|
186 TRequestStatus& aStatus , |
|
187 TDes& aReceiveMessage, |
|
188 TPckg< TUint >& aShowNotesAndDcs ) |
|
189 { |
|
190 __ASSERT_ALWAYS( |
|
191 SubSessionHandle() , |
|
192 User::Panic( KPhClientPanicCategory , KErrBadHandle ) ); |
|
193 |
|
194 SendReceive( |
|
195 EPhoneServerUSSDSubSessionStartSAT, |
|
196 TIpcArgs( |
|
197 &aShowNotesAndDcs, |
|
198 aReceiveMessage.MaxLength(), |
|
199 &aReceiveMessage ), |
|
200 aStatus ); |
|
201 } |
|
202 |
|
203 |
|
204 // ----------------------------------------------------------------------------- |
|
205 // RPhCltUssd::StopSAT |
|
206 // |
|
207 // End SAT interaction. |
|
208 // ----------------------------------------------------------------------------- |
|
209 // |
|
210 void RPhCltUssd::StopSAT() |
|
211 { |
|
212 __ASSERT_ALWAYS( |
|
213 SubSessionHandle() , |
|
214 User::Panic( KPhClientPanicCategory , KErrBadHandle ) ); |
|
215 |
|
216 SendReceive( |
|
217 EPhoneServerUSSDSubSessionStopSAT, |
|
218 TIpcArgs() ); |
|
219 } |
|
220 |
|
221 |
|
222 // End of File |