|
1 /* |
|
2 * Copyright (c) 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: Private Symbian implementation of ICTS client wrapper |
|
15 * |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 #include <QString> |
|
20 #include <QUrl> |
|
21 |
|
22 |
|
23 // User includes |
|
24 #include "ictsqtwrapper.h" |
|
25 #include "ictsqtwrapper_symbian.h" |
|
26 |
|
27 #include "OstTraceDefinitions.h" |
|
28 #ifdef OST_TRACE_COMPILER_IN_USE |
|
29 #include "ictsqtwrapper_symbianTraces.h" |
|
30 #endif |
|
31 |
|
32 /*! |
|
33 \class IctsWrapper |
|
34 \brief This is a wrapper implementation for symbian side ICTS client interface |
|
35 */ |
|
36 |
|
37 // External function prototypes |
|
38 |
|
39 // Local constants |
|
40 |
|
41 |
|
42 // ======== LOCAL FUNCTIONS ======== |
|
43 |
|
44 |
|
45 // ======== MEMBER FUNCTIONS ======== |
|
46 |
|
47 /*! |
|
48 Constructor |
|
49 |
|
50 */ |
|
51 IctsWrapperPrivate::IctsWrapperPrivate(int aIapId, int aNetId, IctsWrapper *aWrapper) : |
|
52 q_ptr(aWrapper), |
|
53 iIct(NULL) |
|
54 { |
|
55 OstTraceFunctionEntry0(ICTSWRAPPERPRIVATE_ICTSWRAPPERPRIVATE_ENTRY); |
|
56 |
|
57 TRAPD(error,iIct = CIctsClientInterface::NewL(aIapId, aNetId, *this)); |
|
58 qt_symbian_throwIfError(error); |
|
59 |
|
60 OstTraceFunctionExit0(ICTSWRAPPERPRIVATE_ICTSWRAPPERPRIVATE_EXIT); |
|
61 } |
|
62 |
|
63 /*! |
|
64 Destructor |
|
65 |
|
66 */ |
|
67 IctsWrapperPrivate::~IctsWrapperPrivate() |
|
68 { |
|
69 OstTraceFunctionEntry0(ICTSWRAPPERPRIVATE_DESTRUCTOR_ENTRY); |
|
70 |
|
71 delete iIct; |
|
72 |
|
73 OstTraceFunctionExit0(ICTSWRAPPERPRIVATE_DESTRUCTOR_EXIT); |
|
74 } |
|
75 |
|
76 /*! |
|
77 This function is called when connectivity test is ready. This is from MICTSObserver. |
|
78 |
|
79 @param [in] aResult result of internet connectivity test |
|
80 @param [in] aString Possible redirection URL that was received. |
|
81 Valid only when result is EHttpAuthenticationNeeded |
|
82 */ |
|
83 |
|
84 void IctsWrapperPrivate::ConnectivityObserver(TIctsTestResult aResult, const TDesC& aString) |
|
85 { |
|
86 OstTraceFunctionEntry0(ICTSWRAPPERPRIVATE_CONNECTIVITYOBSERVER_ENTRY); |
|
87 |
|
88 QUrl redirectUrl; |
|
89 |
|
90 switch (aResult) |
|
91 { |
|
92 case EConnectionOk: |
|
93 q_ptr->emitConnectivityTestResult(IctsWrapper::ConnectionOk, QUrl("")); |
|
94 break; |
|
95 |
|
96 case EHttpAuthenticationNeeded : |
|
97 //Convert descriptor to QString |
|
98 redirectUrl = QString::fromUtf16(aString.Ptr(), aString.Length()); |
|
99 q_ptr->emitConnectivityTestResult(IctsWrapper::HttpAuthenticationNeeded, redirectUrl); |
|
100 break; |
|
101 |
|
102 case EConnectionNotOk : |
|
103 q_ptr->emitConnectivityTestResult(IctsWrapper::ConnectionNotOk, QUrl("")); |
|
104 break; |
|
105 |
|
106 case ETimeout : |
|
107 q_ptr->emitConnectivityTestResult(IctsWrapper::Timeout, QUrl("")); |
|
108 break; |
|
109 |
|
110 default: |
|
111 q_ptr->emitConnectivityTestResult(IctsWrapper::UnspecifiedError, QUrl("")); |
|
112 break; |
|
113 } |
|
114 |
|
115 OstTraceFunctionExit0(ICTSWRAPPERPRIVATE_CONNECTIVITYOBSERVER_EXIT); |
|
116 } |
|
117 |
|
118 /*! |
|
119 This non leaving function starts internet connectivity test |
|
120 |
|
121 */ |
|
122 void IctsWrapperPrivate::startConnectivityTest() |
|
123 { |
|
124 OstTraceFunctionEntry0(ICTSWRAPPERPRIVATE_STARTCONNECTIVITYTEST_ENTRY); |
|
125 |
|
126 TRAPD(err, iIct->StartL()); |
|
127 |
|
128 // Check if startConnectivityTestL() leaved. |
|
129 if (KErrNone != err) |
|
130 { |
|
131 q_ptr->emitConnectivityTestResult(IctsWrapper::UnspecifiedError, QUrl("")); |
|
132 } |
|
133 |
|
134 OstTraceFunctionExit0(ICTSWRAPPERPRIVATE_STARTCONNECTIVITYTEST_EXIT); |
|
135 } |
|
136 |
|
137 /*! |
|
138 This function starts connectivity test in polling mode |
|
139 |
|
140 @param [in] pollingTime Polling time in microseconds |
|
141 @param [in] pollingInterval Polling interval in microseconds |
|
142 */ |
|
143 void IctsWrapperPrivate::startPolling(int pollingTime, int pollingInterval) |
|
144 { |
|
145 OstTraceFunctionEntry0(ICTSWRAPPERPRIVATE_STARTPOLLING_ENTRY); |
|
146 |
|
147 iIct->StartPolling(pollingTime, pollingInterval); |
|
148 |
|
149 OstTraceFunctionExit0( ICTSWRAPPERPRIVATE_STARTPOLLING_EXIT ); |
|
150 } |
|
151 |
|
152 /*! |
|
153 This function stops connectivity test polling mode |
|
154 */ |
|
155 void IctsWrapperPrivate::stopPolling() |
|
156 { |
|
157 OstTraceFunctionEntry0(ICTSWRAPPERPRIVATE_STOPPOLLING_ENTRY); |
|
158 |
|
159 iIct->StopPolling(); |
|
160 |
|
161 OstTraceFunctionExit0(ICTSWRAPPERPRIVATE_STOPPOLLING_EXIT); |
|
162 } |