GVariant *parameters,
gpointer user_data)
{
- BT_DBG("GATT Client event handler Entry >>");
-
bt_event_info_t *event_info;
int result = BLUETOOTH_ERROR_NONE;
if (strcasecmp(signal_name, BT_GATT_CHAR_VAL_CHANGED) == 0) { /* Done */
/* Event: BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED */
- BT_INFO("GATT Client event[BT_GATT_CHAR_VAL_CHANGED]");
+ BT_DBG("GATT Client event[BT_GATT_CHAR_VAL_CHANGED]");
bt_gatt_char_property_t char_prop;
const char *address = NULL;
GVariant *data_var = NULL;
GVariant *char_uuid_var = NULL;
int svc_uuid_len = 0;
int char_uuid_len = 0;
- unsigned int i;
memset(&char_prop, 0x00, sizeof(bt_gatt_char_property_t));
char_prop.svc_prop.instance_id = svc_inst;
/* DEBUG */
- for (i = 0; i < char_prop.val_len; i++)
- BT_INFO("Data[%d] = [0x%x]", i, char_prop.value[i]);
+ // for (i = 0; i < char_prop.val_len; i++)
+ // BT_INFO("Data[%d] = [0x%x]", i, char_prop.value[i]);
_bt_gatt_client_event_cb(BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED,
result, &char_prop,
event_info->cb, event_info->user_data);
} else if (strcasecmp(signal_name, BT_GATT_CLIENT_READ_CHAR) == 0) { /* Done */
/* Event: BLUETOOTH_EVENT_GATT_READ_CHAR */
- BT_INFO("GATT Client event[BT_GATT_CLIENT_READ_CHAR]");
+ BT_DBG("GATT Client event[BT_GATT_CLIENT_READ_CHAR]");
bt_gatt_char_property_t char_prop;
const char *address = NULL;
GVariant *data_var = NULL;
GVariant *char_uuid_var = NULL;
int svc_uuid_len = 0;
int char_uuid_len = 0;
- unsigned int i;
memset(&char_prop, 0x00, sizeof(bt_gatt_char_property_t));
&data_var);
g_strlcpy(char_prop.address, address, BT_ADDRESS_STRING_SIZE);
- BT_INFO("GATT Client Read Callback from [%s] svc inst [%d] char val len [%d] char inst [%d]",
+ BT_DBG("GATT Client Read Callback from [%s] svc inst [%d] char val len [%d] char inst [%d]",
address, svc_inst, char_prop.val_len, char_prop.prop.instance_id);
if (char_prop.val_len > 0) {
- BT_INFO("Get the read data");
/* Copy Data */
memcpy(&char_prop.value, g_variant_get_data(data_var), char_prop.val_len);
}
char_prop.svc_prop.instance_id = svc_inst;
/* DEBUG */
- for (i = 0; i < char_prop.val_len; i++)
- BT_INFO("Data[%d] = [0x%x]", i, char_prop.value[i]);
+ // for (i = 0; i < char_prop.val_len; i++)
+ // BT_INFO("Data[%d] = [0x%x]", i, char_prop.value[i]);
_bt_gatt_client_event_cb(BLUETOOTH_EVENT_GATT_READ_CHAR,
result, &char_prop,
event_info->cb, event_info->user_data);
} else if (strcasecmp(signal_name, BT_GATT_CLIENT_WRITE_CHAR) == 0) { /* Done */
/* Event: BLUETOOTH_EVENT_GATT_WRITE_CHAR */
- BT_INFO("GATT Client event[BT_GATT_CLIENT_WRITE_CHAR]");
+ BT_DBG("GATT Client event[BT_GATT_CLIENT_WRITE_CHAR]");
bt_gatt_char_property_t char_prop;
const char *address = NULL;
GVariant *svc_uuid_var = NULL;
event_info->cb, event_info->user_data);
} else if (strcasecmp(signal_name, BT_GATT_CLIENT_READ_DESC) == 0) { /* Done */
/* Event: BLUETOOTH_EVENT_GATT_READ_DESC */
- BT_INFO("GATT Client event[BT_GATT_CLIENT_READ_DESC]");
+ BT_DBG("GATT Client event[BT_GATT_CLIENT_READ_DESC]");
bt_gatt_char_descriptor_property_t desc_prop;
const char *address = NULL;
GVariant *data_var = NULL;
event_info->cb, event_info->user_data);
} else if (strcasecmp(signal_name, BT_GATT_CLIENT_WRITE_DESC) == 0) { /* Done */
/* Event: BLUETOOTH_EVENT_GATT_WRITE_DESC */
- BT_INFO("GATT Client event[BT_GATT_CLIENT_WRITE_DESC]");
+ BT_DBG("GATT Client event[BT_GATT_CLIENT_WRITE_DESC]");
bt_gatt_char_descriptor_property_t desc_prop;
const char *address = NULL;
GVariant *svc_uuid_var = NULL;
event_info->cb, event_info->user_data);
}
- BT_DBG("GATT Client event handler Exit <<");
}
#endif
{
bt_gatt_characteristic_notify_info_t *chr_info = (bt_gatt_characteristic_notify_info_t *)data;
- BT_INFO(" FD io NOTIFICATION recived\n");
-
if (!chr_info) {
- BT_ERR("char INFO nort recieved");
+ BT_ERR("chr_info is invalid");
return FALSE;
}
if (cond & G_IO_IN) {
}
if (len > 0 && len < chr_info->mtu) {
-
bt_gatt_char_property_t char_val;
- BT_INFO("FD io sending value changed %x %x %x %x %x %x %x %zd \n", buffer[0], buffer[1], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7], len);
-
+// BT_DBG("FD io sending value changed %x %x %x %x %x %x %x %zd \n", buffer[0], buffer[1], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7], len);
memcpy(char_val.prop.uuid, chr_info->UUID, 16);
memcpy(char_val.value, buffer, len);
memcpy(char_val.address, chr_info->address, 18);
event_info = _bt_event_get_cb_data(BT_GATT_CLIENT_EVENT);
-
if (event_info) {
-
_bt_common_event_cb(BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED,
BLUETOOTH_ERROR_NONE, &char_val,
- event_info->cb, event_info->user_data);
+ event_info->cb, event_info->user_data);
} else {
- BT_ERR("eventinfo failed");
+ BT_ERR("event_info failed");
}
} else
BT_ERR("Packet corrupted");
+
g_free(buffer);
return TRUE;
}
+
if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) {
BT_ERR("Error : GIOCondition %d, [%s]", cond, chr_info->UUID);
g_io_channel_shutdown(gio, TRUE, NULL);
bluetooth_gatt_client_char_prop_info_t param;
bt_gatt_characteristic_notify_info_t *chr_info;
- BT_DBG("+");
-
BT_CHECK_PARAMETER(address, return);
BT_CHECK_PARAMETER(service_handle, return);
BT_CHECK_PARAMETER(char_handle, return);
#endif
GUnixFDList *out_fd_list = NULL;
+ char *svc_name = NULL;
+ char str_uuid[37];
+
+ _bt_convert_uuid_type_to_string(str_uuid, param.svc.uuid);
+ bluetooth_get_uuid_name(str_uuid, &svc_name);
+
+ _bt_convert_uuid_type_to_string(str_uuid, param.characteristic.uuid);
+
+ BT_INFO_C("### Request subscription Notify : %s [%s]", str_uuid, svc_name);
+ g_free(svc_name);
result = _bt_send_request_with_unix_fd_list(BT_BLUEZ_SERVICE, BT_GATT_WATCH_CHARACTERISTIC,
in_param1, in_param2, in_param3, in_param4, NULL, &out_param, &out_fd_list);
- BT_DBG("result: %x", result);
-
if (result != BLUETOOTH_ERROR_NONE) {
- BT_ERR("Fail to send request");
+ BT_ERR("Fail to get Nofify FD. result %d", result);
BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
return result;
}
fd = fd_list_array[0];
mtu = g_array_index(out_param, int, 0);
+ BT_INFO("Acquired characteristic Notify FD %d, mtu %d", fd, mtu);
chr_info = bluetooth_gatt_client_create_watch_io(fd, char_handle->instance_id, mtu, (char *)address, char_handle->uuid);
gatt_characteristic_notify_list = g_slist_append(gatt_characteristic_notify_list, chr_info);
BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
- BT_INFO("Result [%d]", result);
return result;
}
int result = BLUETOOTH_ERROR_NONE;
bt_user_info_t *user_info;
bluetooth_gatt_client_char_prop_info_t param;
- BT_DBG("+");
BT_CHECK_PARAMETER(address, return);
BT_CHECK_PARAMETER(service_handle, return);
g_array_append_vals(in_param1, ¶m,
sizeof(bluetooth_gatt_client_char_prop_info_t));
-
result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_GATT_READ_CHARACTERISTIC,
in_param1, in_param2, in_param3, in_param4,
user_info->cb, user_info->user_data);
-
- BT_INFO("result = [%d]", result);
BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
return result;
}
int result = BLUETOOTH_ERROR_NONE;
bt_user_info_t *user_info;
bluetooth_gatt_client_desc_prop_info_t param;
- BT_DBG("+");
BT_CHECK_PARAMETER(address, return);
BT_CHECK_PARAMETER(service_handle, return);
g_array_append_vals(in_param1, ¶m,
sizeof(bluetooth_gatt_client_desc_prop_info_t));
-
result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_GATT_READ_DESCRIPTOR_VALUE,
in_param1, in_param2, in_param3, in_param4,
user_info->cb, user_info->user_data);
- BT_INFO("result = [%d]", result);
BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
return result;
}
{
GSList *l;
char str[37];
- _bt_convert_uuid_type_to_string(str, handle);
- BT_INFO("request found UUID [%s], sid [ %d]", str, id);
+
for (l = gatt_characteristic_write_list; l != NULL; l = l->next) {
bt_gatt_characteristic_write_info_t *info = l->data;
- _bt_convert_uuid_type_to_string(str, info->UUID);
- BT_INFO("UUID [%s], sid [ %d]" , str, info->id);
+
if (memcmp(info->UUID, handle, 16) == 0 && info->id == id)
return info;
}
+
+ _bt_convert_uuid_type_to_string(str, handle);
+ BT_ERR("Unable to get characteristic fd. [%s] id [ %d]", str, id);
return NULL;
}
int fd, const guint8 *value, int length, int mtu,
gpointer user_data)
{
- int written;
- int att_result = BLUETOOTH_ERROR_NONE;
- BT_CHECK_PARAMETER(value, return);
- written = write(fd, value, length);
- if (written != length) {
- att_result = BLUETOOTH_ERROR_INTERNAL;
- BT_INFO("write data failed %d is ", written);
- } else
- BT_INFO("write data %s is sucess ", value);
+ int written;
+ int att_result = BLUETOOTH_ERROR_NONE;
+ BT_CHECK_PARAMETER(value, return);
+ written = write(fd, value, length);
+ if (written != length) {
+ att_result = BLUETOOTH_ERROR_INTERNAL;
+ BT_ERR("write data failed. ret : %d ", written);
+ }
- return att_result;
+ return att_result;
}
static void bluetooth_gatt_client_create_write_io_channel(int fd, unsigned char * uuid, int id, int mtu)
int result = BLUETOOTH_ERROR_NONE;
bt_user_info_t *user_info;
bluetooth_gatt_client_char_prop_info_t param;
- BT_DBG("+");
BT_CHECK_PARAMETER(address, return);
BT_CHECK_PARAMETER(service_handle, return);
result = _bt_send_request_with_unix_fd_list(BT_BLUEZ_SERVICE, BT_GATT_ACQUIRE_WRITE,
in_param1, in_param2, in_param3, in_param4, NULL, &out_param, &out_fd_list);
- BT_DBG("result: %x", result);
mtu = g_array_index(out_param, int, 0);
if (result != BLUETOOTH_ERROR_NONE) {
- BT_ERR("Fail to send request");
+ BT_ERR("Fail to get Write FD. result %d", result);
BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
return result;
} else if (NULL == out_fd_list) {
g_free(fd_list_array);
g_object_unref(out_fd_list);
}
- BT_INFO("Acquired characteristic fd %d --------------- mtu %d, ", fd, mtu);
+ BT_INFO("Acquired characteristic Write FD %d, mtu %d", fd, mtu);
if (fd > -1) {
result = bluetooth_gatt_client_write_characteristics_value_to_fd(fd, data->data, data->length, mtu, NULL);
} else {
- BT_INFO(" characteristic info FD is invalid\n");
+ BT_ERR("characteristic info FD is invalid");
goto done;
}
} else {
- BT_INFO("Acquired characteristic fd %d --------------- mtu %d, ", fd, mtu);
result = bluetooth_gatt_client_write_characteristics_value_to_fd(fd, data->data, data->length, mtu, NULL);
}
int result = BLUETOOTH_ERROR_NONE;
bt_user_info_t *user_info;
bluetooth_gatt_client_desc_prop_info_t param;
- BT_DBG("+");
BT_CHECK_PARAMETER(address, return);
BT_CHECK_PARAMETER(service_handle, return);
in_param1, in_param2, in_param3, in_param4, &out_param);
if (result != BLUETOOTH_ERROR_NONE)
- BT_INFO("GATT Client Unregistration failed result [%d]", result);
+ BT_ERR("GATT Client Unregistration failed result [%d]", result);
else
BT_INFO("GATT Client Unregistration successful");
{
gboolean flight_mode_status;
- BT_DBG("");
-
flight_mode_status = _bt_core_is_flight_mode_enabled();
if (flight_mode_status == FALSE && _bt_is_flightmode_request() == TRUE) {
g_variant_get(param->parameters, "(&o@a{sa{sv}})", &obj_path, &value);
if (obj_path == NULL) {
- DBG("obj_path is NULL");
+ ERR("obj_path is NULL");
return FALSE;
}
/* TODO: Handle Name Owener changed Signal */
if (__bt_hal_get_owner_info(param->parameters, &name, &previous, ¤t)) {
- DBG("Fail to get the owner info");
+ ERR("Fail to get the owner info");
return FALSE;
}
struct hal_ev_adapter_state_changed ev;
struct hal_ev_le_state_changed le_ev;
- DBG("Bluetoothd is terminated");
+ INFO("Bluetoothd is terminated");
/* Send the disable event in here */
_bt_hal_convert_device_path_to_address(path, address);
DBG("Member: [%s]", member);
- ERR_C("Connected [%s] [%s]", !addr_type ? "BREDR" : "LE", address);
+ ERR_C("### Connected [%s] [%s]", !addr_type ? "BREDR" : "LE", address);
if (!addr_type)
__bt_hal_send_device_acl_connection_state_event(BT_STATUS_SUCCESS, TRUE, address);
else
address = g_malloc0(BT_HAL_ADDRESS_STRING_SIZE);
_bt_hal_convert_device_path_to_address(path, address);
- DBG("Member: [%s]", member);
+ ERR_C("### Disconnected [%s] [%d : %s] [%s] [%s]", !addr_type ? "BREDR" : "LE",
+ disc_reason, _bt_hal_convert_disc_reason_to_string(disc_reason), address, name);
- ERR_C("DisConnected [%s] [%s]", !addr_type ? "BREDR" : "LE", address);
- DBG("Disconnected Reason [%d : %s]", disc_reason, _bt_hal_convert_disc_reason_to_string(disc_reason));
- DBG("Name: %s", name);
if (!addr_type)
__bt_hal_send_device_acl_connection_state_event(_bt_hal_convert_disc_reason_to_status(disc_reason), FALSE, address);
else
address = g_malloc0(BT_HAL_ADDRESS_STRING_SIZE);
_bt_hal_convert_device_path_to_address(path, address);
- DBG("Address: %s", address);
- DBG("Profile UUID: %s", profile_uuid);
- DBG("State: %d", state);
- if (strcmp(profile_uuid, HID_UUID) == 0) {
+ DBG("[%s] %s, state %d", address, profile_uuid, state);
+ if (strncmp(profile_uuid, HID_UUID, strlen(HID_UUID)) == 0) {
DBG("HID Host Profile state: %d", state);
if (state == BT_HAL_PROFILE_STATE_CONNECTED)
__bt_hal_send_hid_connection_state_event(TRUE, address);
g_free(address);
} else if (strcasecmp(member, "AdvReport") == 0) {
- DBG("Member: [%s]", member);
__bt_hal_handle_adv_report(msg, path);
}
}
memcpy(ev->adv_data, buffer, data_len);
size += data_len;
- DBG("Send le scan result event to HAL, size: [%zd]", size);
gatt_event_cb(HAL_EV_GATT_CLIENT_SCAN_RESULT, buf, size);
g_variant_unref(value);
}
conn_info->gatt_list_services = g_slist_append(conn_info->gatt_list_services, gattc_service);
- DBG("svc path {%s] svc uuid [%s]", object_path, uuid_str);
+ DBG("svc path [%s] svc uuid [%s]", object_path, uuid_str);
return gattc_service;
}
hal_gattc_char_t *char_info = NULL;
hal_gattc_desc_t *desc_info = NULL;
- DBG("+");
-
conn_info = __bt_find_gatt_conn_info_from_conn_id(conn_id);
if (conn_info == NULL) {
- DBG("conn_info is NULL");
+ ERR("conn_info is NULL");
return;
}
if (svc_info == NULL)
continue;
- DBG("svc path [%s]", svc_info->svc_path);
+ DBG("[%s]", svc_info->svc_path);
/* find characteristic object path */
for (k = svc_info->gatt_list_chars; k != NULL; k = g_slist_next(k)) {
if (char_info == NULL)
continue;
- DBG("char path[%s]", char_info->chr_path);
+ DBG("[%s]", char_info->chr_path);
/* descriptor */
for (m = char_info->gatt_list_descs; m != NULL; m = g_slist_next(m)) {
if (desc_info == NULL)
continue;
- DBG("desc path[%s]", desc_info->desc_path);
+ DBG("[%s]", desc_info->desc_path);
}
}
}
conn_info = __bt_find_gatt_conn_info_from_conn_id(conn_id);
if (NULL == conn_info) {
- DBG("Failed to get the conn_info");
+ ERR("Failed to get the conn_info");
return BT_STATUS_FAIL;
}
gchar* permission;
unsigned int char_permission = 0 ;
- DBG("+");
-
if (gattc_char->chr_path == NULL) {
DBG("char path is NULL");
return BT_STATUS_FAIL;
} else if (!g_strcmp0(key, "Descriptors")) {
g_variant_get(value, "ao", &char_desc_iter);
while (g_variant_iter_loop(char_desc_iter, "&o", &char_desc_handle)) {
- DBG("char descriptor handle : %s", char_desc_handle);
+ DBG("char descriptor : %s", char_desc_handle);
g_ptr_array_add(gp_desc_array, (gpointer)char_desc_handle);
}
char svc_uuid_str[BT_HAL_UUID_STRING_LEN];
int status = BT_STATUS_FAIL;
- DBG("+");
DBG("conn_id[%d]", conn_id);
conn_info = __bt_find_gatt_conn_info_from_conn_id(conn_id);
if (NULL == conn_info) {
- DBG("Failed to get the conn_info for conn_id[%d]", conn_id);
+ ERR("Failed to get the conn_info for conn_id[%d]", conn_id);
return BT_STATUS_FAIL;
}
/* find service */
gattc_service = _gattc_find_service_from_uuid(conn_info, &srvc_id->id.uuid);
if (NULL == gattc_service) {
- DBG("Failed to get the gatt service");
+ ERR("Failed to get the gatt service");
return BT_STATUS_FAIL;
}
- DBG("service path [%s]", gattc_service->svc_path);
-
_bt_hal_convert_uuid_type_to_string(svc_uuid_str, gattc_service->svc_uuid.uu);
- DBG("service uuid [%s]", svc_uuid_str);
+ INFO("%s %s", gattc_service->svc_path + 37, svc_uuid_str);
/* find characteristic object path */
for (l = gattc_service->gatt_list_chars; l != NULL; l = g_slist_next(l)) {
char char_uuid_str[BT_HAL_UUID_STRING_LEN];
int status = BT_STATUS_FAIL;
- DBG("+");
-
conn_info = __bt_find_gatt_conn_info_from_conn_id(conn_id);
if (NULL == conn_info) {
- DBG("Failed to get the conn_info for conn_id[%d]", conn_id);
+ ERR("Failed to get the conn_info for conn_id[%d]", conn_id);
return BT_STATUS_FAIL;
}
/* find service */
gattc_service = _gattc_find_service_from_uuid(conn_info, &srvc_id->id.uuid);
if (NULL == gattc_service) {
- DBG("Failed to get the gatt service");
+ ERR("Failed to get the gatt service");
return BT_STATUS_FAIL;
}
- DBG("service path [%s]", gattc_service->svc_path);
_bt_hal_convert_uuid_type_to_string(svc_uuid_str, gattc_service->svc_uuid.uu);
- DBG("service uuid [%s]", svc_uuid_str);
+ INFO("%s %s", gattc_service->svc_path + 37, svc_uuid_str);
/* find characteristics */
/* a service can have two char with same uuid */
continue;
if (!memcmp(&gattc_char->chr_uuid, &char_id->uuid, sizeof(bt_uuid_t))) {
- INFO("Found GATT char uuid");
- DBG("char path [%s]", gattc_char->chr_path);
_bt_hal_convert_uuid_type_to_string(char_uuid_str, gattc_char->chr_uuid.uu);
- DBG("char uuid [%s]", char_uuid_str);
+ INFO("%s %s", gattc_char->chr_path + 37, char_uuid_str);
/* get descriptor uuid */
for (m = gattc_char->gatt_list_descs; m != NULL; m = g_slist_next(m)) {
guint8 g_byte;
hal_gatt_resp_data_t *resp_data = user_data;
int result = BT_STATUS_SUCCESS;
- int i;
DBG("+");
while (g_variant_iter_loop(iter, "y", &g_byte))
g_byte_array_append(gp_byte_array, &g_byte, 1);
- //print the value
+/*
DBG("value is");
for (i = 0; i < gp_byte_array->len; i++)
DBG("%02x", gp_byte_array->data[i]);
+*/
//send value event
__hal_send_char_read_event(resp_data, result, gp_byte_array->data, gp_byte_array->len);
char char_uuid_str[BT_HAL_UUID_STRING_LEN];
char* char_handle = NULL;
- DBG("+");
-
/* get the connection info */
conn_info = __bt_find_gatt_conn_info_from_conn_id(conn_id);
if (NULL == conn_info) {
- DBG("Failed to get the conn_info for conn_id[%d]", conn_id);
+ ERR("Failed to get the conn_info for conn_id[%d]", conn_id);
return BT_STATUS_FAIL;
}
/* find service */
gattc_service = _gattc_find_service_from_uuid(conn_info, &srvc_id->id.uuid);
if (NULL == gattc_service) {
- DBG("Failed to get the gatt service");
+ ERR("Failed to get the gatt service");
return BT_STATUS_FAIL;
}
- DBG("service path [%s]", gattc_service->svc_path);
_bt_hal_convert_uuid_type_to_string(svc_uuid_str, gattc_service->svc_uuid.uu);
- DBG("service uuid [%s]", svc_uuid_str);
-
+ DBG("%s %s", gattc_service->svc_path + 37, svc_uuid_str);
/* find characteristic */
gattc_char = _gattc_find_char_from_uuid(gattc_service, &char_id->uuid,
HAL_GATT_CHARACTERISTIC_PROPERTY_READ);
if (NULL == gattc_char) {
- DBG("Failed to get the gatt char");
+ ERR("Failed to get the gatt char");
return BT_STATUS_FAIL;
}
- DBG("char path [%s]", gattc_char->chr_path);
_bt_hal_convert_uuid_type_to_string(char_uuid_str, gattc_char->chr_uuid.uu);
- DBG("char uuid [%s]", char_uuid_str);
+ INFO("%s %s", gattc_char->chr_path + 37, char_uuid_str);
g_conn = _bt_hal_get_system_gconn();
if (NULL == g_conn) {
/* get the connection info */
conn_info = __bt_find_gatt_conn_info_from_conn_id(conn_id);
if (NULL == conn_info) {
- DBG("Failed to get the conn_info for conn_id[%d]", conn_id);
+ ERR("Failed to get the conn_info for conn_id[%d]", conn_id);
return BT_STATUS_FAIL;
}
/* find service */
gattc_service = _gattc_find_service_from_uuid(conn_info, &srvc_id->id.uuid);
if (NULL == gattc_service) {
- DBG("Failed to get the gatt service");
+ ERR("Failed to get the gatt service");
return BT_STATUS_FAIL;
}
- DBG("service path [%s]", gattc_service->svc_path);
_bt_hal_convert_uuid_type_to_string(svc_uuid_str, gattc_service->svc_uuid.uu);
- DBG("service uuid [%s]", svc_uuid_str);
+ DBG("%s %s", gattc_service->svc_path + 37, svc_uuid_str);
/* find characteristic */
gattc_char = _gattc_find_char_from_uuid(gattc_service, &char_id->uuid, write_prop);
if (NULL == gattc_char) {
- DBG("Failed to get the gatt char");
+ ERR("Failed to get the gatt char");
return BT_STATUS_FAIL;
}
- DBG("char path [%s]", gattc_char->chr_path);
_bt_hal_convert_uuid_type_to_string(char_uuid_str, gattc_char->chr_uuid.uu);
- DBG("char uuid [%s]", char_uuid_str);
+ DBG("%s %s", gattc_char->chr_path + 37, char_uuid_str);
g_conn = _bt_hal_get_system_gconn();
if (NULL == g_conn) {
{
CHECK_BTGATT_INIT();
- DBG("+");
-
- DBG("svc isntance id:[%d]", srvc_id->id.inst_id);
-
-
hal_gattc_service_t *gattc_service = NULL;
hal_gattc_server_info_t * conn_info = NULL;
hal_gattc_char_t *gattc_char = NULL;
int ret = BT_STATUS_SUCCESS;
DBG("+");
+ DBG("svc isntance id:[%d]", srvc_id->id.inst_id);
- /* get the connection info */
+ /* get the connection info */
conn_info = __bt_find_gatt_conn_info_from_conn_id(conn_id);
if (NULL == conn_info) {
- DBG("Failed to get the conn_info for conn_id[%d]", conn_id);
+ ERR("Failed to get the conn_info for conn_id[%d]", conn_id);
return BT_STATUS_FAIL;
}
/* find service */
gattc_service = _gattc_find_service_from_uuid(conn_info, &srvc_id->id.uuid);
if (NULL == gattc_service) {
- DBG("Failed to get the gatt service");
+ ERR("Failed to get the gatt service");
return BT_STATUS_FAIL;
}
gattc_char = _gattc_find_char_from_uuid(gattc_service, &char_id->uuid, write_prop);
- if (NULL == gattc_char) {
- DBG("Failed to get the gatt char");
- return BT_STATUS_FAIL;
- }
+ if (NULL == gattc_char) {
+ ERR("Failed to get the gatt char");
+ return BT_STATUS_FAIL;
+ }
- DBG("char path [%s]", gattc_char->chr_path);
_bt_hal_convert_uuid_type_to_string(char_uuid_str, gattc_char->chr_uuid.uu);
- DBG("char uuid [%s]", char_uuid_str);
-
+ INFO("%s %s", gattc_char->chr_path + 37, char_uuid_str);
ret = __bluetooth_gatt_acquire_write_fd(gattc_char->chr_path, fd, mtu);
if (ret != BT_STATUS_SUCCESS)
return ret;
-
- ERR("Characterstics FD erite characterstics fd is %d", *fd);
-
- return ret;
+ INFO("Characterstics FD erite characterstics fd is %d", *fd);
+ return ret;
}
bt_status_t btif_get_acquire_notify_fd(int conn_id,
{
CHECK_BTGATT_INIT();
- DBG("+");
-
- DBG("svc isntance id:[%d]", srvc_id->id.inst_id);
-
-
hal_gattc_service_t *gattc_service = NULL;
hal_gattc_server_info_t * conn_info = NULL;
hal_gattc_char_t *gattc_char = NULL;
int ret = BT_STATUS_SUCCESS;
DBG("+");
+ DBG("svc isntance id:[%d]", srvc_id->id.inst_id);
- /* get the connection info */
- conn_info = __bt_find_gatt_conn_info_from_conn_id(conn_id);
- if (NULL == conn_info) {
- DBG("Failed to get the conn_info for conn_id[%d]", conn_id);
- return BT_STATUS_FAIL;
- }
+ /* get the connection info */
+ conn_info = __bt_find_gatt_conn_info_from_conn_id(conn_id);
+ if (NULL == conn_info) {
+ ERR("Failed to get the conn_info for conn_id[%d]", conn_id);
+ return BT_STATUS_FAIL;
+ }
/* find service */
gattc_service = _gattc_find_service_from_uuid(conn_info, &srvc_id->id.uuid);
if (NULL == gattc_service) {
- DBG("Failed to get the gatt service");
+ ERR("Failed to get the gatt service");
return BT_STATUS_FAIL;
}
gattc_char = _gattc_find_char_from_uuid(gattc_service, &char_id->uuid, write_prop);
- if (NULL == gattc_char) {
- DBG("Failed to get the gatt char");
- return BT_STATUS_FAIL;
- }
+ if (NULL == gattc_char) {
+ ERR("Failed to get the gatt char");
+ return BT_STATUS_FAIL;
+ }
- DBG("char path [%s]", gattc_char->chr_path);
_bt_hal_convert_uuid_type_to_string(char_uuid_str, gattc_char->chr_uuid.uu);
- DBG("char uuid [%s]", char_uuid_str);
-
+ INFO("%s %s", gattc_char->chr_path + 37, char_uuid_str);
ret = __bluetooth_gatt_acquire_notify_fd(gattc_char->chr_path, fd, mtu);
if (ret != BT_STATUS_SUCCESS)
return ret;
+ INFO("Characterstics FD write characterstics fd is %d", *fd);
- ERR("Characterstics FD write characterstics fd is %d", *fd);
-
- return ret;
-
+ return ret;
}
/* get the connection info */
conn_info = __bt_find_gatt_conn_info_from_conn_id(conn_id);
if (NULL == conn_info) {
- DBG("Failed to get the conn_info for conn_id[%d]", conn_id);
+ ERR("Failed to get the conn_info for conn_id[%d]", conn_id);
return BT_STATUS_FAIL;
}
/* find service */
gattc_service = _gattc_find_service_from_uuid(conn_info, &srvc_id->id.uuid);
if (NULL == gattc_service) {
- DBG("Failed to get the gatt service");
+ ERR("Failed to get the gatt service");
return BT_STATUS_FAIL;
}
- DBG("service path [%s]", gattc_service->svc_path);
_bt_hal_convert_uuid_type_to_string(svc_uuid_str, gattc_service->svc_uuid.uu);
- DBG("service uuid [%s]", svc_uuid_str);
+ DBG("%s %s", gattc_service->svc_path + 37, svc_uuid_str);
/* find characteristic */
/* service can have two char with same uuid */
continue;
if (!memcmp(&gattc_char->chr_uuid, &char_id->uuid, sizeof(bt_uuid_t))) {
- INFO("Found GATT char uuid");
- DBG("char path [%s]", gattc_char->chr_path);
_bt_hal_convert_uuid_type_to_string(char_uuid_str, gattc_char->chr_uuid.uu);
- DBG("char uuid [%s]", char_uuid_str);
+ DBG("%s %s", gattc_char->chr_path + 37, char_uuid_str);
/* find descriptor */
gattc_desc = _gattc_find_desc_from_uuid(gattc_char, &desc_id->uuid);
if (gattc_desc) {
- DBG("desc path [%s]", gattc_desc->desc_path);
_bt_hal_convert_uuid_type_to_string(desc_uuid_str, gattc_desc->desc_uuid.uu);
- DBG("desc uuid [%s]", desc_uuid_str);
+ DBG("%s %s", gattc_desc->desc_path + 37, desc_uuid_str);
break;
}
}
}
if (NULL == gattc_desc) {
- DBG("Failed to get the gatt desc");
+ ERR("Failed to get the gatt desc");
return BT_STATUS_FAIL;
}
ret = __hal_get_write_prop(write_type, &write_prop);
if (BT_STATUS_FAIL == ret) {
- DBG("received invalid write type:[%d] ", write_type);
+ ERR("received invalid write type:[%d] ", write_type);
return BT_STATUS_FAIL;
}
/* get the connection info */
conn_info = __bt_find_gatt_conn_info_from_conn_id(conn_id);
if (NULL == conn_info) {
- DBG("Failed to get the conn_info for conn_id[%d]", conn_id);
+ ERR("Failed to get the conn_info for conn_id[%d]", conn_id);
return BT_STATUS_FAIL;
}
/* find service */
gattc_service = _gattc_find_service_from_uuid(conn_info, &srvc_id->id.uuid);
if (NULL == gattc_service) {
- DBG("Failed to get the gatt service");
+ ERR("Failed to get the gatt service");
return BT_STATUS_FAIL;
}
- DBG("service path [%s]", gattc_service->svc_path);
_bt_hal_convert_uuid_type_to_string(svc_uuid_str, gattc_service->svc_uuid.uu);
- DBG("service uuid [%s]", svc_uuid_str);
+ DBG("%s %s", gattc_service->svc_path + 37, svc_uuid_str);
/* find characteristic */
/* service can have two char with same uuid */
continue;
if (!memcmp(&gattc_char->chr_uuid, &char_id->uuid, sizeof(bt_uuid_t))) {
- INFO("Found GATT char uuid");
- DBG("char path [%s]", gattc_char->chr_path);
_bt_hal_convert_uuid_type_to_string(char_uuid_str, gattc_char->chr_uuid.uu);
- DBG("char uuid [%s]", char_uuid_str);
+ DBG("%s %s", gattc_char->chr_path + 37, char_uuid_str);
/* find descriptor */
gattc_desc = _gattc_find_desc_from_uuid(gattc_char, &descr_id->uuid);
if (gattc_desc) {
- DBG("desc path [%s]", gattc_desc->desc_path);
_bt_hal_convert_uuid_type_to_string(desc_uuid_str, gattc_desc->desc_uuid.uu);
- DBG("desc uuid [%s]", desc_uuid_str);
+ DBG("%s %s", gattc_desc->desc_path + 37, desc_uuid_str);
break;
}
}
}
if (NULL == gattc_desc) {
- DBG("Failed to get the gatt desc");
+ ERR("Failed to get the gatt desc");
return BT_STATUS_FAIL;
}
/* find service */
gattc_service = _gattc_find_service_from_uuid(conn_info, &srvc_id->id.uuid);
if (NULL == gattc_service) {
- DBG("Failed to get the gatt service");
+ ERR("Failed to get the gatt service");
return BT_STATUS_FAIL;
}
- DBG("service path [%s]", gattc_service->svc_path);
_bt_hal_convert_uuid_type_to_string(svc_uuid_str, gattc_service->svc_uuid.uu);
- DBG("service uuid [%s]", svc_uuid_str);
+ DBG("%s %s", gattc_service->svc_path + 15, svc_uuid_str);
/* find characteristic */
gattc_char = _gattc_find_char_from_uuid_for_notify(gattc_service, &char_id->uuid);
if (NULL == gattc_char) {
- DBG("Failed to get the gatt char");
+ ERR("Failed to get the gatt char");
return BT_STATUS_FAIL;
}
- DBG("char path [%s]", gattc_char->chr_path);
_bt_hal_convert_uuid_type_to_string(char_uuid_str, gattc_char->chr_uuid.uu);
- DBG("char uuid [%s]", char_uuid_str);
+ DBG("%s %s", gattc_char->chr_path + 15, char_uuid_str);
char_handle = gattc_char->chr_path;
resp_data = g_malloc0(sizeof(hal_gatt_resp_data_t));
- DBG("#StartNotify");
+ INFO_C("### Request StartNotify : %s [%s]", gattc_char->chr_path + 15, char_uuid_str);
+
g_dbus_connection_call_sync(g_conn,
BT_HAL_BLUEZ_NAME,
char_handle,
if (error) {
g_dbus_error_strip_remote_error(error);
- ERR("### Watch Failed: %s", error->message);
+ ERR("### StartNotify Failed: %s", error->message);
if (g_strrstr(error->message, "Already notifying"))
result = BT_STATUS_SUCCESS;
else if (g_strrstr(error->message, "In Progress"))
/* find service */
gattc_service = _gattc_find_service_from_uuid(conn_info, &srvc_id->id.uuid);
if (NULL == gattc_service) {
- DBG("Failed to get the gatt service");
+ ERR("Failed to get the gatt service");
return BT_STATUS_FAIL;
}
- DBG("service path [%s]", gattc_service->svc_path);
_bt_hal_convert_uuid_type_to_string(svc_uuid_str, gattc_service->svc_uuid.uu);
- DBG("service uuid [%s]", svc_uuid_str);
+ DBG("%s %s", gattc_service->svc_path + 15, svc_uuid_str);
/* find characteristic */
gattc_char = _gattc_find_char_from_uuid_for_notify(gattc_service, &char_id->uuid);
if (NULL == gattc_char) {
- DBG("Failed to get the gatt char");
+ ERR("Failed to get the gatt char");
return BT_STATUS_FAIL;
}
- DBG("char path [%s]", gattc_char->chr_path);
_bt_hal_convert_uuid_type_to_string(char_uuid_str, gattc_char->chr_uuid.uu);
- DBG("char uuid [%s]", char_uuid_str);
+ DBG("%s %s", gattc_char->chr_path + 15, char_uuid_str);
char_handle = gattc_char->chr_path;
resp_data = g_malloc0(sizeof(hal_gatt_resp_data_t));
- DBG("#StartNotify");
+ INFO("### Request StopNotify : %s [%s]", gattc_char->chr_path + 15, char_uuid_str);
g_dbus_connection_call_sync(g_conn,
BT_HAL_BLUEZ_NAME,
char_handle,
BT_HAL_MAX_DBUS_TIMEOUT, NULL, &error);
if (error) {
- ERR("### Watch Failed: %s", error->message);
+ ERR("### StopNotify Failed: %s", error->message);
g_clear_error(&error);
result = BT_STATUS_FAIL;
}
return BT_STATUS_FAIL;
}
- INFO("### LeConnUpdate");
+ INFO("Request LeConnUpdate");
reply = g_dbus_proxy_call_sync(device_proxy, "LeConnUpdate",
g_variant_new("(uuuu)", min_int, max_int, latency, timeout),
G_DBUS_CALL_FLAGS_NONE,
}
g_variant_unref(reply);
- INFO("LE Connection parameter Updated");
+ DBG("LE Connection parameter Updated");
return ret;
}
static hal_gattc_client_info_t *__bt_find_gatt_client_info_from_conn_id(int conn_id)
{
- DBG("+");
-
GSList *l;
hal_gattc_client_info_t *info = NULL;
static hal_gattc_server_info_t *__bt_find_gatt_conn_info_from_conn_id(int conn_id)
{
- DBG("+");
-
GSList *l;
hal_gattc_server_info_t *info = NULL;
hal_gattc_client_info_t *gattc_client = NULL;
gattc_client = __bt_find_gatt_client_info_from_conn_id(conn_id);
if (gattc_client == NULL) {
- INFO("GATT client conn info not found");
+ ERR("GATT client conn info not found");
return NULL;
}
#define HFP_HF_UUID "0000111e-0000-1000-8000-00805f9b34fb"
#define HFP_AG_UUID "0000111f-0000-1000-8000-00805f9b34fb"
+/**
+ * Device disconnection reasons; received from stack
+ */
+#define BLUETOOTH_ERROR_PAGE_TIMEOUT 0x04
+#define BLUETOOTH_ERROR_AUTH_FAILURE 0x05
+#define BLUETOOTH_ERROR_PIN_OR_KEY_MISSING 0x06
+#define BLUETOOTH_ERROR_CONNECTION_TIMEOUT 0x08
+#define BLUETOOTH_ERROR_CONNECTION_REJECTED_DUE_TO_SECURITY_REASONS 0x0e
+#define BLUETOOTH_ERROR_REMOTE_USER_TERM 0x13
+#define BLUETOOTH_ERROR_REMOTE_LOW_RESOURCES 0x14
+#define BLUETOOTH_ERROR_REMOTE_POWER_OFF 0x15
+#define BLUETOOTH_ERROR_LOCAL_HOST_TERM 0x16
+#define BLUETOOTH_ERROR_REPEATED_ATTEMPTS 0x17
+#define BLUETOOTH_ERROR_LMP_RESPONSE_TIMEOUT 0x22
+#define BLUETOOTH_ERROR_LMP_TRANSACTION_COLLISION 0x23
+#define BLUETOOTH_ERROR_INSTANT_PASSED 0x28
+#define BLUETOOTH_ERROR_INSUFFICIENT_SECURITY 0x2f
+#define BLUETOOTH_ERROR_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE 0x3d
+#define BLUETOOTH_ERROR_CONNECTION_FAILED_TO_BE_ESTABLISHED 0x3e
+
/* TODO More declarations to be added in subsequent patches */
#ifdef __cplusplus
}
};
}
+const char *_bt_convert_uuid_to_string(const char *uuid)
+{
+#define SHORT_UUID_COUNT 199
+#define LONG_UUID_COUNT 17
+
+ if (!uuid)
+ return NULL;
+
+ int offset = 0;
+ int uuid_len = 4;
+ typedef struct {
+ const char *uuid;
+ const char *specification_name;
+ } uuid_name_s;
+ static uuid_name_s short_uuid_name[SHORT_UUID_COUNT] = {
+ // List should be sorted by UUID
+ /* BT Classic Services */
+ {"1101", "Serial Port Service"},
+ {"1102", "LAN Access Using PPP Service"},
+ {"1103", "Dialup Networking Service"},
+ {"1104", "IrMCSync Service"},
+ {"1105", "OBEX Object Push Service"},
+ {"1106", "OBEX File Transfer Service"},
+ {"1107", "IrMC Sync Command Service"},
+ {"1108", "Headset Service"},
+ {"1109", "Cordless Telephony Service"},
+ {"110A", "Audio Source Service"},
+ {"110B", "Audio Sink Service"},
+ {"110C", "AV Remote Control Target Service"},
+ {"110D", "Advanced Audio Distribution Profile"},
+ {"110E", "AV Remote Control Service"},
+ {"110F", "Video Conferencing Service"},
+ {"1110", "Intercom Service"},
+ {"1111", "Fax Service"},
+ {"1112", "Headset Audio Gateway Service"},
+ {"1113", "WAP Service"},
+ {"1114", "WAP Client Service"},
+ {"1115", "PANU Service"},
+ {"1116", "NAP Service"},
+ {"1117", "GN Service"},
+ {"1118", "Direct Printing Service"},
+ {"1119", "Reference Printing Service"},
+ {"111A", "Basic Imaging Profile"},
+ {"111B", "Imaging Responder Service"},
+ {"111C", "Imaging Automatic Archive Service"},
+ {"111D", "Imaging Reference Objects Service"},
+ {"111E", "Handsfree Service"},
+ {"111F", "Handsfree Audio Gateway Service"},
+ {"1120", "Direct Printing Reference Objects Service"},
+ {"1121", "Reflected UI Service"},
+ {"1122", "Basic Printing Profile"},
+ {"1123", "Printing Status Service"},
+ {"1124", "Human Interface Device Service"},
+ {"1125", "Hardcopy Cable Replacement Profile"},
+ {"1126", "HCR Print Service"},
+ {"1127", "HCR Scan Service"},
+ {"112D", "SIM Access Service"},
+ {"112E", "Phonebook Access PCE Service"},
+ {"112F", "Phonebook Access PSE Service"},
+ {"1130", "Phonebook Access Profile"},
+ {"1132", "Message Access Server Service"},
+ {"1133", "Message Notification Server Service"},
+ {"1134", "Message Access Profile"},
+ {"1200", "PnP Information Service"},
+ {"1201", "Generic Networking Service"},
+ {"1202", "Generic File Transfer Service"},
+ {"1203", "Generic Audio Service"},
+ {"1204", "Generic Telephony Service"},
+ {"1205", "UPnP Service"},
+ {"1206", "UPnP Ip Service"},
+ {"1303", "Video Source Service"},
+ {"1304", "Video Sink Service"},
+ {"1305", "Video Distribution Profile"},
+ {"1400", "Health Device Profile"},
+ {"1401", "HDP Source Service"},
+ {"1402", "HDP Sink Service"},
+
+ /* GATT Services */
+ {"1800", "Generic Access"},
+ {"1801", "Generic Attribute"},
+ {"1802", "Immediate Alert"},
+ {"1803", "Link Loss"},
+ {"1804", "Tx Power"},
+ {"1805", "Current Time Service"},
+ {"1806", "Reference Time Update Service"},
+ {"1807", "Next DST Change Service"},
+ {"1808", "Glucose"},
+ {"1809", "Health Thermometer"},
+ {"180A", "Device Information"},
+ {"180D", "Heart Rate"},
+ {"180F", "Battery Service"},
+ {"1810", "Blood Pressure"},
+ {"1811", "Alert Notification Service"},
+ {"1812", "Human Interface Device"},
+ {"1813", "Scan Parameters"},
+ {"1814", "Running Speed and Cadence"},
+ {"1815", "Automation IO"},
+ {"1816", "Cycling Speed and Cadence"},
+ {"1818", "Cycling Power"},
+ {"1819", "Location and Navigation"},
+ {"181A", "Environmental Sensing"},
+ {"181B", "Body Composition"},
+ {"181C", "User Data"},
+ {"181D", "Weight Scale"},
+ {"181E", "Bond Management"},
+ {"181F", "Continuous Glucose Monitoring"},
+ {"1820", "Internet Protocol Support Service"},
+ {"1821", "Indoor Positioning"},
+ {"1822", "Pulse Oximeter Service"},
+ {"1823", "HTTP Proxy"},
+ {"1824", "Transport Discovery"},
+ {"1825", "Object Transfer Service"},
+ {"1826", "Fitness Machine"},
+ {"1827", "Mesh Provisioning Service"},
+ {"1828", "Mesh Proxy Service"},
+ {"1829", "Reconnection Configuration"},
+ {"183A", "Insulin Delivery"},
+
+ /* GATT Declarations */
+ {"2800", "Primary Service Declaration"},
+ {"2801", "Secondary Service Declaration"},
+ {"2802", "Include Declaration"},
+ {"2803", "Characteristic Declaration"},
+
+ /* GATT Descriptors */
+ {"2900", "Characteristic Extended Properties"},
+ {"2901", "Characteristic User Description"},
+ {"2902", "Client Characteristic Configuration"},
+ {"2903", "Server Characteristic Configuration"},
+ {"2904", "Characteristic Format"},
+ {"2905", "Characteristic Aggregate Formate"},
+ {"2906", "Valid Range"},
+ {"2907", "External Report Reference"},
+ {"2908", "Report Reference"},
+
+ /* GATT Characteristics */
+ {"2A00", "Device Name"},
+ {"2A01", "Appearance"},
+ {"2A02", "Peripheral Privacy Flag"},
+ {"2A03", "Reconnection Address"},
+ {"2A04", "Peripheral Preferred Connection Parameters"},
+ {"2A05", "Service Changed"},
+ {"2A06", "Alert Level"},
+ {"2A07", "Tx Power Level"},
+ {"2A08", "Date Time"},
+ {"2A09", "Day of Week"},
+ {"2A0A", "Day Date Time"},
+ {"2A11", "Time with DST"},
+ {"2A12", "Time Accuracy"},
+ {"2A13", "Time Source"},
+ {"2A14", "Reference Time Information"},
+ {"2A16", "Time Update Control Point"},
+ {"2A17", "Time Update State"},
+ {"2A18", "Glucose Measurement"},
+ {"2A19", "Battery Level"},
+ {"2A1C", "Temperature Measurement"},
+ {"2A1D", "Temperature Type"},
+ {"2A1E", "Intermediate Temperature"},
+ {"2A21", "Measurement Interval"},
+ {"2A23", "System ID"},
+ {"2A24", "Model Number String"},
+ {"2A25", "Serial Number String"},
+ {"2A26", "Firmware Revision String"},
+ {"2A27", "Hardware Revision String"},
+ {"2A28", "Software Revision String"},
+ {"2A29", "Manufacturer Name String"},
+ {"2A2A", "IEEE 11073-20601 Regulatory Certification Data List"},
+ {"2A2B", "Current Time"},
+ {"2A34", "Glucose Measurement Context"},
+ {"2A35", "Blood Pressure Measurement"},
+ {"2A37", "Heart Rate Measurement"},
+ {"2A38", "Body Sensor Location"},
+ {"2A39", "Heart Rate Control Point"},
+ {"2A3F", "Alert Status"},
+ {"2A46", "New Alert"},
+ {"2A49", "Blood Pressure Feature"},
+ {"2A4A", "HID Information"},
+ {"2A4C", "HID Control Point"},
+ {"2A50", "PnP ID"},
+ {"2A51", "Glucose Feature"},
+ {"2A52", "Record Access Control Point"},
+ {"2A53", "RSC Measurement"},
+ {"2A54", "RSC Feature"},
+ {"2A55", "SC Control Point"},
+ {"2A56", "Digital"},
+ {"2A58", "Analog"},
+ {"2A5A", "Aggregate"},
+ {"2A5B", "CSC Measurement"},
+ {"2A5C", "CSC Feature"},
+ {"2A5D", "Sensor Location"},
+ {"2A63", "Cycling Power Measurement"},
+ {"2A64", "Cycling Power Vector"},
+ {"2A65", "Cycling Power Feature"},
+ {"2A66", "Cycling Power Control Point"},
+ {"2A67", "Location and Speed"},
+ {"2A68", "Navigation"},
+ {"2A6D", "Pressure"},
+ {"2A6E", "Temperature"},
+ {"2A8E", "Height"},
+ {"2A90", "Last Name"},
+ {"2A91", "Maximum Recommended Heart Rate"},
+ {"2A92", "Resting Heart Rate"},
+ {"2A98", "Weight"},
+ {"2A9B", "Body Composition Feature"},
+ {"2A9C", "Body Composition Measurement"},
+ {"2A9D", "Weight Measurement"},
+ {"2AA2", "Language"},
+ {"2AA4", "Bond Management Control Point"},
+ {"2AA5", "Bond Management Features"},
+ {"2AA6", "Central Address Resolution"},
+ {"2AAD", "Indoor Positioning Configuration"},
+ {"2AB5", "Location Name"},
+ {"2AB6", "URI"},
+ {"2ABC", "TDS Control Point"},
+ {"2AC9", "Resolvable Private Address Only"},
+ {"2ACC", "Fitness Machine Feature"},
+ {"2ACE", "Cross Trainer Data"},
+ {"2AD3", "Training Status"},
+ {"2AD7", "Supported Heart Rate Range"},
+ {"2AD9", "Fitness Machine Control Point"},
+ {"2ADA", "Fitness Machine Status"},
+ {"2B1D", "RC Feature"},
+ {"2B1E", "RC Settings"},
+ {"2B1F", "Reconnection Configuration Control Point"},
+ };
+ static uuid_name_s long_uuid_name[LONG_UUID_COUNT] = {
+ // List should be sorted by UUID
+ /* Custom uuids */
+ {"1AB7C24D-185A-45B9-90D4-F7AB1A71949A", "Samsung Health Service"},
+ {"22EAC6E9-24D6-4BB5-BE44-B36ACE7C7BFB", "Data Source"},
+ {"2F7CABCE-808D-411F-9A0C-BB92BA96C102", "Entity Update"},
+ {"32D1955A-E5AA-4A96-9A49-08538DA8B8F6", "Samsung Gear Fit Manager Service"},
+ {"69D1D8F3-45E1-49A8-9821-9BBDFDAAD9D9", "Control Point"},
+ {"7905F431-B5CE-4E99-A40F-4B1E122D00D0", "Apple Notification Center Service"},
+ {"89D3502B-0F36-433A-8EF4-C502AD55F8DC", "Apple Media Service"},
+ {"9A3F68E0-86CE-11E5-A309-0002A5D5C51B", "Samsung Gear Manager Service"},
+ {"9B3C81D8-57B1-4A8A-B8DF-0E56F7CA51C2", "Remote Command"},
+ {"9FBF120D-6301-42D9-8C58-25E699A21DBD", "Notifications Source"},
+ {"A49EB41E-CB06-495C-9F4F-BB80A90CDF00", "Samsung Gear Manager Service"},
+ {"ADE3D529-C784-4F63-A987-EB69F70EE816", "IoT OIC Service"},
+ {"C2051EE0-804D-4D50-A12C-15E243852100", "Notifications Source"},
+ {"C2F2CC0F-C085-4DD4-BE5A-ACA3074BBC72", "Control Point"},
+ {"C6B2F38C-23AB-46D8-A6AB-A3A870BBD5D7", "Entity Attribute"},
+ {"CECE518B-28D7-4171-92D5-76A1E249A3B9", "Notifications Source"},
+ {"FE53FF98-B259-4337-B56A-0EC9F82C6BAD", "Control Point"},
+ };
+ const uuid_name_s *uuid_name = short_uuid_name;
+ static const char *unknown_name = "Unknown";
+ int start = 0;
+ int end = SHORT_UUID_COUNT - 1;
+ int p;
+ int ret;
+
+ if (strlen(uuid) == 36) {
+ if (!g_ascii_strncasecmp(uuid + 9, "0000-1000-8000-00805F9B34FB", 27))
+ offset = 4;
+ else {
+ offset = 0;
+ uuid_len = 36;
+ end = LONG_UUID_COUNT - 1;
+ uuid_name = long_uuid_name;
+ }
+ } else if (strlen(uuid) >= 8)
+ offset = 4;
+
+ while (start <= end) {
+ p = start + (end - start) / 2;
+ ret = g_ascii_strncasecmp(uuid + offset, uuid_name[p].uuid, uuid_len);
+ if (ret == 0)
+ return uuid_name[p].specification_name;
+ else if (ret < 0)
+ end = p - 1;
+ else
+ start = p + 1;
+ }
+
+ return unknown_name;
+}
+
const char *_bt_convert_error_to_string(int error)
{
switch (error) {
service_uuid_t uuid;
struct gatt_server_info_t *conn_info = NULL;
- int count = 0;
+ int count = 1;
char uuid_string[BLUETOOTH_UUID_STRING_MAX];
- BT_INFO("+");
conn_info = __bt_find_remote_gatt_server_info_from_conn_id(conn_id);
return;
info->count = g_slist_length(svc_info_list->services);
- BT_INFO("Total services present in the svc info list for this conn id [%d] is [%d]",
+ BT_DBG("Total services present in the svc info list for this conn id [%d] is [%d]",
conn_id, info->count);
for (l = svc_info_list->services; l != NULL; l = g_slist_next(l)) {
memcpy(&uuid.uuid, &svc_info->uuid, BLUETOOTH_UUID_HEX_MAX_LEN);
_bt_uuid_to_string(&uuid, uuid_string);
- BT_INFO("Service UUID formed [%s] strlen [%zd]", uuid_string, strlen(uuid_string));
+ BT_INFO("[%d] %s [%s]", count, uuid_string, _bt_convert_uuid_to_string(uuid_string));
/* Fill UUID of service */
g_strlcpy(info->uuids[count], uuid_string,
BLUETOOTH_UUID_STRING_MAX);
- BT_INFO("Service UUID formed TO be sent [%s] strlen [%zd]",
- info->uuids[count], strlen(info->uuids[count]));
/* Fill instance ID of service */
info->inst_id[count] = svc_info->inst_id;
/* Increment count of services browsed */
count++;
}
-
- BT_INFO("Total services browsed [%d]", count);
}
static void __bt_build_char_browse_info(int conn_id,
bt_gatt_descriptor_info_t *desc = NULL;
bt_gatt_included_service_info_t *incl_svc = NULL;
- BT_INFO("Start Cleanup of all services");
-
svc_info_list = __bt_get_service_info_list(conn_info->connection_id);
if (!svc_info_list) {
BT_INFO("Could not find Svc Info list for the connection ID [%d]",
return;
}
- BT_INFO("Num Services [%d]", g_slist_length(svc_info_list->services));
+ BT_INFO("Start Cleanup of all services. Num Services [%d]", g_slist_length(svc_info_list->services));
for (l = svc_info_list->services; l;) {
svc = (bt_gatt_service_info_t*)l->data;
l = g_slist_next(l);
if (svc == NULL)
continue;
- BT_INFO("Service info Is Prim[%d] Inst ID [%d]",
+ BT_DBG("Service info Is Prim[%d] Inst ID [%d]",
svc->is_primary, svc->inst_id);
- BT_INFO("Num chars [%d]", g_slist_length(svc->chars));
/* Delete all chars and its descriptors */
for (ll = svc->chars; ll;) {
chr = (bt_gatt_char_info_t*)ll->data;
if (chr == NULL)
continue;
- BT_INFO("Num descs [%d]", g_slist_length(chr->descs));
for (lll = chr->descs; lll;) {
desc = (bt_gatt_descriptor_info_t *)lll->data;
lll = g_slist_next(lll);
g_free(chr);
}
- BT_INFO("Num incl svcs [%d]", g_slist_length(svc->included_svcs));
/* Delete all included services */
for (llll = svc->included_svcs; llll;) {
incl_svc = (bt_gatt_included_service_info_t*)llll->data;
list_gatt_info = g_slist_remove(list_gatt_info, svc_info_list);
g_free(svc_info_list);
- BT_INFO("Cleanup of all services done");
}
int _bt_register_gatt_client_instance(const char *sender,
static void __bt_handle_client_service_search_result(
event_gattc_service_result_t *event_data)
{
- BT_INFO("+");
BT_INFO("received the gatt service search result");
/* Pre: status is never fail from OAL */
char *read_val = NULL;
char *svc_uuid = NULL;
char *char_uuid = NULL;
- int i;
int uuid_len = 16;
- BT_INFO("+");
-
//memset(&read_info, 0x00, sizeof(bt_gatt_handle_property_t));
memset(&read_info, 0x00, sizeof(bluetooth_gatt_client_char_prop_info_t));
if (event_data->uuid_status.conn_status.status != OAL_STATUS_SUCCESS)
result = BLUETOOTH_ERROR_INTERNAL;
else {
- BT_ERR("read data len is [%d]", event_data->data_len);
if (event_data->data_len > 0) {
/* DEBUG */
- for (i = 0; i < event_data->data_len; i++)
- BT_INFO("Data[%d] = [0x%x]", i, event_data->data[i]);
+ // for (i = 0; i < event_data->data_len; i++)
+ // BT_INFO("Data[%d] = [0x%x]", i, event_data->data[i]);
/* Read data */
read_val = g_memdup(&event_data->data[0], event_data->data_len);
char *_bt_get_profile_uuid128(bt_profile_type_t profile_type);
+const char *_bt_convert_uuid_to_string(const char *uuid);
+
const char *_bt_convert_error_to_string(int error);
const char * _bt_convert_disc_reason_to_string(int reason);
_bt_convert_device_path_to_address(path, address);
- /* 0x00 BDADDR_BRDER
- 0x01 BDADDR_LE_PUBLIC
- 0x02 BDADDR_LE_RANDOM */
- _bt_convert_addr_string_to_secure_string(secure_address, address);
- BT_INFO("Address : %s Type : %d", secure_address, addr_type);
- BT_ERR_C("### Disconnected [%s] [%d : %s] [%s]", !addr_type ? "BREDR" : "LE",
- disc_reason, _bt_convert_disc_reason_to_string(disc_reason),
- !addr_type ? dev_name : secure_address);
- g_free(dev_name);
-
if (!addr_type) {
/*Check for any OPP transfer on the device and cancel
* the transfer
/* TODO: MAP? see above */
}
g_free(address);
+ g_free(dev_name);
} else if (strcasecmp(member, "ProfileStateChanged") == 0) {
int state = 0;
char *profile_uuid = NULL;
_bt_convert_addr_string_to_type(bd_addr.addr, address);
_bt_convert_addr_string_to_secure_string(secure_address, address);
- BT_DBG("Address: %s", secure_address);
- BT_DBG("Profile UUID: %s", profile_uuid);
- BT_DBG("State: %d", state);
+ BT_DBG("[%s] [%s] [%d]", secure_address, profile_uuid, state);
g_free(address);
}
}
BT_ERR("Fail to get the path");
return;
}
- BT_INFO("object_path = [%s]", obj_path);
/*Handle OPP_SERVER_CONNECTED_EVENT here */
/* TODO: MAP? see above */
BT_ERR("Fail to get the path");
return;
}
- BT_INFO("object_path = [%s]", obj_path);
if (strncmp(obj_path, BT_SESSION_BASEPATH_CLIENT,
strlen(BT_SESSION_BASEPATH_CLIENT)) == 0) {