Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

J2se + bluetooth help

  • 06-04-2007 02:25AM
    #1
    Registered Users, Registered Users 2 Posts: 221 ✭✭


    Hi all,

    I'm currently working on a project witch involves a client midlet running on a phone to communicate with a server on a pc. For this communication I'm using RFCOMM . Bluetooth on the phone side is fine however when i try to use it on my computer i am unable to obtain the local device .

    I have tried several stacks including bluecove, electric blue and Atinav but all have the same result .

    The following is a sample program i wrote and the output it gives
    import javax.bluetooth.*;
    //import com.intel.bluetooth.*;
    import javax.microedition.io.*;
    import java.io.*;
    import java.lang.*;
    import java.util.*;


    /**
    *
    * @author Sean
    */
    public class Main /*implements DiscoveryListener*/{

    /** Creates a new instance of Main */
    public Main() {
    }

    public static Vector BTD = new Vector();
    public static Vector BTC = new Vector();
    public static LocalDevice local;
    DiscoveryAgent agent;



    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    // TODO code application logic here

    System.out.println("In Find Devices\n");
    try {
    local = LocalDevice.getLocalDevice();
    local.setDiscoverable(DiscoveryAgent.GIAC);

    // agent = device.getDiscoveryAgent(); // obtain reference to singleton

    } catch (BluetoothStateException ex) {
    ex.printStackTrace();
    System.out.println("cant get localdevice");
    }
    System.out.println("Address is : " + local.getBluetoothAddress());
    System.out.println("stuff : " + local.getFriendlyName());



    }

    I'm using netbeans and my ide. running windows xp sp2 and have WIDCOM bluetooth software.

    All help would be brill thanks

    -Elfman


Advertisement