if (result != BLUETOOTH_ERROR_NONE) {
BT_ERR("Fail to send request");
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
return result;
} else if (NULL == out_fd_list) {
BT_ERR("out_fd_list is NULL");
+ result = BLUETOOTH_ERROR_INTERNAL;
} else {
int *fd_list_array;
int len = 0;
int mtu;
- int fd = -1;;
-
- if (!out_fd_list)
- return BLUETOOTH_ERROR_INTERNAL;
+ int fd = -1;
fd_list_array = g_unix_fd_list_steal_fds(out_fd_list, &len);
BT_INFO("Num fds in fd_list is : %d, fd_list[0]: %d", len, fd_list_array[0]);
_bt_hal_convert_addr_string_to_type(bd_addr.address, device_address);
conn_info = __bt_find_gatt_conn_info(&bd_addr);
- //find service for notified char path
- for (l = conn_info->gatt_list_services; l != NULL; l = g_slist_next(l)) {
- svc_info = (hal_gattc_service_t*)l->data;
- if (svc_info == NULL)
- continue;
-
- /* find characteristic object path */
- for (k = svc_info->gatt_list_chars; k != NULL; k = g_slist_next(k)) {
- char_info = (hal_gattc_char_t *)k->data;
- if (char_info == NULL)
+ if (conn_info != NULL) {
+ //find service for notified char path
+ for (l = conn_info->gatt_list_services; l != NULL; l = g_slist_next(l)) {
+ svc_info = (hal_gattc_service_t*)l->data;
+ if (svc_info == NULL)
continue;
- if (g_strcmp0(char_info->chr_path, char_handle) == 0) {
- DBG("Found char handle[%s]", char_info->chr_path);
+ /* find characteristic object path */
+ for (k = svc_info->gatt_list_chars; k != NULL; k = g_slist_next(k)) {
+ char_info = (hal_gattc_char_t *)k->data;
+ if (char_info == NULL)
+ continue;
+
+ if (g_strcmp0(char_info->chr_path, char_handle) == 0) {
+ DBG("Found char handle[%s]", char_info->chr_path);
- //send event
- _bt_hal_send_value_changed_event(conn_info, svc_info,
- char_info, char_value, len);
- return;
+ //send event
+ _bt_hal_send_value_changed_event(conn_info, svc_info,
+ char_info, char_value, len);
+ return;
+ }
}
}
}
/* Add socket fd to unix_fd_list */
fd_list = g_unix_fd_list_new();
g_unix_fd_list_append(fd_list, fd, &error);
+ g_assert_no_error(error);
_bt_service_method_return_with_unix_fd_list(
context, *out_param1, result, fd_list);