25
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2008 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: Class header for CWsfEventHandler
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
#ifndef C_WSFEVENTHANDLER_H
|
|
23 |
#define C_WSFEVENTHANDLER_H
|
|
24 |
|
|
25 |
// EXTERNAL INCLUDES
|
|
26 |
#include <e32base.h>
|
|
27 |
|
|
28 |
// INTERNAL INCLUDES
|
|
29 |
#include "wsfsession.h"
|
|
30 |
#include "wsfservercommon.h"
|
|
31 |
#include "wsfstatechangeobserver.h"
|
|
32 |
|
|
33 |
|
|
34 |
// CLASS DEFINITION
|
|
35 |
/**
|
|
36 |
* Class to handle callbacks from the server
|
|
37 |
*
|
|
38 |
* CWsfEventHandler acts as a gateway between the client and the server.
|
|
39 |
* Its main task is to hand over notifications of server events if the client
|
|
40 |
* has requested that.
|
|
41 |
*
|
|
42 |
* @lib wsfclient.lib
|
|
43 |
* @since S60 5.0
|
|
44 |
*/
|
|
45 |
|
|
46 |
NONSHARABLE_CLASS( CWsfEventHandler ): public CActive
|
|
47 |
{
|
|
48 |
public: // Constructors and destructor
|
|
49 |
/**
|
|
50 |
* Factory function.
|
|
51 |
* @since S60 5.0
|
|
52 |
* @param aSession Client-side handle to the server session
|
|
53 |
* Ownership not passed.
|
|
54 |
* @param aObserver The object which should be notified on event
|
|
55 |
* Ownership not passed.
|
|
56 |
*/
|
|
57 |
static CWsfEventHandler* NewL( RWsfSession& aSession,
|
|
58 |
MWsfStateChangeObserver& aObserver );
|
|
59 |
|
|
60 |
~CWsfEventHandler();
|
|
61 |
|
|
62 |
|
|
63 |
private:
|
|
64 |
/**
|
|
65 |
* Constructor
|
|
66 |
* @since S60 5.0
|
|
67 |
* @param aSession Client-side handle to the server session.
|
|
68 |
* Ownership not passed.
|
|
69 |
* @param aObserver The object which should be notified on event.
|
|
70 |
* Ownership not passed.
|
|
71 |
*/
|
|
72 |
CWsfEventHandler( RWsfSession& aSession,
|
|
73 |
MWsfStateChangeObserver& aObserver );
|
|
74 |
|
|
75 |
void ConstructL();
|
|
76 |
|
|
77 |
|
|
78 |
public: // new methods
|
|
79 |
/**
|
|
80 |
* Set the listening active object as active
|
|
81 |
* @since S60 5.0
|
|
82 |
*/
|
|
83 |
void Start();
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Get reference to the event container
|
|
87 |
* @since S60 5.0
|
|
88 |
* @return Reference to the event container.
|
|
89 |
*/
|
|
90 |
TPckgBuf<TWsfNotifyEventContainer>& EventContainer();
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Change the event observer by resetting the reference
|
|
94 |
* @since S60 5.0
|
|
95 |
* @param aObserver The object which should be notified on event.
|
|
96 |
* Ownership not passed.
|
|
97 |
*/
|
|
98 |
void ResetObserver( MWsfStateChangeObserver& aObserver );
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Prevents the ongoing connecting process from notifying the observer
|
|
102 |
* if the connecting flag is set
|
|
103 |
* @since S60 5.0
|
|
104 |
*/
|
|
105 |
void BlockNextConnectedEvent();
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Resets the flag that prevents the ongoing connecting process
|
|
109 |
* from notifying the observer
|
|
110 |
* @since S60 5.2
|
|
111 |
*/
|
|
112 |
void UnBlockNextConnectedEvent();
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Sets the connecting flag. Used by RWsfSession to mark the interval
|
|
116 |
* of the connection creation.
|
|
117 |
* @since S60 5.0
|
|
118 |
* @param aConnecting The value of the flag.
|
|
119 |
*/
|
|
120 |
void SetConnecting( TBool aConnecting );
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Gets the connecting flag.
|
|
124 |
* @since S60 5.0
|
|
125 |
* @return The value of the flag.
|
|
126 |
*/
|
|
127 |
TBool Connecting() const;
|
|
128 |
|
|
129 |
|
|
130 |
private: // from CActive
|
|
131 |
void RunL();
|
|
132 |
void DoCancel();
|
|
133 |
TInt RunError( TInt aError );
|
|
134 |
|
|
135 |
private:
|
|
136 |
/**
|
|
137 |
* Handle the RunL trapped
|
|
138 |
* @since S60 5.0
|
|
139 |
*/
|
|
140 |
void DoRunL();
|
|
141 |
|
|
142 |
private:
|
|
143 |
/**
|
|
144 |
* Client-side handle for the server session. Not owned.
|
|
145 |
*/
|
|
146 |
RWsfSession* iSession;
|
|
147 |
|
|
148 |
/**
|
|
149 |
* The object which should be notified on event. Not owned.
|
|
150 |
*/
|
|
151 |
MWsfStateChangeObserver* iObserver;
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Event container
|
|
155 |
*/
|
|
156 |
TPckgBuf<TWsfNotifyEventContainer> iEvent;
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Indicates whether the connection created event should be suppressed
|
|
160 |
*/
|
|
161 |
TBool iBlockConnectedEvent;
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Indicates whether there is an ongoing connecting process
|
|
165 |
*/
|
|
166 |
TBool iConnecting;
|
|
167 |
|
|
168 |
};
|
|
169 |
|
|
170 |
|
|
171 |
#endif // C_WSFEVENTHANDLER_H
|