You Are Here:

Community: Developer Discussion Boards

#1 Old Lightbulb Bluetooth connection problem - 2007-02-27, 11:27

Join Date: Feb 2007
Posts: 122
Location: Bangalore, India
Send a message via AIM to lal.rajan
lal.rajan's Avatar
lal.rajan
Offline
Regular Contributor
Hi all,

I am using CBluetoothSocket class to get the connection from the requesting device and then get the datas sent by it.

I am able to get the request but while reading the data altough i m getting the notification that data read , but I am unable to get any data in my device.

the code goes here:

Code:
    
void GetSocket()
{
        TInt result;
	RSocketServ socksvr;
	// Connect to the socket server
	result = socksvr.Connect();
	if (result != KErrNone)  User::Leave(result);
	
	// Load the protocol
	TProtocolDesc	protocolInfo;
	result = socksvr.FindProtocol(_L("L2CAP"), protocolInfo);
	User::LeaveIfError(result);

	m_cBTSocket		 = CBluetoothSocket::NewL(*this,socksvr,protocolInfo.iSockType,protocolInfo.iProtocol);
	m_cBTBlankSocket = CBluetoothSocket::NewL(*this,socksvr);
	m_cBTSyncLink	 = CBluetoothSynchronousLink::NewL(*this,socksvr);
	
	TL2CAPSockAddr aAddr;
	TBTServiceSecurity serviceSecurity;
	//TUid settingsUID;

	//TBTSockAddr sockaddr;
	serviceSecurity.SetAuthentication(ETrue);
	serviceSecurity.SetEncryption(EFalse);
	serviceSecurity.SetAuthorisation(ETrue);
	serviceSecurity.SetDenied(EFalse);

	aAddr.SetSecurity(serviceSecurity); 
	aAddr.SetPort(3);
	// Configure the listener port.
	m_cBTSocket->SetOpt(KL2CAPGetOutboundMTU, KSolBtL2CAP, 48);
	m_cBTSocket->SetOpt(KL2CAPInboundMTU, KSolBtL2CAP, 48);

	result = m_cBTSocket->Bind(aAddr);
	User::LeaveIfError(result);

	result = m_cBTSocket->Listen(8);
	User::LeaveIfError(result);

	m_cBTSocket->Accept(*m_cBTBlankSocket)
}
On getting the notification from HandleAcceptCompleteL that the connection is been accepted, I m reading the data from the socket:


Code:
void Read()
{    
TSockXfrLength lLen(0);
TBuf8<256> lData;
TBuf16<256> lDataLen;

m_cReadStatus = m_cBTBlankSocket->RecvOneOrMore(lData,0,lLen);
lLen.Copy(lDataLen);
}
after this function completes i m getting the notification HandleReceiveCompleteL with out any error. but the data is not present. I mean lData is empty.

Can any one help me out in getting that where I m going wrong.

thnx,
Rajan.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Nokia 3250 Bluetooth Connection Problem TalJ Symbian Networking & Messaging 2 2006-06-27 08:32
how can i come to know bluetooth connection from remote device santosh3311 Symbian Networking & Messaging 9 2005-09-12 03:46
Bluetooth serial connection timeout martin.ericsson General Discussion 0 2005-06-13 03:00
Problem with Serial port connection using Nokia6600 Bluetooth mandykahlon General Discussion 1 2005-05-31 12:42
6310 bluetooth connection with PCsuite fails Nokia_Archive Bluetooth Technology 1 2002-05-28 16:14

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia