obex/obexprotocol/obex/inc/obexerrorengine.h
changeset 54 4dc88a4ac6f4
parent 52 866b4af7ffbe
child 57 f6055a57ae18
equal deleted inserted replaced
52:866b4af7ffbe 54:4dc88a4ac6f4
     1 // Copyright (c) 2005-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 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #ifndef __OBEXERRORENGINE_H
       
    22 #define __OBEXERRORENGINE_H
       
    23 
       
    24 #include <obex/internal/mobexclienterrorresolver.h>
       
    25 
       
    26 /**
       
    27 Implements the Obex client error resolver extension functionality.
       
    28 Keeps a record of the last underlying client error that occurred.
       
    29 Resolves the underlying error to an error set specified by the user.
       
    30 */
       
    31 NONSHARABLE_CLASS(CObexErrorEngine) : public CBase, public MObexClientErrorResolver
       
    32 	{
       
    33 public:
       
    34 	/**
       
    35 	The Obex client sets a detailed "underlying" error on the error
       
    36 	engine for resolving to a specific error set later on.  This
       
    37 	mechanism adds extensibility to different error sets.
       
    38 	*/
       
    39 	enum TObexClientUnderlyingError
       
    40 		{
       
    41 		/**
       
    42 		No error in the last operation.
       
    43 		@see CObexClient::OnPacketReceive()
       
    44 		*/
       
    45 		ENoError = 0,
       
    46 
       
    47 		/**
       
    48 		The last operation failed to bring the transport up.
       
    49 		@see CObexClient::ClientCommandL()
       
    50 		@see CObexClient::CompleteRequest()
       
    51 		*/
       
    52 		ETransportUpFailed = 1,
       
    53 
       
    54 		/**
       
    55 		Tried to connect but already connected.
       
    56 		@see CObexClient::ClientCommandL()
       
    57 		*/
       
    58 		EAlreadyConnected = 2,
       
    59 
       
    60 		/**
       
    61 		Failed to insert local connection info into connect packet.
       
    62 		@see CObexClient::PrepareConnectPacket()
       
    63 		*/
       
    64 		ECannotInsertConnectInfo = 3,
       
    65 
       
    66 		/**
       
    67 		Connection challenge received but unable to ask the user for a password.
       
    68 		@see CObexClient::PrepareConnectPacket()
       
    69 		*/
       
    70 		EChallengeRejected = 4,
       
    71 
       
    72 		/**
       
    73 		The client's connect state was set to an erroneous value.
       
    74 		@see CObexClient::PrepareConnectPacket()
       
    75 		*/
       
    76 		EPrepareConnectPacketIncorrectState = 5,
       
    77 
       
    78 		/**
       
    79 		A packet was received while the client was sending.
       
    80 		@see CObexClient::OnPacketReceive()
       
    81 		*/
       
    82 		EResponseWhileWriting = 6,
       
    83 
       
    84 		/**
       
    85 		Failed to extract remote connection info from server connect packet.
       
    86 		@see CObexClient::ParseConnectPacket()
       
    87 		*/
       
    88 		ECannotExtractConnectInfo = 7,
       
    89 
       
    90 		/**
       
    91 		Cannot process the challenge/challenge response from the server.
       
    92 		@see CObexClient::ParseConnectPacket()
       
    93 		*/
       
    94 		ECannotProcessChallenge = 8,
       
    95 
       
    96 		/**
       
    97 		Challenge response received but the client did not request one.
       
    98 		@see CObexClient::ParseConnectPacket()
       
    99 		*/
       
   100 		EUnexpectedChallengeResponse = 9,
       
   101 
       
   102 		/**
       
   103 		Unauthorised opcode in server connect packet and there is no challenge header.
       
   104 		This means that the server failed to authenticate the client.
       
   105 		@see CObexClient::ParseConnectPacket()
       
   106 		*/
       
   107 		EChallengeAbsent = 10,
       
   108 
       
   109 		/**
       
   110 		The server connect packet contained an unknown opcode.
       
   111 		@see CObexClient::ParseConnectPacket()
       
   112 		*/
       
   113 		EBadOpcodeInConnectPacket = 11,
       
   114 
       
   115 		/**
       
   116 		The client operation timed out.
       
   117 		@see CObexClient::TimeoutCompletion()
       
   118 		*/
       
   119 		EResponseTimeout = 12,
       
   120 
       
   121 		/**
       
   122 		The client operation was aborted by the user.
       
   123 		@see CObexClient::OnPacketReceive()
       
   124 		*/
       
   125 		EAborted = 13,
       
   126 
       
   127 		/**
       
   128 		The transport went down while an operation was outstanding.
       
   129 		@see CObexClient::OnTransportDown()
       
   130 		@see CObexClient::CompleteRequest()
       
   131 		*/
       
   132 		EOpOutstandingOnTransportDown = 14,
       
   133 
       
   134 		/**
       
   135 		The server refused the disconnection request
       
   136 		because it did not recognise the connection ID.
       
   137 		@see CObexClient::OnPacketReceive()
       
   138 		*/
       
   139 		EBadConnectionId = 15,
       
   140 
       
   141 		/**
       
   142 		The client attempted an operation other than connect while disconnected.
       
   143 		@see CObexClient::ClientCommandL()
       
   144 		*/
       
   145 		EDisconnected = 16,
       
   146 
       
   147 		/**
       
   148 		Could not initialise the object to be sent in the Put/Get request.
       
   149 		@see CObexClient::ClientCommandL()
       
   150 		*/
       
   151 		ECannotInitialiseObject = 17,
       
   152 
       
   153 		/**
       
   154 		Could not set the connection ID on the
       
   155 		object to be sent in the Put/Get request.
       
   156 		@see CObexClient::ClientCommandL()
       
   157 		*/
       
   158 		ECannotSetConnectionId = 18,
       
   159 
       
   160 		/**
       
   161 		Could not prepare the next send packet in the Put/Get request.
       
   162 		@see CObexClient::ClientCommandL()
       
   163 		*/
       
   164 		ECannotPreparePacket = 19,
       
   165 
       
   166 		/**
       
   167 		Multipacket response from server to Put/Get (not GetResponse) request.
       
   168 		@see CObexClient::OnPacketReceive()
       
   169 		*/
       
   170 		EMultipacketResponse = 20,
       
   171 
       
   172 		/**
       
   173 		The response from the server contained an error code.
       
   174 		@see CObexClient::OnPacketReceive()
       
   175 		*/
       
   176 		EErrorResponseFromServer = 21,
       
   177 
       
   178 		/**
       
   179 		Could not extract the header from the final Put response packet.
       
   180 		@see CObexClient::OnPacketReceive()
       
   181 		*/
       
   182 		ECannotExtractFinalPutHeader = 22,
       
   183 
       
   184 		/**
       
   185 		The opcode of the Put response packet from the server is
       
   186 		not consistent with the progress of the Put operation.
       
   187 		@see CObexClient::OnPacketReceive()
       
   188 		*/
       
   189 		EPutOutOfSync = 23,
       
   190 
       
   191 		/**
       
   192 		The opcode of the Get response packet from the server is Success
       
   193 		but the client hasn't finished sending all the Get request packets.
       
   194 		@see CObexClient::OnPacketReceive()
       
   195 		*/
       
   196 		EGetPrematureSuccess = 24,
       
   197 
       
   198 		/**
       
   199 		Could not parse a GetResponse packet from the server.
       
   200 		@see CObexClient::OnPacketReceive()
       
   201 		*/
       
   202 		EGetResponseParseError = 25,
       
   203 		};
       
   204 
       
   205 	static CObexErrorEngine* NewL();
       
   206 
       
   207 	// Implements MObexClientErrorResolver::LastError().
       
   208 	virtual TUint LastError(TObexClientErrorResolutionSetType aErrorSet) const;
       
   209 
       
   210 	void SetLastError(TObexClientUnderlyingError aError);
       
   211 
       
   212 private:
       
   213 	CObexErrorEngine();
       
   214 
       
   215 private:
       
   216 	TObexClientUnderlyingError iLastError;
       
   217 	};
       
   218 
       
   219 #endif