struct gatt_db_attribute **attributes;
};
+static void set_attribute_data(struct gatt_db_attribute *attribute,
+ gatt_db_read_t read_func,
+ gatt_db_write_t write_func,
+ uint32_t permissions,
+ void *user_data)
+{
+ attribute->permissions = permissions;
+ attribute->read_func = read_func;
+ attribute->write_func = write_func;
+ attribute->user_data = user_data;
+}
+
static void pending_read_result(struct pending_read *p, int err,
const uint8_t *data, size_t length)
{
return NULL;
}
+ set_attribute_data(service->attributes[0], NULL, NULL, BT_ATT_PERM_READ, NULL);
+
return service;
}
return service->attributes[index];
}
-static void set_attribute_data(struct gatt_db_attribute *attribute,
- gatt_db_read_t read_func,
- gatt_db_write_t write_func,
- uint32_t permissions,
- void *user_data)
-{
- attribute->permissions = permissions;
- attribute->read_func = read_func;
- attribute->write_func = write_func;
- attribute->user_data = user_data;
-}
-
static struct gatt_db_attribute *
service_insert_characteristic(struct gatt_db_service *service,
uint16_t handle,
if (!service->attributes[i])
return NULL;
+ set_attribute_data(service->attributes[i], NULL, NULL, BT_ATT_PERM_READ, NULL);
+
i++;
service->attributes[i] = new_attribute(service, handle, uuid, NULL, 0);
*
* TODO handle permissions
*/
- set_attribute_data(service->attributes[index], NULL, NULL, 0, NULL);
+ set_attribute_data(service->attributes[index], NULL, NULL, BT_ATT_PERM_READ, NULL);
return attribute_update(service, index);
}