obex/obexprotocol/obex/test/testobexerrorcodes/TestObexErrorCodes.h
changeset 57 f6055a57ae18
parent 0 d0791faffa3f
equal deleted inserted replaced
54:4dc88a4ac6f4 57:f6055a57ae18
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __TESTOBEXERRORCODES_H__
       
    17 #define __TESTOBEXERRORCODES_H__
       
    18 
       
    19 #include <e32cons.h>
       
    20 #include <e32def.h>
       
    21 #include <e32std.h>
       
    22 #include <e32base.h>
       
    23 #include <obex.h>
       
    24 
       
    25 class CControllerConsoleTest;
       
    26 class CBaseErrorCodeTest;
       
    27 class CObexClientHandler;
       
    28 
       
    29 enum TTestProgress { EIdle, EConnecting, EDisconnecting, EConnected, EPutting };
       
    30 
       
    31 class CControllerTestMasterClass : CBase
       
    32 	{
       
    33 public:
       
    34 	void ConstructL();
       
    35 	static CControllerTestMasterClass* NewL();
       
    36 	static CControllerTestMasterClass* NewLC();
       
    37 	~CControllerTestMasterClass();
       
    38 
       
    39 public:
       
    40 	CControllerConsoleTest* iConsoleTest;
       
    41 	};
       
    42 
       
    43 
       
    44 
       
    45 class CControllerConsoleTest : CActive
       
    46 	{
       
    47 
       
    48 public:	
       
    49 	void ConstructL(CControllerTestMasterClass*);
       
    50 	static CControllerConsoleTest* NewL(CControllerTestMasterClass*);
       
    51 	static CControllerConsoleTest* NewLC(CControllerTestMasterClass*);
       
    52 	~CControllerConsoleTest();
       
    53 public:
       
    54 	void IssueRequest(); 
       
    55 	void DoCancel();
       
    56 	void RunL();
       
    57 	void TestAll();
       
    58 	TInt RunError(TInt);
       
    59 	void DoTest();
       
    60 
       
    61 private:
       
    62 	CControllerConsoleTest();
       
    63 	void StartTest();
       
    64 	void StopTest();
       
    65 	void Menu();
       
    66 private:
       
    67 	CControllerTestMasterClass* iOwner;
       
    68 
       
    69 public:
       
    70 	CConsoleBase* iConsole;
       
    71 	CBaseErrorCodeTest* iTest;
       
    72 	TBool iStarted;
       
    73 	};
       
    74 
       
    75 
       
    76 
       
    77 class CBaseErrorCodeTest : public CBase 
       
    78 	{
       
    79 public:
       
    80 	static CBaseErrorCodeTest* NewL(CControllerConsoleTest* aOwner);
       
    81 	virtual ~CBaseErrorCodeTest();
       
    82 
       
    83 public:
       
    84 
       
    85 	virtual	void Start();
       
    86 	virtual void Stop();
       
    87 
       
    88 
       
    89 protected:
       
    90 
       
    91 	CBaseErrorCodeTest();
       
    92 	void ConstructL(CControllerConsoleTest* aOwner);
       
    93 	void LoadObexL();
       
    94 
       
    95 public:
       
    96 	CControllerConsoleTest* iOwner;
       
    97 
       
    98 
       
    99 
       
   100 protected:
       
   101 	CObexBufObject*  iObject;
       
   102 	CBufFlat *iBuf;
       
   103 	RLibrary         iLibrary;					// Use RLibrary object to interface to the DLL
       
   104 	TInt iErrorCode;
       
   105 	};
       
   106 
       
   107 /**
       
   108 *
       
   109 * The public API for Server test
       
   110 *            
       
   111 */
       
   112 
       
   113 class CTestObexErrorCodesServer : public CBaseErrorCodeTest, MObexServerNotify
       
   114 	{
       
   115 public:
       
   116 	static CTestObexErrorCodesServer* NewL(CControllerConsoleTest* aOwner);
       
   117 	virtual ~CTestObexErrorCodesServer();
       
   118 	void StartIrdaServerL();
       
   119 
       
   120 public:
       
   121 
       
   122 	virtual	void Start();
       
   123 	virtual	void Stop();
       
   124 
       
   125 
       
   126 private:
       
   127 	CTestObexErrorCodesServer();
       
   128 
       
   129 
       
   130 	// Virtual functions from OBEX
       
   131 	virtual void ErrorIndication(TInt aError);
       
   132 	virtual void TransportUpIndication();
       
   133 	virtual void TransportDownIndication();
       
   134 	virtual TInt ObexConnectIndication(const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo);
       
   135 	virtual void ObexDisconnectIndication(const TDesC8& aInfo);
       
   136 	virtual CObexBufObject* PutRequestIndication();
       
   137 	virtual TInt PutPacketIndication();
       
   138 	virtual TInt PutCompleteIndication();
       
   139 	virtual CObexBufObject* GetRequestIndication(CObexBaseObject *aRequiredObject);
       
   140 	virtual TInt GetPacketIndication();
       
   141 	virtual TInt GetCompleteIndication();
       
   142 	virtual TInt SetPathIndication(const CObex::TSetPathInfo& aPathInfo, const TDesC8& aInfo);
       
   143 	virtual void AbortIndication();
       
   144 
       
   145 private:
       
   146 	CObexServer* iServer;
       
   147 	};
       
   148 
       
   149 /**
       
   150 *
       
   151 * The public API for Server test
       
   152 *            
       
   153 */
       
   154 
       
   155 class CTestObexErrorCodesClient : public CBaseErrorCodeTest
       
   156 	{
       
   157 public:
       
   158 	static CTestObexErrorCodesClient* NewL(CControllerConsoleTest* aOwner);
       
   159 	virtual ~CTestObexErrorCodesClient();
       
   160 	void StartIrdaClientL();
       
   161 	void ActionComplete(TObexResponse aResponse);
       
   162 
       
   163 public:
       
   164 	void CallBack(TRequestStatus aStatus, TTestProgress aActivity);
       
   165 	virtual	void Start();
       
   166 	virtual	void Stop();
       
   167 
       
   168 
       
   169 private:
       
   170 	CTestObexErrorCodesClient();
       
   171 
       
   172 private:
       
   173 	CObexClientHandler* iClient;
       
   174 	};
       
   175 
       
   176 
       
   177 
       
   178 class CObexClientHandler : public CActive
       
   179 	{
       
   180 public:
       
   181 	static CObexClientHandler* NewL(CTestObexErrorCodesClient* aOwner, 
       
   182 									TObexProtocolInfo& aObexProtocolInfoPtr);
       
   183 	~CObexClientHandler();
       
   184 
       
   185 public:
       
   186 	void Connect();
       
   187 	void Disconnect();
       
   188 	void Put();
       
   189 
       
   190 private:
       
   191 
       
   192 	CObexClientHandler();
       
   193 	void ConstructL(CTestObexErrorCodesClient* aOwner,
       
   194 					TObexProtocolInfo& aObexProtocolInfoPtr);
       
   195 
       
   196 	void DoCancel();
       
   197 	void RunL();
       
   198 
       
   199 
       
   200 
       
   201 private:
       
   202 	CObexClient* iClient;
       
   203 	CTestObexErrorCodesClient* iOwner;	
       
   204 	TTestProgress iActivity;
       
   205 	CObexFileObject* iFileObject;
       
   206 
       
   207 	};
       
   208 
       
   209 #endif // __TESTOBEXERRORCODES_H__