nrf5/modules: Adding new method, getCharacteristics(), in the ubluepy service class. The method returns the list of characteristics which has been added to the service instance.
This commit is contained in:
parent
307c2d6aed
commit
655d6c9bcd
@ -108,11 +108,23 @@ STATIC mp_obj_t service_add_characteristic(mp_obj_t self_in, mp_obj_t characteri
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_service_add_char_obj, service_add_characteristic);
|
||||
|
||||
/// \method getCharacteristics()
|
||||
/// Return list with all characteristics registered in the Service.
|
||||
///
|
||||
STATIC mp_obj_t service_get_chars(mp_obj_t self_in) {
|
||||
ubluepy_service_obj_t * self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return self->char_list;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_service_get_chars_obj, service_get_chars);
|
||||
|
||||
|
||||
STATIC const mp_map_elem_t ubluepy_service_locals_dict_table[] = {
|
||||
#if 0
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_getCharacteristic), (mp_obj_t)(&ubluepy_service_get_char_obj) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_getCharacteristic), (mp_obj_t)(&ubluepy_service_get_char_obj) },
|
||||
#endif
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_addCharacteristic), (mp_obj_t)(&ubluepy_service_add_char_obj) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_addCharacteristic), (mp_obj_t)(&ubluepy_service_add_char_obj) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_getCharacteristics), (mp_obj_t)(&ubluepy_service_get_chars_obj) },
|
||||
#if 0
|
||||
// Properties
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_peripheral), (mp_obj_t)(&ubluepy_service_get_peripheral_obj) },
|
||||
|
Loading…
Reference in New Issue
Block a user