author | mikaruus |
Tue, 19 Oct 2010 13:16:20 +0300 | |
changeset 9 | 8486d82aef45 |
parent 5 | 8ccc39f9d787 |
permissions | -rw-r--r-- |
0 | 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 the License "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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
// INCLUDE FILES |
|
21 |
#include "dpdef.h" // dataport definitions |
|
22 |
#include <pipeisi.h> // isi pipe |
|
23 |
#include "pep_comm_types.h" // structures for isi-message interface |
|
24 |
||
25 |
#include "dpdataport.h" // dataport main and c32 interface |
|
26 |
#include "dpdataconfig.h" // configuration store |
|
27 |
#include "dppif.h" // dcs pipe interface |
|
28 |
#include "dpdatabuffer.h" // base class for rx and tx buffers |
|
29 |
#include "dpmif.h" // message interface mif |
|
30 |
#include "dplog.h" // dataport logging |
|
31 |
||
32 |
#include <pipe_sharedisi.h> |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
33 |
#include "OstTraceDefinitions.h" |
0 | 34 |
#ifdef OST_TRACE_COMPILER_IN_USE |
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
35 |
#include "dpdataconfigTraces.h" |
0 | 36 |
#endif |
37 |
||
38 |
||
39 |
// LOCAL FUNCTION PROTOTYPES |
|
40 |
// none |
|
41 |
||
42 |
// ==================== LOCAL FUNCTIONS ==================== |
|
43 |
// none |
|
44 |
||
45 |
// ================= MEMBER FUNCTIONS ======================= |
|
46 |
||
47 |
||
48 |
// ----------------------------------------------------------------------------- |
|
49 |
// DPDataConfig::NewL |
|
50 |
// Creates a new DPDataConfig object instance |
|
51 |
// ----------------------------------------------------------------------------- |
|
52 |
CDpDataConfig *CDpDataConfig::NewL( |
|
53 |
CDpDataPort& aDataPort ) |
|
54 |
{ |
|
55 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_NEWL, "CDpDataConfig::NewL" ); |
|
56 |
CDpDataConfig* self = new( ELeave ) CDpDataConfig( aDataPort ); |
|
57 |
||
58 |
CleanupStack::PushL( self ); |
|
59 |
self->ConstructL(); |
|
60 |
CleanupStack::Pop( self ); |
|
61 |
||
62 |
return self; |
|
63 |
} |
|
64 |
||
65 |
// ----------------------------------------------------------------------------- |
|
66 |
// DPDataConfig::ConstructL |
|
67 |
// Initialises object attributes |
|
68 |
// ----------------------------------------------------------------------------- |
|
69 |
void CDpDataConfig::ConstructL() |
|
70 |
{ |
|
71 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_CONSTRUCTL, "CDpDataConfig::ConstructL" ); |
|
72 |
// set role capabilities |
|
73 |
User::LeaveIfError( SetRoleCap( iRole ) ); |
|
74 |
} |
|
75 |
||
76 |
// ----------------------------------------------------------------------------- |
|
77 |
// CDpDataConfig::CDpDataConfig |
|
78 |
// C++ default constructor. |
|
79 |
// ----------------------------------------------------------------------------- |
|
80 |
CDpDataConfig::CDpDataConfig( |
|
81 |
CDpDataPort& aDataPort ) : |
|
82 |
iDataPort( aDataPort ) |
|
83 |
{ |
|
84 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_CDPDATACONFIG, "CDpDataConfig::CDpDataConfig" ); |
|
85 |
LOGM(" CDpDataConfig::CDpDataConfig"); |
|
86 |
||
87 |
iDataPort.GetRole( iRole ); |
|
88 |
iDteParityBitWhen7Mode = PEP_COMM_DATA_WITH_PARITY; |
|
89 |
||
90 |
// set default configuration |
|
91 |
iConfig.iRate = EBps9600; |
|
92 |
||
93 |
// default data format 8N1 |
|
94 |
iConfig.iDataBits = EData8; |
|
95 |
iConfig.iStopBits = EStop1; |
|
96 |
iConfig.iParity = EParityNone; |
|
97 |
||
98 |
// DTE defaults |
|
99 |
iConfig.iHandshake = KConfigObeyCTS; |
|
100 |
// Other options to handshake default: |
|
101 |
// KConfigObeyXoff |
|
102 |
// KConfigSendXoff |
|
103 |
// KConfigObeyCTS; |
|
104 |
// KConfigObeyDSR |
|
105 |
// KConfigObeyDCD |
|
106 |
// KConfigFreeRTS |
|
107 |
// KConfigFreeDTR |
|
108 |
||
109 |
// not really applicable |
|
110 |
iConfig.iFifo = EFifoEnable; |
|
111 |
||
112 |
// use no special rate |
|
113 |
iConfig.iSpecialRate = 0; |
|
114 |
||
115 |
// use no terminators |
|
116 |
iConfig.iTerminatorCount = 0; |
|
117 |
||
118 |
// set XON/XOFF characters into 'typical' values |
|
119 |
iConfig.iXonChar = KDcsDefaultXonChar; |
|
120 |
iConfig.iXoffChar = KDcsDefaultXoffChar; |
|
121 |
||
122 |
// ignore parity errors |
|
123 |
iConfig.iParityError = KConfigParityErrorIgnore; |
|
124 |
||
125 |
// ignoring parity errors |
|
126 |
iConfig.iParityErrorChar = 0; |
|
127 |
||
128 |
// we do no IR |
|
129 |
iConfig.iSIREnable = ESIRDisable; |
|
130 |
iConfig.iSIRSettings = 0; |
|
131 |
||
132 |
// flowcontrol extraction |
|
133 |
iFlowCtrlCharExtraction = ETrue; |
|
134 |
||
135 |
iSignals = 0; |
|
136 |
// signals are low, but signal changed bits are up |
|
137 |
// that is because otherwise we might miss clients first signal change, |
|
138 |
// case of signal change is up->low. |
|
139 |
||
140 |
// set capabilities |
|
141 |
// data rate |
|
142 |
iCapsV02.iRate = |
|
143 |
KCapsBps2400 | |
|
144 |
KCapsBps4800 | |
|
145 |
KCapsBps9600 | |
|
146 |
KCapsBps19200 | |
|
147 |
KCapsBps38400 | |
|
148 |
KCapsBps57600 | |
|
149 |
KCapsBps115200; |
|
150 |
//| KCapsBpsSpecial; // unsupported currently |
|
151 |
||
152 |
// data bits |
|
153 |
iCapsV02.iDataBits = KCapsData7 | KCapsData8; |
|
154 |
||
155 |
// stop bits |
|
156 |
iCapsV02.iStopBits = KCapsStop1 | KCapsStop2; |
|
157 |
||
158 |
// parity |
|
159 |
iCapsV02.iParity = |
|
160 |
KCapsParityNone | |
|
161 |
KCapsParityOdd | |
|
162 |
KCapsParityEven | |
|
163 |
KCapsParityMark | |
|
164 |
KCapsParitySpace; |
|
165 |
||
166 |
iCapsV02.iSignals = |
|
167 |
KCapsSignalDSRSupported | |
|
168 |
KCapsSignalDCDSupported | |
|
169 |
KCapsSignalDTRSupported | |
|
170 |
KCapsSignalRNGSupported; |
|
171 |
||
172 |
// not really applicable |
|
173 |
// KCapsHasFifo; |
|
174 |
iCapsV02.iFifo = 0; |
|
175 |
||
176 |
// no IR |
|
177 |
iCapsV02.iSIR = 0; |
|
178 |
||
179 |
// supported notifications |
|
180 |
iCapsV02.iNotificationCaps = |
|
181 |
KNotifySignalsChangeSupported | |
|
182 |
KNotifyRateChangeSupported | |
|
183 |
KNotifyDataFormatChangeSupported | |
|
184 |
KNotifyHandshakeChangeSupported | |
|
185 |
KNotifyBreakSupported | |
|
186 |
KNotifyFlowControlChangeSupported | |
|
187 |
KNotifyDataAvailableSupported | |
|
188 |
KNotifyOutputEmptySupported; |
|
189 |
||
190 |
iCapsV02.iRoleCaps = KCapsRoleSwitchSupported; |
|
191 |
||
192 |
// port supports retrieval of flow control status |
|
193 |
iCapsV02.iFlowControlCaps = KCapsFlowControlStatusSupported; |
|
194 |
||
195 |
// '+' |
|
196 |
iEscChar = KEscChar; |
|
197 |
// in 50 millisec note: previous comment was in 20 milliseconds |
|
198 |
iEscTime = KEscTime50millisec; |
|
199 |
} |
|
200 |
||
201 |
// ----------------------------------------------------------------------------- |
|
202 |
// CDpDataConfig::~CDpDataConfig |
|
203 |
// Destructor |
|
204 |
// ----------------------------------------------------------------------------- |
|
205 |
CDpDataConfig::~CDpDataConfig() |
|
206 |
{ |
|
207 |
OstTrace0( TRACE_NORMAL, DUP1_CDPDATACONFIG_CDPDATACONFIG, "CDpDataConfig::~CDpDataConfig" ); |
|
208 |
LOGM(" CDpDataConfig::~CDpDataConfig"); |
|
209 |
} |
|
210 |
||
211 |
// --------------------------------------------------------- |
|
212 |
// CDpDataConfig::SetRoleCap |
|
213 |
// Sets role Capabalities |
|
214 |
// --------------------------------------------------------- |
|
215 |
// |
|
216 |
TInt CDpDataConfig::SetRoleCap( |
|
217 |
TCommRole aRole ) |
|
218 |
{ |
|
219 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETROLECAP, "CDpDataConfig::SetRoleCap" ); |
|
220 |
TInt ret( KErrNone ); |
|
221 |
||
222 |
switch ( aRole ) |
|
223 |
{ |
|
224 |
case ECommRoleDTE: |
|
225 |
{ |
|
226 |
// we cope with both sw & hw flow control |
|
227 |
iCapsV02.iHandshake = |
|
228 |
KCapsObeyXoffSupported | |
|
229 |
KCapsSendXoffSupported | |
|
230 |
KCapsObeyCTSSupported | |
|
231 |
KCapsObeyDSRSupported | |
|
232 |
KCapsObeyDCDSupported | |
|
233 |
KCapsFreeDTRSupported | |
|
234 |
KCapsFailDCDSupported | |
|
235 |
KCapsFreeRTSSupported; |
|
236 |
break; |
|
237 |
} |
|
238 |
case ECommRoleDCE: |
|
239 |
{ |
|
240 |
// we cope with sw flow control and RTS DTR |
|
241 |
iCapsV02.iHandshake = |
|
242 |
KCapsObeyXoffSupported | |
|
243 |
KCapsSendXoffSupported | |
|
244 |
KCapsObeyCTSSupported | |
|
245 |
KCapsObeyDTRSupported | |
|
246 |
0x1000 | // KCapsObeyRTSSupported |
|
247 |
0x4000 | // KCapsFreeDSRSupported |
|
248 |
0x10000; // KCapsFreeDCDSupported |
|
249 |
break; |
|
250 |
} |
|
251 |
default: |
|
252 |
{ |
|
253 |
ret = KErrGeneral; |
|
254 |
break; |
|
255 |
} |
|
256 |
} |
|
257 |
||
258 |
return ret; |
|
259 |
} |
|
260 |
||
261 |
// --------------------------------------------------------- |
|
262 |
// CDpDataConfig::GetCommCaps |
|
263 |
// This method gets port capabilities in TCommCapsV01. |
|
264 |
// --------------------------------------------------------- |
|
265 |
// |
|
266 |
void CDpDataConfig::GetCommCaps( |
|
267 |
TCommCapsV01& aCommCaps ) const |
|
268 |
{ |
|
269 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_GETCOMMCAPS, "CDpDataConfig::GetCommCaps" ); |
|
270 |
LOGM(" CDpDataConfig::GetCommCaps"); |
|
271 |
||
272 |
aCommCaps.iRate = iCapsV02.iRate; |
|
273 |
aCommCaps.iDataBits = iCapsV02.iDataBits; |
|
274 |
aCommCaps.iStopBits = iCapsV02.iStopBits; |
|
275 |
aCommCaps.iParity = iCapsV02.iParity; |
|
276 |
aCommCaps.iHandshake = iCapsV02.iHandshake; |
|
277 |
aCommCaps.iSignals = iCapsV02.iSignals; |
|
278 |
aCommCaps.iFifo = iCapsV02.iFifo; |
|
279 |
aCommCaps.iSIR = iCapsV02.iSIR; |
|
280 |
} |
|
281 |
||
282 |
// --------------------------------------------------------- |
|
283 |
// CDpDataConfig::GetCommCapsV02 |
|
284 |
// This method gets port capabilities in TCommCapsV02. |
|
285 |
// --------------------------------------------------------- |
|
286 |
// |
|
287 |
void CDpDataConfig::GetCommCapsV02( |
|
288 |
TCommCapsV02& aCommCaps2 ) const |
|
289 |
{ |
|
290 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_GETCOMMCAPSV02, "CDpDataConfig::GetCommCapsV02" ); |
|
291 |
LOGM(" CDpDataConfig::GetCommCapsV02"); |
|
292 |
||
293 |
GetCommCaps( aCommCaps2 ); |
|
294 |
||
295 |
aCommCaps2.iNotificationCaps = iCapsV02.iNotificationCaps; |
|
296 |
aCommCaps2.iRoleCaps = iCapsV02.iRoleCaps; |
|
297 |
aCommCaps2.iFlowControlCaps = iCapsV02.iFlowControlCaps; |
|
298 |
} |
|
299 |
||
300 |
// --------------------------------------------------------- |
|
301 |
// CDpDataConfig::SetConfig |
|
302 |
// This method sets DTE interface port configuration |
|
303 |
// settings. |
|
304 |
// --------------------------------------------------------- |
|
305 |
// |
|
306 |
TInt CDpDataConfig::SetConfig( |
|
307 |
TCommConfigV01& aConfig ) |
|
308 |
{ |
|
309 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETCONFIG, "CDpDataConfig::SetConfig" ); |
|
310 |
LOGM(" CDpDataConfig::SetConfig"); |
|
311 |
||
312 |
TInt ret( KErrNone ); |
|
313 |
||
314 |
//Initialise these values to 0 |
|
315 |
TUint8 rate( 0 ); |
|
316 |
TUint8 dataBits( 0 ); |
|
317 |
TUint8 stopBits( 0 ); |
|
318 |
TUint8 parity( 0 ); |
|
319 |
TBool saveSettings ( EFalse ); |
|
320 |
||
321 |
// Check against supported values, NOTE: caps is a bitmask, |
|
322 |
// when config is enumerated. |
|
323 |
if ( !( iCapsV02.iRate & ( 1 << aConfig.iRate ) ) ) |
|
324 |
{ |
|
325 |
ret = KErrNotSupported; |
|
326 |
} |
|
327 |
else if ( !( iCapsV02.iDataBits & ( 1 << aConfig.iDataBits ) ) ) |
|
328 |
{ |
|
329 |
ret = KErrNotSupported; |
|
330 |
} |
|
331 |
else if ( !( iCapsV02.iStopBits & ( 1 << aConfig.iStopBits ) ) ) |
|
332 |
{ |
|
333 |
ret = KErrNotSupported; |
|
334 |
} |
|
335 |
else if ( !( iCapsV02.iParity & ( 1 << aConfig.iParity ) ) ) |
|
336 |
{ |
|
337 |
ret = KErrNotSupported; |
|
338 |
} |
|
339 |
else if ( ( ~iCapsV02.iHandshake & aConfig.iHandshake ) && |
|
340 |
( 0 != aConfig.iHandshake ) ) |
|
341 |
{ |
|
342 |
ret = KErrNotSupported; |
|
343 |
} |
|
344 |
else |
|
345 |
{ |
|
346 |
// We do not parity check, disable fifo, do special rate nor IR. |
|
347 |
if ( ( aConfig.iParityError != KConfigParityErrorIgnore ) || |
|
348 |
( aConfig.iFifo != EFifoEnable ) || |
|
349 |
aConfig.iSpecialRate || |
|
350 |
aConfig.iParityErrorChar || |
|
351 |
( aConfig.iSIREnable != ESIRDisable ) || |
|
352 |
aConfig.iSIRSettings ) |
|
353 |
{ |
|
354 |
LOG(" ERROR, SetConfig - KErrNotSupported"); |
|
355 |
OstTrace0( TRACE_NORMAL, DUP1_CDPDATACONFIG_SETCONFIG, "CDpDataConfig:: ERROR, SetConfig - KErrNotSupported" ); |
|
356 |
||
357 |
ret = KErrNotSupported; |
|
358 |
} |
|
359 |
else if ( KConfigMaxTerminators < aConfig.iTerminatorCount ) |
|
360 |
{ |
|
361 |
LOG(" ERROR, CDpDataConfig::SetConfig, KErrArgument"); |
|
362 |
OstTrace0( TRACE_NORMAL, DUP2_CDPDATACONFIG_SETCONFIG, "CDpDataConfig:: ERROR, SetConfig - KErrArgument" ); |
|
363 |
||
364 |
ret = KErrArgument; |
|
365 |
} |
|
366 |
// We care only databits, stopbits and parity changes. |
|
367 |
// We don't send message to CMT when only speed has changed. |
|
368 |
// CMT is not using speed setting at all. |
|
369 |
else if ( ( iConfig.iDataBits == aConfig.iDataBits ) && |
|
370 |
( iConfig.iStopBits == aConfig.iStopBits ) && |
|
371 |
( iConfig.iParity == aConfig.iParity ) ) |
|
372 |
{ |
|
373 |
// Save settings, to return same |
|
374 |
// settings when client is asking them. |
|
375 |
iConfig = aConfig; |
|
376 |
saveSettings = ETrue; |
|
377 |
} |
|
378 |
// Do parameter mapping. |
|
379 |
// check data rate |
|
380 |
else if ( KErrNone != Rate( aConfig, rate ) ) |
|
381 |
{ |
|
382 |
ret = Rate( aConfig, rate ); |
|
383 |
} |
|
384 |
// check data bits |
|
385 |
else if ( KErrNone != DataBits( aConfig, dataBits ) ) |
|
386 |
{ |
|
387 |
ret = DataBits( aConfig, dataBits ); |
|
388 |
} |
|
389 |
// check stop bits |
|
390 |
else if ( KErrNone != StopBits( aConfig, stopBits ) ) |
|
391 |
{ |
|
392 |
ret = StopBits( aConfig, stopBits ); |
|
393 |
} |
|
394 |
// check parity |
|
395 |
else if ( KErrNone != Parity( aConfig, parity ) ) |
|
396 |
{ |
|
397 |
ret = Parity( aConfig, parity ); |
|
398 |
} |
|
399 |
//no else |
|
400 |
||
401 |
if ( KErrNone == ret && !saveSettings ) |
|
402 |
{ |
|
403 |
// this is for if Client uses SetConfig before we have pipe up. |
|
404 |
if ( CDpPif::EDpPipeEnabled != iDataPort.Pif().PipeState() ) |
|
405 |
{ |
|
406 |
ret = KErrNotReady; |
|
407 |
} |
|
408 |
else |
|
409 |
{ |
|
410 |
// Create PNS_PEP_STATUS_IND : PEP_COMM_IND_ID_PARAM |
|
411 |
// (Indication data, PEP_COMM_CTRL_ID_PARAM_STR size = 4 bytes) |
|
412 |
TBuf8<SIZE_PNS_PEP_STATUS_IND + 4 > messageData; |
|
413 |
// Pipe Handle |
|
414 |
messageData.Append( iDataPort.Pif().PipeHandle() ); |
|
415 |
// PEP Type |
|
416 |
messageData.Append( PN_PEP_TYPE_COMM ); |
|
417 |
// Indication ID |
|
418 |
messageData.Append( PEP_COMM_IND_ID_PARAM ); |
|
419 |
// Filler bytes |
|
420 |
messageData.Append( KDpPadding ); |
|
421 |
messageData.Append( KDpPadding ); |
|
422 |
// Indication data (PEP_COMM_CTRL_ID_PARAM_STR) |
|
423 |
messageData.Append( dataBits ); |
|
424 |
messageData.Append( stopBits ); |
|
425 |
messageData.Append( rate ); |
|
426 |
messageData.Append( parity ); |
|
427 |
||
428 |
// Send messages |
|
429 |
TInt result = iDataPort.Mif().SendMessage( |
|
9 | 430 |
#ifdef PIPECAMP_DATAPORT_PNS_PEP_STATUS_IND_PHONET_ADDRESS_FROM_PNS_PEP_CTRL_REQ // 20100523_1300 |
431 |
iDataPort.Pif().GetPipeControllerDeviceIdentifier(), |
|
432 |
iDataPort.Pif().GetPipeControllerObjectIdentifier(), |
|
433 |
#endif |
|
0 | 434 |
PN_PIPE, |
435 |
iDataPort.CreateTransactionId(), |
|
436 |
PNS_PEP_STATUS_IND, |
|
437 |
messageData ); |
|
438 |
||
439 |
LOG(" <== PNS_PEP_STATUS_IND ind sent (PEP_COMM_IND_ID_PARAM)"); |
|
440 |
OstTrace0( TRACE_NORMAL, DUP3_CDPDATACONFIG_SETCONFIG, "CDpDataConfig:: <== PNS_PEP_STATUS_IND ind sent (PEP_COMM_IND_ID_PARAM)" ); |
|
441 |
||
442 |
#if defined(_DEBUG) |
|
443 |
if ( KErrNone != result ) |
|
444 |
{ |
|
445 |
LOG1("Error isc api send %d", result ); |
|
446 |
OstTrace1( TRACE_NORMAL, DUP4_CDPDATACONFIG_SETCONFIG, "CDpDataConfig:: Error isc api send %d", result ); |
|
447 |
} |
|
448 |
//no else |
|
449 |
#endif |
|
450 |
// accept new values |
|
451 |
iConfig = aConfig; |
|
452 |
} |
|
453 |
} |
|
454 |
//no else |
|
455 |
} |
|
456 |
||
457 |
return ret; |
|
458 |
} |
|
459 |
||
460 |
// --------------------------------------------------------- |
|
461 |
// CDpDataConfig::GetSignals |
|
462 |
// This method gets status of signals. |
|
463 |
//// On return, contains signals |
|
464 |
// --------------------------------------------------------- |
|
465 |
// |
|
466 |
void CDpDataConfig::GetSignals( |
|
467 |
TUint& aSignals ) |
|
468 |
{ |
|
469 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_GETSIGNALS, "CDpDataConfig::GetSignals" ); |
|
470 |
LOGM(" CDpDataConfig::GetSignals"); |
|
471 |
||
472 |
aSignals = iSignals; |
|
473 |
} |
|
474 |
||
475 |
// --------------------------------------------------------- |
|
476 |
// CDpDataConfig::SetSignals2Epoc |
|
477 |
// Signal cahnges from CMT. This method sets signal values. |
|
478 |
// --------------------------------------------------------- |
|
479 |
// |
|
480 |
TInt CDpDataConfig::SetSignals2Epoc( |
|
481 |
const TUint aSignals ) |
|
482 |
{ |
|
483 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETSIGNALS2EPOC, "CDpDataConfig::SetSignals2Epoc" ); |
|
484 |
LOGM(" CDpDataConfig::SetSignals2Epoc"); |
|
485 |
||
486 |
TCommRole role; |
|
487 |
TUint newSignals( 0 ); |
|
488 |
iDataPort.GetRole( role ); |
|
489 |
||
490 |
// accept new signals |
|
491 |
iSignals = aSignals; |
|
492 |
||
493 |
// signal change came from DCS |
|
494 |
||
495 |
if ( iSignalNotify ) |
|
496 |
{ |
|
497 |
newSignals = iSignals & ( |
|
498 |
iNotifySignalMask | iNotifySignalMask * KSignalChanged ); |
|
499 |
||
500 |
if ( ECommRoleDTE == role ) |
|
501 |
{ |
|
502 |
newSignals &= ( KSignalDTEInputs | KDTEDeltaInput ); |
|
503 |
} |
|
504 |
else |
|
505 |
{ |
|
506 |
newSignals &= ( KSignalDCEInputs | KDCEDeltaInput ); |
|
507 |
} |
|
508 |
||
509 |
// we should indicate client |
|
510 |
CompleteSignalChangeNotify( newSignals ); |
|
511 |
} |
|
512 |
//no else |
|
513 |
||
514 |
return KErrNone; |
|
515 |
} |
|
516 |
||
517 |
// --------------------------------------------------------- |
|
518 |
// CDpDataConfig::SetSignals2Cmt |
|
519 |
// Signal changes from the C32 client. |
|
520 |
// This method sends mapped signal values to CMT and sets |
|
521 |
// signal values. |
|
522 |
// --------------------------------------------------------- |
|
523 |
// |
|
524 |
TInt CDpDataConfig::SetSignals2Cmt( |
|
525 |
const TUint aSignals ) |
|
526 |
{ |
|
527 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETSIGNALS2CMT, "CDpDataConfig::SetSignals2Cmt" ); |
|
528 |
LOGM(" CDpDataConfig::SetSignals2Cmt"); |
|
529 |
||
530 |
TCommRole role; |
|
531 |
iDataPort.GetRole( role ); |
|
532 |
||
533 |
// signal change came from client |
|
534 |
||
535 |
TInt ret( MapSignalsEpoc2Cmt( aSignals, role ) ); |
|
536 |
||
537 |
if ( KErrNone == ret ) |
|
538 |
{ |
|
539 |
// accept new signals |
|
540 |
iSignals = aSignals; |
|
541 |
||
542 |
TUint newSignals( 0 ); |
|
543 |
||
544 |
if ( iSignalNotify ) |
|
545 |
{ |
|
546 |
newSignals = iSignals & ( |
|
547 |
iNotifySignalMask | iNotifySignalMask * KSignalChanged ); |
|
548 |
if ( ECommRoleDTE == role ) |
|
549 |
{ |
|
550 |
newSignals &= ( KSignalDCEInputs | KDCEDeltaInput ); |
|
551 |
} |
|
552 |
else |
|
553 |
{ |
|
554 |
newSignals &= ( KSignalDTEInputs | KDTEDeltaInput ); |
|
555 |
} |
|
556 |
||
557 |
// we should indicate client |
|
558 |
CompleteSignalChangeNotify( newSignals ); |
|
559 |
} |
|
560 |
//no else |
|
561 |
} |
|
562 |
//no else |
|
563 |
||
564 |
return ret; |
|
565 |
} |
|
566 |
||
567 |
// --------------------------------------------------------- |
|
568 |
// CDpDataConfig::SetSignalNotify |
|
569 |
// Activate/deactivate signal change notify. |
|
570 |
// --------------------------------------------------------- |
|
571 |
// |
|
572 |
void CDpDataConfig::SetSignalNotify( |
|
573 |
const TBool aEnableNotify ) |
|
574 |
{ |
|
575 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETSIGNALNOTIFY, "CDpDataConfig::SetSignalNotify" ); |
|
576 |
LOGM(" CDpDataConfig::SetSignalNotify"); |
|
577 |
||
578 |
iSignalNotify = aEnableNotify; |
|
579 |
||
580 |
// Forget signal changes |
|
581 |
iSignals &= ( KSignalDTEOutputs | KSignalDTEInputs ); |
|
582 |
} |
|
583 |
||
584 |
// --------------------------------------------------------- |
|
585 |
// CDpDataConfig::SetNotifySignalMask |
|
586 |
// Client sets a signal mask. i.e. Client can give a mask |
|
587 |
// and we only notify client when one of the signals given |
|
588 |
// in mask changes. |
|
589 |
// --------------------------------------------------------- |
|
590 |
// |
|
591 |
void CDpDataConfig::SetNotifySignalMask( |
|
592 |
const TUint aSignalMask ) |
|
593 |
{ |
|
594 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETNOTIFYSIGNALMASK, "CDpDataConfig::SetNotifySignalMask" ); |
|
595 |
LOGM(" CDpDataConfig::SetNotifySignalMask"); |
|
596 |
||
597 |
iNotifySignalMask = aSignalMask; |
|
598 |
} |
|
599 |
||
600 |
// --------------------------------------------------------- |
|
601 |
// CDpDataConfig::SetConfigNotify |
|
602 |
// Client is requesting to notify when configuration changes |
|
603 |
// --------------------------------------------------------- |
|
604 |
// |
|
605 |
void CDpDataConfig::SetConfigNotify( |
|
606 |
const TBool aEnableNotify ) |
|
607 |
{ |
|
608 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETCONFIGNOTIFY, "CDpDataConfig::SetConfigNotify" ); |
|
609 |
LOGM(" CDpDataConfig::SetConfigNotify"); |
|
610 |
||
611 |
iConfigNotify = aEnableNotify; |
|
612 |
} |
|
613 |
||
614 |
// --------------------------------------------------------- |
|
615 |
// CDpDataConfig::MapSignalsCmt2Epoc |
|
616 |
// This method map signals from CMT messages to C32 signals. |
|
617 |
// --------------------------------------------------------- |
|
618 |
// |
|
619 |
TInt CDpDataConfig::MapSignalsCmt2Epoc( |
|
620 |
TDesC8& aIndData ) |
|
621 |
{ |
|
622 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig::MapSignalsCmt2Epoc" ); |
|
623 |
LOGM(" CDpDataConfig::MapSignalsCmt2Epoc"); |
|
624 |
||
625 |
TUint signalsC32( iSignals ); |
|
626 |
TInt ret( KErrNone ); |
|
627 |
TBool noSignalChanged( EFalse ); |
|
628 |
||
629 |
PEP_COMM_IND_ID_V24_CHANGE_STR& pepParam = *( |
|
630 |
( PEP_COMM_IND_ID_V24_CHANGE_STR* ) aIndData.Ptr() ); |
|
631 |
||
632 |
// DTE inputs from CMT side |
|
633 |
if ( PEP_COMM_SIGNAL_RI_ON == pepParam.new_state ) |
|
634 |
{ |
|
635 |
LOG(" PEP_COMM_SIGNAL_RI_ON"); |
|
636 |
OstTrace0( TRACE_NORMAL, DUP1_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: PEP_COMM_SIGNAL_RI_ON" ); |
|
637 |
||
638 |
if ( ( signalsC32 & KSignalRNG ) != KSignalRNG ) |
|
639 |
{ |
|
640 |
signalsC32 |= KSignalRNG | KRNGChanged; |
|
641 |
} |
|
642 |
else |
|
643 |
{ |
|
644 |
// No signals has changed |
|
645 |
noSignalChanged = ETrue; |
|
646 |
} |
|
647 |
} |
|
648 |
else if ( PEP_COMM_SIGNAL_RI_OFF == pepParam.new_state ) |
|
649 |
{ |
|
650 |
LOG(" PEP_COMM_SIGNAL_RI_OFF"); |
|
651 |
OstTrace0( TRACE_NORMAL, DUP2_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: PEP_COMM_SIGNAL_RI_OFF" ); |
|
652 |
||
653 |
if ( ( signalsC32 & KSignalRNG ) == KSignalRNG ) |
|
654 |
{ |
|
655 |
signalsC32 &= ~KSignalRNG; |
|
656 |
signalsC32 |= KRNGChanged; |
|
657 |
} |
|
658 |
else |
|
659 |
{ |
|
660 |
// No signals has changed |
|
661 |
noSignalChanged = ETrue; |
|
662 |
} |
|
663 |
} |
|
664 |
else if ( PEP_COMM_SIGNAL_DCD_ON == pepParam.new_state ) |
|
665 |
{ |
|
666 |
LOG(" PEP_COMM_SIGNAL_DCD_ON"); |
|
667 |
OstTrace0( TRACE_NORMAL, DUP3_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: PEP_COMM_SIGNAL_DCD_ON" ); |
|
668 |
||
669 |
if ( ( signalsC32 & KSignalDCD ) != KSignalDCD ) |
|
670 |
{ |
|
671 |
LOG("DCD_ON"); |
|
672 |
OstTrace0( TRACE_NORMAL, DUP4_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: DCD_ON" ); |
|
673 |
||
674 |
signalsC32 |= KSignalDCD | KDCDChanged; |
|
675 |
} |
|
676 |
else |
|
677 |
{ |
|
678 |
// No signals has changed |
|
679 |
noSignalChanged = ETrue; |
|
680 |
} |
|
681 |
} |
|
682 |
else if ( PEP_COMM_SIGNAL_DCD_OFF == pepParam.new_state ) |
|
683 |
{ |
|
684 |
LOG(" PEP_COMM_SIGNAL_DCD_OFF"); |
|
685 |
OstTrace0( TRACE_NORMAL, DUP5_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: PEP_COMM_SIGNAL_DCD_OFF" ); |
|
686 |
||
687 |
if ( ( signalsC32 & KSignalDCD ) == KSignalDCD ) |
|
688 |
{ |
|
689 |
LOG("DCD_OFF"); |
|
690 |
OstTrace0( TRACE_NORMAL, DUP6_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: DCD_OFF" ); |
|
691 |
||
692 |
signalsC32 &= ~KSignalDCD; |
|
693 |
signalsC32 |= KDCDChanged; |
|
694 |
} |
|
695 |
else |
|
696 |
{ |
|
697 |
// No signals has changed |
|
698 |
noSignalChanged = ETrue; |
|
699 |
} |
|
700 |
} |
|
9 | 701 |
else if ( PEP_COMM_SIGNAL_DSR_ON == pepParam.new_state ) |
702 |
{ |
|
703 |
LOG(" PEP_COMM_SIGNAL_DSR_ON"); |
|
704 |
OstTrace0( TRACE_NORMAL, DUP7_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: PEP_COMM_SIGNAL_DSR_ON" ); |
|
705 |
||
706 |
if ( ( signalsC32 & KSignalDSR ) != KSignalDSR ) |
|
707 |
{ |
|
708 |
LOG("DSR_ON"); |
|
709 |
OstTrace0( TRACE_NORMAL, DUP8_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: DSR_ON" ); |
|
710 |
||
711 |
signalsC32 |= KSignalDSR | KDSRChanged; |
|
712 |
} |
|
713 |
else |
|
714 |
{ |
|
715 |
// No signals has changed |
|
716 |
noSignalChanged = ETrue; |
|
717 |
} |
|
718 |
} |
|
719 |
else if ( PEP_COMM_SIGNAL_DSR_OFF == pepParam.new_state ) |
|
720 |
{ |
|
721 |
LOG(" PEP_COMM_SIGNAL_DSR_OFF"); |
|
722 |
OstTrace0( TRACE_NORMAL, DUP9_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: PEP_COMM_SIGNAL_DSR_OFF" ); |
|
723 |
||
724 |
if ( ( signalsC32 & KSignalDSR ) == KSignalDSR ) |
|
725 |
{ |
|
726 |
LOG("DSR_OFF"); |
|
727 |
OstTrace0( TRACE_NORMAL, DUP10_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: DSR_OFF" ); |
|
728 |
||
729 |
signalsC32 &= ~KSignalDSR; |
|
730 |
signalsC32 |= KDSRChanged; |
|
731 |
} |
|
732 |
else |
|
733 |
{ |
|
734 |
// No signals has changed |
|
735 |
noSignalChanged = ETrue; |
|
736 |
} |
|
737 |
} |
|
0 | 738 |
else |
739 |
{ |
|
740 |
// No signals has changed |
|
741 |
noSignalChanged = ETrue; |
|
742 |
} |
|
743 |
||
744 |
if ( !noSignalChanged ) |
|
745 |
{ |
|
746 |
ret = SetSignals2Epoc( signalsC32 ); |
|
747 |
} |
|
748 |
//no else |
|
749 |
||
750 |
return ret; |
|
751 |
} |
|
752 |
||
753 |
// --------------------------------------------------------- |
|
754 |
// CDpDataConfig::MapSignalsEpoc2Cmt |
|
755 |
// Map signals to CMT and send signal change message. |
|
756 |
// --------------------------------------------------------- |
|
757 |
// |
|
758 |
TInt CDpDataConfig::MapSignalsEpoc2Cmt( |
|
759 |
const TUint aSignals, |
|
760 |
const TCommRole aRole ) |
|
761 |
{ |
|
762 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_MAPSIGNALSEPOC2CMT, "CDpDataConfig::MapSignalsEpoc2Cmt" ); |
|
763 |
LOGM(" CDpDataConfig::MapSignalsEpoc2Cmt"); |
|
764 |
||
765 |
TInt ret( KErrNone ); |
|
766 |
||
767 |
// PEP_COMM_IND_ID_V24_CHANGE_STR |
|
768 |
TBuf8<1> data; |
|
769 |
||
770 |
switch ( aRole ) |
|
771 |
{ |
|
772 |
case ECommRoleDTE: |
|
773 |
{ |
|
774 |
HandleDteSignalMapping( aSignals, data ); |
|
775 |
break; |
|
776 |
} |
|
777 |
case ECommRoleDCE: |
|
778 |
{ |
|
779 |
HandleDceSignalMapping( aSignals, data ); |
|
780 |
break; |
|
781 |
} |
|
782 |
default: |
|
783 |
{ |
|
784 |
LOG(" ERROR, CDpDataConfig::MapSignalsEpoc2Cmt, Unsupported role"); |
|
785 |
OstTrace0( TRACE_NORMAL, DUP1_CDPDATACONFIG_MAPSIGNALSEPOC2CMT, "ERROR, CDpDataConfig::MapSignalsEpoc2Cmt, Unsupported role" ); |
|
786 |
||
787 |
ret = KErrNotSupported; |
|
788 |
} |
|
789 |
} |
|
790 |
||
791 |
//if data = 0, do not send |
|
792 |
if ( ( 0 != data.Length() ) && ( KErrNone == ret ) ) |
|
793 |
{ |
|
794 |
// Create PNS_PEP_STATUS_IND |
|
795 |
TBuf8<SIZE_PNS_PEP_STATUS_IND> messageData; |
|
796 |
// Pipe Handle |
|
797 |
messageData.Append( iDataPort.Pif().PipeHandle() ); |
|
798 |
// PEP Type |
|
799 |
messageData.Append( PN_PEP_TYPE_COMM ); |
|
800 |
// Indication ID |
|
801 |
messageData.Append( PEP_COMM_IND_ID_V24_CHANGE ); |
|
802 |
// Filler bytes |
|
803 |
messageData.Append( KDpPadding ); |
|
804 |
messageData.Append( KDpPadding ); |
|
805 |
// Indication data |
|
806 |
messageData.Append( data ); |
|
807 |
||
808 |
// Send message |
|
809 |
#if defined(_DEBUG) |
|
810 |
TInt err = |
|
811 |
#endif |
|
812 |
iDataPort.Mif().SendMessage( |
|
813 |
PN_PIPE, |
|
814 |
iDataPort.CreateTransactionId(), |
|
815 |
PNS_PEP_STATUS_IND, |
|
816 |
messageData ); |
|
817 |
||
818 |
LOG(" <== PNS_PEP_STATUS_IND sent (PEP_COMM_IND_ID_V24_CHANGE)"); |
|
819 |
OstTrace0( TRACE_NORMAL, DUP2_CDPDATACONFIG_MAPSIGNALSEPOC2CMT, "CDpDataConfig:: <== PNS_PEP_STATUS_IND sent (PEP_COMM_IND_ID_V24_CHANGE)" ); |
|
820 |
||
821 |
#if defined(_DEBUG) |
|
822 |
if ( KErrNone != err ) |
|
823 |
{ |
|
824 |
LOG1("Error isc api send %d", err ); |
|
825 |
OstTrace1( TRACE_NORMAL, DUP3_CDPDATACONFIG_MAPSIGNALSEPOC2CMT, "CDpDataConfig:: Error isc api send %d", err ); |
|
826 |
} |
|
827 |
//no else |
|
828 |
#endif |
|
829 |
} |
|
830 |
//no else |
|
831 |
||
832 |
return ret; |
|
833 |
} |
|
834 |
||
835 |
// --------------------------------------------------------- |
|
836 |
// CDpDataConfig::CompleteSignalChangeNotify |
|
837 |
// This method completes signal change notify, if there are |
|
838 |
// new signals. New signals are already mapped with notify |
|
839 |
// mask. This method disables notifying after completion. |
|
840 |
// --------------------------------------------------------- |
|
841 |
// |
|
842 |
void CDpDataConfig::CompleteSignalChangeNotify( |
|
843 |
const TUint aNewSignals) |
|
844 |
{ |
|
845 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_COMPLETESIGNALCHANGENOTIFY, "CDpDataConfig::CompleteSignalChangeNotify" ); |
|
846 |
LOGM(" CDpDataConfig::CompleteSignalChangeNotify"); |
|
847 |
||
848 |
if ( aNewSignals ) |
|
849 |
{ |
|
850 |
iDataPort.SignalChangeCompleted( aNewSignals, KErrNone ); |
|
851 |
||
852 |
SetSignalNotify( EFalse ); |
|
853 |
} |
|
854 |
//no else |
|
855 |
||
856 |
// otherwise client is not interested in these signals |
|
857 |
} |
|
858 |
||
859 |
// --------------------------------------------------------- |
|
860 |
// CDpDataConfig::CompleteConfigChangeNotify |
|
861 |
// Check if client has 'ordered' config change notify and there |
|
862 |
// is something changed. Complete config change to client. |
|
863 |
// --------------------------------------------------------- |
|
864 |
// |
|
865 |
void CDpDataConfig::CompleteConfigChangeNotify() |
|
866 |
{ |
|
867 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_COMPLETECONFIGCHANGENOTIFY, "CDpDataConfig::CompleteConfigChangeNotify" ); |
|
868 |
LOGM(" CDpDataConfig::CompleteConfigChangeNotify"); |
|
869 |
||
870 |
if ( ( iConfigNotify ) && ( 0 < iPeerConfig.iChangedMembers ) ) |
|
871 |
{ |
|
872 |
TPckg<TCommNotificationV01> cfg( iPeerConfig ); |
|
873 |
iDataPort.ConfigChangeCompleted( cfg, KErrNone ); |
|
874 |
iConfigNotify = EFalse; |
|
875 |
iPeerConfig.iChangedMembers = 0; |
|
876 |
} |
|
877 |
//no else |
|
878 |
} |
|
879 |
||
880 |
// --------------------------------------------------------- |
|
881 |
// CDpDataConfig::SetFlowControlConfig |
|
882 |
// This method sets flow control configuration. This is |
|
883 |
// called from COMM PEP. |
|
884 |
// --------------------------------------------------------- |
|
885 |
// |
|
886 |
TInt CDpDataConfig::SetFlowControlConfig( |
|
887 |
const TUint8 aFlowCtrlInwards, |
|
888 |
const TUint8 aFlowCtrlOutwards, |
|
889 |
const TUint8 aExtract ) |
|
890 |
{ |
|
891 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETFLOWCONTROLCONFIG, "CDpDataConfig::SetFlowControlConfig" ); |
|
892 |
LOGM(" CDpDataConfig::SetFlowControlConfig"); |
|
893 |
||
894 |
TUint handshake( iConfig.iHandshake ); |
|
895 |
TInt ret( KErrNone ); |
|
896 |
TCommRole role; |
|
897 |
iDataPort.GetRole( role ); |
|
898 |
||
899 |
// clear peer configuration notify flags |
|
900 |
iPeerConfig.iChangedMembers = 0; |
|
901 |
||
902 |
// Inwards=DCS->DP data flow |
|
903 |
switch ( aFlowCtrlInwards ) |
|
904 |
{ |
|
905 |
case PEP_COMM_FLOW_CTRL_SW: |
|
906 |
{ |
|
907 |
if ( role == ECommRoleDTE ) |
|
908 |
{ |
|
909 |
handshake |= KConfigObeyXoff; |
|
910 |
handshake &= ~KConfigObeyDSR; |
|
911 |
handshake &= ~KConfigObeyDCD; |
|
912 |
handshake &= ~KConfigObeyCTS; |
|
913 |
} |
|
914 |
else |
|
915 |
{ |
|
916 |
handshake |= KConfigObeyXoff; |
|
917 |
handshake &= ~KConfigObeyDTR; |
|
918 |
handshake &= ~KConfigObeyRTS; |
|
919 |
} |
|
920 |
break; |
|
921 |
} |
|
922 |
case PEP_COMM_FLOW_CTRL_HW: |
|
923 |
{ |
|
924 |
if ( role == ECommRoleDTE ) |
|
925 |
{ |
|
926 |
handshake |= KConfigObeyCTS; |
|
927 |
handshake &= ~KConfigObeyDCD; |
|
928 |
handshake &= ~KConfigObeyDSR; |
|
929 |
handshake &= ~KConfigObeyXoff; |
|
930 |
} |
|
931 |
else |
|
932 |
{ |
|
933 |
handshake |= KConfigObeyRTS; |
|
934 |
handshake &= ~KConfigObeyXoff; |
|
935 |
handshake &= ~KConfigObeyDTR; |
|
936 |
} |
|
937 |
break; |
|
938 |
} |
|
939 |
case PEP_COMM_FLOW_CTRL_BOTH: |
|
940 |
{ |
|
941 |
if ( role == ECommRoleDTE ) |
|
942 |
{ |
|
943 |
handshake |= KConfigObeyXoff; |
|
944 |
handshake |= KConfigObeyCTS; |
|
945 |
handshake &= ~KConfigObeyDCD; |
|
946 |
handshake &= ~KConfigObeyDSR; |
|
947 |
} |
|
948 |
else |
|
949 |
{ |
|
950 |
handshake |= KConfigObeyXoff; |
|
951 |
handshake |= KConfigObeyRTS; |
|
952 |
handshake &= ~KConfigObeyDTR; |
|
953 |
} |
|
954 |
break; |
|
955 |
} |
|
956 |
case PEP_COMM_FLOW_CTRL_NONE: |
|
957 |
{ |
|
958 |
if ( role == ECommRoleDTE ) |
|
959 |
{ |
|
960 |
handshake &= ~KConfigObeyXoff; |
|
961 |
handshake &= ~KConfigObeyCTS; |
|
962 |
handshake &= ~KConfigObeyDCD; |
|
963 |
handshake &= ~KConfigObeyDSR; |
|
964 |
} |
|
965 |
else |
|
966 |
{ |
|
967 |
handshake &= ~KConfigObeyXoff; |
|
968 |
handshake &= ~KConfigObeyRTS; |
|
969 |
handshake &= ~KConfigObeyDTR; |
|
970 |
} |
|
971 |
break; |
|
972 |
} |
|
973 |
default: |
|
974 |
{ |
|
975 |
LOG1(" ERROR, CDpDataConfig::SetFlowControlConfig, Unsupported flowCtrl status: %d", |
|
976 |
aFlowCtrlInwards ); |
|
977 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPDATACONFIG_SETFLOWCONTROLCONFIG, "CDpDataConfig:: ERROR, CDpDataConfig::SetFlowControlConfig, Unsupported flowCtrl status: %hhu", aFlowCtrlInwards ); |
|
978 |
||
979 |
ret = KErrNotSupported; |
|
980 |
} |
|
981 |
} |
|
982 |
||
983 |
if ( KErrNone == ret ) |
|
984 |
{ |
|
985 |
// Outwards=DP->DCS data flow |
|
986 |
switch ( aFlowCtrlOutwards ) |
|
987 |
{ |
|
988 |
case PEP_COMM_FLOW_CTRL_SW: |
|
989 |
{ |
|
990 |
if ( role == ECommRoleDTE ) |
|
991 |
{ |
|
992 |
handshake |= KConfigSendXoff; |
|
993 |
handshake |= KConfigFreeDTR; |
|
994 |
handshake |= KConfigFreeRTS; |
|
995 |
} |
|
996 |
else |
|
997 |
{ |
|
998 |
handshake |= KConfigSendXoff; |
|
999 |
handshake |= KConfigFreeDSR; |
|
1000 |
handshake |= KConfigFreeDCD; |
|
1001 |
} |
|
1002 |
break; |
|
1003 |
} |
|
1004 |
case PEP_COMM_FLOW_CTRL_HW: |
|
1005 |
{ |
|
1006 |
if ( role == ECommRoleDTE ) |
|
1007 |
{ |
|
1008 |
handshake &= ~KConfigFreeRTS; |
|
1009 |
handshake |= KConfigFreeDTR; |
|
1010 |
handshake &= ~KConfigSendXoff; |
|
1011 |
} |
|
1012 |
else |
|
1013 |
{ |
|
1014 |
handshake |= KConfigFreeDCD; |
|
1015 |
handshake |= KConfigFreeDSR; |
|
1016 |
handshake &= ~KConfigSendXoff; |
|
1017 |
} |
|
1018 |
break; |
|
1019 |
} |
|
1020 |
case PEP_COMM_FLOW_CTRL_BOTH: |
|
1021 |
{ |
|
1022 |
if ( role == ECommRoleDTE ) |
|
1023 |
{ |
|
1024 |
handshake |= KConfigSendXoff; |
|
1025 |
handshake &= ~KConfigFreeRTS; |
|
1026 |
handshake |= KConfigFreeDTR; |
|
1027 |
} |
|
1028 |
else |
|
1029 |
{ |
|
1030 |
handshake |= KConfigSendXoff; |
|
1031 |
handshake |= KConfigFreeDCD; |
|
1032 |
handshake |= KConfigFreeDSR; |
|
1033 |
} |
|
1034 |
break; |
|
1035 |
} |
|
1036 |
case PEP_COMM_FLOW_CTRL_NONE: |
|
1037 |
{ |
|
1038 |
if ( role == ECommRoleDTE ) |
|
1039 |
{ |
|
1040 |
handshake &= ~KConfigSendXoff; |
|
1041 |
handshake |= KConfigFreeRTS; |
|
1042 |
handshake |= KConfigFreeDTR; |
|
1043 |
} |
|
1044 |
else |
|
1045 |
{ |
|
1046 |
handshake &= ~KConfigSendXoff; |
|
1047 |
handshake |= KConfigFreeDSR; |
|
1048 |
handshake |= KConfigFreeDCD; |
|
1049 |
} |
|
1050 |
break; |
|
1051 |
} |
|
1052 |
default: |
|
1053 |
{ |
|
1054 |
LOG1(" ERROR, CDpDataConfig::SetFlowControlConfig, Unsupported flowCtrl status: %d", |
|
1055 |
aFlowCtrlInwards ); |
|
1056 |
OstTraceExt1( TRACE_NORMAL, DUP2_CDPDATACONFIG_SETFLOWCONTROLCONFIG, "ERROR, CDpDataConfig::SetFlowControlConfig, Unsupported flowCtrl status: %hhu", aFlowCtrlInwards ); |
|
1057 |
||
1058 |
ret = KErrNotSupported; |
|
1059 |
} |
|
1060 |
} |
|
1061 |
||
1062 |
if ( KErrNone == ret ) |
|
1063 |
{ |
|
1064 |
// set flow control char extraction |
|
1065 |
switch ( aExtract ) |
|
1066 |
{ |
|
1067 |
case PEP_COMM_FLOW_CTRL_EXTRACT: |
|
1068 |
{ |
|
1069 |
iFlowCtrlCharExtraction = ETrue; |
|
1070 |
break; |
|
1071 |
} |
|
1072 |
case PEP_COMM_FLOW_CTRL_NO_EXTRACT: |
|
1073 |
{ |
|
1074 |
iFlowCtrlCharExtraction = EFalse; |
|
1075 |
break; |
|
1076 |
} |
|
1077 |
default: |
|
1078 |
{ |
|
1079 |
LOG1(" ERROR unsupported extract status: %d", aExtract ); |
|
1080 |
OstTraceExt1( TRACE_NORMAL, DUP3_CDPDATACONFIG_SETFLOWCONTROLCONFIG, "CDpDataConfig:: ERROR unsupported extract status: %hhu", aExtract ); |
|
1081 |
||
1082 |
ret = KErrNotSupported; |
|
1083 |
} |
|
1084 |
} |
|
1085 |
||
1086 |
if ( KErrNone == ret ) |
|
1087 |
{ |
|
1088 |
if ( iPeerConfig.iHandshake != handshake ) |
|
1089 |
{ |
|
1090 |
// turn change flags on |
|
1091 |
iPeerConfig.iChangedMembers |= KHandshakeChanged; |
|
1092 |
||
1093 |
iPeerConfig.iHandshake = handshake; |
|
1094 |
iConfig.iHandshake = iPeerConfig.iHandshake; |
|
1095 |
||
1096 |
// we should indicate client |
|
1097 |
CompleteConfigChangeNotify(); |
|
1098 |
} |
|
1099 |
//no else |
|
1100 |
} |
|
1101 |
//no else |
|
1102 |
} |
|
1103 |
//no else |
|
1104 |
} |
|
1105 |
//no else |
|
1106 |
||
1107 |
return ret; |
|
1108 |
} |
|
1109 |
||
1110 |
// --------------------------------------------------------- |
|
1111 |
// CDpDataConfig::SetEchoDte |
|
1112 |
// This method sets DTE interface echo mode. This method is |
|
1113 |
// called from COMM PEP. |
|
1114 |
// --------------------------------------------------------- |
|
1115 |
// |
|
1116 |
TInt CDpDataConfig::SetEchoDte( |
|
1117 |
const TUint8 aEcho) |
|
1118 |
{ |
|
1119 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETECHODTE, "CDpDataConfig::SetEchoDte" ); |
|
1120 |
LOGM1(" CDpDataConfig::SetEchoDte, aEcho: %d", aEcho ); |
|
1121 |
||
1122 |
TInt ret( KErrNone ); |
|
1123 |
||
1124 |
switch ( aEcho ) |
|
1125 |
{ |
|
1126 |
case PEP_COMM_ECHO_ON: |
|
1127 |
{ |
|
1128 |
iEchoDte = ETrue; |
|
1129 |
break; |
|
1130 |
} |
|
1131 |
case PEP_COMM_ECHO_OFF: |
|
1132 |
{ |
|
1133 |
iEchoDte = EFalse; |
|
1134 |
break; |
|
1135 |
} |
|
1136 |
default: |
|
1137 |
{ |
|
1138 |
LOG1(" ERROR, CDpDataConfig::SetEchoDte, Not supported echo value %d", |
|
1139 |
aEcho ); |
|
1140 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPDATACONFIG_SETECHODTE, "ERROR, CDpDataConfig::SetEchoDte, Not supported echo value %hhu", aEcho ); |
|
1141 |
||
1142 |
ret = KErrNotSupported; |
|
1143 |
} |
|
1144 |
} |
|
1145 |
||
1146 |
return ret; |
|
1147 |
} |
|
1148 |
||
1149 |
// --------------------------------------------------------- |
|
1150 |
// CDpDataConfig::WaterMarkHighSize |
|
1151 |
// Size of xx% of buffer size (typically 75% or 50% of buffer |
|
1152 |
// size) e.g. if buffer size is 1024 and '%' is 50% returns |
|
1153 |
// 512. |
|
1154 |
// --------------------------------------------------------- |
|
1155 |
// |
|
1156 |
TInt CDpDataConfig::WaterMarkHighSize( |
|
1157 |
CDpDataBuffer& aBuffer ) |
|
1158 |
{ |
|
1159 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_WATERMARKHIGHSIZE, "CDpDataConfig::WaterMarkHighSize" ); |
|
1160 |
LOGM(" CDpDataConfig::WaterMarkHighSize"); |
|
1161 |
||
1162 |
return ( ( aBuffer.Size() * KDpFlowCtrlWaterMarkHighProsOfBuff ) / 100 ); |
|
1163 |
} |
|
1164 |
||
1165 |
// --------------------------------------------------------- |
|
1166 |
// CDpDataConfig::WaterMarkLowSize |
|
1167 |
// Size of x% of buffer size (typically 25% of buffer size). |
|
1168 |
// --------------------------------------------------------- |
|
1169 |
// |
|
1170 |
TInt CDpDataConfig::WaterMarkLowSize( |
|
1171 |
CDpDataBuffer& aBuffer ) |
|
1172 |
{ |
|
1173 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_WATERMARKLOWSIZE, "CDpDataConfig::WaterMarkLowSize" ); |
|
1174 |
LOGM(" CDpDataConfig::WaterMarkLowSize"); |
|
1175 |
||
1176 |
return ( ( aBuffer.Size() * KDpFlowCtrlWaterMarkLowProsOfBuff ) / 100 ); |
|
1177 |
} |
|
1178 |
||
1179 |
// --------------------------------------------------------- |
|
1180 |
// CDpDataConfig::IsLineFail |
|
1181 |
// True if there is line fail. i.e. Client has configured |
|
1182 |
// some signal example CTS --> KConfigFailCTS. Now when CTS |
|
1183 |
// goes down it is a line fail. |
|
1184 |
// --------------------------------------------------------- |
|
1185 |
// |
|
1186 |
TBool CDpDataConfig::IsLineFail( |
|
1187 |
TCommRole aRole ) const |
|
1188 |
{ |
|
1189 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_ISLINEFAIL, "CDpDataConfig::IsLineFail" ); |
|
1190 |
LOGM(" CDpDataConfig::IsLineFail"); |
|
1191 |
||
1192 |
TBool ret( EFalse ); |
|
1193 |
||
1194 |
if ( ECommRoleDTE == aRole ) |
|
1195 |
{ |
|
1196 |
if ( ( !( iSignals & KSignalDSR ) && |
|
1197 |
( iConfig.iHandshake & KConfigFailDSR ) ) || |
|
1198 |
( !( iSignals & KSignalDCD ) && |
|
1199 |
( iConfig.iHandshake & KConfigFailDCD ) ) ) |
|
1200 |
{ |
|
1201 |
ret = ETrue; |
|
1202 |
} |
|
1203 |
//no else |
|
1204 |
} |
|
1205 |
else |
|
1206 |
{ |
|
1207 |
if ( ( !( iSignals & KSignalRTS ) && |
|
1208 |
( iConfig.iHandshake & KConfigFailRTS ) ) || |
|
1209 |
( !( iSignals & KSignalDTR ) && |
|
1210 |
( iConfig.iHandshake & KConfigFailDTR ) ) ) |
|
1211 |
{ |
|
1212 |
ret = ETrue; |
|
1213 |
} |
|
1214 |
//no else |
|
1215 |
} |
|
1216 |
||
1217 |
return ret; |
|
1218 |
} |
|
1219 |
||
1220 |
// --------------------------------------------------------- |
|
1221 |
// CDpDataConfig::Terminator |
|
1222 |
// This method gets DTE interface terminator character. |
|
1223 |
// --------------------------------------------------------- |
|
1224 |
// |
|
1225 |
TText8 CDpDataConfig::Terminator( |
|
1226 |
const TUint aIndex ) |
|
1227 |
{ |
|
1228 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_TERMINATOR, "CDpDataConfig::Terminator" ); |
|
1229 |
LOGM(" CDpDataConfig::Terminator"); |
|
1230 |
||
1231 |
return iConfig.iTerminator[aIndex]; |
|
1232 |
} |
|
1233 |
||
1234 |
// --------------------------------------------------------- |
|
1235 |
// CDpDataConfig::Rate |
|
1236 |
// Solves out the bit rate |
|
1237 |
// --------------------------------------------------------- |
|
1238 |
// |
|
1239 |
TInt CDpDataConfig::Rate( |
|
1240 |
TCommConfigV01& aConfig, |
|
1241 |
TUint8& aRate) |
|
1242 |
{ |
|
1243 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_RATE, "CDpDataConfig::Rate" ); |
|
1244 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPDATACONFIG_RATE, "CDpDataConfig::Rate, Config rate: %hhu", aRate ); |
|
1245 |
||
1246 |
LOGM1(" CDpDataConfig::Rate, Config rate: %d.", aRate ); |
|
1247 |
||
1248 |
TInt ret( KErrNone ); |
|
1249 |
||
1250 |
switch ( aConfig.iRate ) |
|
1251 |
{ |
|
1252 |
case EBps2400: |
|
1253 |
{ |
|
1254 |
aRate = EPEP_COMM_RATE_2400; |
|
1255 |
break; |
|
1256 |
} |
|
1257 |
case EBps4800: |
|
1258 |
{ |
|
1259 |
aRate = EPEP_COMM_RATE_4800; |
|
1260 |
break; |
|
1261 |
} |
|
1262 |
case EBps9600: |
|
1263 |
{ |
|
1264 |
aRate = EPEP_COMM_RATE_9600; |
|
1265 |
break; |
|
1266 |
} |
|
1267 |
case EBps19200: |
|
1268 |
{ |
|
1269 |
aRate = EPEP_COMM_RATE_19200; |
|
1270 |
break; |
|
1271 |
} |
|
1272 |
case EBps38400: |
|
1273 |
{ |
|
1274 |
aRate = EPEP_COMM_RATE_38400; |
|
1275 |
break; |
|
1276 |
} |
|
1277 |
case EBps57600: |
|
1278 |
{ |
|
1279 |
aRate = EPEP_COMM_RATE_57600; |
|
1280 |
break; |
|
1281 |
} |
|
1282 |
case EBps115200: |
|
1283 |
{ |
|
1284 |
aRate = EPEP_COMM_RATE_115200; |
|
1285 |
break; |
|
1286 |
} |
|
1287 |
default: |
|
1288 |
{ |
|
1289 |
LOG1(" ERROR, CDpDataConfig::Rate, Unsupported rate value: %d.", |
|
1290 |
aRate ); |
|
1291 |
OstTraceExt1( TRACE_NORMAL, DUP2_CDPDATACONFIG_RATE, "CDpDataConfig:: ERROR, Unsupported rate value:%hhu", aRate ); |
|
1292 |
||
1293 |
ret = KErrNotSupported; |
|
1294 |
} |
|
1295 |
} |
|
1296 |
||
1297 |
return ret; |
|
1298 |
} |
|
1299 |
||
1300 |
// --------------------------------------------------------- |
|
1301 |
// CDpDataConfig::DataBits |
|
1302 |
// Solves out data bits. |
|
1303 |
// --------------------------------------------------------- |
|
1304 |
// |
|
1305 |
TInt CDpDataConfig::DataBits( |
|
1306 |
TCommConfigV01& aConfig, |
|
1307 |
TUint8& aDataBits) |
|
1308 |
{ |
|
1309 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_DATABITS, "CDpDataConfig::DataBits" ); |
|
1310 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPDATACONFIG_DATABITS, "CDpDataConfig::DataBits: %hhu in DataConfig::DataBits", aDataBits ); |
|
1311 |
||
1312 |
LOGM(" CDpDataConfig::DataBits"); |
|
1313 |
LOGM1(" DataBits: %d in DataConfig::DataBits.", aDataBits ); |
|
1314 |
||
1315 |
TInt ret( KErrNone ); |
|
1316 |
||
1317 |
switch ( aConfig.iDataBits ) |
|
1318 |
{ |
|
1319 |
case EData7: |
|
1320 |
{ |
|
1321 |
aDataBits = PEP_COMM_DATA_BITS_7; |
|
1322 |
break; |
|
1323 |
} |
|
1324 |
case EData8: |
|
1325 |
{ |
|
1326 |
aDataBits = PEP_COMM_DATA_BITS_8; |
|
1327 |
break; |
|
1328 |
} |
|
1329 |
default: |
|
1330 |
{ |
|
1331 |
LOG1(" ERROR, CDpDataConfig::DataBits, Unsupported DataBits: %d.", |
|
1332 |
aDataBits); |
|
1333 |
OstTraceExt1( TRACE_NORMAL, DUP2_CDPDATACONFIG_DATABITS, "CDpDataConfig:: ERROR, Unsupported DataBits: %hhu", aDataBits ); |
|
1334 |
||
1335 |
ret =KErrNotSupported; |
|
1336 |
} |
|
1337 |
} |
|
1338 |
||
1339 |
return ret; |
|
1340 |
} |
|
1341 |
||
1342 |
// --------------------------------------------------------- |
|
1343 |
// CDpDataConfig::StopBits |
|
1344 |
// Solves out the stop bits |
|
1345 |
// --------------------------------------------------------- |
|
1346 |
// |
|
1347 |
TInt CDpDataConfig::StopBits( |
|
1348 |
TCommConfigV01& aConfig, |
|
1349 |
TUint8& aStopBits) |
|
1350 |
{ |
|
1351 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_STOPBITS, "CDpDataConfig::StopBits" ); |
|
1352 |
OstTraceExt1( TRACE_NORMAL, DUP2_CDPDATACONFIG_STOPBITS, "CDpDataConfig::StopBits: %hhu", aStopBits ); |
|
1353 |
||
1354 |
LOGM1(" CDpDataConfig::StopBits, StopBits: %d.", aStopBits ); |
|
1355 |
||
1356 |
TInt ret( KErrNone ); |
|
1357 |
||
1358 |
switch ( aConfig.iStopBits ) |
|
1359 |
{ |
|
1360 |
case EStop1: |
|
1361 |
{ |
|
1362 |
aStopBits = PEP_COMM_STOP_BITS_1; |
|
1363 |
break; |
|
1364 |
} |
|
1365 |
case EStop2: |
|
1366 |
{ |
|
1367 |
aStopBits = PEP_COMM_STOP_BITS_2; |
|
1368 |
break; |
|
1369 |
} |
|
1370 |
default: |
|
1371 |
{ |
|
1372 |
LOG1(" ERROR, CDpDataConfig::StopBits, Unsupported StopBits: %d.", |
|
1373 |
aStopBits ); |
|
1374 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPDATACONFIG_STOPBITS, "ERROR, CDpDataConfig::StopBits, Unsupported StopBits: %hhu", aStopBits ); |
|
1375 |
||
1376 |
ret = KErrNotSupported; |
|
1377 |
} |
|
1378 |
} |
|
1379 |
||
1380 |
return ret; |
|
1381 |
} |
|
1382 |
||
1383 |
// --------------------------------------------------------- |
|
1384 |
// CDpDataConfig::Parity |
|
1385 |
// Solves out the parity bit |
|
1386 |
// --------------------------------------------------------- |
|
1387 |
// |
|
1388 |
TInt CDpDataConfig::Parity( |
|
1389 |
TCommConfigV01& aConfig, |
|
1390 |
TUint8& aParity ) |
|
1391 |
{ |
|
1392 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_PARITY, "CDpDataConfig::Parity" ); |
|
1393 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPDATACONFIG_PARITY, "CDpDataConfig::Parity: %hhu", aParity ); |
|
1394 |
||
1395 |
LOGM1(" CDpDataConfig::Parity, Parity: %d.", aParity ); |
|
1396 |
||
1397 |
TInt ret( KErrNone ); |
|
1398 |
||
1399 |
switch ( aConfig.iParity ) |
|
1400 |
{ |
|
1401 |
case EParityNone: |
|
1402 |
{ |
|
1403 |
aParity = PEP_COMM_PARITY_NONE; |
|
1404 |
break; |
|
1405 |
} |
|
1406 |
case EParityEven: |
|
1407 |
{ |
|
1408 |
aParity = PEP_COMM_PARITY_EVEN; |
|
1409 |
break; |
|
1410 |
} |
|
1411 |
case EParityOdd: |
|
1412 |
{ |
|
1413 |
aParity = PEP_COMM_PARITY_ODD; |
|
1414 |
break; |
|
1415 |
} |
|
1416 |
case EParityMark: |
|
1417 |
{ |
|
1418 |
aParity = PEP_COMM_PARITY_MARK; |
|
1419 |
break; |
|
1420 |
} |
|
1421 |
case EParitySpace: |
|
1422 |
{ |
|
1423 |
aParity = PEP_COMM_PARITY_SPACE; |
|
1424 |
break; |
|
1425 |
} |
|
1426 |
default: |
|
1427 |
{ |
|
1428 |
LOG1(" ERROR, CDpDataConfig::Parity, Unsupported parity: %d.", |
|
1429 |
aParity ); |
|
1430 |
OstTraceExt1( TRACE_NORMAL, DUP2_CDPDATACONFIG_PARITY, "ERROR, CDpDataConfig::Parity, Unsupported parity: %hhu", aParity ); |
|
1431 |
||
1432 |
ret = KErrNotSupported; |
|
1433 |
} |
|
1434 |
} |
|
1435 |
||
1436 |
return ret; |
|
1437 |
} |
|
1438 |
||
1439 |
// --------------------------------------------------------- |
|
1440 |
// CDpDataConfig::HandleDteSignalMapping |
|
1441 |
// Maps the DTE type signals. |
|
1442 |
// --------------------------------------------------------- |
|
1443 |
// |
|
1444 |
void CDpDataConfig::HandleDteSignalMapping( |
|
1445 |
const TUint aSignals, |
|
1446 |
TDes8& aData ) |
|
1447 |
{ |
|
1448 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_HANDLEDTESIGNALMAPPING, "CDpDataConfig::HandleDteSignalMapping" ); |
|
1449 |
OstTrace1( TRACE_NORMAL, DUP1_CDPDATACONFIG_HANDLEDTESIGNALMAPPING, "CDpDataConfig:: aSignals: %u\n", aSignals ); |
|
1450 |
OstTrace1( TRACE_NORMAL, DUP2_CDPDATACONFIG_HANDLEDTESIGNALMAPPING, "CDpDataConfig:: aHandshake: %u\n", iConfig.iHandshake ); |
|
1451 |
||
1452 |
LOGM(" CDpDataConfig::HandleDteSignalMapping"); |
|
1453 |
LOG1(" HandleDteSignalsMapping - aSignals: %x\n", aSignals ); |
|
1454 |
LOG1(" HandleDteSignalsMapping - aHandshake: %x\n", iConfig.iHandshake ); |
|
1455 |
||
1456 |
TUint8 state( 0 ); |
|
1457 |
||
1458 |
if ( ( iConfig.iHandshake & KConfigFreeDTR ) ) |
|
1459 |
{ |
|
1460 |
LOG(" CDpDataConfig::HandleDteSignalMapping, iConfig.iHandshake & KConfigFreeDTR == TRUE"); |
|
1461 |
OstTrace0( TRACE_NORMAL, DUP3_CDPDATACONFIG_HANDLEDTESIGNALMAPPING, "CDpDataConfig:: iConfig.iHandshake and KConfigFreeDTR == TRUE" ); |
|
1462 |
||
1463 |
// This is little bit simplified. Win2000 doesn't send DTR signal properly |
|
1464 |
if ( ( aSignals & KDTRChanged ) ) |
|
1465 |
{ |
|
1466 |
if ( aSignals & KSignalDTR ) |
|
1467 |
{ |
|
1468 |
LOG(" DTR signal ON"); |
|
1469 |
OstTrace0( TRACE_NORMAL, DUP4_CDPDATACONFIG_HANDLEDTESIGNALMAPPING, "CDpDataConfig:: DTR signal ON" ); |
|
1470 |
||
1471 |
state = PEP_COMM_SIGNAL_DTR_ON; |
|
1472 |
} |
|
1473 |
else |
|
1474 |
{ |
|
1475 |
LOG(" DTR signal OFF"); |
|
1476 |
OstTrace0( TRACE_NORMAL, DUP5_CDPDATACONFIG_HANDLEDTESIGNALMAPPING, "CDpDataConfig:: DTR signal OFF" ); |
|
1477 |
||
1478 |
state = PEP_COMM_SIGNAL_DTR_OFF; |
|
1479 |
} |
|
1480 |
} |
|
1481 |
} |
|
1482 |
//no else |
|
1483 |
||
1484 |
aData.Append( state ); |
|
1485 |
} |
|
1486 |
||
1487 |
// --------------------------------------------------------- |
|
1488 |
// CDpDataConfig::HandleDceSignalMapping |
|
1489 |
// Maps the DCE type signals |
|
1490 |
// --------------------------------------------------------- |
|
1491 |
// |
|
1492 |
void CDpDataConfig::HandleDceSignalMapping( |
|
1493 |
const TUint aSignals, |
|
1494 |
TDes8& aData ) |
|
1495 |
{ |
|
1496 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_HANDLEDCESIGNALMAPPING, "CDpDataConfig::HandleDceSignalMapping" ); |
|
1497 |
LOGM(" CDpDataConfig::HandleDceSignalMapping"); |
|
1498 |
||
1499 |
TUint8 state( 0 ); |
|
1500 |
||
1501 |
if ( ( iConfig.iHandshake & KConfigFreeDSR ) ) |
|
1502 |
{ |
|
1503 |
if ( ( ( aSignals & KSignalDSR) != (iSignals & KSignalDSR) ) || |
|
1504 |
( ( aSignals & KDSRChanged ) && ( aSignals & KSignalDSR ) ) ) |
|
1505 |
{ |
|
1506 |
if ( aSignals & KSignalDSR ) |
|
1507 |
{ |
|
1508 |
state |= PEP_COMM_SIGNAL_DSR_ON; |
|
1509 |
} |
|
1510 |
else |
|
1511 |
{ |
|
1512 |
state |= PEP_COMM_SIGNAL_DSR_OFF; |
|
1513 |
} |
|
1514 |
} |
|
1515 |
//no else |
|
1516 |
} |
|
1517 |
//no else |
|
1518 |
||
1519 |
if ( ( iConfig.iHandshake & KConfigFreeDCD ) ) |
|
1520 |
{ |
|
1521 |
if ( ( ( aSignals & KSignalDCD ) != (iSignals & KSignalDCD) ) || |
|
1522 |
( ( aSignals & KDCDChanged ) && ( aSignals & KSignalDCD) ) ) |
|
1523 |
{ |
|
1524 |
if ( aSignals & KSignalDCD ) |
|
1525 |
{ |
|
1526 |
state |= PEP_COMM_SIGNAL_DCD_ON; |
|
1527 |
} |
|
1528 |
else |
|
1529 |
{ |
|
1530 |
state |= PEP_COMM_SIGNAL_DCD_OFF; |
|
1531 |
} |
|
1532 |
} |
|
1533 |
//no else |
|
1534 |
} |
|
1535 |
//no else |
|
1536 |
||
1537 |
if ( ( iConfig.iHandshake & KConfigFreeRI ) ) |
|
1538 |
{ |
|
1539 |
if ( ( ( aSignals & KSignalRNG ) != ( iSignals & KSignalRNG ) ) || |
|
1540 |
( ( aSignals & KRNGChanged ) && ( aSignals & KSignalRNG) ) ) |
|
1541 |
{ |
|
1542 |
if ( aSignals & KSignalRNG ) |
|
1543 |
{ |
|
1544 |
state |= PEP_COMM_SIGNAL_RI_ON; |
|
1545 |
} |
|
1546 |
else |
|
1547 |
{ |
|
1548 |
state |= PEP_COMM_SIGNAL_RI_OFF; |
|
1549 |
} |
|
1550 |
} |
|
1551 |
//no else |
|
1552 |
} |
|
1553 |
//no else |
|
1554 |
||
1555 |
aData.Append( state ); |
|
1556 |
} |
|
1557 |
||
1558 |
// OTHER EXPORTED FUNCTIONS |
|
1559 |
// none |
|
1560 |
||
1561 |
// End of File |