examples/ForumNokia/Symbian_OS_End-to-End_Sockets_API_Example/SocketTaskManager/inc/Response.h

00001 /*
00002  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003  *    
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions are met:
00006  *    
00007  *  * Redistributions of source code must retain the above copyright notice, this
00008  *    list of conditions and the following disclaimer.
00009  *  * Redistributions in binary form must reproduce the above copyright notice,
00010  *    this list of conditions and the following disclaimer in the documentation
00011  *    and/or other materials provided with the distribution.
00012  *  * Neither the name of Nokia Corporation nor the names of its contributors
00013  *    may be used to endorse or promote products derived from this software
00014  *    without specific prior written permission.
00015  *    
00016  *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017  *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018  *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019  *    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020  *    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021  *    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022  *    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023  *    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024  *    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025  *    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026  *    
00027  *    Description:  
00028  */
00029 
00030 
00031 #ifndef __CRESPONSE_H
00032 #define __CRESPONSE_H
00033 
00034 // INCLUDE FILES
00035 #include "TaskManager.hrh"
00036 
00037 #include <e32std.h>
00038 #include <badesca.h>            //CDesCArray
00039 
00040 // CLASS DECLARATION
00041 
00045 class CResponse : public CBase
00046         {
00047 public: // Constructors and destructor
00048 
00052     enum TResponseState
00053         {
00054         ENotComplete,
00055         EComplete,
00056         EError
00057         };
00058         
00062         static CResponse* NewL();
00063 
00067         static CResponse* NewLC();
00068 
00072         ~CResponse();
00073 
00077         enum TResponseType
00078                 {
00079                 ELoadTasks = 0,
00080                 ETaskComplete
00081                 };
00082 
00083 public: // New functions
00084 
00089         void ParseDataL( TDesC& aData );
00090     
00095         TBool HasError() const;
00096 
00101         TBuf<KMaxError> Error() const;
00102 
00107         TInt TaskCount() const;
00108 
00114         TBuf<KMaxTaskLength> TaskDescription(const TInt& aIndex) const;
00115 
00120         TInt TaskId(const TInt& aIndex) const;
00121 
00126         TResponseType ResponseType() const;
00127 
00132     void InputDataL( const TDesC8& aData );
00133     
00140     TResponseState GetState() const;
00141 
00142 private: 
00143 
00148     void DoCheck();
00149 
00153         CResponse();
00154         void ConstructL();
00155         
00159         enum TTaskReadStatus
00160                 {
00161                 EStart = 0,
00162                 EReadId,
00163                 EReadTask
00164                 };
00165 
00166 private: // Data members
00167 
00168     // Error informers
00169         TBuf<KMaxError> iError;
00170         
00171         CDesCArray*             iDescriptions;
00172         RArray<TInt>    iIds;
00173         TResponseType   iResponseType;
00174         
00175         // Resizable descriptor for storing the message
00176         HBufC*          iMessageBuffer;
00177         
00178         TInt            iExpectedPackageSize;
00179         TResponseState  iState;
00180         };
00181 
00182 #endif
00183 
00184 // End of file
00185 
00186 

Generated by  doxygen 1.6.2