Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
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 <zephyr/types.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
36#define BT_VOCS_ERR_INVALID_COUNTER 0x80
37#define BT_VOCS_ERR_OP_NOT_SUPPORTED 0x81
38#define BT_VOCS_ERR_OUT_OF_RANGE 0x82
39
40#define BT_VOCS_MIN_OFFSET -255
41#define BT_VOCS_MAX_OFFSET 255
42
44struct bt_vocs;
45
50
53
56
59
62
64 struct bt_vocs_cb *cb;
65};
66
81};
82
88struct bt_vocs *bt_vocs_free_instance_get(void);
89
99void *bt_vocs_svc_decl_get(struct bt_vocs *vocs);
100
112int bt_vocs_client_conn_get(const struct bt_vocs *vocs, struct bt_conn **conn);
113
122int bt_vocs_register(struct bt_vocs *vocs,
123 const struct bt_vocs_register_param *param);
124
136typedef void (*bt_vocs_state_cb)(struct bt_vocs *inst, int err, int16_t offset);
137
145typedef void (*bt_vocs_set_offset_cb)(struct bt_vocs *inst, int err);
146
158typedef void (*bt_vocs_location_cb)(struct bt_vocs *inst, int err,
159 uint32_t location);
160
172typedef void (*bt_vocs_description_cb)(struct bt_vocs *inst, int err,
173 char *description);
174
187typedef void (*bt_vocs_discover_cb)(struct bt_vocs *inst, int err);
188
193
194#if defined(CONFIG_BT_VOCS_CLIENT)
195 /* Client only */
196 bt_vocs_discover_cb discover;
197 bt_vocs_set_offset_cb set_offset;
198#endif /* CONFIG_BT_VOCS_CLIENT */
199};
200
210int bt_vocs_state_get(struct bt_vocs *inst);
211
220int bt_vocs_state_set(struct bt_vocs *inst, int16_t offset);
221
231int bt_vocs_location_get(struct bt_vocs *inst);
232
241int bt_vocs_location_set(struct bt_vocs *inst, uint32_t location);
242
252int bt_vocs_description_get(struct bt_vocs *inst);
253
262int bt_vocs_description_set(struct bt_vocs *inst, const char *description);
263
270void bt_vocs_client_cb_register(struct bt_vocs *inst, struct bt_vocs_cb *cb);
271
278
290int bt_vocs_discover(struct bt_conn *conn, struct bt_vocs *inst,
291 const struct bt_vocs_discover_param *param);
292
293#ifdef __cplusplus
294}
295#endif
296
301#endif /* ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VOCS_H_ */
void
Definition: eswifi_shell.c:15
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:145
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:158
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:136
void(* bt_vocs_description_cb)(struct bt_vocs *inst, int err, char *description)
Callback function for the description.
Definition: vocs.h:172
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:187
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:60
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
__INT16_TYPE__ int16_t
Definition: stdint.h:43
Definition: vocs.h:189
bt_vocs_location_cb location
Definition: vocs.h:191
bt_vocs_description_cb description
Definition: vocs.h:192
bt_vocs_state_cb state
Definition: vocs.h:190
Structure for discovering a Volume Offset Control Service instance.
Definition: vocs.h:68
uint16_t end_handle
The end handle of the discovering.
Definition: vocs.h:80
uint16_t start_handle
The start handle of the discovering.
Definition: vocs.h:74
Structure for registering a Volume Offset Control Service instance.
Definition: vocs.h:47
uint32_t location
Definition: vocs.h:49
char * output_desc
Definition: vocs.h:58
struct bt_vocs_cb * cb
Definition: vocs.h:64
bool location_writable
Definition: vocs.h:52
bool desc_writable
Definition: vocs.h:61
int16_t offset
Definition: vocs.h:55