obex/obexprotocol/obex/src/TObexServerStateTransportConnected.cpp
changeset 57 f6055a57ae18
parent 0 d0791faffa3f
equal deleted inserted replaced
54:4dc88a4ac6f4 57:f6055a57ae18
       
     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 #include <obex.h>
       
    17 #include "obexserverstatemachine.h"
       
    18 
       
    19 /**
       
    20 @file
       
    21 @internalComponent
       
    22 
       
    23 Transport Connected State
       
    24 This is the state where there is a transport connect, but no OBEX connection.
       
    25 A CONNECT will move the machine to ObexConnecting
       
    26 A DISCONNECT will be processed
       
    27 An ABORT will cause a Protocol Error
       
    28 Any other OBEX operation will be answered with an OBEX error code
       
    29 */
       
    30 
       
    31 TObexServerStateTransportConnected::TObexServerStateTransportConnected()
       
    32 	{
       
    33 #ifdef __FLOG_ACTIVE
       
    34 	_LIT8(KName, "TransportConnected");
       
    35 	iName = KName;
       
    36 #endif
       
    37 	}
       
    38 
       
    39 void TObexServerStateTransportConnected::Connect(CObexServerStateMachine& aContext, CObexPacket& /*aPacket*/)
       
    40 	{
       
    41 	aContext.ChangeState(CObexServerStateMachine::EObexConnecting);
       
    42 	}
       
    43 
       
    44 void TObexServerStateTransportConnected::Disconnect(CObexServerStateMachine& aContext, CObexPacket& aPacket)
       
    45 	{
       
    46 	// Process disconnect
       
    47 	PerformDisconnect(aContext, aPacket);
       
    48 	}
       
    49 
       
    50 void TObexServerStateTransportConnected::Put(CObexServerStateMachine& aContext, CObexPacket& /*aPacket*/)
       
    51 	{
       
    52 	// Send ERespBadRequest
       
    53 	aContext.Transport().Send(ERespBadRequest);
       
    54 	}
       
    55 
       
    56 void TObexServerStateTransportConnected::Get(CObexServerStateMachine& aContext, CObexPacket& /*aPacket*/)
       
    57 	{
       
    58 	// Send ERespConflict
       
    59 	aContext.Transport().Send(ERespConflict);
       
    60 	}
       
    61 
       
    62 void TObexServerStateTransportConnected::SetPath(CObexServerStateMachine& aContext, CObexPacket& /*aPacket*/)
       
    63 	{
       
    64 	// Send ERespConflict
       
    65 	aContext.Transport().Send(ERespConflict);
       
    66 	}
       
    67 
       
    68 void TObexServerStateTransportConnected::Abort(CObexServerStateMachine& aContext)
       
    69 	{
       
    70 	// Send ERespSuccess
       
    71 	// Any other response would, according to the spec,
       
    72 	// require the Obex client to bring down the transport.
       
    73 	// Our attempt is to be resilient if an 'Abort'
       
    74 	// is sent erroneously whilst we are in this state.
       
    75 	aContext.Transport().Send(ERespSuccess);
       
    76 	}
       
    77 
       
    78 void TObexServerStateTransportConnected::OverrideRequestHandling(CObexServerStateMachine& aContext, TObexResponse aResponse)
       
    79 	{
       
    80 	aContext.Transport().Send(aResponse);
       
    81 	// no need to change state, it's just as if the packet never arrived.
       
    82 	}
       
    83