24
|
1 |
// Copyright (c) 2003-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 |
// PSD Agent Factory and Agent implementations
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file PSDAGTBase.cpp
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "PSDAGTBase.h"
|
|
23 |
#include "debuglogger.h"
|
|
24 |
#include "psdagt.h"
|
|
25 |
|
|
26 |
/**
|
|
27 |
First ordinal export
|
|
28 |
|
|
29 |
@internalComponent
|
|
30 |
@return an object of class CPSDAgentFactory.
|
|
31 |
*/
|
|
32 |
extern "C" EXPORT_C CNifAgentFactory* NewAgentFactoryL()
|
|
33 |
{
|
|
34 |
|
|
35 |
return new(ELeave) CPSDAgentFactory;
|
|
36 |
}
|
|
37 |
|
|
38 |
void CPSDAgentFactory::InstallL()
|
|
39 |
/**
|
|
40 |
PSD Agent Factory functions
|
|
41 |
Perform any Agent initialisation
|
|
42 |
|
|
43 |
Treat as ConstructL()
|
|
44 |
*/
|
|
45 |
{}
|
|
46 |
|
|
47 |
CNifAgentBase* CPSDAgentFactory::NewAgentL(const TDesC& /*aName*/)
|
|
48 |
/**
|
|
49 |
Create a new PSD Agent
|
|
50 |
|
|
51 |
@param aName the name of the Agent to create
|
|
52 |
@return a newly created object of class CPSDAgent
|
|
53 |
*/
|
|
54 |
{
|
|
55 |
|
|
56 |
return CPSDAgent::NewL();
|
|
57 |
}
|
|
58 |
|
|
59 |
TInt CPSDAgentFactory::Info(TNifAgentInfo& aInfo, TInt /*aIndex*/) const
|
|
60 |
/**
|
|
61 |
Retrieve information about this Agent
|
|
62 |
|
|
63 |
@param aInfo, information about agent.
|
|
64 |
@return KErrNone if information retrieved successfully.
|
|
65 |
*/
|
|
66 |
{
|
|
67 |
|
|
68 |
aInfo.iName = KPSDAgentName;
|
|
69 |
aInfo.iName.AppendFormat(_L("-AgentFactory[0x%08x]"), this);
|
|
70 |
aInfo.iVersion = TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
|
|
71 |
|
|
72 |
return KErrNone;
|
|
73 |
}
|
|
74 |
|
|
75 |
|
|
76 |
// PSD Agent Implementation
|
|
77 |
|
|
78 |
CPSDAgent::~CPSDAgent()
|
|
79 |
/**
|
|
80 |
Destructor
|
|
81 |
*/
|
|
82 |
{
|
|
83 |
|
|
84 |
}
|
|
85 |
|
|
86 |
CPSDAgent* CPSDAgent::NewL()
|
|
87 |
/**
|
|
88 |
Static NewL function creating an object of CPSDAgent, pushing it to the clean up stack and popping it out.
|
|
89 |
|
|
90 |
@return a pointer to class CPSDAgent.
|
|
91 |
*/
|
|
92 |
{
|
|
93 |
CPSDAgent* self = new (ELeave) CPSDAgent();
|
|
94 |
CleanupStack::PushL(self);
|
|
95 |
self->ConstructL();
|
|
96 |
CleanupStack::Pop(); // self
|
|
97 |
return self;
|
|
98 |
}
|
|
99 |
|
|
100 |
void CPSDAgent::ConstructL()
|
|
101 |
/**
|
|
102 |
2nd Phase Construction
|
|
103 |
*/
|
|
104 |
{
|
|
105 |
|
|
106 |
// Call base class constructor to create database and dialog processor
|
|
107 |
CStateMachineAgentBase::ConstructL();
|
|
108 |
}
|
|
109 |
|
|
110 |
CAgentSMBase* CPSDAgent::CreateAgentSML(MAgentNotify& aObserver,CDialogProcessor* aDlgPrc, CCommsDbAccess& aDb, TCommDbConnectionDirection aDirection)
|
|
111 |
/**
|
|
112 |
Creates PSD agent extension.
|
|
113 |
|
|
114 |
@param aObserver a reference to state machine observer.
|
|
115 |
@param aDlgPrc a pointer to dialog processor.
|
|
116 |
@param aDb a referecen to CommDB accessor.
|
|
117 |
@param aDir is direction of the connection.
|
|
118 |
@return a new CPsdOutSM or CPsdInSM object.
|
|
119 |
@exception Leaves if NewL() leaves, or not enough memory is available.
|
|
120 |
@exception Panics if connection direction is unknown.
|
|
121 |
*/
|
|
122 |
{
|
|
123 |
__FLOG_STMT(_LIT8(logString1,"GPRS:\tCreating a new PSD state machine - %s");)
|
|
124 |
|
|
125 |
if (aDirection==ECommDbConnectionDirectionOutgoing)
|
|
126 |
{
|
|
127 |
__FLOG_STMT(const TText8 direction[] = "Outbound";)
|
|
128 |
__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),&direction);
|
|
129 |
return CPsdOutSM::NewL(aObserver,aDlgPrc,aDb);
|
|
130 |
}
|
|
131 |
else
|
|
132 |
{
|
|
133 |
#ifndef INCOMING_NOT_SUPORTED
|
|
134 |
__ASSERT_ALWAYS(aDirection==ECommDbConnectionDirectionIncoming, PanicAgx(EPsdBadDirection));
|
|
135 |
__FLOG_STMT(const TText8 direction[] = "Inbound";)
|
|
136 |
__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),&direction);
|
|
137 |
return CPsdInSM::NewL(aObserver,aDlgPrc,aDb);
|
|
138 |
#else
|
|
139 |
User::Leave(KErrNotSupported);
|
|
140 |
return NULL;
|
|
141 |
#endif
|
|
142 |
}
|
|
143 |
}
|
|
144 |
|
|
145 |
CPSDAgent::CPSDAgent()
|
|
146 |
/**
|
|
147 |
Default Constructor
|
|
148 |
*/
|
|
149 |
{}
|
|
150 |
|
|
151 |
void CPSDAgent::Info(TNifAgentInfo& aInfo) const
|
|
152 |
/**
|
|
153 |
Information about this Agent
|
|
154 |
|
|
155 |
@param aInfo on return contains information about the agent
|
|
156 |
*/
|
|
157 |
{
|
|
158 |
|
|
159 |
aInfo.iName = KPSDAgentName;
|
|
160 |
aInfo.iName.AppendFormat(_L("-Agent[0x%08x]"), this);
|
|
161 |
aInfo.iVersion = TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
|
|
162 |
}
|
|
163 |
|
|
164 |
void CPSDAgent::ConnectionComplete(TInt aError)
|
|
165 |
/**
|
|
166 |
Establish the connection with the agent.
|
|
167 |
Override previous definition to add mobile IP reconnection functionality
|
|
168 |
|
|
169 |
@param aError, error code if connection is not completed.
|
|
170 |
*/
|
|
171 |
{
|
|
172 |
CStateMachineAgentBase::ConnectionComplete(aError);
|
|
173 |
}
|
|
174 |
|
|
175 |
void CPSDAgent::Reconnect()
|
|
176 |
/**
|
|
177 |
Reconnecting to the agent if link is down.
|
|
178 |
Override previous definition to add mobile IP reconnection functionality
|
|
179 |
*/
|
|
180 |
{
|
|
181 |
|
|
182 |
}
|
|
183 |
|
|
184 |
void CPSDAgent::DisconnectComplete()
|
|
185 |
/**
|
|
186 |
It is called when Shutdown of packet switched connection using the values in the CommDB is complete.
|
|
187 |
*/
|
|
188 |
{
|
|
189 |
CStateMachineAgentBase::DisconnectComplete();
|
|
190 |
}
|
|
191 |
|
|
192 |
void CPSDAgent::MDPOLoginComplete(TInt /*aError*/)
|
|
193 |
/**
|
|
194 |
Log in complete.
|
|
195 |
|
|
196 |
@param aError, a error code for completition.
|
|
197 |
*/
|
|
198 |
{
|
|
199 |
}
|
|
200 |
|
|
201 |
void CPSDAgent::MDPOReadPctComplete(TInt /*aError*/)
|
|
202 |
/**
|
|
203 |
Packet read complete.
|
|
204 |
|
|
205 |
@param aError, a error code for completition.
|
|
206 |
*/
|
|
207 |
{
|
|
208 |
}
|
|
209 |
|
|
210 |
void CPSDAgent::MDPODestroyPctComplete(TInt /*aError*/)
|
|
211 |
/**
|
|
212 |
Packet destruction complete.
|
|
213 |
|
|
214 |
@param aError, a error code for completition.
|
|
215 |
*/
|
|
216 |
{
|
|
217 |
}
|
|
218 |
|
|
219 |
void CPSDAgent::MDPOQoSWarningComplete(TInt /*aError*/, TBool /*aResponse*/)
|
|
220 |
/**
|
|
221 |
Callback from the QoS warning dialog
|
|
222 |
|
|
223 |
@param aError indication if an error occured in the dialog
|
|
224 |
@param flag indicating the response from the dialog. ETrue means disconnect
|
|
225 |
*/
|
|
226 |
{
|
|
227 |
}
|
|
228 |
|
|
229 |
void CPSDAgent::AgentEvent(TNetworkAdaptorEventType aEventType, TUint aEvent, const TDesC8& aEventData, TAny* aSource)
|
|
230 |
{
|
|
231 |
iNotify->AgentEvent( aEventType, aEvent, aEventData, aSource);
|
|
232 |
}
|