#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 */
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,
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);
+ /* 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;
+
/* DEBUG */
for (i = 0; i < char_prop.val_len; i++)
BT_INFO("Data[%d] = [0x%x]", i, char_prop.value[i]);
BT_INFO("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);
- /* Copy Data */
- memcpy(&char_prop.value, g_variant_get_data(data_var), char_prop.val_len);
+ 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.prop.uuid, g_variant_get_data(char_uuid_var), 16);
/* Copy Svc Data */
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);
BT_DBG("GATT Client Descriptor Val len: [%d]", desc_prop.val_len);
/* Copy Data */
- memcpy(&desc_prop.value, g_variant_get_data(data_var), desc_prop.val_len);
+ if (desc_prop.val_len > 0) {
+ BT_INFO("Get the desc read data");
+ memcpy(&desc_prop.value, g_variant_get_data(data_var), desc_prop.val_len);
+ }
+
memcpy(&desc_prop.prop.uuid, g_variant_get_data(desc_uuid_var), 16);
/* Copy Char Data */
_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;
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);
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;