Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Writing a Java App to read a feed from a Bluetooth GPS Device?

Options
  • 08-05-2006 5:34pm
    #1
    Registered Users Posts: 527 ✭✭✭


    Hi all,

    I am starting to write this application through JavaME.

    I have the following:
    1. Java Bluetooth API (JSR-82)
    2. J2sdk 1.4.2_06
    3. Netbeans 5.0 + Mobility Pack
    4. JRE
    5. Sun Wireless Toolkit 2.2


    All I want is to setup a connection from my laptop's built-in Bluetooth connection to the Bluetooth connection on the GPS device.

    I have read tutorial after tutorial over the last week on the net about Bluetooth programming but I still don't know an awful lot more about how to go about doing this.

    From what I have learned there is 5 main parts to a Bluetooth application:
    1. Stack Initilisation
    2. Device Management
    3. Device Discovery
    4. Service Discovery
    5. Communication


    Do I need to write a seperate class for each of these or can I take any shorcuts?
    If I do have to write seperate classes for each one could someone please give me an idea on what goes into each one.

    Could someone please help me out either by listing the minimum requirements as regards classes and methods that I need to do this.

    Any help or pointing in the right direction is greatly appreciated.

    Sean.


Comments

  • Registered Users Posts: 1,275 ✭✭✭bpmurray


    When I last tried it, the JSR82 stuff wasn't in great shape. However, here's a good place to start: http://www.javabluetooth.com/


  • Registered Users Posts: 527 ✭✭✭Sean^DCT4


    has anyone ever come across this error before while trying to setup a bluetooth connection:
    java.lang.UnsatisfiedLinkError: isNetworkMonitorActive
    				at javax.microedition.io.Connector.isNetworkMonitorActive(Native Method)
    				at javax.microedition.io.Connector.<clinit>(Connector.java:142)
    				at Main.createConnection(Main.java:77)
    				at Main.main(Main.java:58)
    

    I have tried loading a DLL from the J2ME Wireless Toolkit (which I think it is looking for the following ways..
    static {
       System.load( C:\\WTK22\\bin\\zayit.dll" );
    }
    

    and by copying that .dll to where the Java code's calling it and trying this:
    static {
       System.loadLibrary( "zayit.dll" );
    }
    

    Any help would be greatly appreciated.

    Thanks


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    I'm pretty sure that you have to specify a full path to the DLL. The API docs make no mention of loadLibrary starting to look from the CLASSPATH variable.


  • Registered Users Posts: 700 ✭✭✭Magown3


    Your java program will not be able to access your bluetooth dongle without a Bluetooth Stack like Avetanna or Bluecove which you have to buy (Although there is a free one for Linux users which i can't remember the name of).

    If you are developing the program to run on a mobile then you'll have to write the code on you're pc and then transfer the jar file onto your mobile for testing as the wireless toolkit will no access the BT dongle either although it will simulate a phone to phone BT connection if you run 2 WTK windows at the same time.

    You'll need a phone that supports JABWT also.

    Useful Link


  • Registered Users Posts: 527 ✭✭✭Sean^DCT4


    @aidan_walsh
    The classpath of the OS is:
    C:\j2sdk1.4.2_06\bin\;%CLASSPATH%;
    The only DLL in the WTK directory is zayit.dll so I presume this is the missing file.
    I have tried everything from copying the zayit.dll to the JDK\bin folder to putting it in the folder where my classes are calling it, but still I get this error.


    @Magown3
    Its not for a phone.
    Tablet PC <--> GPS Bluetooth Device

    Can I not just install the Wireless Toolkit and write a program from scratch to create this connection between the Tablet PC and the GPS BT Device?
    Do I still need a bluetooth stack??


  • Advertisement
  • Registered Users Posts: 700 ✭✭✭Magown3


    No you'll need the stack. The J2SE cannot talk to the bluetooth dongle, that's what the stack will do for you.


Advertisement