Closed xpdrycry closed 4 years ago
APP 是连上设备了然后没有反应了? 有截图或者 LOG 吗?
D/BluetoothAdapter: isLeEnabled(): ON D/BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=6 mScannerId=0 D/[MainBleNotifyThread]: MainBleNotifyThread notified I/chromium: [INFO:CONSOLE(635)] "a4cf1243c598", source: file:///android_asset/web/js/utils.js (635) D/BluetoothAdapter: isLeEnabled(): ON D/[MainBleNotifyThread]: MainBleNotifyThread wait() I/chromium: [INFO:CONSOLE(1273)] "dfdfdfdfdfd", source: file:///android_asset/web/js/common.js (1273) I/chromium: [INFO:CONSOLE(41)] "{"connected":true,"encode":true,"ssid":"CMCC-yUAE","bssid":"84:a9:c4:bc:8c:08","frequency":"2457"}", source: file:///android_asset/web/app/js/conDevice.js (41) D/BluetoothAdapter: isLeEnabled(): ON D/BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=6 mScannerId=0 D/[MainBleNotifyThread]: MainBleNotifyThread notified D/BluetoothAdapter: isLeEnabled(): ON I/chromium: [INFO:CONSOLE(1357)] "["a4cf1243c598"]", source: file:///android_asset/web/js/common.js (1357) D/BluetoothGatt: connect() - device: A4:CF:12:43:C5:9A, auto: false registerApp() D/BluetoothGatt: registerApp() - UUID=a4fc334d-9b24-4133-a0fe-d0426cfa2fb0 D/EspActionDeviceConfigure2: Start doActionConfigureBlufi2 D/BluetoothGatt: onClientRegistered() - status=0 clientIf=6 D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=6 device=A4:CF:12:43:C5:9A D/[EspActionDeviceConfigure]: onConnectionStateChange status=0, newState=2, address=A4:CF:12:43:C5:9A D/BluetoothGatt: discoverServices() - device: A4:CF:12:43:C5:9A D/BluetoothGatt: onConnectionUpdated() - Device=A4:CF:12:43:C5:9A interval=6 latency=0 timeout=500 status=0 D/BluetoothGatt: onSearchComplete() = Device=A4:CF:12:43:C5:9A Status=0 D/[EspActionDeviceConfigure]: onServicesDiscovered status=0 D/BluetoothGatt: setCharacteristicNotification() - uuid: 0000ff02-0000-1000-8000-00805f9b34fb enable: true D/BluetoothGatt: requestConnectionPriority() - params: 1 D/[EspActionDeviceConfigure]: Set BlufiClient complete D/BluetoothGatt: configureMTU() - device: A4:CF:12:43:C5:9A mtu: 128 D/BluetoothGatt: onConfigureMTU() - Device=A4:CF:12:43:C5:9A mtu=128 status=0 D/[EspActionDeviceConfigure]: onMtuChanged status=0, mtu=128 D/[EspActionDeviceConfigure]: onCharacteristicWrite status=0 D/[EspActionDeviceConfigure]: onCharacteristicChanged D/[EspActionDeviceConfigure]: onCharacteristicChanged D/BluetoothGatt: onConnectionUpdated() - Device=A4:CF:12:43:C5:9A interval=39 latency=0 timeout=500 status=0 D/[EspActionDeviceConfigure]: onCharacteristicChanged D/BlufiClientImpl: Get RSA device public key length 272 D/[MainBleNotifyThread]: MainBleNotifyThread wait() D/[EspActionDeviceConfigure]: onCharacteristicWrite status=133 D/BluetoothGatt: cancelOpen() - device: A4:CF:12:43:C5:9A D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=6 device=A4:CF:12:43:C5:9A D/[EspActionDeviceConfigure]: onConnectionStateChange status=8, newState=0, address=A4:CF:12:43:C5:9A D/BluetoothGatt: close() unregisterApp() - mClientIf=6 D/[EspActionDeviceConfigure]: onGattClose D/BluetoothAdapter: isLeEnabled(): ON D/BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=6 mScannerId=0 D/[MainBleNotifyThread]: MainBleNotifyThread notified D/BluetoothAdapter: isLeEnabled(): ON
发生情况的图片和Log,都发给你了。主要问题就是在配网过程中,无法把ssid和pwd给发送过去.
D/[MainBleNotifyThread]: MainBleNotifyThread wait() I/chromium: [INFO:CONSOLE(1273)] "dfdfdfdfdfd", source: file:///android_asset/web/js/common.js (1273) I/chromium: [INFO:CONSOLE(41)] "{"connected":true,"encode":true,"ssid":"CMCC-yUAE","bssid":"84:a9:c4:bc:8c:08","frequency":"2457"}", source: file:///android_asset/web/app/js/conDevice.js (41) D/BluetoothAdapter: isLeEnabled(): ON D/BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=6 mScannerId=0 D/[MainBleNotifyThread]: MainBleNotifyThread notified D/BluetoothAdapter: isLeEnabled(): ON I/chromium: [INFO:CONSOLE(1357)] "["a4cf1243c598"]", source: file:///android_asset/web/js/common.js (1357) D/BluetoothGatt: connect() - device: A4:CF:12:43:C5:9A, auto: false registerApp() D/BluetoothGatt: registerApp() - UUID=1f031686-d540-473c-a2ec-2133370ae620 D/EspActionDeviceConfigure2: Start doActionConfigureBlufi2 D/BluetoothGatt: onClientRegistered() - status=0 clientIf=6 D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=6 device=A4:CF:12:43:C5:9A D/[EspActionDeviceConfigure]: onConnectionStateChange status=0, newState=2, address=A4:CF:12:43:C5:9A D/BluetoothGatt: discoverServices() - device: A4:CF:12:43:C5:9A D/BluetoothGatt: onConnectionUpdated() - Device=A4:CF:12:43:C5:9A interval=6 latency=0 timeout=500 status=0 D/BluetoothGatt: onSearchComplete() = Device=A4:CF:12:43:C5:9A Status=0 D/[EspActionDeviceConfigure]: onServicesDiscovered status=0 D/BluetoothGatt: setCharacteristicNotification() - uuid: 0000ff02-0000-1000-8000-00805f9b34fb enable: true D/[MainBleNotifyThread]: MainBleNotifyThread wait() D/BluetoothGatt: requestConnectionPriority() - params: 1 D/[EspActionDeviceConfigure]: Set BlufiClient complete D/BluetoothGatt: configureMTU() - device: A4:CF:12:43:C5:9A mtu: 128 D/BluetoothGatt: onConfigureMTU() - Device=A4:CF:12:43:C5:9A mtu=128 status=0 D/[EspActionDeviceConfigure]: onMtuChanged status=0, mtu=128 D/[EspActionDeviceConfigure]: onCharacteristicWrite status=0 D/[EspActionDeviceConfigure]: onCharacteristicChanged D/[EspActionDeviceConfigure]: onCharacteristicChanged D/BluetoothGatt: onConnectionUpdated() - Device=A4:CF:12:43:C5:9A interval=39 latency=0 timeout=500 status=0 D/[EspActionDeviceConfigure]: onCharacteristicChanged D/BlufiClientImpl: Get RSA device public key length 272 D/[EspActionDeviceConfigure]: onCharacteristicWrite status=133 D/BluetoothGatt: cancelOpen() - device: A4:CF:12:43:C5:9A D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=6 device=A4:CF:12:43:C5:9A D/[EspActionDeviceConfigure]: onConnectionStateChange status=8, newState=0, address=A4:CF:12:43:C5:9A D/BluetoothGatt: close() D/BluetoothGatt: unregisterApp() - mClientIf=6 D/[EspActionDeviceConfigure]: onGattClose D/BluetoothAdapter: isLeEnabled(): ON D/BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=6 mScannerId=0 D/[MainBleNotifyThread]: MainBleNotifyThread notified D/BluetoothAdapter: isLeEnabled(): ON I/chromium: [INFO:CONSOLE(1357)] "["a4cf1243c598"]", source: file:///android_asset/web/js/common.js (1357) D/BluetoothGatt: close() unregisterApp() - mClientIf=0 close() unregisterApp() - mClientIf=0 D/BluetoothGatt: connect() - device: A4:CF:12:43:C5:9A, auto: false registerApp() registerApp() - UUID=23c2048f-348e-41e7-bc4a-eec5fdb9c5fc D/EspActionDeviceConfigure2: Start doActionConfigureBlufi2 D/BluetoothGatt: onClientRegistered() - status=0 clientIf=6 D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=6 device=A4:CF:12:43:C5:9A D/[EspActionDeviceConfigure]: onConnectionStateChange status=0, newState=2, address=A4:CF:12:43:C5:9A D/BluetoothGatt: discoverServices() - device: A4:CF:12:43:C5:9A D/BluetoothGatt: onConnectionUpdated() - Device=A4:CF:12:43:C5:9A interval=6 latency=0 timeout=500 status=0 D/BluetoothGatt: onSearchComplete() = Device=A4:CF:12:43:C5:9A Status=0 D/[EspActionDeviceConfigure]: onServicesDiscovered status=0 D/BluetoothGatt: setCharacteristicNotification() - uuid: 0000ff02-0000-1000-8000-00805f9b34fb enable: true D/BluetoothGatt: requestConnectionPriority() - params: 1 D/[EspActionDeviceConfigure]: Set BlufiClient complete D/BluetoothGatt: configureMTU() - device: A4:CF:12:43:C5:9A mtu: 128 D/BluetoothGatt: onConfigureMTU() - Device=A4:CF:12:43:C5:9A mtu=128 status=0 D/[EspActionDeviceConfigure]: onMtuChanged status=0, mtu=128 D/[MainBleNotifyThread]: MainBleNotifyThread wait() D/[EspActionDeviceConfigure]: onCharacteristicWrite status=0 D/[EspActionDeviceConfigure]: onCharacteristicChanged D/[EspActionDeviceConfigure]: onCharacteristicChanged D/BluetoothGatt: onConnectionUpdated() - Device=A4:CF:12:43:C5:9A interval=39 latency=0 timeout=500 status=0 D/[EspActionDeviceConfigure]: onCharacteristicChanged D/BlufiClientImpl: Get RSA device public key length 272 D/[EspActionDeviceConfigure]: onCharacteristicWrite status=133 D/BluetoothGatt: cancelOpen() - device: A4:CF:12:43:C5:9A D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=6 device=A4:CF:12:43:C5:9A D/[EspActionDeviceConfigure]: onConnectionStateChange status=8, newState=0, address=A4:CF:12:43:C5:9A D/BluetoothGatt: close() unregisterApp() - mClientIf=6 D/[EspActionDeviceConfigure]: onGattClose D/BluetoothAdapter: isLeEnabled(): ON D/BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=6 mScannerId=0 D/[MainBleNotifyThread]: MainBleNotifyThread notified D/BluetoothAdapter: isLeEnabled(): ON I/chromium: [INFO:CONSOLE(1357)] "["a4cf1243c598"]", source: file:///android_asset/web/js/common.js (1357) D/BluetoothGatt: close() unregisterApp() - mClientIf=0 D/BluetoothGatt: close() D/BluetoothGatt: unregisterApp() - mClientIf=0 D/BluetoothGatt: connect() - device: A4:CF:12:43:C5:9A, auto: false D/BluetoothGatt: registerApp() registerApp() - UUID=2ae8c330-4d3d-4d25-a6f4-fd31469f30a5 D/EspActionDeviceConfigure2: Start doActionConfigureBlufi2 D/BluetoothGatt: onClientRegistered() - status=0 clientIf=6 D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=6 device=A4:CF:12:43:C5:9A D/[EspActionDeviceConfigure]: onConnectionStateChange status=0, newState=2, address=A4:CF:12:43:C5:9A D/BluetoothGatt: discoverServices() - device: A4:CF:12:43:C5:9A D/BluetoothGatt: onConnectionUpdated() - Device=A4:CF:12:43:C5:9A interval=6 latency=0 timeout=500 status=0 D/BluetoothGatt: onSearchComplete() = Device=A4:CF:12:43:C5:9A Status=0 D/[MainBleNotifyThread]: MainBleNotifyThread wait() D/[EspActionDeviceConfigure]: onServicesDiscovered status=0 D/BluetoothGatt: setCharacteristicNotification() - uuid: 0000ff02-0000-1000-8000-00805f9b34fb enable: true D/BluetoothGatt: requestConnectionPriority() - params: 1 D/[EspActionDeviceConfigure]: Set BlufiClient complete D/BluetoothGatt: configureMTU() - device: A4:CF:12:43:C5:9A mtu: 128 D/BluetoothGatt: onConfigureMTU() - Device=A4:CF:12:43:C5:9A mtu=128 status=0 D/[EspActionDeviceConfigure]: onMtuChanged status=0, mtu=128 D/BluetoothGatt: onConnectionUpdated() - Device=A4:CF:12:43:C5:9A interval=39 latency=0 timeout=500 status=0 D/[EspActionDeviceConfigure]: onCharacteristicWrite status=0 D/[EspActionDeviceConfigure]: onCharacteristicChanged I/chatty: uid=10320(h5.espressif.esp32) Binder:21432_4 identical 1 line D/[EspActionDeviceConfigure]: onCharacteristicChanged D/BlufiClientImpl: Get RSA device public key length 272 D/[EspActionDeviceConfigure]: onCharacteristicWrite status=133 D/BluetoothGatt: cancelOpen() - device: A4:CF:12:43:C5:9A D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=6 device=A4:CF:12:43:C5:9A D/[EspActionDeviceConfigure]: onConnectionStateChange status=8, newState=0, address=A4:CF:12:43:C5:9A D/BluetoothGatt: close() unregisterApp() - mClientIf=6 D/[EspActionDeviceConfigure]: onGattClose D/BluetoothAdapter: isLeEnabled(): ON D/BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=6 mScannerId=0 D/[MainBleNotifyThread]: MainBleNotifyThread notified D/BluetoothAdapter: isLeEnabled(): ON I/chromium: [INFO:CONSOLE(1357)] "["a4cf1243c598"]", source: file:///android_asset/web/js/common.js (1357) D/BluetoothGatt: close() D/BluetoothGatt: unregisterApp() - mClientIf=0 D/BluetoothGatt: close() unregisterApp() - mClientIf=0 D/BluetoothGatt: connect() - device: A4:CF:12:43:C5:9A, auto: false registerApp() D/BluetoothGatt: registerApp() - UUID=9084a146-f22b-4f67-9d14-122c52069dba D/EspActionDeviceConfigure2: Start doActionConfigureBlufi2 D/BluetoothGatt: onClientRegistered() - status=0 clientIf=6 D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=6 device=A4:CF:12:43:C5:9A D/[EspActionDeviceConfigure]: onConnectionStateChange status=0, newState=2, address=A4:CF:12:43:C5:9A D/BluetoothGatt: discoverServices() - device: A4:CF:12:43:C5:9A D/BluetoothGatt: onConnectionUpdated() - Device=A4:CF:12:43:C5:9A interval=6 latency=0 timeout=500 status=0 D/BluetoothGatt: onSearchComplete() = Device=A4:CF:12:43:C5:9A Status=0 D/[EspActionDeviceConfigure]: onServicesDiscovered status=0 D/BluetoothGatt: setCharacteristicNotification() - uuid: 0000ff02-0000-1000-8000-00805f9b34fb enable: true D/BluetoothGatt: requestConnectionPriority() - params: 1 D/[EspActionDeviceConfigure]: Set BlufiClient complete D/BluetoothGatt: configureMTU() - device: A4:CF:12:43:C5:9A mtu: 128 D/BluetoothGatt: onConfigureMTU() - Device=A4:CF:12:43:C5:9A mtu=128 status=0 D/[EspActionDeviceConfigure]: onMtuChanged status=0, mtu=128 D/BluetoothGatt: onConnectionUpdated() - Device=A4:CF:12:43:C5:9A interval=39 latency=0 timeout=500 status=0 D/[EspActionDeviceConfigure]: onCharacteristicWrite status=0 D/[EspActionDeviceConfigure]: onCharacteristicChanged D/[MainBleNotifyThread]: MainBleNotifyThread wait() D/[EspActionDeviceConfigure]: onCharacteristicChanged D/[EspActionDeviceConfigure]: onCharacteristicChanged D/BlufiClientImpl: Get RSA device public key length 272 D/[EspActionDeviceConfigure]: onCharacteristicWrite status=133 D/BluetoothGatt: cancelOpen() - device: A4:CF:12:43:C5:9A D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=6 device=A4:CF:12:43:C5:9A D/[EspActionDeviceConfigure]: onConnectionStateChange status=8, newState=0, address=A4:CF:12:43:C5:9A D/BluetoothGatt: close() D/BluetoothGatt: unregisterApp() - mClientIf=6 D/[EspActionDeviceConfigure]: onGattClose D/BluetoothGatt: close() D/BluetoothGatt: unregisterApp() - mClientIf=0 D/BluetoothGatt: close() unregisterApp() - mClientIf=0
看 Log 是因为 Gatt Write 失败了 请问一下你们使用的手机型号和系统版本?
系统版本为ESPMESH 版本3.2,测试手机型号为三星和小米两款手机。
具体的手机型号的系统呢? 两款手机是相同的情况吗?
一个是android版本9,另外一个没有看。两款手机的情况是一样的。 应该是,你们的程序有问题的。
会不会是mdf版本和你们现在的版本加密的那个地方有问题?导致app跟下载到硬件里面的不配套导致的?
尝试一下修改 MTU 值试试
在接口 IEspActionDeviceBlufi 内
int DEFAULT_MTU_LENGTH = 128;
改成 20 试试
试过的,不行的 D/BluetoothGatt: onConnectionUpdated() - Device=3C:71:BF:5F:AD:BA interval=39 latency=0 timeout=500 status=0 D/[MainBleNotifyThread]: MainBleNotifyThread wait() D/BluetoothGatt: onConnectionUpdated() - Device=3C:71:BF:5F:AD:BA interval=12 latency=0 timeout=2000 status=0 D/BluetoothGatt: onClientConnectionState() - status=19 clientIf=5 device=3C:71:BF:5F:AD:BA D/[EspActionDeviceConfigure]: onConnectionStateChange status=19, newState=0, address=3C:71:BF:5F:AD:BA D/BluetoothGatt: close() D/BluetoothGatt: unregisterApp() - mClientIf=5 I/chromium: [INFO:CONSOLE(1373)] "9003", source: file:///android_asset/web/js/common.js (1373) D/[EspActionDeviceConfigure]: onGattClose I/chromium: [INFO:CONSOLE(1402)] "where is wrong is lock _cjx", source: file:///android_asset/web/js/common.js (1402) I/chromium: [INFO:CONSOLE(1403)] "9003", source: file:///android_asset/web/js/common.js (1403) D/BluetoothGatt: close() unregisterApp() - mClientIf=0 D/BluetoothGatt: close() unregisterApp() - mClientIf=0
整个的信息如下:
// int DEFAULT_MTU_LENGTH = 128;
修改为: int DEFAULT_MTU_LENGTH = 20;
出现的信息如下:
05/09 14:25:45: Launching 'app' on Xiaomi Redmi 6.
$ adb shell am start -n "h5.espressif.esp32/h5.espressif.esp32.module.main.EspWebActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Waiting for process to come online...
Connected to process 18472 on device 'xiaomi-redmi_6-6c1e97287d26'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/espressif.esp3: Late-enabling -Xcheck:jni
E/libc: Access denied finding property "persist.vendor.sys.activitylog"
I/MultiDex: VM with version 2.1.0 has multidex support
Installing application
VM has multidex support, MultiDex support library is disabled.
D/MeshApp: first is run here
I/chatty: uid=10326(h5.espressif.esp32) identical 1 line
D/MeshApp: first is run here
W/MeshApp: Init Aliyun failed
W/espressif.esp3: Accessing hidden method Landroid/graphics/drawable/Drawable;->getOpticalInsets()Landroid/graphics/Insets; (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking)
I/espressif.esp3: The ClassLoaderContext is a special shared library.
W/Binder:intercep: type=1400 audit(0.0:13259367): avc: denied { getattr } for path="/data/data/com.miui.contentcatcher" dev="dm-2" ino=3270568 scontext=u:r:untrusted_app:s0:c70,c257,c512,c768 tcontext=u:object_r:system_app_data_file:s0 tclass=dir permissive=0
D/ViewContentFactory: initViewContentFetcherClass
getInterceptorPackageInfo
W/espressif.esp3: Accessing hidden method Landroid/app/AppGlobals;->getInitialApplication()Landroid/app/Application; (light greylist, linking)
D/ViewContentFactory: getInitialApplication took 2ms
packageInfo.packageName: com.miui.catcherpatch
D/ViewContentFactory: initViewContentFetcherClass took 19ms
I/ContentCatcher: ViewContentFetcher : ViewContentFetcher
D/ViewContentFactory: createInterceptor took 19ms
W/espressif.esp3: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
W/espressif.esp3: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
I/WebViewFactory: Loading com.google.android.webview version 74.0.3729.136 (code 372913600)
I/cr_LibraryLoader: Time to load native libraries: 4 ms (timestamps 1344-1348)
W/chromium: [0509/222557.518214:WARNING:library_prefetcher.cc(328)] Code not ordered, madvise optimization skipped
I/chromium: [INFO:library_loader_hooks.cc(50)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_LibraryLoader: Expected native library version number "74.0.3729.136", actual native library version number "74.0.3729.136"
W/cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.google.android.webview, sandboxed = true
W/espressif.esp3: Accessing hidden method Landroid/content/Context;->bindServiceAsUser(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/Handler;Landroid/os/UserHandle;)Z (light greylist, reflection)
I/cr_BrowserStartup: Initializing chromium process, singleProcess=false
W/espressif.esp3: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker;->
从 LOG 看,MTU 设置 20 后就被设备踢掉连接了,跟之前情况不一样了 先把把 MTU 改成 23,然后在类 BlufiClientImpl 的函数 gattWrite 加一下打印: Log.i(TAG, "GattWrite: length=" + data.length + " , data=" + Arrays.toString(data)); 我看看发包情况
把MTU改为23以后,就没有问题了。提示可以连接,也可以正常使用了。挺不错的。
common.js中的1267行函数startWifi:function(self)中,蓝牙配网,匹配成功以后,无法将wifi和密码传递,在函数中,无法配网。有问题。