|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CTCStateTiltIdle class implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "tcstatetiltidle.h" |
|
20 #include "tctransactionhandler.h" |
|
21 #include "tcstatepool.h" |
|
22 #include "tcutil.h" |
|
23 #include "trace.h" |
|
24 |
|
25 CTCStateTiltIdle* CTCStateTiltIdle::NewL( MTCStatePool& aStatePool, |
|
26 MTCTransactionHandler& aTransactionHandler ) |
|
27 { |
|
28 FUNC_LOG; |
|
29 |
|
30 CTCStateTiltIdle* self = CTCStateTiltIdle::NewLC( |
|
31 aStatePool, |
|
32 aTransactionHandler ); |
|
33 CleanupStack::Pop( self ); |
|
34 |
|
35 return self; |
|
36 } |
|
37 |
|
38 CTCStateTiltIdle* CTCStateTiltIdle::NewLC( MTCStatePool& aStatePool, |
|
39 MTCTransactionHandler& aTransactionHandler ) |
|
40 { |
|
41 FUNC_LOG; |
|
42 |
|
43 CTCStateTiltIdle* self = new( ELeave ) CTCStateTiltIdle( |
|
44 aStatePool, |
|
45 aTransactionHandler ); |
|
46 CleanupStack::PushL( self ); |
|
47 |
|
48 return self; |
|
49 } |
|
50 |
|
51 CTCStateTiltIdle::CTCStateTiltIdle( MTCStatePool& aStatePool, |
|
52 MTCTransactionHandler& aTransactionHandler ): |
|
53 CTCStateTilt( CTCState::ETCStateIdle, aStatePool, aTransactionHandler ) |
|
54 { |
|
55 FUNC_LOG; |
|
56 } |
|
57 |
|
58 // METHODS |
|
59 |
|
60 // ---------------------------------------------------------------------------------- |
|
61 // CTCStateTiltIdle::HandleTransactionL |
|
62 // ---------------------------------------------------------------------------------- |
|
63 // |
|
64 void CTCStateTiltIdle::HandleEventL( TTCEventId aId, TTCEvent* /*aEvent */) |
|
65 { |
|
66 FUNC_LOG; |
|
67 |
|
68 INFO_2( "Handling event [%S] in state [%S]", |
|
69 &TCUtil::EventIdAsDesC( aId ), |
|
70 &TCUtil::StateIdAsDesC( this ) ); |
|
71 |
|
72 // Idle state only handles EEventIdHandleOpenChannel event. |
|
73 switch( aId ) |
|
74 { |
|
75 case EEventIdHandleOpenChannel: |
|
76 { |
|
77 iTransactionHandler.ProcessTransactionL( ETCTransactionIdOpenChannel ); |
|
78 } |
|
79 default: |
|
80 { |
|
81 INFO_2( "Event [%S] not handled in [%S] state", |
|
82 &TCUtil::EventIdAsDesC( aId ), |
|
83 &TCUtil::StateIdAsDesC( this ) ); |
|
84 break; |
|
85 } |
|
86 } |
|
87 } |
|
88 |
|
89 // ---------------------------------------------------------------------------------- |
|
90 // CTCStateTiltIdle::HandleTransactionCompletedL |
|
91 // ---------------------------------------------------------------------------------- |
|
92 // |
|
93 void CTCStateTiltIdle::HandleTransactionCompletedL( TTCTransactionId aTransactionId, |
|
94 TInt /*aError */) |
|
95 { |
|
96 FUNC_LOG; |
|
97 |
|
98 INFO_2( "Transaction [%S] complete message recieved in [%S] state", |
|
99 &TCUtil::TransactionIdAsDesC( aTransactionId ), |
|
100 &TCUtil::StateIdAsDesC( this ) ); |
|
101 |
|
102 // When ETCTransactionIdOpenChannel is completed, change top OPEN state |
|
103 switch( aTransactionId ) |
|
104 { |
|
105 case ETCTransactionIdOpenChannel: |
|
106 { |
|
107 iStatePool.ChangeStateL( CTCState::ETCStateOpen ); |
|
108 break; |
|
109 } |
|
110 default: |
|
111 { |
|
112 INFO_2( "Transaction [%S] complete message not handled in [%S] state", |
|
113 &TCUtil::TransactionIdAsDesC( aTransactionId ), |
|
114 &TCUtil::StateIdAsDesC( this ) ); |
|
115 break; |
|
116 } |
|
117 } |
|
118 } |
|
119 |
|
120 // ---------------------------------------------------------------------------------- |
|
121 // CTCStateTiltIdle::HandleStateEntryL |
|
122 // ---------------------------------------------------------------------------------- |
|
123 // |
|
124 void CTCStateTiltIdle::HandleStateEntryL() |
|
125 { |
|
126 FUNC_LOG; |
|
127 |
|
128 // Nothing to do |
|
129 } |
|
130 |
|
131 // ---------------------------------------------------------------------------------- |
|
132 // CTCStateTiltIdle::HandleStateExitL |
|
133 // ---------------------------------------------------------------------------------- |
|
134 // |
|
135 void CTCStateTiltIdle::HandleStateExitL() |
|
136 { |
|
137 FUNC_LOG; |
|
138 |
|
139 // Nothing to do |
|
140 } |
|
141 |
|
142 // End of File |