subsys: bluetooth: Add notification TX complete callback

This changed added notification complete callback which
gives information if a given notification has been sent.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
This commit is contained in:
Kamil Gawor 2018-09-12 09:58:43 +02:00 committed by Carles Cufí
commit 8853cb3d06
2 changed files with 40 additions and 9 deletions

View file

@ -679,6 +679,28 @@ ssize_t bt_gatt_attr_read_cpf(struct bt_conn *conn,
.user_data = _value, \
}
/** @brief Notification complete result callback.
*
* @param conn Connection object.
*/
typedef void (*bt_gatt_notify_complete_func_t) (struct bt_conn *conn);
/** @brief Notify attribute value change with callback.
*
* This function works in the same way as @ref bt_gatt_notify.
* With the addition that after sending the notification the
* callback function will be called.
*
* @param conn Connection object.
* @param attr Characteristic or Characteristic Value attribute.
* @param data Pointer to Attribute data.
* @param len Attribute value length.
* @param func Notification value callback.
*/
int bt_gatt_notify_cb(struct bt_conn *conn, const struct bt_gatt_attr *attr,
const void *data, u16_t len,
bt_gatt_notify_complete_func_t func);
/** @brief Notify attribute value change.
*
* Send notification of attribute value change, if connection is NULL notify
@ -696,8 +718,11 @@ ssize_t bt_gatt_attr_read_cpf(struct bt_conn *conn,
* @param data Pointer to Attribute data.
* @param len Attribute value length.
*/
int bt_gatt_notify(struct bt_conn *conn, const struct bt_gatt_attr *attr,
const void *data, u16_t len);
static inline int bt_gatt_notify(struct bt_conn *conn, const struct bt_gatt_attr *attr,
const void *data, u16_t len)
{
return bt_gatt_notify_cb(conn, attr, data, len, NULL);
}
/** @typedef bt_gatt_indicate_func_t
* @brief Indication complete result callback.