This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

#define APP_BLE_OBSERVER_PRIO explanation

Hello,

In ble_app_blinky code,I cant understand this line "#define APP_BLE_OBSERVER_PRIO           3"  and what does the value 3 represents here??. Is this value constant or can be modified? 

  • In the ble blinky example, the define APP_BLE_OBSERVER_PRIO is used when registering a handler for BLE events through NRF_SDH_BLE_OBSERVER:

    #define NRF_SDH_BLE_OBSERVER(_name, _prio, _handler, _context)            \
    ...                                                                       \
    ...                                                                       \
    ...                                                                       \

    In this way, the BLE events will be received and handled by the user specified handler. It is possible to register several event handlers, and the assigned priority specify when it will receive the event with respect to the other handlers (See this link for more in depth information).

    In an application, these priorities might be important. Some part of a program might depend on another part, and often an event needs to be given to a specific handler before another. I assume this is taken into account when making the ble app blinky example, and changing this value might lead to unexpected behavior due to the reasons mentioned.

    Best regards, Simon

Related