From 1da82b2aeba3410646c360b6ff79892b3ee1c468 Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Sat, 18 Feb 2017 18:06:58 +0100 Subject: [PATCH] nrf5/modules: Updating ubluepy service. Creating empty characteristic list in constructor. Appending characteristic to the list when added. --- nrf5/modules/ubluepy/ubluepy_service.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nrf5/modules/ubluepy/ubluepy_service.c b/nrf5/modules/ubluepy/ubluepy_service.c index 63db27a73b..8f47551394 100644 --- a/nrf5/modules/ubluepy/ubluepy_service.c +++ b/nrf5/modules/ubluepy/ubluepy_service.c @@ -26,6 +26,7 @@ #include "py/obj.h" #include "py/runtime.h" +#include "py/objlist.h" #if MICROPY_PY_UBLUEPY_PERIPHERAL || MICROPY_PY_UBLUEPY_CENTRAL @@ -80,6 +81,7 @@ STATIC mp_obj_t ubluepy_service_make_new(const mp_obj_type_t *type, size_t n_arg // clear reference to peripheral s->p_periph = NULL; + s->char_list = mp_obj_new_list(0, NULL); return MP_OBJ_FROM_PTR(s); } @@ -99,6 +101,8 @@ STATIC mp_obj_t service_add_characteristic(mp_obj_t self_in, mp_obj_t characteri p_char->p_service = self; } + mp_obj_list_append(self->char_list, characteristic); + // return mp_obj_new_bool(retval); return mp_const_none; }