如何用Java连接蓝牙设备?

时间:2012-04-11 03:27:11

标签: java bluetooth

我没有使用Android。我目前正在运行Ubuntu 10.04。

我想连接到另一个蓝牙设备(通过我的蓝牙USB加密狗)通过我的java应用程序发送数据。

我已经安装了javax.bluetooth软件包并试图运行以下内容并收到此错误:

  

org.javabluetooth.stack.hci.HCIException:HCIManagerRemoteClient:IOException:java.net.ConnectException:Connection timed out

try{
// retrieve the local Bluetooth device object
    BluetoothStack.init(new BluetoothTCPClient("192.168.10.2", 2600));
    lDevice = LocalDevice.getLocalDevice();
}catch(Exception e){
e.printStackTrace();
}

我应该将什么用于BluetoothStack init参数?我在互联网上找到了这个TCPClient。请解释一下。

0 个答案:

没有答案