The usbclient program expects to receive and send certain hard coded messages. It uses this to work out how to decode the messages it receives (the output from the Blackberry from USB channels opened using Connectors has a header, where as output from USB channels opened using net.rim.device.api.system.USBPort have no header).

On the PC side you should have a look at the usbclient program found at samples\usbclient in BlackBerry JDEs. Basically you have to make use of COM to get an IChannelPtr (via IDeviceManagerPtr) which you can then use to send and receive data.

Of course you could just use the brawchannel tool in Barry to send and receive any data you want to your BlackBerry application via a simple command line application :)

Regards,

Toby

On 14/10/2010 23:15, Josh Kropf wrote:
When you run the usbdemo program it sends data to the handheld and the handheld sends some back. You will see the output from the program on the command line (stdout) I think (it's been a while since I tinkered with it).

On 10/14/2010 06:10 PM, Eric Arseneau wrote:
Does that mean that once I run the USBDemo.exe, run it, that the serial port will work?

On Oct 14, 2010, at 2:53 PM, Josh Kropf wrote:

Eric,

The USBDemo program is important. It sets up the channel for communicating between the PC and the handheld.

Simply using a terminal emulator on the comm ports is not going to work I'm afraid.

On 10/14/2010 05:32 PM, Eric Arseneau wrote:
I KNOW this is the wrong list, but your the smartest bunch I've met in BlackBerry land and I am desperate :(

If this should not be done, then I will refrain from doing it in future.

I've tried the better part of the day trying to get USB comm's to work from BB to Windows PC.

I KNOW there is a USBDemo, but it requires that I have the USBDemo exe on the Windows side.

I am trying to generate some data from app on BB and send it via serial to an application on desktop via a serial port.

Has anyone been able to do this? I have NO Bluetooth, nor wifi, nor any other option other than USB cable.

Here is a snippet of the thread I start


printlnTestResult(true, "Send thread started");

try {
connection = (StreamConnection) Connector.open("comm:USB;baudrate=38400;channel=JDE_USBClient");

outputStream = connection.openOutputStream();
// inputStream = connection.openDataInputStream();

} catch (IOException e) {

printTestResultError(e);

setFailed();

return;

}

printlnTestResult(true, "Connection setup");

int count = 0;

String message = "Hello Jon!!!";

while (isRunning()) {

if ((count % 10) == 0) {

printlnTestResult(true, "About to send: " + message);

try {

outputStream.write(message.getBytes());

} catch (IOException e) {

printTestResultError(e);

}

printlnTestResult(true, "Sent: " + message);

}

count++;

Util.sleep(500);

}

The app jams on the about to send, never gets to Sent:. I am using hyper terminal on Windows connected to both virtual comm ports on windows side.



------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Barry-devel mailing list
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel

Reply via email to