当前位置:网站首页>Modification and analysis of libcoap source code by Hongmeng device discovery module

Modification and analysis of libcoap source code by Hongmeng device discovery module

2022-06-13 05:02:00 Snow * sleet * snow

The soft bus device discovery module of Hongmeng system discovery The module uses coap agreement , And based on libcoap Open source library for development , The specific use is libcoap2.0 edition ( at present libcoap Updated to 3.0).
Use coap The protocol mainly considers the operation HarmonyOS In addition to mobile phones with good hardware performance 、 Computers and other equipment , There are also Internet of things devices with limited resources , Of these devices ram、rom Relatively small .coap The protocol supports lightweight and reliable transmission , It is suitable for small embedded devices with limited resources .
discovery The premise of the implementation is to ensure that the discovery end device and the receiving end device are in the same LAN and can receive each other's messages . The process consists of three steps :

  1. Discovery end device , Use coap The protocol sends the broadcast over the LAN ;
  2. Use of receiving end equipment PublishService Interface publishing service , When the receiver receives the broadcast , send out coap Protocol unicast to discovery end ;
  3. The discovery end device receives the reply unicast message , Update device information .
    But the original libcoap Broadcast not supported , So we need to make some changes to its source code , So that it can support broadcasting .
    Hongmeng libcoap Source warehouse :third_party_libcoap
    The code mainly uses a macro to separate :COAP_SUPPORT_SOCKET_BROADCAST
原网站

版权声明
本文为[Snow * sleet * snow]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280516196632.html