summaryrefslogtreecommitdiff
path: root/shared-bindings/bleio/Peripheral.c
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2019-07-07 00:07:47 -0400
committerDan Halbert <halbert@halwitz.org>2019-07-07 00:07:47 -0400
commit09ddff8df1349c590e6c0533b6f5085fbcb92483 (patch)
tree0d7e167b231f892937eaead1390a2fcaee65b6ce /shared-bindings/bleio/Peripheral.c
parentbf8a35b2f835fbc97d54867f8e21b486a46c245b (diff)
WIP: Need descriptors for Central CCCD discovery; not done yet
Diffstat (limited to 'shared-bindings/bleio/Peripheral.c')
-rw-r--r--shared-bindings/bleio/Peripheral.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/shared-bindings/bleio/Peripheral.c b/shared-bindings/bleio/Peripheral.c
index 665f5baaf..320d83471 100644
--- a/shared-bindings/bleio/Peripheral.c
+++ b/shared-bindings/bleio/Peripheral.c
@@ -250,10 +250,26 @@ STATIC mp_obj_t bleio_peripheral_stop_advertising(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_peripheral_stop_advertising_obj, bleio_peripheral_stop_advertising);
+//| .. method:: disconnect()
+//|
+//| Disconnects from the remote central.
+//| Normally the central initiates a disconnection. Use this only
+//| if necessary for your application.
+//|
+STATIC mp_obj_t bleio_peripheral_disconnect(mp_obj_t self_in) {
+ bleio_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
+
+ common_hal_bleio_peripheral_disconnect(self);
+
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_peripheral_disconnect_obj, bleio_peripheral_disconnect);
+
STATIC const mp_rom_map_elem_t bleio_peripheral_locals_dict_table[] = {
// Methods
{ MP_ROM_QSTR(MP_QSTR_start_advertising), MP_ROM_PTR(&bleio_peripheral_start_advertising_obj) },
{ MP_ROM_QSTR(MP_QSTR_stop_advertising), MP_ROM_PTR(&bleio_peripheral_stop_advertising_obj) },
+ { MP_ROM_QSTR(MP_QSTR_disconnect), MP_ROM_PTR(&bleio_peripheral_disconnect_obj) },
// Properties
{ MP_ROM_QSTR(MP_QSTR_connected), MP_ROM_PTR(&bleio_peripheral_connected_obj) },