السلام عليكم ورحمة الله وبركاتة
لقد قمت بتوصيل
usb bluetooth device
بالكمبيوتر وكنت عمل برنامج j2se
يقوم بالبحث عن الاجهزة الفريبة منة وكان ذلك الكود
import java.util.Vector;
import javax.bluetooth.*;
public class Server implements DiscoveryListener {
public static LocalDevice local = null;
public static DiscoveryAgent agent = null;
public static Vector devicesFound = null;
public static ServiceRecord[] servicesFound = null;
public static void main(String[] args) throws BluetoothStateException {
local = LocalDevice.getLocalDevice();
agent = local.getDiscoveryAgent();
devicesFound = new Vector();
}
public void deviceDiscovered(RemoteDevice rd, DeviceClass dc) {
String name = null;
int classofdev;
String address = rd.getBluetoothAddress();
classofdev = dc.getMajorDeviceClass();
try {
name = rd.getFriendlyName(true);
} catch (Exception e) {
}
if (name == null) {
name = address;
}
System.out.println("name is "+name);
}
public void servicesDiscovered(int i, ServiceRecord[] srs) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void serviceSearchCompleted(int i, int i1) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void inquiryCompleted(int i) {
if (devicesFound.size() == 0) {
try {
System.out.println("no devices found ");
} catch (Exception e) {
}
}
}
}لقد قمت بتنزيل
bluecove-2.1.0
وقمت باستدعائها عند تشغيل البرنامج يظهر لى هذة المشكلة
Exception in thread "main" javax.bluetooth.BluetoothStateException: BluetoothStack not detected
at com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:476)
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 Server.main(Server.java:17)
Java Result: 1
ممكن اعرف اية المشكلة وازاى اعرف ال
bluetooth stack
لقد قمت بتنزيل الملفات الخاصة بة ولكننى لا اعلم اين اضعها
