There is option in native application just like as in android and iOS to get the characteristic and descriptor by their UUID. An example code is given below
char *svc_uuid = "0000180f-0000-1000-8000-00805f9b34fb"; /* Battery service */ char *chr_uuid = "00002a19-0000-1000-8000-00805f9b34fb"; /* Battery level */ /* Client characteristic configuration */ char *desc_uuid = "00002902-0000-1000-8000-00805f9b34fb"; bt_gatt_h svc = NULL; bt_gatt_h chr = NULL; bt_gatt_h desc = NULL; ret = bt_gatt_client_get_service(client, svc_uuid, &svc); if (ret != BT_ERROR_NONE) { dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_client_get_service failed: %d", ret); return; } ret = bt_gatt_service_get_characteristic(svc, chr_uuid, &chr); if (ret != BT_ERROR_NONE) { dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_service_get_characteristic failed: %d", ret); return; } ret = bt_gatt_characteristic_get_descriptor(chr, desc_uuid, &desc); if (ret != BT_ERROR_NONE) { dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_characteristic_get_descriptor failed: %d", ret); return; } ret = __bt_gatt_client_set_value("int32", "1234", desc); if (ret != BT_ERROR_NONE) { dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_set_value failed: %d", ret); return; } ret = bt_gatt_client_write_value(desc, __bt_gatt_client_write_complete_cb, NULL); if (ret != BT_ERROR_NONE) { dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_client_write_value failed: %d", ret); return; }
But I couldn't find any such methods for web applications. Is there any way to get the required descriptor and characteristic without having to loop through the entire characteristics?