Skip to content

Jira794 Central writeInt API behaves differently when use on various … #400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libraries/CurieBLE/src/internal/BLECallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,8 @@ void ble_central_device_found(const bt_addr_le_t *addr,
ad, len);
}

void ble_on_write_no_rsp_complete(struct bt_conn *conn, uint8_t err,
const void *data)
{
}

3 changes: 3 additions & 0 deletions libraries/CurieBLE/src/internal/BLECallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,8 @@ uint8_t profile_service_read_rsp_process(bt_conn_t *conn,
const void *data,
uint16_t length);

void ble_on_write_no_rsp_complete(struct bt_conn *conn, uint8_t err,
const void *data);

#endif

25 changes: 19 additions & 6 deletions libraries/CurieBLE/src/internal/BLECharacteristicImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,12 +655,25 @@ bool BLECharacteristicImp::write(const unsigned char value[],
return false;
}

// Send read request
retval = bt_gatt_write_without_response(conn,
_value_handle,
value,
length,
false);
// Send write request
if (_gatt_chrc.properties | BT_GATT_CHRC_WRITE_WITHOUT_RESP)
{
retval = bt_gatt_write_without_response(conn,
_value_handle,
value,
length,
false);
}
else if (_gatt_chrc.properties | BT_GATT_CHRC_WRITE)
{
retval = bt_gatt_write(conn,
_value_handle,
0,
value,
length,
ble_on_write_no_rsp_complete);

}
bt_conn_unref(conn);
return (0 == retval);
}
Expand Down