author | Sebastian Brannstrom <sebastianb@symbian.org> |
Tue, 16 Nov 2010 10:39:20 +0000 | |
branch | symbian1 |
changeset 364 | 998e9d114bd5 |
parent 349 | 4538abb763e4 |
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" |
|
60 | 30 |
#include <sqlite3.h> |
2 | 31 |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
65
diff
changeset
|
32 |
struct TDownload |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
65
diff
changeset
|
33 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
65
diff
changeset
|
34 |
TUint iIndex; |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
65
diff
changeset
|
35 |
TUint iUid; |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
65
diff
changeset
|
36 |
}; |
130
92572a695a1d
Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents:
65
diff
changeset
|
37 |
|
2 | 38 |
class CShowEngine : public CBase, public MHttpClientObserver, public MMetaDataReaderObserver |
148
e3f9b65d6910
Cleanup from the merge
Brendan Donegan <brendand@symbian.org>
parents:
147
diff
changeset
|
39 |
{ |
2 | 40 |
public: |
41 |
IMPORT_C static CShowEngine* NewL(CPodcastModel& aPodcastModel); |
|
42 |
IMPORT_C virtual ~CShowEngine(); |
|
43 |
||
44 |
public: |
|
45 |
IMPORT_C void AddDownloadL(CShowInfo& info); |
|
60 | 46 |
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
|
47 |
IMPORT_C void RemoveAllDownloadsL(); |
2 | 48 |
|
49 |
IMPORT_C void SuspendDownloads(); |
|
50 |
IMPORT_C void ResumeDownloadsL(); |
|
51 |
||
52 |
IMPORT_C TInt GetNumDownloadingShows(); |
|
53 |
IMPORT_C CShowInfo* ShowDownloading(); |
|
54 |
IMPORT_C CShowInfo* GetShowByUidL(TUint aShowUid); |
|
55 |
IMPORT_C CShowInfo* GetNextShowByTrackL(CShowInfo* aShowInfo); |
|
56 |
||
57 |
// show access methods |
|
58 |
IMPORT_C void GetAllShowsL(RShowInfoArray &aArray); |
|
59 |
IMPORT_C void GetShowsByFeedL(RShowInfoArray &aArray, TUint aFeedUid); |
|
60 |
IMPORT_C void GetShowsDownloadedL(RShowInfoArray &aArray); |
|
61 |
IMPORT_C void GetNewShowsL(RShowInfoArray &aArray); |
|
62 |
IMPORT_C void GetShowsDownloadingL(RShowInfoArray &aArray); |
|
63 |
IMPORT_C CShowInfo* DBGetShowByFileNameL(TFileName aFileName); |
|
64 |
||
60 | 65 |
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
|
66 |
IMPORT_C void DeletePlayedShowsL(RShowInfoArray &aShowInfoArray); |
2 | 67 |
IMPORT_C void DeleteAllShowsByFeedL(TUint aFeedUid,TBool aDeleteFiles=ETrue); |
68 |
IMPORT_C void DeleteShowL(TUint aShowUid, TBool aRemoveFile=ETrue); |
|
60 | 69 |
IMPORT_C void DeleteOldShowsByFeedL(TUint aFeedUid); |
2 | 70 |
|
71 |
IMPORT_C void AddObserver(MShowEngineObserver *observer); |
|
72 |
IMPORT_C void RemoveObserver(MShowEngineObserver *observer); |
|
73 |
||
74 |
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
|
75 |
IMPORT_C void UpdateShowL(CShowInfo& aInfo); |
2 | 76 |
|
77 |
IMPORT_C void GetMimeType(const TDesC& aFileName, TDes& aMimeType); |
|
78 |
||
60 | 79 |
IMPORT_C void CheckForDeletedShows(TUint aFeedUid); |
2 | 80 |
IMPORT_C CMetaDataReader& MetaDataReader(); |
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
65
diff
changeset
|
81 |
IMPORT_C void MoveDownloadUpL(TUint aUid); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
65
diff
changeset
|
82 |
IMPORT_C void MoveDownloadDownL(TUint aUid); |
349
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
348
diff
changeset
|
83 |
IMPORT_C void PostPlayHandling(CShowInfo *aShow); |
2 | 84 |
|
349
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
348
diff
changeset
|
85 |
IMPORT_C void ExpireOldShows(); |
2 | 86 |
private: |
87 |
// from HttpClientObserver, dont have to be public |
|
88 |
void Connected(CHttpClient* aClient); |
|
89 |
void Disconnected(CHttpClient* aClient); |
|
90 |
void CompleteL(CHttpClient* aClient, TInt aError); |
|
91 |
void Progress(CHttpClient* aHttpClient, int aBytes, int aTotalBytes); |
|
92 |
void DownloadInfo(CHttpClient* aClient, int aSize); |
|
93 |
void FileError(TUint aError); |
|
94 |
// from MetaDataReaderObserver |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
2
diff
changeset
|
95 |
void ReadMetaDataL(CShowInfo& aShowInfo); |
2 | 96 |
void ReadMetaDataCompleteL(); |
97 |
||
98 |
private: |
|
99 |
CShowEngine(CPodcastModel& aPodcastModel); |
|
100 |
void ConstructL(); |
|
101 |
||
60 | 102 |
void GetShowL(CShowInfo *info); |
2 | 103 |
|
104 |
void NotifyDownloadQueueUpdatedL(); |
|
105 |
void NotifyShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt aBytesTotal); |
|
106 |
void NotifyShowFinishedL(TInt aError); |
|
107 |
void DownloadNextShowL(); |
|
108 |
||
109 |
static TInt CompareShowsByDate(const CShowInfo &a, const CShowInfo &b); |
|
110 |
static TBool CompareShowsByUid(const CShowInfo &a, const CShowInfo &b); |
|
111 |
static TInt CompareShowsByTitle(const CShowInfo &a, const CShowInfo &b); |
|
112 |
static TInt CompareShowsByTrackNo(const CShowInfo &a, const CShowInfo &b); |
|
113 |
||
114 |
void AddShowToMpxCollection(CShowInfo &aShowInfo); |
|
115 |
||
116 |
private: |
|
117 |
// DB methods |
|
118 |
CShowInfo* DBGetShowByUidL(TUint aUid); |
|
119 |
void DBFillShowInfoFromStmtL(sqlite3_stmt *st, CShowInfo* showInfo); |
|
60 | 120 |
void DBAddShowL(const CShowInfo& aItem); |
121 |
void DBUpdateShowL(CShowInfo& aItem); |
|
2 | 122 |
void DBGetShowsByFeedL(RShowInfoArray& aShowArray, TUint aFeedUid); |
123 |
void DBGetAllShowsL(RShowInfoArray& aShowArray); |
|
124 |
void DBGetNewShowsL(RShowInfoArray& aShowArray); |
|
125 |
void DBGetDownloadedShowsL(RShowInfoArray& aShowArray); |
|
60 | 126 |
void DBDeleteAllShowsByFeedL(TUint aFeedUid); |
127 |
void DBDeleteOldShowsByFeedL(TUint aFeedUid); |
|
128 |
void DBDeleteShowL(TUint aUid); |
|
129 |
void DBRemoveAllDownloadsL(); |
|
130 |
void DBRemoveDownloadL(TUint aUid); |
|
2 | 131 |
void DBGetAllDownloadsL(RShowInfoArray& aShowArray); |
60 | 132 |
TUint DBGetDownloadsCountL(); |
133 |
void DBAddDownloadL(TUint aUid); |
|
2 | 134 |
CShowInfo* DBGetNextDownloadL(); |
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
65
diff
changeset
|
135 |
void DBSwapDownloadsL(TDownload aFirstDL, TDownload aSecondDL); |
349
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
348
diff
changeset
|
136 |
void DBGetOldShowsL(RShowInfoArray& aShowArray); |
2 | 137 |
|
138 |
private: |
|
139 |
CHttpClient* iShowClient; |
|
140 |
||
141 |
CPodcastModel& iPodcastModel; |
|
142 |
||
143 |
// observers that will receive callbacks |
|
336
3d6c1417e8bd
Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
144 |
RArray<MShowEngineObserver*> iObservers; |
2 | 145 |
|
146 |
// The show we are currently downloading |
|
147 |
CShowInfo* iShowDownloading; |
|
148
e3f9b65d6910
Cleanup from the merge
Brendan Donegan <brendand@symbian.org>
parents:
147
diff
changeset
|
148 |
TUint iDownloadErrors; |
2 | 149 |
|
148
e3f9b65d6910
Cleanup from the merge
Brendan Donegan <brendand@symbian.org>
parents:
147
diff
changeset
|
150 |
CMetaDataReader* iMetaDataReader; |
2 | 151 |
|
148
e3f9b65d6910
Cleanup from the merge
Brendan Donegan <brendand@symbian.org>
parents:
147
diff
changeset
|
152 |
RApaLsSession iApaSession; |
2 | 153 |
TBuf8<512> iRecogBuffer; |
154 |
||
155 |
sqlite3& iDB; |
|
148
e3f9b65d6910
Cleanup from the merge
Brendan Donegan <brendand@symbian.org>
parents:
147
diff
changeset
|
156 |
TBuf<KDefaultSQLDataBufferLength> iSqlBuffer; |
e3f9b65d6910
Cleanup from the merge
Brendan Donegan <brendand@symbian.org>
parents:
147
diff
changeset
|
157 |
}; |
2 | 158 |
|
159 |
#endif /*SHOWENGINE_H_*/ |
|
160 |