华为手机超级终端连接开发板(Hi3861+Hi3516)失败~T_T~
华为手机超级终端连接开发板(Hi3861+Hi3516)失败~T_T~
liangkz 2021.07.12
一直尝试着通过华为手机的超级终端去发现和连接开发板(Hi3861+Hi3516),在社区和网络上找了很久的相关资料(软总线相关)、也看了鸿蒙系统自带的readme、测试代码,向华为官方咨询、在gitee的communication_softbus_lite上提需求,都没有得到有效的办法,能够达成目标,目前对软总线模块的理解,就卡在这里了~~
在发布分支OpenHarmony_1.0.1_release的代码基础上,写测试代码,PublishService() OK。
【实际上Hi3516的dtbschedsrv服务的dmslite feature已经通过 OnInitialize()->InitSoftbusService()->PublishService(dms) 发布服务成功了。
而Hi3861也通过测试代码在合适的地方 PublishService() 发布服务成功了。】
华为手机【已经更新到鸿蒙系统 2.0.0.135 版本】打开超级终端时,Hi3516/Hi3861开发板都能收到很多条手机端的广播消息,但开发板这边的响应,总会出现失败,部分log如下。
有没有人知道,开发板这边需要做些什么配置,才能让华为手机的超级终端发现并连接上,烦请告知一声,谢谢。
==============================================================================
Hi3861 开发板(基于OpenHarmony_1.0.1_release代码编写的测试用例)PublishService() 发布服务成功
开发板收到多条广播:
#coap_listen_task#:: HandleReadEvent(UDP ServerSocket Fvent), serverFd[0]
HandleReadEvent Begin: [coap_discover]
HandleReadEvent [3-1] CoapSocketRecv() [391] Bytes to recvBuffer
HandleReadEvent [3-2] COAP_SoftBusDecode(recvBuffer to decodePacket): COAP_UDP
HandleReadEvent [3-3] PostServiceDiscover(decodePacket): ResponseService
decodePacket:
payload.len[354]
{"deviceId":"{"UDID":"E36AD7。。。。。。418302983"}","devicename":"HUAWEI Mate 40E","hicomversion":"3.1.0.0","mode":1,"deviceHash":"2850。。。3123","serviceData":"port:36731","extendServiceData":"","w【看上去没有打印完整的payload data出来】
HandleReadEvent End.
开发板端经过:
[bus_manager] OnConnectEvent(IP[192.168.1.118]): ProcessConnectEvent()
[wifi_auth_manager] ProcessConnectEvent(fd[4])[2-2]: AddAuthConnToList(ip[192.168.1.118])->OK
。。。
[bus_manager] OnDataEvent(fd[4]): ProcessDataEvent()
[wifi_auth_manager] ProcessDataEvent(fd[4]): AuthConnRecv(rc[223] Bytes)->OK
。。。
[bus_manager] OnDataEvent(fd[4]): ProcessDataEvent()
[wifi_auth_manager] ProcessDataEvent(fd[4]): AuthConnRecv(rc[830] Bytes)->OK
[wifi_auth_manager] OnDataReceived: {"authForm":1,"userId":2850。。。3123, "step":0,"deviceId":"67AAB22A7C。。。。。。4CE7FEC3067E", "servicePkgName":"com.huawei.nearby","data":"8000001600000000【看上去没有打印完整的data出来】
。。。
[auth_interface][HiChain] AuthInitHiChain(sessionId = 1) Begin:
[hichain] get_instance() Begin:
[hichain] get_instance() End. return hichain
[auth_interface][HiChain] AuthInitHiChain(sessionId = 1) End....HiChain....
[hichain] receive_data() Begin: data[], datalen
[parsedata] parse_data() NG message_code[-1] // get_json_int(obj, FIELD_MESSAGE) fail
[parsedata] parse_data() NG, return NULL
[hichain] deserialize_message() parse_data() ret=[NULL] return 9-HC_BUILD_OBJECT_FAILED
[hichain] receive_data(): deserialize_message() ret=9
[auth_interface][HiChain] -> AuthOnTransmit(): AuthSendData({"message":32896, "payload":{"errorCode":9}})
[auth_interface][HiChain] AuthSetServiceResult: result[1][END_FAILED]
[auth_interface][HiChain] DestroyHiChain
最终连接失败。
=============================================================================
Hi3516 开发板(基于OpenHarmony_1.0.1_release代码编写的测试用例)PublishService(dms) 发布服务成功
开发板收到多条广播:
#coap_listen_task#:: HandleReadEvent(UDP ServerSocket Fvent), serverFd[85]
HandleReadEvent Begin: [coap_discover]
HandleReadEvent [3-1] CoapSocketRecv() [391] Bytes to recvBuffer
HandleReadEvent [3-2] COAP_SoftBusDecode(recvBuffer to decodePacket): COAP_UDP
HandleReadEvent [3-3] PostServiceDiscover(decodePacket): ResponseService
decodePacket:
payload.len[354]:
{"deviceId":"{"UDID":"E36AD77903F。。。。。。18302983"}","devicename":"HUAWEI Mate 40E","hicomversion":"3.1.0.0","mode":1,"deviceHash":"2850。。。3123","serviceData":"port:36731","extendServiceData":"","wlanIp":"192.168.1.118","capabilityBitmap":[199],"type":14,"coapUri":"coap://192.168.1.118/device_discover"}
HandleReadEvent End.
开发板端经过:
[bus_manager] OnConnectEvent(IP[192.168.1.118]): ProcessConnectEvent()
[wifi_auth_manager] ProcessConnectEvent(fd[92]): AddAuthConnToList(ip[192.168.1.118])->OK
。。。
[bus_manager] OnDataEvent(fd[92]): ProcessDataEvent()
[wifi_auth_manager] ProcessDataEvent(fd[92]): AuthConnRecv(rc[223] Bytes)->OK
。。。
[bus_manager] OnDataEvent(fd[92]): ProcessDataEvent()
[wifi_auth_manager] ProcessDataEvent(fd[92]): AuthConnRecv(rc[830] Bytes)->OK
[wifi_auth_manager] OnDataReceived: {"authForm":1,"userId":2850。。。913123, "step":0,"deviceId":"67AAB22A。。。。。。4CE7FEC3067E", "servicePkgName":"com.huawei.nearby","data":"800000160000000000000124002701【后面一大串data】
。。。
[auth_interface] AuthInterfaceOnDataReceived(module[3]3-MODULE_AUTH_SDK) Begin:
[auth_interface] AuthProcessReceivedData(sessionId[1])
[auth_interface][HiChain] AuthInitHiChain(sessionId = 1) Begin:
[hichain] get_instance() Begin:
[hichain] get_instance() key_info_init()
[huks_adapter] key_info_init() hks_init() ret = -1-ERROR_CODE_FAILED
[hichain] get_instance() key_info_init() NG
[auth_interface] AuthInterfaceOnDataReceived(module[3]) End.
最终连接失败。
我猜,你可能需要鸿蒙测试版手机,跑的镜像系统,专门用来连接那些没有发布的物联网设备。例如市面上支持鸿蒙的家电,在开发阶段,正式版鸿蒙手机碰鸿蒙NFC贴纸,进行配网会有问题,甚至根别发现不了设备,只能用测试版手机去配网,我估计超级终端也是同理。鸿蒙设备互联的安全性做得很苛刻,手机系统、手机APP、NFC贴纸、嵌入式设备软硬件等等,任何一个环节的参数出错都有可能导致发现和连接设备出问题,开发过程很多坑,一言难尽。最后,测试版手机应该只有合作的公司能申请到吧,不知道能不能自己编译手机ROM?
支持一下,能不能把失败的尝试也发个教程上来!