24
|
1 |
// Copyright (c) 2004-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 |
// NIFMAN notification proxy class
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalComponent
|
|
21 |
*/
|
|
22 |
|
|
23 |
#include "spudnotify.h"
|
|
24 |
#include "bindman.h"
|
|
25 |
|
|
26 |
CSpudNotify::CSpudNotify(CBindMan& aBindMan, MNifIfNotify* aNotify, TContextId aContextId)
|
|
27 |
: iBindMan(aBindMan), iNotify(aNotify), iContextId(aContextId)
|
|
28 |
{
|
|
29 |
}
|
|
30 |
|
|
31 |
|
|
32 |
CSpudNotify::~CSpudNotify()
|
|
33 |
{
|
|
34 |
}
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Notification from the nif that the link layer has gone down.
|
|
38 |
* @param aReason A Symbian OS error code indicating the reason for the link closing down
|
|
39 |
* @param aAction The action that should be taken as a result of link layer down being signalled
|
|
40 |
*/
|
|
41 |
void CSpudNotify::LinkLayerDown(TInt aReason, TAction aAction)
|
|
42 |
{
|
|
43 |
iBindMan.SpudMan()->LinkLayerDown(iContextId, aReason, aAction);
|
|
44 |
}
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Notification from the nif that the link layer is up
|
|
48 |
*/
|
|
49 |
void CSpudNotify::LinkLayerUp()
|
|
50 |
{
|
|
51 |
iBindMan.SpudMan()->LinkLayerUp(iContextId);
|
|
52 |
}
|
|
53 |
|
|
54 |
/**
|
|
55 |
* Indicate that link negotiation failed on this nif to allow nifman to take appropriate action
|
|
56 |
* @param aIf The address of the CNifIfBase/Link object for which negotiation failed
|
|
57 |
* @param aReason An error code denoting the reason for failure
|
|
58 |
*/
|
|
59 |
void CSpudNotify::NegotiationFailed(CNifIfBase* aIf, TInt aReason)
|
|
60 |
{
|
|
61 |
iNotify->NegotiationFailed(aIf, aReason);
|
|
62 |
}
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Request to the agent to return the data required for authentication
|
|
66 |
* @param aUsername On return, contains the username to be used for authentication
|
|
67 |
* @param aPassword On return, contains the password to be used for authentication
|
|
68 |
* @note The return values in aUsername and aPassword should not be considered valid until CNifIfLink::AuthenticateComplete() has been called
|
|
69 |
*/
|
|
70 |
TInt CSpudNotify::Authenticate(TDes& aUsername, TDes& aPassword)
|
|
71 |
{
|
|
72 |
return iNotify->Authenticate(aUsername, aPassword);
|
|
73 |
}
|
|
74 |
|
|
75 |
/**
|
|
76 |
* Request to the agent to cancel a pending authentication
|
|
77 |
*/
|
|
78 |
void CSpudNotify::CancelAuthenticate()
|
|
79 |
{
|
|
80 |
iNotify->CancelAuthenticate();
|
|
81 |
}
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Fetch any excess data from the agent that it received during connection setup
|
|
85 |
* @param aBuffer On return, the buffer contains the excess data from the agent
|
|
86 |
* @return KErrNone, if successful; otherwise, one of the standard Symbian OS error codes
|
|
87 |
*/
|
|
88 |
TInt CSpudNotify::GetExcessData(TDes8& aBuffer)
|
|
89 |
{
|
|
90 |
return iNotify->GetExcessData(aBuffer);
|
|
91 |
}
|
|
92 |
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Upcall from the nif indicating that a new progress state has been reached on this connection
|
|
96 |
* @pre The stage value is within the range assigned to nifs i.e. KMinNifProgress <= aStage <= KMaxNifProgress
|
|
97 |
* @param aStage The progress stage that has been reached
|
|
98 |
* @param aError Any errors that have occurred
|
|
99 |
*/
|
|
100 |
void CSpudNotify::IfProgress(TInt aStage, TInt aError)
|
|
101 |
{
|
|
102 |
iBindMan.SpudMan()->IfProgress(iContextId, aStage, aError);
|
|
103 |
}
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Upcall from the nif indicating that a new progress state has been reached on this subconnection
|
|
107 |
* @pre The stage value is within the range assigned to nifs i.e. KMinNifProgress <= aStage <= KMaxNifProgress
|
|
108 |
* @param aSubConnectionUniqueId The subconnection to which this notification refers
|
|
109 |
* @param aStage The progress stage that has been reached
|
|
110 |
* @param aError Any errors that have occurred
|
|
111 |
*/
|
|
112 |
void CSpudNotify::IfProgress(TSubConnectionUniqueId aSubConnectionUniqueId, TInt aStage, TInt aError)
|
|
113 |
{
|
|
114 |
iBindMan.SpudMan()->IfProgress(iContextId, aSubConnectionUniqueId, aStage, aError);
|
|
115 |
}
|
|
116 |
|
|
117 |
/**
|
|
118 |
* Increment the count of users of this nif
|
|
119 |
*/
|
|
120 |
void CSpudNotify::OpenRoute()
|
|
121 |
{
|
|
122 |
// TODO: check that this reference counting is correct
|
|
123 |
iNotify->OpenRoute();
|
|
124 |
}
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Decrement the count of users of this nif
|
|
128 |
*/
|
|
129 |
void CSpudNotify::CloseRoute()
|
|
130 |
{
|
|
131 |
// TODO: check that this reference counting is correct
|
|
132 |
iNotify->CloseRoute();
|
|
133 |
}
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Notification of an event from the nif
|
|
137 |
* @param aEvent The type of event that occurred
|
|
138 |
* @param aInfo Any data associated with the event
|
|
139 |
* @return KErrNone if successful, otherwise one of the system-wide error codes
|
|
140 |
*/
|
|
141 |
TInt CSpudNotify::Notification(TNifToAgentEventType aEvent, void * aInfo)
|
|
142 |
{
|
|
143 |
return iBindMan.SpudMan()->Notification(iContextId, aEvent, aInfo);
|
|
144 |
}
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Notification from the nif that a binder layer has gone down
|
|
148 |
* @param aBinderIf An identifier for the binder layer that went down
|
|
149 |
* @param aReason The reason for the binder layer failure
|
|
150 |
* @param aAction The action to be taken as a result, eg. disconnect, reconnect
|
|
151 |
*/
|
|
152 |
void CSpudNotify::BinderLayerDown(CNifIfBase* aBinderIf, TInt aReason, TAction aAction)
|
|
153 |
{
|
|
154 |
iNotify->BinderLayerDown(aBinderIf, aReason, aAction);
|
|
155 |
}
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Indication from network layer that a packet has been transmitted or received
|
|
159 |
*
|
|
160 |
* @param aDirection Whether the packet was transmitted or received
|
|
161 |
* @param aBytes The size of the packet
|
|
162 |
* @param aResetTimer Whether the idle timer should be reset
|
|
163 |
* @return KErrNone if successful, otherwise one of the system-wide error codes
|
|
164 |
*/
|
|
165 |
TInt CSpudNotify::PacketActivity(TDataTransferDirection aDirection, TUint aBytes, TBool aResetTimer)
|
|
166 |
{
|
|
167 |
return iNotify->PacketActivity(aDirection, aBytes, aResetTimer);
|
|
168 |
}
|
|
169 |
|
|
170 |
/**
|
|
171 |
* Indication that the sent bytes threshold for a subconnection has been met or exceeded in the nif
|
|
172 |
*
|
|
173 |
* @param aSubConnectionUniqueId The subconnection to which this notification refers
|
|
174 |
* @param aUplinkVolume The total number of bytes sent by this subconnection
|
|
175 |
*/
|
|
176 |
void CSpudNotify::NotifyDataSent(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aUplinkVolume)
|
|
177 |
{
|
|
178 |
iNotify->NotifyDataSent(aSubConnectionUniqueId, aUplinkVolume);
|
|
179 |
}
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Indication that the received bytes threshold for a subconnection has been met or exceeded in the nif
|
|
183 |
*
|
|
184 |
* @param aSubConnectionUniqueId The subconnection to which this notification refers
|
|
185 |
* @param aDownlinkVolume The total number of bytes sent by this subconnection
|
|
186 |
*/
|
|
187 |
void CSpudNotify::NotifyDataReceived(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aDownlinkVolume)
|
|
188 |
{
|
|
189 |
iNotify->NotifyDataReceived(aSubConnectionUniqueId, aDownlinkVolume);
|
|
190 |
}
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Indication that some parameter relating to a subconnection has changed in the nif eg. subconnection closed, opened, QoS changed
|
|
194 |
*
|
|
195 |
* @param aEventType The type of event which has occurred - used to direct the event notification to the appropriate component(s)
|
|
196 |
* @param aEvent The event which has occurred
|
|
197 |
* @param aEventData Any arguments or additional data to do with the event; the interpretation of this depends on the event
|
|
198 |
* @param aSource An appropriate identifier of the source of the event - this will be used when one receiver is receiving events from many producers
|
|
199 |
*/
|
|
200 |
void CSpudNotify::NifEvent(TNetworkAdaptorEventType aEventType, TUint aEvent, const TDesC8& aEventData, TAny* aSource)
|
|
201 |
{
|
|
202 |
iNotify->NifEvent(aEventType, aEvent, aEventData, aSource);
|
|
203 |
}
|
|
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
/**
|
|
209 |
* Read an integer field from the connection settings provider
|
|
210 |
* @param aField The name of the field to read
|
|
211 |
* @param aValue On return, contains the value of the field read
|
|
212 |
* @param aMessage for capability checking
|
|
213 |
* @return KErrNone, if successful; otherwise one of the standard Symbian OS error codes
|
|
214 |
*/
|
|
215 |
TInt CSpudNotify::DoReadInt(const TDesC& aField, TUint32& aValue,const RMessagePtr2* aMessage)
|
|
216 |
{
|
|
217 |
//Spudman does eventually call iNotify->ReadInt but it does some necessary translations for some special cases therefore we
|
|
218 |
//need to defer to Spudman and cannot call iNotify->ReadInt ourselves
|
|
219 |
// The lower NIF will never have any capabilities to give us
|
|
220 |
__ASSERT_ALWAYS(aMessage == NULL, iBindMan.SpudMan()->Panic());
|
|
221 |
return iBindMan.SpudMan()->ReadInt(iContextId, aField, aValue);
|
|
222 |
}
|
|
223 |
|
|
224 |
/**
|
|
225 |
* Write an integer field to the connection settings provider
|
|
226 |
* @param aField The name of the field to which to write
|
|
227 |
* @param aValue The value to be written to the field
|
|
228 |
* @param aMessage for capability checking
|
|
229 |
* @return KErrNone, if successful; otherwise one of the standard Symbian OS error codes
|
|
230 |
*/
|
|
231 |
TInt CSpudNotify::DoWriteInt(const TDesC& aField, TUint32 aValue,const RMessagePtr2* aMessage)
|
|
232 |
{
|
|
233 |
return iNotify->WriteInt(aField, aValue, aMessage);
|
|
234 |
}
|
|
235 |
|
|
236 |
/**
|
|
237 |
* Read a 8-bit descriptor field from the connection settings provider
|
|
238 |
* @param aField The name of the field to read
|
|
239 |
* @param aValue On return, contains the value of the field read
|
|
240 |
* @param aMessage for capability checking
|
|
241 |
* @return KErrNone, if successful; otherwise one of the standard Symbian OS error codes
|
|
242 |
*/
|
|
243 |
TInt CSpudNotify::DoReadDes(const TDesC& aField, TDes8& aValue,const RMessagePtr2* aMessage)
|
|
244 |
{
|
|
245 |
//Spudman does eventually call iNotify->ReadDes but it does some necessary translations for some special cases therefore we
|
|
246 |
//need to defer to Spudman and cannot call iNotify->ReadDes ourselves
|
|
247 |
// The lower NIF will never have any capabilities to give us
|
|
248 |
__ASSERT_ALWAYS(aMessage == NULL, iBindMan.SpudMan()->Panic());
|
|
249 |
return iBindMan.SpudMan()->ReadDes(iContextId, aField, aValue);
|
|
250 |
}
|
|
251 |
|
|
252 |
/**
|
|
253 |
* Read a 16-bit descriptor field from the connection settings provider
|
|
254 |
* @param aField The name of the field to read
|
|
255 |
* @param aValue On return, contains the value of the field read
|
|
256 |
* @param aMessage for capability checking
|
|
257 |
* @return KErrNone, if successful; otherwise one of the standard Symbian OS error codes
|
|
258 |
*/
|
|
259 |
TInt CSpudNotify::DoReadDes(const TDesC& aField, TDes16& aValue,const RMessagePtr2* aMessage)
|
|
260 |
{
|
|
261 |
//Spudman does eventually call iNotify->ReadDes but it does some necessary translations for some special cases therefore we
|
|
262 |
//need to defer to Spudman and cannot call iNotify->ReadDes ourselves
|
|
263 |
// The lower NIF will never have any capabilities to give us
|
|
264 |
__ASSERT_ALWAYS(aMessage == NULL, iBindMan.SpudMan()->Panic());
|
|
265 |
return iBindMan.SpudMan()->ReadDes(iContextId, aField, aValue);
|
|
266 |
}
|
|
267 |
|
|
268 |
/**
|
|
269 |
* Write an 8-bit descriptor field to the connection settings provider
|
|
270 |
* @param aField The name of the field to which to write
|
|
271 |
* @param aValue The value to be written to the field
|
|
272 |
* @param aMessage for capability checking
|
|
273 |
* @return KErrNone, if successful; otherwise one of the standard Symbian OS error codes
|
|
274 |
*/
|
|
275 |
TInt CSpudNotify::DoWriteDes(const TDesC& aField, const TDesC8& aValue,const RMessagePtr2* aMessage)
|
|
276 |
{
|
|
277 |
return iNotify->WriteDes(aField, aValue, aMessage);
|
|
278 |
}
|
|
279 |
|
|
280 |
/**
|
|
281 |
* Write an 16-bit descriptor field to the connection settings provider
|
|
282 |
* @param aField The name of the field to which to write
|
|
283 |
* @param aValue The value to be written to the field
|
|
284 |
* @param aMessage for capability checking
|
|
285 |
* @return KErrNone, if successful; otherwise one of the standard Symbian OS error codes
|
|
286 |
*/
|
|
287 |
TInt CSpudNotify::DoWriteDes(const TDesC& aField, const TDesC16& aValue,const RMessagePtr2* aMessage)
|
|
288 |
{
|
|
289 |
return iNotify->WriteDes(aField, aValue, aMessage);
|
|
290 |
}
|
|
291 |
|
|
292 |
/**
|
|
293 |
* Read an boolean field from the connection settings provider
|
|
294 |
* @param aField The name of the field to read
|
|
295 |
* @param aValue On return, contains the value of the field read
|
|
296 |
* @param aMessage for capability checking
|
|
297 |
* @return KErrNone, if successful; otherwise one of the standard Symbian OS error codes
|
|
298 |
*/
|
|
299 |
TInt CSpudNotify::DoReadBool(const TDesC& aField, TBool& aValue,const RMessagePtr2* aMessage)
|
|
300 |
{
|
|
301 |
return iNotify->ReadBool(aField, aValue, aMessage);
|
|
302 |
}
|
|
303 |
|
|
304 |
/**
|
|
305 |
* Write an boolean field to the connection settings provider
|
|
306 |
* @param aField The name of the field to which to write
|
|
307 |
* @param aValue The value to be written to the field
|
|
308 |
* @param aMessage for capability checking
|
|
309 |
* @return KErrNone, if successful; otherwise one of the standard Symbian OS error codes
|
|
310 |
*/
|
|
311 |
TInt CSpudNotify::DoWriteBool(const TDesC& aField, TBool aValue,const RMessagePtr2* aMessage)
|
|
312 |
{
|
|
313 |
return iNotify->WriteBool(aField, aValue, aMessage);
|
|
314 |
}
|
|
315 |
|
|
316 |
|