Exemplo n.º 1
0
/**@brief Function for handling the Device Manager events.
 *
 * @param[in] p_evt  Data associated to the device manager event.
 */
static uint32_t device_manager_evt_handler(dm_handle_t const * p_handle,
                                           dm_event_t const  * p_event,
                                           ret_code_t        event_result)
{
    uint32_t err_code;
    bool     is_indication_enabled;

    switch(p_event->event_id)
    {
        case DM_EVT_LINK_SECURED:
            // Send a single temperature measurement if indication is enabled.
            // NOTE: For this to work, make sure ble_hts_on_ble_evt() is called before
            //       dm_ble_evt_handler() in ble_evt_dispatch().
            err_code = ble_hts_is_indication_enabled(&m_hts, &is_indication_enabled);
            APP_ERROR_CHECK(err_code);

            if (is_indication_enabled)
            {
                temperature_measurement_send();
            }
            break;

        default:
            break;
    }

    return NRF_SUCCESS;
}
Exemplo n.º 2
0
 */
static void bond_evt_handler(ble_bondmngr_evt_t * p_evt)
{
    uint32_t err_code;
    bool     is_indication_enabled;

    switch (p_evt->evt_type)
    {
        case BLE_BONDMNGR_EVT_ENCRYPTED:
            // Send a single temperature measurement if indication is enabled.
            // NOTE: For this to work, make sure ble_hts_on_ble_evt() is called before
            //       ble_bondmngr_on_ble_evt() in ble_evt_dispatch().
            err_code = ble_hts_is_indication_enabled(&m_hts, &is_indication_enabled);
            APP_ERROR_CHECK(err_code);

            if (is_indication_enabled)
            {
                temperature_measurement_send();
            }
            break;

        default:
            break;
    }