微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI蓝牙设计交流 > 定向广播求助?

定向广播求助?

时间:10-02 整理:3721RD 点击:

1、有些资料说定向可连接广播类型分成两种方式(High duty cycle和Low duty cycle)。且在(include/gap.h),具体定义的类型如下:

 GAP_ADTYPE_ADV_IND //!< Connectable undirected advertisement

 GAP_ADTYPE_ADV_HDC_DIRECT_IND //!< Connectable high duty cycle directed advertisement

 GAP_ADTYPE_ADV_SCAN_IND //!< Scannable undirected advertisement

 GAP_ADTYPE_ADV_NONCONN_IND //!< Non-Connectable undirected advertisement

 GAP_ADTYPE_ADV_LDC_DIRECT_IND //!< Connectable low duty cycle directed advertisement

但是,怎么找不到GAP_ADTYPE_ADV_HDC_DIRECT_IND 和GAP_ADTYPE_ADV_LDC_DIRECT_IND ;只有

#define GAP_ADTYPE_ADV_IND                0x00  //!< Connectable undirected advertisement

#define GAP_ADTYPE_ADV_DIRECT_IND         0x01  //!< Connectable directed advertisement

#define GAP_ADTYPE_ADV_DISCOVER_IND       0x02  //!< Discoverable undirected advertisement

#define GAP_ADTYPE_ADV_NONCONN_IND        0x03  //!< Non-Connectable undirected advertisement

#define GAP_ADTYPE_SCAN_RSP_IND           0x04  //!< Only used in gapDeviceInfoEvent_t

这是什么问题?

2、Direct Advertisement Address Type和Direct Advertisement Address.又要怎么配置?有什么作用?

 主机代码:
static uint8 bdAddress[6] = {0xff,0xff,0xff,0xff,0xff,0x03};
    HCI_EXT_SetBDADDRCmd(bdAddress);

然后将拨码开关的组号与bdAddress[0]相或

注释:simpleBLECentralEventCB时间中

 case GAP_DEVICE_INFO_EVENT:

      {

        // if filtering device discovery results based on service UUID

        /*

        if ( DEFAULT_DEV_DISC_BY_SVC_UUID == TRUE )

        {

          if ( simpleBLEFindSvcUuid( SIMPLEPROFILE_SERV_UUID,

                                     pEvent->deviceInfo.pEvtData,

                                     pEvent->deviceInfo.dataLen ) )

          {

            simpleBLEAddDeviceInfo( pEvent->deviceInfo.addr, pEvent->deviceInfo.addrType );

          }

        }

        */

        simpleBLEAddDeviceInfo( pEvent->deviceInfo.addr, pEvent->deviceInfo.addrType );

      }

      break;

case GAP_DEVICE_DISCOVERY_EVENT:

      {

        // discovery complete

        simpleBLEScanning = FALSE;

       

        // if not filtering device discovery results based on service UUID

        /*

        if ( DEFAULT_DEV_DISC_BY_SVC_UUID == FALSE )

        {

          // Copy results

          simpleBLEScanRes = pEvent->discCmpl.numDevs;

          osal_memcpy( simpleBLEDevList, pEvent->discCmpl.pDevList,

                       (sizeof( gapDevRec_t ) * pEvent->discCmpl.numDevs) );

        }

        */

        simpleBLEScanRes = pEvent->discCmpl.numDevs;

          osal_memcpy( simpleBLEDevList, pEvent->discCmpl.pDevList,

                       (sizeof( gapDevRec_t ) * pEvent->discCmpl.numDevs) );

        LCD_WRITE_STRING_VALUE( "Devices Found", simpleBLEScanRes,

                                10, HAL_LCD_LINE_1 );

        if ( simpleBLEScanRes > 0 )

        {

          LCD_WRITE_STRING( "<- To Select", HAL_LCD_LINE_2 );

          //连接第一个

         

          HalLedSet(HAL_LED_3, HAL_LED_MODE_ON ); //开LED3

         

          if ( simpleBLEState == BLE_STATE_IDLE )

          {

            simpleBLEScanIdx++;

            LCD_WRITE_STRING( "simpleBLEScanIdx++", HAL_LCD_LINE_1 );

            if ( simpleBLEScanIdx >= simpleBLEScanRes )

            {

              simpleBLEScanIdx = 0;

              LCD_WRITE_STRING( "simpleBLEScanIdx = 0;", HAL_LCD_LINE_1 );

            }

            uint8 addrType;

            uint8 *peerAddr;

            // connect to current device in scan result

            peerAddr = simpleBLEDevList[simpleBLEScanIdx].addr;

            addrType = simpleBLEDevList[simpleBLEScanIdx].addrType;

            simpleBLEState = BLE_STATE_CONNECTING;

            GAPCentralRole_EstablishLink( DEFAULT_LINK_HIGH_DUTY_CYCLE,

                                          DEFAULT_LINK_WHITE_LIST,

                                          addrType, peerAddr );

         

          }

        }

        // initialize scan index to last device

        simpleBLEScanIdx = simpleBLEScanRes;

      }

      break;

 从机:
申明 static uint8 centralAddr[]={0x00,0xFF,0xFF,0xFF,0xFF,0xF1};


void SimpleBLEPeripheral_Init( uint8 task_id )
{
.......................
uint8 gaprole_adv_event_type = GAP_ADTYPE_ADV_LDC_DIRECT_IND;


GAPRole_SetParameter(GAPROLE_ADV_EVENT_TYPE, sizeof( uint8 ), &gaprole_adv_event_type);
GAPRole_SetParameter(GAPROLE_ADV_DIRECT_ADDR,sizeof(centralAddr), centralAddr);
.......................
}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top