properties = BT_GATT_PROPERTY_WRITE | BT_GATT_PROPERTY_READ;
}
+ /* Add Indicate property by default */
+ properties |= BT_GATT_PROPERTY_INDICATE;
+
bt_gatt_h charPath = NULL;
int ret = bt_gatt_characteristic_create(charUUID, permissions, properties, charValue,
OIC_LOG_V(DEBUG, TAG,
"bt_gatt_characteristic_create charPath obtained: %s", (char *)charPath);
- if (read)
- {
#ifdef BLE_TIZEN_30
ret = bt_gatt_server_set_characteristic_notification_state_change_cb(charPath,
CALENotificationCb,
CALEGetErrorMsg(ret));
return CA_STATUS_FAILED;
}
- }
ret = bt_gatt_service_add_characteristic(svcPath, charPath);
if (0 != ret)
oc_mutex_lock(g_leCharacteristicMutex);
+ /**
+ * NOTE : Currently this sequence of adding characterstic works both on android and tizen.
+ * With previous logic it was faling on android in some devices giving wrong attribute
+ * handle error. This issue needs to be fixed in Android BT layer but we have applied
+ * workaround for now so that it should work with both Android and Tizen devices.
+ */
if (read)
- {
g_gattReadCharPath = charPath;
- }
else
- {
+ g_gattWriteCharPath = charPath;
+
char desc_value[2] = {0, 0}; // Notification enabled.
bt_gatt_h descriptor = NULL;
permissions = BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE;
CALEGetErrorMsg(ret));
return CA_STATUS_FAILED;
}
- g_gattWriteCharPath = charPath;
- }
oc_mutex_unlock(g_leCharacteristicMutex);