bluetooth: ots: Add object write procedure

Add the ability to perform an OTS Write Procedure with only Patch
support configuration.

Signed-off-by: Abe Kohandel <abe.kohandel@gmail.com>
This commit is contained in:
Abe Kohandel 2021-07-31 17:03:03 -07:00 committed by Christopher Friedt
commit 997bbcb000
10 changed files with 400 additions and 21 deletions

View file

@ -23,6 +23,7 @@ extern "C" {
#include <zephyr/types.h>
#include <sys/byteorder.h>
#include <sys/types.h>
#include <sys/util.h>
#include <bluetooth/conn.h>
#include <bluetooth/uuid.h>
@ -546,6 +547,36 @@ struct bt_ots_cb {
uint64_t id, uint8_t **data, uint32_t len,
uint32_t offset);
/** @brief Object write callback
*
* This callback is called multiple times during the Object write
* operation. OTS module will keep providing successive Object
* fragments to the application until the write operation is
* completed. The offset and length of each write fragment is
* validated by the OTS module to be within the allocated size
* of the object. The remaining length indicates data length
* remaining to be written and will decrease each write iteration
* until it reaches 0 in the last write fragment.
*
* @param ots OTS instance.
* @param conn The connection that wrote object.
* @param id Object ID.
* @param data Next chunk of data to be written.
* @param len Length of the current chunk of data in the buffer.
* @param offset Object data offset.
* @param rem Remaining length in the write operation.
*
* @return Number of bytes written in case of success, if the number
* of bytes written does not match len, -EIO is returned to
* the L2CAP layer.
* @return A negative value in case of an error.
* @return -EINPROGRESS has a special meaning and is unsupported at
* the moment. It should not be returned.
*/
ssize_t (*obj_write)(struct bt_ots *ots, struct bt_conn *conn, uint64_t id,
const void *data, size_t len, off_t offset,
size_t rem);
/** @brief Object name written callback
*
* This callback is called when the object name is written.