engine/inc/FeedEngine.h
changeset 60 4d230e702aa3
parent 32 26a3f2dfba08
child 65 bcd88ba95046
equal deleted inserted replaced
59:9569ea080d5a 60:4d230e702aa3
    26 #include "ShowInfo.h"
    26 #include "ShowInfo.h"
    27 #include <e32cmn.h>
    27 #include <e32cmn.h>
    28 #include "Constants.h"
    28 #include "Constants.h"
    29 #include "FeedEngineObserver.h"
    29 #include "FeedEngineObserver.h"
    30 #include "FeedTimer.h"
    30 #include "FeedTimer.h"
    31 #include "sqlite3.h"
    31 #include <sqlite3.h>
    32 
    32 
    33 class CPodcastModel;
    33 class CPodcastModel;
    34 class COpmlParser;
    34 class COpmlParser;
    35 
    35 
    36 _LIT(KOpmlFeed, "    <outline title=\"%S\" description=\"%S\" xmlUrl=\"%S\" htmlUrl=\"%S\"/>");
    36 _LIT(KOpmlFeed, "    <outline title=\"%S\" description=\"%S\" xmlUrl=\"%S\" htmlUrl=\"%S\"/>");
    68 	IMPORT_C TBool UpdateFeedL(TUint aFeedUid);
    68 	IMPORT_C TBool UpdateFeedL(TUint aFeedUid);
    69 	IMPORT_C void UpdateAllFeedsL(TBool aAutoUpdate = EFalse);
    69 	IMPORT_C void UpdateAllFeedsL(TBool aAutoUpdate = EFalse);
    70 	IMPORT_C void CancelUpdateAllFeeds();
    70 	IMPORT_C void CancelUpdateAllFeeds();
    71 	IMPORT_C const RFeedInfoArray& GetSortedFeeds();
    71 	IMPORT_C const RFeedInfoArray& GetSortedFeeds();
    72 	IMPORT_C CFeedInfo* GetFeedInfoByUid(TUint aFeedUid);	
    72 	IMPORT_C CFeedInfo* GetFeedInfoByUid(TUint aFeedUid);	
    73 	IMPORT_C void GetStatsByFeed(TUint aFeedUid, TUint &aNumShows, TUint &aNumUnplayed);
    73 	IMPORT_C void GetStatsByFeedL(TUint aFeedUid, TUint &aNumShows, TUint &aNumUnplayed);
    74 	IMPORT_C void GetDownloadedStats(TUint &aNumShows, TUint &aNumUnplayed);
       
    75 
    74 
    76 	IMPORT_C void AddObserver(MFeedEngineObserver *observer);
    75 	IMPORT_C void AddObserver(MFeedEngineObserver *observer);
    77 	IMPORT_C void RemoveObserver(MFeedEngineObserver *observer);
    76 	IMPORT_C void RemoveObserver(MFeedEngineObserver *observer);
    78 
    77 
    79 	void RunFeedTimer();
    78 	void RunFeedTimer();
    80 	
    79 	
    81 	IMPORT_C void UpdateFeed(CFeedInfo *aItem);
    80 	IMPORT_C void UpdateFeedInfoL(CFeedInfo *aItem);
    82 	/**
    81 	/**
    83 	 * Returns the current internal state of the feed engine4
    82 	 * Returns the current internal state of the feed engine4
    84 	 */
    83 	 */
    85 	IMPORT_C TClientState ClientState();
    84 	IMPORT_C TClientState ClientState();
    86 
    85 
    92 	
    91 	
    93 	IMPORT_C void SearchForFeedL(TDesC& aSearchString);
    92 	IMPORT_C void SearchForFeedL(TDesC& aSearchString);
    94 	IMPORT_C void AddSearchResultL(CFeedInfo *item);
    93 	IMPORT_C void AddSearchResultL(CFeedInfo *item);
    95 	IMPORT_C const RFeedInfoArray& GetSearchResults();
    94 	IMPORT_C const RFeedInfoArray& GetSearchResults();
    96 
    95 
    97 	IMPORT_C void OpmlParsingComplete(TInt aError, TUint aNumFeedsAdded);
    96 	IMPORT_C void OpmlParsingCompleteL(TInt aError, TUint aNumFeedsAdded);
       
    97 	void NotifyFeedUpdateComplete(TInt aFeedUid, TInt aError);
    98 protected:
    98 protected:
    99 	
    99 	
   100 	static TInt CompareFeedsByTitle(const CFeedInfo &a, const CFeedInfo &b);
   100 	static TInt CompareFeedsByTitle(const CFeedInfo &a, const CFeedInfo &b);
   101 
   101 
   102 private:
   102 private:
   115 	void ParsingCompleteL(CFeedInfo *aItem);
   115 	void ParsingCompleteL(CFeedInfo *aItem);
   116 
   116 
   117 	void GetFeedImageL(CFeedInfo *aFeedInfo);
   117 	void GetFeedImageL(CFeedInfo *aFeedInfo);
   118 	
   118 	
   119 	void UpdateNextFeedL();
   119 	void UpdateNextFeedL();
   120 	void NotifyFeedUpdateComplete(TInt aError);
   120 	void NotifyOpmlParsingCompleteL(TInt aError, TUint aNumFeedsAdded);
   121 	void NotifyOpmlParsingComplete(TInt aError, TUint aNumFeedsAdded);
       
   122 
   121 
   123 	
   122 	
   124 private:
   123 private:
   125 	void DBLoadFeedsL();
   124 	void DBLoadFeedsL();
   126 	TBool DBRemoveFeed(TUint aUid);
   125 	void DBRemoveFeedL(TUint aUid);
   127 	TBool DBAddFeedL(const CFeedInfo& aTtem);
   126 	void DBAddFeedL(const CFeedInfo& aTtem);
   128 	CFeedInfo* DBGetFeedInfoByUidL(TUint aFeedUid);	
   127 	CFeedInfo* DBGetFeedInfoByUidL(TUint aFeedUid);	
   129 	TUint DBGetFeedCount();
   128 	TUint DBGetFeedCountL();
   130 	TBool DBUpdateFeed(const CFeedInfo& aItem);
   129 	void DBUpdateFeedL(const CFeedInfo& aItem);
   131 	void DBGetStatsByFeed(TUint aFeedUid, TUint &aNumShows, TUint &aNumUnplayed);
   130 	void DBGetStatsByFeedL(TUint aFeedUid, TUint &aNumShows, TUint &aNumUnplayed);
   132 
   131 
   133 		
   132 		
   134 private:
   133 private:
   135 	CHttpClient* iFeedClient;
   134 	CHttpClient* iFeedClient;
   136 	TClientState iClientState;
   135 	TClientState iClientState;
   145 	RFeedInfoArray iSortedFeeds;
   144 	RFeedInfoArray iSortedFeeds;
   146 
   145 
   147 	CFeedInfo *iActiveFeed;
   146 	CFeedInfo *iActiveFeed;
   148 	TFileName iUpdatingFeedFileName;
   147 	TFileName iUpdatingFeedFileName;
   149 	TFileName iSearchResultsFileName;
   148 	TFileName iSearchResultsFileName;
   150 	RFeedInfoArray iFeedsUpdating;
   149 	RArray<TUint> iFeedsUpdating;
   151 	
   150 	
   152 	// observers that will receive callbacks, not owning
   151 	// observers that will receive callbacks, not owning
   153     RArray<MFeedEngineObserver*> iObservers;
   152     RArray<MFeedEngineObserver*> iObservers;
   154     
   153     
   155     TBool iCatchupMode;
   154     TBool iCatchupMode;