Diff between 67cd2b092231ea1328805f989896cb55d0ea2696 and cdb0f1e52ac422860d2752540c91111d7653bdca

Changed Files

File Additions Deletions Status
attrib/gatt-service.c +7 -0 modified
attrib/gatt-service.h +3 -0 modified

Full Patch

diff --git a/attrib/gatt-service.c b/attrib/gatt-service.c
index 3d623de..b8f2503 100644
--- a/attrib/gatt-service.c
+++ b/attrib/gatt-service.c
@@ -44,6 +44,7 @@ struct gatt_info {
 	int authorization;
 	GSList *callbacks;
 	unsigned int num_attrs;
+	uint16_t *value_handle;
 };
 
 struct attrib_cb {
@@ -85,6 +86,9 @@ static GSList *parse_opts(gatt_option opt1, va_list args)
 			cb->fn = va_arg(args, void *);
 			info->callbacks = g_slist_append(info->callbacks, cb);
 			break;
+		case GATT_OPT_CHR_VALUE_GET_HANDLE:
+			info->value_handle = va_arg(args, void *);
+			break;
 		case GATT_OPT_CHR_AUTHENTICATION:
 			info->authentication = va_arg(args, gatt_option);
 			break;
@@ -206,6 +210,9 @@ static gboolean add_characteristic(uint16_t *handle, struct gatt_info *info)
 		}
 	}
 
+	if (info->value_handle)
+		*info->value_handle = a->handle;
+
 	/* client characteristic configuration descriptor */
 	if (info->props & (ATT_CHAR_PROPER_NOTIFY | ATT_CHAR_PROPER_INDICATE)) {
 		uint8_t cfg_val[2];
diff --git a/attrib/gatt-service.h b/attrib/gatt-service.h
index 4cb91ce..d627ca1 100644
--- a/attrib/gatt-service.h
+++ b/attrib/gatt-service.h
@@ -30,6 +30,9 @@ typedef enum {
 	GATT_OPT_CHR_AUTHENTICATION,
 	GATT_OPT_CHR_AUTHORIZATION,
 
+	/* Get attribute handle for characteristic value */
+	GATT_OPT_CHR_VALUE_GET_HANDLE,
+
 	/* arguments for authentication/authorization */
 	GATT_CHR_VALUE_READ,
 	GATT_CHR_VALUE_WRITE,