2.如命令API的“对应事件”部分所述,此命令返回“供应商特定命令完成事件”(hciEvt_VSCmdComplete_t),因此在处理HCI_GAP_EVENT_EVENT处理时添加此事件。这在下面进一步详细说明。 static uint8_t SimpleBLEPeripheral_processStackMsg(ICall_Hdr* pMsg)
{
uint8_t safeToDealloc = TRUE;
switch (pMsg->event)
{
case HCI_GAP_EVENT_EVENT:
{
// Process HCI message
switch(pMsg->status)
{
// Process HCI Vendor Specific Command Complete Event
case HCI_VE_EVENT_CODE:
{
// Parse Command Complete Event for opcode and status
hciEvt_VSCmdComplete_t* command_complete = (hciEvt_VSCmdComplete_t*)pMsg;
// Find which command this command complete is for
switch(command_complete->cmdOpcode)
{
case HCI_EXT_PER:
{
uint8_t status = command_complete->pEventParam[2];
if (status == SUCCESS)
{
uint8_t cmdVal = command_complete->pEventParam[3];