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.

IOS后台运行模式无法搜索到设备

你好,我们做了以下测试:

1、将16bit uuid放进了scan_rsp pdu里面,用sniffer抓包发现确实是对的,写ios app的同事说手机在后台运行模式时候,可以根据服务uuid扫描到设备。

2、将128bit uuid放进了scan_rsp pdu里面,用sniffer抓包发现确实是对的,写ios app的同事说手机在后台运行模式时候,根据服务uuid扫描不到设备了。

我有以下猜测:

1、需要将service uuid放进adv pdu,而不能放在scan_rsp pdu。

2、只能识别广播包中16bit 服务uuid

但是按照规范,16bit uuid都是留在SIG的,所以我们还是希望用自定义128bit来作服务uuid,请问之前有遇到过这种情况吗?

  • 参考下右面链接里贴出的代码: e2echina.ti.com/.../147591
  • Hi,Viki

    根据你提供的连接,我摘抄了代码如下:

    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
    #if (defined USE_128_BIT_UUID)
    0x11, // length of this data
    GAP_ADTYPE_128BIT_MORE, // some of the UUID's, but not all
    TI_UUID(SIMPLEPROFILE_SERV_UUID),

    #else
    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 ),

    #endif
    };

    这个128bit的服务uuid是放在adv pdu里面的,而不是放在scan_rsp里面。在IOS后台运行模式下,服务uuid只能放在adv pdu吗?因为我们IOS app同事说扫不到,我想确认一下是IOS系统限制问题,还是说我们的app出问题了。

    谢谢、