engine/inc/FeedEngine.h
branchasynchparser
changeset 171 cc1be3797632
parent 83 daef3a71bac5
equal deleted inserted replaced
170:f42c9de433f2 171:cc1be3797632
    45 const TInt KMaxDescriptionLength = 1024;
    45 const TInt KMaxDescriptionLength = 1024;
    46 const TInt KMaxURLLength = 512;
    46 const TInt KMaxURLLength = 512;
    47 const TInt KMaxLineLength = 4096;
    47 const TInt KMaxLineLength = 4096;
    48 const TInt KMaxSearchString = 30;
    48 const TInt KMaxSearchString = 30;
    49 
    49 
    50 enum TClientState {
    50 enum TFeedEngineState {
    51 	EIdle,
    51 	EIdle,
    52 	EUpdatingFeed,
    52 	EDownloadingFeed,
    53 	EUpdatingImage,
    53 	EParsingFeed,
    54 	ESearching
    54 	EDownloadingImage,
       
    55 	ESearching,
       
    56 	EParsingOpml
    55 };
    57 };
    56 
    58 
    57 class CFeedEngine : public CBase, public MHttpClientObserver, public MFeedParserObserver
    59 class CFeedEngine : public CBase, public MHttpClientObserver, public MFeedParserObserver
    58 {
    60 {
    59 public:
    61 public:
    79 	
    81 	
    80 	IMPORT_C void UpdateFeedInfoL(CFeedInfo *aItem);
    82 	IMPORT_C void UpdateFeedInfoL(CFeedInfo *aItem);
    81 	/**
    83 	/**
    82 	 * Returns the current internal state of the feed engine4
    84 	 * Returns the current internal state of the feed engine4
    83 	 */
    85 	 */
    84 	IMPORT_C TClientState ClientState();
    86 	IMPORT_C TFeedEngineState ClientState();
    85 
    87 
    86 	/**
    88 	/**
    87 	 * Returns the current updating client UID if clientstate is != ENotUpdateing
    89 	 * Returns the current updating client UID if clientstate is != ENotUpdateing
    88 	 * @return TUint
    90 	 * @return TUint
    89 	 */
    91 	 */
   116 
   118 
   117 	void GetFeedImageL(CFeedInfo *aFeedInfo);
   119 	void GetFeedImageL(CFeedInfo *aFeedInfo);
   118 	
   120 	
   119 	void UpdateNextFeedL();
   121 	void UpdateNextFeedL();
   120 	void NotifyOpmlParsingCompleteL(TInt aError, TUint aNumFeedsAdded);
   122 	void NotifyOpmlParsingCompleteL(TInt aError, TUint aNumFeedsAdded);
   121 
       
   122 	
   123 	
   123 private:
   124 private:
   124 	void DBLoadFeedsL();
   125 	void DBLoadFeedsL();
   125 	void DBRemoveFeedL(TUint aUid);
   126 	void DBRemoveFeedL(TUint aUid);
   126 	void DBAddFeedL(const CFeedInfo& aTtem);
   127 	void DBAddFeedL(const CFeedInfo& aTtem);
   130 	void DBGetStatsByFeedL(TUint aFeedUid, TUint &aNumShows, TUint &aNumUnplayed);
   131 	void DBGetStatsByFeedL(TUint aFeedUid, TUint &aNumShows, TUint &aNumUnplayed);
   131 
   132 
   132 		
   133 		
   133 private:
   134 private:
   134 	CHttpClient* iFeedClient;
   135 	CHttpClient* iFeedClient;
   135 	TClientState iClientState;
   136 	TFeedEngineState iEngineState;
   136 	CFeedTimer iFeedTimer;
   137 	CFeedTimer iFeedTimer;
   137 
   138 
   138 	CPodcastModel& iPodcastModel;	
   139 	CPodcastModel& iPodcastModel;	
   139 	
   140 	
   140 	// RSS parser
   141 	// RSS parser
   150 	
   151 	
   151 	// observers that will receive callbacks, not owning
   152 	// observers that will receive callbacks, not owning
   152     RArray<MFeedEngineObserver*> iObservers;
   153     RArray<MFeedEngineObserver*> iObservers;
   153     
   154     
   154     // new feeds only add one show to download list when auto downloading
   155     // new feeds only add one show to download list when auto downloading
   155     TBool newFeed;
   156     TBool iNewFeed;
   156     TUint showsAdded;
   157     TUint iShowsAdded;
   157     
   158     
   158     sqlite3& iDB;
   159     sqlite3& iDB;
   159     
   160     
   160     TBuf<KDefaultSQLDataBufferLength> iSqlBuffer;
   161     TBuf<KDefaultSQLDataBufferLength> iSqlBuffer;
   161     
   162