nrf5/bluetooth: Adding function to register gattc event handler (central).

This commit is contained in:
Glenn Ruben Bakke 2017-03-26 22:57:07 +02:00
parent 025f07dbab
commit 0914b34193
2 changed files with 9 additions and 0 deletions

View File

@ -77,10 +77,12 @@ static volatile bool m_tx_in_progress;
static ble_drv_gap_evt_callback_t gap_event_handler;
static ble_drv_adv_evt_callback_t adv_event_handler;
static ble_drv_gatts_evt_callback_t gatts_event_handler;
static ble_drv_gattc_evt_callback_t gattc_event_handler;
static mp_obj_t mp_gap_observer;
static mp_obj_t mp_adv_observer;
static mp_obj_t mp_gatts_observer;
static mp_obj_t mp_gattc_observer;
#if (BLUETOOTH_SD != 100) && (BLUETOOTH_SD != 110)
#include "nrf_nvic.h"
@ -663,6 +665,11 @@ void ble_drv_gatts_event_handler_set(mp_obj_t obj, ble_drv_gatts_evt_callback_t
gatts_event_handler = evt_handler;
}
void ble_drv_gattc_event_handler_set(mp_obj_t obj, ble_drv_gattc_evt_callback_t evt_handler) {
mp_gattc_observer = obj;
gattc_event_handler = evt_handler;
}
void ble_drv_adv_report_handler_set(mp_obj_t obj, ble_drv_adv_evt_callback_t evt_handler) {
mp_adv_observer = obj;
adv_event_handler = evt_handler;

View File

@ -69,6 +69,8 @@ void ble_drv_gap_event_handler_set(mp_obj_t obs, ble_drv_gap_evt_callback_t evt_
void ble_drv_gatts_event_handler_set(mp_obj_t obj, ble_drv_gatts_evt_callback_t evt_handler);
void ble_drv_gattc_event_handler_set(mp_obj_t obj, ble_drv_gattc_evt_callback_t evt_handler);
void ble_drv_attr_read(uint16_t conn_handle, uint16_t handle, uint16_t len, uint8_t * p_data);
void ble_drv_attr_write(uint16_t conn_handle, uint16_t handle, uint16_t len, uint8_t * p_data);