BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 12-06-2007, 01:41 PM   #1 (permalink)
New Member
 
Join Date: Dec 2007
Model: 957
PIN: N/A
Carrier: T-Mobile
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default StreamConnection mystery

Please Login to Remove!

Hello all,

I have a pile of old RIM957's !! They have rs232 connectors (not usb) via a nice cradle. The RIM Desktop Manager works fine, and I have updated the firmware to v3.6, which I understand is the newest that will work with them.

With JDE v.3.6 I can compile and upload HelloWorld and it works great.

Now, I am trying to upload a program which will basically read stuff from the serial port and write it to the screen. A kind of data-watcher. String data is streamed from a serial device, terminated with CRLF's. On Hyperterminal I can watch the data thus: 12034,12099 CRLF 12021,12081 CRLF etc..

Now I wanna get that on the BB screen.

I tried this code, but the device just seems to hang after the open connection is called....

Note I am using 19200 baud, although have also tried 9600 in-case that was a limitation. Also tried connecting the device directly to Hyperterminal, but get nothing in or out.

In theory, should this be possible at all ??? I am beginning to wonder if the BB does not allow traffic on its serial port, except to the Desktop Manager! Or if I need some special security/other settings first!

If anyone has a working sample of a simple echo program, that would be good to see. I tried to method here RIM Device Java Library: Interface CommConnection without success.

Code:
            Dialog.alert("Get this message OK");

            _serialConnection =  (StreamConnection)Connector.open(ConnectionString);
            
            Dialog.alert("Don't get this message, nor is an exception thrown... just seems to be hanging here");

            _din = _serialConnection.openDataInputStream();
            _dout = _serialConnection.openDataOutputStream();

            _dout.writeChars("WELCOME FROM BLACKBERRY!!");
            String contents = _din.readUTF();
            Dialog.alert("GOT: " + contents);
Thanks for any input!

Max.
Offline  
Old 12-06-2007, 01:53 PM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Nov 2007
Model: 8700c
PIN: N/A
Carrier: AT&T
Posts: 32
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm a noob so don't mind me much :P Is that code in a separate thread? Connections have to be in a separate thread. Also, Dialog objects don't work in it. My application kept freezing too when i was trying that. Take that out and try another method of displaying the data on the screen

Page 145 of the blackberry java development environment development guide has a nice sample all that listens for data on the serial port and renders it.
Offline  
Old 12-06-2007, 02:05 PM   #3 (permalink)
New Member
 
Join Date: Dec 2007
Model: 957
PIN: N/A
Carrier: T-Mobile
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Took out the Dialog objects - now works fine.

Funny that... I added those to help me debug, but they ended up being the bug!!

Thank you for your wise comments.

Max
Offline  
Old 12-07-2007, 04:28 AM   #4 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

you can use dialog but you have to put it into an invokelater to have it placed on the event thread.
__________________
java developer, Devinto, hamburg/germany
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.