|
1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32base.h> |
|
21 #include <cphcltussdint.h> |
|
22 |
|
23 #include "ussdcomms.h" |
|
24 #include "tflogger.h" |
|
25 |
|
26 // The maximum length of editor lines. |
|
27 const TInt KUssdEditorMaxLength = 182; |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CUssdComms::CUssdComms |
|
32 // Constructor. |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 CUssdComms::CUssdComms(QObject *parent) |
|
36 : QObject(parent), |
|
37 mUssd(NULL), |
|
38 mErrorCode(static_cast<int>(EPhCltExitReasonUnknown)) |
|
39 { |
|
40 // Default value - ETrue |
|
41 TRAP_IGNORE(mUssd = CPhCltUssdInt::NewL()); |
|
42 TFLOGSTRING("USSDEDITOR: CUssdComms::CUssdComms") |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CUssdComms::~CUssdComms |
|
47 // ~CUssdComms. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CUssdComms::~CUssdComms() |
|
51 { |
|
52 if (mUssd){ |
|
53 mErrorCode = mUssd->AppTerminating( |
|
54 static_cast<TPhCltUssdAppExitReason>(mErrorCode)); |
|
55 delete mUssd; |
|
56 mUssd = NULL; |
|
57 TFLOGSTRING2("USSDEDITOR: CUssdComms::~CUssdComms %d", mErrorCode) |
|
58 } |
|
59 TFLOGSTRING("USSDEDITOR: CUssdComms::~CUssdComms") |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CUssdComms::appStarting |
|
64 // appStarting. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 void CUssdComms::appStarting() |
|
68 { |
|
69 mErrorCode = mUssd->AppStarting(); |
|
70 TFLOGSTRING("USSDEDITOR: CUssdComms::appStarting") |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CUssdComms::appTerminating |
|
75 // appTerminating. |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CUssdComms::appTerminating() |
|
79 { |
|
80 mErrorCode = mUssd->AppTerminating(EPhCltUserExit); |
|
81 TFLOGSTRING("USSDEDITOR: CUssdComms::appTerminating") |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CUssdComms::appToBackground |
|
86 // appToBackground. |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 void CUssdComms::appToBackground() |
|
90 { |
|
91 mErrorCode = mUssd->AppToBackground(); |
|
92 TFLOGSTRING("USSDEDITOR: CUssdComms::appToBackground") |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CUssdComms::appToForeground |
|
97 // appToForeground. |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 void CUssdComms::appToForeground() |
|
101 { |
|
102 mErrorCode = mUssd->AppToForeground(); |
|
103 TFLOGSTRING("USSDEDITOR: CUssdComms::appToForeground") |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CUssdComms::send |
|
108 // send. |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 int CUssdComms::send( const QString& message ) |
|
112 { |
|
113 TBuf<KUssdEditorMaxLength> buf16; |
|
114 buf16.Copy((const TUint16*)message.constData(), message.length()); |
|
115 mErrorCode = mUssd->SendUssd(buf16); |
|
116 TFLOGSTRING("USSDEDITOR: CUssdComms::send") |
|
117 return mErrorCode; |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CUssdComms::cancel |
|
122 // cancel. |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 void CUssdComms::cancel() |
|
126 { |
|
127 mUssd->SendUssdCancel(); |
|
128 TFLOGSTRING("USSDEDITOR: CUssdComms::cancel") |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CUssdComms::errorCode |
|
133 // errorCode. |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 int CUssdComms::errorCode() |
|
137 { |
|
138 TFLOGSTRING("USSDEDITOR: CUssdComms::send") |
|
139 return mErrorCode; |
|
140 } |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // CUssdComms::informExitReason |
|
144 // informExitReason. |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 void CUssdComms::informExitReason(int aExitReason) |
|
148 { |
|
149 TFLOGSTRING2("USSDEDITOR: CUssdComms::informExitReason \ |
|
150 %d", aExitReason) |
|
151 mErrorCode = aExitReason; |
|
152 } |
|
153 |
|
154 // End of file |