BlackBerry Forums Support Community

Closed Thread
Thread Tools
Old 05-07-2010, 11:17 PM   #1
New Member
Join Date: May 2010
Model: none
Carrier: none
Posts: 1
Default USB connection using stream level API

Please Login to Remove!

Hi all,

I'm new to BlackBerry programming, and I need your advise my friends...

I'm trying to establish USB connection between desktop and my device. I'm using JDK 4.7.

As we know it's to ways to establish connection through USB:

1. Using stream connection (

2. Using low-level API (USBPort)

I tried both ways, and I found problems in both situations:

1. Using first method we have stream functionality, and this is definitely advantage, but I can't figure out, how can I handle that connection was established? We are calling, and have as a return value valid StreamConnection object, than we are opening streams, and also have valid objects. It's no any analogue like AcceptAndOpen or something similar... One way that I see in this situation, is to open channel using connector, and than wait on blocking read on input stream, but this is workaround, and I don't really want to use it, because when you writing echo server for demonstration - it's one thing, but if you writing full functional system, it's quite different.

2. This method (low level) full opposite to first - you have a lot of control (callbacks using USBPortListener, writing/reading, etc), but in return, you should handle a lot of things manually, like for example: to send/receive big packets of data you should care about buffering, implementing receiving/sending is robust, because you should not only call read/write function, but you should handle callbacks like dataSent/dataReceived and so on, besides you should correctly handle all callbacks. And when you try to implement all this stuff, synchronize it, you starting to think something like "It should be something here another, simple solution, I need just to find it...".

So, the question: is it some possibility when we are using stream level API, to know that connection is established? Synchronous/asynchronous - doesn't matter. Or may be you know some other ways how to connect using USB without all these unneeded stuff?

Thank you in advance!
Closed Thread

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


1/2" 12V 230 PSI Electric Solenoid Valve 12-V DC Brass Viton High Pressure B22V



3/4" PT AC 110V Electric Solenoid Valve Brass Water Air Gas


MAC Boost Control Solenoid Valve 1/8'' 35A-ACA-DDBA-1BA DC12V 5.4W picture

MAC Boost Control Solenoid Valve 1/8'' 35A-ACA-DDBA-1BA DC12V 5.4W


U.S. Solid 1/4

U.S. Solid 1/4" Pneumatic Electric Solenoid Valve 5 way 2 Position DC 24V, Air


U.S. Solid 1/4

U.S. Solid 1/4" Brass Electric Solenoid Valve DC 12V VITON Water Air Fuel N/C



1/4" Electric Solenoid Valve Water Oil Air Gas Welders 110/120 volt AC B20N/V


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