#include "bt-event-handler.h"
#include "bt-gatt-client.h"
#include "bt-request-sender.h"
+#include "bt-gatt-server.h"
#define PROFILE_SUPPORTED 0x3 /* This corresponds to binary 0b11*/
#define BT_RELIABLE_DISABLE_TIME 300 /* 300 ms */
return FALSE;
}
+static void __bt_fill_garray_from_variant(GVariant *var, GArray *param)
+{
+ char *data;
+ int size;
+
+ size = g_variant_get_size(var);
+ if (size > 0) {
+ data = (char *)g_variant_get_data(var);
+ if (data)
+ param = g_array_append_vals(param, data, size);
+
+ }
+}
+
void __bt_adapter_event_filter(GDBusConnection *connection,
const gchar *sender_name,
const gchar *object_path,
disable_timer_id = g_timeout_add(BT_RELIABLE_DISABLE_TIME,
(GSourceFunc)__bt_reliable_disable_cb,
event_info);
+ } else if (strcasecmp(signal_name, BT_DISABLED_BATTERY_DATA) == 0) {
+ BT_INFO("BT_DISABLED_BATTERY_DATA");
+
+ int result;
+ GVariant *param = NULL;
+ GArray *dbus_data = NULL;
+ bt_battery_dbus_data_t *info = NULL;
+ bt_battery_data *data = NULL;
+
+ g_variant_get(parameters, "(iv)", &result, ¶m);
+
+ if (!param) {
+ result = BLUETOOTH_ERROR_INTERNAL;
+ BT_ERR("No data reveived");
+ _bt_common_event_cb(BLUETOOTH_EVENT_DISABLED_BATTERY_DATA,
+ result, data,
+ event_info->cb, event_info->user_data);
+ return;
+ }
+
+ dbus_data = g_array_new(TRUE, TRUE, sizeof(gchar));
+
+ if (dbus_data == NULL) {
+ BT_ERR("g_array_new failed");
+ g_variant_unref(param);
+ return;
+ }
+ __bt_fill_garray_from_variant(param, dbus_data);
+ g_variant_unref(param);
+
+ info = &g_array_index(dbus_data, bt_battery_dbus_data_t, 0);
+
+ data = g_new0(bt_battery_data, 1);
+
+ data->session_start_time = info->session_start_time;
+ data->session_end_time = info->session_end_time;
+ data->session_scan_time = info->session_scan_time;
+ data->session_connected_time = info->session_connected_time;
+ data->atm_list = NULL;
+
+ BT_INFO("Received battery data in bt-api: %ld %ld %d %d.",
+ data->session_start_time, data->session_end_time,
+ data->session_scan_time, data->session_connected_time);
+
+ /*Copying app wise details*/
+ int n = NUM_APP_MAX < info->num_app ? NUM_APP_MAX : info->num_app; //Maximum NUM_APP_MAX details will be fetched
+
+ for (int i = 0; i < n; i++) {
+ bt_battery_app_data *app_data = NULL;
+ app_data = g_malloc0(sizeof(bt_battery_app_data));
+ memcpy(app_data, &(info->app_data[i]), sizeof(bt_battery_app_data));
+ data->atm_list = g_slist_append(data->atm_list, app_data);
+ }
+
+ if (data->atm_list == NULL) {
+ BT_INFO("No app data transaction in this session");
+ }
+ else {
+ BT_INFO("App-wise data transaction details:");
+ for (GSList *l = data->atm_list; l != NULL; l = g_slist_next(l)) {
+ bt_battery_app_data *t = (bt_battery_app_data *)(l->data);
+ BT_DBG("%ld %ld %d %d %u", (long int)(t->uid), (long int)(t->pid), t->rx_bytes, t->tx_bytes, t->time);
+ }
+ }
+
+ _bt_common_event_cb(BLUETOOTH_EVENT_DISABLED_BATTERY_DATA,
+ result, data,
+ event_info->cb, event_info->user_data);
+ g_slist_free(data->atm_list);
+ g_free(data);
+ g_array_free(dbus_data, TRUE);
} else if (strcasecmp(signal_name, BT_DISCOVERABLE_MODE_CHANGED) == 0) {
int mode = 0;
const char *address = NULL;
const char *name = NULL;
const char *str_passkey = NULL;
+ bool incoming = false;
bluetooth_authentication_request_info_t auth_info;
memset(&auth_info, 0x00, sizeof(bluetooth_authentication_request_info_t));
- g_variant_get(parameters, "(i&s&s&s)", &result, &address, &name, &str_passkey);
+ g_variant_get(parameters, "(b&s&s&s)", &incoming, &address, &name, &str_passkey);
g_strlcpy(auth_info.device_name.name, name,
BLUETOOTH_DEVICE_NAME_LENGTH_MAX + 1);
_bt_convert_addr_string_to_type(auth_info.device_address.addr,
address);
g_strlcpy(auth_info.str_passkey, str_passkey, strlen(str_passkey)+1);
+ auth_info.incoming = incoming;
+ BT_INFO("BLUETOOTH_EVENT_KEYBOARD_PASSKEY_DISPLAY");
_bt_common_event_cb(BLUETOOTH_EVENT_KEYBOARD_PASSKEY_DISPLAY,
result, &auth_info,
event_info->cb, event_info->user_data);
} else if (strcasecmp(signal_name, BT_PIN_REQ_RECEIVED) == 0) {
const char *address = NULL;
const char *name = NULL;
+ bool incoming = false;
bluetooth_authentication_request_info_t auth_info;
memset(&auth_info, 0x00, sizeof(bluetooth_authentication_request_info_t));
- g_variant_get(parameters, "(i&s&s)", &result, &address, &name);
+ g_variant_get(parameters, "(b&s&s)", &incoming, &address, &name);
g_strlcpy(auth_info.device_name.name, name,
BLUETOOTH_DEVICE_NAME_LENGTH_MAX + 1);
_bt_convert_addr_string_to_type(auth_info.device_address.addr,
address);
+ auth_info.incoming = incoming;
+
+ BT_INFO("BLUETOOTH_EVENT_PIN_REQUEST");
_bt_common_event_cb(BLUETOOTH_EVENT_PIN_REQUEST,
result, &auth_info,
} else if (strcasecmp(signal_name, BT_PASSKEY_REQ_RECEIVED) == 0) {
const char *address = NULL;
const char *name = NULL;
+ bool incoming = false;
bluetooth_authentication_request_info_t auth_info;
memset(&auth_info, 0x00, sizeof(bluetooth_authentication_request_info_t));
- g_variant_get(parameters, "(i&s&s)", &result, &address, &name);
+ g_variant_get(parameters, "(b&s&s)", &incoming, &address, &name);
g_strlcpy(auth_info.device_name.name, name,
BLUETOOTH_DEVICE_NAME_LENGTH_MAX + 1);
_bt_convert_addr_string_to_type(auth_info.device_address.addr,
address);
+ auth_info.incoming = incoming;
+
+ BT_INFO("BLUETOOTH_EVENT_PASSKEY_REQUEST");
_bt_common_event_cb(BLUETOOTH_EVENT_PASSKEY_REQUEST,
result, &auth_info,
const char *address = NULL;
const char *name = NULL;
const char *str_passkey = NULL;
+ bool incoming = false;
bluetooth_authentication_request_info_t auth_info;
memset(&auth_info, 0x00, sizeof(bluetooth_authentication_request_info_t));
- g_variant_get(parameters, "(i&s&s&s)", &result, &address, &name, &str_passkey);
+ g_variant_get(parameters, "(b&s&s&s)", &incoming, &address, &name, &str_passkey);
g_strlcpy(auth_info.device_name.name, name,
BLUETOOTH_DEVICE_NAME_LENGTH_MAX + 1);
_bt_convert_addr_string_to_type(auth_info.device_address.addr,
address);
g_strlcpy(auth_info.str_passkey, str_passkey, strlen(str_passkey)+1);
+ auth_info.incoming = incoming;
+
+ BT_INFO("BLUETOOTH_EVENT_PASSKEY_CONFIRM_REQUEST");
_bt_common_event_cb(BLUETOOTH_EVENT_PASSKEY_CONFIRM_REQUEST,
result, &auth_info,
BLUETOOTH_ERROR_NONE, NULL,
event_info->cb, event_info->user_data);
} else if (strcasecmp(signal_name, BT_LE_DISCOVERY_FINISHED) == 0) {
+ _bt_set_le_scan_status(FALSE);
g_variant_get(parameters, "(i)", &result);
_bt_common_event_cb(BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED,
result, NULL,
g_variant_get(parameters, "(i&s)", &result, &address);
_bt_convert_addr_string_to_type(dev_address.addr, address);
- BT_DBG("Sending Event to Framework");
_bt_common_event_cb(BLUETOOTH_EVENT_GATT_SERVER_CONNECTED,
result, &dev_address,
event_info->cb, event_info->user_data);
g_variant_get(parameters, "(i&s)", &result, &address);
_bt_convert_addr_string_to_type(dev_address.addr, address);
- BT_DBG("Sending Event to Framework");
_bt_common_event_cb(BLUETOOTH_EVENT_GATT_SERVER_DISCONNECTED,
result, &dev_address,
event_info->cb, event_info->user_data);
g_variant_get(parameters, "(i&s)", &result, &address);
_bt_convert_addr_string_to_type(dev_address.addr, address);
- BT_DBG("Sending Event to Framework");
_bt_common_event_cb(BLUETOOTH_EVENT_GATT_CLIENT_CONNECTED,
result, &dev_address,
event_info->cb, event_info->user_data);
g_variant_get(parameters, "(i&s)", &result, &address);
_bt_convert_addr_string_to_type(dev_address.addr, address);
- BT_DBG("Sending Event to Framework");
_bt_common_event_cb(BLUETOOTH_EVENT_GATT_CLIENT_DISCONNECTED,
result, &dev_address,
event_info->cb, event_info->user_data);
g_variant_get(parameters, "(i&s)", &result, &address);
_bt_convert_addr_string_to_type(dev_address.addr, address);
- BT_DBG("Sending Event to Framework");
_bt_common_event_cb(BLUETOOTH_EVENT_GATT_CONNECTED,
result, &dev_address,
event_info->cb, event_info->user_data);
g_variant_get(parameters, "(i&s)", &result, &address);
_bt_convert_addr_string_to_type(dev_address.addr, address);
- BT_DBG("Sending Event to Framework");
_bt_common_event_cb(BLUETOOTH_EVENT_GATT_DISCONNECTED,
result, &dev_address,
event_info->cb, event_info->user_data);
conn_info.addr_type = addr_type;
conn_info.disc_reason = 0;
- BT_DBG("Sending Event to Framework");
_bt_common_event_cb(BLUETOOTH_EVENT_DEVICE_CONNECTED,
result, &conn_info,
event_info->cb, event_info->user_data);
unsigned char addr_type;
bt_connection_info_t conn_info;
bluetooth_device_address_t dev_address = { {0} };
- BT_DBG("BT_DEVICE_DISCONNECTED");
- g_variant_get(parameters, "(i&sy)", &result, &address, &addr_type);
+ int rssi;
+ g_variant_get(parameters, "(i&syi)", &result, &address, &addr_type, &rssi);
+ BT_DBG("BT_DEVICE_DISCONNECTED reason(%d)", result);
_bt_convert_addr_string_to_type(dev_address.addr,
address);
conn_info.addr_type = addr_type;
conn_info.disc_reason = result;
- BT_DBG("Sending Event to Framework");
+ conn_info.rssi = rssi;
_bt_common_event_cb(BLUETOOTH_EVENT_DEVICE_DISCONNECTED,
result, &conn_info,
event_info->cb, event_info->user_data);
folders_struct.size = g_variant_iter_n_children(iter);
folders_struct.names = (char**) g_malloc0(folders_struct.size * sizeof(*(folders_struct.names)));
- BT_DBG("g_variant_iter_n_children: %d", folders_struct.size);
+ BT_DBG("g_variant_iter_n_children: %lli", (long long int)folders_struct.size);
GVariantIter* res = NULL;
int i = 0;
while (g_variant_iter_loop(iter, "a{sv}", &res)) {
messages_struct.size = g_variant_iter_n_children(iter);
messages_struct.message_items = (bt_map_client_message_item_t*)
g_malloc(messages_struct.size * sizeof(*(messages_struct.message_items)));
- BT_DBG("g_variant_iter_n_children: %d", messages_struct.size);
+ BT_DBG("g_variant_iter_n_children: %lli", (long long int)messages_struct.size);
char *object = NULL;
GVariantIter *properites = NULL;
} else if (strcmp(key, "Size") == 0) {
g_variant_get(value, "t", &value_int);
messages_struct.message_items[i].size = value_int;
- BT_DBG(" Size: %d", value_int);
+ BT_DBG(" Size: %llu", (unsigned long long int)value_int);
} else if (strcmp(key, "Text") == 0) {
g_variant_get(value, "b", &value_bool);
messages_struct.message_items[i].is_text = value_bool ? 1 : 0;
} else if (strcmp(key, "AttachmentSize") == 0) {
g_variant_get(value, "t", &value_int);
messages_struct.message_items[i].attachment_size = value_int;
- BT_DBG(" AttachmentSize: %d", value_int);
+ BT_DBG(" AttachmentSize: %llu", (unsigned long long int)value_int);
} else if (strcmp(key, "Priority") == 0) {
g_variant_get(value, "b", &value_bool);
messages_struct.message_items[i].is_priority = value_bool ? 1 : 0;
for (i = 0; i < count; i++)
BT_DBG("%s", list[i]);
- BT_DBG("address: %s, result: %d, count: %d, success: %d",
+ BT_DBG("address: %s, result: %d, count: %zd, success: %d",
address, result, count, success);
_bt_convert_addr_string_to_type(vc_list.btaddr.addr,
const char *address = NULL;
char *data;
int data_len = 0;
- int k;
GVariant *var = NULL;
bluetooth_tds_transport_data_info_t *info = NULL;
data = (char *)g_variant_get_data(var);
if (data) {
- BT_DBG("Address [%s]", address);
- BT_DBG("Data len [%d]", data_len);
-
- /* DEBUG */
- for (k = 0; k < data_len ; k++)
- BT_DBG("Data[%d] [0x%x]", k, data[k]);
-
if (data_len == 0) {
BT_ERR("No data");
g_variant_unref(var);
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));
BT_INFO("GATT Client Char value changed in remote Server [%s]", address);
BT_INFO("GATT Client Char Val len: [%d]", char_prop.val_len);
- /* Copy Data */
- memcpy(&char_prop.value, g_variant_get_data(data_var), char_prop.val_len);
+ if (char_prop.val_len > 0) {
+ /* Copy Data */
+ memcpy(&char_prop.value, g_variant_get_data(data_var), char_prop.val_len);
+ }
+
memcpy(&char_prop.prop.uuid, g_variant_get_data(char_uuid_var), 16);
- /* DEBUG */
- for (i = 0; i < char_prop.val_len; i++)
- BT_INFO("Data[%d] = [0x%x]", i, char_prop.value[i]);
+ /* Copy SVC data */
+ memcpy(&char_prop.svc_prop.uuid, g_variant_get_data(svc_uuid_var), 16);
+ char_prop.svc_prop.instance_id = svc_inst;
_bt_gatt_client_event_cb(BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED,
result, &char_prop,
event_info->cb, event_info->user_data);
+
+ g_variant_unref(svc_uuid_var);
+ g_variant_unref(char_uuid_var);
+ g_variant_unref(data_var);
+
} 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);
}
memcpy(&char_prop.svc_prop.uuid, g_variant_get_data(svc_uuid_var), 16);
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]);
-
_bt_gatt_client_event_cb(BLUETOOTH_EVENT_GATT_READ_CHAR,
result, &char_prop,
event_info->cb, event_info->user_data);
+
+ g_variant_unref(svc_uuid_var);
+ g_variant_unref(char_uuid_var);
+ g_variant_unref(data_var);
+
} 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;
_bt_gatt_client_event_cb(BLUETOOTH_EVENT_GATT_WRITE_CHAR,
result, &char_prop,
event_info->cb, event_info->user_data);
+
+ g_variant_unref(svc_uuid_var);
+ g_variant_unref(char_uuid_var);
+
} 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;
int svc_uuid_len = 0;
int char_uuid_len = 0;
int desc_uuid_len = 0;
- unsigned int i;
memset(&desc_prop, 0x00, sizeof(bt_gatt_char_descriptor_property_t));
memcpy(&desc_prop.svc_prop.uuid, g_variant_get_data(svc_uuid_var), 16);
desc_prop.svc_prop.instance_id = svc_inst;
- /* DEBUG */
- for (i = 0; i < desc_prop.val_len; i++)
- BT_INFO("Data[%d] = [0x%x]", i, desc_prop.value[i]);
-
_bt_gatt_client_event_cb(BLUETOOTH_EVENT_GATT_READ_DESC,
result, &desc_prop,
event_info->cb, event_info->user_data);
+
+ g_variant_unref(svc_uuid_var);
+ g_variant_unref(char_uuid_var);
+ g_variant_unref(desc_uuid_var);
+ g_variant_unref(data_var);
+
} 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;
_bt_gatt_client_event_cb(BLUETOOTH_EVENT_GATT_WRITE_DESC,
result, &desc_prop,
event_info->cb, event_info->user_data);
- }
- BT_DBG("GATT Client event handler Exit <<");
+ g_variant_unref(svc_uuid_var);
+ g_variant_unref(char_uuid_var);
+ g_variant_unref(desc_uuid_var);
+
+ } else if (strcasecmp(signal_name, BT_GATT_CLIENT_SERVICE_CHANGED) == 0) {
+ BT_DBG("GATT Client event[BT_GATT_CLIENT_SERVICE_CHANGED]");
+ bt_gatt_service_change_t change = {0, };
+ char *address_str = NULL;
+ char *name = NULL;
+
+ g_variant_get(parameters, "(i&s&s)", &change.change_type, &address_str, &change.uuid);
+
+ _bt_convert_addr_string_to_type(change.device_addr.addr, address_str);
+ bluetooth_get_uuid_name(change.uuid, &name);
+ BT_INFO(" ### GATT Service %s [%s]", change.change_type ? "Added" : "Removed", name);
+ g_free(name);
+
+ if (_bluetooth_gatt_check_service_change_watcher_address(&change.device_addr) == FALSE) {
+ BT_INFO("No watcher for %s", address_str);
+ return;
+ }
+
+ _bt_gatt_client_event_cb(BLUETOOTH_EVENT_GATT_CLIENT_SERVICE_CHANGED,
+ BLUETOOTH_ERROR_NONE, &change,
+ event_info->cb, event_info->user_data);
+ }
}
#endif
BT_INFO("GATT Server event[BT_GATT_SERVER_WRITE_REQUESTED]");
const char *address = NULL;
GVariant *data_var = NULL;
- int i;
bluetooth_device_address_t dev_address = { {0} };
bluetooth_gatt_server_write_requested_info_t write_info;
dev_address.addr,
BLUETOOTH_ADDRESS_LENGTH);
- /* DEBUG */
- for (i = 0; i < write_info.length; i++)
- BT_DBG("Data[%d] = [0x%x]", i, write_info.data.data[i]);
-
_bt_gatt_server_event_cb(BLUETOOTH_EVENT_GATT_SERVER_VALUE_CHANGED,
BLUETOOTH_ERROR_NONE, &write_info,
event_info->cb, event_info->user_data);
+
+ g_variant_unref(data_var);
} else if (strcasecmp(signal_name, BT_GATT_SERVER_READ_REQ) == 0) {
const char *address = NULL;
bluetooth_device_address_t dev_address = { {0} };
_bt_gatt_server_event_cb(BLUETOOTH_EVENT_GATT_SERVER_READ_REQUESTED,
result, &read_info,
event_info->cb, event_info->user_data);
- } else if (strcasecmp(signal_name, BT_GATT_SERVER_NOTIFICATION_COMPLETED) == 0) {
+ } else if (strcasecmp(signal_name, BT_GATT_SERVER_ACQUIRE_WRITE) == 0) {
+
+ bluetooth_gatt_server_send_acquire_write_response(parameters);
+
+ } else if (strcasecmp(signal_name, BT_GATT_SERVER_ACQUIRE_NOTIFICATION) == 0) {
+
+ bluetooth_gatt_server_send_acquire_notify_response(parameters, event_info);
+
+ } else if (strcasecmp(signal_name, BT_GATT_SERVER_NOTIFICATION_COMPLETED) == 0) {
const char *address = NULL;
bluetooth_device_address_t dev_address = { {0} };
bluetooth_gatt_server_indicate_confirmed_info_t info;
bluetooth_gatt_server_notification_changed_t info;
memset(&info, 0x00, sizeof(bluetooth_gatt_server_notification_changed_t));
- BT_INFO("GATT Server event[BT_GATT_SERVER_NOTIFICATION_COMPLETED]");
+ BT_INFO("GATT Server event[BT_GATT_SERVER_NOTIFICATION_CHANGED]");
/* Extract data from DBUS params */
g_variant_get(parameters, "(i&sib)", &result, &address, &info.handle, &info.notification);
BT_INFO("GATT Server: Notification Enabled?? Handle: [%d] address [%s] Is Enabled [%d] result [%d]",
info.handle, address, info.notification, result);
+ if (info.notification == FALSE)
+ cleanup_gatt_acquire_fd(info.handle);
+
_bt_gatt_server_event_cb(BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_STATE_CHANGED,
result, &info,
event_info->cb, event_info->user_data);
+ } else if (strcasecmp(signal_name, BT_GATT_SERVER_ATT_MTU_CHANGED) == 0) {
+ const char *address = NULL;
+ bluetooth_device_address_t dev_address = { {0} };
+ bluetooth_le_att_mtu_info_t att_mtu_info;
+ guint16 mtu;
+ guint8 status;
+ BT_DBG("BT_GATT_SERVER_ATT_MTU_CHANGED");
+ g_variant_get(parameters, "(i&sqy)", &result, &address, &mtu, &status);
+
+ _bt_convert_addr_string_to_type(dev_address.addr, address);
+
+ memset(&att_mtu_info, 0x00, sizeof(bluetooth_le_att_mtu_info_t));
+ memcpy(att_mtu_info.device_address.addr,
+ dev_address.addr,
+ BLUETOOTH_ADDRESS_LENGTH);
+
+ att_mtu_info.mtu = mtu;
+ att_mtu_info.status = status;
+
+ _bt_common_event_cb(BLUETOOTH_EVENT_GATT_SERVER_ATT_MTU_CHANGED,
+ result, &att_mtu_info,
+ event_info->cb, event_info->user_data);
}
+
BT_INFO("GATT Server event handler Exit <<");
}
#endif
path = BT_RFCOMM_SERVER_PATH;
break;
case BT_HF_AGENT_EVENT:
- BT_DBG("BT_HF_AGENT_EVENT\n");
event_func = __bt_hf_agent_event_filter;
path = BT_HF_AGENT_PATH;
interface = BT_HF_SERVICE_INTERFACE;
break;
case BT_A2DP_SOURCE_EVENT:
- BT_DBG("BT_A2DP_SOURCE_EVENT");
event_func = __bt_a2dp_source_event_filter;
path = BT_A2DP_SOURCE_PATH;
break;
case BT_HID_DEVICE_EVENT:
- BT_DBG("BT_HID_DEVICE_EVENT");
event_func = __bt_hid_device_event_filter;
path = BT_HID_DEVICE_PATH;
break;
#ifdef GATT_NO_RELAY
case BT_GATT_BLUEZ_EVENT:
- BT_DBG("BT_GATT_BLUEZ_EVENT");
event_func = __bt_device_event_filter;
interface = BT_GATT_CHARACTERISTIC_INTERFACE;
path = NULL;
break;
#endif
case BT_TDS_EVENT:
- BT_DBG("BT_TDS_EVENT");
event_func = __bt_tds_event_filter;
path = BT_TDS_PATH;
break;
case BT_OTP_EVENT:
- BT_DBG("BT_OTP_EVENT");
event_func = __bt_otp_event_filter;
path = BT_OTP_PATH;
break;
case BT_HDP_EVENT:
- BT_DBG("BT_HDP_EVENT");
event_func = __bt_hdp_event_filter;
path = BT_HDP_DEVICE_PATH;
break;
return BLUETOOTH_ERROR_INTERNAL;
}
- connection_type = _bt_gdbus_get_system_gconn();
+ connection_type = _bt_get_system_private_conn();
if (connection_type == NULL)
return BLUETOOTH_ERROR_INTERNAL;
return BLUETOOTH_ERROR_INTERNAL;
}
- connection_type = _bt_gdbus_get_system_gconn();
+ connection_type = _bt_get_system_private_conn();
event_list = g_slist_remove(event_list, (void *)cb_data);
{
GDBusConnection *connection_type;
- connection_type = _bt_gdbus_get_system_gconn();
+ connection_type = _bt_get_system_private_conn();
if (connection_type == NULL) {
BT_ERR("Unable to get the bus");
return;
{
GDBusConnection *connection_type;
- connection_type = _bt_gdbus_get_system_gconn();
+ connection_type = _bt_get_system_private_conn();
if (connection_type != NULL && owner_sig_id > 0) {
g_dbus_connection_signal_unsubscribe(connection_type,
owner_sig_id);
GVariant *ret = NULL;
GVariant *value = NULL;
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
ret_if(g_conn == NULL);
proxy = g_dbus_proxy_new_sync(g_conn,
- G_DBUS_PROXY_FLAGS_NONE, NULL,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL,
BT_BLUEZ_NAME,
path,
BT_PROPERTIES_INTERFACE,
static guint service_added_id = 0;
static guint interface_removed_id = 0;
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
if (g_conn == NULL)
return BLUETOOTH_ERROR_INTERNAL;