|
1 // Copyright (c) 1997-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 // Netdial Agent Factory and Agent implementations |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file Nd_Agent.cpp |
|
20 */ |
|
21 |
|
22 #include "Nd_Agent.h" |
|
23 |
|
24 /** |
|
25 First ordinal export |
|
26 |
|
27 @internalComponent |
|
28 */ |
|
29 extern "C" EXPORT_C CNifAgentFactory* NewAgentFactoryL() |
|
30 { |
|
31 |
|
32 return new(ELeave) CNetdialAgentFactory; |
|
33 } |
|
34 |
|
35 // |
|
36 // Netdial Agent Factory functions |
|
37 // |
|
38 |
|
39 void CNetdialAgentFactory::InstallL() |
|
40 /** |
|
41 Performs any Agent initialisation |
|
42 Treat as ConstructL() |
|
43 */ |
|
44 {} |
|
45 |
|
46 CNifAgentBase* CNetdialAgentFactory::NewAgentL(const TDesC& /*aName*/) |
|
47 /** |
|
48 Creates a new Netdial Agent |
|
49 |
|
50 @param aName the name of the Agent to create |
|
51 */ |
|
52 { |
|
53 |
|
54 return CNetDialAgent::NewL(); |
|
55 } |
|
56 |
|
57 TInt CNetdialAgentFactory::Info(TNifAgentInfo& aInfo, TInt /*aIndex*/) const |
|
58 /** |
|
59 Retrieves information about this Agent |
|
60 */ |
|
61 { |
|
62 |
|
63 aInfo.iName = KNetdialAgentName; |
|
64 aInfo.iName.AppendFormat(_L("-AgentFactory[0x%08x]"), this); |
|
65 aInfo.iVersion = TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); |
|
66 |
|
67 return KErrNone; |
|
68 } |
|
69 |
|
70 |
|
71 |
|
72 // |
|
73 // Netdial Agent Implementation |
|
74 // |
|
75 |
|
76 |
|
77 CNetDialAgent::~CNetDialAgent() |
|
78 /** |
|
79 Destructor |
|
80 */ |
|
81 {} |
|
82 |
|
83 CNetDialAgent* CNetDialAgent::NewL() |
|
84 /** |
|
85 Static NewL function |
|
86 */ |
|
87 { |
|
88 CNetDialAgent* self = new (ELeave) CNetDialAgent(); |
|
89 CleanupStack::PushL(self); |
|
90 self->ConstructL(); |
|
91 CleanupStack::Pop(); // self |
|
92 return self; |
|
93 } |
|
94 |
|
95 void CNetDialAgent::ConstructL() |
|
96 /** |
|
97 2nd Phase Constructor |
|
98 */ |
|
99 { |
|
100 |
|
101 // Call base class constructor to create database and dialog processor |
|
102 CStateMachineAgentBase::ConstructL(); |
|
103 } |
|
104 |
|
105 CAgentSMBase* CNetDialAgent::CreateAgentSML(MAgentNotify& aObserver,CDialogProcessor* aDlgPrc, CCommsDbAccess& aDb, TCommDbConnectionDirection aDir) |
|
106 /** |
|
107 Creates CSD agent extension. |
|
108 |
|
109 @param aObserver a reference to state machine observer. |
|
110 @param aDlgPrc a pointer to dialog processor. |
|
111 @param aDb a referecen to CommDB accessor. |
|
112 @param aDir is direction of the connection. |
|
113 @exception Leaves if IsDefaultTelNumL() or NewL() leaves, or not enough memory is available. |
|
114 @exception Panics if connection direction is unknown. |
|
115 @return a new CDlUpAgXSM, CDirCtAgXSM or CDlInAgXSM object. |
|
116 */ |
|
117 { |
|
118 |
|
119 if (aDir==ECommDbConnectionDirectionOutgoing) |
|
120 { |
|
121 TBool dialUp=EFalse; |
|
122 |
|
123 CCommsDbNetDialAccess* db=CCommsDbNetDialAccess::NewL(&aDb); |
|
124 CleanupStack::PushL(db); |
|
125 db->IsDefaultTelNumL(dialUp); |
|
126 CleanupStack::PopAndDestroy(db); |
|
127 |
|
128 if (dialUp) |
|
129 { |
|
130 return CDlUpAgXSM::NewL(aObserver,aDlgPrc,aDb); |
|
131 } |
|
132 else |
|
133 { |
|
134 return CDirCtAgXSM::NewL(aObserver,aDlgPrc,aDb); |
|
135 } |
|
136 } |
|
137 else if (aDir==ECommDbConnectionDirectionIncoming) |
|
138 { |
|
139 return CDlInAgXSM::NewL(aObserver,aDlgPrc,aDb); |
|
140 } |
|
141 else |
|
142 { |
|
143 NetDialPanic(EUnknownCallDirection); |
|
144 return NULL; |
|
145 } |
|
146 } |
|
147 |
|
148 CNetDialAgent::CNetDialAgent() |
|
149 /** |
|
150 Default Constructor |
|
151 */ |
|
152 {} |
|
153 |
|
154 void CNetDialAgent::Info(TNifAgentInfo& aInfo) const |
|
155 /** |
|
156 Information about this Agent |
|
157 |
|
158 @param aInfo on return contains information about the agent |
|
159 */ |
|
160 { |
|
161 |
|
162 aInfo.iName = KNetdialAgentName; |
|
163 aInfo.iName.AppendFormat(_L("-Agent[0x%08x]"), this); |
|
164 aInfo.iVersion = TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); |
|
165 } |
|
166 |
|
167 void CNetDialAgent::MDPOLoginComplete(TInt /*aError*/) |
|
168 { |
|
169 } |
|
170 |
|
171 void CNetDialAgent::MDPOReadPctComplete(TInt /*aError*/) |
|
172 { |
|
173 } |
|
174 |
|
175 void CNetDialAgent::MDPODestroyPctComplete(TInt /*aError*/) |
|
176 { |
|
177 } |
|
178 |
|
179 void CNetDialAgent::MDPOQoSWarningComplete(TInt /*aError*/, TBool /*aResponse*/) |
|
180 { |
|
181 } |
|
182 |