struct pending_op {
struct btd_device *device;
unsigned int id;
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ uint16_t offset;
+#endif
struct gatt_db_attribute *attrib;
struct queue *owner_queue;
struct iovec data;
free(op);
}
-
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+static struct pending_op *pending_read_new(struct btd_device *device,
+ struct queue *owner_queue,
+ struct gatt_db_attribute *attrib,
+ unsigned int id, uint16_t offset)
+#else
static struct pending_op *pending_read_new(struct btd_device *device,
struct queue *owner_queue,
struct gatt_db_attribute *attrib,
unsigned int id)
+#endif
{
struct pending_op *op;
op->device = device;
op->attrib = attrib;
op->id = id;
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ op->offset = offset;
+#endif
queue_push_tail(owner_queue, op);
return op;
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
char dst_addr[18] = { 0 };
char *addr_value = dst_addr;
- uint16_t offset = 0;
const bdaddr_t *bdaddr = device_get_address(op->device);
ba2str(bdaddr, dst_addr);
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &addr_value);
dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &op->id);
- dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &offset);
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &op->offset);
#else
DBusMessageIter dict;
#endif
}
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
static struct pending_op *send_read(struct btd_device *device,
struct gatt_db_attribute *attrib,
GDBusProxy *proxy,
struct queue *owner_queue,
+ unsigned int id,
+ uint16_t offset)
+#else
+static struct pending_op *send_read(struct btd_device *device,
+ struct gatt_db_attribute *attrib,
+ GDBusProxy *proxy,
+ struct queue *owner_queue
unsigned int id)
+#endif
{
struct pending_op *op;
-
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ op = pending_read_new(device, owner_queue, attrib, id, offset);
+#else
op = pending_read_new(device, owner_queue, attrib, id);
+#endif
if (g_dbus_proxy_method_call(proxy, "ReadValue", read_setup_cb,
read_reply_cb, op, pending_op_free) == TRUE)
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
char dst_addr[18] = { 0 };
char *addr_value = dst_addr;
- uint16_t offset = 0;
gboolean response_needed = TRUE;
const bdaddr_t *bdaddr = device_get_address(op->device);
ba2str(bdaddr, dst_addr);
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &addr_value);
dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &op->id);
- dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &offset);
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &op->offset);
dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &response_needed);
#endif
dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, "y", &array);
done:
gatt_db_attribute_write_result(op->attrib, op->id, ecode);
}
-
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+static struct pending_op *pending_write_new(struct btd_device *device,
+ struct queue *owner_queue,
+ struct gatt_db_attribute *attrib,
+ unsigned int id,
+ const uint8_t *value,
+ size_t len,
+ uint16_t offset)
+#else
static struct pending_op *pending_write_new(struct btd_device *device,
struct queue *owner_queue,
struct gatt_db_attribute *attrib,
unsigned int id,
const uint8_t *value,
size_t len)
+#endif
{
struct pending_op *op;
op->owner_queue = owner_queue;
op->attrib = attrib;
op->id = id;
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ op->offset = offset;
+#endif
queue_push_tail(owner_queue, op);
return op;
}
-
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+static struct pending_op *send_write(struct btd_device *device,
+ struct gatt_db_attribute *attrib,
+ GDBusProxy *proxy,
+ struct queue *owner_queue,
+ unsigned int id,
+ const uint8_t *value, size_t len,
+ uint16_t offset)
+#else
static struct pending_op *send_write(struct btd_device *device,
struct gatt_db_attribute *attrib,
GDBusProxy *proxy,
struct queue *owner_queue,
unsigned int id,
const uint8_t *value, size_t len)
+#endif
{
struct pending_op *op;
-
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ op = pending_write_new(device, owner_queue, attrib, id, value, len, offset);
+#else
op = pending_write_new(device, owner_queue, attrib, id, value, len);
+#endif
if (g_dbus_proxy_method_call(proxy, "WriteValue", write_setup_cb,
owner_queue ? write_reply_cb : NULL,
error("Unable to find device object");
goto fail;
}
-
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ if (send_read(device, attrib, desc->proxy, desc->pending_reads, id, offset))
+#else
if (send_read(device, attrib, desc->proxy, desc->pending_reads, id))
+#endif
return;
+
fail:
gatt_db_attribute_read_result(attrib, id, BT_ATT_ERROR_UNLIKELY,
NULL, 0);
error("Unable to find device object");
goto fail;
}
-
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ if (send_write(device, attrib, desc->proxy, desc->pending_writes, id,
+ value, len, offset))
+#else
if (send_write(device, attrib, desc->proxy, desc->pending_writes, id,
value, len))
+#endif
return;
fail:
error("Unable to find device object");
goto fail;
}
-
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ if (send_read(device, attrib, chrc->proxy, chrc->pending_reads, id, offset))
+#else
if (send_read(device, attrib, chrc->proxy, chrc->pending_reads, id))
+#endif
return;
fail:
queue = chrc->pending_writes;
else
queue = NULL;
-
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ if (send_write(device, attrib, chrc->proxy, queue, id, value, len, offset))
+#else
if (send_write(device, attrib, chrc->proxy, queue, id, value, len))
+#endif
return;
fail: