0 Replies Latest reply on Nov 27, 2012 9:26 AM by 976400

    Ubuntu and API bluecove : java and bluetooth


      Here is my final project I want study worked with bluecove api (java bluetooth technology) and J2ME you guessed I am looking to make contacts and nokia laptop via bluetooth

      then voila I first exposed my equipment:

      hp laptop duel core processor, 200 gig hard drive, 2 GB rowing bone ubuntu 10.10 and set a date and I installed the bluetooth driver that ubuntu recommended me short I followed this short course:


      for the library installed on ubuntu bluecove then I tested a small java program:


      to see that Bluetooth is enabled and can detect the presence of mobile phone nokia

      I created a test project in eclipse and I joined the library in my project brief bluecove here is the program:

      import java.io.*;
      import javax.bluetooth.*;
      import javax.microedition.io.*;

      public class EchoServer {
      public final UUID uuid = new UUID( //the uid of the service, it has to be unique,
                     "27012f0c68af4fbf8dbe6bbaf7aa432a", false); //it can be generated randomly
      public final String name = "Echo Server"; //the name of the service
      public final String url = "btspp://localhost:" + uuid //the service url
      + ";name=" + name
      + ";authenticate=false;encrypt=false;";
      LocalDevice local = null;
      StreamConnectionNotifier server = null;
      StreamConnection conn = null;

      public EchoServer() {
      try {
      System.out.println("Setting device to be discoverable...");
      local = LocalDevice.getLocalDevice();
      System.out.println("Start advertising service...");
      server = (StreamConnectionNotifier)Connector.open(url);
      System.out.println("Waiting for incoming connection...");
      conn = server.acceptAndOpen();
      System.out.println("Client Connected...");
      DataInputStream din = new DataInputStream(conn.openInputStream());
      String cmd = "";
      char c;
      while (((c = din.readChar()) > 0) && (c!='\n') ){
      cmd = cmd + c;
      System.out.println("Received " + cmd);

      } catch (Exception e) {System.out.println("Exception Occured: " + e.toString());}

      public static void main (String args[]){
      EchoServer echoserver = new EchoServer();


      here is the result of the execution in eclipse:

      Setting device to be discoverable...
      BlueCove version 2.1.1-SNAPSHOT on bluez
      Exception Occured: javax.bluetooth.BluetoothStateException: Bluetooth Device is not ready. [1] Operation not permitted
      BlueCove stack shutdown completed

      Do you have an idea for solving the problem?