Results 1 to 3 of 3
  1. #1
    ducks is offline Member
    Join Date
    Jan 2011
    Location
    Taiwan
    Posts
    1
    Rep Power
    0

    Default help please~~ my javax.comm prog hangs outputting to bluetooth com port

    Hi all,
    I'm using the java comm API and my program scans through each available com port, each sending out a handshake code, and the port that replies back the "password" is labeled as our device. I'm doing this so users won't have to do a com port selection.
    The problem now is, if it gets to a bluetooth generated port, the program simply hangs on:

    outputStream.write(byteBuffer);

    This behaves the same under debug, as if it's waiting for something, and no exceptions are caught for this, it just hangs on that line :(
    Has anyone ever had this problem? or is there a way to write a timeout for the outpustream.write line..etc?

    my prog wasn't designed for bluetooth btw, it connects to health care instruments through a converter cable of 5pin mini-usb & usb

    Thanks

  2. #2
    baloda is offline Member
    Join Date
    Nov 2010
    Location
    New Delhi
    Posts
    50
    Rep Power
    0

    Default

    i have used the javax.comm. but not on blue tooth

    you should do it some thing like

    first write single byte for handshake and asks ur communicating device to send back any per defined byte for handshake.

    then put ur code in if statement

    like

    if(bytercvd==0x32)
    outputStream.write(byteBuffer);


    after that to end the communication ask for another byte like

    f(bytercvd==0x70)
    serialPort.close();

    u can have a look on this example for more details
    Reading and Writing Data from comm port in JAVA

  3. #3
    mozart is offline Member
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Default

    Hallo ducks

    Did you manage to solve your problem with the bluetooth COM port?

    If you did, how did you solve it, because I have the same problem?

    Thanks

Similar Threads

  1. import javax.comm
    By kareena in forum Threads and Synchronization
    Replies: 2
    Last Post: 09-21-2010, 03:45 PM
  2. Replies: 7
    Last Post: 07-12-2010, 04:24 PM
  3. Replies: 0
    Last Post: 02-26-2009, 08:14 PM
  4. javax.microedition.io/ javax.bluetooth
    By ahtiven in forum New To Java
    Replies: 3
    Last Post: 01-13-2009, 02:54 PM
  5. javax/comm/SerialPortEvent
    By musiigedeo in forum Threads and Synchronization
    Replies: 9
    Last Post: 11-24-2008, 11:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •