|
1 /* |
|
2 * Copyright (c) 2006, 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: These classes define the dps states. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef DPSSTATE_H |
|
20 #define DPSSTATE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 class CDpsStateMachine; |
|
24 |
|
25 /** |
|
26 * This class is the base classes for all dps state classes. |
|
27 * We follow state design pattern here so the state class defines all |
|
28 * transactions among states as member functions. |
|
29 */ |
|
30 class MDpsState |
|
31 { |
|
32 public: |
|
33 |
|
34 /** |
|
35 * Script sent notification |
|
36 */ |
|
37 virtual void ScriptSentNotifyL(TBool aReply) = 0; |
|
38 |
|
39 /** |
|
40 * Script received notification |
|
41 */ |
|
42 virtual void ScriptReceivedNotifyL(TBool aReply) = 0; |
|
43 |
|
44 /** |
|
45 * Error handling of the transaction |
|
46 */ |
|
47 virtual void Error(TInt aErr) = 0; |
|
48 }; |
|
49 |
|
50 /** |
|
51 * Idle state class |
|
52 */ |
|
53 NONSHARABLE_CLASS(TDpsIdleState) : public MDpsState |
|
54 { |
|
55 public: |
|
56 /** |
|
57 * Constructor |
|
58 */ |
|
59 TDpsIdleState(CDpsStateMachine* aStateMachine); |
|
60 public: |
|
61 |
|
62 /** |
|
63 * @see MDpsState |
|
64 */ |
|
65 void ScriptSentNotifyL(TBool aReply); |
|
66 |
|
67 /** |
|
68 * @see MDpsState |
|
69 */ |
|
70 void ScriptReceivedNotifyL(TBool aReply); |
|
71 |
|
72 /** |
|
73 * @see MDpsState |
|
74 */ |
|
75 void Error(TInt aErr); |
|
76 |
|
77 |
|
78 private: |
|
79 CDpsStateMachine* iStateMachine; |
|
80 }; |
|
81 |
|
82 /** |
|
83 * Sending Request state class. Device sending request starts form this state |
|
84 */ |
|
85 NONSHARABLE_CLASS(TDpsSendingReqState) : public MDpsState |
|
86 { |
|
87 public: |
|
88 /** |
|
89 * Constructor |
|
90 */ |
|
91 TDpsSendingReqState(CDpsStateMachine* aStateMachine); |
|
92 |
|
93 public: |
|
94 |
|
95 /** |
|
96 * @see MDpsState |
|
97 */ |
|
98 void ScriptSentNotifyL(TBool aReply); |
|
99 |
|
100 /** |
|
101 * @see MDpsState |
|
102 */ |
|
103 void ScriptReceivedNotifyL(TBool aReply); |
|
104 |
|
105 /** |
|
106 * @see MDpsState |
|
107 */ |
|
108 void Error(TInt aErr); |
|
109 |
|
110 private: |
|
111 CDpsStateMachine* iStateMachine; |
|
112 }; |
|
113 |
|
114 /** |
|
115 * Waiting Reply state class (script has been sent) |
|
116 */ |
|
117 NONSHARABLE_CLASS(TDpsWaitingRepState) : public MDpsState |
|
118 { |
|
119 public: |
|
120 /** |
|
121 * Constructor |
|
122 */ |
|
123 TDpsWaitingRepState(CDpsStateMachine* aStateMachine); |
|
124 |
|
125 public: |
|
126 |
|
127 /** |
|
128 * @see MDpsState |
|
129 */ |
|
130 void ScriptSentNotifyL(TBool aReply); |
|
131 |
|
132 /** |
|
133 * @see MDpsState |
|
134 */ |
|
135 void ScriptReceivedNotifyL(TBool aReply); |
|
136 |
|
137 /** |
|
138 * @see MDpsState |
|
139 */ |
|
140 void Error(TInt aErr); |
|
141 |
|
142 private: |
|
143 CDpsStateMachine* iStateMachine; |
|
144 }; |
|
145 |
|
146 /** |
|
147 * Sending Reply state class. The device starts replying the host request |
|
148 * in this state. |
|
149 */ |
|
150 NONSHARABLE_CLASS(TDpsSendingRepState) : public MDpsState |
|
151 { |
|
152 public: |
|
153 /** |
|
154 * Constructor |
|
155 */ |
|
156 TDpsSendingRepState(CDpsStateMachine* aStateMachine); |
|
157 |
|
158 public: |
|
159 |
|
160 /** |
|
161 * @see MDpsState |
|
162 */ |
|
163 void ScriptSentNotifyL(TBool aReply); |
|
164 |
|
165 /** |
|
166 * @see MDpsState |
|
167 */ |
|
168 void ScriptReceivedNotifyL(TBool aReply); |
|
169 |
|
170 /** |
|
171 * @see MDpsState |
|
172 */ |
|
173 void Error(TInt aErr); |
|
174 |
|
175 private: |
|
176 CDpsStateMachine* iStateMachine; |
|
177 }; |
|
178 |
|
179 #endif |