bluetooth/btcomm/src/btcomm.cpp
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <bluetooth/logger.h>
       
    17 #include <cs_port.h>
       
    18 #include "btcomm.h"
       
    19 #include "btstate.h"
       
    20 
       
    21 #ifdef __FLOG_ACTIVE
       
    22 _LIT8(KLogComponent, LOG_COMPONENT_BT_COMM);
       
    23 #endif
       
    24 
       
    25 //**********************************************************************
       
    26 //			            BTCOMM CSY ENTRY POINT CODE
       
    27 //**********************************************************************
       
    28 
       
    29 extern "C"
       
    30 	{
       
    31 	IMPORT_C CSerial* LibEntry();	// Force export 
       
    32 	}
       
    33 
       
    34 EXPORT_C CSerial* LibEntry()
       
    35 /**
       
    36 	Lib main entry point.
       
    37 **/
       
    38 	{
       
    39 	CBTPortFactory* c=NULL;
       
    40 	TRAPD(ret,c=CBTPortFactory::NewL());
       
    41 	if (ret!=KErrNone)
       
    42 		return NULL;
       
    43 	return c;
       
    44 	}
       
    45 
       
    46 
       
    47 
       
    48 //**********************************************************************
       
    49 //			            BTCOMM PORT FACTORY CODE
       
    50 //**********************************************************************
       
    51 
       
    52 #pragma warning (disable : 4100)  // Unreferenced formal parameter
       
    53 
       
    54 static void CleanupCObject(TAny* aCObject)
       
    55 /**
       
    56 	Clean up a CObject.
       
    57 	This static callback is invoked upon destruction of factory 
       
    58 	by c32 to close it down.
       
    59 **/
       
    60     {
       
    61 	LOG_STATIC_FUNC
       
    62     ((CObject*)aCObject)->Close();
       
    63     }
       
    64 
       
    65 CPort* CBTPortFactory::NewPortL(const TUint aUnit)
       
    66 /**
       
    67 	CBTPortFactory NewPortL.
       
    68 	Create a new port for the supplied unit number.
       
    69 **/
       
    70 	{
       
    71 	LOG_FUNC
       
    72 	__ASSERT_ALWAYS(aUnit<=KCommHighUnit,User::Leave(KErrNotSupported));
       
    73 	// need to pass the factory instance through to the port.
       
    74 	CBTPort *port=CBTPort::NewL(aUnit,iPortStateFactory);
       
    75 	return port;
       
    76 	}
       
    77 
       
    78 void CBTPortFactory::Info(TSerialInfo& aSerialInfo)
       
    79 /**
       
    80 	Fill in the supplied structure.
       
    81 **/
       
    82 	{
       
    83 	LOG_FUNC
       
    84 	aSerialInfo.iDescription=SERIAL_DESCRIPTION;
       
    85 	aSerialInfo.iName=SERIAL_NAME;
       
    86 	aSerialInfo.iLowUnit=KCommLowUnit;
       
    87 	aSerialInfo.iHighUnit=KCommHighUnit;
       
    88 	}
       
    89 
       
    90 void CBTPortFactory::ConstructL()
       
    91 /**
       
    92 	Construct CBTPort Factory.
       
    93 	Also construct the CBTPortStateFactory here too.
       
    94 **/
       
    95 	{
       
    96 	CONNECT_LOGGER
       
    97 	LOG_FUNC
       
    98 
       
    99 	iPortStateFactory=CBTPortStateFactory::NewL();
       
   100 	TName name(SERIAL_NAME);
       
   101 	SetNameL(&name);
       
   102 	}
       
   103 
       
   104 CBTPortFactory* CBTPortFactory::NewL()
       
   105 /**
       
   106 	Create new CBTPortFactory.
       
   107 	This factory is derived from CSerial.
       
   108 	Corresponds to the BTCOMM in BTCOMM::0 etc.
       
   109 **/
       
   110 	{
       
   111 	LOG_STATIC_FUNC
       
   112 	CBTPortFactory* c=new(ELeave) CBTPortFactory;
       
   113 	CleanupStack::PushL(TCleanupItem(CleanupCObject, c));
       
   114 	c->ConstructL();
       
   115 	CleanupStack::Pop();
       
   116 	return c;
       
   117 	}
       
   118 
       
   119 CBTPortFactory::CBTPortFactory()
       
   120 /**
       
   121 	CBTPortFactory c'tor.
       
   122 **/
       
   123 	{
       
   124 	LOG_FUNC
       
   125 //	iVersion=TVersion(KMajorVersion,KMinorVersion,KBuild);
       
   126 	}
       
   127 
       
   128 CBTPortFactory::~CBTPortFactory()
       
   129 /**
       
   130 	CBTPortFactory destructor.
       
   131 **/
       
   132 	{
       
   133 	LOG_FUNC
       
   134 	delete iPortStateFactory;
       
   135 
       
   136 	CLOSE_LOGGER
       
   137 	}
       
   138 
       
   139 TSecurityPolicy CBTPortFactory::PortPlatSecCapability (TUint /**aPort*/) const
       
   140 	//return the security policy for the given port number, aPort.  All the ports
       
   141 	//are treated the same so always return a security policy defining local services
       
   142 	{
       
   143 	LOG_FUNC
       
   144 	return TSecurityPolicy(ECapabilityLocalServices);	
       
   145 	}
       
   146 //**********************************************************************
       
   147 //			            BTCOMM PORT CODE
       
   148 //**********************************************************************
       
   149 
       
   150 CBTPort::CBTPort()
       
   151 /**
       
   152 	C'Tor sets-up the TCommconfigV01 and TCommCapsV02 structs of the CSY.
       
   153 **/
       
   154 	{
       
   155 	LOG_FUNC
       
   156 
       
   157 	iConfig.iRate            = EBps9600;
       
   158 	iConfig.iDataBits        = EData8;
       
   159 	iConfig.iStopBits        = EStop1;
       
   160 	iConfig.iParity          = EParityNone;
       
   161 	iConfig.iFifo            = EFifoEnable;
       
   162 	iConfig.iHandshake       = 0;	// KConfigObeyCTS
       
   163 	iConfig.iParityError     = KConfigParityErrorIgnore;
       
   164 	iConfig.iSIREnable       = ESIRDisable;
       
   165 	iConfig.iTerminatorCount = 0;
       
   166 	iConfig.iXonChar         = 0x11; // XON
       
   167 	iConfig.iXoffChar        = 0x13; // XOFF
       
   168 	iConfig.iSpecialRate     = 0;
       
   169 	iConfig.iParityErrorChar = 0;
       
   170 
       
   171 	// set CSY TCommCapsV02 capabilities struct
       
   172 	iCaps.iRate              = KCapsBps9600;
       
   173 	iCaps.iDataBits          = KCapsData8;
       
   174 	iCaps.iStopBits          = KCapsStop1;
       
   175 	iCaps.iParity            = KCapsParityNone;
       
   176 	iCaps.iHandshake         = 0;
       
   177 	iCaps.iSignals           = 0;
       
   178 	iCaps.iFifo              = KCapsHasFifo;
       
   179 	iCaps.iSIR               = 0;
       
   180 	iCaps.iNotificationCaps  = 0;		
       
   181 	iCaps.iRoleCaps          = 0;
       
   182 	iCaps.iFlowControlCaps   = 0;
       
   183 	}
       
   184 
       
   185 CBTPort* CBTPort::NewL(TUint aUnit,CBTPortStateFactory* aFactory)
       
   186 /**
       
   187 	CBTPort NewL, make a new CPort for the Comm server.
       
   188 	This port is derived from CPort. This CBTPort is used by 
       
   189 	the Comms server to serve all the client RComm requests. 
       
   190 							
       
   191 	@param		aUnit		Corresponds to the digit in BTCOMM::0 etc.
       
   192 							Note that each digit corresponds to a different
       
   193 							legacy CSY port.  
       
   194 	@param		aFactory    Is the factory object used to reach each state
       
   195 */
       
   196 	{
       
   197 	LOG_STATIC_FUNC
       
   198 	CBTPort* p=new(ELeave) CBTPort;
       
   199 	CleanupStack::PushL(TCleanupItem(CleanupCObject, p));
       
   200 	p->ConstructL(aUnit,aFactory);
       
   201     CleanupStack::Pop();
       
   202 	return p;
       
   203 	}
       
   204 
       
   205 void CBTPort::ConstructL(TUint aUnit,CBTPortStateFactory* aFactory)
       
   206 /**
       
   207 	ConstructL(..) is the second phase construction of CBTPort.
       
   208 	  
       
   209 	This sets the CSY role to DTE, instantiates the state machine and 
       
   210 	registers the CPort name to whatever the aUnit is.
       
   211 	
       
   212 	@param	aUnit		is the virtual BTComm port number
       
   213 	@param	aFactory	is the state machine factory used to access the 
       
   214 						proxy states
       
   215 **/
       
   216 	{
       
   217 	LOG_FUNC
       
   218 	iRole=ECommRoleDTE;	// set to DTE by default.
       
   219 	iPortProxy=CBTPortProxy::NewL(TUint32(aUnit),this,aFactory);
       
   220 	TName name;
       
   221 	name.Format(_L("%d"), aUnit);
       
   222 	SetNameL(&name);
       
   223 	}
       
   224 
       
   225 CBTPort::~CBTPort()
       
   226 /**
       
   227 	The CBTPort destructor is either invoked immediately from destruct or
       
   228 	via deferred deletion mechanism via the "active shutterdowner".
       
   229 **/
       
   230 	{
       
   231 	LOG_FUNC
       
   232 	delete iPortProxy;
       
   233 	}
       
   234 
       
   235 void CBTPort::Destruct()
       
   236 /**
       
   237 	CBTPort Destruct, is invoked by c32 to destroy the port.  	
       
   238 
       
   239 	At this point it is necessary to either destroy the port immediately or 
       
   240 	invoke a deferred deletion "active shutterdowner" mechanism.
       
   241 **/
       
   242 	{
       
   243 	LOG_FUNC
       
   244 
       
   245 	if (iPortProxy)
       
   246 		iPortProxy->Close();
       
   247 	}
       
   248 
       
   249 void CBTPort::DestructNow()
       
   250 /**
       
   251 	To be called by CBTPortProxy to signal the shutdown.
       
   252 */
       
   253 	{
       
   254 	LOG_FUNC
       
   255 	delete this;
       
   256 	}
       
   257 
       
   258 void CBTPort::StartRead(const TAny* aClientBuffer,TInt aLength)
       
   259 /**
       
   260 	Reads any inbound data into the client buffer supplied.
       
   261 	
       
   262 	The read is passed over to the CBTPortProxy for completion and when it is 
       
   263 	eventually completed to RFComm; read completion is signalled to the client
       
   264 	by invoking the CPort::ReadCompleted mechanism.
       
   265 
       
   266 	@param	aClientBuffer	is the pointer to the client buffer to be filled
       
   267 	@param	aLength			the desired amount of bytes to be filled in the buffer
       
   268 **/
       
   269 	{
       
   270 	LOG_FUNC
       
   271 	iPortProxy->Read(aClientBuffer,aLength);
       
   272 	}
       
   273 
       
   274 void CBTPort::ReadCancel()
       
   275 /**
       
   276 	Cancels the pending read.
       
   277 **/
       
   278 	{
       
   279 	LOG_FUNC
       
   280 	iPortProxy->ReadCancel();
       
   281 	}
       
   282 
       
   283 TInt CBTPort::QueryReceiveBuffer(TInt& aLength) const
       
   284 /**
       
   285 	Retrieval of the number of bytes waiting in the receive buffer.
       
   286 	
       
   287 	@param		aLength		is set to zero
       
   288 	@return		KErrNone
       
   289 */
       
   290 	{
       
   291 	LOG_FUNC
       
   292 	return iPortProxy->QueryReceiveBuffer(aLength);
       
   293 	}
       
   294 
       
   295 void CBTPort::ResetBuffers(TUint aFlags)
       
   296 /**
       
   297 	Resets the Rx buffers, does nothing about the Tx buffer.
       
   298 	The reason why we don't do anything about the Tx buffer is 
       
   299 	because the CSY passes the client data straight to ESock.
       
   300 
       
   301 	@param aFlags may be KCommResetRx, KCommResetTx or KCommResetRx|KCommResetTx
       
   302 **/
       
   303 	{
       
   304 	LOG_FUNC
       
   305 	if((aFlags==KCommResetTx)||(aFlags==0)) //only
       
   306 		{
       
   307 		return; //nothing to do
       
   308 		}
       
   309 	iPortProxy->ResetRxBuffer();// holds true for the case > KCommResetRx|KCommResetTx
       
   310 								// as well, since we cannot signal the client
       
   311 	}
       
   312 
       
   313 void CBTPort::StartWrite(const TAny* aClientBuffer, TInt aLength)
       
   314 /**
       
   315 	Uses the supplied buffer to read out data from. 
       
   316 	These data are destined to be send to the RFComm layer of the Bluetooth stack.
       
   317 
       
   318 	@param	aClientBuffer	the pointer to the clients buffer from which to read from
       
   319 	@param	aLength			the number of desired bytes to be read out.
       
   320 */
       
   321 	{
       
   322 	LOG_FUNC
       
   323 	iPortProxy->Write(aClientBuffer,aLength);
       
   324 	}
       
   325 
       
   326 void CBTPort::WriteCancel()
       
   327 /**
       
   328 	Cancels the last requested Write if possible.
       
   329 */
       
   330 	{
       
   331 	LOG_FUNC
       
   332 	iPortProxy->WriteCancel();
       
   333 	}
       
   334 
       
   335 void CBTPort::Break(TInt /*aTime*/)
       
   336 /** 
       
   337 	CBTPort Break is Not supported.
       
   338 **/
       
   339 	{
       
   340 	LOG_FUNC
       
   341 	}
       
   342 
       
   343 void CBTPort::BreakCancel()
       
   344 /** 
       
   345 	CBTPort BreakCancel is not supported.
       
   346 **/
       
   347 	{
       
   348 	LOG_FUNC
       
   349 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* BreakCancel *) used by client"));
       
   350 	}
       
   351 
       
   352 TInt CBTPort::GetConfig(TDes8& aPackage) const
       
   353 /**
       
   354 	CBTPort GetConfig gives the CSY's configuration TCommConfigV01 to the client.
       
   355 
       
   356 	@param	aPackage	is the packaged TCommConfigV01 supplied by the client, to be filled.
       
   357 	@return		KErrNone always
       
   358 */
       
   359 	{
       
   360 	LOG_FUNC
       
   361     // copy back local iConfig
       
   362 	aPackage.FillZ();
       
   363     TPckg<TCommConfigV01> cfg(iConfig);
       
   364 	aPackage.Copy(cfg);
       
   365 	return KErrNone;
       
   366 	}
       
   367 
       
   368 TInt CBTPort::SetConfig(const TDesC8& aPackage)
       
   369 /**
       
   370 	CBTPort SetConfig allows for the configuration of the CSY.
       
   371 	Currently the only configuration which is allowed and is meaningful, is the
       
   372 	configuration associated with terminated reads; the rest are not honoured.
       
   373 
       
   374 	@param aPackage		is a packaged TCommConfigV01 struct.
       
   375 	@return		KErrNone or KErrNotSupported if the terminator count is 
       
   376 				greater than KConfigMaxTerminators
       
   377 	
       
   378 */
       
   379 	{
       
   380 	LOG_FUNC
       
   381     TCommConfigV01 c;
       
   382     Mem::FillZ(&c,sizeof(c));
       
   383 	TInt len=Min(aPackage.Length(),sizeof(c));
       
   384 	Mem::Copy(&c, aPackage.Ptr(),len);
       
   385 	if(c.iTerminatorCount)
       
   386 		{
       
   387 		if (c.iTerminatorCount>KConfigMaxTerminators)
       
   388 			{
       
   389 			return KErrNotSupported;
       
   390 			}
       
   391 		else
       
   392 			{
       
   393 			iPortProxy->iTerminatedReads=ETrue;
       
   394 			iPortProxy->iTerm.iTerminatorCount=c.iTerminatorCount;
       
   395 			for (TInt i=0;i<c.iTerminatorCount;i++)
       
   396 				{
       
   397 				iPortProxy->iTerm.iTerminatorChars[i]=c.iTerminator[i];
       
   398 				}
       
   399 			}
       
   400 		}
       
   401 	else
       
   402 		{
       
   403 		iPortProxy->iTerminatedReads=EFalse;
       
   404 		}
       
   405 	iConfig=c;
       
   406 	return KErrNone;
       
   407 	}
       
   408 
       
   409 TInt CBTPort::SetServerConfig(const TDesC8& /*aTCommServerConfigV01-Package*/)
       
   410 /** 
       
   411 	CBTPort SetServerConfig is not supported.
       
   412 	SetServerConfig is otherwise used to mandate the buffering strategy within 
       
   413 	the CSY. The Bluetooth CSY uses it's own buffering startegy which is not
       
   414 	exposed to the client nor it is reconfigurable by it.
       
   415 	
       
   416 	@return KErrNotSupported
       
   417 **/
       
   418 	{
       
   419 	LOG_FUNC
       
   420 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* SetServerConfig *) used by client"));
       
   421 	return KErrNotSupported;
       
   422 	}
       
   423 
       
   424 TInt CBTPort::GetServerConfig(TDes8& /*aPackage*/)
       
   425 /**
       
   426 	CBTPort GetServerConfig is not supported
       
   427 
       
   428 	@return KErrNotSupported
       
   429 **/
       
   430 	{
       
   431 	LOG_FUNC
       
   432 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* GetServerConfig *)  used by client"));
       
   433 	return KErrNotSupported;
       
   434 	}
       
   435 
       
   436 TInt CBTPort::GetCaps(TDes8& aPackage)
       
   437 /**
       
   438 	Get current Bluetooth CSY serial port emulation capabilities.
       
   439 	Capabilities are defined in c32comm.h.
       
   440 
       
   441 	@param aPackage		can either be a packaged TCommCapsV01 or TCommCapsV02
       
   442 	@return				KErrNone
       
   443 */
       
   444 	{
       
   445 	LOG_FUNC
       
   446     aPackage.FillZ();
       
   447 	TPckg<TCommCapsV02> caps(iCaps);
       
   448 	TInt len=Min(caps.Length(),aPackage.Length());
       
   449 	//to be on the safe side just in case the package is v01
       
   450 	aPackage.Copy(caps.Left(len));
       
   451 	return KErrNone;
       
   452 	}
       
   453 
       
   454 TInt CBTPort::GetSignals(TUint& /*aSignals*/)
       
   455 /**
       
   456 	GetSignal is not supported.
       
   457 	Would otherwise gets current signal emulation states.
       
   458 
       
   459 	@return		KErrNotSupported
       
   460 */
       
   461 	{
       
   462 	//	Signals are set as follows (from c32comm.h):
       
   463 	//	KSignalCTS, KSignalDSR, KSignalDCD, KSignalRNG, KSignalRTS, KSignalDTR.
       
   464 
       
   465 	LOG_FUNC
       
   466 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* GetSignals *) used by client"));
       
   467 	return KErrNotSupported;
       
   468 	}
       
   469 
       
   470 TInt CBTPort::SetSignalsToMark(TUint /*aSignals*/)
       
   471 /**
       
   472 	SetSignalsToMark is not supported.
       
   473 
       
   474 	@return		KErrNotSupported
       
   475 **/
       
   476 	{
       
   477 	// Set signals to Mark (high).
       
   478 	// Signals are defined as follows (from c32comm.h):
       
   479 	// KSignalCTS, KSignalDSR, KSignalDCD, KSignalRNG, KSignalRTS, KSignalDTR.
       
   480 
       
   481 	LOG_FUNC
       
   482 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* SetSignalsToMark *) used by client"));
       
   483 	return KErrNotSupported;
       
   484 	}
       
   485 
       
   486 TInt CBTPort::SetSignalsToSpace(TUint /*aSignals*/)
       
   487 /**
       
   488 	Set Signals to Space is not supported.
       
   489 	
       
   490 	@return KErrNotSupported
       
   491 **/
       
   492 	{
       
   493 	LOG_FUNC
       
   494 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* SetSignalsToSpace *) used by client"));
       
   495 	//	Signals are defined as follows (from c32comm.h):
       
   496 	//	KSignalCTS, KSignalDSR, KSignalDCD, KSignalRNG, KSignalRTS, KSignalDTR.
       
   497 
       
   498 	return KErrNotSupported;
       
   499 	}
       
   500 
       
   501 TInt CBTPort::SetReceiveBufferLength(TInt /*aLength*/)
       
   502 /**
       
   503 	Setting of the  receiver buffer length is not allowed.
       
   504 
       
   505 	@return KErrNotSupported
       
   506 **/
       
   507 	{
       
   508 	LOG_FUNC
       
   509 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* SetReceiveBufferLength *) used by client"));
       
   510 	return KErrNotSupported;
       
   511 	}
       
   512 
       
   513 TInt CBTPort::GetReceiveBufferLength(TInt& aLength) const
       
   514 /**
       
   515 	Assigns to the parameter the max length of the CSY's receive buffer.
       
   516 
       
   517 	@param		aLength		the max size of the receive buffer in the CSY
       
   518 	@return		KErrNone or an appropriate error code
       
   519 */
       
   520 	{
       
   521 	LOG_FUNC
       
   522 	return iPortProxy->GetReceiveBufferLength(aLength);
       
   523 	}
       
   524 
       
   525 void CBTPort::FreeMemory()
       
   526 /**
       
   527 	CBTPort FreeMemory, this function is called by nothing and is not supported.
       
   528 **/
       
   529 	{
       
   530 	LOG_FUNC
       
   531 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* FreeMemory *) used by client"));
       
   532 	}
       
   533 
       
   534 //*********************** EXTRAS FOR C32 v6 ************************
       
   535 
       
   536 void CBTPort::NotifySignalChange(TUint /*aChange*/)
       
   537 /**
       
   538 	Signal Change Notification is not supported by the Bluetooth CSY.
       
   539 	RComm::Caps(..) should be called to read the CSY's capabilities,
       
   540 	which indicate that notification is not supported.
       
   541 */
       
   542 	{
       
   543 	LOG_FUNC
       
   544 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* NotifySignalChange *) used by client"));
       
   545 	}
       
   546 
       
   547 
       
   548 void CBTPort::NotifySignalChangeCancel(void)
       
   549 /**
       
   550 	Notify Signal Change Cancel is not supported.
       
   551 	RComm::Caps(..) should be called to read the CSY's capabilities,
       
   552 	which indicate that notification is not supported.
       
   553 
       
   554 	Note:	this method may be called implicitly by RComm::Cancel and will
       
   555 			have no effect.
       
   556 
       
   557 */
       
   558 	{
       
   559 	LOG_FUNC
       
   560 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* NotifySignalChangeCancel *) used by client"));
       
   561 	}
       
   562 
       
   563 void CBTPort::NotifyConfigChange(void)
       
   564 /**
       
   565 	NotifyConfigChange is not supported.
       
   566 	RComm::Caps(..) should be called to read the CSY's capabilities,
       
   567 	which indicate that notification is not supported.
       
   568 */
       
   569 	{
       
   570 	LOG_FUNC
       
   571 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* NotifyConfigChange *) used by client"));
       
   572 	}
       
   573 
       
   574 void CBTPort::NotifyConfigChangeCancel(void)
       
   575 /**
       
   576 	NotifyConfigChangeCancel is not supported.
       
   577 	RComm::Caps(..) should be called to read the CSY's capabilities,
       
   578 	which indicate that notification is not supported.
       
   579 
       
   580   	Note:	this method may be called implicitly by RComm::Cancel and will
       
   581 			have no effect.
       
   582 
       
   583 */
       
   584 	{
       
   585 	LOG_FUNC
       
   586 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* NotifyConfigChangeCancel *) used by client"));
       
   587 	}
       
   588 
       
   589 void CBTPort::NotifyFlowControlChange(void)
       
   590 /**
       
   591 	NotifyFlowControlChange is not supported.
       
   592 	RComm::Caps(..) should be called to read the CSY's capabilities,
       
   593 	which indicate that notification is not supported.
       
   594 
       
   595 */
       
   596 	{
       
   597 	LOG_FUNC
       
   598 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* NotifyFlowControlChange *) used by client"));
       
   599 	}
       
   600 
       
   601 void CBTPort::NotifyFlowControlChangeCancel(void)
       
   602 /**
       
   603 	NotifyFlowControlChangeCancel is not supported.
       
   604 	RComm::Caps(..) should be called to read the CSY's capabilities,
       
   605 	which indicate that notification is not supported.
       
   606 
       
   607 	Note:	this method may be called implicitly by RComm::Cancel and will
       
   608 			have no effect.
       
   609 
       
   610 */
       
   611 	{
       
   612 	LOG_FUNC
       
   613 	LOG(_L("CBTPort: [WARNING] Non-implemented feature  (* NotifyFlowControlChangeCancel *) used by client"));
       
   614 	}
       
   615 
       
   616 void CBTPort::NotifyBreak(void)
       
   617 /**
       
   618 	Notify Break is not supported.
       
   619 	RComm::Caps(..) should be called to read the CSY's capabilities,
       
   620 	which indicate that notification is not supported.
       
   621 */
       
   622 	{
       
   623 	LOG_FUNC
       
   624 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* NotifyBreak *) used by client"));
       
   625 	}
       
   626 
       
   627 void CBTPort::NotifyBreakCancel(void)
       
   628 /**
       
   629 	NotifyBreakCancel is not supported.
       
   630 	RComm::Caps(..) should be called to read the CSY's capabilities,
       
   631 	which indicate that notification is not supported.
       
   632 
       
   633 	Note:	this method may be called implicitly by RComm::Cancel and will
       
   634 			have no effect.
       
   635   
       
   636 */
       
   637 	{
       
   638 	LOG_FUNC
       
   639 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* NotifyBreakCancel *) used by client"));
       
   640 	}
       
   641 
       
   642 void CBTPort::NotifyDataAvailable(void)
       
   643 /**
       
   644 	NotifyDataAvailable is not supported.
       
   645 	RComm::Caps(..) should be called to read the CSY's capabilities,
       
   646 	which indicate that notification is not supported.
       
   647 */
       
   648 	{
       
   649 	LOG_FUNC
       
   650 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* NotifyDataAvailable *) used by client"));
       
   651 	}
       
   652 
       
   653 void CBTPort::NotifyDataAvailableCancel(void)
       
   654 /**
       
   655 	NotifyDataAvailableCancel is not supported.
       
   656 	RComm::Caps(..) should be called to read the CSY's capabilities,
       
   657 	which indicate that notification is not supported.
       
   658 
       
   659 	Note:	this method may be called implicitly by RComm::Cancel and will
       
   660 			have no effect.
       
   661 
       
   662 */
       
   663 	{
       
   664 	LOG_FUNC
       
   665 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* NotifyDataAvailableCancel *)used by client"));
       
   666 	}
       
   667 
       
   668 void CBTPort::NotifyOutputEmpty(void)
       
   669 /**
       
   670 	NotifyOutputEmptyIndication is not supported.
       
   671 	RComm::Caps(..) should be called to read the CSY's capabilities,
       
   672 	which indicate that notification is not supported.
       
   673 */
       
   674 	{
       
   675 	LOG_FUNC
       
   676 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* NotifyOutputEmpty *) used by client"));
       
   677 	}
       
   678 
       
   679 void CBTPort::NotifyOutputEmptyCancel(void)
       
   680 /**
       
   681 	NotifyOutputEmptyCancel.
       
   682 	RComm::Caps(..) should be called to read the CSY's capabilities,
       
   683 	which indicate that notification is not supported.
       
   684 
       
   685 	Note:	this method may be called implicitly by RComm::Cancel and will
       
   686 			have no effect.
       
   687   
       
   688 */
       
   689 	{
       
   690 	LOG_FUNC
       
   691 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* NotifyOutputEmptyCancel *) used by client"));
       
   692 	}
       
   693 
       
   694 TInt CBTPort::GetFlowControlStatus(TFlowControl& /*aFlowControl*/)
       
   695 /**
       
   696 	Getting of serial port emulation flow control status is not supported.
       
   697 
       
   698 	@return KErrNotSupported
       
   699 **/
       
   700 	{
       
   701 	LOG_FUNC
       
   702 	LOG(_L("CBTPort: [WARNING] Non-implemented feature (* GetFlowControlStatus *) used by client"));
       
   703 	return KErrNotSupported;
       
   704 	}
       
   705 
       
   706 TInt CBTPort::GetRole(TCommRole& aRole)
       
   707 /**
       
   708 	Get serial port emulation mode.
       
   709 	Options in general are: ECommRoleDTE or ECommRoleDCE but the Bluetooth CSY
       
   710 	only supports the DTE role, hence aRole will always be set to DTE for now.
       
   711 **/
       
   712 	{
       
   713 	LOG_FUNC
       
   714 	aRole=iRole;
       
   715 	return KErrNone;
       
   716 	}
       
   717 
       
   718 TInt CBTPort::SetRole(TCommRole aRole)
       
   719 /**
       
   720 	Set serial port emulation mode, options are: ECommRoleDTE only.
       
   721 	If the client tries to open the RComm session as a DCE then the client call
       
   722 	will cause a Leave in CPort::DoOpenL(..), this will subsequently be traped
       
   723 	and the error will be propagated to the client (which may Panic with a 
       
   724 	EReqActiveObjectLeave if the error doesn't get handled).
       
   725 
       
   726 	@param		aRole	should be ECommRoleDTE
       
   727 	@return		KErrNone or KErrNotSupported
       
   728 */
       
   729 	{
       
   730 	LOG_FUNC
       
   731 	if(aRole==ECommRoleDTE)
       
   732 		{
       
   733 		iRole=aRole;
       
   734 		return KErrNone;
       
   735 		}
       
   736 	return KErrNotSupported;
       
   737 	}
       
   738 
       
   739 #pragma warning (default : 4100)  // Unreferenced formal parameter
       
   740