cancel
Showing results for 
Search instead for 
Did you mean: 

TL_BLEEVT_CS_OPCODE vs TL_BLEEVT_CC_OPCODE

DS.4
Senior II

Example: BLEHeartRateFreeRtos.

In one case of command response we get TL_BLEEVT_CS_OPCODE , another one is TL_BLEEVT_CC_OPCODE.

What is the difference?

Can we get more than one packet of response in each case? (It looks like the code is written to handle this case)

Why in TL_BLEEVT_CC_OPCODE only saves (memcopy) the last packet received ?

while(local_cmd_status == HCI_TL_CmdBusy)
  {
    hci_cmd_resp_wait(HCI_TL_DEFAULT_TIMEOUT);
 
    /**
     * Process Cmd Event
     */
    while(LST_is_empty(&HciCmdEventQueue) == FALSE)
    {
      LST_remove_head (&HciCmdEventQueue, (tListNode **)&pevtpacket);
 
      if(pevtpacket->evtserial.evt.evtcode == TL_BLEEVT_CS_OPCODE)
      {
        pcommand_status_event = (TL_CsEvt_t*)pevtpacket->evtserial.evt.payload;
        if(pcommand_status_event->cmdcode == opcode)
        {
          *(uint8_t *)(p_cmd->rparam) = pcommand_status_event->status;
        }
 
        if(pcommand_status_event->numcmd != 0)
        {
          local_cmd_status = HCI_TL_CmdAvailable;
        }
      }
      else // my comment: if( TL_BLEEVT_CC_OPCODE)
      {
        pcommand_complete_event = (TL_CcEvt_t*)pevtpacket->evtserial.evt.payload;
 
        if(pcommand_complete_event->cmdcode == opcode)
        {
          hci_cmd_complete_return_parameters_length = pevtpacket->evtserial.evt.plen - TL_EVT_HDR_SIZE;
          p_cmd->rlen = MIN(hci_cmd_complete_return_parameters_length, p_cmd->rlen);
          memcpy(p_cmd->rparam, pcommand_complete_event->payload, p_cmd->rlen);
        }
 
        if(pcommand_complete_event->numcmd != 0)
        {
          local_cmd_status = HCI_TL_CmdAvailable;
        }
      }
    }
  }

Could not find the relevant documentation.

0 REPLIES 0