1 // Copyright (c) 2006-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 #if ( defined __FLOG_ACTIVE && defined __LOG_FUNCTIONS__ ) |
|
20 _LIT8(KLogComponent, "OBEX"); |
|
21 #endif |
|
22 |
|
23 /** |
|
24 @file |
|
25 @internalComponent |
|
26 |
|
27 Disconnecting State |
|
28 In this state, the server has received a (correctly-addressed) disconnect |
|
29 request from the client, and placed an asynchronous request on the transport |
|
30 to ACK it. |
|
31 This state is interested in the completion of that send request so it can (a) |
|
32 complete the client's notifications, (b) move to 'transport connected' state |
|
33 and (c) pull down the transport. |
|
34 */ |
|
35 |
|
36 TObexServerStateDisconnecting::TObexServerStateDisconnecting() |
|
37 { |
|
38 #ifdef __FLOG_ACTIVE |
|
39 _LIT8(KName, "Disconnecting"); |
|
40 iName = KName; |
|
41 #endif |
|
42 } |
|
43 |
|
44 void TObexServerStateDisconnecting::Connect(CObexServerStateMachine& aContext, CObexPacket& /*aPacket*/) |
|
45 { |
|
46 aContext.Owner().Error(KErrIrObexBadEvent); |
|
47 } |
|
48 |
|
49 void TObexServerStateDisconnecting::Disconnect(CObexServerStateMachine& aContext, CObexPacket& /*aPacket*/) |
|
50 { |
|
51 aContext.Owner().Error(KErrIrObexBadEvent); |
|
52 } |
|
53 |
|
54 void TObexServerStateDisconnecting::Put(CObexServerStateMachine& aContext, CObexPacket& /*aPacket*/) |
|
55 { |
|
56 aContext.Owner().Error(KErrIrObexBadEvent); |
|
57 } |
|
58 |
|
59 void TObexServerStateDisconnecting::Get(CObexServerStateMachine& aContext, CObexPacket& /*aPacket*/) |
|
60 { |
|
61 aContext.Owner().Error(KErrIrObexBadEvent); |
|
62 } |
|
63 |
|
64 void TObexServerStateDisconnecting::SetPath(CObexServerStateMachine& aContext, CObexPacket& /*aPacket*/) |
|
65 { |
|
66 aContext.Owner().Error(KErrIrObexBadEvent); |
|
67 } |
|
68 |
|
69 void TObexServerStateDisconnecting::Abort(CObexServerStateMachine& aContext) |
|
70 { |
|
71 aContext.Owner().Error(KErrIrObexBadEvent); |
|
72 } |
|
73 |
|
74 void TObexServerStateDisconnecting::OverrideRequestHandling(CObexServerStateMachine& aContext, TObexResponse /*aResponse*/) |
|
75 { |
|
76 aContext.Owner().Error(KErrIrObexBadEvent); |
|
77 } |
|
78 |
|
79 void TObexServerStateDisconnecting::WriteComplete(CObexServerStateMachine& aContext) |
|
80 { |
|
81 LOG_FUNC |
|
82 |
|
83 aContext.Notification().ObexDisconnectIndication(KNullDesC8); |
|
84 // ControlledTransportDown() may raise a TransportDown event immediately, |
|
85 // re-entering the state machine, so we need to be in the correct state |
|
86 // (TransportConnected) before the call. |
|
87 // Also need to keep current operation == EOpDisconnect until transport is |
|
88 // happy (which is done in CObex) so ETransportConnected does not set |
|
89 // iCurrentOperation to EOpIdle. |
|
90 aContext.ChangeState(CObexServerStateMachine::ETransportConnected); |
|
91 aContext.ControlledTransportDown(); |
|
92 } |
|