EspressifApp / EspBlufiForAndroid

EspBlufi is based on the BLUFI protocol, which connect with IOT devices for BLE data communication, realizes device config network, and custom data transmission and reception. EspBlufi is developed and maintained by Espressif Corp.
Other
322 stars 124 forks source link

配网失败 设备不支持5G WIFI,继续配网? #18

Closed tangchuanyong closed 4 years ago

tangchuanyong commented 4 years ago

我这边在配网是显示 设备不支持5G WIFI,继续配网? 是不是这个原因导致的问题!

LOG:Post configure params complete LOG:Receive error code -1000

XuXiangJun commented 4 years ago

只有当路由器的 5G 的 SSID、密码 和 2.4 G 设置一样的情况才能配网成功 要不然设备是连不上 5G 信号的

XuXiangJun commented 4 years ago

从这两个 LOG 看, APP 发送配网信息成功了,但设备连不上,所以报错了

tangchuanyong commented 4 years ago

不是这个问题,一会好一会坏!这会儿又好了!

XuXiangJun commented 4 years ago

能看手机的 logcat 吗?能看的话把打印内容提供一下

tangchuanyong commented 4 years ago

W/System.err: java.lang.ArrayIndexOutOfBoundsException: src.length=20 srcPos=4 dst.length=23 dstPos=0 length=23 W/System.err: at java.lang.System.arraycopy(Native Method) W/System.err: at blufi.espressif.BlufiClientImpl.parseNotification(BlufiClientImpl.java:457) W/System.err: at blufi.espressif.BlufiClientImpl.access$2000(BlufiClientImpl.java:43) W/System.err: at blufi.espressif.BlufiClientImpl$InnerGattCallback.onCharacteristicChanged(BlufiClientImpl.java:1220) W/System.err: at android.bluetooth.BluetoothGatt$1$8.run(BluetoothGatt.java:468) W/System.err: at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:770) W/System.err: at android.bluetooth.BluetoothGatt.access$200(BluetoothGatt.java:39) W/System.err: at android.bluetooth.BluetoothGatt$1.onNotify(BluetoothGatt.java:462) W/System.err: at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:185) W/System.err: at android.os.Binder.execTransact(Binder.java:750)

XuXiangJun commented 4 years ago

请问用的是什么版本的 APP ?

tangchuanyong commented 4 years ago

我公司这边没有5G WIFI,用的就是2.4G的路由器!这里报角标越界!

tangchuanyong commented 4 years ago

APP版本 1.5.2 BluFi库版本 2.3.2

tangchuanyong commented 4 years ago

System.arraycopy(response, dataOffset, dataBytes, 0, dataLen); src.length=20 srcPos=4 dst.length=23 dstPos=0 length=23 这里复制数组的时候出现问题,数据源长度只有20 起始位置是4 但是要复制的长度是23 肯定不够

tangchuanyong commented 4 years ago

response====: [61, 4, 1, 23, 0, 0, 0, 1, 6, -68, -35, -62, -43, 78, 124, 2, 10, 90, 101, 98] responselength====: 20 dataOffset====: 4 dataLen====: 23 Exception====: src.length=20 srcPos=4 dst.length=23 dstPos=0 length=23

XuXiangJun commented 4 years ago

我待会更新下代码,到时你再试试

XuXiangJun commented 4 years ago

代码更新了,试试看

tangchuanyong commented 4 years ago

tangchuanyong commented 4 years ago

Receive device status response: op mode:NULL

tangchuanyong commented 4 years ago

没有其他任何信息!

XuXiangJun commented 4 years ago

先配网,配完网之后才会有其他信息的 选择 Station 模式配

XuXiangJun commented 4 years ago

不应该啊,你们对设备端代码有做过修改吗?

tangchuanyong commented 4 years ago

IOS端一直没有任何问题!

tangchuanyong commented 4 years ago

要是设备端的代码改掉的话,ios那边肯定也会报错的!

XuXiangJun commented 4 years ago

我这边测的没有任何问题啊 能看看设备那边的打印收到的是什么数据吗?

tangchuanyong commented 4 years ago

E/response ==: [0, 4, 0, 1, 0] E/dataOffset ==: 4 E/responselenght ==: 5 E/dataByteslengnt ==: 1 E/dataLen ==: 1 _good 56255 tx_bad 6 rx_good 62521 tx_retry 6322 RM release without a matched acquire! process_indicate, ignore HID ind/notificiation E/response ==: [61, 4, 1, 23, 0, 0, 0, 1, 6, -68, -35, -62, -43, 78, 124, 2, 10, 90, 101, 98, 114, 97, 95, 104, 111, 109, 101] E/dataOffset ==: 4 E/responselenght ==: 27 E/dataByteslengnt ==: 23

tangchuanyong commented 4 years ago

返回两次respon

XuXiangJun commented 4 years ago

我是说设备那边收到的数据。。 要不你在类 BlufiClientImpl 的函数 gattWrite 第一行添加打印 Log.i(TAG, "gattWrite= " + Arrays.toString(data)); 看看发出去的数据

tangchuanyong commented 4 years ago

gattWrite= [8, 8, 0, 1, 1] gattWrite= [9, 0, 1, 10, 90, 101, 98, 114, 97, 95, 104, 111, 109, 101] gattWrite= [13, 0, 2, 11, 90, 101, 98, 114, 97, 49, 50, 51, 52, 53, 54] gattWrite= [12, 0, 3, 0]

tangchuanyong commented 4 years ago

443820294 要不加QQ吧 这样太麻烦了!

tangchuanyong commented 4 years ago

我这连接github卡的很!

XuXiangJun commented 4 years ago

第一包第 5 个字节的 1 就表示是 station 模式,发的模式应该没有错,设备那边没有切换

XuXiangJun commented 4 years ago

不好意思,我们不允许加私人联系

tangchuanyong commented 4 years ago

网关那边怎么切换

tangchuanyong commented 4 years ago

网关那边我不太知道,要不我问下硬件那边!

XuXiangJun commented 4 years ago

如果你们对设备那边的代码也做了修改,有相关问题可以去 https://github.com/espressif/esp-idf 这个项目下问,我这边也只支持 APP,设备端不懂

tangchuanyong commented 4 years ago

tangchuanyong commented 4 years ago

设备端那边反馈只设置了station模式!

tangchuanyong commented 4 years ago

2020-03-26 08:43:24.067 802-1186/com.espressif.espblufi W/BlufiClientImpl: gattWrite= [8, 8, 0, 1, 1] 2020-03-26 08:43:24.093 802-952/com.espressif.espblufi W/BlufiClientImpl: response ==: [0, 4, 0, 1, 0] 2020-03-26 08:43:24.093 802-1186/com.espressif.espblufi W/BlufiClientImpl: gattWrite= [9, 0, 1, 10, 90, 101, 98, 114, 97, 95, 104, 111, 109, 101] 2020-03-26 08:43:24.132 802-1186/com.espressif.espblufi W/BlufiClientImpl: gattWrite= [13, 0, 2, 11, 90, 101, 98, 114, 97, 49, 50, 51, 52, 53, 54] 2020-03-26 08:43:24.178 802-1186/com.espressif.espblufi W/BlufiClientImpl: gattWrite= [12, 0, 3, 0] 2020-03-26 08:43:26.730 802-952/com.espressif.espblufi W/BlufiClientImpl: response ==: [61, 4, 1, 23, 0, 0, 0, 1, 6, -68, -35, -62, -43, 78, 124, 2, 10, 90, 101, 98, 114, 97, 95, 104, 111, 109, 101]

tangchuanyong commented 4 years ago

这样的数据能发现问题吗?

tangchuanyong commented 4 years ago

设备端无反馈! 为什么会返回 op mdoe:NULL

tangchuanyong commented 4 years ago

2020-03-26 08:54:57.635 1491-5786/? D/ActivityTrigger: activityStartTrigger: Activity is Triggerred in full screen ApplicationInfo{4fbbb16 com.espressif.espblufi} 2020-03-26 08:54:57.635 1491-5786/? E/ActivityTrigger: activityStartTrigger: not whiteListedcom.espressif.espblufi/com.espressif.espblufi.ui.ConfigureOptionsActivity/24 2020-03-26 08:54:57.636 1491-5786/? D/ActivityTrigger: activityResumeTrigger: The activity in ApplicationInfo{4fbbb16 com.espressif.espblufi} is now in focus and seems to be in full-screen mode 2020-03-26 08:54:57.636 1491-5786/? E/ActivityTrigger: activityResumeTrigger: not whiteListedcom.espressif.espblufi/com.espressif.espblufi.ui.ConfigureOptionsActivity/24 2020-03-26 08:54:57.653 1491-5786/? D/ActivityTrigger: activityResumeTrigger: The activity in ApplicationInfo{4fbbb16 com.espressif.espblufi} is now in focus and seems to be in full-screen mode 2020-03-26 08:54:57.653 1491-5786/? E/ActivityTrigger: activityResumeTrigger: not whiteListedcom.espressif.espblufi/com.espressif.espblufi.ui.ConfigureOptionsActivity/24 2020-03-26 08:54:57.655 1491-5786/? D/RMS-PreloadedAppRecordMgr: setNeedKeepQuiet pkgName=com.espressif.espblufi,userId=0uid=0,keepQuiet=false 2020-03-26 08:54:57.667 6290-6290/com.espressif.espblufi W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@501c851 2020-03-26 08:54:57.701 6290-6290/com.espressif.espblufi W/ressif.espbluf: Accessing hidden method Landroid/widget/PopupWindow;->setEpicenterBounds(Landroid/graphics/Rect;)V (light greylist, linking) 2020-03-26 08:54:57.702 6290-6290/com.espressif.espblufi W/ressif.espbluf: Accessing hidden method Landroid/widget/PopupWindow;->setClipToScreenEnabled(Z)V (light greylist, reflection) 2020-03-26 08:54:57.751 1491-5785/? D/TansactManager: addProxyBpBinder BpTransactProxy{descriptor=IContentObserver pkg=com.espressif.espblufi proc=com.espressif.espblufi uid=10490 pid=6290 proxy=false binder=android.os.BinderProxy@40ac56e} 2020-03-26 08:54:57.777 6290-6290/com.espressif.espblufi I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead. 2020-03-26 08:54:57.795 6290-6290/com.espressif.espblufi I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead. 2020-03-26 08:54:57.798 6290-6295/com.espressif.espblufi I/ressif.espbluf: Compiler allocated 4MB to compile void android.widget.TextView.(android.content.Context, android.util.AttributeSet, int, int) 2020-03-26 08:54:57.833 6290-6290/com.espressif.espblufi W/ressif.espbluf: Accessing hidden method Landroid/net/wifi/WifiInfo;->getWifiSsid()Landroid/net/wifi/WifiSsid; (light greylist, reflection) 2020-03-26 08:54:57.833 6290-6290/com.espressif.espblufi W/ressif.espbluf: Accessing hidden method Landroid/net/wifi/WifiSsid;->getOctets()[B (light greylist, reflection) 2020-03-26 08:54:57.868 1491-5785/? D/TansactManager: addProxyBpBinder BpTransactProxy{descriptor=IWindow pkg=com.espressif.espblufi proc=com.espressif.espblufi uid=10490 pid=6290 proxy=false binder=android.os.BinderProxy@1d1c40f} 2020-03-26 08:54:57.883 6290-6290/com.espressif.espblufi I/TouchMotionHandler: handler onAttached 2020-03-26 08:54:57.961 706-706/? E/ANDR-IOP: IOP HAL: Received pkg_name = com.espressif.espblufi pid = 0 2020-03-26 08:54:57.961 1491-1634/? I/ActivityManager: Displayed com.espressif.espblufi/.ui.ConfigureOptionsActivity: +301ms 2020-03-26 08:54:57.970 706-706/? E/ANDR-IOP: IOP HAL: Received pkg_name = com.espressif.espblufi pid = 0 2020-03-26 08:54:58.011 6290-6321/com.espressif.espblufi D/OpenGLRenderer: endAllActiveAnimators on 0x7251556600 (RippleDrawable) with handle 0x7251458c00 2020-03-26 08:54:59.101 6290-6290/com.espressif.espblufi E/BackgroundFallback: initVivoBgFallback callstackcom.android.internal.policy.DecorView.:388 com.android.internal.policy.PhoneWindow.generateDecor:2441 com.android.internal.policy.PhoneWindow.installDecor:2820 com.android.internal.policy.PhoneWindow.getDecorView:2185 androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor:717 androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor:659 androidx.appcompat.app.AppCompatDelegateImpl.setContentView:552 androidx.appcompat.app.AppCompatDialog.setContentView:95 androidx.appcompat.app.AlertController.installContent:232 androidx.appcompat.app.AlertDialog.onCreate:279 2020-03-26 08:54:59.142 1491-5785/? D/TansactManager: addProxyBpBinder BpTransactProxy{descriptor=IWindow pkg=com.espressif.espblufi proc=com.espressif.espblufi uid=10490 pid=6290 proxy=false binder=android.os.BinderProxy@90104cc} 2020-03-26 08:54:59.151 6290-6290/com.espressif.espblufi W/[ConfigureOptionsActivity]: Generate configure params null 2020-03-26 08:54:59.165 6290-6290/com.espressif.espblufi I/TouchMotionHandler: handler onAttached 2020-03-26 08:54:59.185 751-751/? D/SurfaceFlinger: duplicate layer name: changing com.espressif.espblufi/com.espressif.espblufi.ui.ConfigureOptionsActivity to com.espressif.espblufi/com.espressif.espblufi.ui.ConfigureOptionsActivity#1 2020-03-26 08:55:00.338 6290-6290/com.espressif.espblufi I/TouchMotionHandler: handler onDetached 2020-03-26 08:55:00.341 6290-6321/com.espressif.espblufi D/OpenGLRenderer: endAllActiveAnimators on 0x724f4a9e00 (RippleDrawable) with handle 0x724fe624e0 2020-03-26 08:55:00.361 1491-5785/? D/ActivityTrigger: activityResumeTrigger: The activity in ApplicationInfo{4fbbb16 com.espressif.espblufi} is now in focus and seems to be in full-screen mode 2020-03-26 08:55:00.361 1491-5785/? E/ActivityTrigger: activityResumeTrigger: not whiteListedcom.espressif.espblufi/com.espressif.espblufi.ui.BlufiActivity/24 2020-03-26 08:55:00.385 6290-6401/com.espressif.espblufi W/BlufiClientImpl: gattWrite= [8, 8, 0, 1, 1] 2020-03-26 08:55:00.420 6290-6344/com.espressif.espblufi W/BlufiClientImpl: response ==: [0, 4, 0, 1, 0] 2020-03-26 08:55:00.420 6290-6401/com.espressif.espblufi W/BlufiClientImpl: gattWrite= [9, 0, 1, 10, 90, 101, 98, 114, 97, 95, 104, 111, 109, 101] 2020-03-26 08:55:00.459 6290-6401/com.espressif.espblufi W/BlufiClientImpl: gattWrite= [13, 0, 2, 11, 90, 101, 98, 114, 97, 49, 50, 51, 52, 53, 54] 2020-03-26 08:55:00.506 6290-6401/com.espressif.espblufi W/BlufiClientImpl: gattWrite= [12, 0, 3, 0] 2020-03-26 08:55:00.516 1491-1796/? D/TansactManager: removeProxyBpBinder BpTransactProxy{descriptor=IWindow pkg=com.espressif.espblufi proc=com.espressif.espblufi uid=10490 pid=6290 proxy=false binder=android.os.BinderProxy@90104cc} 2020-03-26 08:55:00.518 751-869/? W/SurfaceFlinger: Attempting to set client state on removed layer: com.espressif.espblufi/com.espressif.espblufi.ui.ConfigureOptionsActivity#1 2020-03-26 08:55:00.518 751-869/? W/SurfaceFlinger: Attempting to destroy on removed layer: com.espressif.espblufi/com.espressif.espblufi.ui.ConfigureOptionsActivity#1 2020-03-26 08:55:00.732 6290-6290/com.espressif.espblufi I/TouchMotionHandler: handler onDetached 2020-03-26 08:55:00.734 1491-2315/? D/TansactManager: removeProxyBpBinder BpTransactProxy{descriptor=IWindow pkg=com.espressif.espblufi proc=com.espressif.espblufi uid=10490 pid=6290 proxy=false binder=android.os.BinderProxy@1d1c40f} 2020-03-26 08:55:03.283 6290-6344/com.espressif.espblufi W/BlufiClientImpl: response ==: [61, 4, 1, 23, 0, 0, 0, 1, 6, -68, -35, -62, -43, 78, 124, 2, 10, 90, 101, 98, 114, 97, 95, 104, 111, 109, 101] 2020-03-26 08:55:40.052 6290-6401/com.espressif.espblufi W/BlufiClientImpl: gattWrite= [20, 0, 4, 0] 2020-03-26 08:55:40.141 6290-6295/com.espressif.espblufi I/ressif.espbluf: Compiler allocated 4MB to compile void android.view.ViewRootImpl.performTraversals() 2020-03-26 08:55:40.187 6290-6344/com.espressif.espblufi W/BlufiClientImpl: response ==: [61, 4, 2, 23, 0, 0, 0, 1, 6, -68, -35, -62, -43, 78, 124, 2, 10, 90, 101, 98, 114, 97, 95, 104, 111, 109, 101]

tangchuanyong commented 4 years ago

已解决。硬件那边查了一下返回的数据!

XuXiangJun commented 4 years ago

配网包内容在我看来是没问题的,其他命令都有效吗? [8, 8, 0, 1, 1] 这一包是设置 stataion 模式 [9, 0, 1, 10, 90, 101, 98, 114, 97, 95, 104, 111, 109, 101] 这一包是设置 SSID [13, 0, 2, 11, 90, 101, 98, 114, 97, 49, 50, 51, 52, 53, 54] 这一包是设置 密码 [12, 0, 3, 0] 这一包是通知设备开始配网

XuXiangJun commented 4 years ago

好的

lmz13411274381 commented 4 years ago

@tangchuanyong 你好,我也出现了你说的APP端-1000的值,您是怎么解决能说下吗?

tangchuanyong commented 4 years ago

@tangchuanyong 你好,我也出现了你说的APP端-1000的值,您是怎么解决能说下吗?

— 这种情况和硬件开发那边有关系,没有按照说明文档要求传递wifi和密码。数据加密后对不上号了。我这边当时对接发现这个问题让硬件开发那边查看原因。

tangchuanyong commented 4 years ago

后面我们弃用蓝牙配网了,使用esp_touch方案配网。要方便很多。而且可以不用去管蓝牙适配。Android这里在5.0以下的机型搞蓝牙适配能搞死人。我把资料放在附件了,你可以看下,需要下载demo的话再github搜索esp_touch就好了。需要你们硬件那边配合使用。蓝牙在Android低版本机型,基本无法适配。那时候连蓝牙协议都没有统一。好多厂家都是自己的协议。api全部不一样的。