Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 10:32, 23 August 2007.

KIJ000109 - Using Bluetooth serial port in MIDlets

From Forum Nokia Wiki


Using Bluetooth serial port in MIDlets
KIJ000109
Overview
Reading incoming stream does not work properly in certain Nokia S60 and Series 80 devices.
Reported against
S60 2nd Edition: Nokia 6600 v.4.09.1
S60 2nd Edition, Feature Pack 1:  Nokia 6620, Nokia 6260, Nokia 6670, Nokia 7610
Series 80 2nd Edition: Nokia 9300, Nokia 9500
Date identified
December 22, 2004
Symptoms
-
Detailed description
When the Bluetooth Serial Port Profile (RFCOMM protocol) is used, reading incoming stream is sometimes interrupted with IOException. The read() method of the InputStream class may throw an IOException if the other end has closed the stream while the InputStream is still reading it.
Another issue is that the InputStream cannot use a bigger byte array than 512 bytes when reading stream. A bigger byte array may crash the MIDlet.
How to reproduce
Run, for example, the BtsppEcho example application.
Solution
Solution to the IOException issue: Ensure that the InputStream.read() has finished before closing the output stream in the other end.
Solution to the stream size issue: Do not use a bigger byte array than 512 bytes.  Read the input stream in a loop or keep the whole length of the stream under 512 bytes.
Generic workaround to both issues: Use L2CAP connection instead of SPP (RFCOMM), if appropriate. This is feasible when you have access to the L2CAP protocol in both ends of your application (for example, connections between two devices).
Related Discussions
Thread Thread Starter Forum Replies Last Post
7650 + Mitsumi USB BT + Data suite simondup Bluetooth Technology 5 2003-03-13 20:01
SMS BASED APPLICATION DEVELOPMENT mabilash General Messaging 71 2008-07-15 07:05
Using PC suite for Nokia 7650 mantit Bluetooth Technology 1 2002-10-29 06:25
Nokia 6630 Phone 2 PC File Access JP5000 Bluetooth Technology 1 2005-03-17 12:29
7650 connection through Bluetooth Serial port ? asabulu Bluetooth Technology 2 2002-11-21 14:09
 
Powered by MediaWiki