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.

CC2541: what is the function of the definition about SYS_EVENT_MSG in the file "simpleBLECentral.c " from SDK BLE-CC254x-1.4.2.2

Part Number: CC2541

Dear Sir or Madam:

    The codes below is in   in the file "simpleBLECentral.c " from SDK BLE-CC254x-1.4.2.2:


uint16 SimpleBLECentral_ProcessEvent( uint8 task_id, uint16 events )
{
  
  VOID task_id; // OSAL required parameter that isn't used in this function
  
  if ( events & SYS_EVENT_MSG )
  {
    uint8 *pMsg;
    
    if ( (pMsg = osal_msg_receive( simpleBLETaskId )) != NULL )
    {
      simpleBLECentral_ProcessOSALMsg( (osal_event_hdr_t *)pMsg );

      // Release the OSAL message
      VOID osal_msg_deallocate( pMsg );
    }

    // return unprocessed events
    return (events ^ SYS_EVENT_MSG);
  }
    ........
    ........
}

The function below shows it  implements the key function,

it is called in the function     uint16 SimpleBLECentral_ProcessEvent( uint8 task_id, uint16 events )

static void simpleBLECentral_ProcessOSALMsg( osal_event_hdr_t *pMsg )
{
switch ( pMsg->event )

{
case KEY_CHANGE:
simpleBLECentral_HandleKeys( ((keyChange_t *)pMsg)->state, ((keyChange_t *)pMsg)->keys );
break;

case GATT_MSG_EVENT:
simpleBLECentralProcessGATTMsg( (gattMsgEvent_t *) pMsg );
break;
}
}

 but I find the function does not work,  or I misunderstand it?

Best Regards

Tom