为什么用QT在Android上写的有关蓝牙程序,在不同手机上有的能用,有的不能用呢
最近用QT在Android上写蓝牙和单片机通过串口扩展的蓝牙模块通信,发现在有的手机上能运行,有的手机居然不行,连接蓝牙模块时提示以下提示,信息
W/System.err( 2356): java.io.IOException: [JSR82] connect: Connection is not created (failed or aborted).
W/System.err( 2356): at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:396)
W/System.err( 2356): at dalvik.system.NativeStart.run(Native Method)
I/BluetoothSocket_MTK( 2356): [JSR82] Bluetooth Socket Constructor
I/BluetoothSocket_MTK( 2356): [JSR82] type=1 fd=-1 auth=true encrypt=true port=-1
I/BluetoothSocket_MTK( 2356): [JSR82] connect: do SDP
I/BluetoothSocket_MTK( 2356): [JSR82] SdpHelper::onRfcommChannelFound: channel=-1
W/System.err( 2356): java.io.IOException: Service discovery failed
W/System.err( 2356): at android.bluetooth.BluetoothSocket$SdpHelper.doSdp(BluetoothSocket.java:814)
W/System.err( 2356): at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:383)
W/System.err( 2356): at dalvik.system.NativeStart.run(Native Method)
W/ResourceType( 2356): No package identifier when getting name for resource number 0x00000001
I/View ( 2356): Touch down dispatch to org.qtproject.qt5.android.QtSurface{411ce6a0 V.E..... ........ 0,0-1024,490 #1}, event = MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=943.07904, y[0]=425.22794, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=682683, downTime=682683, deviceId=2, source=0x1002 }