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

SDK 15 peer_manager undefined reference ble_evt_handler

Migrating from 13.1 to 15.0.
getting error, undefined reference to 'ble_evt_handler'

In 15.0, peer_manager.c has the function,
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
In 15.0, ble_conn_params.c has the same function name (but with a switch statement),
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)

In SES I have the peer and conn objects in the nRF_BLE folder, and in edit options the preprocessor user include directories.

When looking at these same two functions in 13.1, there are differences to 15.0;
In 13.1, peer_manager.c ,
void pm_on_ble_evt(ble_evt_t const * p_ble_evt)
In 13.1, ble_conn_params.c,
void ble_conn_params_on_ble_evt(ble_evt_t const * p_ble_evt)
(this change had already taken place when looking at 14.2)In 13.1, 
peer_manager.c ,

Was this change intentional?
In the Migration Guide(s), I do not see a note about this change (unless I missed it) to help understand.

-thank-you

Parents Reply Children
  • Looks like the questions are a starting point in updating the tutorial (which has now gone missing, but comments remain).

    I found these tutorials extremely helpful (and others have probably as well), and now with 15.0 there seem to have been some big changes. To add, SES is being encouraged, and s112 with nRF52810 are out (which I'm using for custom), and having the tutorials in sync helps to understand these changes.

    I'm still not sure why the function names are the same in 15.0, whereas in 13.1 the functions were named differently. A & B different function names and code, C & D same function name but same code as A & B.

    A) 13.1   peer_manager.h
    
    void pm_on_ble_evt(ble_evt_t * p_ble_evt)
    {
        VERIFY_MODULE_INITIALIZED_VOID();
    
        im_ble_evt_handler(p_ble_evt);
        sm_ble_evt_handler(p_ble_evt);
        gcm_ble_evt_handler(p_ble_evt);
    }

    B) 13.1  ble_conn_params.h
    
    void ble_conn_params_on_ble_evt(ble_evt_t * p_ble_evt)
    {
        switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
                on_connect(p_ble_evt);
                break;
    
            case BLE_GAP_EVT_DISCONNECTED:
                on_disconnect(p_ble_evt);
                break;
    
            case BLE_GATTS_EVT_WRITE:
                on_write(p_ble_evt);
                break;
    
            case BLE_GAP_EVT_CONN_PARAM_UPDATE:
                on_conn_params_update(p_ble_evt);
                break;
    
            default:
                // No implementation needed.
                break;
        }
    }

    C) 15.0   peer_manager.h
    
    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {
        VERIFY_MODULE_INITIALIZED_VOID();
    
        im_ble_evt_handler(p_ble_evt);
        sm_ble_evt_handler(p_ble_evt);
        gcm_ble_evt_handler(p_ble_evt);
    }

    D) 15.0  ble_conn_params.h
    
    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {
        switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
                on_connect(p_ble_evt);
                break;
    
            case BLE_GAP_EVT_DISCONNECTED:
                on_disconnect(p_ble_evt);
                break;
    
            case BLE_GATTS_EVT_WRITE:
                on_write(p_ble_evt);
                break;
    
            case BLE_GAP_EVT_CONN_PARAM_UPDATE:
                on_conn_params_update(p_ble_evt);
                break;
    
            default:
                // No implementation needed.
                break;
        }
    }

  • FormerMember
    0 FormerMember in reply to Simon

    Did you were able to solve the "undefined reference" problem?

    I don't know why the names of all the ble event handlers in the different modules were changed to ble_evt_handler(..), perhaps it was to easier get an overview..?

  • Would have reported if fixed,...but if there is an error in sdk 15.0 then this part of Nordic code will not work as it is right now.

    "perhaps it was to easier get an overview..?"... Nordic wrote the code, no?

    By going through the code in the tutorial you will be able to reproduce the error in 15.0.

  • FormerMember
    +1 FormerMember in reply to Simon

    Instead of migrating the code from SDK13 to SDK 15, I would think the easiest is to add "our_service" to an existing project in SDK 15, for example ble_app_blinky.

Related