|
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 implementation for CIRReportGenerator |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "irqstatisticsreporter.h" |
|
19 #ifdef Q_OS_SYMBIAN |
|
20 #include "irqstatisticsreporter_symbian_p.h" |
|
21 #endif |
|
22 |
|
23 QMutex IRQStatisticsReporter::mMutex; |
|
24 int IRQStatisticsReporter::mRef = 0; |
|
25 IRQStatisticsReporter *IRQStatisticsReporter::mInstatnce = NULL; |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // IRQStatisticsReporter::openInstance() |
|
29 // Static function to get a singleton instance of IRQStatisticsReporter |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 IRQStatisticsReporter* IRQStatisticsReporter::openInstance() |
|
33 { |
|
34 mMutex.lock(); |
|
35 if( NULL == mInstatnce ) |
|
36 { |
|
37 mInstatnce = new IRQStatisticsReporter(); |
|
38 } |
|
39 if( mInstatnce != NULL ) |
|
40 { |
|
41 mRef++; |
|
42 } |
|
43 mMutex.unlock(); |
|
44 return mInstatnce; |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // IRQStatisticsReporter::closeInstance() |
|
49 // Close a singleton instance of IRQStatisticsReporter |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 void IRQStatisticsReporter::closeInstance() |
|
53 { |
|
54 if( mInstatnce != NULL ) |
|
55 { |
|
56 mMutex.lock(); |
|
57 mRef--; |
|
58 if( 0 == mRef ) |
|
59 { |
|
60 delete mInstatnce; |
|
61 } |
|
62 mMutex.unlock(); |
|
63 } |
|
64 } |
|
65 |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // IRQStatisticsReporter::IRQStatisticsReporter() |
|
69 // Constructor. |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 IRQStatisticsReporter::IRQStatisticsReporter() : d_ptr(new IRQStatisticsReporterPrivate()) |
|
73 { |
|
74 d_ptr->init(); |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // IRQStatisticsReporter::~IRQStatisticsReporter() |
|
79 // Destructor. |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 IRQStatisticsReporter::~IRQStatisticsReporter() |
|
83 { |
|
84 delete d_ptr; |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // IRQStatisticsReporter::markSessionStart() |
|
89 // marks the start of a session |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 void IRQStatisticsReporter::markSessionStart() |
|
93 { |
|
94 d_ptr->markSessionStart(); |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // IRQStatisticsReporter::sessionStarted() |
|
99 // starts a new session |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 void IRQStatisticsReporter::sessionStarted(const int aChanneldId, const IRConnectedFrom aConnectedFrom) |
|
103 { |
|
104 d_ptr->sessionStarted(aChanneldId, aConnectedFrom); |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // IRQStatisticsReporter::suspendSession() |
|
109 // function handle session suspend |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 void IRQStatisticsReporter::suspendSession() |
|
113 { |
|
114 d_ptr->suspendSession(); |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // IRQStatisticsReporter::restartSession() |
|
119 // function handle session restart |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 void IRQStatisticsReporter::restartSession() |
|
123 { |
|
124 d_ptr->restartSession(); |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 // IRQStatisticsReporter::sessionEnded() |
|
129 // ends the session |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 void IRQStatisticsReporter::sessionEnded(const IRTerminatedType aTerminatedBy) |
|
133 { |
|
134 d_ptr->sessionEnded(aTerminatedBy); |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // IRQStatisticsReporter::logServerResult() |
|
139 // logs server connection result |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 void IRQStatisticsReporter::logServerResult(const QString& aUrl, const IRServerResult aServerResult) |
|
143 { |
|
144 d_ptr->logServerResult(aUrl, aServerResult); |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // IRQStatisticsReporter::logSongRecogEvent() |
|
149 // logs songRecog event |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 void IRQStatisticsReporter::logSongRecogEvent() |
|
153 { |
|
154 d_ptr->logSongRecogEvent(); |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // IRQStatisticsReporter::logNmsEvents() |
|
159 // logs nmsEvents |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 void IRQStatisticsReporter::logNmsEvent(const IRNmsType aNmsType, const int aChanneldId) |
|
163 { |
|
164 d_ptr->logNmsEvent(aNmsType, aChanneldId); |
|
165 } |