From 098e64b1228d62682cb9d4e4085ba46192a1bceb Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Sat, 25 Mar 2017 17:39:44 +0100 Subject: [PATCH] nrf5/modules/ubluepy: Adding locals dict to Scan Entry introducing function to retreive Scan Data. Not working as expected together with .attr. It looks like locals dict functions are treated to be attributes and cannot be resolved. --- nrf5/modules/ubluepy/ubluepy_scan_entry.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/nrf5/modules/ubluepy/ubluepy_scan_entry.c b/nrf5/modules/ubluepy/ubluepy_scan_entry.c index b7d54523d6..d197df4051 100644 --- a/nrf5/modules/ubluepy/ubluepy_scan_entry.c +++ b/nrf5/modules/ubluepy/ubluepy_scan_entry.c @@ -56,15 +56,29 @@ STATIC void ubluepy_scan_entry_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) } +/// \method getScanData() +/// Return list of the scan data tupples. +/// +STATIC mp_obj_t scan_entry_get_scan_data(mp_obj_t self_in, mp_obj_t type_in) { + ubluepy_scan_entry_obj_t * self = MP_OBJ_TO_PTR(self_in); + (void)self; + + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_scan_entry_get_scan_data_obj, scan_entry_get_scan_data); + +STATIC const mp_map_elem_t ubluepy_scan_entry_locals_dict_table[] = { + { MP_OBJ_NEW_QSTR(MP_QSTR_getScanData), (mp_obj_t)(&ubluepy_scan_entry_get_scan_data_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(ubluepy_scan_entry_locals_dict, ubluepy_scan_entry_locals_dict_table); + const mp_obj_type_t ubluepy_scan_entry_type = { { &mp_type_type }, .name = MP_QSTR_ScanEntry, .print = ubluepy_scan_entry_print, -#if 0 - .make_new = ubluepy_scan_entry_make_new, .locals_dict = (mp_obj_t)&ubluepy_scan_entry_locals_dict, -#endif .attr = ubluepy_scan_entry_attr };