Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
OTS callback structure. More...
#include <ots.h>
Data Fields | |
int(* | obj_created )(struct bt_ots *ots, struct bt_conn *conn, uint64_t id, const struct bt_ots_obj_metadata *init) |
Object created callback. More... | |
void(* | obj_deleted )(struct bt_ots *ots, struct bt_conn *conn, uint64_t id) |
Object deleted callback. More... | |
void(* | obj_selected )(struct bt_ots *ots, struct bt_conn *conn, uint64_t id) |
Object selected callback. More... | |
ssize_t(* | obj_read )(struct bt_ots *ots, struct bt_conn *conn, uint64_t id, void **data, size_t len, off_t offset) |
Object read callback. More... | |
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) |
Object write callback. More... | |
void(* | obj_name_written )(struct bt_ots *ots, struct bt_conn *conn, uint64_t id, const char *name) |
Object name written callback. More... | |
OTS callback structure.
int(* bt_ots_cb::obj_created) (struct bt_ots *ots, struct bt_conn *conn, uint64_t id, const struct bt_ots_obj_metadata *init) |
Object created callback.
This callback is called whenever a new object is created. Application can reject this request by returning an error when it does not have necessary resources to hold this new object. This callback is also triggered when the server creates a new object with bt_ots_obj_add() API.
ots | OTS instance. |
conn | The connection that is requesting object creation or NULL if object is created by the following function: bt_ots_obj_add(). |
id | Object ID. |
init | Object initialization metadata. |
Object deleted callback.
This callback is called whenever an object is deleted. It is also triggered when the server deletes an object with bt_ots_obj_delete() API.
ots | OTS instance. |
conn | The connection that deleted the object or NULL if this request came from the server. |
id | Object ID. |
void(* bt_ots_cb::obj_name_written) (struct bt_ots *ots, struct bt_conn *conn, uint64_t id, const char *name) |
Object name written callback.
This callback is called when the object name is written. This is a notification to the application that the object name has been updated by the OTS service implementation.
ots | OTS instance. |
conn | The connection that wrote object name. |
id | Object ID. |
name | Object name. |
ssize_t(* bt_ots_cb::obj_read) (struct bt_ots *ots, struct bt_conn *conn, uint64_t id, void **data, size_t len, off_t offset) |
Object read callback.
This callback is called multiple times during the Object read operation. OTS module will keep requesting successive Object fragments from the application until the read operation is completed. The end of read operation is indicated by NULL data parameter.
ots | OTS instance. |
conn | The connection that read object. |
id | Object ID. |
data | In: NULL once the read operations is completed. Out: Next chunk of data to be sent. |
len | Remaining length requested by the client. |
offset | Object data offset. |
Object selected callback.
This callback is called on successful object selection.
ots | OTS instance. |
conn | The connection that selected new object. |
id | Object ID. |
ssize_t(* bt_ots_cb::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) |
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.
ots | OTS instance. |
conn | The connection that wrote object. |
id | Object ID. |
data | Next chunk of data to be written. |
len | Length of the current chunk of data in the buffer. |
offset | Object data offset. |
rem | Remaining length in the write operation. |