nrf5/modules: Removing connection handle from python gap event handler callback function.

This commit is contained in:
Glenn Ruben Bakke 2017-02-18 14:41:46 +01:00
parent f800f22a79
commit 852dde6747
2 changed files with 7 additions and 8 deletions

View File

@ -40,8 +40,8 @@ DB setup:
from ubluepy import Service, Characteristic, UUID, Peripheral, constants
from pyb import LED
def event_handler(id, conn_handle, length, data):
print("BLE event:", id, "conn_handle:", conn_handle, "length:", length)
def event_handler(id, length, data):
print("BLE event:", id, "length:", length)
if id == constants.EVT_GAP_CONNECTED:
# connected

View File

@ -49,15 +49,14 @@ STATIC void gap_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t conn
}
if (self->conn_handler != mp_const_none) {
mp_obj_t args[4];
mp_uint_t num_of_args = 4;
mp_obj_t args[3];
mp_uint_t num_of_args = 3;
args[0] = MP_OBJ_NEW_SMALL_INT(event_id);
args[1] = MP_OBJ_NEW_SMALL_INT(conn_handle);
args[2] = MP_OBJ_NEW_SMALL_INT(length);
args[1] = MP_OBJ_NEW_SMALL_INT(length);
if (data != NULL) {
args[3] = mp_obj_new_bytearray_by_ref(length, data);
args[2] = mp_obj_new_bytearray_by_ref(length, data);
} else {
args[3] = mp_const_none;
args[2] = mp_const_none;
}
// for now hard-code all events to conn_handler