author | teknolog |
Sun, 04 Apr 2010 18:06:31 +0100 | |
changeset 78 | 12c59f14a031 |
parent 35 | 66c5303f3610 |
child 83 | a2e43aa1ad11 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
2 |
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB |
|
3 |
* |
|
4 |
* All rights reserved. |
|
5 |
* This component and the accompanying materials are made available |
|
6 |
* under the terms of the License "Eclipse Public License v1.0" |
|
7 |
* which accompanies this distribution, and is available |
|
8 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 |
* |
|
10 |
* Initial Contributors: |
|
11 |
* EmbedDev AB - initial contribution. |
|
12 |
* |
|
13 |
* Contributors: |
|
14 |
* |
|
15 |
* Description: |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
#ifndef SHOWENGINE_H_ |
|
20 |
#define SHOWENGINE_H_ |
|
21 |
||
22 |
#include <e32base.h> |
|
23 |
#include <APGCLI.H> |
|
24 |
#include "constants.h" |
|
25 |
#include "ShowInfo.h" |
|
26 |
#include "PodcastModel.h" |
|
27 |
#include "HttpClient.h" |
|
28 |
#include "ShowEngineObserver.h" |
|
29 |
#include "MetaDataReader.h" |
|
30 |
#include "sqlite3.h" |
|
31 |
||
32 |
class CShowEngine : public CBase, public MHttpClientObserver, public MMetaDataReaderObserver |
|
33 |
{ |
|
34 |
public: |
|
35 |
IMPORT_C static CShowEngine* NewL(CPodcastModel& aPodcastModel); |
|
36 |
IMPORT_C virtual ~CShowEngine(); |
|
37 |
||
38 |
public: |
|
39 |
IMPORT_C void AddDownloadL(CShowInfo& info); |
|
78 | 40 |
IMPORT_C void RemoveDownloadL(TUint aUid); |
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
2
diff
changeset
|
41 |
IMPORT_C void RemoveAllDownloadsL(); |
2 | 42 |
|
43 |
IMPORT_C void SuspendDownloads(); |
|
44 |
IMPORT_C void ResumeDownloadsL(); |
|
45 |
||
46 |
IMPORT_C TInt GetNumDownloadingShows(); |
|
47 |
IMPORT_C CShowInfo* ShowDownloading(); |
|
48 |
IMPORT_C CShowInfo* GetShowByUidL(TUint aShowUid); |
|
49 |
IMPORT_C CShowInfo* GetNextShowByTrackL(CShowInfo* aShowInfo); |
|
50 |
||
51 |
// show access methods |
|
52 |
IMPORT_C void GetAllShowsL(RShowInfoArray &aArray); |
|
53 |
IMPORT_C void GetShowsByFeedL(RShowInfoArray &aArray, TUint aFeedUid); |
|
54 |
IMPORT_C void GetShowsDownloadedL(RShowInfoArray &aArray); |
|
55 |
IMPORT_C void GetNewShowsL(RShowInfoArray &aArray); |
|
56 |
IMPORT_C void GetShowsDownloadingL(RShowInfoArray &aArray); |
|
57 |
IMPORT_C CShowInfo* DBGetShowByFileNameL(TFileName aFileName); |
|
58 |
||
78 | 59 |
IMPORT_C void AddShowL(const CShowInfo& item); |
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
2
diff
changeset
|
60 |
IMPORT_C void DeletePlayedShowsL(RShowInfoArray &aShowInfoArray); |
2 | 61 |
IMPORT_C void DeleteAllShowsByFeedL(TUint aFeedUid,TBool aDeleteFiles=ETrue); |
62 |
IMPORT_C void DeleteShowL(TUint aShowUid, TBool aRemoveFile=ETrue); |
|
78 | 63 |
IMPORT_C void DeleteOldShowsByFeedL(TUint aFeedUid); |
2 | 64 |
|
65 |
IMPORT_C void AddObserver(MShowEngineObserver *observer); |
|
66 |
IMPORT_C void RemoveObserver(MShowEngineObserver *observer); |
|
67 |
||
68 |
IMPORT_C void NotifyShowListUpdatedL(); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
2
diff
changeset
|
69 |
IMPORT_C void UpdateShowL(CShowInfo& aInfo); |
2 | 70 |
|
71 |
IMPORT_C void GetMimeType(const TDesC& aFileName, TDes& aMimeType); |
|
72 |
||
73 |
IMPORT_C CMetaDataReader& MetaDataReader(); |
|
74 |
||
75 |
private: |
|
76 |
// from HttpClientObserver, dont have to be public |
|
77 |
void Connected(CHttpClient* aClient); |
|
78 |
void Disconnected(CHttpClient* aClient); |
|
79 |
void CompleteL(CHttpClient* aClient, TInt aError); |
|
80 |
void Progress(CHttpClient* aHttpClient, int aBytes, int aTotalBytes); |
|
81 |
void DownloadInfo(CHttpClient* aClient, int aSize); |
|
82 |
void FileError(TUint aError); |
|
83 |
// from MetaDataReaderObserver |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
2
diff
changeset
|
84 |
void ReadMetaDataL(CShowInfo& aShowInfo); |
2 | 85 |
void ReadMetaDataCompleteL(); |
86 |
||
87 |
private: |
|
88 |
CShowEngine(CPodcastModel& aPodcastModel); |
|
89 |
void ConstructL(); |
|
90 |
||
78 | 91 |
void GetShowL(CShowInfo *info); |
2 | 92 |
|
93 |
void NotifyDownloadQueueUpdatedL(); |
|
94 |
void NotifyShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt aBytesTotal); |
|
95 |
void NotifyShowFinishedL(TInt aError); |
|
96 |
void DownloadNextShowL(); |
|
97 |
||
98 |
static TInt CompareShowsByDate(const CShowInfo &a, const CShowInfo &b); |
|
99 |
static TBool CompareShowsByUid(const CShowInfo &a, const CShowInfo &b); |
|
100 |
static TInt CompareShowsByTitle(const CShowInfo &a, const CShowInfo &b); |
|
101 |
static TInt CompareShowsByTrackNo(const CShowInfo &a, const CShowInfo &b); |
|
102 |
||
103 |
void AddShowToMpxCollection(CShowInfo &aShowInfo); |
|
104 |
||
105 |
private: |
|
106 |
// DB methods |
|
107 |
CShowInfo* DBGetShowByUidL(TUint aUid); |
|
108 |
void DBFillShowInfoFromStmtL(sqlite3_stmt *st, CShowInfo* showInfo); |
|
78 | 109 |
void DBAddShowL(const CShowInfo& aItem); |
110 |
void DBUpdateShowL(CShowInfo& aItem); |
|
2 | 111 |
void DBGetShowsByFeedL(RShowInfoArray& aShowArray, TUint aFeedUid); |
112 |
void DBGetAllShowsL(RShowInfoArray& aShowArray); |
|
113 |
void DBGetNewShowsL(RShowInfoArray& aShowArray); |
|
114 |
void DBGetDownloadedShowsL(RShowInfoArray& aShowArray); |
|
78 | 115 |
void DBDeleteAllShowsByFeedL(TUint aFeedUid); |
116 |
void DBDeleteOldShowsByFeedL(TUint aFeedUid); |
|
117 |
void DBDeleteShowL(TUint aUid); |
|
118 |
void DBRemoveAllDownloadsL(); |
|
119 |
void DBRemoveDownloadL(TUint aUid); |
|
2 | 120 |
void DBGetAllDownloadsL(RShowInfoArray& aShowArray); |
78 | 121 |
TUint DBGetDownloadsCountL(); |
122 |
void DBAddDownloadL(TUint aUid); |
|
2 | 123 |
CShowInfo* DBGetNextDownloadL(); |
124 |
||
125 |
private: |
|
126 |
CHttpClient* iShowClient; |
|
127 |
||
128 |
CPodcastModel& iPodcastModel; |
|
129 |
||
130 |
// observers that will receive callbacks |
|
131 |
RArray<MShowEngineObserver*> iObservers; |
|
132 |
||
133 |
// The show we are currently downloading |
|
134 |
CShowInfo* iShowDownloading; |
|
135 |
TUint iDownloadErrors; |
|
136 |
||
137 |
CMetaDataReader* iMetaDataReader; |
|
138 |
||
139 |
RApaLsSession iApaSession; |
|
140 |
TBuf8<512> iRecogBuffer; |
|
141 |
||
142 |
sqlite3& iDB; |
|
143 |
TBuf<KDefaultSQLDataBufferLength> iSqlBuffer; |
|
144 |
}; |
|
145 |
||
146 |
#endif /*SHOWENGINE_H_*/ |
|
147 |