wlanapitest/wlanhaitest/wlan/inc/T_RSocketData.h
branchRCL_3
changeset 18 d3d7683d16f5
parent 0 c40eb8fe8501
equal deleted inserted replaced
17:a828660c511c 18:d3d7683d16f5
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef T_RSOCKETDATA_H_
       
    21 #define T_RSOCKETDATA_H_
       
    22 
       
    23 //User Includes
       
    24 #include "datawrapperbase.h"
       
    25 
       
    26 //Epoc includes
       
    27 #include <es_sock.h> // RSocketServ, RConnection
       
    28 #include <in_sock.h> // KAfInet
       
    29 #include <activecallback.h>
       
    30 #include <f32file.h>
       
    31 
       
    32 
       
    33 class CT_RSocketData: public CDataWrapperBase
       
    34 	{
       
    35 public:
       
    36 	static CT_RSocketData* NewL();
       
    37 	void RunL(CActive* aActive, TInt aIndex);
       
    38 	virtual ~CT_RSocketData();
       
    39 
       
    40 public:	
       
    41 	virtual TAny* GetObject();
       
    42 	void ErrorMessage(const TInt aMessage);
       
    43 	virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);		
       
    44 
       
    45 protected:
       
    46 	CT_RSocketData();
       
    47 	void ConstructL();
       
    48 
       
    49 private:
       
    50 	void DoCmdOpen(const TTEFSectionName& aSection);	
       
    51 	void DoCmdConnect(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
       
    52 	void DoCmdShutdown(const TInt aAsyncErrorIndex);			
       
    53 	void DoCmdClose();
       
    54 	void DoCmdHttpGet();
       
    55 	void DoCmdCheckSupportedRates(const TTEFSectionName& aSection);
       
    56 	void DoCmdUploadSendHTTPPost(const TTEFSectionName& aSection);
       
    57     void CreateHTTPHeaderStart(TDes8& aRequest, TInt aDataSize, TDesC& aFileServer,TDesC& clientID,TDesC& serverScript);
       
    58 	void SendFileToSocketL(const TDesC& aFilename);
       
    59 	TInt ReadFileSizeL(const TDesC& aFilename);
       
    60 	void CreateHTTPHeaderEnd(TDes8& aRequest);
       
    61 	TBool CheckSupportedRates(const TDesC8& aSupportedRates, const TUint8 aRate);
       
    62 	void Shutdown();
       
    63 	void DoCmdDownloadSendHTTPGet(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex );
       
    64 	void DoCmdRecvOneOrMore(const TTEFSectionName& aSection);	
       
    65 	void Close();	
       
    66 	TReal ThroughputInMegaBits( TTimeIntervalMicroSeconds aDuration, TInt aTotalTransferred );
       
    67 	void RecvOneOrMore(TRequestStatus& status);	
       
    68 
       
    69 private:
       
    70 	/**
       
    71 	 * Wrapped object
       
    72 	 */
       
    73 	RSocket*			iSocket;
       
    74 	/**
       
    75 	 * Used in the command DoCmdDownloadSendHTTPGet for RSocket::Write
       
    76 	 */
       
    77 	CActiveCallback* 	iActiveCallback;
       
    78 	/**
       
    79 	 * Used in the command DoCmdConnect for RSocket::Connect
       
    80 	 */
       
    81 	CActiveCallback* 	iActCallConnectSocket;
       
    82 	/**
       
    83 	 * Used in the command DoCmdConnectSocket for RSocket::Connect
       
    84 	 */
       
    85 	CActiveCallback* 	iActCallShutDownSocket;		
       
    86 	/**
       
    87 	 * Flag to review if the Socket is Open with RSocket::Connect
       
    88 	 */
       
    89 	TBool 				iSocketOpened;
       
    90 	/**
       
    91 	 * flag to review if the Socket was shutdown
       
    92 	 */
       
    93 	TBool 				iSocketStarted;		
       
    94 	/**
       
    95 	 * Async data
       
    96 	 */
       
    97 	TInt 			    iAsyncErrorIndex;
       
    98 	/**
       
    99 	 * Buffer for Download in DoCmdReceiveHTTPResponse command
       
   100 	 */
       
   101 	HBufC8* 			iDownloadBuffer;
       
   102 	/**
       
   103 	 * Buffer for Upload in SendFileToSocket 
       
   104 	 */
       
   105 	HBufC8* 			iUploadBuffer;
       
   106 	/**
       
   107 	 * Header for response HTPP
       
   108 	 */
       
   109 	RBuf8   			iHttpResponseHeader;
       
   110 	/**
       
   111 	 * Download throughput
       
   112 	 */
       
   113 	TReal 				iDownloadThroughput;
       
   114 	/**
       
   115 	 * Handle for Filse server session
       
   116 	 */
       
   117 	RFs 				iFs;
       
   118 	/**
       
   119 	 * Upload throughput
       
   120 	 */
       
   121 	TReal               iUploadThroughput;
       
   122 	/**
       
   123 	 * Bytes received in DoCmdHttpGet
       
   124 	 */
       
   125 	TInt                itotalReceived;
       
   126 	};
       
   127 
       
   128 #endif /*T_RSOCKETDATA_H_*/