|
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 OBEX Ready State |
|
24 This is the default state when there is an OBEX connection but no current operation. |
|
25 A CONNECT will be answered with an OBEX error code |
|
26 A GET will move the machine to GetOpReceiveSpecification |
|
27 A PUT will move the machine to PutOpWaitForUser |
|
28 A SETPATH will move the machine to SetPathOp |
|
29 A DISCONNECT or ABORT will be processed |
|
30 */ |
|
31 |
|
32 TObexServerStateReady::TObexServerStateReady() |
|
33 { |
|
34 #ifdef __FLOG_ACTIVE |
|
35 _LIT8(KName, "Ready"); |
|
36 iName = KName; |
|
37 #endif |
|
38 } |
|
39 |
|
40 void TObexServerStateReady::Entry(CObexServerStateMachine& aContext) |
|
41 { |
|
42 aContext.Owner().SetCurrentOperation(CObex::EOpIdle); |
|
43 } |
|
44 |
|
45 void TObexServerStateReady::Connect(CObexServerStateMachine& aContext, CObexPacket& /*aPacket*/) |
|
46 { |
|
47 // Send ERespConflict |
|
48 aContext.Transport().Send(ERespConflict); |
|
49 } |
|
50 |
|
51 void TObexServerStateReady::Disconnect(CObexServerStateMachine& aContext, CObexPacket& aPacket) |
|
52 { |
|
53 // Process disconnect |
|
54 PerformDisconnect(aContext, aPacket); |
|
55 } |
|
56 |
|
57 void TObexServerStateReady::Put(CObexServerStateMachine& aContext, CObexPacket& /*aPacket*/) |
|
58 { |
|
59 aContext.ChangeState(CObexServerStateMachine::EPutOpWaitForUser); |
|
60 } |
|
61 |
|
62 void TObexServerStateReady::Get(CObexServerStateMachine& aContext, CObexPacket& /*aPacket*/) |
|
63 { |
|
64 aContext.ChangeState(CObexServerStateMachine::EGetOpReceiveSpecification); |
|
65 } |
|
66 |
|
67 void TObexServerStateReady::SetPath(CObexServerStateMachine& aContext, CObexPacket& /*aPacket*/) |
|
68 { |
|
69 aContext.ChangeState(CObexServerStateMachine::ESetPathOp); |
|
70 } |
|
71 |
|
72 void TObexServerStateReady::Abort(CObexServerStateMachine& aContext) |
|
73 { |
|
74 // Send ERespSuccess |
|
75 // Report that we're re-synced |
|
76 aContext.Transport().Send(ERespSuccess); |
|
77 } |
|
78 |
|
79 void TObexServerStateReady::OverrideRequestHandling(CObexServerStateMachine& aContext, TObexResponse aResponse) |
|
80 { |
|
81 // Send response and remain in Ready state |
|
82 aContext.Transport().Send(aResponse); |
|
83 } |
|
84 |
|
85 |
|
86 void TObexServerStateReady::ReadActivityDetected(CObexServerStateMachine& aContext) |
|
87 /* |
|
88 Indicates that a new obex packet is being read. |
|
89 This should only need to be passed up to the user |
|
90 if we are in 'Ready' state. |
|
91 */ |
|
92 { |
|
93 aContext.Owner().SignalReadActivity(); |
|
94 } |
|
95 |