Need help in bluecove implementation!

1,611 views
Skip to first unread message

Anu

unread,
Feb 10, 2011, 9:28:42 AM2/10/11
to bluecove-users
Hello everyone!

I am new to this forum and this is the first time trying to code for
bluetooth connectivity.

II tried with an example code:

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 Acer laptop with WIDCOMM bluetooth stack. And i have installed
bluecove implementation and added to the the class path. The added
jars are:

bluecove-2.1.0.jar
bluecove-2.1.1-SNAPSHOT.jar
bluecove-bluez-2.1.1-SNAPSHOT.jar
bluecove-emu-2.1.1-SNAPSHOT.jar
bluecove-gpl-2.1.1-SNAPSHOT.jar

And i am getting the following errors:


Exception in thread "main" javax.bluetooth.BluetoothStateException:
BlueCove native library version mismatch
at com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:
454)
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? It will be very
helpful if i get any suggestions as to what must be done!

Thanks in advance!

Anu

unread,
Feb 10, 2011, 9:28:45 AM2/10/11
to bluecove-users

Mina Shokry

unread,
Feb 10, 2011, 9:34:26 AM2/10/11
to bluecov...@googlegroups.com
if you are on windows, just use bluecove-2.1.1-SNAPSHOT.jar in classpath. if on linux, also add either bluecove-bluez-2.1.1-SNAPSHOT.jar or bluecove-gpl-2.1.1-SNAPSHOT.jar


--
You received this message because you are subscribed to the Google Groups "bluecove-users" group.
To post to this group, send email to bluecov...@googlegroups.com.
To unsubscribe from this group, send email to bluecove-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bluecove-users?hl=en.


Kalpana Pugazhendi

unread,
Feb 10, 2011, 10:30:23 AM2/10/11
to bluecov...@googlegroups.com
Thank yo so much for your reply!

I am using windows 7, 64-bit OS. So removed other jars and just added the bluecove-2.1.1 SNAPSHOT.jar and bluecove-emu-2.1.1 SNAPSHOT.jar. But now i am getting the following errors:

Native Library bluecove_x64 not available
Exception in thread "main" javax.bluetooth.BluetoothStateException: BlueCove library bluecove not available;
resource not found bluecove_x64.dll
load [bluecove_x64] no bluecove_x64 in java.library.path
at com.intel.bluetooth.BlueCoveImpl.loadNativeLibraries(BlueCoveImpl.java:396)
at com.intel.bluetooth.BlueCoveImpl.setBluetoothStack(BlueCoveImpl.java:963)
at com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:502)
at com.intel.bluetooth.BlueCoveImpl.access$500(BlueCoveImpl.java:69)
at com.intel.bluetooth.BlueCoveImpl$1.run(BlueCoveImpl.java:1044)
at java.security.AccessController.doPrivileged(Native Method)
at com.intel.bluetooth.BlueCoveImpl.detectStackPrivileged(BlueCoveImpl.java:1042)
at com.intel.bluetooth.BlueCoveImpl.getBluetoothStack(BlueCoveImpl.java:1035)
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 you please help me? 

Raul Mora

unread,
Mar 17, 2011, 11:42:48 PM3/17/11
to bluecove-users
Perhaps you should try removing the emu jar, I'm running win7 x64 and
I have no problem just adding bluecove-2.1.1 SNAPSHOT.jar

Kalpana Pugazhendi

unread,
Mar 18, 2011, 9:24:33 AM3/18/11
to bluecov...@googlegroups.com

Thanks, Raul Mora for your kind reply! I just added the bluecove-2.1.1 SNAPSHOT.jar but the error still resides. I was told native code is not available for 64-bit os for this jar. So switched on to 32-bit os. Now working fine. But how did you get it work in 64-bit os?  It will be very helpful for others also if you please let us know.

youssef moudine

unread,
May 14, 2016, 6:13:39 PM5/14/16
to bluecove-users
hello,
all you need to do is to remove all the librery except bluecove-2.1.1 SNAPSHOT.jarand it will work like charm ^^
Reply all
Reply to author
Forward
0 new messages