|
1 |
|
2 /* |
|
3 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Initial Contributors: |
|
11 * Nokia Corporation - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __TSIPEXSTATE_H__ |
|
22 #define __TSIPEXSTATE_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include "SIPExSocketEngine.h" |
|
26 #include "SIPExGameEngine.h" |
|
27 #include <e32base.h> |
|
28 #include <in_sock.h> |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 |
|
32 // CLASS DECLARATIONS |
|
33 /** |
|
34 * The abstract base class for all states. |
|
35 */ |
|
36 class TSIPExState |
|
37 { |
|
38 public: // New functions |
|
39 |
|
40 /** |
|
41 * ChangeState |
|
42 * Changing the active state. |
|
43 * @param aContext The pointer to the game engine. |
|
44 * @param aNewState The new active state. |
|
45 */ |
|
46 void ChangeState( CSIPExEngine* aContext, TSIPExState* aNewState ); |
|
47 |
|
48 /** |
|
49 * Info |
|
50 * Non leaving function for setting info text. |
|
51 * @param aContext The pointer to the game engine. |
|
52 * @param aText A text to set to the info |
|
53 */ |
|
54 void Info( CSIPExEngine* aContext, const TDesC& aText ); |
|
55 |
|
56 /** |
|
57 * StatusInfo |
|
58 * Non leaving function for setting status info text. |
|
59 * @param aContext The pointer to the game engine. |
|
60 * @param aText A text to set to the info |
|
61 */ |
|
62 void StatusInfo( CSIPExEngine* aContext, const TDesC& aText ); |
|
63 |
|
64 /** |
|
65 * CombineAndShowInfoL |
|
66 * Combines a descriptor and a number value as one descriptor. |
|
67 * The result descriptor is set to info view. |
|
68 * The max length of the new desc is 64. |
|
69 * @param aContext The pointer to the game engine. |
|
70 * @param aText A text part. |
|
71 * @param aNum A number part. |
|
72 */ |
|
73 void CombineAndShowInfoL( CSIPExEngine* aContext, const TDesC& aText, TInt aNum ); |
|
74 |
|
75 public: |
|
76 // ---------------------------------------------------------------------------- |
|
77 // From SIP Observer |
|
78 // ---------------------------------------------------------------------------- |
|
79 |
|
80 /** |
|
81 * InviteReceived |
|
82 * From MSIPExSIPEngineObserver. |
|
83 */ |
|
84 virtual void InviteReceived( CSIPExEngine* aContext, |
|
85 const TDesC8& aFrom, const TUint32 aIapId ); |
|
86 |
|
87 /** |
|
88 * InviteAcceptedByRemote |
|
89 * From MSIPExSIPEngineObserver. |
|
90 */ |
|
91 virtual void InviteAcceptedByRemote( CSIPExEngine* aContext, const TInetAddr& aIPAddress, const TUint32 aIapId ); |
|
92 |
|
93 /** |
|
94 * InviteDeclinedByRemote |
|
95 * From MSIPExSIPEngineObserver. |
|
96 */ |
|
97 virtual void InviteDeclinedByRemote( CSIPExEngine* aContext, const TInt aResponse ); |
|
98 |
|
99 /** |
|
100 * InviteReceivedByRemote |
|
101 * From MSIPExSIPEngineObserver. |
|
102 */ |
|
103 virtual void InviteReceivedByRemote( CSIPExEngine* aContext, const TInt aResponse ); |
|
104 |
|
105 /** |
|
106 * InviteAcceptedByUs |
|
107 * From MSIPExSIPEngineObserver. |
|
108 */ |
|
109 virtual void InviteAcceptedByUs( CSIPExEngine* aContext ); |
|
110 |
|
111 /** |
|
112 * InvitationCancelled |
|
113 * From MSIPExSIPEngineObserver. |
|
114 */ |
|
115 virtual void InvitationCancelled( CSIPExEngine* aContext); |
|
116 |
|
117 /** |
|
118 * CancelFailed |
|
119 * From MSIPExSIPEngineObserver. |
|
120 */ |
|
121 virtual void CancelFailed( CSIPExEngine* aContext ); |
|
122 |
|
123 /** |
|
124 * ProfileEnabled |
|
125 * From MSIPExSIPEngineObserver. |
|
126 */ |
|
127 virtual void ProfileEnabled( CSIPExEngine* aContext, TUint32 aSIPProfileId ); |
|
128 |
|
129 /** |
|
130 * IMReceived |
|
131 * From MSIPExSIPEngineObserver. |
|
132 */ |
|
133 virtual void IMReceived( CSIPExEngine* aContext, const TDesC8& aFrom, |
|
134 const TDesC8& aMessage ); |
|
135 |
|
136 /** |
|
137 * SessionEnded |
|
138 * From MSIPExSIPEngineObserver. |
|
139 */ |
|
140 virtual void SessionEnded( CSIPExEngine* aContext ); |
|
141 |
|
142 /** |
|
143 * ConnectionLost |
|
144 * From MSIPExSIPEngineObserver. |
|
145 */ |
|
146 virtual void ConnectionLost( CSIPExEngine* aContext ); |
|
147 |
|
148 /** |
|
149 * ProfileError |
|
150 * From MSIPExSIPEngineObserver. |
|
151 */ |
|
152 virtual void ProfileError( CSIPExEngine* aContext, TInt aError ); |
|
153 |
|
154 /** |
|
155 * EngineError |
|
156 * From MSIPExSIPEngineObserver. |
|
157 */ |
|
158 void EngineError( CSIPExEngine* aContext, TInt aError ); |
|
159 |
|
160 // ---------------------------------------------------------------------------- |
|
161 // From Socket engine |
|
162 // ---------------------------------------------------------------------------- |
|
163 |
|
164 /** |
|
165 * SocketState |
|
166 * From MSIPExSocketEngineObserver. |
|
167 */ |
|
168 virtual void SocketState( CSIPExEngine* aContext, TInt aNewState ); |
|
169 |
|
170 /** |
|
171 * SocketData |
|
172 * From MSIPExSocketEngineObserver. |
|
173 */ |
|
174 virtual void SocketData( CSIPExEngine* aContext, TDesC8& aData ); |
|
175 |
|
176 // ---------------------------------------------------------------------------- |
|
177 // From Game Engine |
|
178 // ---------------------------------------------------------------------------- |
|
179 |
|
180 /** |
|
181 * InviteL |
|
182 * Called when user invites the remote user to the game. |
|
183 */ |
|
184 virtual void InviteL( CSIPExEngine* aContext, const TDesC& aAddress ); |
|
185 |
|
186 /** |
|
187 * DrawCursor |
|
188 * Tells whether we should draw the cursor or not. |
|
189 */ |
|
190 virtual TBool DrawCursor(); |
|
191 |
|
192 /** |
|
193 * DrawBoard |
|
194 * Tells whether we should draw the board or not. |
|
195 */ |
|
196 virtual TBool DrawBoard(); |
|
197 |
|
198 /** |
|
199 * CalculatePos |
|
200 * Calculates the next free place in cursor's column. |
|
201 */ |
|
202 virtual TInt CalculatePos( CSIPExEngine* aContext ); |
|
203 |
|
204 /** |
|
205 * IsWin |
|
206 * Checks the if the move is winning move. |
|
207 */ |
|
208 virtual TInt IsWin( CSIPExEngine* aContext, const TInt aX, const TInt aY ); |
|
209 |
|
210 /** |
|
211 * EnableProfile |
|
212 * Virtual function. |
|
213 */ |
|
214 virtual void EnableProfileL( CSIPExEngine* aContext ); |
|
215 |
|
216 /** |
|
217 * DisableProfile |
|
218 * Virtual function. |
|
219 */ |
|
220 virtual void DisableProfileL( CSIPExEngine* aContext ); |
|
221 |
|
222 /** |
|
223 * CursorPressed |
|
224 * Virtual function. |
|
225 */ |
|
226 virtual void CursorPressed( CSIPExEngine* aContext ); |
|
227 |
|
228 /** |
|
229 * CursorRight |
|
230 * Virtual function. |
|
231 */ |
|
232 virtual void CursorRight( CSIPExEngine* aContext ); |
|
233 |
|
234 /** |
|
235 * CursorLeft |
|
236 * Virtual function. |
|
237 */ |
|
238 virtual void CursorLeft( CSIPExEngine* aContext ); |
|
239 |
|
240 /** |
|
241 * MoveCursorL |
|
242 * Virtual function |
|
243 */ |
|
244 virtual void MoveCursorL( CSIPExEngine* aContext, const TInt aNewPosition ); |
|
245 |
|
246 /** |
|
247 * SendInstantMsgL |
|
248 * Virtual function. |
|
249 */ |
|
250 virtual void SendInstantMsgL( CSIPExEngine* aContext, |
|
251 const TDesC& aAddress, const TDesC& aMsg ); |
|
252 |
|
253 /** |
|
254 * EndGameL |
|
255 * Virtual function. |
|
256 */ |
|
257 virtual void EndGameL( CSIPExEngine* aContext ); |
|
258 }; |
|
259 |
|
260 #endif // __TSIPEXSTATE_H__ |
|
261 |
|
262 // End of file |