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 simpleBLECharHdl CharHdl[] 数组的作用。

Other Parts Discussed in Thread: CC2540

刚刚接触cc2540 蓝牙协议。在蓝牙协议教程里面,cc2540 central , simpleBLECentralEventCB的函数中, 有定义数组 uint 16 charHdl 和 uinit 16 SimpleBLECharVal. 这两个定义是什么意思呢?

为何要在如下的代码里面给 charHdl[0] - charHdl[7] 赋 0 呢?

非常感谢!

case GAP_LINK_ESTABLISHED_EVENT:
      {
        if ( pEvent->gap.hdr.status == SUCCESS )
        {          
          simpleBLEState = BLE_STATE_CONNECTED;
          simpleBLEConnHandle = pEvent->linkCmpl.connectionHandle;

          
          charHdl[0] = 0;
          charHdl[1] = 0;
          charHdl[2] = 0;
          charHdl[3] = 0;
          charHdl[4] = 0;
          charHdl[5] = 0;
          charHdl[6] = 0;
          charHdl[7] = 0;
          simpleBLEProcedureInProgress = TRUE;    

          if ( simpleBLECharHdl == 0 )
          {
            osal_start_timerEx( simpleBLETaskId, START_DISCOVERY_EVT, DEFAULT_SVC_DISCOVERY_DELAY );
          }

          USBPrintString("Connected: ");    
          USBPrintString((uint8*) bdAddr2Str( pEvent->linkCmpl.devAddr ));USBPrintString("\r\n");