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

What do LEDs 0 and 1 indicate in the ble_proximity sample app?

Here are some constants from main.c for the other LEDs, but what do LEDs 0 and 1 indicate? 0 seems to be on when advertising. 1 when connected? What about pairing/bonding state?

#define ALERT_LEVEL_MILD_LED_PIN_NO NRF6310_LED_2 /< Is on when we are in Mild Alert state. */ #define ALERT_LEVEL_HIGH_LED_PIN_NO NRF6310_LED_3 /< Is on when we are in High Alert state. */ #define ADV_INTERVAL_SLOW_LED_PIN_NO NRF6310_LED_4 /< Is on when we are doing slow advertising. */ #define PEER_SRV_DISC_LED_PIN_NO NRF6310_LED_5 /< Is on when the Immediate Alert Service has been discovered at the peer. */ #define ADV_WHITELIST_LED_PIN_NO NRF6310_LED_6 /**< Is on when we are doing advertising with whitelist. */

  • Hi Eliot,

    as you say, LED 0 is set when advertising, and LED 1 is set when connected. There is no LED activity that indicates pairing state.

    If you want main.c to handle bond-related events, you should implement the evt_handler provided in ble_bondmngr_init(). See bond_manager_init in main.c. For example:

    
    static void bond_manager_event_handler(ble_bondmngr_evt_t * p_evt)
    {
        switch (p_evt->evt_type)
        {
            case BLE_BONDMNGR_EVT_NEW_BOND:
                break;
            
            case BLE_BONDMNGR_EVT_CONN_TO_BONDED_MASTER:
                break;
            
            case BLE_BONDMNGR_EVT_ENCRYPTED:
                break;
            
            case BLE_BONDMNGR_EVT_AUTH_STATUS_UPDATED:
                break;
            
            case BLE_BONDMNGR_EVT_BOND_FLASH_FULL:
                break;
            
            default:
                // Unexpected event
                APP_ERROR_CHECK_BOOL(false);
                break;
        }
    }
    
    
    /**@brief Function for the Bond Manager initialization.
     */
    static void bond_manager_init(void)
    {
        uint32_t            err_code;
        ble_bondmngr_init_t bond_init_data;
        bool                bonds_delete;
    
        // Clear all bonded masters if the Bonds Delete button is pushed
        err_code = app_button_is_pushed(BONDMNGR_DELETE_BUTTON_PIN_NO, &bonds_delete);
        APP_ERROR_CHECK(err_code);
        
        // Initialize the Bond Manager
        bond_init_data.flash_page_num_bond     = FLASH_PAGE_BOND;
        bond_init_data.flash_page_num_sys_attr = FLASH_PAGE_SYS_ATTR;
        bond_init_data.evt_handler             = bond_manager_event_handler; // This wasnt here originally
        bond_init_data.error_handler           = bond_manager_error_handler;
        bond_init_data.bonds_delete            = bonds_delete;
        
        err_code = ble_bondmngr_init(&bond_init_data);
        APP_ERROR_CHECK(err_code);
    }
    
    
Related