Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
|
Object Transfer Service (OTS) . More...
Data Structures | |
struct | bt_ots_obj_type |
Type of an OTS object. More... | |
struct | bt_ots_obj_size |
Descriptor for OTS Object Size parameter. More... | |
struct | bt_ots_feat |
Features of the OTS. More... | |
struct | bt_ots_date_time |
Date and Time structure. More... | |
struct | bt_ots_obj_metadata |
Metadata of an OTS object. More... | |
struct | bt_ots_obj_add_param |
Descriptor for OTS object addition. More... | |
struct | bt_ots_obj_created_desc |
Descriptor for OTS created object. More... | |
struct | bt_ots_cb |
OTS callback structure. More... | |
struct | bt_ots_init_param |
Descriptor for OTS initialization. More... | |
struct | bt_ots_client |
OTS client instance. More... | |
struct | bt_ots_client_cb |
OTS client callback structure. More... | |
Typedefs | |
typedef int(* | bt_ots_client_dirlisting_cb) (struct bt_ots_obj_metadata *meta) |
Directory listing object metadata callback. | |
Functions | |
int | bt_ots_obj_add (struct bt_ots *ots, const struct bt_ots_obj_add_param *param) |
Add an object to the OTS instance. | |
int | bt_ots_obj_delete (struct bt_ots *ots, uint64_t id) |
Delete an object from the OTS instance. | |
void * | bt_ots_svc_decl_get (struct bt_ots *ots) |
Get the service declaration attribute. | |
int | bt_ots_init (struct bt_ots *ots, struct bt_ots_init_param *ots_init) |
Initialize the OTS instance. | |
struct bt_ots * | bt_ots_free_instance_get (void) |
Get a free instance of OTS from the pool. | |
int | bt_ots_client_register (struct bt_ots_client *ots_inst) |
Register an Object Transfer Service Instance. | |
int | bt_ots_client_unregister (uint8_t index) |
Unregister an Object Transfer Service Instance. | |
uint8_t | bt_ots_client_indicate_handler (struct bt_conn *conn, struct bt_gatt_subscribe_params *params, const void *data, uint16_t length) |
OTS Indicate Handler function. | |
int | bt_ots_client_read_feature (struct bt_ots_client *otc_inst, struct bt_conn *conn) |
Read the OTS feature characteristic. | |
int | bt_ots_client_select_id (struct bt_ots_client *otc_inst, struct bt_conn *conn, uint64_t obj_id) |
Select an object by its Object ID. | |
int | bt_ots_client_select_first (struct bt_ots_client *otc_inst, struct bt_conn *conn) |
Select the first object. | |
int | bt_ots_client_select_last (struct bt_ots_client *otc_inst, struct bt_conn *conn) |
Select the last object. | |
int | bt_ots_client_select_next (struct bt_ots_client *otc_inst, struct bt_conn *conn) |
Select the next object. | |
int | bt_ots_client_select_prev (struct bt_ots_client *otc_inst, struct bt_conn *conn) |
Select the previous object. | |
int | bt_ots_client_read_object_metadata (struct bt_ots_client *otc_inst, struct bt_conn *conn, uint8_t metadata) |
Read the metadata of the current object. | |
int | bt_ots_client_read_object_data (struct bt_ots_client *otc_inst, struct bt_conn *conn) |
Read the data of the current selected object. | |
int | bt_ots_client_write_object_data (struct bt_ots_client *otc_inst, struct bt_conn *conn, const void *buf, size_t len, off_t offset, enum bt_ots_oacp_write_op_mode mode) |
Write the data of the current selected object. | |
int | bt_ots_client_get_object_checksum (struct bt_ots_client *otc_inst, struct bt_conn *conn, off_t offset, size_t len) |
Get the checksum of the current selected object. | |
int | bt_ots_client_decode_dirlisting (uint8_t *data, uint16_t length, bt_ots_client_dirlisting_cb cb) |
Decode Directory Listing object into object metadata. | |
static int | bt_ots_obj_id_to_str (uint64_t obj_id, char *str, size_t len) |
Converts binary OTS Object ID to string. | |
void | bt_ots_metadata_display (struct bt_ots_obj_metadata *metadata, uint16_t count) |
Displays one or more object metadata as text with LOG_INF. | |
Object Transfer Service (OTS) .
[Experimental] Users should note that the APIs can change as a part of ongoing development.
#define BT_OTS_CONTINUE 1 |
#include <zephyr/bluetooth/services/ots.h>
#define BT_OTS_DATE_TIME_FIELD_SIZE 7 |
#include <zephyr/bluetooth/services/ots.h>
#define BT_OTS_OACP_GET_FEAT_ABORT | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OACP_FEAT_ABORT feature.
feat | OTS features. |
#define BT_OTS_OACP_GET_FEAT_APPEND | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OACP_FEAT_APPEND feature.
feat | OTS features. |
#define BT_OTS_OACP_GET_FEAT_CHECKSUM | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OACP_FEAT_CHECKSUM feature.
feat | OTS features. |
#define BT_OTS_OACP_GET_FEAT_CREATE | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OACP_FEAT_CREATE feature.
feat | OTS features. |
#define BT_OTS_OACP_GET_FEAT_DELETE | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OACP_FEAT_DELETE feature.
feat | OTS features. |
#define BT_OTS_OACP_GET_FEAT_EXECUTE | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OACP_FEAT_EXECUTE feature.
feat | OTS features. |
#define BT_OTS_OACP_GET_FEAT_PATCH | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OACP_FEAT_PATCH feature.
feat | OTS features. |
#define BT_OTS_OACP_GET_FEAT_READ | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OACP_FEAT_READ feature.
feat | OTS features. |
#define BT_OTS_OACP_GET_FEAT_TRUNCATE | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OACP_FEAT_TRUNCATE feature.
feat | OTS features. |
#define BT_OTS_OACP_GET_FEAT_WRITE | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OACP_FEAT_WRITE feature.
feat | OTS features. |
#define BT_OTS_OACP_SET_FEAT_ABORT | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OACP_FEAT_ABORT feature.
feat | OTS features. |
#define BT_OTS_OACP_SET_FEAT_APPEND | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OACP_FEAT_APPEND feature.
feat | OTS features. |
#define BT_OTS_OACP_SET_FEAT_CHECKSUM | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OACP_FEAT_CHECKSUM feature.
feat | OTS features. |
#define BT_OTS_OACP_SET_FEAT_CREATE | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OACP_SET_FEAT_CREATE feature.
feat | OTS features. |
#define BT_OTS_OACP_SET_FEAT_DELETE | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OACP_FEAT_DELETE feature.
feat | OTS features. |
#define BT_OTS_OACP_SET_FEAT_EXECUTE | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OACP_FEAT_EXECUTE feature.
feat | OTS features. |
#define BT_OTS_OACP_SET_FEAT_PATCH | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OACP_FEAT_PATCH feature.
feat | OTS features. |
#define BT_OTS_OACP_SET_FEAT_READ | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OACP_FEAT_READ feature.
feat | OTS features. |
#define BT_OTS_OACP_SET_FEAT_TRUNCATE | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OACP_FEAT_TRUNCATE feature.
feat | OTS features. |
#define BT_OTS_OACP_SET_FEAT_WRITE | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OACP_FEAT_WRITE feature.
feat | OTS features. |
#define BT_OTS_OBJ_GET_PROP_APPEND | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OBJ_PROP_APPEND property.
prop | Object properties. |
#define BT_OTS_OBJ_GET_PROP_DELETE | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OBJ_PROP_DELETE property.
prop | Object properties. |
#define BT_OTS_OBJ_GET_PROP_EXECUTE | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OBJ_PROP_EXECUTE property.
prop | Object properties. |
#define BT_OTS_OBJ_GET_PROP_MARKED | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OBJ_PROP_MARKED property.
prop | Object properties. |
#define BT_OTS_OBJ_GET_PROP_PATCH | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OBJ_PROP_PATCH property.
prop | Object properties. |
#define BT_OTS_OBJ_GET_PROP_READ | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OBJ_PROP_READ property.
prop | Object properties. |
#define BT_OTS_OBJ_GET_PROP_TRUNCATE | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OBJ_PROP_TRUNCATE property.
prop | Object properties. |
#define BT_OTS_OBJ_GET_PROP_WRITE | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OBJ_PROP_WRITE property.
prop | Object properties. |
#define BT_OTS_OBJ_ID_MASK BIT64_MASK(48) |
#include <zephyr/bluetooth/services/ots.h>
Mask for OTS object IDs, preserving the 48 bits.
#define BT_OTS_OBJ_ID_MAX 0xFFFFFFFFFFFFULL |
#include <zephyr/bluetooth/services/ots.h>
Maximum allowed value for object ID (except ID for directory listing)
#define BT_OTS_OBJ_ID_MIN 0x000000000100ULL |
#include <zephyr/bluetooth/services/ots.h>
Minimum allowed value for object ID (except ID for directory listing)
#define BT_OTS_OBJ_ID_SIZE 6 |
#include <zephyr/bluetooth/services/ots.h>
Size of OTS object ID (in bytes).
#define BT_OTS_OBJ_ID_STR_LEN 15 |
#include <zephyr/bluetooth/services/ots.h>
Length of OTS object ID string (in bytes).
#define BT_OTS_OBJ_SET_PROP_APPEND | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OBJ_PROP_APPEND property.
prop | Object properties. |
#define BT_OTS_OBJ_SET_PROP_DELETE | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OBJ_PROP_DELETE property.
prop | Object properties. |
#define BT_OTS_OBJ_SET_PROP_EXECUTE | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OBJ_PROP_EXECUTE property.
prop | Object properties. |
#define BT_OTS_OBJ_SET_PROP_MARKED | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OBJ_SET_PROP_MARKED property.
prop | Object properties. |
#define BT_OTS_OBJ_SET_PROP_PATCH | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OBJ_PROP_PATCH property.
prop | Object properties. |
#define BT_OTS_OBJ_SET_PROP_READ | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OBJ_PROP_READ property.
prop | Object properties. |
#define BT_OTS_OBJ_SET_PROP_TRUNCATE | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OBJ_PROP_TRUNCATE property.
prop | Object properties. |
#define BT_OTS_OBJ_SET_PROP_WRITE | ( | prop | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OBJ_PROP_WRITE property.
prop | Object properties. |
#define BT_OTS_OLCP_GET_FEAT_CLEAR | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OLCP_GET_FEAT_CLEAR feature.
feat | OTS features. |
#define BT_OTS_OLCP_GET_FEAT_GO_TO | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OLCP_GET_FEAT_GO_TO feature.
feat | OTS features. |
#define BT_OTS_OLCP_GET_FEAT_NUM_REQ | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OLCP_GET_FEAT_NUM_REQ feature.
feat | OTS features. |
#define BT_OTS_OLCP_GET_FEAT_ORDER | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Get BT_OTS_OLCP_GET_FEAT_ORDER feature.
feat | OTS features. |
#define BT_OTS_OLCP_SET_FEAT_CLEAR | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OLCP_FEAT_CLEAR feature.
feat | OTS features. |
#define BT_OTS_OLCP_SET_FEAT_GO_TO | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OLCP_FEAT_GO_TO feature.
feat | OTS features. |
#define BT_OTS_OLCP_SET_FEAT_NUM_REQ | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OLCP_FEAT_NUM_REQ feature.
feat | OTS features. |
#define BT_OTS_OLCP_SET_FEAT_ORDER | ( | feat | ) |
#include <zephyr/bluetooth/services/ots.h>
Set BT_OTS_OLCP_FEAT_ORDER feature.
feat | OTS features. |
#define BT_OTS_STOP 0 |
#include <zephyr/bluetooth/services/ots.h>
#define OTS_OBJ_ID_DIR_LIST 0x000000000000ULL |
#include <zephyr/bluetooth/services/ots.h>
ID of the Directory Listing Object.
typedef int(* bt_ots_client_dirlisting_cb) (struct bt_ots_obj_metadata *meta) |
#include <zephyr/bluetooth/services/ots.h>
Directory listing object metadata callback.
If a directory listing is decoded using bt_ots_client_decode_dirlisting(), this callback will be called for each object in the directory listing.
meta | The metadata of the decoded object |
anonymous enum |
#include <zephyr/bluetooth/services/ots.h>
Properties of an OTS object.
anonymous enum |
#include <zephyr/bluetooth/services/ots.h>
Object Action Control Point Feature bits.
anonymous enum |
#include <zephyr/bluetooth/services/ots.h>
Object List Control Point Feature bits.
anonymous enum |
#include <zephyr/bluetooth/services/ots.h>
Object metadata request bit field values.
#include <zephyr/bluetooth/services/ots.h>
Enumerator | |
---|---|
BT_OTS_OACP_WRITE_OP_MODE_NONE | |
BT_OTS_OACP_WRITE_OP_MODE_TRUNCATE |
int bt_ots_client_decode_dirlisting | ( | uint8_t * | data, |
uint16_t | length, | ||
bt_ots_client_dirlisting_cb | cb ) |
#include <zephyr/bluetooth/services/ots.h>
Decode Directory Listing object into object metadata.
If the Directory Listing object contains multiple objects, then the callback will be called for each of them.
data | The data received for the directory listing object. |
length | Length of the data. |
cb | The callback that will be called for each object. |
int bt_ots_client_get_object_checksum | ( | struct bt_ots_client * | otc_inst, |
struct bt_conn * | conn, | ||
off_t | offset, | ||
size_t | len ) |
#include <zephyr/bluetooth/services/ots.h>
Get the checksum of the current selected object.
This will trigger an OACP calculate checksum operation for the current object with a specified offset and length.
The checksum goes to OACP IND and obj_checksum_calculated() callback.
otc_inst | Pointer to the OTC instance. |
conn | Pointer to the connection object. |
offset | Offset to calculate, usually 0. |
len | Len of data to calculate checksum for. May be less than the current object's size, but shall not be larger. |
uint8_t bt_ots_client_indicate_handler | ( | struct bt_conn * | conn, |
struct bt_gatt_subscribe_params * | params, | ||
const void * | data, | ||
uint16_t | length ) |
#include <zephyr/bluetooth/services/ots.h>
OTS Indicate Handler function.
Set this function as callback for indicate handler when discovering OTS.
conn | Connection object. May be NULL, indicating that the peer is being unpaired. |
params | Subscription parameters. |
data | Attribute value data. If NULL then subscription was removed. |
length | Attribute value length. |
int bt_ots_client_read_feature | ( | struct bt_ots_client * | otc_inst, |
struct bt_conn * | conn ) |
#include <zephyr/bluetooth/services/ots.h>
Read the OTS feature characteristic.
otc_inst | Pointer to the OTC instance. |
conn | Pointer to the connection object. |
int bt_ots_client_read_object_data | ( | struct bt_ots_client * | otc_inst, |
struct bt_conn * | conn ) |
#include <zephyr/bluetooth/services/ots.h>
Read the data of the current selected object.
This will trigger an OACP read operation for the current size of the object with a 0 offset and then expect receiving the content via the L2CAP CoC.
The data of the object are returned in the obj_data_read() callback.
otc_inst | Pointer to the OTC instance. |
conn | Pointer to the connection object. |
int bt_ots_client_read_object_metadata | ( | struct bt_ots_client * | otc_inst, |
struct bt_conn * | conn, | ||
uint8_t | metadata ) |
#include <zephyr/bluetooth/services/ots.h>
Read the metadata of the current object.
The metadata are returned in the obj_metadata_read() callback.
otc_inst | Pointer to the OTC instance. |
conn | Pointer to the connection object. |
metadata | Bitfield (BT_OTS_METADATA_REQ_* ) of the metadata to read. |
int bt_ots_client_register | ( | struct bt_ots_client * | ots_inst | ) |
#include <zephyr/bluetooth/services/ots.h>
Register an Object Transfer Service Instance.
Register an Object Transfer Service instance discovered on the peer. Call this function when an OTS instance is discovered (discovery is to be handled by the higher layer).
[in] | ots_inst | Discovered OTS instance. |
int bt_ots_client_select_first | ( | struct bt_ots_client * | otc_inst, |
struct bt_conn * | conn ) |
#include <zephyr/bluetooth/services/ots.h>
Select the first object.
otc_inst | Pointer to the OTC instance. |
conn | Pointer to the connection object. |
int bt_ots_client_select_id | ( | struct bt_ots_client * | otc_inst, |
struct bt_conn * | conn, | ||
uint64_t | obj_id ) |
#include <zephyr/bluetooth/services/ots.h>
Select an object by its Object ID.
otc_inst | Pointer to the OTC instance. |
conn | Pointer to the connection object. |
obj_id | Object's ID. |
int bt_ots_client_select_last | ( | struct bt_ots_client * | otc_inst, |
struct bt_conn * | conn ) |
#include <zephyr/bluetooth/services/ots.h>
Select the last object.
otc_inst | Pointer to the OTC instance. |
conn | Pointer to the connection object. |
int bt_ots_client_select_next | ( | struct bt_ots_client * | otc_inst, |
struct bt_conn * | conn ) |
#include <zephyr/bluetooth/services/ots.h>
Select the next object.
otc_inst | Pointer to the OTC instance. |
conn | Pointer to the connection object. |
int bt_ots_client_select_prev | ( | struct bt_ots_client * | otc_inst, |
struct bt_conn * | conn ) |
#include <zephyr/bluetooth/services/ots.h>
Select the previous object.
otc_inst | Pointer to the OTC instance. |
conn | Pointer to the connection object. |
int bt_ots_client_unregister | ( | uint8_t | index | ) |
#include <zephyr/bluetooth/services/ots.h>
Unregister an Object Transfer Service Instance.
Unregister an Object Transfer Service instance when disconnect from the peer. Call this function when an ACL using OTS instance is disconnected.
[in] | index | Index of OTS instance. |
int bt_ots_client_write_object_data | ( | struct bt_ots_client * | otc_inst, |
struct bt_conn * | conn, | ||
const void * | buf, | ||
size_t | len, | ||
off_t | offset, | ||
enum bt_ots_oacp_write_op_mode | mode ) |
#include <zephyr/bluetooth/services/ots.h>
Write the data of the current selected object.
This will trigger an OACP write operation for the current object with a specified offset and then expect transferring the content via the L2CAP CoC.
The length of the data written to object is returned in the obj_data_written() callback.
otc_inst | Pointer to the OTC instance. |
conn | Pointer to the connection object. |
buf | Pointer to the data buffer to be written. |
len | Size of data. |
offset | Offset to write, usually 0. |
mode | Mode Parameter for OACP Write Op Code. See bt_ots_oacp_write_op_mode. |
struct bt_ots * bt_ots_free_instance_get | ( | void | ) |
#include <zephyr/bluetooth/services/ots.h>
Get a free instance of OTS from the pool.
int bt_ots_init | ( | struct bt_ots * | ots, |
struct bt_ots_init_param * | ots_init ) |
#include <zephyr/bluetooth/services/ots.h>
Initialize the OTS instance.
ots | OTS instance. |
ots_init | OTS initialization descriptor. |
void bt_ots_metadata_display | ( | struct bt_ots_obj_metadata * | metadata, |
uint16_t | count ) |
#include <zephyr/bluetooth/services/ots.h>
Displays one or more object metadata as text with LOG_INF.
metadata | Pointer to the first (or only) metadata in an array. |
count | Number of metadata objects to display information of. |
int bt_ots_obj_add | ( | struct bt_ots * | ots, |
const struct bt_ots_obj_add_param * | param ) |
#include <zephyr/bluetooth/services/ots.h>
Add an object to the OTS instance.
This function adds an object to the OTS database. When the object is being added, a callback obj_created() is called to notify the user about a new object ID.
ots | OTS instance. |
param | Object addition parameters. |
int bt_ots_obj_delete | ( | struct bt_ots * | ots, |
uint64_t | id ) |
#include <zephyr/bluetooth/services/ots.h>
Delete an object from the OTS instance.
This function deletes an object from the OTS database. When the object is deleted a callback obj_deleted() is called to notify the user about this event. At this point, it is possible to free allocated buffer for object data.
ots | OTS instance. |
id | ID of the object to be deleted (uint48). |
#include <zephyr/bluetooth/services/ots.h>
Converts binary OTS Object ID to string.
obj_id | Object ID. |
str | Address of user buffer with enough room to store formatted string containing binary Object ID. |
len | Length of data to be copied to user string buffer. Refer to BT_OTS_OBJ_ID_STR_LEN about recommended value. |
void * bt_ots_svc_decl_get | ( | struct bt_ots * | ots | ) |
#include <zephyr/bluetooth/services/ots.h>
Get the service declaration attribute.
This function is enabled for CONFIG_BT_OTS_SECONDARY_SVC configuration. The first service attribute can be included in any other GATT service.
ots | OTS instance. |