From dbaa3e38cf37e27d7f23e5e72e5ddcab493c3e38 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 3 Feb 2016 17:04:57 +0200 Subject: [PATCH] drivers/nble: Add initial implementation of bt_gatt_notify Change-Id: I9a5ed5092e8ae8ce9f89f53334b43a2362b91bac Signed-off-by: Luiz Augusto von Dentz --- drivers/nble/gatt.c | 9 ++++++++- drivers/nble/gatt_internal.h | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/nble/gatt.c b/drivers/nble/gatt.c index fe41c61a328..573f79b41c1 100644 --- a/drivers/nble/gatt.c +++ b/drivers/nble/gatt.c @@ -348,7 +348,14 @@ int bt_gatt_attr_read_cpf(struct bt_conn *conn, int bt_gatt_notify(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *data, uint16_t len) { - return -ENOSYS; + struct ble_gatt_send_notif_ind_params notif; + + notif.conn_handle = 0xFFFF; + notif.params.attr = (struct bt_gatt_attr *)attr; + notif.params.offset = 0; + + ble_gatt_send_notif_req(¬if, (uint8_t *)data, len); + return 0; } int bt_gatt_exchange_mtu(struct bt_conn *conn, bt_gatt_rsp_func_t func) diff --git a/drivers/nble/gatt_internal.h b/drivers/nble/gatt_internal.h index bf6d359faca..1a017fee399 100644 --- a/drivers/nble/gatt_internal.h +++ b/drivers/nble/gatt_internal.h @@ -122,7 +122,7 @@ struct ble_gatts_rw_reply_params { * Notification/Indication parameters */ struct ble_gatt_notif_ind_params { - uint16_t val_handle; + struct bt_gatt_attr *attr; uint16_t offset; }; @@ -131,6 +131,7 @@ struct ble_gatt_notif_ind_params { */ struct ble_gatt_send_notif_ind_params { + void *cback; uint16_t conn_handle; struct ble_gatt_notif_ind_params params; };