if (length >= bt_att_get_mtu(op->client->att) - 1) {
uint8_t pdu[4];
+ int err;
put_le16(op->value_handle, pdu);
put_le16(op->offset, pdu + 2);
- req->att_id = bt_att_send(op->client->att,
+ err = bt_att_resend(op->client->att, req->att_id,
BT_ATT_OP_READ_BLOB_REQ,
pdu, sizeof(pdu),
read_long_cb,
request_ref(req),
request_unref);
- if (req->att_id)
+ if (!err)
return;
request_unref(req);
struct long_write_op *op = req->data;
bool success = true;
uint8_t *pdu;
+ int err;
pdu = malloc(op->cur_length + 4);
if (!pdu) {
put_le16(op->offset + op->index, pdu + 2);
memcpy(pdu + 4, op->value + op->index, op->cur_length);
- req->att_id = bt_att_send(op->client->att, BT_ATT_OP_PREP_WRITE_REQ,
- pdu, op->cur_length + 4,
- prepare_write_cb,
- request_ref(req),
- request_unref);
- if (!req->att_id) {
+ err = bt_att_resend(op->client->att, req->att_id,
+ BT_ATT_OP_PREP_WRITE_REQ,
+ pdu, op->cur_length + 4,
+ prepare_write_cb,
+ request_ref(req),
+ request_unref);
+ if (err) {
request_unref(req);
success = false;
}
{
struct long_write_op *op = req->data;
uint8_t pdu;
+ int err;
op->success = success;
op->att_ecode = att_ecode;
else
pdu = 0x00; /* Cancel */
- req->att_id = bt_att_send(op->client->att, BT_ATT_OP_EXEC_WRITE_REQ,
- &pdu, sizeof(pdu),
- execute_write_cb,
- request_ref(req),
- request_unref);
- if (req->att_id)
+ err = bt_att_resend(op->client->att, req->att_id,
+ BT_ATT_OP_EXEC_WRITE_REQ,
+ &pdu, sizeof(pdu),
+ execute_write_cb,
+ request_ref(req),
+ request_unref);
+ if (!err)
return;
request_unref(req);