Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
vocs.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VOCS_H_
8#define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VOCS_H_
9
29#include <stdint.h>
30#include <stdbool.h>
31
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
39#define BT_VOCS_ERR_INVALID_COUNTER 0x80
40#define BT_VOCS_ERR_OP_NOT_SUPPORTED 0x81
41#define BT_VOCS_ERR_OUT_OF_RANGE 0x82
42
43#define BT_VOCS_MIN_OFFSET -255
44#define BT_VOCS_MAX_OFFSET 255
45
47struct bt_vocs;
48
53
56
59
62
65
67 struct bt_vocs_cb *cb;
68};
69
84};
85
91struct bt_vocs *bt_vocs_free_instance_get(void);
92
102void *bt_vocs_svc_decl_get(struct bt_vocs *vocs);
103
115int bt_vocs_client_conn_get(const struct bt_vocs *vocs, struct bt_conn **conn);
116
125int bt_vocs_register(struct bt_vocs *vocs,
126 const struct bt_vocs_register_param *param);
127
139typedef void (*bt_vocs_state_cb)(struct bt_vocs *inst, int err, int16_t offset);
140
148typedef void (*bt_vocs_set_offset_cb)(struct bt_vocs *inst, int err);
149
161typedef void (*bt_vocs_location_cb)(struct bt_vocs *inst, int err,
162 uint32_t location);
163
175typedef void (*bt_vocs_description_cb)(struct bt_vocs *inst, int err,
176 char *description);
177
190typedef void (*bt_vocs_discover_cb)(struct bt_vocs *inst, int err);
191
196
197#if defined(CONFIG_BT_VOCS_CLIENT)
198 /* Client only */
199 bt_vocs_discover_cb discover;
200 bt_vocs_set_offset_cb set_offset;
201#endif /* CONFIG_BT_VOCS_CLIENT */
202};
203
213int bt_vocs_state_get(struct bt_vocs *inst);
214
223int bt_vocs_state_set(struct bt_vocs *inst, int16_t offset);
224
234int bt_vocs_location_get(struct bt_vocs *inst);
235
244int bt_vocs_location_set(struct bt_vocs *inst, uint32_t location);
245
255int bt_vocs_description_get(struct bt_vocs *inst);
256
265int bt_vocs_description_set(struct bt_vocs *inst, const char *description);
266
273void bt_vocs_client_cb_register(struct bt_vocs *inst, struct bt_vocs_cb *cb);
274
281
293int bt_vocs_discover(struct bt_conn *conn, struct bt_vocs *inst,
294 const struct bt_vocs_discover_param *param);
295
296#ifdef __cplusplus
297}
298#endif
299
304#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:148
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:161
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:139
void(* bt_vocs_description_cb)(struct bt_vocs *inst, int err, char *description)
Callback function for the description.
Definition: vocs.h:175
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:190
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
Definition: vocs.h:192
bt_vocs_location_cb location
Definition: vocs.h:194
bt_vocs_description_cb description
Definition: vocs.h:195
bt_vocs_state_cb state
Definition: vocs.h:193
Structure for discovering a Volume Offset Control Service instance.
Definition: vocs.h:71
uint16_t end_handle
The end handle of the discovering.
Definition: vocs.h:83
uint16_t start_handle
The start handle of the discovering.
Definition: vocs.h:77
Structure for registering a Volume Offset Control Service instance.
Definition: vocs.h:50
uint32_t location
Audio Location bitmask.
Definition: vocs.h:52
char * output_desc
Initial audio output description.
Definition: vocs.h:61
struct bt_vocs_cb * cb
Pointer to the callback structure.
Definition: vocs.h:67
bool location_writable
Boolean to set whether the location is writable by clients.
Definition: vocs.h:55
bool desc_writable
Boolean to set whether the description is writable by clients.
Definition: vocs.h:64
int16_t offset
Initial volume offset (-255 to 255)
Definition: vocs.h:58