Skip to content
Merged
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
4 changes: 4 additions & 0 deletions features/FEATURE_BLE/targets/TARGET_CORDIO/CordioGattServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ class GattServer : public ::ble::interface::GattServer<GattServer>,


private:
void add_default_services();

static uint16_t compute_attributes_count(GattService& service);

void insert_service_attribute(
Expand Down Expand Up @@ -280,6 +282,8 @@ class GattServer : public ::ble::interface::GattServer<GattServer>,

uint16_t currentHandle;

bool default_services_added;

private:
GattServer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,21 @@ void GattServer::initialize()
#if BLE_FEATURE_SECURITY
AttsAuthorRegister(atts_auth_cb);
#endif
add_generic_access_service();
add_generic_attribute_service();
add_default_services();
}

void GattServer::add_default_services()
{
if (!default_services_added) {
default_services_added = true;
add_generic_access_service();
add_generic_attribute_service();
}
}

ble_error_t GattServer::addService_(GattService &service)
{
add_default_services();
// create and fill the service structure
internal_service_t *att_service = new internal_service_t;
att_service->attGroup.pNext = NULL;
Expand Down Expand Up @@ -1344,7 +1353,8 @@ GattServer::GattServer() :
generic_attribute_service(),
registered_service(NULL),
allocated_blocks(NULL),
currentHandle(0)
currentHandle(0),
default_services_added(false)
{
}

Expand Down