|
1 /* |
|
2 * Copyright (c) 2002-2009 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: Handles Ussd communications to the Phone Server. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "UssdComms.h" |
|
22 #include <CPhCltUssd.h> |
|
23 |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // CUssdComms::CUssdComms |
|
30 // C++ default constructor can NOT contain any code, that |
|
31 // might leave. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CUssdComms::CUssdComms() |
|
35 : iExitReason( EPhCltExitReasonUnknown ) |
|
36 { |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CUssdComms::NewL |
|
41 // Two-phased constructor. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 CUssdComms* CUssdComms::NewL() |
|
45 { |
|
46 CUssdComms* self = new( ELeave ) CUssdComms(); |
|
47 CleanupStack::PushL( self ); |
|
48 self->ConstructL(); |
|
49 CleanupStack::Pop(); // self |
|
50 return self; |
|
51 } |
|
52 |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CUssdComms::ConstructL |
|
56 // Symbian 2nd phase constructor can leave. |
|
57 // |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 void CUssdComms::ConstructL() |
|
61 { |
|
62 iUssdClientInt = CPhCltUssdInt::NewL(); |
|
63 User::LeaveIfError( iUssdClientInt->AppStarting() ); |
|
64 } |
|
65 |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CUssdComms::~CUssdComms |
|
69 // Destructor. |
|
70 // |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 CUssdComms::~CUssdComms() |
|
74 { |
|
75 //disconnect from server. No need to check SubSessionHandles. |
|
76 |
|
77 // Inform the exit reason. |
|
78 // If send completed, then the USSD session is not canceled in server side, |
|
79 // to ensure reply possibility to possible network request. |
|
80 |
|
81 if( iUssdClientInt ) |
|
82 { |
|
83 iUssdClientInt->AppTerminating( iExitReason ); |
|
84 } |
|
85 delete iUssdClientInt; |
|
86 } |
|
87 |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CUssdAppUi::SendString |
|
91 // Sends given string to network via phone client. |
|
92 // |
|
93 // ----------------------------------------------------------------------------- |
|
94 TInt CUssdComms::SendString( const TDesC& aString ) |
|
95 { |
|
96 return iUssdClientInt->SendUssd( aString ); |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CUssdAppUi::InformAppForeground |
|
101 // Informs the server that app is on foreground. |
|
102 // |
|
103 // ----------------------------------------------------------------------------- |
|
104 TBool CUssdComms::InformAppForeground() |
|
105 { |
|
106 return iUssdClientInt->AppToForeground(); |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CUssdAppUi::InformAppBackground |
|
111 // Informs the Server that app in on background |
|
112 // |
|
113 // ----------------------------------------------------------------------------- |
|
114 void CUssdComms::InformAppBackground() |
|
115 { |
|
116 iUssdClientInt->AppToBackground(); |
|
117 } |
|
118 |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CUssdAppUi::InformExitReason |
|
122 // |
|
123 // Inform the reason why app was terminated. |
|
124 // ----------------------------------------------------------------------------- |
|
125 void CUssdComms::InformExitReason( TPhCltUssdAppExitReason aExitReason ) |
|
126 { |
|
127 iExitReason = aExitReason; |
|
128 } |
|
129 |
|
130 |
|
131 // End of File |