Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ots.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/sys/util.h>
#include <zephyr/sys/crc.h>
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/uuid.h>
#include <zephyr/bluetooth/gatt.h>

Go to the source code of this file.

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.