Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
vocs.h
Go to the documentation of this file.
1
6/*
7 * Copyright (c) 2020-2024 Nordic Semiconductor ASA
8 *
9 * SPDX-License-Identifier: Apache-2.0
10 */
11
12#ifndef ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VOCS_H_
13#define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VOCS_H_
14
35#include <stdint.h>
36#include <stdbool.h>
37
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
52#define BT_VOCS_ERR_INVALID_COUNTER 0x80
54#define BT_VOCS_ERR_OP_NOT_SUPPORTED 0x81
56#define BT_VOCS_ERR_OUT_OF_RANGE 0x82
64#define BT_VOCS_MIN_OFFSET -255
66#define BT_VOCS_MAX_OFFSET 255
70struct bt_vocs;
71
92
108
114struct bt_vocs *bt_vocs_free_instance_get(void);
115
125void *bt_vocs_svc_decl_get(struct bt_vocs *vocs);
126
138int bt_vocs_client_conn_get(const struct bt_vocs *vocs, struct bt_conn **conn);
139
148int bt_vocs_register(struct bt_vocs *vocs,
149 const struct bt_vocs_register_param *param);
150
162typedef void (*bt_vocs_state_cb)(struct bt_vocs *inst, int err, int16_t offset);
163
171typedef void (*bt_vocs_set_offset_cb)(struct bt_vocs *inst, int err);
172
184typedef void (*bt_vocs_location_cb)(struct bt_vocs *inst, int err,
185 uint32_t location);
186
198typedef void (*bt_vocs_description_cb)(struct bt_vocs *inst, int err,
199 char *description);
200
213typedef void (*bt_vocs_discover_cb)(struct bt_vocs *inst, int err);
214
228
229#if defined(CONFIG_BT_VOCS_CLIENT) || defined(__DOXYGEN__)
242#endif /* CONFIG_BT_VOCS_CLIENT */
243};
244
254int bt_vocs_state_get(struct bt_vocs *inst);
255
264int bt_vocs_state_set(struct bt_vocs *inst, int16_t offset);
265
275int bt_vocs_location_get(struct bt_vocs *inst);
276
285int bt_vocs_location_set(struct bt_vocs *inst, uint32_t location);
286
296int bt_vocs_description_get(struct bt_vocs *inst);
297
306int bt_vocs_description_set(struct bt_vocs *inst, const char *description);
307
314void bt_vocs_client_cb_register(struct bt_vocs *inst, struct bt_vocs_cb *cb);
315
322
334int bt_vocs_discover(struct bt_conn *conn, struct bt_vocs *inst,
335 const struct bt_vocs_discover_param *param);
336
337#ifdef __cplusplus
338}
339#endif
340
345#endif /* ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VOCS_H_ */
Bluetooth connection handling.
int bt_vocs_location_set(struct bt_vocs *inst, uint32_t location)
Set the Volume Offset Control Service location.
void(* bt_vocs_set_offset_cb)(struct bt_vocs *inst, int err)
Callback function for setting offset.
Definition vocs.h:171
int bt_vocs_state_set(struct bt_vocs *inst, int16_t offset)
Set the Volume Offset Control Service offset state.
int bt_vocs_discover(struct bt_conn *conn, struct bt_vocs *inst, const struct bt_vocs_discover_param *param)
Discover a Volume Offset Control Service.
struct bt_vocs * bt_vocs_client_free_instance_get(void)
Returns a pointer to a Volume Offset Control Service client instance.
int bt_vocs_state_get(struct bt_vocs *inst)
Read the Volume Offset Control Service offset state.
void(* bt_vocs_location_cb)(struct bt_vocs *inst, int err, uint32_t location)
Callback function for the location.
Definition vocs.h:184
int bt_vocs_location_get(struct bt_vocs *inst)
Read the Volume Offset Control Service location.
void * bt_vocs_svc_decl_get(struct bt_vocs *vocs)
Get the service declaration attribute.
void(* bt_vocs_state_cb)(struct bt_vocs *inst, int err, int16_t offset)
Callback function for the offset state.
Definition vocs.h:162
void(* bt_vocs_description_cb)(struct bt_vocs *inst, int err, char *description)
Callback function for the description.
Definition vocs.h:198
int bt_vocs_description_get(struct bt_vocs *inst)
Read the Volume Offset Control Service output description.
void bt_vocs_client_cb_register(struct bt_vocs *inst, struct bt_vocs_cb *cb)
Registers the callbacks for the Volume Offset Control Service client.
int bt_vocs_register(struct bt_vocs *vocs, const struct bt_vocs_register_param *param)
Register the Volume Offset Control Service instance.
int bt_vocs_description_set(struct bt_vocs *inst, const char *description)
Set the Volume Offset Control Service description.
void(* bt_vocs_discover_cb)(struct bt_vocs *inst, int err)
Callback function for bt_vocs_discover.
Definition vocs.h:213
struct bt_vocs * bt_vocs_free_instance_get(void)
Get a free service instance of Volume Offset Control Service from the pool.
int bt_vocs_client_conn_get(const struct bt_vocs *vocs, struct bt_conn **conn)
Get the connection pointer of a client instance.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT16_TYPE__ int16_t
Definition stdint.h:73
Struct to hold the Volume Offset Control Service callbacks.
Definition vocs.h:221
bt_vocs_set_offset_cb set_offset
The set offset procedure has completed.
Definition vocs.h:241
bt_vocs_discover_cb discover
The discovery procedure has completed.
Definition vocs.h:235
bt_vocs_location_cb location
The location has changed.
Definition vocs.h:225
bt_vocs_description_cb description
The Description has changed.
Definition vocs.h:227
bt_vocs_state_cb state
The offset state has changed.
Definition vocs.h:223
Structure for discovering a Volume Offset Control Service instance.
Definition vocs.h:94
uint16_t end_handle
The end handle of the discovering.
Definition vocs.h:106
uint16_t start_handle
The start handle of the discovering.
Definition vocs.h:100
Structure for registering a Volume Offset Control Service instance.
Definition vocs.h:73
uint32_t location
Audio Location bitmask.
Definition vocs.h:75
char * output_desc
Initial audio output description.
Definition vocs.h:84
struct bt_vocs_cb * cb
Pointer to the callback structure.
Definition vocs.h:90
bool location_writable
Boolean to set whether the location is writable by clients.
Definition vocs.h:78
bool desc_writable
Boolean to set whether the description is writable by clients.
Definition vocs.h:87
int16_t offset
Initial volume offset (-255 to 255)
Definition vocs.h:81