This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2541广播和搜索问题

Other Parts Discussed in Thread: CC2541

你好!CC2541 从设备进行广播,可以广播设备的名字吗?如果可以,当主设备搜索发现从设备的时候,能不能抓取从设备的名字,而不是从设备的地址?例子程序好像都是显示从设备地址到LCD,然后进行选择连接。现在我想让主设备将搜索到的从设备的名字显示在LCD上,然后进行选择连接。感觉这样用户体验比较好。谢谢!

  • 可以。广播数据本来就是你自己决定的。IOS側也需要自己处理。

  • 但是该在哪些修改呢?我看很久没明白广播数据到底在哪个地方定义并调用的,谢谢!

  • static uint8 advertData[] =
    {
      // Flags; this sets the device to use limited discoverable
      // mode (advertises for 30 seconds at a time) instead of general
      // discoverable mode (advertises indefinitely)
      0x02,   // length of this data
      GAP_ADTYPE_FLAGS,
      DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,

      // service UUID, to notify central devices what services are included
      // in this peripheral
      0x03,   // length of this data
      GAP_ADTYPE_16BIT_MORE,      // some of the UUID's, but not all
      LO_UINT16( SIMPLEPROFILE_SERV_UUID ),
      HI_UINT16( SIMPLEPROFILE_SERV_UUID ),

    };

    static void gapRole_ProcessGAPMsg( gapEventHdr_t *pMsg )

    {

             ……

    // Update the advertising data
              stat = GAP_UpdateAdvertisingData( gapRole_TaskID,
                                  TRUE, gapRole_AdvertDataLen, gapRole_AdvertData );

               ……

    }

    上传的广播数据什么意思啊?貌似没有设备地址和设备名字吧?那么主设备是如何获得从设备地址和从设备名字的呢?