Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Object Transfer Service (OTS)

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...
 

Macros

#define BT_OTS_OBJ_ID_SIZE   6
 Size of OTS object ID (in bytes).
 
#define BT_OTS_OBJ_ID_MIN   0x000000000100ULL
 Minimum allowed value for object ID (except ID for directory listing)
 
#define BT_OTS_OBJ_ID_MAX   0xFFFFFFFFFFFFULL
 Maximum allowed value for object ID (except ID for directory listing)
 
#define OTS_OBJ_ID_DIR_LIST   0x000000000000ULL
 ID of the Directory Listing Object.
 
#define BT_OTS_OBJ_ID_MASK   BIT64_MASK(48)
 Mask for OTS object IDs, preserving the 48 bits.
 
#define BT_OTS_OBJ_ID_STR_LEN   15
 Length of OTS object ID string (in bytes).
 
#define BT_OTS_OBJ_SET_PROP_DELETE(prop)
 Set BT_OTS_OBJ_PROP_DELETE property.
 
#define BT_OTS_OBJ_SET_PROP_EXECUTE(prop)
 Set BT_OTS_OBJ_PROP_EXECUTE property.
 
#define BT_OTS_OBJ_SET_PROP_READ(prop)
 Set BT_OTS_OBJ_PROP_READ property.
 
#define BT_OTS_OBJ_SET_PROP_WRITE(prop)
 Set BT_OTS_OBJ_PROP_WRITE property.
 
#define BT_OTS_OBJ_SET_PROP_APPEND(prop)
 Set BT_OTS_OBJ_PROP_APPEND property.
 
#define BT_OTS_OBJ_SET_PROP_TRUNCATE(prop)
 Set BT_OTS_OBJ_PROP_TRUNCATE property.
 
#define BT_OTS_OBJ_SET_PROP_PATCH(prop)
 Set BT_OTS_OBJ_PROP_PATCH property.
 
#define BT_OTS_OBJ_SET_PROP_MARKED(prop)
 Set BT_OTS_OBJ_SET_PROP_MARKED property.
 
#define BT_OTS_OBJ_GET_PROP_DELETE(prop)
 Get BT_OTS_OBJ_PROP_DELETE property.
 
#define BT_OTS_OBJ_GET_PROP_EXECUTE(prop)
 Get BT_OTS_OBJ_PROP_EXECUTE property.
 
#define BT_OTS_OBJ_GET_PROP_READ(prop)
 Get BT_OTS_OBJ_PROP_READ property.
 
#define BT_OTS_OBJ_GET_PROP_WRITE(prop)
 Get BT_OTS_OBJ_PROP_WRITE property.
 
#define BT_OTS_OBJ_GET_PROP_APPEND(prop)
 Get BT_OTS_OBJ_PROP_APPEND property.
 
#define BT_OTS_OBJ_GET_PROP_TRUNCATE(prop)
 Get BT_OTS_OBJ_PROP_TRUNCATE property.
 
#define BT_OTS_OBJ_GET_PROP_PATCH(prop)
 Get BT_OTS_OBJ_PROP_PATCH property.
 
#define BT_OTS_OBJ_GET_PROP_MARKED(prop)
 Get BT_OTS_OBJ_PROP_MARKED property.
 
#define BT_OTS_OACP_SET_FEAT_CREATE(feat)
 Set BT_OTS_OACP_SET_FEAT_CREATE feature.
 
#define BT_OTS_OACP_SET_FEAT_DELETE(feat)
 Set BT_OTS_OACP_FEAT_DELETE feature.
 
#define BT_OTS_OACP_SET_FEAT_CHECKSUM(feat)
 Set BT_OTS_OACP_FEAT_CHECKSUM feature.
 
#define BT_OTS_OACP_SET_FEAT_EXECUTE(feat)
 Set BT_OTS_OACP_FEAT_EXECUTE feature.
 
#define BT_OTS_OACP_SET_FEAT_READ(feat)
 Set BT_OTS_OACP_FEAT_READ feature.
 
#define BT_OTS_OACP_SET_FEAT_WRITE(feat)
 Set BT_OTS_OACP_FEAT_WRITE feature.
 
#define BT_OTS_OACP_SET_FEAT_APPEND(feat)
 Set BT_OTS_OACP_FEAT_APPEND feature.
 
#define BT_OTS_OACP_SET_FEAT_TRUNCATE(feat)
 Set BT_OTS_OACP_FEAT_TRUNCATE feature.
 
#define BT_OTS_OACP_SET_FEAT_PATCH(feat)
 Set BT_OTS_OACP_FEAT_PATCH feature.
 
#define BT_OTS_OACP_SET_FEAT_ABORT(feat)
 Set BT_OTS_OACP_FEAT_ABORT feature.
 
#define BT_OTS_OACP_GET_FEAT_CREATE(feat)
 Get BT_OTS_OACP_FEAT_CREATE feature.
 
#define BT_OTS_OACP_GET_FEAT_DELETE(feat)
 Get BT_OTS_OACP_FEAT_DELETE feature.
 
#define BT_OTS_OACP_GET_FEAT_CHECKSUM(feat)
 Get BT_OTS_OACP_FEAT_CHECKSUM feature.
 
#define BT_OTS_OACP_GET_FEAT_EXECUTE(feat)
 Get BT_OTS_OACP_FEAT_EXECUTE feature.
 
#define BT_OTS_OACP_GET_FEAT_READ(feat)
 Get BT_OTS_OACP_FEAT_READ feature.
 
#define BT_OTS_OACP_GET_FEAT_WRITE(feat)
 Get BT_OTS_OACP_FEAT_WRITE feature.
 
#define BT_OTS_OACP_GET_FEAT_APPEND(feat)
 Get BT_OTS_OACP_FEAT_APPEND feature.
 
#define BT_OTS_OACP_GET_FEAT_TRUNCATE(feat)
 Get BT_OTS_OACP_FEAT_TRUNCATE feature.
 
#define BT_OTS_OACP_GET_FEAT_PATCH(feat)
 Get BT_OTS_OACP_FEAT_PATCH feature.
 
#define BT_OTS_OACP_GET_FEAT_ABORT(feat)
 Get BT_OTS_OACP_FEAT_ABORT feature.
 
#define BT_OTS_OLCP_SET_FEAT_GO_TO(feat)
 Set BT_OTS_OLCP_FEAT_GO_TO feature.
 
#define BT_OTS_OLCP_SET_FEAT_ORDER(feat)
 Set BT_OTS_OLCP_FEAT_ORDER feature.
 
#define BT_OTS_OLCP_SET_FEAT_NUM_REQ(feat)
 Set BT_OTS_OLCP_FEAT_NUM_REQ feature.
 
#define BT_OTS_OLCP_SET_FEAT_CLEAR(feat)
 Set BT_OTS_OLCP_FEAT_CLEAR feature.
 
#define BT_OTS_OLCP_GET_FEAT_GO_TO(feat)
 Get BT_OTS_OLCP_GET_FEAT_GO_TO feature.
 
#define BT_OTS_OLCP_GET_FEAT_ORDER(feat)
 Get BT_OTS_OLCP_GET_FEAT_ORDER feature.
 
#define BT_OTS_OLCP_GET_FEAT_NUM_REQ(feat)
 Get BT_OTS_OLCP_GET_FEAT_NUM_REQ feature.
 
#define BT_OTS_OLCP_GET_FEAT_CLEAR(feat)
 Get BT_OTS_OLCP_GET_FEAT_CLEAR feature.
 
#define BT_OTS_DATE_TIME_FIELD_SIZE   7
 
#define BT_OTS_STOP   0
 
#define BT_OTS_CONTINUE   1
 

Typedefs

typedef int(* bt_ots_client_dirlisting_cb) (struct bt_ots_obj_metadata *meta)
 Directory listing object metadata callback.
 

Enumerations

enum  {
  BT_OTS_OBJ_PROP_DELETE = 0 , BT_OTS_OBJ_PROP_EXECUTE = 1 , BT_OTS_OBJ_PROP_READ = 2 , BT_OTS_OBJ_PROP_WRITE = 3 ,
  BT_OTS_OBJ_PROP_APPEND = 4 , BT_OTS_OBJ_PROP_TRUNCATE = 5 , BT_OTS_OBJ_PROP_PATCH = 6 , BT_OTS_OBJ_PROP_MARKED = 7
}
 Properties of an OTS object. More...
 
enum  {
  BT_OTS_OACP_FEAT_CREATE = 0 , BT_OTS_OACP_FEAT_DELETE = 1 , BT_OTS_OACP_FEAT_CHECKSUM = 2 , BT_OTS_OACP_FEAT_EXECUTE = 3 ,
  BT_OTS_OACP_FEAT_READ = 4 , BT_OTS_OACP_FEAT_WRITE = 5 , BT_OTS_OACP_FEAT_APPEND = 6 , BT_OTS_OACP_FEAT_TRUNCATE = 7 ,
  BT_OTS_OACP_FEAT_PATCH = 8 , BT_OTS_OACP_FEAT_ABORT = 9
}
 Object Action Control Point Feature bits. More...
 
enum  bt_ots_oacp_write_op_mode { BT_OTS_OACP_WRITE_OP_MODE_NONE = 0 , BT_OTS_OACP_WRITE_OP_MODE_TRUNCATE = BIT(1) }
 
enum  { BT_OTS_OLCP_FEAT_GO_TO = 0 , BT_OTS_OLCP_FEAT_ORDER = 1 , BT_OTS_OLCP_FEAT_NUM_REQ = 2 , BT_OTS_OLCP_FEAT_CLEAR = 3 }
 Object List Control Point Feature bits. More...
 
enum  {
  BT_OTS_METADATA_REQ_NAME = BIT(0) , BT_OTS_METADATA_REQ_TYPE = BIT(1) , BT_OTS_METADATA_REQ_SIZE = BIT(2) , BT_OTS_METADATA_REQ_CREATED = BIT(3) ,
  BT_OTS_METADATA_REQ_MODIFIED = BIT(4) , BT_OTS_METADATA_REQ_ID = BIT(5) , BT_OTS_METADATA_REQ_PROPS = BIT(6) , BT_OTS_METADATA_REQ_ALL = 0x7F
}
 Object metadata request bit field values. More...
 

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.
 

Detailed Description

Object Transfer Service (OTS) .

[Experimental] Users should note that the APIs can change as a part of ongoing development.

Macro Definition Documentation

◆ BT_OTS_CONTINUE

#define BT_OTS_CONTINUE   1

◆ BT_OTS_DATE_TIME_FIELD_SIZE

#define BT_OTS_DATE_TIME_FIELD_SIZE   7

◆ BT_OTS_OACP_GET_FEAT_ABORT

#define BT_OTS_OACP_GET_FEAT_ABORT ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OACP_FEAT_ABORT
Bit 9 OACP Abort Op Code Supported.
Definition ots.h:253
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44

Get BT_OTS_OACP_FEAT_ABORT feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_GET_FEAT_APPEND

#define BT_OTS_OACP_GET_FEAT_APPEND ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OACP_FEAT_APPEND
Bit 6 Appending Additional Data to Objects Supported
Definition ots.h:244

Get BT_OTS_OACP_FEAT_APPEND feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_GET_FEAT_CHECKSUM

#define BT_OTS_OACP_GET_FEAT_CHECKSUM ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OACP_FEAT_CHECKSUM
Bit 2 OACP Calculate Checksum Op Code Supported.
Definition ots.h:232

Get BT_OTS_OACP_FEAT_CHECKSUM feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_GET_FEAT_CREATE

#define BT_OTS_OACP_GET_FEAT_CREATE ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OACP_FEAT_CREATE
Bit 0 OACP Create Op Code Supported.
Definition ots.h:226

Get BT_OTS_OACP_FEAT_CREATE feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_GET_FEAT_DELETE

#define BT_OTS_OACP_GET_FEAT_DELETE ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OACP_FEAT_DELETE
Bit 1 OACP Delete Op Code Supported
Definition ots.h:229

Get BT_OTS_OACP_FEAT_DELETE feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_GET_FEAT_EXECUTE

#define BT_OTS_OACP_GET_FEAT_EXECUTE ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OACP_FEAT_EXECUTE
Bit 3 OACP Execute Op Code Supported.
Definition ots.h:235

Get BT_OTS_OACP_FEAT_EXECUTE feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_GET_FEAT_PATCH

#define BT_OTS_OACP_GET_FEAT_PATCH ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OACP_FEAT_PATCH
Bit 8 Patching of Objects Supported
Definition ots.h:250

Get BT_OTS_OACP_FEAT_PATCH feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_GET_FEAT_READ

#define BT_OTS_OACP_GET_FEAT_READ ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OACP_FEAT_READ
Bit 4 OACP Read Op Code Supported.
Definition ots.h:238

Get BT_OTS_OACP_FEAT_READ feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_GET_FEAT_TRUNCATE

#define BT_OTS_OACP_GET_FEAT_TRUNCATE ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OACP_FEAT_TRUNCATE
Bit 7 Truncation of Objects Supported.
Definition ots.h:247

Get BT_OTS_OACP_FEAT_TRUNCATE feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_GET_FEAT_WRITE

#define BT_OTS_OACP_GET_FEAT_WRITE ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OACP_FEAT_WRITE
Bit 5 OACP Write Op Code Supported.
Definition ots.h:241

Get BT_OTS_OACP_FEAT_WRITE feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_SET_FEAT_ABORT

#define BT_OTS_OACP_SET_FEAT_ABORT ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
#define WRITE_BIT(var, bit, set)
Set or clear a bit depending on a boolean value.
Definition util_macro.h:61

Set BT_OTS_OACP_FEAT_ABORT feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_SET_FEAT_APPEND

#define BT_OTS_OACP_SET_FEAT_APPEND ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OACP_FEAT_APPEND feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_SET_FEAT_CHECKSUM

#define BT_OTS_OACP_SET_FEAT_CHECKSUM ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OACP_FEAT_CHECKSUM feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_SET_FEAT_CREATE

#define BT_OTS_OACP_SET_FEAT_CREATE ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OACP_SET_FEAT_CREATE feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_SET_FEAT_DELETE

#define BT_OTS_OACP_SET_FEAT_DELETE ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OACP_FEAT_DELETE feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_SET_FEAT_EXECUTE

#define BT_OTS_OACP_SET_FEAT_EXECUTE ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OACP_FEAT_EXECUTE feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_SET_FEAT_PATCH

#define BT_OTS_OACP_SET_FEAT_PATCH ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OACP_FEAT_PATCH feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_SET_FEAT_READ

#define BT_OTS_OACP_SET_FEAT_READ ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OACP_FEAT_READ feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_SET_FEAT_TRUNCATE

#define BT_OTS_OACP_SET_FEAT_TRUNCATE ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OACP_FEAT_TRUNCATE feature.

Parameters
featOTS features.

◆ BT_OTS_OACP_SET_FEAT_WRITE

#define BT_OTS_OACP_SET_FEAT_WRITE ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OACP_FEAT_WRITE feature.

Parameters
featOTS features.

◆ BT_OTS_OBJ_GET_PROP_APPEND

#define BT_OTS_OBJ_GET_PROP_APPEND ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OBJ_PROP_APPEND
Bit 4 Appending data to this object is permitted.
Definition ots.h:86

Get BT_OTS_OBJ_PROP_APPEND property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_GET_PROP_DELETE

#define BT_OTS_OBJ_GET_PROP_DELETE ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OBJ_PROP_DELETE
Bit 0 Deletion of this object is permitted.
Definition ots.h:71

Get BT_OTS_OBJ_PROP_DELETE property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_GET_PROP_EXECUTE

#define BT_OTS_OBJ_GET_PROP_EXECUTE ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OBJ_PROP_EXECUTE
Bit 1 Execution of this object is permitted.
Definition ots.h:74

Get BT_OTS_OBJ_PROP_EXECUTE property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_GET_PROP_MARKED

#define BT_OTS_OBJ_GET_PROP_MARKED ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OBJ_PROP_MARKED
Bit 7 This object is a marked object.
Definition ots.h:99

Get BT_OTS_OBJ_PROP_MARKED property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_GET_PROP_PATCH

#define BT_OTS_OBJ_GET_PROP_PATCH ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OBJ_PROP_PATCH
Bit 6 Patching this object is permitted.
Definition ots.h:96

Get BT_OTS_OBJ_PROP_PATCH property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_GET_PROP_READ

#define BT_OTS_OBJ_GET_PROP_READ ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OBJ_PROP_READ
Bit 2 Reading this object is permitted.
Definition ots.h:77

Get BT_OTS_OBJ_PROP_READ property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_GET_PROP_TRUNCATE

#define BT_OTS_OBJ_GET_PROP_TRUNCATE ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OBJ_PROP_TRUNCATE
Bit 5 Truncation of this object is permitted.
Definition ots.h:89

Get BT_OTS_OBJ_PROP_TRUNCATE property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_GET_PROP_WRITE

#define BT_OTS_OBJ_GET_PROP_WRITE ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OBJ_PROP_WRITE
Bit 3 Writing data to this object is permitted.
Definition ots.h:80

Get BT_OTS_OBJ_PROP_WRITE property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_ID_MASK

#define BT_OTS_OBJ_ID_MASK   BIT64_MASK(48)

#include <zephyr/bluetooth/services/ots.h>

Mask for OTS object IDs, preserving the 48 bits.

◆ BT_OTS_OBJ_ID_MAX

#define BT_OTS_OBJ_ID_MAX   0xFFFFFFFFFFFFULL

#include <zephyr/bluetooth/services/ots.h>

Maximum allowed value for object ID (except ID for directory listing)

◆ BT_OTS_OBJ_ID_MIN

#define BT_OTS_OBJ_ID_MIN   0x000000000100ULL

#include <zephyr/bluetooth/services/ots.h>

Minimum allowed value for object ID (except ID for directory listing)

◆ BT_OTS_OBJ_ID_SIZE

#define BT_OTS_OBJ_ID_SIZE   6

#include <zephyr/bluetooth/services/ots.h>

Size of OTS object ID (in bytes).

◆ BT_OTS_OBJ_ID_STR_LEN

#define BT_OTS_OBJ_ID_STR_LEN   15

#include <zephyr/bluetooth/services/ots.h>

Length of OTS object ID string (in bytes).

◆ BT_OTS_OBJ_SET_PROP_APPEND

#define BT_OTS_OBJ_SET_PROP_APPEND ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OBJ_PROP_APPEND property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_SET_PROP_DELETE

#define BT_OTS_OBJ_SET_PROP_DELETE ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OBJ_PROP_DELETE property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_SET_PROP_EXECUTE

#define BT_OTS_OBJ_SET_PROP_EXECUTE ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OBJ_PROP_EXECUTE property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_SET_PROP_MARKED

#define BT_OTS_OBJ_SET_PROP_MARKED ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OBJ_SET_PROP_MARKED property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_SET_PROP_PATCH

#define BT_OTS_OBJ_SET_PROP_PATCH ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OBJ_PROP_PATCH property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_SET_PROP_READ

#define BT_OTS_OBJ_SET_PROP_READ ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OBJ_PROP_READ property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_SET_PROP_TRUNCATE

#define BT_OTS_OBJ_SET_PROP_TRUNCATE ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OBJ_PROP_TRUNCATE property.

Parameters
propObject properties.

◆ BT_OTS_OBJ_SET_PROP_WRITE

#define BT_OTS_OBJ_SET_PROP_WRITE ( prop)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OBJ_PROP_WRITE property.

Parameters
propObject properties.

◆ BT_OTS_OLCP_GET_FEAT_CLEAR

#define BT_OTS_OLCP_GET_FEAT_CLEAR ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OLCP_FEAT_CLEAR
Bit 3 OLCP Clear Marking Op Code Supported.
Definition ots.h:417

Get BT_OTS_OLCP_GET_FEAT_CLEAR feature.

Parameters
featOTS features.

◆ BT_OTS_OLCP_GET_FEAT_GO_TO

#define BT_OTS_OLCP_GET_FEAT_GO_TO ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OLCP_FEAT_GO_TO
Bit 0 OLCP Go To Op Code Supported.
Definition ots.h:408

Get BT_OTS_OLCP_GET_FEAT_GO_TO feature.

Parameters
featOTS features.

◆ BT_OTS_OLCP_GET_FEAT_NUM_REQ

#define BT_OTS_OLCP_GET_FEAT_NUM_REQ ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OLCP_FEAT_NUM_REQ
Bit 2 OLCP Request Number of Objects Op Code Supported.
Definition ots.h:414

Get BT_OTS_OLCP_GET_FEAT_NUM_REQ feature.

Parameters
featOTS features.

◆ BT_OTS_OLCP_GET_FEAT_ORDER

#define BT_OTS_OLCP_GET_FEAT_ORDER ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:
@ BT_OTS_OLCP_FEAT_ORDER
Bit 1 OLCP Order Op Code Supported.
Definition ots.h:411

Get BT_OTS_OLCP_GET_FEAT_ORDER feature.

Parameters
featOTS features.

◆ BT_OTS_OLCP_SET_FEAT_CLEAR

#define BT_OTS_OLCP_SET_FEAT_CLEAR ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OLCP_FEAT_CLEAR feature.

Parameters
featOTS features.

◆ BT_OTS_OLCP_SET_FEAT_GO_TO

#define BT_OTS_OLCP_SET_FEAT_GO_TO ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OLCP_FEAT_GO_TO feature.

Parameters
featOTS features.

◆ BT_OTS_OLCP_SET_FEAT_NUM_REQ

#define BT_OTS_OLCP_SET_FEAT_NUM_REQ ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OLCP_FEAT_NUM_REQ feature.

Parameters
featOTS features.

◆ BT_OTS_OLCP_SET_FEAT_ORDER

#define BT_OTS_OLCP_SET_FEAT_ORDER ( feat)

#include <zephyr/bluetooth/services/ots.h>

Value:

Set BT_OTS_OLCP_FEAT_ORDER feature.

Parameters
featOTS features.

◆ BT_OTS_STOP

#define BT_OTS_STOP   0

◆ OTS_OBJ_ID_DIR_LIST

#define OTS_OBJ_ID_DIR_LIST   0x000000000000ULL

#include <zephyr/bluetooth/services/ots.h>

ID of the Directory Listing Object.

Typedef Documentation

◆ bt_ots_client_dirlisting_cb

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.

Parameters
metaThe metadata of the decoded object
Returns
int BT_OTS_STOP or BT_OTS_CONTINUE. BT_OTS_STOP can be used to stop the decoding.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

#include <zephyr/bluetooth/services/ots.h>

Properties of an OTS object.

Enumerator
BT_OTS_OBJ_PROP_DELETE 

Bit 0 Deletion of this object is permitted.

BT_OTS_OBJ_PROP_EXECUTE 

Bit 1 Execution of this object is permitted.

BT_OTS_OBJ_PROP_READ 

Bit 2 Reading this object is permitted.

BT_OTS_OBJ_PROP_WRITE 

Bit 3 Writing data to this object is permitted.

BT_OTS_OBJ_PROP_APPEND 

Bit 4 Appending data to this object is permitted.

Appending data increases its Allocated Size.

BT_OTS_OBJ_PROP_TRUNCATE 

Bit 5 Truncation of this object is permitted.

BT_OTS_OBJ_PROP_PATCH 

Bit 6 Patching this object is permitted.

Patching this object overwrites some of the object's existing contents.

BT_OTS_OBJ_PROP_MARKED 

Bit 7 This object is a marked object.

◆ anonymous enum

anonymous enum

#include <zephyr/bluetooth/services/ots.h>

Object Action Control Point Feature bits.

Enumerator
BT_OTS_OACP_FEAT_CREATE 

Bit 0 OACP Create Op Code Supported.

BT_OTS_OACP_FEAT_DELETE 

Bit 1 OACP Delete Op Code Supported

BT_OTS_OACP_FEAT_CHECKSUM 

Bit 2 OACP Calculate Checksum Op Code Supported.

BT_OTS_OACP_FEAT_EXECUTE 

Bit 3 OACP Execute Op Code Supported.

BT_OTS_OACP_FEAT_READ 

Bit 4 OACP Read Op Code Supported.

BT_OTS_OACP_FEAT_WRITE 

Bit 5 OACP Write Op Code Supported.

BT_OTS_OACP_FEAT_APPEND 

Bit 6 Appending Additional Data to Objects Supported

BT_OTS_OACP_FEAT_TRUNCATE 

Bit 7 Truncation of Objects Supported.

BT_OTS_OACP_FEAT_PATCH 

Bit 8 Patching of Objects Supported

BT_OTS_OACP_FEAT_ABORT 

Bit 9 OACP Abort Op Code Supported.

◆ anonymous enum

anonymous enum

#include <zephyr/bluetooth/services/ots.h>

Object List Control Point Feature bits.

Enumerator
BT_OTS_OLCP_FEAT_GO_TO 

Bit 0 OLCP Go To Op Code Supported.

BT_OTS_OLCP_FEAT_ORDER 

Bit 1 OLCP Order Op Code Supported.

BT_OTS_OLCP_FEAT_NUM_REQ 

Bit 2 OLCP Request Number of Objects Op Code Supported.

BT_OTS_OLCP_FEAT_CLEAR 

Bit 3 OLCP Clear Marking Op Code Supported.

◆ anonymous enum

anonymous enum

#include <zephyr/bluetooth/services/ots.h>

Object metadata request bit field values.

Enumerator
BT_OTS_METADATA_REQ_NAME 

Request object name.

BT_OTS_METADATA_REQ_TYPE 

Request object type.

BT_OTS_METADATA_REQ_SIZE 

Request object size.

BT_OTS_METADATA_REQ_CREATED 

Request object first created time.

BT_OTS_METADATA_REQ_MODIFIED 

Request object last modified time.

BT_OTS_METADATA_REQ_ID 

Request object ID.

BT_OTS_METADATA_REQ_PROPS 

Request object properties.

BT_OTS_METADATA_REQ_ALL 

Request all object metadata.

◆ bt_ots_oacp_write_op_mode

#include <zephyr/bluetooth/services/ots.h>

Enumerator
BT_OTS_OACP_WRITE_OP_MODE_NONE 
BT_OTS_OACP_WRITE_OP_MODE_TRUNCATE 

Function Documentation

◆ bt_ots_client_decode_dirlisting()

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.

Parameters
dataThe data received for the directory listing object.
lengthLength of the data.
cbThe callback that will be called for each object.

◆ bt_ots_client_get_object_checksum()

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.

Parameters
otc_instPointer to the OTC instance.
connPointer to the connection object.
offsetOffset to calculate, usually 0.
lenLen of data to calculate checksum for. May be less than the current object's size, but shall not be larger.
Returns
int 0 if success, ERRNO on failure.

◆ bt_ots_client_indicate_handler()

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.

Parameters
connConnection object. May be NULL, indicating that the peer is being unpaired.
paramsSubscription parameters.
dataAttribute value data. If NULL then subscription was removed.
lengthAttribute value length.

◆ bt_ots_client_read_feature()

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.

Parameters
otc_instPointer to the OTC instance.
connPointer to the connection object.
Returns
int 0 if success, ERRNO on failure.

◆ bt_ots_client_read_object_data()

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.

Parameters
otc_instPointer to the OTC instance.
connPointer to the connection object.
Returns
int 0 if success, ERRNO on failure.

◆ bt_ots_client_read_object_metadata()

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.

Parameters
otc_instPointer to the OTC instance.
connPointer to the connection object.
metadataBitfield (BT_OTS_METADATA_REQ_*) of the metadata to read.
Returns
int 0 if success, ERRNO on failure.

◆ bt_ots_client_register()

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).

Parameters
[in]ots_instDiscovered OTS instance.
Returns
int 0 if success, ERRNO on failure.

◆ bt_ots_client_select_first()

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.

Parameters
otc_instPointer to the OTC instance.
connPointer to the connection object.
Returns
int 0 if success, ERRNO on failure.

◆ bt_ots_client_select_id()

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.

Parameters
otc_instPointer to the OTC instance.
connPointer to the connection object.
obj_idObject's ID.
Returns
int 0 if success, ERRNO on failure.

◆ bt_ots_client_select_last()

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.

Parameters
otc_instPointer to the OTC instance.
connPointer to the connection object.
Returns
int 0 if success, ERRNO on failure.

◆ bt_ots_client_select_next()

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.

Parameters
otc_instPointer to the OTC instance.
connPointer to the connection object.
Returns
int 0 if success, ERRNO on failure.

◆ bt_ots_client_select_prev()

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.

Parameters
otc_instPointer to the OTC instance.
connPointer to the connection object.
Returns
int 0 if success, ERRNO on failure.

◆ bt_ots_client_unregister()

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.

Parameters
[in]indexIndex of OTS instance.
Returns
int 0 if success, ERRNO on failure.

◆ bt_ots_client_write_object_data()

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.

Parameters
otc_instPointer to the OTC instance.
connPointer to the connection object.
bufPointer to the data buffer to be written.
lenSize of data.
offsetOffset to write, usually 0.
modeMode Parameter for OACP Write Op Code. See bt_ots_oacp_write_op_mode.
Returns
int 0 if success, ERRNO on failure.

◆ bt_ots_free_instance_get()

struct bt_ots * bt_ots_free_instance_get ( void )

#include <zephyr/bluetooth/services/ots.h>

Get a free instance of OTS from the pool.

Returns
OTS instance in case of success or NULL in case of error.

◆ bt_ots_init()

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.

Parameters
otsOTS instance.
ots_initOTS initialization descriptor.
Returns
0 in case of success or negative value in case of error.

◆ bt_ots_metadata_display()

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.

Parameters
metadataPointer to the first (or only) metadata in an array.
countNumber of metadata objects to display information of.

◆ bt_ots_obj_add()

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.

Parameters
otsOTS instance.
paramObject addition parameters.
Returns
ID of created object in case of success.
negative value in case of error.

◆ bt_ots_obj_delete()

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.

Parameters
otsOTS instance.
idID of the object to be deleted (uint48).
Returns
0 in case of success or negative value in case of error.

◆ bt_ots_obj_id_to_str()

static int bt_ots_obj_id_to_str ( uint64_t obj_id,
char * str,
size_t len )
inlinestatic

#include <zephyr/bluetooth/services/ots.h>

Converts binary OTS Object ID to string.

Parameters
obj_idObject ID.
strAddress of user buffer with enough room to store formatted string containing binary Object ID.
lenLength of data to be copied to user string buffer. Refer to BT_OTS_OBJ_ID_STR_LEN about recommended value.
Returns
Number of successfully formatted bytes from binary ID.

◆ bt_ots_svc_decl_get()

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.

Parameters
otsOTS instance.
Returns
The first OTS attribute instance.