static int assigned_id = 0;
static gboolean instance_id_used[BT_GATTS_MAX];
static guint manager_id[BT_GATTS_MAX];
-static bool acquire_notify_is_pending = false;
-static bool write_value_is_pending = false;
+static int acquire_notify_pending_count = 0;
+static int write_value_pending_count = 0;
#define CHECK_BTGATT_INIT() if (_bt_hal_gatt_interface_ready() == false)\
{\
ERR("Client info not found. This method call will be called again shortly");
g_variant_unref(var);
- if (write_value_is_pending) {
- write_value_is_pending = false;
+ if (write_value_pending_count > 2) {
+ ERR("Client info still not found (count %d). Ignoring this method call", write_value_pending_count);
+ write_value_pending_count = 0;
goto done;
}
info->user_data = user_data;
g_timeout_add(300, __bt_pending_method_call, info);
- write_value_is_pending = true;
+ write_value_pending_count++;
return;
}
- write_value_is_pending = false;
+ write_value_pending_count = 0;
svc_info = __bt_gatt_find_gatt_service_from_char(object_path, &char_hdl);
if (svc_info == NULL || event_cb == NULL) {
ERR("Client info not found. This method call will be called again shortly");
g_variant_iter_free(iter);
- if (acquire_notify_is_pending) {
- acquire_notify_is_pending = false;
+ if (acquire_notify_pending_count > 2) {
+ ERR("Client info still not found (count %d). Ignoring this method call", acquire_notify_pending_count);
+ acquire_notify_pending_count = 0;
goto done;
}
info->user_data = user_data;
g_timeout_add(300, __bt_pending_method_call, info);
- acquire_notify_is_pending = true;
+ acquire_notify_pending_count++;
return;
}
- acquire_notify_is_pending = false;
+ acquire_notify_pending_count = 0;
svc_info = __bt_gatt_find_gatt_service_from_char(object_path, &char_hdl);
if (svc_info == NULL) {
struct method_call_info *info = data;
DBG("The method call was called again");
+ if (g_strcmp0(info->method_name, "WriteValue") == 0)
+ DBG("WriteValue pending count [%d]", write_value_pending_count);
+ if (g_strcmp0(info->method_name, "AcquireNotify") == 0)
+ DBG("AcquireNotify pending count [%d]", acquire_notify_pending_count);
+
__bt_gatt_char_method_call(info->connection,
info->sender,
info->object_path,