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

When I disable auto re-lock in eddystone gatt services, I cannot perform any read/write operation of the adv slots?

Hi,

I am working on a project that includes eddystone format. I am using SDK v13 sample example. When ı try to disable auto relock feature, ı cannot read or write any adv slot or cannot perform any gatt services, I guess the reason that beacon thinks it is in lock state,

Do you have any idea what is the reason of this problem and what is the solution?

Thanks in advance, BR

Parents
  • Hi,

    Thank you for reporting this. This is clearly a bug, and will be fixed in the next SDK release. The bug is located in the function is_beacon_unlocked() in es_gatts.c:

    The function looks like this:

    static bool is_beacon_unlocked(const nrf_ble_escs_t * p_escs)
    {
        uint32_t                        err_code;
        nrf_ble_escs_lock_state_read_t  lock_state;
        
        err_code = nrf_ble_escs_get_lock_state(p_escs, &lock_state);
        APP_ERROR_CHECK(err_code);
        
        return lock_state == NRF_BLE_ESCS_LOCK_STATE_UNLOCKED;
    }
    

    But the last line should instead be return lock_state != NRF_BLE_ESCS_LOCK_STATE_LOCKED;, i.e. the function should look like this:

    static bool is_beacon_unlocked(const nrf_ble_escs_t * p_escs)
    {
        uint32_t                        err_code;
        nrf_ble_escs_lock_state_read_t  lock_state;
        
        err_code = nrf_ble_escs_get_lock_state(p_escs, &lock_state);
        APP_ERROR_CHECK(err_code);
        
        return lock_state != NRF_BLE_ESCS_LOCK_STATE_LOCKED;
    }
    
Reply
  • Hi,

    Thank you for reporting this. This is clearly a bug, and will be fixed in the next SDK release. The bug is located in the function is_beacon_unlocked() in es_gatts.c:

    The function looks like this:

    static bool is_beacon_unlocked(const nrf_ble_escs_t * p_escs)
    {
        uint32_t                        err_code;
        nrf_ble_escs_lock_state_read_t  lock_state;
        
        err_code = nrf_ble_escs_get_lock_state(p_escs, &lock_state);
        APP_ERROR_CHECK(err_code);
        
        return lock_state == NRF_BLE_ESCS_LOCK_STATE_UNLOCKED;
    }
    

    But the last line should instead be return lock_state != NRF_BLE_ESCS_LOCK_STATE_LOCKED;, i.e. the function should look like this:

    static bool is_beacon_unlocked(const nrf_ble_escs_t * p_escs)
    {
        uint32_t                        err_code;
        nrf_ble_escs_lock_state_read_t  lock_state;
        
        err_code = nrf_ble_escs_get_lock_state(p_escs, &lock_state);
        APP_ERROR_CHECK(err_code);
        
        return lock_state != NRF_BLE_ESCS_LOCK_STATE_LOCKED;
    }
    
Children
Related