nrf5/modules/ubluepy: Adding template function for central connect() in peripheral object.

This commit is contained in:
Glenn Ruben Bakke 2017-03-25 17:51:52 +01:00
parent 098e64b122
commit 4d147beedb
1 changed files with 16 additions and 2 deletions

View File

@ -242,13 +242,26 @@ STATIC mp_obj_t peripheral_get_services(mp_obj_t self_in) {
STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_peripheral_get_services_obj, peripheral_get_services);
/// \method connect(device_address)
/// Connect to device peripheral with the given device address.
///
STATIC mp_obj_t peripheral_connect(mp_obj_t self_in, mp_obj_t dev_addr) {
ubluepy_peripheral_obj_t * self = MP_OBJ_TO_PTR(self_in);
(void)self;
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_peripheral_connect_obj, peripheral_connect);
STATIC const mp_map_elem_t ubluepy_peripheral_locals_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_withDelegate), (mp_obj_t)(&ubluepy_peripheral_with_delegate_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_setNotificationHandler), (mp_obj_t)(&ubluepy_peripheral_set_notif_handler_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_setConnectionHandler), (mp_obj_t)(&ubluepy_peripheral_set_conn_handler_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_getServices), (mp_obj_t)(&ubluepy_peripheral_get_services_obj) },
#if 0 // MICROPY_PY_UBLUEPY_CENTRAL
#if MICROPY_PY_UBLUEPY_CENTRAL
{ MP_OBJ_NEW_QSTR(MP_QSTR_connect), (mp_obj_t)(&ubluepy_peripheral_connect_obj) },
#if 0
{ MP_OBJ_NEW_QSTR(MP_QSTR_disconnect), (mp_obj_t)(&ubluepy_peripheral_disconnect_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_getServiceByUUID), (mp_obj_t)(&ubluepy_peripheral_get_service_by_uuid_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_getCharacteristics), (mp_obj_t)(&ubluepy_peripheral_get_chars_obj) },
@ -256,7 +269,8 @@ STATIC const mp_map_elem_t ubluepy_peripheral_locals_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_waitForNotifications), (mp_obj_t)(&ubluepy_peripheral_wait_for_notif_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_writeCharacteristic), (mp_obj_t)(&ubluepy_peripheral_write_char_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_readCharacteristic), (mp_obj_t)(&ubluepy_peripheral_read_char_obj) },
#endif
#endif // 0
#endif // MICROPY_PY_UBLUEPY_CENTRAL
#if MICROPY_PY_UBLUEPY_PERIPHERAL
{ MP_OBJ_NEW_QSTR(MP_QSTR_advertise), (mp_obj_t)(&ubluepy_peripheral_advertise_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_disconnect), (mp_obj_t)(&ubluepy_peripheral_disconnect_obj) },