|
1 /* |
|
2 * Copyright (c) 2009-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: Qt wrapper class declaration for CIRReportGenerator |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef IRQSTATISTICSREPORTER_H_ |
|
20 #define IRQSTATISTICSREPORTER_H_ |
|
21 |
|
22 #include <QObject> |
|
23 #include <QString> |
|
24 |
|
25 #include "irqevent.h" |
|
26 #include "irqenums.h" |
|
27 |
|
28 class CIRReportGenerator; |
|
29 class IRQNetworkController; |
|
30 class IRQIsdsClient; |
|
31 class IRQReportSender; |
|
32 |
|
33 /*! |
|
34 * This class provides usage report related interface. |
|
35 * |
|
36 * IRQReportGenerator follows singleton pattern |
|
37 * |
|
38 */ |
|
39 class IRQStatisticsReporter : public QObject |
|
40 { |
|
41 Q_OBJECT |
|
42 |
|
43 public: |
|
44 |
|
45 /*! |
|
46 * Get the instance of IRQStatisticsReporter |
|
47 * @return IRQStatisticsReporter* |
|
48 */ |
|
49 IMPORT_C static IRQStatisticsReporter* openInstance(IRQIsdsClient *aIsdsClient); |
|
50 |
|
51 /*! |
|
52 * Close the instance of IRQStatisticsReporter |
|
53 */ |
|
54 IMPORT_C void closeInstance(); |
|
55 |
|
56 private: |
|
57 /** |
|
58 * Creates IRQStatisticsReporter instance |
|
59 */ |
|
60 static IRQStatisticsReporter* createInstanceL(IRQIsdsClient *aIsdsClient); |
|
61 |
|
62 /*! |
|
63 * Constructor. |
|
64 */ |
|
65 IRQStatisticsReporter(); |
|
66 |
|
67 void constructL(IRQIsdsClient *aIsdsClient); |
|
68 |
|
69 /*! |
|
70 * Destructor. |
|
71 */ |
|
72 ~IRQStatisticsReporter(); |
|
73 |
|
74 public: |
|
75 |
|
76 /*! |
|
77 * The following methods are for Nms Event Usage Logging |
|
78 * |
|
79 * <session starttime="R" duration="R" terminatedBy="R" connectedFrom="R" id="R"> |
|
80 * <channelid>1234</channelid> |
|
81 * <serverResult url="R">Connected</serverResult> |
|
82 * <connection type="R"> |
|
83 * <operator currentNetwork="R" homeOperator=""/> |
|
84 * </connection> |
|
85 * </session> |
|
86 */ |
|
87 |
|
88 /*! |
|
89 * Function: sessionStarted |
|
90 * starts a new session |
|
91 * @return bool return ture if session is started successfully, otherwise, return false. |
|
92 */ |
|
93 IMPORT_C bool sessionStarted(const int aChannelId, const IRQConnectedFrom aConnectedFrom); |
|
94 |
|
95 /*! |
|
96 * Function: markSessionStart |
|
97 * marks the start of a session |
|
98 */ |
|
99 IMPORT_C void markSessionStart(); |
|
100 |
|
101 /*! |
|
102 * Function: suspendSession |
|
103 * function handle session suspend |
|
104 */ |
|
105 IMPORT_C void suspendSession(); |
|
106 |
|
107 /*! |
|
108 * Function: restartSession |
|
109 * function handle session restart |
|
110 */ |
|
111 IMPORT_C void restartSession(); |
|
112 |
|
113 /*! |
|
114 * Function: sessionEnd |
|
115 * ends the session |
|
116 */ |
|
117 IMPORT_C void sessionEnded(const IRQTerminatedType aTerminatedBy); |
|
118 |
|
119 /*! |
|
120 * Function: logServerResult |
|
121 * logs server connection result |
|
122 * @param aUrl URL to which connection is attempted |
|
123 * @param aServerResult response from server |
|
124 */ |
|
125 IMPORT_C void logServerResult(const QString& aUrl, const IRQError aServerResult); |
|
126 |
|
127 /*! |
|
128 * The following methods are for Nms Event Usage Logging |
|
129 * |
|
130 * <nmsLog> |
|
131 * <nmsEvent timeStamp="R" channelId="" type="R"> |
|
132 * <operator currentNetwork="R" homeOperator=""/> |
|
133 * </nmsEvent> |
|
134 * </nmsLog> |
|
135 */ |
|
136 |
|
137 /*! |
|
138 * Function: logNmsEvent |
|
139 * logs nmsEvent to Xml file |
|
140 * @param aNmsType Nms type |
|
141 * @param aChannelId Nms channel id |
|
142 */ |
|
143 IMPORT_C void logNmsEvent(const IRQNmsType aNmsType, const int aChannelId); |
|
144 |
|
145 /*! |
|
146 * Function: logSongRecogEvent |
|
147 * logs songRecog event to Xml file |
|
148 */ |
|
149 IMPORT_C void logSongRecogEvent(); |
|
150 |
|
151 public slots: |
|
152 |
|
153 /*! |
|
154 * Function: updateCurrentNetwork |
|
155 * updates the current network |
|
156 */ |
|
157 IMPORT_C void updateCurrentNetwork(const QString &aCurrentNwkMCC, const QString &aCurrentNwkMNC); |
|
158 |
|
159 /*! |
|
160 * Function: updateHomeOperator |
|
161 * updates the home network |
|
162 */ |
|
163 IMPORT_C void updateHomeOperator(const QString &aHomeNetworkMCC, const QString &aHomeNetworkMNC); |
|
164 |
|
165 private slots: |
|
166 |
|
167 /*! |
|
168 * Function: reportSent |
|
169 * should be called after report is sent to isds server |
|
170 */ |
|
171 void reportSent(); |
|
172 |
|
173 private: |
|
174 |
|
175 /*! |
|
176 * Function: updateTerminatedBy |
|
177 * updates the termination status |
|
178 * @param aTerminatedBy terminated by information |
|
179 */ |
|
180 void updateTerminatedBy(const IRQTerminatedType aTerminatedBy); |
|
181 |
|
182 /*! |
|
183 * Function: updateConnectedFrom |
|
184 * updateds connected information |
|
185 * @param aConnectedFrom connected from information |
|
186 */ |
|
187 void updateConnectedFrom(const IRQConnectedFrom aConnectedFrom); |
|
188 |
|
189 /*! |
|
190 * Function: updateConnectionType |
|
191 * updates the connection type |
|
192 */ |
|
193 void updateConnectionType(); |
|
194 |
|
195 /*! |
|
196 * Function: updateNmsType |
|
197 * updates the nokia music shop access type |
|
198 */ |
|
199 void updateNmsType(const IRQNmsType aNmsType); |
|
200 |
|
201 /*! |
|
202 * Function: doLogNmsEventL |
|
203 * logs nmsEvents to Xml file |
|
204 * @param aNmsType Nms type |
|
205 * @param aChannelId Nms channel id |
|
206 */ |
|
207 void doLogNmsEventL(const IRQNmsType aNmsType, const int aChannelId); |
|
208 |
|
209 private: |
|
210 |
|
211 CIRReportGenerator *iBody; |
|
212 |
|
213 IRQReportSender *iSender; |
|
214 |
|
215 /*! |
|
216 * Used for retrieving Connection Type |
|
217 */ |
|
218 IRQNetworkController *iNetworkController; |
|
219 |
|
220 int iCurrentNetwork; |
|
221 |
|
222 int iHomeOperator; |
|
223 |
|
224 /*! |
|
225 * Number of objects currently referring to the singleton object |
|
226 */ |
|
227 int iSingletonInstances; |
|
228 }; |
|
229 |
|
230 #endif /* IRQSTATISTICSREPORTER_H_ */ |