Zephyr API Documentation 4.0.99
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_add_param *add_param, struct bt_ots_obj_created_desc *created_desc) |
Object created callback. | |
int(* | obj_deleted )(struct bt_ots *ots, struct bt_conn *conn, uint64_t id) |
Object deleted callback. | |
void(* | obj_selected )(struct bt_ots *ots, struct bt_conn *conn, uint64_t id) |
Object selected callback. | |
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. | |
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. | |
void(* | obj_name_written )(struct bt_ots *ots, struct bt_conn *conn, uint64_t id, const char *cur_name, const char *new_name) |
Object name written callback. | |
int(* | obj_cal_checksum )(struct bt_ots *ots, struct bt_conn *conn, uint64_t id, off_t offset, size_t len, void **data) |
Object Calculate checksum callback. | |
OTS callback structure.
int(* bt_ots_cb::obj_cal_checksum) (struct bt_ots *ots, struct bt_conn *conn, uint64_t id, off_t offset, size_t len, void **data) |
Object Calculate checksum callback.
This callback is called when the OACP Calculate Checksum procedure is performed. Because object data is opaque to OTS, the application is the only one who knows where data is and should return pointer of actual object data.
[in] | ots | OTS instance. |
[in] | conn | The connection that wrote object. |
[in] | id | Object ID. |
[in] | offset | The first octet of the object contents need to be calculated. |
[in] | len | The length number of octets object name. |
[out] | data | Pointer of actual object data. |
int(* bt_ots_cb::obj_created) (struct bt_ots *ots, struct bt_conn *conn, uint64_t id, const struct bt_ots_obj_add_param *add_param, struct bt_ots_obj_created_desc *created_desc) |
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 bt_ots_obj_add(). |
id | Object ID. |
add_param | Object creation requested parameters. |
created_desc | Created object descriptor that shall be filled by the receiver of this callback. |
int(* bt_ots_cb::obj_deleted) (struct bt_ots *ots, struct bt_conn *conn, uint64_t id) |
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. |
When | an error is indicated by using a negative value, the object delete procedure is aborted and a corresponding failed status is returned to the client. |
void(* bt_ots_cb::obj_name_written) (struct bt_ots *ots, struct bt_conn *conn, uint64_t id, const char *cur_name, const char *new_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 will be updated by the OTS service implementation.
ots | OTS instance. |
conn | The connection that wrote object name. |
id | Object ID. |
cur_name | Current object name. |
new_name | New 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. |
void(* bt_ots_cb::obj_selected) (struct bt_ots *ots, struct bt_conn *conn, uint64_t id) |
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. |