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

HID demo restart cound't control any more

I programmed to nRF51 DK, the first time the device is connected to mobile phone.It works, but if i turn off the nRF51 DK and then turn it on.it is connected but it cound't control any more. This is my demo nRF51822_HID_KEYBOARD_MOUSE_C_20170926.rar.

#define DM_GATT_CCCD_COUNT 9

Ithink here have a question.

Parents
  • Hi,

    In the function device_manager_evt_handler() in main.c

    Change the function, so it looks like this:

    static uint32_t device_manager_evt_handler(dm_handle_t const *p_handle,
                                               dm_event_t const * p_event,
                                               ret_code_t         event_result)
    {
        APP_ERROR_CHECK(event_result);
        switch (p_event->event_id)
        {
            case DM_EVT_CONNECTION:
                m_peer_handle = (*p_handle);
                security_timer_start(&m_peer_handle);
                break;
    
            case DM_EVT_DEVICE_CONTEXT_LOADED: // Fall through.
            case DM_EVT_SECURITY_SETUP_COMPLETE:
                m_bonded_peer_handle = (*p_handle);
                break;
    
            default:
                // No implementation needed.
                break;
        }
    
        return NRF_SUCCESS;
    }
    
Reply
  • Hi,

    In the function device_manager_evt_handler() in main.c

    Change the function, so it looks like this:

    static uint32_t device_manager_evt_handler(dm_handle_t const *p_handle,
                                               dm_event_t const * p_event,
                                               ret_code_t         event_result)
    {
        APP_ERROR_CHECK(event_result);
        switch (p_event->event_id)
        {
            case DM_EVT_CONNECTION:
                m_peer_handle = (*p_handle);
                security_timer_start(&m_peer_handle);
                break;
    
            case DM_EVT_DEVICE_CONTEXT_LOADED: // Fall through.
            case DM_EVT_SECURITY_SETUP_COMPLETE:
                m_bonded_peer_handle = (*p_handle);
                break;
    
            default:
                // No implementation needed.
                break;
        }
    
        return NRF_SUCCESS;
    }
    
Children
No Data
Related