00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 #ifndef __CRESPONSE_H
00012 #define __CRESPONSE_H
00013 
00014 
00015 #include "TaskManager.hrh"
00016 
00017 #include <e32std.h>
00018 #include <badesca.h>            
00019 
00020 
00021 
00025 class CResponse : public CBase
00026         {
00027 public: 
00028 
00032     enum TResponseState
00033         {
00034         ENotComplete,
00035         EComplete,
00036         EError
00037         };
00038         
00042         static CResponse* NewL();
00043 
00047         static CResponse* NewLC();
00048 
00052         ~CResponse();
00053 
00057         enum TResponseType
00058                 {
00059                 ELoadTasks = 0,
00060                 ETaskComplete
00061                 };
00062 
00063 public: 
00064 
00069         void ParseDataL( TDesC& aData );
00070     
00075         TBool HasError() const;
00076 
00081         TBuf<KMaxError> Error() const;
00082 
00087         TInt TaskCount() const;
00088 
00094         TBuf<KMaxTaskLength> TaskDescription(const TInt& aIndex) const;
00095 
00100         TInt TaskId(const TInt& aIndex) const;
00101 
00106         TResponseType ResponseType() const;
00107 
00112     void InputDataL( const TDesC8& aData );
00113     
00120     TResponseState GetState() const;
00121 
00122 private: 
00123 
00128     void DoCheck();
00129 
00133         CResponse();
00134         void ConstructL();
00135         
00139         enum TTaskReadStatus
00140                 {
00141                 EStart = 0,
00142                 EReadId,
00143                 EReadTask
00144                 };
00145 
00146 private: 
00147 
00148     
00149         TBuf<KMaxError> iError;
00150         
00151         CDesCArray*             iDescriptions;
00152         RArray<TInt>    iIds;
00153         TResponseType   iResponseType;
00154         
00155         
00156         HBufC*          iMessageBuffer;
00157         
00158         TInt            iExpectedPackageSize;
00159         TResponseState  iState;
00160         };
00161 
00162 #endif
00163 
00164 
00165 
00166