This discussion is archived
0 Replies Latest reply: Feb 10, 2011 10:11 PM by 838802 RSS

Error in Bluecove implementation

838802 Newbie
Currently Being Moderated
Hello everyone,

I am a newbie in doing bluetooth projects. I have a client side (mobile) j2me application. I need to do a pc side j2se code so as to establish a bluetooth connection. This is my M.Tech., project. Supposed to complete within a month. So, please help with with the details!

I am trying to run the following sample code using eclipse pulsar installed with S60_5th edition SDK:

package com.example.Serv;

import java.io.IOException;
import java.util.Vector;
import javax.bluetooth.DeviceClass;
import javax.bluetooth.DiscoveryAgent;
import javax.bluetooth.LocalDevice;
import javax.bluetooth.DiscoveryListener;
import javax.bluetooth.RemoteDevice;
import javax.bluetooth.ServiceRecord;
public class Serv implements DiscoveryListener{

     private static Object lock = new Object();
     private static Vector<RemoteDevice> vecDevices = new Vector<RemoteDevice>();
     
     public static void main (String[] args) throws IOException {
          Serv bluetoothDeviceDiscovery = new Serv();
          LocalDevice ld = LocalDevice.getLocalDevice();
          System.out.println ("Address:" +ld.getBluetoothAddress());
          System.out.println ("Name:" +ld.getFriendlyName());
          
          DiscoveryAgent agent = ld.getDiscoveryAgent();
          System.out.println("Start device inquiry..");
          agent.startInquiry(DiscoveryAgent.GIAC, bluetoothDeviceDiscovery);
          
          try{
               synchronized(lock){
                    lock.wait();
               }
          }
          catch(InterruptedException e){
               e.printStackTrace();
          }
          
          System.out.println("Device Inquiry Completed");
          
          int devCount = vecDevices.size();
               if(devCount<=0){
                    System.out.println("No Devices Found");
               }
               else{
                    System.out.println("Bluetooth Devices:");
                    
                    for (int i=0; i<devCount; i++){
                         RemoteDevice rd = (RemoteDevice)vecDevices.elementAt(i);
                         System.out.println((i+1)+"."+rd.getBluetoothAddress()+" ("+rd.getFriendlyName(true)+")");
                    }
               }
     }
     public void deviceDiscoverd(RemoteDevice btDev, DeviceClass cod){
          System.out.println("Device Discovered: "+btDev.getBluetoothAddress());
          
          if(!vecDevices.contains(btDev)){
               vecDevices.addElement(btDev);
          }
     }
     
     public void serviceDiscovered (int transID, ServiceRecord[] servRecord){
     }
     
     public void serviceSearchCompleted(int transID, int respCode){
     }
     
     public void inquiryCompleted(int discType){
          
          synchronized(lock){
               lock.notify();
          }
          
          switch(discType){
          
          case DiscoveryListener.INQUIRY_COMPLETED:
               System.out.println("INQUIRY_COMPLETED");
               break;
          case DiscoveryListener.INQUIRY_TERMINATED:
               System.out.println("INQUIRY_TERMINATED");
               break;
          case DiscoveryListener.INQUIRY_ERROR:
               System.out.println("INQUIRY_ERROR");
               break;
          default:
               System.out.println("Unknown Response Code");
               break;
                    
          }
     }
     @Override
     public void deviceDiscovered(RemoteDevice arg0, DeviceClass arg1) {
          // TODO Auto-generated method stub
          
     }
     @Override
     public void servicesDiscovered(int arg0, ServiceRecord[] arg1) {
          // TODO Auto-generated method stub
          
     }
}
          
I use Windows 7, 64-bit OS. I have added bluecove-2.1.1 SNAPSHOT.jar for jsr-82 implementation But i am getting the following errors:


Native Library intelbth_x64 not available
Native Library bluecove_x64 not available
Exception in thread "main" javax.bluetooth.BluetoothStateException: BlueCove libraries not available
     at com.intel.bluetooth.BlueCoveImpl.createDetectorOnWindows(BlueCoveImpl.java:896)
     at com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:439)
     at com.intel.bluetooth.BlueCoveImpl.access$500(BlueCoveImpl.java:65)
     at com.intel.bluetooth.BlueCoveImpl$1.run(BlueCoveImpl.java:1020)
     at java.security.AccessController.doPrivileged(Native Method)
     at com.intel.bluetooth.BlueCoveImpl.detectStackPrivileged(BlueCoveImpl.java:1018)
     at com.intel.bluetooth.BlueCoveImpl.getBluetoothStack(BlueCoveImpl.java:1011)
     at javax.bluetooth.LocalDevice.getLocalDeviceInstance(LocalDevice.java:75)
     at javax.bluetooth.LocalDevice.getLocalDevice(LocalDevice.java:95)
     at com.example.Serv.Serv.main(Serv.java:18)

Can anyone please help me resolve this problem? Is this of os compatibility problem? It will be very helpful if someone tells me how to eliminate this problem!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points