summaryrefslogtreecommitdiff
path: root/shared-bindings/bleio/Peripheral.c
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2019-08-28 23:15:22 -0400
committerDan Halbert <halbert@halwitz.org>2019-08-28 23:15:22 -0400
commitf17059b10bde0bdce3aca959ea9ee207ed98ede7 (patch)
treeaf07deb2cbd592d2f39a4e5a58460301093a302b /shared-bindings/bleio/Peripheral.c
parent19c59b41edcfdbb2ef67c73729fb8c866dd360ad (diff)
another API rework: less abstraction leakage
Diffstat (limited to 'shared-bindings/bleio/Peripheral.c')
-rw-r--r--shared-bindings/bleio/Peripheral.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/shared-bindings/bleio/Peripheral.c b/shared-bindings/bleio/Peripheral.c
index 3a78802ac..6ebc406d6 100644
--- a/shared-bindings/bleio/Peripheral.c
+++ b/shared-bindings/bleio/Peripheral.c
@@ -112,50 +112,6 @@ STATIC mp_obj_t bleio_peripheral_make_new(const mp_obj_type_t *type, size_t n_ar
return MP_OBJ_FROM_PTR(self);
}
-//| .. method:: add_service(uuid, *, secondary=False)
-//|
-//| Create a new `Service` object, identitied by the specified UUID, and add it to this ``Peripheral``.
-//|
-//| To mark the service as secondary, pass `True` as :py:data:`secondary`.
-//|
-//| :param bleio.UUID uuid: The uuid of the service
-//| :param bool secondary: If the service is a secondary one
-//
-//| :return: the new `Service`
-//|
-STATIC mp_obj_t bleio_peripheral_add_service(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- bleio_peripheral_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
-
- enum { ARG_uuid, ARG_secondary };
- static const mp_arg_t allowed_args[] = {
- { MP_QSTR_uuid, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = mp_const_none} },
- { MP_QSTR_secondary, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
- };
-
- mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
- mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
-
- const mp_obj_t uuid_obj = args[ARG_uuid].u_obj;
-
- if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) {
- mp_raise_ValueError(translate("Expected a UUID"));
- }
-
- const bool is_secondary = args[ARG_secondary].u_bool;
- bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj);
-
- bleio_service_obj_t *service = m_new_obj(bleio_service_obj_t);
- service->base.type = &bleio_service_type;
-
- common_hal_bleio_service_construct(service, uuid, is_secondary);
-
- common_hal_bleio_peripheral_add_service(self, service);
-
- return MP_OBJ_FROM_PTR(service);
-}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_peripheral_add_service_obj, 2, bleio_peripheral_add_service);
-
-
//| .. attribute:: connected (read-only)
//|
//| True if connected to a BLE Central device.
@@ -347,7 +303,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_peripheral_pair_obj, bleio_peripheral_pai
STATIC const mp_rom_map_elem_t bleio_peripheral_locals_dict_table[] = {
// Methods
- { MP_ROM_QSTR(MP_QSTR_add_service), MP_ROM_PTR(&bleio_peripheral_add_service_obj) },
{ 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) },