int link_type;
gboolean rssi_enabled = FALSE;
- g_variant_get(parameters, "(isib)", &result, &address,
+ g_variant_get(parameters, "(i&sib)", &result, &address,
&link_type, &rssi_enabled);
BT_DBG("RSSI Enabled[Address:%s LinkType:%d RSSI_dbm:%d]",
int link_type;
bt_rssi_alert_t alert = { 0, };
- g_variant_get(parameters, "(isiii)", &result, &address,
+ g_variant_get(parameters, "(i&siii)", &result, &address,
&link_type, &alert_type, &rssi_dbm);
alert.alert_type = alert_type;
char *address;
bt_raw_rssi_t raw_rssi = { 0, };
- g_variant_get(parameters, "(isii)", &result,
+ g_variant_get(parameters, "(i&sii)", &result,
&address, &link_type, &rssi_dbm);
BT_DBG("Address [%s] Link Type[%d] dBm[%d]",
BT_DBG("BT_PXP_PROPERTY_CHANGED");
- g_variant_get(parameters, "(isiii)", &result, &address, &role, &type, &level);
+ g_variant_get(parameters, "(i&siii)", &result, &address, &role, &type, &level);
_bt_convert_addr_string_to_type(dev_address.addr, address);
memcpy(¶ms.device_address, &dev_address, BLUETOOTH_ADDRESS_LENGTH);
GVariant* value = NULL;
while (g_variant_iter_loop(res, "{sv}", &key, &value)) {
char* string_value = NULL;
- g_variant_get(value, "s", &string_value);
+ g_variant_get(value, "&s", &string_value);
BT_DBG("got folder name: %s", string_value);
folders_struct.names[i] = strdup(string_value);
}
void bluetooth_gatt_server_send_acquire_notify_response(GVariant * parameters, bt_event_info_t *event_info)
{
- int con_id = -1;
- int tran_id = -1;
- int att_han = -1;
- int pipefd[2] = {-1,};
- int mtu = -1;
- int offset = -1;
- char err_msg[512] = {'\0'};
- GIOChannel *channel = NULL;
- int result = -1;
- int fd = -1;
- bluetooth_gatt_acquire_notify_info_t *chr_info;
- const char *address = NULL;
-
- g_variant_get(parameters, "(iiiiiis)",
- &result,
- &con_id,
- &tran_id,
- &att_han,
- &mtu,
- &offset,
- &address);
-
- BT_DBG("GATT ServerAcquire Conn ID: [%d]", con_id);
- BT_DBG("GATT Server Acquire notify att handle:[%d]", att_han);
- BT_DBG("GATT Server Acquire Notify Offset: [%d]", offset);
- BT_DBG("GATT Server Acquire Notify address: [%s]", address);
-
-
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, pipefd) < 0) {
- strerror_r(errno, err_msg, sizeof(err_msg));
- BT_ERR("socketpair(): %s", err_msg);
- return ;
- }
+ int con_id = -1;
+ int tran_id = -1;
+ int att_han = -1;
+ int pipefd[2] = {-1,};
+ int mtu = -1;
+ int offset = -1;
+ char err_msg[512] = {'\0'};
+ GIOChannel *channel = NULL;
+ int result = -1;
+ int fd = -1;
+ bluetooth_gatt_acquire_notify_info_t *chr_info;
+ const char *address = NULL;
- fd = pipefd[0];
+ g_variant_get(parameters, "(iiiiii&s)",
+ &result,
+ &con_id,
+ &tran_id,
+ &att_han,
+ &mtu,
+ &offset,
+ &address);
- BT_INIT_PARAMS();
- BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+ BT_DBG("GATT ServerAcquire Conn ID: [%d]", con_id);
+ BT_DBG("GATT Server Acquire notify att handle:[%d]", att_han);
+ BT_DBG("GATT Server Acquire Notify Offset: [%d]", offset);
+ BT_DBG("GATT Server Acquire Notify address: [%s]", address);
- //param1 = g_array_new(TRUE, TRUE, sizeof(gchar));
- bluetooth_gatt_server_acquire_response_params_t data;
- data.req_type = BLUETOOTH_GATT_REQUEST_TYPE_ACQUIRE_NOTIFY;
- data.fd = pipefd[1];
- data.mtu = mtu;
- data.request_id = tran_id;
- BT_INFO("FD write %d characterstics path \n", pipefd[0]);
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, pipefd) < 0) {
+ strerror_r(errno, err_msg, sizeof(err_msg));
+ BT_ERR("socketpair(): %s", err_msg);
+ return ;
+ }
- chr_info = bluetooth_get_characteristic_info_from_path(att_han);
- if (!chr_info) {
- chr_info = g_malloc0(sizeof(bluetooth_gatt_acquire_notify_info_t));
- chr_info->write_fd = fd;
- chr_info->att_hand = att_han;
+ fd = pipefd[0];
- gatt_characteristic_server_notify_list = g_slist_append(gatt_characteristic_server_notify_list, chr_info);
- } else
- chr_info->write_fd = fd;
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
- channel = g_io_channel_unix_new(fd);
- g_io_channel_set_encoding(channel, NULL, NULL);
- g_io_channel_set_buffered(channel, FALSE);
- g_io_channel_set_close_on_unref(channel, TRUE);
- g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL);
- g_io_add_watch(channel, (G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL),
- bluetooth_gatt_write_channel_watch_cb, chr_info);
+ //param1 = g_array_new(TRUE, TRUE, sizeof(gchar));
+ bluetooth_gatt_server_acquire_response_params_t data;
+ data.req_type = BLUETOOTH_GATT_REQUEST_TYPE_ACQUIRE_NOTIFY;
+ data.fd = pipefd[1];
+ data.mtu = mtu;
+ data.request_id = tran_id;
+
+ BT_INFO("FD write %d characterstics path \n", pipefd[0]);
+
+ chr_info = bluetooth_get_characteristic_info_from_path(att_han);
+ if (!chr_info) {
+ chr_info = g_malloc0(sizeof(bluetooth_gatt_acquire_notify_info_t));
+ chr_info->write_fd = fd;
+ chr_info->att_hand = att_han;
+
+ gatt_characteristic_server_notify_list = g_slist_append(gatt_characteristic_server_notify_list, chr_info);
+ } else
+ chr_info->write_fd = fd;
+
+ channel = g_io_channel_unix_new(fd);
+ g_io_channel_set_encoding(channel, NULL, NULL);
+ g_io_channel_set_buffered(channel, FALSE);
+ g_io_channel_set_close_on_unref(channel, TRUE);
+ g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL);
+ g_io_add_watch(channel, (G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL),
+ bluetooth_gatt_write_channel_watch_cb, chr_info);
- GUnixFDList *fd_list = g_unix_fd_list_new();
- GError *error = NULL;
+ GUnixFDList *fd_list = g_unix_fd_list_new();
+ GError *error = NULL;
- g_unix_fd_list_append(fd_list, pipefd[1], &error);
- g_assert_no_error(error);
- close(pipefd[1]);
+ g_unix_fd_list_append(fd_list, pipefd[1], &error);
+ g_assert_no_error(error);
+ close(pipefd[1]);
- g_array_append_vals(in_param1, &data, sizeof(bluetooth_gatt_server_acquire_response_params_t));
+ g_array_append_vals(in_param1, &data, sizeof(bluetooth_gatt_server_acquire_response_params_t));
- BT_DBG("Sending event BT_GATT_SERVER_ACQUIRE_NOTIFY_RESPONSE file descriptor value [%d] ", data.fd);
+ BT_DBG("Sending event BT_GATT_SERVER_ACQUIRE_NOTIFY_RESPONSE file descriptor value [%d] ", data.fd);
- result = _bt_send_request_with_unix_fd_list(BT_BLUEZ_SERVICE, BT_GATT_SERVER_ACQUIRE_NOTIFY_RESPONSE,
- in_param1, in_param2, in_param3, in_param4, fd_list, &out_param, NULL);
+ result = _bt_send_request_with_unix_fd_list(BT_BLUEZ_SERVICE, BT_GATT_SERVER_ACQUIRE_NOTIFY_RESPONSE,
+ in_param1, in_param2, in_param3, in_param4, fd_list, &out_param, NULL);
- BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
- //send
- if (result == BLUETOOTH_ERROR_NONE) {
- BT_DBG("sending gatt server notification state changed event");
- bluetooth_gatt_server_notification_changed_t info;
- bluetooth_device_address_t dev_address = { {0} };
- memset(&info, 0x00, sizeof(bluetooth_gatt_server_notification_changed_t));
+ //send
+ if (result == BLUETOOTH_ERROR_NONE) {
+ BT_DBG("sending gatt server notification state changed event");
+ bluetooth_gatt_server_notification_changed_t info;
+ bluetooth_device_address_t dev_address = { {0} };
+ memset(&info, 0x00, sizeof(bluetooth_gatt_server_notification_changed_t));
- _bt_convert_addr_string_to_type(dev_address.addr, address);
- memcpy(info.device_address.addr,
- dev_address.addr,
- BLUETOOTH_ADDRESS_LENGTH);
- info.handle = att_han;
- info.notification = TRUE;
+ _bt_convert_addr_string_to_type(dev_address.addr, address);
+ memcpy(info.device_address.addr,
+ dev_address.addr,
+ BLUETOOTH_ADDRESS_LENGTH);
+ info.handle = att_han;
+ info.notification = TRUE;
- _bt_gatt_server_event_cb(BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_STATE_CHANGED,
- result, &info,
- event_info->cb, event_info->user_data);
+ _bt_gatt_server_event_cb(BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_STATE_CHANGED,
+ result, &info,
+ event_info->cb, event_info->user_data);
- }
+ }
}
void cleanup_gatt_acquire_fd(int handle)
static gboolean __bt_hal_pincode_request(GapAgentPrivate *agent, GDBusProxy *device)
{
uint32_t device_class;
- gchar *address;
+ gchar *address = NULL;
unsigned char auth_info[5] = {0, };
- gchar *name;
+ gchar *name = NULL;
GVariant *reply = NULL;
GVariant *reply_temp = NULL;
- GVariant *tmp_value;
+ GVariant *tmp_value = NULL;
DBG("+");
reply_temp = __bt_hal_service_getall(device, BT_HAL_DEVICE_INTERFACE);
static gboolean __bt_hal_display_request(GapAgentPrivate *agent, GDBusProxy *device,
guint passkey)
{
- gchar *address;
- gchar *name;
+ gchar *address = NULL;
+ gchar *name = NULL;
unsigned char auth_info[5] = {0, };
- char *str_passkey;
+ char *str_passkey = NULL;
uint32_t device_class;
GVariant *reply = NULL;
GVariant *reply_temp = NULL;
/* SSP */
static gboolean __bt_hal_passkey_request(GapAgentPrivate *agent, GDBusProxy *device)
{
- gchar *address;
- gchar *name;
+ gchar *address = NULL;
+ gchar *name = NULL;
unsigned char auth_info[5] = {0, };
uint32_t device_class;
GVariant *reply = NULL;
GVariant *reply_temp = NULL;
- GVariant *tmp_value;
+ GVariant *tmp_value = NULL;
DBG("+");
reply_temp = __bt_hal_service_getall(device, BT_HAL_DEVICE_INTERFACE);
static gboolean __bt_hal_confirm_request(GapAgentPrivate *agent, GDBusProxy *device,
guint passkey)
{
- gchar *address;
- gchar *name;
+ gchar *address = NULL;
+ gchar *name = NULL;
char str_passkey[7];
uint32_t device_class;
GVariant *reply_temp = NULL;
GVariant *reply = NULL;
- GVariant *tmp_value;
+ GVariant *tmp_value = NULL;
DBG("+ passkey[%.6d]", passkey);
DBG("Agent Path [%s]", agent->path);
static gboolean __bt_hal_authorize_request(GapAgentPrivate *agent, GDBusProxy *device,
const char *uuid)
{
- gchar *address;
- gchar *name;
+ gchar *address = NULL;
+ gchar *name = NULL;
gboolean trust;
gboolean paired;
GVariant *reply = NULL;
GVariant *reply_temp = NULL;
- GVariant *tmp_value;
+ GVariant *tmp_value = NULL;
#ifdef TIZEN_FEATURE_BT_RFCOMM_DIRECT
bt_hal_agent_osp_server_t *osp_server;
#endif