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.

cc2540 SimpleBLECentral如何解析出从机的设备名称



大家好!

      请问SimpleBLECentral如何解析出从机的设备名称。

  • silver,

    一般是在查找过程中发现的。因为从机会在广播包中带上自己的名字。

    查找一下GAP_DEVICE_INFO_EVENT, 这里面就会有线索:)

  • 大家好:

     问题已解决,跟大家分享一下:

    case GAP_DEVICE_INFO_EVENT://扫描过程中发现设备事件
    {
    // if filtering device discovery results based on service UUID
    if ( DEFAULT_DEV_DISC_BY_SVC_UUID == TRUE )
    {
    if(pEvent->deviceInfo.eventType == GAP_ADTYPE_ADV_IND )//判断是否是广播包
    {
    if ( simpleBLEFindSvcUuid( SIMPLEPROFILE_SERV_UUID,//服务UUID过滤
    pEvent->deviceInfo.pEvtData,
    pEvent->deviceInfo.dataLen ) )
    {
    simpleBLEAddDeviceInfo( pEvent->deviceInfo.addr, pEvent->deviceInfo.addrType );
    }
    }
    else if(pEvent->deviceInfo.eventType == GAP_ADTYPE_SCAN_RSP_IND)//判断是否是扫描Rsp
    {

    if(SUCCESS == CheckDeviceScanRspData(pEvent->deviceInfo.pEvtData,
    pEvent->deviceInfo.dataLen))//校对扫描Rsp的内容,信息存在pEvent->deviceInfo的结构体里

    {
    GAPCentralRole_CancelDiscovery(); //停止扫描
    }
    else
    {
    simpleBLEScanRes = 0;//清除扫描列表
    }
    }
    }
    }

    这是我这段的代码