Skip to content

bluetooth: remove hardcoded generic attribute service. #7675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions extmod/btstack/modbluetooth_btstack.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,6 @@ int mp_bluetooth_gatts_register_service_begin(bool append) {
uint16_t handle = att_db_util_add_characteristic_uuid16(GAP_DEVICE_NAME_UUID, ATT_PROPERTY_READ | ATT_PROPERTY_DYNAMIC, ATT_SECURITY_NONE, ATT_SECURITY_NONE, NULL, 0);
assert(handle == BTSTACK_GAP_DEVICE_NAME_HANDLE);
(void)handle;

att_db_util_add_service_uuid16(0x1801);
att_db_util_add_characteristic_uuid16(0x2a05, ATT_PROPERTY_READ, ATT_SECURITY_NONE, ATT_SECURITY_NONE, NULL, 0);
}

return 0;
Expand Down
13 changes: 5 additions & 8 deletions extmod/nimble/modbluetooth_nimble.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include "nimble/ble.h"
#include "nimble/nimble_port.h"
#include "services/gap/ble_svc_gap.h"
#include "services/gatt/ble_svc_gatt.h"

#if MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS
// We need the definition of "struct ble_l2cap_chan".
Expand Down Expand Up @@ -643,12 +642,11 @@ int mp_bluetooth_init(void) {

DEBUG_printf("mp_bluetooth_init: starting services\n");

// By default, just register the default gap/gatt service.
// By default, just register the default gap service.
ble_svc_gap_init();
ble_svc_gatt_init();
// The preceeding two calls allocate service definitions on the heap,
// then we must now call gatts_start to register those services
// and free the heap memory.
// The preceeding call allocates the service definition on the heap,
// we must now call gatts_start to register the service and free
// the heap memory.
// Otherwise it will be realloc'ed on the next stack startup.
ble_gatts_start();

Expand Down Expand Up @@ -908,9 +906,8 @@ int mp_bluetooth_gatts_register_service_begin(bool append) {
// Reset the gatt characteristic value db.
mp_bluetooth_gatts_db_reset(MP_STATE_PORT(bluetooth_nimble_root_pointers)->gatts_db);

// By default, just register the default gap/gatt service.
// By default, just register the default gap service.
ble_svc_gap_init();
ble_svc_gatt_init();

// Unref any previous service definitions.
for (size_t i = 0; i < MP_STATE_PORT(bluetooth_nimble_root_pointers)->n_services; ++i) {
Expand Down