概述
我正在尝试连接到蓝牙射频通信设备。我使用sl4a并从Python脚本进行连接。我有两个android设备运行相同的android版本2.3.4。在
在一个设备上(galaxys2,内核非常接近股票,根目录),脚本运行良好并连接到RFCOMM设备。在另一台设备上,我得到了一个java.io.IOException: Connection refused的异国情调的winmate430t(我怀疑是一款特别坚固的Android手机)。在
我尝试运行示例代码bluetooth_chat.py,但没有成功,这是一个用于Android到Android连接的代码。我收到了同样的错误消息,这表明问题不在我的代码中,而更多的是Winmate电话的状态(根或否,已安装软件,配置)。在
有人见过类似的东西吗?我看到了一些关于修理飞机的帖子,我试了两次,但都没用。在安装了Python和所有模块之后,我还尝试重新启动Winmate。在
代码:import android
droid = android.Android()
address = '00:12:F3:11:DC:D5'
uuid = '00001101-0000-1000-8000-00805F9B34FB'
droid.toggleBluetoothState(True)
droid.bluetoothConnect(uuid, address)
logcat摘录:
^{pr2}$
编辑:2012年9月13日09:55:我试过市场上的Bluetooth Chat App(BILL-RAY),它允许我的两部手机聊天,我可以从任何一边连接:问题至少可以用Java解决。仍然bluetooth_chat.py示例不起作用。在
编辑10:45:我尝试了仍然在SL4A的BeanShell,同样的问题,在我的S2和我的Winmate失败:
代码:source("/sdcard/com.googlecode.bshforandroid/extras/bsh/android.bsh");
droid = Android();
droid.call("makeToast", "Hello, Android!");
address = "00:12:F3:11:DC:E5";
uuid = "00001101-0000-1000-8000-00805F9B34FB";
droid.call("toggleBluetoothState","True");
droid.call("bluetoothConnect",uuid, address);
droid.call("makeToast", "Bye, Android!");
logcat类似:I/ActivityManager( 1305): Starting: Intent { act=android.bluetooth.adapter.action.REQUEST_ENABLE cmp=com.android.settings/.bluetooth.RequestPermissionActivity } from pid 7364
D/dalvikvm( 7364): GC_CONCURRENT freed 1075K, 49% free 3716K/7239K, external 4198K/5242K, paused 2ms+14ms
V/sl4a.JsonRpcServer:117( 7364): Sent: {"error":null,"id":0,"result":true}
I/HK/LatinkeyboardBaseView( 1385): closing org.pocketworkstation.pckeyboard.LatinKeyboardView@4078a040
V/sl4a.JsonRpcServer:74( 7364): Received: {"id":0,"method":"bluetoothConnect","params":["00001101-0000-1000-8000-00805F9B34FB","00:12:F3:11:DC:E5"]}
E/BluetoothService.cpp( 1305): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
I/ActivityManager( 1305): Displayed com.googlecode.android_scripting/.activity.FutureActivity: +223ms
I/HK/LatinKeyboardBaseView( 1385): closing org.pocketworkstation.pckeyboard.LatinKeyboardView@4078a040
D/sl4a.ConsoleActivity:761( 7364): onResume called
E/BluetoothEventLoop.cpp( 1305): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/1804/hci0/dev_00_12_F3_11_DC_E5
I/ActivityManager( 1305): Start proc com.google.android.carhome for broadcast com.google.android.carhome/.receiver.BluetoothLaunchReceiver: pid=7876 uid=10020 gids={3002, 3001}
I/HK/LatinKeyboardBaseView( 1385): closing org.pocketworkstation.pckeyboard.LatinKeyboardView@4078a040
I/ActivityThread( 7876): Pub com.google.android.carhome.config: com.google.android.carhome.CarHomeProvider
D/BluetoothService( 1305): updateDeviceServiceChannelCache(00:12:F3:11:DC:E5)
D/BluetoothService( 1305): uuid(application): 00001101-0000-1000-8000-00805f9b34fb 1
D/BluetoothService( 1305): Making callback for 00001101-0000-1000-8000-00805f9b34fb with result 1
D/dalvikvm( 7364): GC_EXTERNAL_ALLOC freed 50K, 49% free 3698K/7239K, external 4198K/5242K, paused 131ms
V/BluetoothEventRedirector( 7681): Received android.bleutooth.device.action.UUID
I/BluetoothEventLoop.cpp( 1305): agent_event_filter: Received method org.bluez.Agent:OutOfBandAvailable
I/sl4a.TerminalBridge:540( 7364): parentChanged() now width=133, height=34
E/sl4a.JsonRpcServer:101( 7364): Invocation error.
E/sl4a.JsonRpcServer:101( 7364): java.io.IOException: Connection refused
E/sl4a.JsonRpcServer:101( 7364): at android.bluetooth.BluetoothSocket.connectNative(Native Method)
E/sl4a.JsonRpcServer:101( 7364): at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:204)
E/sl4a.JsonRpcServer:101( 7364): at com.googlecode.android_scripting.facade.BluetoothFacade.bluetoothConnect(BluetoothFacade.java:158)
E/sl4a.JsonRpcServer:101( 7364): at java.lang.reflect.Method.invokeNative(Native Method)
E/sl4a.JsonRpcServer:101( 7364): at java.lang.reflect.Method.invoke(Method.java:507)
E/sl4a.JsonRpcServer:101( 7364): at com.googlecode.android_scripting.jsonrpc.RpcReceiverManager.invoke(RpcReceiverManager.java:87)
E/sl4a.JsonRpcServer:101( 7364): at com.googlecode.android_scripting.facade.FacadeManager.invoke(FacadeManager.java:58)
E/sl4a.JsonRpcServer:101( 7364): at com.googlecode.android_scripting.rpc.MethodDescriptor.invoke(MethodDescriptor.java:109)
E/sl4a.JsonRpcServer:101( 7364): at com.googlecode.android_scripting.jsonrpc.JsonRpcServer.handleConnection(JsonRpcServer.java:99)
E/sl4a.JsonRpcServer:101( 7364): at com.googlecode.android_scripting.SimpleServer$ConnectionThread.run(SimpleServer.java:91)
V/sl4a.JsonRpcServer:117( 7364): Sent: {"error":"java.io.IOException: Connection refused","id":0,"result":null}
最后
以上就是义气白羊为你收集整理的android 蓝牙拒绝配对,Android蓝牙IOException:连接被拒绝的全部内容,希望文章能够帮你解决android 蓝牙拒绝配对,Android蓝牙IOException:连接被拒绝所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复