dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_characteristic_get_descriptor is failed : %d", ret);
break;
}
- ret = bt_gatt_client_read_value(desc,
- __bt_gatt_client_read_complete_cb, NULL);
- }
- else
- {
- ret = bt_gatt_client_read_value(chr,
- __bt_gatt_client_read_complete_cb, NULL);
- }
-
+ ret = bt_gatt_client_read_value(desc, __bt_gatt_client_read_complete_cb, NULL);
if (ret != BT_ERROR_NONE)
{
dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_client_read_value is failed : %d", ret);
bt_gatt_h desc = NULL;
ret = bt_gatt_client_get_service(client, svc_uuid, &svc);
- if (ret != BT_ERROR_NONE)
+ if (ret != BT_ERROR_NONE)
{
dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_client_get_service is failed : %d", ret);
break;
break;
}
- 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 is failed : %d", ret);
- break;
- }
-
- ret = __bt_gatt_client_set_value("int32",
- "1234", desc);
- if (ret != BT_ERROR_NONE)
- {
- dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_set_value is failed : %d", ret);
- break;
- }
-
- ret = bt_gatt_client_write_value(desc,
- __bt_gatt_client_write_complete_cb, NULL);
- }
- else
+ ret = bt_gatt_characteristic_get_descriptor(chr, desc_uuid, &desc);
+ if (ret != BT_ERROR_NONE)
{
- ret = __bt_gatt_client_set_value(desc_uuid,
- "int32", chr);
- if (ret != BT_ERROR_NONE)
- {
- dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_set_value is failed : %d", ret);
- break;
- }
-
- ret = bt_gatt_client_write_value(chr,
- __bt_gatt_client_write_complete_cb, NULL);
+ dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_characteristic_get_descriptor is failed : %d", ret);
+ break;
}
- if (ret != BT_ERROR_NONE)
+ ret = __bt_gatt_client_set_value("int32",
+ "1234", desc);
+ if (ret != BT_ERROR_NONE)
{
- dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_client_write_value is failed : %d", ret);
+ dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_set_value is failed : %d", ret);
+ break;
}
+
+ ret = bt_gatt_client_write_value(desc, __bt_gatt_client_write_complete_cb, NULL);
+
</pre>
<p>After the writing operation is complete, use the <span style="font-family: Courier New,Courier,monospace;">bt_gatt_client_write_complete_cb()</span> callback to finish the task:</p>
<pre class="prettyprint">