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 |
// implementation of etel driver input
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalComponent
|
|
21 |
*/
|
|
22 |
|
|
23 |
#include <e32def.h>
|
|
24 |
#include <e32std.h>
|
|
25 |
|
|
26 |
#include "ceteldriverfactory.h"
|
|
27 |
#include "ceteldrivercontext.h"
|
|
28 |
#include "reteldriverinput.h"
|
|
29 |
#include "spudteldebuglogger.h"
|
|
30 |
|
|
31 |
using namespace EtelDriver;
|
|
32 |
|
|
33 |
REtelDriverInput::REtelDriverInput()
|
|
34 |
: iDriverFactory(NULL)
|
|
35 |
{
|
|
36 |
}
|
|
37 |
|
|
38 |
|
|
39 |
REtelDriverInput::~REtelDriverInput()
|
|
40 |
{
|
|
41 |
SPUDTEL_FNLOG("REtelDriverInput::~REtelDriverInput()");
|
|
42 |
|
|
43 |
if (iDriverFactory)
|
|
44 |
{
|
|
45 |
delete iDriverFactory;
|
|
46 |
}
|
|
47 |
}
|
|
48 |
|
|
49 |
|
|
50 |
/** requests to open etel driver
|
|
51 |
|
|
52 |
@param aPdpFsmInterface - reference to pdp FSM interface
|
|
53 |
*/
|
|
54 |
void REtelDriverInput::OpenL (CPdpFsmInterface& aPdpFsmInterface)
|
|
55 |
{
|
|
56 |
SPUDTEL_FNLOG("REtelDriverInput::OpenL()");
|
|
57 |
|
|
58 |
// internal check
|
|
59 |
iDriverFactory = CEtelDriverFactory::NewL(aPdpFsmInterface);
|
|
60 |
if (iDriverFactory)
|
|
61 |
{
|
|
62 |
iDriverFactory->InitL();
|
|
63 |
}
|
|
64 |
}
|
|
65 |
|
|
66 |
|
|
67 |
/** closes eTel driver and frees underlying resources
|
|
68 |
*/
|
|
69 |
void REtelDriverInput::Close()
|
|
70 |
{
|
|
71 |
SPUDTEL_FNLOG("REtelDriverInput::Close()");
|
|
72 |
|
|
73 |
// cancel all outstanding requests
|
|
74 |
if (iDriverFactory)
|
|
75 |
{
|
|
76 |
CancelAllPdps();
|
|
77 |
}
|
|
78 |
|
|
79 |
delete iDriverFactory;
|
|
80 |
iDriverFactory = NULL;
|
|
81 |
}
|
|
82 |
|
|
83 |
/** requests to create new pdp context
|
|
84 |
Note: this request will not open new primary or secondary context
|
|
85 |
But rather allocate necessary resources to do it.
|
|
86 |
Creation / deletion of eTel contexts should be done though Input method.
|
|
87 |
|
|
88 |
@param aPdpId - id of new pdp context
|
|
89 |
*/
|
|
90 |
void REtelDriverInput::CreatePdpL (TContextId aPdpId,SpudMan::TPdpContextType aContextType)
|
|
91 |
{
|
|
92 |
SPUDTEL_FNLOG("REtelDriverInput::CreatePdpL()");
|
|
93 |
SPUDTELVERBOSE_INFO_LOG1(_L("pdp id : %d"), aPdpId);
|
|
94 |
|
|
95 |
ASSERT(iDriverFactory);
|
|
96 |
iDriverFactory->CreatePdpL (aPdpId,aContextType );
|
|
97 |
}
|
|
98 |
|
|
99 |
/** deletes pdp context
|
|
100 |
|
|
101 |
@param aPdpId - id of a pdp context
|
|
102 |
*/
|
|
103 |
void REtelDriverInput::DeletePdp (TContextId aPdpId)
|
|
104 |
{
|
|
105 |
SPUDTEL_FNLOG("REtelDriverInput::DeletePdp()");
|
|
106 |
SPUDTELVERBOSE_INFO_LOG1(_L("pdp id : %d"), aPdpId);
|
|
107 |
|
|
108 |
if(iDriverFactory)
|
|
109 |
{
|
|
110 |
iDriverFactory->FreePdp(aPdpId);
|
|
111 |
}
|
|
112 |
}
|
|
113 |
|
|
114 |
/** requests to perform aOperation for aPdpId context
|
|
115 |
|
|
116 |
@param aPdpId - id of a pdp context
|
|
117 |
@param aOperation - etel driver operation
|
|
118 |
*/
|
|
119 |
void REtelDriverInput::Input(TContextId aPdpId, TEtelInput aOperation)
|
|
120 |
{
|
|
121 |
SPUDTEL_FNLOG("REtelDriverInput::Input()");
|
|
122 |
SPUDTEL_INFO_LOG2(_L("REtelDriverInput::Input: pdp id : %d, operation %d"), aPdpId, aOperation);
|
|
123 |
ASSERT(iDriverFactory);
|
|
124 |
|
|
125 |
iDriverFactory->Context(aPdpId).Input(aOperation);
|
|
126 |
}
|
|
127 |
|
|
128 |
/** cancels last operation for aPdpId context
|
|
129 |
|
|
130 |
@param aPdpId - id of a pdp context
|
|
131 |
*/
|
|
132 |
void REtelDriverInput::CancelPdp (TContextId aPdpId)
|
|
133 |
{
|
|
134 |
SPUDTEL_FNLOG("REtelDriverInput::CancelPdp()");
|
|
135 |
SPUDTEL_INFO_LOG1(_L("REtelDriverInput::CancelPdp: pdp id : %d"), aPdpId);
|
|
136 |
ASSERT(iDriverFactory);
|
|
137 |
|
|
138 |
iDriverFactory->Context(aPdpId).Cancel();
|
|
139 |
}
|
|
140 |
|
|
141 |
/** starts network notifications for aPdpId context
|
|
142 |
|
|
143 |
@param aPdpId - id of a pdp context
|
|
144 |
*/
|
|
145 |
void REtelDriverInput::StartPdpNotifications(TContextId aPdpId)
|
|
146 |
{
|
|
147 |
SPUDTEL_FNLOG("REtelDriverInput::StartPdpNotifications()");
|
|
148 |
ASSERT(iDriverFactory);
|
|
149 |
|
|
150 |
iDriverFactory->StartPdpNotifications(aPdpId);
|
|
151 |
}
|
|
152 |
|
|
153 |
/** cancels network notifications for aPdpId context
|
|
154 |
|
|
155 |
@param aPdpId - id of a pdp context
|
|
156 |
*/
|
|
157 |
void REtelDriverInput::CancelPdpNotifications (TContextId aPdpId)
|
|
158 |
{
|
|
159 |
SPUDTEL_FNLOG("REtelDriverInput::CancelPdpNotifications()");
|
|
160 |
SPUDTEL_INFO_LOG1(_L("REtelDriverInput::CancelPdpNotifications: pdp id : %d"), aPdpId);
|
|
161 |
ASSERT(iDriverFactory);
|
|
162 |
|
|
163 |
iDriverFactory->CancelPdpNotifications (aPdpId);
|
|
164 |
}
|
|
165 |
|
|
166 |
/** cancels last operations for all created pdp contexts */
|
|
167 |
void REtelDriverInput::CancelAllPdps ()
|
|
168 |
{
|
|
169 |
SPUDTEL_FNLOG("REtelDriverInput::CancelAllPdps()");
|
|
170 |
ASSERT(iDriverFactory);
|
|
171 |
|
|
172 |
for(TContextId i = 0; i < static_cast<TContextId>(iDriverFactory->ContextCount()); i++)
|
|
173 |
{
|
|
174 |
if (iDriverFactory->HasContext(i))
|
|
175 |
{
|
|
176 |
iDriverFactory->Context(i).Cancel();
|
|
177 |
}
|
|
178 |
}
|
|
179 |
}
|
|
180 |
|
|
181 |
/** cancels all notifications for all pdp contexts */
|
|
182 |
void REtelDriverInput::CancelAllPdpNotifications ()
|
|
183 |
{
|
|
184 |
SPUDTEL_FNLOG("REtelDriverInput::CancelAllPdpNotifications()");
|
|
185 |
ASSERT(iDriverFactory);
|
|
186 |
|
|
187 |
iDriverFactory->CancelAllPdpNotifications();
|
|
188 |
}
|
|
189 |
|
|
190 |
|