7#ifndef ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_OTS_H_
8#define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_OTS_H_
32#define BT_OTS_OBJ_ID_SIZE 6
35#define BT_OTS_OBJ_ID_MIN 0x000000000100
38#define BT_OTS_OBJ_ID_MAX 0xFFFFFFFFFFFF
41#define OTS_OBJ_ID_DIR_LIST 0x000000000000
44#define BT_OTS_OBJ_ID_MASK BIT64_MASK(48)
47#define BT_OTS_OBJ_ID_STR_LEN 15
101#define BT_OTS_OBJ_SET_PROP_DELETE(prop) \
102 WRITE_BIT(prop, BT_OTS_OBJ_PROP_DELETE, 1)
108#define BT_OTS_OBJ_SET_PROP_EXECUTE(prop) \
109 WRITE_BIT(prop, BT_OTS_OBJ_PROP_EXECUTE, 1)
115#define BT_OTS_OBJ_SET_PROP_READ(prop) \
116 WRITE_BIT(prop, BT_OTS_OBJ_PROP_READ, 1)
122#define BT_OTS_OBJ_SET_PROP_WRITE(prop) \
123 WRITE_BIT(prop, BT_OTS_OBJ_PROP_WRITE, 1)
129#define BT_OTS_OBJ_SET_PROP_APPEND(prop) \
130 WRITE_BIT(prop, BT_OTS_OBJ_PROP_APPEND, 1)
136#define BT_OTS_OBJ_SET_PROP_TRUNCATE(prop) \
137 WRITE_BIT(prop, BT_OTS_OBJ_PROP_TRUNCATE, 1)
143#define BT_OTS_OBJ_SET_PROP_PATCH(prop) \
144 WRITE_BIT(prop, BT_OTS_OBJ_PROP_PATCH, 1)
150#define BT_OTS_OBJ_SET_PROP_MARKED(prop) \
151 WRITE_BIT(prop, BT_OTS_OBJ_PROP_MARKED, 1)
157#define BT_OTS_OBJ_GET_PROP_DELETE(prop) \
158 ((prop) & BIT(BT_OTS_OBJ_PROP_DELETE))
164#define BT_OTS_OBJ_GET_PROP_EXECUTE(prop) \
165 ((prop) & BIT(BT_OTS_OBJ_PROP_EXECUTE))
171#define BT_OTS_OBJ_GET_PROP_READ(prop) \
172 ((prop) & BIT(BT_OTS_OBJ_PROP_READ))
178#define BT_OTS_OBJ_GET_PROP_WRITE(prop) \
179 ((prop) & BIT(BT_OTS_OBJ_PROP_WRITE))
185#define BT_OTS_OBJ_GET_PROP_APPEND(prop) \
186 ((prop) & BIT(BT_OTS_OBJ_PROP_APPEND))
192#define BT_OTS_OBJ_GET_PROP_TRUNCATE(prop) \
193 ((prop) & BIT(BT_OTS_OBJ_PROP_TRUNCATE))
199#define BT_OTS_OBJ_GET_PROP_PATCH(prop) \
200 ((prop) & BIT(BT_OTS_OBJ_PROP_PATCH))
206#define BT_OTS_OBJ_GET_PROP_MARKED(prop) \
207 ((prop) & BIT(BT_OTS_OBJ_PROP_MARKED))
270#define BT_OTS_OACP_SET_FEAT_CREATE(feat) \
271 WRITE_BIT(feat, BT_OTS_OACP_FEAT_CREATE, 1)
277#define BT_OTS_OACP_SET_FEAT_DELETE(feat) \
278 WRITE_BIT(feat, BT_OTS_OACP_FEAT_DELETE, 1)
284#define BT_OTS_OACP_SET_FEAT_CHECKSUM(feat) \
285 WRITE_BIT(feat, BT_OTS_OACP_FEAT_CHECKSUM, 1)
291#define BT_OTS_OACP_SET_FEAT_EXECUTE(feat) \
292 WRITE_BIT(feat, BT_OTS_OACP_FEAT_EXECUTE, 1)
298#define BT_OTS_OACP_SET_FEAT_READ(feat) \
299 WRITE_BIT(feat, BT_OTS_OACP_FEAT_READ, 1)
305#define BT_OTS_OACP_SET_FEAT_WRITE(feat) \
306 WRITE_BIT(feat, BT_OTS_OACP_FEAT_WRITE, 1)
312#define BT_OTS_OACP_SET_FEAT_APPEND(feat) \
313 WRITE_BIT(feat, BT_OTS_OACP_FEAT_APPEND, 1)
319#define BT_OTS_OACP_SET_FEAT_TRUNCATE(feat) \
320 WRITE_BIT(feat, BT_OTS_OACP_FEAT_TRUNCATE, 1)
326#define BT_OTS_OACP_SET_FEAT_PATCH(feat) \
327 WRITE_BIT(feat, BT_OTS_OACP_FEAT_PATCH, 1)
333#define BT_OTS_OACP_SET_FEAT_ABORT(feat) \
334 WRITE_BIT(feat, BT_OTS_OACP_FEAT_ABORT, 1)
340#define BT_OTS_OACP_GET_FEAT_CREATE(feat) \
341 ((feat) & BIT(BT_OTS_OACP_FEAT_CREATE))
347#define BT_OTS_OACP_GET_FEAT_DELETE(feat) \
348 ((feat) & BIT(BT_OTS_OACP_FEAT_DELETE))
354#define BT_OTS_OACP_GET_FEAT_CHECKSUM(feat) \
355 ((feat) & BIT(BT_OTS_OACP_FEAT_CHECKSUM))
361#define BT_OTS_OACP_GET_FEAT_EXECUTE(feat) \
362 ((feat) & BIT(BT_OTS_OACP_FEAT_EXECUTE))
368#define BT_OTS_OACP_GET_FEAT_READ(feat) \
369 ((feat) & BIT(BT_OTS_OACP_FEAT_READ))
375#define BT_OTS_OACP_GET_FEAT_WRITE(feat) \
376 ((feat) & BIT(BT_OTS_OACP_FEAT_WRITE))
382#define BT_OTS_OACP_GET_FEAT_APPEND(feat) \
383 ((feat) & BIT(BT_OTS_OACP_FEAT_APPEND))
389#define BT_OTS_OACP_GET_FEAT_TRUNCATE(feat) \
390 ((feat) & BIT(BT_OTS_OACP_FEAT_TRUNCATE))
396#define BT_OTS_OACP_GET_FEAT_PATCH(feat) \
397 ((feat) & BIT(BT_OTS_OACP_FEAT_PATCH))
403#define BT_OTS_OACP_GET_FEAT_ABORT(feat) \
404 ((feat) & BIT(BT_OTS_OACP_FEAT_ABORT))
425#define BT_OTS_OLCP_SET_FEAT_GO_TO(feat) \
426 WRITE_BIT(feat, BT_OTS_OLCP_FEAT_GO_TO, 1)
432#define BT_OTS_OLCP_SET_FEAT_ORDER(feat) \
433 WRITE_BIT(feat, BT_OTS_OLCP_FEAT_ORDER, 1)
439#define BT_OTS_OLCP_SET_FEAT_NUM_REQ(feat) \
440 WRITE_BIT(feat, BT_OTS_OLCP_FEAT_NUM_REQ, 1)
446#define BT_OTS_OLCP_SET_FEAT_CLEAR(feat) \
447 WRITE_BIT(feat, BT_OTS_OLCP_FEAT_CLEAR, 1)
453#define BT_OTS_OLCP_GET_FEAT_GO_TO(feat) \
454 ((feat) & BIT(BT_OTS_OLCP_FEAT_GO_TO))
460#define BT_OTS_OLCP_GET_FEAT_ORDER(feat) \
461 ((feat) & BIT(BT_OTS_OLCP_FEAT_ORDER))
467#define BT_OTS_OLCP_GET_FEAT_NUM_REQ(feat) \
468 ((feat) & BIT(BT_OTS_OLCP_FEAT_NUM_REQ))
474#define BT_OTS_OLCP_GET_FEAT_CLEAR(feat) \
475 ((feat) & BIT(BT_OTS_OLCP_FEAT_CLEAR))
590 const void *
data,
size_t len, off_t offset,
687 return snprintk(str, len,
"0x%02X%02X%02X%02X%02X%02X",
688 id[5],
id[4],
id[3],
id[2],
id[1],
id[0]);
static void sys_put_le48(uint64_t val, uint8_t dst[6])
Put a 48-bit integer as little-endian to arbitrary location.
Definition: byteorder.h:346
Bluetooth connection handling.
void
Definition: eswifi_shell.c:15
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 *ots_init)
Initialize the OTS instance.
static int bt_ots_obj_id_to_str(uint64_t obj_id, char *str, size_t len)
Converts binary OTS Object ID to string.
Definition: ots.h:681
struct bt_ots * bt_ots_free_instance_get(void)
Get a free instance of OTS from the pool.
int bt_ots_obj_add(struct bt_ots *ots, struct bt_ots_obj_metadata *obj_init)
Add an object to the OTS instance.
@ BT_OTS_OACP_FEAT_ABORT
Definition: ots.h:263
@ BT_OTS_OACP_FEAT_DELETE
Definition: ots.h:239
@ BT_OTS_OACP_FEAT_APPEND
Definition: ots.h:254
@ BT_OTS_OACP_FEAT_READ
Definition: ots.h:248
@ BT_OTS_OACP_FEAT_TRUNCATE
Definition: ots.h:257
@ BT_OTS_OACP_FEAT_CHECKSUM
Definition: ots.h:242
@ BT_OTS_OACP_FEAT_WRITE
Definition: ots.h:251
@ BT_OTS_OACP_FEAT_EXECUTE
Definition: ots.h:245
@ BT_OTS_OACP_FEAT_PATCH
Definition: ots.h:260
@ BT_OTS_OACP_FEAT_CREATE
Definition: ots.h:236
@ BT_OTS_OBJ_PROP_MARKED
Definition: ots.h:94
@ BT_OTS_OBJ_PROP_DELETE
Definition: ots.h:66
@ BT_OTS_OBJ_PROP_TRUNCATE
Definition: ots.h:84
@ BT_OTS_OBJ_PROP_APPEND
Bit 4 Appending data to this object is permitted.
Definition: ots.h:81
@ BT_OTS_OBJ_PROP_READ
Definition: ots.h:72
@ BT_OTS_OBJ_PROP_EXECUTE
Definition: ots.h:69
@ BT_OTS_OBJ_PROP_PATCH
Bit 6 Patching this object is permitted.
Definition: ots.h:91
@ BT_OTS_OBJ_PROP_WRITE
Definition: ots.h:75
@ BT_OTS_OLCP_FEAT_ORDER
Definition: ots.h:412
@ BT_OTS_OLCP_FEAT_NUM_REQ
Definition: ots.h:415
@ BT_OTS_OLCP_FEAT_CLEAR
Definition: ots.h:418
@ BT_OTS_OLCP_FEAT_GO_TO
Definition: ots.h:409
__SIZE_TYPE__ ssize_t
Definition: types.h:28
int snprintk(char *str, size_t size, const char *fmt,...)
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT64_TYPE__ uint64_t
Definition: stdint.h:61
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
OTS callback structure.
Definition: ots.h:490
void(* obj_name_written)(struct bt_ots *ots, struct bt_conn *conn, uint64_t id, const char *name)
Object name written callback.
Definition: ots.h:604
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.
Definition: ots.h:559
int(* obj_created)(struct bt_ots *ots, struct bt_conn *conn, uint64_t id, const struct bt_ots_obj_metadata *init)
Object created callback.
Definition: ots.h:510
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.
Definition: ots.h:589
void(* obj_selected)(struct bt_ots *ots, struct bt_conn *conn, uint64_t id)
Object selected callback.
Definition: ots.h:536
void(* obj_deleted)(struct bt_ots *ots, struct bt_conn *conn, uint64_t id)
Object deleted callback.
Definition: ots.h:525
Features of the OTS.
Definition: ots.h:478
uint32_t olcp
Definition: ots.h:483
uint32_t oacp
Definition: ots.h:480
Descriptor for OTS initialization.
Definition: ots.h:609
struct bt_ots_feat features
Definition: ots.h:611
struct bt_ots_cb * cb
Definition: ots.h:614
Descriptor for OTS Object Size parameter.
Definition: ots.h:210
uint32_t cur
Definition: ots.h:212
uint32_t alloc
Definition: ots.h:215
Type of an OTS object.
Definition: ots.h:50
struct bt_uuid uuid
Definition: ots.h:53
struct bt_uuid_16 uuid_16
Definition: ots.h:56
struct bt_uuid_128 uuid_128
Definition: ots.h:59
This is a 'tentative' type and should be used as a pointer only.
Definition: uuid.h:46
static fdata_t data[2]
Definition: test_fifo_contexts.c:15