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>
|
|
33 |
#include "osttracedefinitions.h"
|
|
34 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
35 |
#include "dpdataconfigtraces.h"
|
|
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(
|
|
430 |
PN_PIPE,
|
|
431 |
iDataPort.CreateTransactionId(),
|
|
432 |
PNS_PEP_STATUS_IND,
|
|
433 |
messageData );
|
|
434 |
|
|
435 |
LOG(" <== PNS_PEP_STATUS_IND ind sent (PEP_COMM_IND_ID_PARAM)");
|
|
436 |
OstTrace0( TRACE_NORMAL, DUP3_CDPDATACONFIG_SETCONFIG, "CDpDataConfig:: <== PNS_PEP_STATUS_IND ind sent (PEP_COMM_IND_ID_PARAM)" );
|
|
437 |
|
|
438 |
#if defined(_DEBUG)
|
|
439 |
if ( KErrNone != result )
|
|
440 |
{
|
|
441 |
LOG1("Error isc api send %d", result );
|
|
442 |
OstTrace1( TRACE_NORMAL, DUP4_CDPDATACONFIG_SETCONFIG, "CDpDataConfig:: Error isc api send %d", result );
|
|
443 |
}
|
|
444 |
//no else
|
|
445 |
#endif
|
|
446 |
// accept new values
|
|
447 |
iConfig = aConfig;
|
|
448 |
}
|
|
449 |
}
|
|
450 |
//no else
|
|
451 |
}
|
|
452 |
|
|
453 |
return ret;
|
|
454 |
}
|
|
455 |
|
|
456 |
// ---------------------------------------------------------
|
|
457 |
// CDpDataConfig::GetSignals
|
|
458 |
// This method gets status of signals.
|
|
459 |
//// On return, contains signals
|
|
460 |
// ---------------------------------------------------------
|
|
461 |
//
|
|
462 |
void CDpDataConfig::GetSignals(
|
|
463 |
TUint& aSignals )
|
|
464 |
{
|
|
465 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_GETSIGNALS, "CDpDataConfig::GetSignals" );
|
|
466 |
LOGM(" CDpDataConfig::GetSignals");
|
|
467 |
|
|
468 |
aSignals = iSignals;
|
|
469 |
}
|
|
470 |
|
|
471 |
// ---------------------------------------------------------
|
|
472 |
// CDpDataConfig::SetSignals2Epoc
|
|
473 |
// Signal cahnges from CMT. This method sets signal values.
|
|
474 |
// ---------------------------------------------------------
|
|
475 |
//
|
|
476 |
TInt CDpDataConfig::SetSignals2Epoc(
|
|
477 |
const TUint aSignals )
|
|
478 |
{
|
|
479 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETSIGNALS2EPOC, "CDpDataConfig::SetSignals2Epoc" );
|
|
480 |
LOGM(" CDpDataConfig::SetSignals2Epoc");
|
|
481 |
|
|
482 |
TCommRole role;
|
|
483 |
TUint newSignals( 0 );
|
|
484 |
iDataPort.GetRole( role );
|
|
485 |
|
|
486 |
// accept new signals
|
|
487 |
iSignals = aSignals;
|
|
488 |
|
|
489 |
// signal change came from DCS
|
|
490 |
|
|
491 |
if ( iSignalNotify )
|
|
492 |
{
|
|
493 |
newSignals = iSignals & (
|
|
494 |
iNotifySignalMask | iNotifySignalMask * KSignalChanged );
|
|
495 |
|
|
496 |
if ( ECommRoleDTE == role )
|
|
497 |
{
|
|
498 |
newSignals &= ( KSignalDTEInputs | KDTEDeltaInput );
|
|
499 |
}
|
|
500 |
else
|
|
501 |
{
|
|
502 |
newSignals &= ( KSignalDCEInputs | KDCEDeltaInput );
|
|
503 |
}
|
|
504 |
|
|
505 |
// we should indicate client
|
|
506 |
CompleteSignalChangeNotify( newSignals );
|
|
507 |
}
|
|
508 |
//no else
|
|
509 |
|
|
510 |
return KErrNone;
|
|
511 |
}
|
|
512 |
|
|
513 |
// ---------------------------------------------------------
|
|
514 |
// CDpDataConfig::SetSignals2Cmt
|
|
515 |
// Signal changes from the C32 client.
|
|
516 |
// This method sends mapped signal values to CMT and sets
|
|
517 |
// signal values.
|
|
518 |
// ---------------------------------------------------------
|
|
519 |
//
|
|
520 |
TInt CDpDataConfig::SetSignals2Cmt(
|
|
521 |
const TUint aSignals )
|
|
522 |
{
|
|
523 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETSIGNALS2CMT, "CDpDataConfig::SetSignals2Cmt" );
|
|
524 |
LOGM(" CDpDataConfig::SetSignals2Cmt");
|
|
525 |
|
|
526 |
TCommRole role;
|
|
527 |
iDataPort.GetRole( role );
|
|
528 |
|
|
529 |
// signal change came from client
|
|
530 |
|
|
531 |
TInt ret( MapSignalsEpoc2Cmt( aSignals, role ) );
|
|
532 |
|
|
533 |
if ( KErrNone == ret )
|
|
534 |
{
|
|
535 |
// accept new signals
|
|
536 |
iSignals = aSignals;
|
|
537 |
|
|
538 |
TUint newSignals( 0 );
|
|
539 |
|
|
540 |
if ( iSignalNotify )
|
|
541 |
{
|
|
542 |
newSignals = iSignals & (
|
|
543 |
iNotifySignalMask | iNotifySignalMask * KSignalChanged );
|
|
544 |
if ( ECommRoleDTE == role )
|
|
545 |
{
|
|
546 |
newSignals &= ( KSignalDCEInputs | KDCEDeltaInput );
|
|
547 |
}
|
|
548 |
else
|
|
549 |
{
|
|
550 |
newSignals &= ( KSignalDTEInputs | KDTEDeltaInput );
|
|
551 |
}
|
|
552 |
|
|
553 |
// we should indicate client
|
|
554 |
CompleteSignalChangeNotify( newSignals );
|
|
555 |
}
|
|
556 |
//no else
|
|
557 |
}
|
|
558 |
//no else
|
|
559 |
|
|
560 |
return ret;
|
|
561 |
}
|
|
562 |
|
|
563 |
// ---------------------------------------------------------
|
|
564 |
// CDpDataConfig::SetSignalNotify
|
|
565 |
// Activate/deactivate signal change notify.
|
|
566 |
// ---------------------------------------------------------
|
|
567 |
//
|
|
568 |
void CDpDataConfig::SetSignalNotify(
|
|
569 |
const TBool aEnableNotify )
|
|
570 |
{
|
|
571 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETSIGNALNOTIFY, "CDpDataConfig::SetSignalNotify" );
|
|
572 |
LOGM(" CDpDataConfig::SetSignalNotify");
|
|
573 |
|
|
574 |
iSignalNotify = aEnableNotify;
|
|
575 |
|
|
576 |
// Forget signal changes
|
|
577 |
iSignals &= ( KSignalDTEOutputs | KSignalDTEInputs );
|
|
578 |
}
|
|
579 |
|
|
580 |
// ---------------------------------------------------------
|
|
581 |
// CDpDataConfig::SetNotifySignalMask
|
|
582 |
// Client sets a signal mask. i.e. Client can give a mask
|
|
583 |
// and we only notify client when one of the signals given
|
|
584 |
// in mask changes.
|
|
585 |
// ---------------------------------------------------------
|
|
586 |
//
|
|
587 |
void CDpDataConfig::SetNotifySignalMask(
|
|
588 |
const TUint aSignalMask )
|
|
589 |
{
|
|
590 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETNOTIFYSIGNALMASK, "CDpDataConfig::SetNotifySignalMask" );
|
|
591 |
LOGM(" CDpDataConfig::SetNotifySignalMask");
|
|
592 |
|
|
593 |
iNotifySignalMask = aSignalMask;
|
|
594 |
}
|
|
595 |
|
|
596 |
// ---------------------------------------------------------
|
|
597 |
// CDpDataConfig::SetConfigNotify
|
|
598 |
// Client is requesting to notify when configuration changes
|
|
599 |
// ---------------------------------------------------------
|
|
600 |
//
|
|
601 |
void CDpDataConfig::SetConfigNotify(
|
|
602 |
const TBool aEnableNotify )
|
|
603 |
{
|
|
604 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETCONFIGNOTIFY, "CDpDataConfig::SetConfigNotify" );
|
|
605 |
LOGM(" CDpDataConfig::SetConfigNotify");
|
|
606 |
|
|
607 |
iConfigNotify = aEnableNotify;
|
|
608 |
}
|
|
609 |
|
|
610 |
// ---------------------------------------------------------
|
|
611 |
// CDpDataConfig::MapSignalsCmt2Epoc
|
|
612 |
// This method map signals from CMT messages to C32 signals.
|
|
613 |
// ---------------------------------------------------------
|
|
614 |
//
|
|
615 |
TInt CDpDataConfig::MapSignalsCmt2Epoc(
|
|
616 |
TDesC8& aIndData )
|
|
617 |
{
|
|
618 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig::MapSignalsCmt2Epoc" );
|
|
619 |
LOGM(" CDpDataConfig::MapSignalsCmt2Epoc");
|
|
620 |
|
|
621 |
TUint signalsC32( iSignals );
|
|
622 |
TInt ret( KErrNone );
|
|
623 |
TBool noSignalChanged( EFalse );
|
|
624 |
|
|
625 |
PEP_COMM_IND_ID_V24_CHANGE_STR& pepParam = *(
|
|
626 |
( PEP_COMM_IND_ID_V24_CHANGE_STR* ) aIndData.Ptr() );
|
|
627 |
|
|
628 |
// DTE inputs from CMT side
|
|
629 |
if ( PEP_COMM_SIGNAL_RI_ON == pepParam.new_state )
|
|
630 |
{
|
|
631 |
LOG(" PEP_COMM_SIGNAL_RI_ON");
|
|
632 |
OstTrace0( TRACE_NORMAL, DUP1_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: PEP_COMM_SIGNAL_RI_ON" );
|
|
633 |
|
|
634 |
if ( ( signalsC32 & KSignalRNG ) != KSignalRNG )
|
|
635 |
{
|
|
636 |
signalsC32 |= KSignalRNG | KRNGChanged;
|
|
637 |
}
|
|
638 |
else
|
|
639 |
{
|
|
640 |
// No signals has changed
|
|
641 |
noSignalChanged = ETrue;
|
|
642 |
}
|
|
643 |
}
|
|
644 |
else if ( PEP_COMM_SIGNAL_RI_OFF == pepParam.new_state )
|
|
645 |
{
|
|
646 |
LOG(" PEP_COMM_SIGNAL_RI_OFF");
|
|
647 |
OstTrace0( TRACE_NORMAL, DUP2_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: PEP_COMM_SIGNAL_RI_OFF" );
|
|
648 |
|
|
649 |
if ( ( signalsC32 & KSignalRNG ) == KSignalRNG )
|
|
650 |
{
|
|
651 |
signalsC32 &= ~KSignalRNG;
|
|
652 |
signalsC32 |= KRNGChanged;
|
|
653 |
}
|
|
654 |
else
|
|
655 |
{
|
|
656 |
// No signals has changed
|
|
657 |
noSignalChanged = ETrue;
|
|
658 |
}
|
|
659 |
}
|
|
660 |
else if ( PEP_COMM_SIGNAL_DCD_ON == pepParam.new_state )
|
|
661 |
{
|
|
662 |
LOG(" PEP_COMM_SIGNAL_DCD_ON");
|
|
663 |
OstTrace0( TRACE_NORMAL, DUP3_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: PEP_COMM_SIGNAL_DCD_ON" );
|
|
664 |
|
|
665 |
if ( ( signalsC32 & KSignalDCD ) != KSignalDCD )
|
|
666 |
{
|
|
667 |
LOG("DCD_ON");
|
|
668 |
OstTrace0( TRACE_NORMAL, DUP4_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: DCD_ON" );
|
|
669 |
|
|
670 |
signalsC32 |= KSignalDCD | KDCDChanged;
|
|
671 |
}
|
|
672 |
else
|
|
673 |
{
|
|
674 |
// No signals has changed
|
|
675 |
noSignalChanged = ETrue;
|
|
676 |
}
|
|
677 |
}
|
|
678 |
else if ( PEP_COMM_SIGNAL_DCD_OFF == pepParam.new_state )
|
|
679 |
{
|
|
680 |
LOG(" PEP_COMM_SIGNAL_DCD_OFF");
|
|
681 |
OstTrace0( TRACE_NORMAL, DUP5_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: PEP_COMM_SIGNAL_DCD_OFF" );
|
|
682 |
|
|
683 |
if ( ( signalsC32 & KSignalDCD ) == KSignalDCD )
|
|
684 |
{
|
|
685 |
LOG("DCD_OFF");
|
|
686 |
OstTrace0( TRACE_NORMAL, DUP6_CDPDATACONFIG_MAPSIGNALSCMT2EPOC, "CDpDataConfig:: DCD_OFF" );
|
|
687 |
|
|
688 |
signalsC32 &= ~KSignalDCD;
|
|
689 |
signalsC32 |= KDCDChanged;
|
|
690 |
}
|
|
691 |
else
|
|
692 |
{
|
|
693 |
// No signals has changed
|
|
694 |
noSignalChanged = ETrue;
|
|
695 |
}
|
|
696 |
}
|
|
697 |
else
|
|
698 |
{
|
|
699 |
// No signals has changed
|
|
700 |
noSignalChanged = ETrue;
|
|
701 |
}
|
|
702 |
|
|
703 |
if ( !noSignalChanged )
|
|
704 |
{
|
|
705 |
ret = SetSignals2Epoc( signalsC32 );
|
|
706 |
}
|
|
707 |
//no else
|
|
708 |
|
|
709 |
return ret;
|
|
710 |
}
|
|
711 |
|
|
712 |
// ---------------------------------------------------------
|
|
713 |
// CDpDataConfig::MapSignalsEpoc2Cmt
|
|
714 |
// Map signals to CMT and send signal change message.
|
|
715 |
// ---------------------------------------------------------
|
|
716 |
//
|
|
717 |
TInt CDpDataConfig::MapSignalsEpoc2Cmt(
|
|
718 |
const TUint aSignals,
|
|
719 |
const TCommRole aRole )
|
|
720 |
{
|
|
721 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_MAPSIGNALSEPOC2CMT, "CDpDataConfig::MapSignalsEpoc2Cmt" );
|
|
722 |
LOGM(" CDpDataConfig::MapSignalsEpoc2Cmt");
|
|
723 |
|
|
724 |
TInt ret( KErrNone );
|
|
725 |
|
|
726 |
// PEP_COMM_IND_ID_V24_CHANGE_STR
|
|
727 |
TBuf8<1> data;
|
|
728 |
|
|
729 |
switch ( aRole )
|
|
730 |
{
|
|
731 |
case ECommRoleDTE:
|
|
732 |
{
|
|
733 |
HandleDteSignalMapping( aSignals, data );
|
|
734 |
break;
|
|
735 |
}
|
|
736 |
case ECommRoleDCE:
|
|
737 |
{
|
|
738 |
HandleDceSignalMapping( aSignals, data );
|
|
739 |
break;
|
|
740 |
}
|
|
741 |
default:
|
|
742 |
{
|
|
743 |
LOG(" ERROR, CDpDataConfig::MapSignalsEpoc2Cmt, Unsupported role");
|
|
744 |
OstTrace0( TRACE_NORMAL, DUP1_CDPDATACONFIG_MAPSIGNALSEPOC2CMT, "ERROR, CDpDataConfig::MapSignalsEpoc2Cmt, Unsupported role" );
|
|
745 |
|
|
746 |
ret = KErrNotSupported;
|
|
747 |
}
|
|
748 |
}
|
|
749 |
|
|
750 |
//if data = 0, do not send
|
|
751 |
if ( ( 0 != data.Length() ) && ( KErrNone == ret ) )
|
|
752 |
{
|
|
753 |
// Create PNS_PEP_STATUS_IND
|
|
754 |
TBuf8<SIZE_PNS_PEP_STATUS_IND> messageData;
|
|
755 |
// Pipe Handle
|
|
756 |
messageData.Append( iDataPort.Pif().PipeHandle() );
|
|
757 |
// PEP Type
|
|
758 |
messageData.Append( PN_PEP_TYPE_COMM );
|
|
759 |
// Indication ID
|
|
760 |
messageData.Append( PEP_COMM_IND_ID_V24_CHANGE );
|
|
761 |
// Filler bytes
|
|
762 |
messageData.Append( KDpPadding );
|
|
763 |
messageData.Append( KDpPadding );
|
|
764 |
// Indication data
|
|
765 |
messageData.Append( data );
|
|
766 |
|
|
767 |
// Send message
|
|
768 |
#if defined(_DEBUG)
|
|
769 |
TInt err =
|
|
770 |
#endif
|
|
771 |
iDataPort.Mif().SendMessage(
|
|
772 |
PN_PIPE,
|
|
773 |
iDataPort.CreateTransactionId(),
|
|
774 |
PNS_PEP_STATUS_IND,
|
|
775 |
messageData );
|
|
776 |
|
|
777 |
LOG(" <== PNS_PEP_STATUS_IND sent (PEP_COMM_IND_ID_V24_CHANGE)");
|
|
778 |
OstTrace0( TRACE_NORMAL, DUP2_CDPDATACONFIG_MAPSIGNALSEPOC2CMT, "CDpDataConfig:: <== PNS_PEP_STATUS_IND sent (PEP_COMM_IND_ID_V24_CHANGE)" );
|
|
779 |
|
|
780 |
#if defined(_DEBUG)
|
|
781 |
if ( KErrNone != err )
|
|
782 |
{
|
|
783 |
LOG1("Error isc api send %d", err );
|
|
784 |
OstTrace1( TRACE_NORMAL, DUP3_CDPDATACONFIG_MAPSIGNALSEPOC2CMT, "CDpDataConfig:: Error isc api send %d", err );
|
|
785 |
}
|
|
786 |
//no else
|
|
787 |
#endif
|
|
788 |
}
|
|
789 |
//no else
|
|
790 |
|
|
791 |
return ret;
|
|
792 |
}
|
|
793 |
|
|
794 |
// ---------------------------------------------------------
|
|
795 |
// CDpDataConfig::CompleteSignalChangeNotify
|
|
796 |
// This method completes signal change notify, if there are
|
|
797 |
// new signals. New signals are already mapped with notify
|
|
798 |
// mask. This method disables notifying after completion.
|
|
799 |
// ---------------------------------------------------------
|
|
800 |
//
|
|
801 |
void CDpDataConfig::CompleteSignalChangeNotify(
|
|
802 |
const TUint aNewSignals)
|
|
803 |
{
|
|
804 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_COMPLETESIGNALCHANGENOTIFY, "CDpDataConfig::CompleteSignalChangeNotify" );
|
|
805 |
LOGM(" CDpDataConfig::CompleteSignalChangeNotify");
|
|
806 |
|
|
807 |
if ( aNewSignals )
|
|
808 |
{
|
|
809 |
iDataPort.SignalChangeCompleted( aNewSignals, KErrNone );
|
|
810 |
|
|
811 |
SetSignalNotify( EFalse );
|
|
812 |
}
|
|
813 |
//no else
|
|
814 |
|
|
815 |
// otherwise client is not interested in these signals
|
|
816 |
}
|
|
817 |
|
|
818 |
// ---------------------------------------------------------
|
|
819 |
// CDpDataConfig::CompleteConfigChangeNotify
|
|
820 |
// Check if client has 'ordered' config change notify and there
|
|
821 |
// is something changed. Complete config change to client.
|
|
822 |
// ---------------------------------------------------------
|
|
823 |
//
|
|
824 |
void CDpDataConfig::CompleteConfigChangeNotify()
|
|
825 |
{
|
|
826 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_COMPLETECONFIGCHANGENOTIFY, "CDpDataConfig::CompleteConfigChangeNotify" );
|
|
827 |
LOGM(" CDpDataConfig::CompleteConfigChangeNotify");
|
|
828 |
|
|
829 |
if ( ( iConfigNotify ) && ( 0 < iPeerConfig.iChangedMembers ) )
|
|
830 |
{
|
|
831 |
TPckg<TCommNotificationV01> cfg( iPeerConfig );
|
|
832 |
iDataPort.ConfigChangeCompleted( cfg, KErrNone );
|
|
833 |
iConfigNotify = EFalse;
|
|
834 |
iPeerConfig.iChangedMembers = 0;
|
|
835 |
}
|
|
836 |
//no else
|
|
837 |
}
|
|
838 |
|
|
839 |
// ---------------------------------------------------------
|
|
840 |
// CDpDataConfig::SetFlowControlConfig
|
|
841 |
// This method sets flow control configuration. This is
|
|
842 |
// called from COMM PEP.
|
|
843 |
// ---------------------------------------------------------
|
|
844 |
//
|
|
845 |
TInt CDpDataConfig::SetFlowControlConfig(
|
|
846 |
const TUint8 aFlowCtrlInwards,
|
|
847 |
const TUint8 aFlowCtrlOutwards,
|
|
848 |
const TUint8 aExtract )
|
|
849 |
{
|
|
850 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETFLOWCONTROLCONFIG, "CDpDataConfig::SetFlowControlConfig" );
|
|
851 |
LOGM(" CDpDataConfig::SetFlowControlConfig");
|
|
852 |
|
|
853 |
TUint handshake( iConfig.iHandshake );
|
|
854 |
TInt ret( KErrNone );
|
|
855 |
TCommRole role;
|
|
856 |
iDataPort.GetRole( role );
|
|
857 |
|
|
858 |
// clear peer configuration notify flags
|
|
859 |
iPeerConfig.iChangedMembers = 0;
|
|
860 |
|
|
861 |
// Inwards=DCS->DP data flow
|
|
862 |
switch ( aFlowCtrlInwards )
|
|
863 |
{
|
|
864 |
case PEP_COMM_FLOW_CTRL_SW:
|
|
865 |
{
|
|
866 |
if ( role == ECommRoleDTE )
|
|
867 |
{
|
|
868 |
handshake |= KConfigObeyXoff;
|
|
869 |
handshake &= ~KConfigObeyDSR;
|
|
870 |
handshake &= ~KConfigObeyDCD;
|
|
871 |
handshake &= ~KConfigObeyCTS;
|
|
872 |
}
|
|
873 |
else
|
|
874 |
{
|
|
875 |
handshake |= KConfigObeyXoff;
|
|
876 |
handshake &= ~KConfigObeyDTR;
|
|
877 |
handshake &= ~KConfigObeyRTS;
|
|
878 |
}
|
|
879 |
break;
|
|
880 |
}
|
|
881 |
case PEP_COMM_FLOW_CTRL_HW:
|
|
882 |
{
|
|
883 |
if ( role == ECommRoleDTE )
|
|
884 |
{
|
|
885 |
handshake |= KConfigObeyCTS;
|
|
886 |
handshake &= ~KConfigObeyDCD;
|
|
887 |
handshake &= ~KConfigObeyDSR;
|
|
888 |
handshake &= ~KConfigObeyXoff;
|
|
889 |
}
|
|
890 |
else
|
|
891 |
{
|
|
892 |
handshake |= KConfigObeyRTS;
|
|
893 |
handshake &= ~KConfigObeyXoff;
|
|
894 |
handshake &= ~KConfigObeyDTR;
|
|
895 |
}
|
|
896 |
break;
|
|
897 |
}
|
|
898 |
case PEP_COMM_FLOW_CTRL_BOTH:
|
|
899 |
{
|
|
900 |
if ( role == ECommRoleDTE )
|
|
901 |
{
|
|
902 |
handshake |= KConfigObeyXoff;
|
|
903 |
handshake |= KConfigObeyCTS;
|
|
904 |
handshake &= ~KConfigObeyDCD;
|
|
905 |
handshake &= ~KConfigObeyDSR;
|
|
906 |
}
|
|
907 |
else
|
|
908 |
{
|
|
909 |
handshake |= KConfigObeyXoff;
|
|
910 |
handshake |= KConfigObeyRTS;
|
|
911 |
handshake &= ~KConfigObeyDTR;
|
|
912 |
}
|
|
913 |
break;
|
|
914 |
}
|
|
915 |
case PEP_COMM_FLOW_CTRL_NONE:
|
|
916 |
{
|
|
917 |
if ( role == ECommRoleDTE )
|
|
918 |
{
|
|
919 |
handshake &= ~KConfigObeyXoff;
|
|
920 |
handshake &= ~KConfigObeyCTS;
|
|
921 |
handshake &= ~KConfigObeyDCD;
|
|
922 |
handshake &= ~KConfigObeyDSR;
|
|
923 |
}
|
|
924 |
else
|
|
925 |
{
|
|
926 |
handshake &= ~KConfigObeyXoff;
|
|
927 |
handshake &= ~KConfigObeyRTS;
|
|
928 |
handshake &= ~KConfigObeyDTR;
|
|
929 |
}
|
|
930 |
break;
|
|
931 |
}
|
|
932 |
default:
|
|
933 |
{
|
|
934 |
LOG1(" ERROR, CDpDataConfig::SetFlowControlConfig, Unsupported flowCtrl status: %d",
|
|
935 |
aFlowCtrlInwards );
|
|
936 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPDATACONFIG_SETFLOWCONTROLCONFIG, "CDpDataConfig:: ERROR, CDpDataConfig::SetFlowControlConfig, Unsupported flowCtrl status: %hhu", aFlowCtrlInwards );
|
|
937 |
|
|
938 |
ret = KErrNotSupported;
|
|
939 |
}
|
|
940 |
}
|
|
941 |
|
|
942 |
if ( KErrNone == ret )
|
|
943 |
{
|
|
944 |
// Outwards=DP->DCS data flow
|
|
945 |
switch ( aFlowCtrlOutwards )
|
|
946 |
{
|
|
947 |
case PEP_COMM_FLOW_CTRL_SW:
|
|
948 |
{
|
|
949 |
if ( role == ECommRoleDTE )
|
|
950 |
{
|
|
951 |
handshake |= KConfigSendXoff;
|
|
952 |
handshake |= KConfigFreeDTR;
|
|
953 |
handshake |= KConfigFreeRTS;
|
|
954 |
}
|
|
955 |
else
|
|
956 |
{
|
|
957 |
handshake |= KConfigSendXoff;
|
|
958 |
handshake |= KConfigFreeDSR;
|
|
959 |
handshake |= KConfigFreeDCD;
|
|
960 |
}
|
|
961 |
break;
|
|
962 |
}
|
|
963 |
case PEP_COMM_FLOW_CTRL_HW:
|
|
964 |
{
|
|
965 |
if ( role == ECommRoleDTE )
|
|
966 |
{
|
|
967 |
handshake &= ~KConfigFreeRTS;
|
|
968 |
handshake |= KConfigFreeDTR;
|
|
969 |
handshake &= ~KConfigSendXoff;
|
|
970 |
}
|
|
971 |
else
|
|
972 |
{
|
|
973 |
handshake |= KConfigFreeDCD;
|
|
974 |
handshake |= KConfigFreeDSR;
|
|
975 |
handshake &= ~KConfigSendXoff;
|
|
976 |
}
|
|
977 |
break;
|
|
978 |
}
|
|
979 |
case PEP_COMM_FLOW_CTRL_BOTH:
|
|
980 |
{
|
|
981 |
if ( role == ECommRoleDTE )
|
|
982 |
{
|
|
983 |
handshake |= KConfigSendXoff;
|
|
984 |
handshake &= ~KConfigFreeRTS;
|
|
985 |
handshake |= KConfigFreeDTR;
|
|
986 |
}
|
|
987 |
else
|
|
988 |
{
|
|
989 |
handshake |= KConfigSendXoff;
|
|
990 |
handshake |= KConfigFreeDCD;
|
|
991 |
handshake |= KConfigFreeDSR;
|
|
992 |
}
|
|
993 |
break;
|
|
994 |
}
|
|
995 |
case PEP_COMM_FLOW_CTRL_NONE:
|
|
996 |
{
|
|
997 |
if ( role == ECommRoleDTE )
|
|
998 |
{
|
|
999 |
handshake &= ~KConfigSendXoff;
|
|
1000 |
handshake |= KConfigFreeRTS;
|
|
1001 |
handshake |= KConfigFreeDTR;
|
|
1002 |
}
|
|
1003 |
else
|
|
1004 |
{
|
|
1005 |
handshake &= ~KConfigSendXoff;
|
|
1006 |
handshake |= KConfigFreeDSR;
|
|
1007 |
handshake |= KConfigFreeDCD;
|
|
1008 |
}
|
|
1009 |
break;
|
|
1010 |
}
|
|
1011 |
default:
|
|
1012 |
{
|
|
1013 |
LOG1(" ERROR, CDpDataConfig::SetFlowControlConfig, Unsupported flowCtrl status: %d",
|
|
1014 |
aFlowCtrlInwards );
|
|
1015 |
OstTraceExt1( TRACE_NORMAL, DUP2_CDPDATACONFIG_SETFLOWCONTROLCONFIG, "ERROR, CDpDataConfig::SetFlowControlConfig, Unsupported flowCtrl status: %hhu", aFlowCtrlInwards );
|
|
1016 |
|
|
1017 |
ret = KErrNotSupported;
|
|
1018 |
}
|
|
1019 |
}
|
|
1020 |
|
|
1021 |
if ( KErrNone == ret )
|
|
1022 |
{
|
|
1023 |
// set flow control char extraction
|
|
1024 |
switch ( aExtract )
|
|
1025 |
{
|
|
1026 |
case PEP_COMM_FLOW_CTRL_EXTRACT:
|
|
1027 |
{
|
|
1028 |
iFlowCtrlCharExtraction = ETrue;
|
|
1029 |
break;
|
|
1030 |
}
|
|
1031 |
case PEP_COMM_FLOW_CTRL_NO_EXTRACT:
|
|
1032 |
{
|
|
1033 |
iFlowCtrlCharExtraction = EFalse;
|
|
1034 |
break;
|
|
1035 |
}
|
|
1036 |
default:
|
|
1037 |
{
|
|
1038 |
LOG1(" ERROR unsupported extract status: %d", aExtract );
|
|
1039 |
OstTraceExt1( TRACE_NORMAL, DUP3_CDPDATACONFIG_SETFLOWCONTROLCONFIG, "CDpDataConfig:: ERROR unsupported extract status: %hhu", aExtract );
|
|
1040 |
|
|
1041 |
ret = KErrNotSupported;
|
|
1042 |
}
|
|
1043 |
}
|
|
1044 |
|
|
1045 |
if ( KErrNone == ret )
|
|
1046 |
{
|
|
1047 |
if ( iPeerConfig.iHandshake != handshake )
|
|
1048 |
{
|
|
1049 |
// turn change flags on
|
|
1050 |
iPeerConfig.iChangedMembers |= KHandshakeChanged;
|
|
1051 |
|
|
1052 |
iPeerConfig.iHandshake = handshake;
|
|
1053 |
iConfig.iHandshake = iPeerConfig.iHandshake;
|
|
1054 |
|
|
1055 |
// we should indicate client
|
|
1056 |
CompleteConfigChangeNotify();
|
|
1057 |
}
|
|
1058 |
//no else
|
|
1059 |
}
|
|
1060 |
//no else
|
|
1061 |
}
|
|
1062 |
//no else
|
|
1063 |
}
|
|
1064 |
//no else
|
|
1065 |
|
|
1066 |
return ret;
|
|
1067 |
}
|
|
1068 |
|
|
1069 |
// ---------------------------------------------------------
|
|
1070 |
// CDpDataConfig::SetEchoDte
|
|
1071 |
// This method sets DTE interface echo mode. This method is
|
|
1072 |
// called from COMM PEP.
|
|
1073 |
// ---------------------------------------------------------
|
|
1074 |
//
|
|
1075 |
TInt CDpDataConfig::SetEchoDte(
|
|
1076 |
const TUint8 aEcho)
|
|
1077 |
{
|
|
1078 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_SETECHODTE, "CDpDataConfig::SetEchoDte" );
|
|
1079 |
LOGM1(" CDpDataConfig::SetEchoDte, aEcho: %d", aEcho );
|
|
1080 |
|
|
1081 |
TInt ret( KErrNone );
|
|
1082 |
|
|
1083 |
switch ( aEcho )
|
|
1084 |
{
|
|
1085 |
case PEP_COMM_ECHO_ON:
|
|
1086 |
{
|
|
1087 |
iEchoDte = ETrue;
|
|
1088 |
break;
|
|
1089 |
}
|
|
1090 |
case PEP_COMM_ECHO_OFF:
|
|
1091 |
{
|
|
1092 |
iEchoDte = EFalse;
|
|
1093 |
break;
|
|
1094 |
}
|
|
1095 |
default:
|
|
1096 |
{
|
|
1097 |
LOG1(" ERROR, CDpDataConfig::SetEchoDte, Not supported echo value %d",
|
|
1098 |
aEcho );
|
|
1099 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPDATACONFIG_SETECHODTE, "ERROR, CDpDataConfig::SetEchoDte, Not supported echo value %hhu", aEcho );
|
|
1100 |
|
|
1101 |
ret = KErrNotSupported;
|
|
1102 |
}
|
|
1103 |
}
|
|
1104 |
|
|
1105 |
return ret;
|
|
1106 |
}
|
|
1107 |
|
|
1108 |
// ---------------------------------------------------------
|
|
1109 |
// CDpDataConfig::WaterMarkHighSize
|
|
1110 |
// Size of xx% of buffer size (typically 75% or 50% of buffer
|
|
1111 |
// size) e.g. if buffer size is 1024 and '%' is 50% returns
|
|
1112 |
// 512.
|
|
1113 |
// ---------------------------------------------------------
|
|
1114 |
//
|
|
1115 |
TInt CDpDataConfig::WaterMarkHighSize(
|
|
1116 |
CDpDataBuffer& aBuffer )
|
|
1117 |
{
|
|
1118 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_WATERMARKHIGHSIZE, "CDpDataConfig::WaterMarkHighSize" );
|
|
1119 |
LOGM(" CDpDataConfig::WaterMarkHighSize");
|
|
1120 |
|
|
1121 |
return ( ( aBuffer.Size() * KDpFlowCtrlWaterMarkHighProsOfBuff ) / 100 );
|
|
1122 |
}
|
|
1123 |
|
|
1124 |
// ---------------------------------------------------------
|
|
1125 |
// CDpDataConfig::WaterMarkLowSize
|
|
1126 |
// Size of x% of buffer size (typically 25% of buffer size).
|
|
1127 |
// ---------------------------------------------------------
|
|
1128 |
//
|
|
1129 |
TInt CDpDataConfig::WaterMarkLowSize(
|
|
1130 |
CDpDataBuffer& aBuffer )
|
|
1131 |
{
|
|
1132 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_WATERMARKLOWSIZE, "CDpDataConfig::WaterMarkLowSize" );
|
|
1133 |
LOGM(" CDpDataConfig::WaterMarkLowSize");
|
|
1134 |
|
|
1135 |
return ( ( aBuffer.Size() * KDpFlowCtrlWaterMarkLowProsOfBuff ) / 100 );
|
|
1136 |
}
|
|
1137 |
|
|
1138 |
// ---------------------------------------------------------
|
|
1139 |
// CDpDataConfig::IsLineFail
|
|
1140 |
// True if there is line fail. i.e. Client has configured
|
|
1141 |
// some signal example CTS --> KConfigFailCTS. Now when CTS
|
|
1142 |
// goes down it is a line fail.
|
|
1143 |
// ---------------------------------------------------------
|
|
1144 |
//
|
|
1145 |
TBool CDpDataConfig::IsLineFail(
|
|
1146 |
TCommRole aRole ) const
|
|
1147 |
{
|
|
1148 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_ISLINEFAIL, "CDpDataConfig::IsLineFail" );
|
|
1149 |
LOGM(" CDpDataConfig::IsLineFail");
|
|
1150 |
|
|
1151 |
TBool ret( EFalse );
|
|
1152 |
|
|
1153 |
if ( ECommRoleDTE == aRole )
|
|
1154 |
{
|
|
1155 |
if ( ( !( iSignals & KSignalDSR ) &&
|
|
1156 |
( iConfig.iHandshake & KConfigFailDSR ) ) ||
|
|
1157 |
( !( iSignals & KSignalDCD ) &&
|
|
1158 |
( iConfig.iHandshake & KConfigFailDCD ) ) )
|
|
1159 |
{
|
|
1160 |
ret = ETrue;
|
|
1161 |
}
|
|
1162 |
//no else
|
|
1163 |
}
|
|
1164 |
else
|
|
1165 |
{
|
|
1166 |
if ( ( !( iSignals & KSignalRTS ) &&
|
|
1167 |
( iConfig.iHandshake & KConfigFailRTS ) ) ||
|
|
1168 |
( !( iSignals & KSignalDTR ) &&
|
|
1169 |
( iConfig.iHandshake & KConfigFailDTR ) ) )
|
|
1170 |
{
|
|
1171 |
ret = ETrue;
|
|
1172 |
}
|
|
1173 |
//no else
|
|
1174 |
}
|
|
1175 |
|
|
1176 |
return ret;
|
|
1177 |
}
|
|
1178 |
|
|
1179 |
// ---------------------------------------------------------
|
|
1180 |
// CDpDataConfig::Terminator
|
|
1181 |
// This method gets DTE interface terminator character.
|
|
1182 |
// ---------------------------------------------------------
|
|
1183 |
//
|
|
1184 |
TText8 CDpDataConfig::Terminator(
|
|
1185 |
const TUint aIndex )
|
|
1186 |
{
|
|
1187 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_TERMINATOR, "CDpDataConfig::Terminator" );
|
|
1188 |
LOGM(" CDpDataConfig::Terminator");
|
|
1189 |
|
|
1190 |
return iConfig.iTerminator[aIndex];
|
|
1191 |
}
|
|
1192 |
|
|
1193 |
// ---------------------------------------------------------
|
|
1194 |
// CDpDataConfig::Rate
|
|
1195 |
// Solves out the bit rate
|
|
1196 |
// ---------------------------------------------------------
|
|
1197 |
//
|
|
1198 |
TInt CDpDataConfig::Rate(
|
|
1199 |
TCommConfigV01& aConfig,
|
|
1200 |
TUint8& aRate)
|
|
1201 |
{
|
|
1202 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_RATE, "CDpDataConfig::Rate" );
|
|
1203 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPDATACONFIG_RATE, "CDpDataConfig::Rate, Config rate: %hhu", aRate );
|
|
1204 |
|
|
1205 |
LOGM1(" CDpDataConfig::Rate, Config rate: %d.", aRate );
|
|
1206 |
|
|
1207 |
TInt ret( KErrNone );
|
|
1208 |
|
|
1209 |
switch ( aConfig.iRate )
|
|
1210 |
{
|
|
1211 |
case EBps2400:
|
|
1212 |
{
|
|
1213 |
aRate = EPEP_COMM_RATE_2400;
|
|
1214 |
break;
|
|
1215 |
}
|
|
1216 |
case EBps4800:
|
|
1217 |
{
|
|
1218 |
aRate = EPEP_COMM_RATE_4800;
|
|
1219 |
break;
|
|
1220 |
}
|
|
1221 |
case EBps9600:
|
|
1222 |
{
|
|
1223 |
aRate = EPEP_COMM_RATE_9600;
|
|
1224 |
break;
|
|
1225 |
}
|
|
1226 |
case EBps19200:
|
|
1227 |
{
|
|
1228 |
aRate = EPEP_COMM_RATE_19200;
|
|
1229 |
break;
|
|
1230 |
}
|
|
1231 |
case EBps38400:
|
|
1232 |
{
|
|
1233 |
aRate = EPEP_COMM_RATE_38400;
|
|
1234 |
break;
|
|
1235 |
}
|
|
1236 |
case EBps57600:
|
|
1237 |
{
|
|
1238 |
aRate = EPEP_COMM_RATE_57600;
|
|
1239 |
break;
|
|
1240 |
}
|
|
1241 |
case EBps115200:
|
|
1242 |
{
|
|
1243 |
aRate = EPEP_COMM_RATE_115200;
|
|
1244 |
break;
|
|
1245 |
}
|
|
1246 |
default:
|
|
1247 |
{
|
|
1248 |
LOG1(" ERROR, CDpDataConfig::Rate, Unsupported rate value: %d.",
|
|
1249 |
aRate );
|
|
1250 |
OstTraceExt1( TRACE_NORMAL, DUP2_CDPDATACONFIG_RATE, "CDpDataConfig:: ERROR, Unsupported rate value:%hhu", aRate );
|
|
1251 |
|
|
1252 |
ret = KErrNotSupported;
|
|
1253 |
}
|
|
1254 |
}
|
|
1255 |
|
|
1256 |
return ret;
|
|
1257 |
}
|
|
1258 |
|
|
1259 |
// ---------------------------------------------------------
|
|
1260 |
// CDpDataConfig::DataBits
|
|
1261 |
// Solves out data bits.
|
|
1262 |
// ---------------------------------------------------------
|
|
1263 |
//
|
|
1264 |
TInt CDpDataConfig::DataBits(
|
|
1265 |
TCommConfigV01& aConfig,
|
|
1266 |
TUint8& aDataBits)
|
|
1267 |
{
|
|
1268 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_DATABITS, "CDpDataConfig::DataBits" );
|
|
1269 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPDATACONFIG_DATABITS, "CDpDataConfig::DataBits: %hhu in DataConfig::DataBits", aDataBits );
|
|
1270 |
|
|
1271 |
LOGM(" CDpDataConfig::DataBits");
|
|
1272 |
LOGM1(" DataBits: %d in DataConfig::DataBits.", aDataBits );
|
|
1273 |
|
|
1274 |
TInt ret( KErrNone );
|
|
1275 |
|
|
1276 |
switch ( aConfig.iDataBits )
|
|
1277 |
{
|
|
1278 |
case EData7:
|
|
1279 |
{
|
|
1280 |
aDataBits = PEP_COMM_DATA_BITS_7;
|
|
1281 |
break;
|
|
1282 |
}
|
|
1283 |
case EData8:
|
|
1284 |
{
|
|
1285 |
aDataBits = PEP_COMM_DATA_BITS_8;
|
|
1286 |
break;
|
|
1287 |
}
|
|
1288 |
default:
|
|
1289 |
{
|
|
1290 |
LOG1(" ERROR, CDpDataConfig::DataBits, Unsupported DataBits: %d.",
|
|
1291 |
aDataBits);
|
|
1292 |
OstTraceExt1( TRACE_NORMAL, DUP2_CDPDATACONFIG_DATABITS, "CDpDataConfig:: ERROR, Unsupported DataBits: %hhu", aDataBits );
|
|
1293 |
|
|
1294 |
ret =KErrNotSupported;
|
|
1295 |
}
|
|
1296 |
}
|
|
1297 |
|
|
1298 |
return ret;
|
|
1299 |
}
|
|
1300 |
|
|
1301 |
// ---------------------------------------------------------
|
|
1302 |
// CDpDataConfig::StopBits
|
|
1303 |
// Solves out the stop bits
|
|
1304 |
// ---------------------------------------------------------
|
|
1305 |
//
|
|
1306 |
TInt CDpDataConfig::StopBits(
|
|
1307 |
TCommConfigV01& aConfig,
|
|
1308 |
TUint8& aStopBits)
|
|
1309 |
{
|
|
1310 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_STOPBITS, "CDpDataConfig::StopBits" );
|
|
1311 |
OstTraceExt1( TRACE_NORMAL, DUP2_CDPDATACONFIG_STOPBITS, "CDpDataConfig::StopBits: %hhu", aStopBits );
|
|
1312 |
|
|
1313 |
LOGM1(" CDpDataConfig::StopBits, StopBits: %d.", aStopBits );
|
|
1314 |
|
|
1315 |
TInt ret( KErrNone );
|
|
1316 |
|
|
1317 |
switch ( aConfig.iStopBits )
|
|
1318 |
{
|
|
1319 |
case EStop1:
|
|
1320 |
{
|
|
1321 |
aStopBits = PEP_COMM_STOP_BITS_1;
|
|
1322 |
break;
|
|
1323 |
}
|
|
1324 |
case EStop2:
|
|
1325 |
{
|
|
1326 |
aStopBits = PEP_COMM_STOP_BITS_2;
|
|
1327 |
break;
|
|
1328 |
}
|
|
1329 |
default:
|
|
1330 |
{
|
|
1331 |
LOG1(" ERROR, CDpDataConfig::StopBits, Unsupported StopBits: %d.",
|
|
1332 |
aStopBits );
|
|
1333 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPDATACONFIG_STOPBITS, "ERROR, CDpDataConfig::StopBits, Unsupported StopBits: %hhu", aStopBits );
|
|
1334 |
|
|
1335 |
ret = KErrNotSupported;
|
|
1336 |
}
|
|
1337 |
}
|
|
1338 |
|
|
1339 |
return ret;
|
|
1340 |
}
|
|
1341 |
|
|
1342 |
// ---------------------------------------------------------
|
|
1343 |
// CDpDataConfig::Parity
|
|
1344 |
// Solves out the parity bit
|
|
1345 |
// ---------------------------------------------------------
|
|
1346 |
//
|
|
1347 |
TInt CDpDataConfig::Parity(
|
|
1348 |
TCommConfigV01& aConfig,
|
|
1349 |
TUint8& aParity )
|
|
1350 |
{
|
|
1351 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_PARITY, "CDpDataConfig::Parity" );
|
|
1352 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPDATACONFIG_PARITY, "CDpDataConfig::Parity: %hhu", aParity );
|
|
1353 |
|
|
1354 |
LOGM1(" CDpDataConfig::Parity, Parity: %d.", aParity );
|
|
1355 |
|
|
1356 |
TInt ret( KErrNone );
|
|
1357 |
|
|
1358 |
switch ( aConfig.iParity )
|
|
1359 |
{
|
|
1360 |
case EParityNone:
|
|
1361 |
{
|
|
1362 |
aParity = PEP_COMM_PARITY_NONE;
|
|
1363 |
break;
|
|
1364 |
}
|
|
1365 |
case EParityEven:
|
|
1366 |
{
|
|
1367 |
aParity = PEP_COMM_PARITY_EVEN;
|
|
1368 |
break;
|
|
1369 |
}
|
|
1370 |
case EParityOdd:
|
|
1371 |
{
|
|
1372 |
aParity = PEP_COMM_PARITY_ODD;
|
|
1373 |
break;
|
|
1374 |
}
|
|
1375 |
case EParityMark:
|
|
1376 |
{
|
|
1377 |
aParity = PEP_COMM_PARITY_MARK;
|
|
1378 |
break;
|
|
1379 |
}
|
|
1380 |
case EParitySpace:
|
|
1381 |
{
|
|
1382 |
aParity = PEP_COMM_PARITY_SPACE;
|
|
1383 |
break;
|
|
1384 |
}
|
|
1385 |
default:
|
|
1386 |
{
|
|
1387 |
LOG1(" ERROR, CDpDataConfig::Parity, Unsupported parity: %d.",
|
|
1388 |
aParity );
|
|
1389 |
OstTraceExt1( TRACE_NORMAL, DUP2_CDPDATACONFIG_PARITY, "ERROR, CDpDataConfig::Parity, Unsupported parity: %hhu", aParity );
|
|
1390 |
|
|
1391 |
ret = KErrNotSupported;
|
|
1392 |
}
|
|
1393 |
}
|
|
1394 |
|
|
1395 |
return ret;
|
|
1396 |
}
|
|
1397 |
|
|
1398 |
// ---------------------------------------------------------
|
|
1399 |
// CDpDataConfig::HandleDteSignalMapping
|
|
1400 |
// Maps the DTE type signals.
|
|
1401 |
// ---------------------------------------------------------
|
|
1402 |
//
|
|
1403 |
void CDpDataConfig::HandleDteSignalMapping(
|
|
1404 |
const TUint aSignals,
|
|
1405 |
TDes8& aData )
|
|
1406 |
{
|
|
1407 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_HANDLEDTESIGNALMAPPING, "CDpDataConfig::HandleDteSignalMapping" );
|
|
1408 |
OstTrace1( TRACE_NORMAL, DUP1_CDPDATACONFIG_HANDLEDTESIGNALMAPPING, "CDpDataConfig:: aSignals: %u\n", aSignals );
|
|
1409 |
OstTrace1( TRACE_NORMAL, DUP2_CDPDATACONFIG_HANDLEDTESIGNALMAPPING, "CDpDataConfig:: aHandshake: %u\n", iConfig.iHandshake );
|
|
1410 |
|
|
1411 |
LOGM(" CDpDataConfig::HandleDteSignalMapping");
|
|
1412 |
LOG1(" HandleDteSignalsMapping - aSignals: %x\n", aSignals );
|
|
1413 |
LOG1(" HandleDteSignalsMapping - aHandshake: %x\n", iConfig.iHandshake );
|
|
1414 |
|
|
1415 |
TUint8 state( 0 );
|
|
1416 |
|
|
1417 |
if ( ( iConfig.iHandshake & KConfigFreeDTR ) )
|
|
1418 |
{
|
|
1419 |
LOG(" CDpDataConfig::HandleDteSignalMapping, iConfig.iHandshake & KConfigFreeDTR == TRUE");
|
|
1420 |
OstTrace0( TRACE_NORMAL, DUP3_CDPDATACONFIG_HANDLEDTESIGNALMAPPING, "CDpDataConfig:: iConfig.iHandshake and KConfigFreeDTR == TRUE" );
|
|
1421 |
|
|
1422 |
// This is little bit simplified. Win2000 doesn't send DTR signal properly
|
|
1423 |
if ( ( aSignals & KDTRChanged ) )
|
|
1424 |
{
|
|
1425 |
if ( aSignals & KSignalDTR )
|
|
1426 |
{
|
|
1427 |
LOG(" DTR signal ON");
|
|
1428 |
OstTrace0( TRACE_NORMAL, DUP4_CDPDATACONFIG_HANDLEDTESIGNALMAPPING, "CDpDataConfig:: DTR signal ON" );
|
|
1429 |
|
|
1430 |
state = PEP_COMM_SIGNAL_DTR_ON;
|
|
1431 |
}
|
|
1432 |
else
|
|
1433 |
{
|
|
1434 |
LOG(" DTR signal OFF");
|
|
1435 |
OstTrace0( TRACE_NORMAL, DUP5_CDPDATACONFIG_HANDLEDTESIGNALMAPPING, "CDpDataConfig:: DTR signal OFF" );
|
|
1436 |
|
|
1437 |
state = PEP_COMM_SIGNAL_DTR_OFF;
|
|
1438 |
}
|
|
1439 |
}
|
|
1440 |
}
|
|
1441 |
//no else
|
|
1442 |
|
|
1443 |
aData.Append( state );
|
|
1444 |
}
|
|
1445 |
|
|
1446 |
// ---------------------------------------------------------
|
|
1447 |
// CDpDataConfig::HandleDceSignalMapping
|
|
1448 |
// Maps the DCE type signals
|
|
1449 |
// ---------------------------------------------------------
|
|
1450 |
//
|
|
1451 |
void CDpDataConfig::HandleDceSignalMapping(
|
|
1452 |
const TUint aSignals,
|
|
1453 |
TDes8& aData )
|
|
1454 |
{
|
|
1455 |
OstTrace0( TRACE_NORMAL, CDPDATACONFIG_HANDLEDCESIGNALMAPPING, "CDpDataConfig::HandleDceSignalMapping" );
|
|
1456 |
LOGM(" CDpDataConfig::HandleDceSignalMapping");
|
|
1457 |
|
|
1458 |
TUint8 state( 0 );
|
|
1459 |
|
|
1460 |
if ( ( iConfig.iHandshake & KConfigFreeDSR ) )
|
|
1461 |
{
|
|
1462 |
if ( ( ( aSignals & KSignalDSR) != (iSignals & KSignalDSR) ) ||
|
|
1463 |
( ( aSignals & KDSRChanged ) && ( aSignals & KSignalDSR ) ) )
|
|
1464 |
{
|
|
1465 |
if ( aSignals & KSignalDSR )
|
|
1466 |
{
|
|
1467 |
state |= PEP_COMM_SIGNAL_DSR_ON;
|
|
1468 |
}
|
|
1469 |
else
|
|
1470 |
{
|
|
1471 |
state |= PEP_COMM_SIGNAL_DSR_OFF;
|
|
1472 |
}
|
|
1473 |
}
|
|
1474 |
//no else
|
|
1475 |
}
|
|
1476 |
//no else
|
|
1477 |
|
|
1478 |
if ( ( iConfig.iHandshake & KConfigFreeDCD ) )
|
|
1479 |
{
|
|
1480 |
if ( ( ( aSignals & KSignalDCD ) != (iSignals & KSignalDCD) ) ||
|
|
1481 |
( ( aSignals & KDCDChanged ) && ( aSignals & KSignalDCD) ) )
|
|
1482 |
{
|
|
1483 |
if ( aSignals & KSignalDCD )
|
|
1484 |
{
|
|
1485 |
state |= PEP_COMM_SIGNAL_DCD_ON;
|
|
1486 |
}
|
|
1487 |
else
|
|
1488 |
{
|
|
1489 |
state |= PEP_COMM_SIGNAL_DCD_OFF;
|
|
1490 |
}
|
|
1491 |
}
|
|
1492 |
//no else
|
|
1493 |
}
|
|
1494 |
//no else
|
|
1495 |
|
|
1496 |
if ( ( iConfig.iHandshake & KConfigFreeRI ) )
|
|
1497 |
{
|
|
1498 |
if ( ( ( aSignals & KSignalRNG ) != ( iSignals & KSignalRNG ) ) ||
|
|
1499 |
( ( aSignals & KRNGChanged ) && ( aSignals & KSignalRNG) ) )
|
|
1500 |
{
|
|
1501 |
if ( aSignals & KSignalRNG )
|
|
1502 |
{
|
|
1503 |
state |= PEP_COMM_SIGNAL_RI_ON;
|
|
1504 |
}
|
|
1505 |
else
|
|
1506 |
{
|
|
1507 |
state |= PEP_COMM_SIGNAL_RI_OFF;
|
|
1508 |
}
|
|
1509 |
}
|
|
1510 |
//no else
|
|
1511 |
}
|
|
1512 |
//no else
|
|
1513 |
|
|
1514 |
aData.Append( state );
|
|
1515 |
}
|
|
1516 |
|
|
1517 |
// OTHER EXPORTED FUNCTIONS
|
|
1518 |
// none
|
|
1519 |
|
|
1520 |
// End of File
|