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.

BLE callbacks

Hi!!!

I am a beginner in  BLE and I have started the understanding of simpleBLEcentral and simpleBLEperipheral projects provided in ble stack.

Now I came accross the callbacks that are registered for events and I cant understand the flow for that.

Can anyone please help me with the same???

  • Hey Chirag,

    I'm assuming you're referring to functions such as SimpleBLEPeripheral_ProcessEvent(). To get a basic understand of the flow of the system you should look at osal_run_system(). OSAL functions as a simple operating system and this loop is its basic control loop that is repeated indefinitely while the system is running.

    You'll see that the function iterates through tasksEvents[] starting with highest priority task (idx=0) and ending with lowest priority task to see if there are any pending events. If there is a pending event, OSAL will invoke whatever that task's event handler is, which for the application tasks is SimpleBLEPeripheral_ProcessEvent(). Look at the definition of tasksArr[] to see the list of all task event handlers.

    The event handler should process the event and clear whatever event flag caused the event. This way the next time osal_run_system() occurs, the next event can be processed.

    Events are the basic interactions between all tasks within the system and OSAL is simply the managing system to these events.

    -Matt

  • Thanks Matthew for this but this is not what i was looking for....

    What i mean to ask was about the callbacks that get executed when the event occurs
    such as

    simpleBLECentralEventCB     // Event callback

    I was facing problems understand the execution of such callback functions during execution.However I got the flow as of now..

    Thanks again....