Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
New Developer
Posts: 24
Registered: ‎08-07-2008
My Device: Not Specified

EOFException on a Bluetooth DataInputStream connection

Am I wrong or it doesn't make sense to get an EOFException when reading from a DataInputStream obtain from a bluetooth connection?

We are "streaming" a "network" connection. I could understand getting it from a FileInputStream but not from "network" connection.

 

Blackberry 8700 v4.2.1.101 (Platform 2.3.0.81) 

 

String url = "btspp://008098D4BB48:1;authenticate=false;encrypt=false;master=false";

StreamConnection connection = (StreamConnection)Connector.open(url);
DataInputStream inputStream = connection.openDataInputStream();
LEDataInputStream efmInput = new LEDataInputStream(inputStream);  // LEDataInputStream is just a wrapper class to read the stream in Little Endian.

....

int b = efmInput.readUnsignedByte();

 

The funny things is I get this exception only when I keep my form "active" by rolling the wheel. The form is simply compose of 2 String (label) and 2 Gauge. If I turn the wheel to prevent the screen to turn off (power saving option) I get the problem. If I leave the wheel alone I don't get it. Like if the CPU was too busy to process both the connection and refreshing the screen. 

 

Here is the stacktrace grap from the Event log.

---------------------------------------------
Name: EOFException
GUID: 9c3cd62e3320b498
Time: Aug 07, 2008 14:06:45
No detail message
net_rim_cldc-1
 DataInputStream
 readUnsignedByte
 0x39FB
zedi_efmwalkup
 LEDataInputStream
 readUnsignedByte
 0x6943
zedi_efmwalkup
 FISession
 readFIPacket
 0x4D77
zedi_efmwalkup
 FISession
 readThreadProcess
 0x4F63
zedi_efmwalkup
 FISession$ReadingThread
 run
 0x5097

 

BlackBerry Development Advisor
Posts: 15,885
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: EOFException on a Bluetooth DataInputStream connection

What line of code is triggering the exception?  What type of Bluetooth device are you connecting to?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
New Developer
Posts: 24
Registered: ‎08-07-2008
My Device: Not Specified

Re: EOFException on a Bluetooth DataInputStream connection

>> What line of code is triggering the exception?

int b = efmInput.readUnsignedByte();

 

>> What type of Bluetooth device are you connecting to?

A Ezurio Bluetooth module.

 

 

I solve my problem with the following code:

int b;
while ((b = in.read()) == -1) {
    Thread.sleep(100);
}
buffer[index] = (byte)b;

 

But I can't still understand why I was getting it. I had the same code running on a Nokia 5300 without any issue. And again I get the problem on the Blackberry only If I generate some "other activity" on the BB by turn the wheel going from the different element in my form.