23 #endif |
23 #endif |
24 |
24 |
25 #include "irplaycontroller.h" |
25 #include "irplaycontroller.h" |
26 #include "irapplication.h" |
26 #include "irapplication.h" |
27 #include "irqmediaplayer.h" |
27 #include "irqmediaplayer.h" |
28 #include "irabstractviewmanager.h" |
28 #include "irviewmanager.h" |
29 #include "irqisdsdatastructure.h" |
29 #include "irqisdsdatastructure.h" |
30 #include "irlastplayedstationinfo.h" |
30 #include "irlastplayedstationinfo.h" |
31 #include "irqnetworkcontroller.h" |
31 #include "irqnetworkcontroller.h" |
32 #include "irqsonghistoryengine.h" |
32 #include "irqsonghistoryengine.h" |
33 #include "irqmetadata.h" |
33 #include "irqmetadata.h" |
34 #include "irqsettings.h" |
34 #include "irqsettings.h" |
35 #include "irqfavoritesdb.h" |
35 #include "irqfavoritesdb.h" |
36 #include "irqstatisticsreporter.h" |
36 #include "irqstatisticsreporter.h" |
|
37 #include "irenummapper.h" |
37 |
38 |
38 #ifdef Q_CC_NOKIAX86 |
39 #ifdef Q_CC_NOKIAX86 |
39 void getRadioServerAddress(QString & aUrl); |
40 void getRadioServerAddress(QString & aUrl); |
40 #endif |
41 #endif |
|
42 |
|
43 BEGIN_ENUM_MAP( KTerminationTypeMap ) |
|
44 ENUM_MAP_ITEM( EIRQUserTerminated, IRQStatisticsReporter::EIRUserTerminated ), |
|
45 ENUM_MAP_ITEM( EIRQNoConnectionToServer, IRQStatisticsReporter::EIRNoConnToServer ), |
|
46 ENUM_MAP_ITEM( EIRQNoConnectionToNetwork, IRQStatisticsReporter::EIRNoConnToNetwork ) |
|
47 END_ENUM_MAP( KTerminationTypeMap ) |
|
48 |
|
49 #define MAP_TO_ENGINE_TerminationType(ui_enum) \ |
|
50 MAP_TO_ENGINE_ENUM( IRQTerminatedType, \ |
|
51 IRQStatisticsReporter::IRTerminatedType, \ |
|
52 ui_enum, KTerminationTypeMap ) |
|
53 |
|
54 BEGIN_ENUM_MAP( KServerResultMap ) |
|
55 ENUM_MAP_ITEM( EIRQPlayerErrorServerFull, IRQStatisticsReporter::EIRServerFull ), |
|
56 ENUM_MAP_ITEM( EIRQPlayerErrorTimeOut, IRQStatisticsReporter::EIRTimeOut ), |
|
57 ENUM_MAP_ITEM( EIRQPlayerErrorConnectingFailed, IRQStatisticsReporter::EIRConnectFailed ) |
|
58 END_ENUM_MAP( KServerResultMap ) |
|
59 |
|
60 #define MAP_TO_ENGINE_ServerResult(ui_enum) \ |
|
61 MAP_TO_ENGINE_ENUM( IRQError, \ |
|
62 IRQStatisticsReporter::IRServerResult, \ |
|
63 ui_enum, KServerResultMap ) |
|
64 |
|
65 BEGIN_ENUM_MAP( KConnectedFromMap ) |
|
66 ENUM_MAP_ITEM( EIRQIsds, IRQStatisticsReporter::EIRIsds ), |
|
67 ENUM_MAP_ITEM( EIRQPresetAdhoc, IRQStatisticsReporter::EIRPresetAdhoc ), |
|
68 ENUM_MAP_ITEM( EIRQPresetIsds, IRQStatisticsReporter::EIRPresetIsds ), |
|
69 ENUM_MAP_ITEM( EIRQHistoryAdhoc, IRQStatisticsReporter::EIRHistoryAdhoc ), |
|
70 ENUM_MAP_ITEM( EIRQHistoryIsds, IRQStatisticsReporter::EIRHistoryIsds ), |
|
71 ENUM_MAP_ITEM( EIRQAdhocManual, IRQStatisticsReporter::EIRAdhocManual ), |
|
72 ENUM_MAP_ITEM( EIRQAdhocExternal, IRQStatisticsReporter::EIRAdhocExternal ) |
|
73 END_ENUM_MAP( KConnectedFromMap ) |
|
74 |
|
75 #define MAP_TO_ENGINE_ConnectedFrom(ui_enum) \ |
|
76 MAP_TO_ENGINE_ENUM( IRQConnectedFrom, \ |
|
77 IRQStatisticsReporter::IRConnectedFrom, \ |
|
78 ui_enum, KConnectedFromMap ) |
41 |
79 |
42 // public functions |
80 // public functions |
43 |
81 |
44 /* |
82 /* |
45 * Description : constructor |
83 * Description : constructor |
47 IRPlayController::IRPlayController(IRApplication* aApplication) : |
85 IRPlayController::IRPlayController(IRApplication* aApplication) : |
48 iApplication(aApplication), |
86 iApplication(aApplication), |
49 iMediaPlayer(new IRQMediaPlayer()), |
87 iMediaPlayer(new IRQMediaPlayer()), |
50 iStatisticsReporter(NULL), |
88 iStatisticsReporter(NULL), |
51 iConnectedFrom(EIRQIsds), |
89 iConnectedFrom(EIRQIsds), |
52 iSessionStarted(false), |
|
53 iGetServerResult(false), |
90 iGetServerResult(false), |
54 iBufferingDialog(NULL), |
91 iBufferingDialog(NULL), |
55 iNowPlayingPreset(new IRQPreset()), |
92 iNowPlayingPreset(new IRQPreset()), |
56 iMetaData(NULL), |
93 iMetaData(NULL), |
57 iSongHistoryEngine(IRQSongHistoryEngine::openInstance()), |
94 iSongHistoryEngine(IRQSongHistoryEngine::openInstance()), |
58 iPlayState(EStopped), |
95 iPlayState(EIdle), |
59 iResuming(false), |
96 iResuming(false), |
60 iTryingBitrate(0), |
97 iTryingBitrate(0), |
61 iUrlArray(0), |
98 iUrlArray(0), |
62 iRealBitrate(0), |
99 iRealBitrate(0), |
63 iLastError(EIRQErrorNone), |
100 iLastError(EIRQErrorNone), |
64 iStopReason(EIRQUnknownTermination) |
101 iStopReason(EIRQUnknownTermination) |
65 { |
102 { |
66 connectSignalSlot(); |
103 connectSignalSlot(); |
67 iStatisticsReporter = iApplication->getStatisticsReporter(); |
104 iStatisticsReporter = IRQStatisticsReporter::openInstance(); |
68 } |
105 } |
69 |
106 |
70 /* |
107 /* |
71 * Description : destructor |
108 * Description : destructor |
72 */ |
109 */ |
73 IRPlayController::~IRPlayController() |
110 IRPlayController::~IRPlayController() |
74 { |
111 { |
75 iApplication = NULL; |
|
76 iPlayState = EStopped; |
|
77 |
|
78 delete iBufferingDialog; |
112 delete iBufferingDialog; |
79 iBufferingDialog = NULL; |
113 iBufferingDialog = NULL; |
80 |
114 |
81 stop(EIRQUserTerminated); |
115 stop(EIRQUserTerminated); |
82 delete iMediaPlayer; |
116 delete iMediaPlayer; |
215 /* |
252 /* |
216 * Description : End Session |
253 * Description : End Session |
217 */ |
254 */ |
218 void IRPlayController::endSession(IRQTerminatedType aStopReason) |
255 void IRPlayController::endSession(IRQTerminatedType aStopReason) |
219 { |
256 { |
220 if(iStatisticsReporter && iSessionStarted) |
257 if(iStatisticsReporter) |
221 { |
258 { |
222 if(!iGetServerResult) |
259 if(!iGetServerResult) |
223 { |
260 { |
224 iStatisticsReporter->logServerResult(iLastPlayedUrl,EIRQPlayerErrorConnectingFailed); |
261 iStatisticsReporter->logServerResult(iLastPlayedUrl,IRQStatisticsReporter::EIRConnectFailed); |
225 } |
262 } |
226 iStatisticsReporter->sessionEnded(aStopReason); |
263 iStatisticsReporter->sessionEnded(MAP_TO_ENGINE_TerminationType(aStopReason)); |
227 iSessionStarted = false; |
|
228 } |
264 } |
229 } |
265 } |
230 |
266 |
231 /* |
267 /* |
232 * Description : get current volume setting from media player or |
268 * Description : get current volume setting from media player or |
412 case EIRQPlayerErrorServerFull: |
458 case EIRQPlayerErrorServerFull: |
413 case EIRQPlayerErrorTimeOut: |
459 case EIRQPlayerErrorTimeOut: |
414 case EIRQPlayerErrorConnectingFailed: |
460 case EIRQPlayerErrorConnectingFailed: |
415 if(iStatisticsReporter) |
461 if(iStatisticsReporter) |
416 { |
462 { |
417 iStatisticsReporter->logServerResult(iLastPlayedUrl,iLastError); |
463 iStatisticsReporter->logServerResult(iLastPlayedUrl,MAP_TO_ENGINE_ServerResult(iLastError)); |
418 iGetServerResult = true; |
464 iGetServerResult = true; |
419 } |
465 } |
420 |
466 |
421 // if there's NO other URL to try, show warning. |
467 // if there's NO other URL to try, show warning. |
422 if (iNowPlayingPreset->getChannelURLCount() == 1) |
468 if (iNowPlayingPreset->getChannelURLCount() == 1) |
423 { |
469 { |
424 endSession(EIRQNoConnectionToServer); |
470 stop(EIRQNoConnectionToServer); |
425 break; |
471 break; |
426 } |
472 } |
427 |
473 |
428 if (iResuming) |
474 if (iResuming) |
429 { |
475 { |
506 // Save the station information to database |
552 // Save the station information to database |
507 IRQMetaData tmpMetaData; |
553 IRQMetaData tmpMetaData; |
508 tmpMetaData.setBitrate(iRealBitrate); |
554 tmpMetaData.setBitrate(iRealBitrate); |
509 tmpMetaData.setStreamUrl(iLastPlayedUrl); |
555 tmpMetaData.setStreamUrl(iLastPlayedUrl); |
510 iSongHistoryEngine->handleMetaDataReceived(tmpMetaData, *iNowPlayingPreset); |
556 iSongHistoryEngine->handleMetaDataReceived(tmpMetaData, *iNowPlayingPreset); |
511 // open stereo according to settings |
557 // open stereo defaultly |
512 if (1 == iApplication->getSettings()->getStereoMode()) |
558 iMediaPlayer->enableStereoEffect(); |
513 { |
|
514 iMediaPlayer->enableStereoEffect(); |
|
515 } |
|
516 } |
559 } |
517 } |
560 } |
518 } |
561 } |
519 |
562 |
520 /* |
563 /* |