app = &numapps[k];
/* Search for a app which has same sender and stop adv is running */
- if (!strncasecmp(app->sender, name, strlen(name)) && app->is_initialized == TRUE) {
- BT_DBG("Match found, name: %s", name);
+ if (strcasecmp(app->sender, name) == 0 && app->is_initialized == TRUE) {
+ BT_DBG("numapps[%d] Match found, name: %s", k, name);
/* TODO 2: Need to manage app info as list, not array.
This loop always run for MAX count if any apps are terminated.
int k;
oal_uuid_t uuid;
- BT_INFO("###Check on which instance Server instance can be initialized....");
+ BT_INFO("Check on which instance Server instance can be initialized....");
for (k = 1; k < MAX_APPS_SUPPORTED; k++) {
if (numapps[k].is_initialized == 1) {
- BT_INFO("Instance ID [%d] is already in use..Check next slot", numapps[k].instance_id);
+ BT_DBG("Instance ID [%d] is already in use..Check next slot", numapps[k].instance_id);
} else {
slot = k;
- BT_INFO("Time to register GATT Server..UUID to be used is [%s] slot [%d]", uuid_list[slot-1], slot);
+ BT_DBG("Time to register GATT Server..UUID to be used is [%s] slot [%d]", uuid_list[slot-1], slot);
break;
}
}
g_free(uuid_string);
return BLUETOOTH_ERROR_INTERNAL;
}
- BT_INFO("GATT Server registration call successfully accepted by OAL..wait for Instance Initialized event from OAL..");
+ BT_DBG("GATT Server registration call successfully accepted by OAL..wait for Instance Initialized event from OAL..");
/* Return & wait for GATT Server Instance Initialization event */
memset(numapps[slot].sender, 0x00, sizeof(numapps[slot].sender));
memset(numapps[slot].uuid, 0x00, sizeof(numapps[slot].uuid));
#ifndef GATT_DIRECT
case BT_GATT_SERVER_REGISTER: {
bt_service_app_info_t *param = (bt_service_app_info_t*)data;
- BT_DBG("Sender [%s] Request Sender [%s]", param->sender, req_info->sender);
+
if (!g_strcmp0(req_info->sender, param->sender)) {
BT_DBG("GATT Server app found [%s]", req_info->sender);
case BT_GATT_SERVER_START_SERVICE:
case BT_GATT_SERVER_DELETE_SERVICE: {
bt_service_app_info_t *param = (bt_service_app_info_t*)data;
- BT_DBG("Sender [%s] Request Sender [%s]", param->sender, req_info->sender);
int *saved_instance_id = (int*)req_info->user_data;
if (!g_strcmp0(req_info->sender, param->sender) && param->instance_id == *saved_instance_id) {
#ifdef TIZEN_GATT_CLIENT
case BT_GATT_CLIENT_REGISTER: {
bt_service_app_info_t *param = (bt_service_app_info_t*)data;
- BT_DBG("Sender [%s] Request Sender [%s]", param->sender, req_info->sender);
+
if (!g_strcmp0(req_info->sender, param->sender)) {
BT_DBG("GATT Client app found [%s] created client ID [%d]",
req_info->sender, param->client_id);
_bt_convert_addr_type_to_string(address,
(unsigned char *)(¶m->device_addr.addr));
- BT_DBG("Request Sender [%s] address [%s]", req_info->sender, address);
-
/* Match address to determine same request */
if (!g_strcmp0((char*)req_info->user_data, address)) {
BT_DBG("GATT Client app found [%s] Remote address [%s]",
bt_char_browse_info_t param;
memcpy((void*)¶m, data, sizeof(bt_char_browse_info_t));
//bt_char_browse_info_t *param = (bt_char_browse_info_t*)data;
- BT_DBG("Request Sender [%s]", req_info->sender);
+
bluetooth_gatt_client_svc_prop_info_t *prop = (bluetooth_gatt_client_svc_prop_info_t*)req_info->user_data;
/* Match both address and service properties to determine same request */
case BT_GATT_GET_CHARACTERISTIC_PROPERTIES: {
bt_descriptor_browse_info_t *param = (bt_descriptor_browse_info_t*)data;
- BT_DBG("Request Sender [%s]", req_info->sender);
bluetooth_gatt_client_char_prop_info_t *prop = (bluetooth_gatt_client_char_prop_info_t*)req_info->user_data;
/* Match both address, service properties &char properties to determine same request */
case BT_GATT_WATCH_CHARACTERISTIC: {
bt_gatt_notif_reg_info_t *param = (bt_gatt_notif_reg_info_t*)data;
bluetooth_gatt_client_char_prop_info_t *prop = (bluetooth_gatt_client_char_prop_info_t*)req_info->user_data;
- BT_DBG("Request Sender [%s]", req_info->sender);
+
/* Match both address, service properties &char properties to determine same request */
if (!memcmp(param->addr.addr,
prop->device_address.addr,
case BT_GATT_READ_CHARACTERISTIC:
case BT_GATT_WRITE_CHARACTERISTIC_VALUE_BY_TYPE: {
bluetooth_gatt_client_char_prop_info_t *param = (bluetooth_gatt_client_char_prop_info_t*)data;
- BT_DBG("Request Sender [%s]", req_info->sender);
char *addr = g_malloc0(sizeof(char) * BT_ADDRESS_STRING_SIZE);
bluetooth_gatt_client_char_prop_info_t *prop = (bluetooth_gatt_client_char_prop_info_t*)req_info->user_data;
case BT_GATT_READ_DESCRIPTOR_VALUE:
case BT_GATT_WRITE_DESCRIPTOR_VALUE: {
bluetooth_gatt_client_desc_prop_info_t *param = (bluetooth_gatt_client_desc_prop_info_t*)data;
- BT_DBG("Request Sender [%s]", req_info->sender);
char *addr = g_malloc0(sizeof(char) * BT_ADDRESS_STRING_SIZE);
bluetooth_gatt_client_desc_prop_info_t *prop = (bluetooth_gatt_client_desc_prop_info_t*)req_info->user_data;
info = &numapps[k];
if (info->instance_id == event->gatt_srvc_stat.server_inst) {
- BT_INFO("Found GATT Server.. UUID [%s], sender [%s]", info->uuid, info->sender);
+ BT_INFO("numapps[%d] Found GATT Server.. UUID [%s], sender [%s]", k, info->uuid, info->sender);
__bt_gatt_handle_pending_request_info(result, BT_GATT_SERVER_ADD_SERVICE,
(int*)&svc_handle, sizeof(int));
if (svc_handle > 0) {
handle = g_malloc0(sizeof(int));
*handle = svc_handle;
- numapps[event->gatt_srvc_stat.server_inst].service_handles = g_slist_append(numapps[event->gatt_srvc_stat.server_inst].service_handles, handle);
- count = g_slist_length(numapps[event->gatt_srvc_stat.server_inst].service_handles);
+ numapps[k].service_handles = g_slist_append(numapps[k].service_handles, handle);
+ count = g_slist_length(numapps[k].service_handles);
BT_INFO("Added Service handle [%d] to list..current count [%d]", svc_handle, count);
}
break;
break;
}
case OAL_EVENT_GATTC_SERVICE_SEARCH_RESULT: {
- BT_INFO("OAL Event: GATT Client Service Search Result");
+ BT_DBG("OAL Event: GATT Client Service Search Result");
__bt_handle_client_service_search_result((event_gattc_service_result_t *) event_data);
break;
}
break;
}
case OAL_EVENT_GATTC_CHARAC_SERACH_RESULT: {
- BT_INFO("OAL Event: GATT Client Characteristic Search Result");
+ BT_DBG("OAL Event: GATT Client Characteristic Search Result");
__bt_handle_client_characteristic_search_result((event_gattc_characteristic_result_t *) event_data);
break;
}
case OAL_EVENT_GATTC_DESC_SERACH_RESULT: {
- BT_INFO("OAL Event: GATT Client Descriptor Search Result");
+ BT_DBG("OAL Event: GATT Client Descriptor Search Result");
__bt_handle_client_descriptor_search_result((event_gattc_descriptor_result_t *) event_data);
break;
}
case OAL_EVENT_GATTC_READ_CHARAC: {
- BT_INFO("OAL Event: GATT Client Characteristic Read Data");
+ BT_DBG("OAL Event: GATT Client Characteristic Read Data");
__bt_handle_client_characteristic_read_data((event_gattc_read_data *) event_data);
break;
}
case OAL_EVENT_GATTC_READ_DESCR: {
- BT_INFO("OAL Event: GATT Client Descriptor Read Data");
+ BT_DBG("OAL Event: GATT Client Descriptor Read Data");
__bt_handle_client_descriptor_read_data((event_gattc_read_data *) event_data);
break;
}
case OAL_EVENT_GATTC_WRITE_CHARAC: {
- BT_INFO("OAL Event: GATT Client Characteristic Write Data");
+ BT_DBG("OAL Event: GATT Client Characteristic Write Data");
__bt_handle_client_characteristic_write_data((event_gattc_write_data *) event_data);
break;
}
case OAL_EVENT_GATTC_WRITE_DESCR: {
- BT_INFO("OAL Event: GATT Client Descriptor Write Data");
+ BT_DBG("OAL Event: GATT Client Descriptor Write Data");
__bt_handle_client_descriptor_write_data((event_gattc_write_data *) event_data);
break;
}
break;
}
case OAL_EVENT_GATTC_NOTIFY_DATA: {
- BT_INFO("OAL Event: GATT Client Notification Data");
+ BT_DBG("OAL Event: GATT Client Notification Data");
__bt_handle_client_notification_data((event_gattc_notify_data *) event_data);
break;
}
oal_uuid_t uuid;
/* App should ensure that it should not send */
- BT_INFO("### Check on which instance GATT Client instance can be initialized....");
+ BT_INFO("Check on which instance GATT Client instance can be initialized....");
for (k = 1; k < MAX_APPS_SUPPORTED; k++) {
if (numapps[k].is_initialized == 1) {
BT_INFO("Instance ID [%d] is already in use..Check next slot",
bt_gatt_descriptor_info_t *desc_info;
bt_descriptor_browse_info_t browse_info;
- BT_INFO("descriptor search result status [%d]", event_data->conn_status.status);
+ BT_DBG("descriptor search result status [%d]", event_data->conn_status.status);
memset(&browse_info, 0x00, sizeof(bt_descriptor_browse_info_t));
bt_service_app_info_t *info = NULL;
int k, ret;
- BT_INFO("Unregister Allocated GATT Client instance [%s] Client ID [%d]", sender, client_id);
+ BT_DBG("Unregister Allocated GATT Client instance [%s] Client ID [%d]", sender, client_id);
/* Unregister CLient instance associated with address X. It is possible that another app still
has client_id valid for same remote address */
/* Exact matching of sender */
if (!g_strcmp0(info->sender, sender) && info->client_id == client_id) { /* Check for only valid GATT client Instance */
- BT_INFO("Unregister GATT client instance [%d]", info->client_id);
numapps[k].client_id = -1;
numapps[k].is_initialized = FALSE;
memset(numapps[k].sender, 0x00, sizeof(numapps[k].sender));
}
}
+int _bt_gatt_get_data_batching_available_packets(
+ guint *available_packets)
+{
+ int ret = OAL_STATUS_SUCCESS;
+
+ BT_CHECK_PARAMETER(available_packets, return);
+
+ ret = gatt_get_data_batching_available_packets(available_packets);
+ if (ret != OAL_STATUS_SUCCESS) {
+ BT_ERR("ret: %d", ret);
+ if (ret == OAL_STATUS_NOT_SUPPORT)
+ return BLUETOOTH_ERROR_NOT_SUPPORT;
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ return BLUETOOTH_ERROR_NONE;
+}
+
+int _bt_gatt_enable_data_batching(bluetooth_device_address_t *address,
+ int packet_threshold, int timeout)
+{
+ int ret = OAL_STATUS_SUCCESS;
+ char remote_address[BT_ADDRESS_STRING_SIZE] = { 0 };
+
+ BT_CHECK_PARAMETER(address, return);
+
+ _bt_convert_addr_type_to_string(remote_address, address->addr);
+ BT_INFO("Enable GATT data batching. address[%s] packet_threshold[%d] timeout[%d]",
+ remote_address, packet_threshold, timeout);
+
+ ret = gatt_enable_data_batching((bt_address_t*)(address), packet_threshold, timeout);
+
+ if (ret != OAL_STATUS_SUCCESS) {
+ BT_ERR("ret: %d", ret);
+ if (ret == OAL_STATUS_INVALID_PARAM)
+ return BLUETOOTH_ERROR_INVALID_PARAM;
+ else if (ret == OAL_STATUS_NOT_SUPPORT)
+ return BLUETOOTH_ERROR_NOT_SUPPORT;
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ return BLUETOOTH_ERROR_NONE;
+}
+
+int _bt_gatt_disable_data_batching(bluetooth_device_address_t *address)
+{
+ int ret = OAL_STATUS_SUCCESS;
+ char remote_address[BT_ADDRESS_STRING_SIZE] = { 0 };
+
+ BT_CHECK_PARAMETER(address, return);
+
+ _bt_convert_addr_type_to_string(remote_address, address->addr);
+ BT_INFO("Disable GATT data batching. address[%s]", remote_address);
+
+ ret = gatt_disable_data_batching((bt_address_t*)(address));
+
+ if (ret != OAL_STATUS_SUCCESS) {
+ BT_ERR("ret: %d", ret);
+ if (ret == OAL_STATUS_NOT_SUPPORT)
+ return BLUETOOTH_ERROR_NOT_SUPPORT;
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ return BLUETOOTH_ERROR_NONE;
+}
#endif