diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index d28301a..c62255f 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
after = NULL;
- if (!db || handle < 1)
+ if (!db)
return NULL;
+ if (!handle)
+ handle = db->next_handle;
+
if (num_handles < 1 || (handle + num_handles - 1) > UINT16_MAX)
return NULL;
bool primary,
uint16_t num_handles)
{
- return gatt_db_insert_service(db, db->next_handle, uuid, primary,
- num_handles);
+ return gatt_db_insert_service(db, 0, uuid, primary, num_handles);
}
unsigned int gatt_db_register(struct gatt_db *db,
gatt_db_write_t write_func,
void *user_data)
{
- if (!attrib || !handle)
+ if (!attrib)
return NULL;
return service_insert_characteristic(attrib->service, handle, uuid,
gatt_db_write_t write_func,
void *user_data)
{
- if (!attrib || !handle)
+ if (!attrib)
return NULL;
return service_insert_descriptor(attrib->service, handle, uuid,