diff options
| author | arturo182 <arturo182@tlen.pl> | 2018-07-23 23:52:09 +0200 |
|---|---|---|
| committer | arturo182 <arturo182@tlen.pl> | 2018-10-21 15:59:46 +0200 |
| commit | b5e5805bb408ca3bb5975d8fad21070dbf4d51e9 (patch) | |
| tree | 346ba2b97f7be6ef6ad42a486136433e340408ae | |
| parent | c7b42d80b3df38048b2269c5eae55e318204e564 (diff) | |
bleio: Remove redundant struct field
| -rw-r--r-- | ports/nrf/common-hal/bleio/Device.c | 2 | ||||
| -rw-r--r-- | ports/nrf/common-hal/bleio/Service.c | 3 | ||||
| -rw-r--r-- | shared-bindings/bleio/Service.c | 4 | ||||
| -rw-r--r-- | shared-module/bleio/Characteristic.h | 1 |
4 files changed, 3 insertions, 7 deletions
diff --git a/ports/nrf/common-hal/bleio/Device.c b/ports/nrf/common-hal/bleio/Device.c index 8e52b2fbc..fd772c04d 100644 --- a/ports/nrf/common-hal/bleio/Device.c +++ b/ports/nrf/common-hal/bleio/Device.c @@ -376,8 +376,6 @@ STATIC void on_char_discovery_rsp(ble_gattc_evt_char_disc_rsp_t *response, bleio characteristic->props.write = gattc_char->char_props.write; characteristic->props.write_wo_resp = gattc_char->char_props.write_wo_resp; characteristic->handle = gattc_char->handle_value; - - characteristic->service_handle = m_char_discovery_service->handle; characteristic->service = m_char_discovery_service; mp_obj_list_append(m_char_discovery_service->char_list, MP_OBJ_FROM_PTR(characteristic)); diff --git a/ports/nrf/common-hal/bleio/Service.c b/ports/nrf/common-hal/bleio/Service.c index 9e376b333..93588d156 100644 --- a/ports/nrf/common-hal/bleio/Service.c +++ b/ports/nrf/common-hal/bleio/Service.c @@ -101,7 +101,7 @@ void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self, blei ble_gatts_char_handles_t handles; uint32_t err_code; - err_code = sd_ble_gatts_characteristic_add(characteristic->service_handle, &char_md, &attr_char_value, &handles); + err_code = sd_ble_gatts_characteristic_add(self->handle, &char_md, &attr_char_value, &handles); if (err_code != NRF_SUCCESS) { nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "Failed to add characteristic, status: 0x%08lX", err_code)); @@ -111,5 +111,4 @@ void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self, blei characteristic->cccd_handle = handles.cccd_handle; characteristic->sccd_handle = handles.sccd_handle; characteristic->handle = handles.value_handle; - characteristic->service = self; } diff --git a/shared-bindings/bleio/Service.c b/shared-bindings/bleio/Service.c index 3a4aa4737..94d245d7f 100644 --- a/shared-bindings/bleio/Service.c +++ b/shared-bindings/bleio/Service.c @@ -113,12 +113,12 @@ STATIC mp_obj_t bleio_service_add_characteristic(mp_obj_t self_in, mp_obj_t char bleio_service_obj_t *self = MP_OBJ_TO_PTR(self_in); bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(characteristic_in); - characteristic->service_handle = self->handle; - // TODO: If service is 128b then update Chara UUID to be 128b too common_hal_bleio_service_add_characteristic(self, characteristic); + characteristic->service = self; + mp_obj_list_append(self->char_list, characteristic); return mp_const_none; diff --git a/shared-module/bleio/Characteristic.h b/shared-module/bleio/Characteristic.h index 13f75b2c9..94c43f81e 100644 --- a/shared-module/bleio/Characteristic.h +++ b/shared-module/bleio/Characteristic.h @@ -33,7 +33,6 @@ typedef struct { mp_obj_base_t base; bleio_service_obj_t *service; - uint16_t service_handle; // TODO: Is this needed? bleio_uuid_obj_t *uuid; mp_obj_t value_data; uint16_t handle; |
