Skip to content

Commit 04232fe

Browse files
Thalleynashif
authored andcommitted
Bluetooth: Audio: Append bt_ for everything defined in vocs_internal
Was requested in the review for ed2162c but was merged before it could be fixed. Signed-off-by: Emil Gydesen <[email protected]>
1 parent 2a42ebc commit 04232fe

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

subsys/bluetooth/audio/vocs.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define LOG_MODULE_NAME bt_vocs
2424
#include "common/log.h"
2525

26-
#define VALID_VOCS_OPCODE(opcode) ((opcode) == VOCS_OPCODE_SET_OFFSET)
26+
#define VALID_VOCS_OPCODE(opcode) ((opcode) == BT_VOCS_OPCODE_SET_OFFSET)
2727

2828
#if defined(CONFIG_BT_VOCS)
2929
static void offset_state_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
@@ -34,7 +34,7 @@ static void offset_state_cfg_changed(const struct bt_gatt_attr *attr, uint16_t v
3434
static ssize_t read_offset_state(struct bt_conn *conn, const struct bt_gatt_attr *attr,
3535
void *buf, uint16_t len, uint16_t offset)
3636
{
37-
struct vocs_server *inst = attr->user_data;
37+
struct bt_vocs_server *inst = attr->user_data;
3838

3939
BT_DBG("offset %d, counter %u", inst->state.offset, inst->state.change_counter);
4040
return bt_gatt_attr_read(conn, attr, buf, len, offset, &inst->state, sizeof(inst->state));
@@ -50,7 +50,7 @@ static void location_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value
5050
static ssize_t write_location(struct bt_conn *conn, const struct bt_gatt_attr *attr,
5151
const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
5252
{
53-
struct vocs_server *inst = attr->user_data;
53+
struct bt_vocs_server *inst = attr->user_data;
5454
uint32_t old_location = inst->location;
5555

5656
if (len != sizeof(inst->location)) {
@@ -76,7 +76,7 @@ static ssize_t write_location(struct bt_conn *conn, const struct bt_gatt_attr *a
7676
static ssize_t read_location(struct bt_conn *conn, const struct bt_gatt_attr *attr,
7777
void *buf, uint16_t len, uint16_t offset)
7878
{
79-
struct vocs_server *inst = attr->user_data;
79+
struct bt_vocs_server *inst = attr->user_data;
8080

8181
BT_DBG("0x%02x", inst->location);
8282
return bt_gatt_attr_read(conn, attr, buf, len, offset, &inst->location,
@@ -87,8 +87,8 @@ static ssize_t read_location(struct bt_conn *conn, const struct bt_gatt_attr *at
8787
static ssize_t write_vocs_control(struct bt_conn *conn, const struct bt_gatt_attr *attr,
8888
const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
8989
{
90-
struct vocs_server *inst = attr->user_data;
91-
const struct vocs_control_t *cp = buf;
90+
struct bt_vocs_server *inst = attr->user_data;
91+
const struct bt_vocs_control *cp = buf;
9292
bool notify = false;
9393

9494
if (!len || !buf) {
@@ -105,7 +105,7 @@ static ssize_t write_vocs_control(struct bt_conn *conn, const struct bt_gatt_att
105105
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
106106
}
107107

108-
if (len != sizeof(struct vocs_control_t)) {
108+
if (len != sizeof(struct bt_vocs_control)) {
109109
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
110110
}
111111

@@ -117,7 +117,7 @@ static ssize_t write_vocs_control(struct bt_conn *conn, const struct bt_gatt_att
117117
}
118118

119119
switch (cp->opcode) {
120-
case VOCS_OPCODE_SET_OFFSET:
120+
case BT_VOCS_OPCODE_SET_OFFSET:
121121
BT_DBG("Set offset %d", cp->offset);
122122
if (cp->offset > BT_VOCS_MAX_OFFSET || cp->offset < BT_VOCS_MIN_OFFSET) {
123123
return BT_GATT_ERR(BT_VOCS_ERR_OUT_OF_RANGE);
@@ -158,7 +158,7 @@ static void output_desc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t va
158158
static ssize_t write_output_desc(struct bt_conn *conn, const struct bt_gatt_attr *attr,
159159
const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
160160
{
161-
struct vocs_server *inst = attr->user_data;
161+
struct bt_vocs_server *inst = attr->user_data;
162162

163163
if (len >= sizeof(inst->output_desc)) {
164164
BT_DBG("Output desc was clipped from length %u to %zu",
@@ -188,7 +188,7 @@ static ssize_t write_output_desc(struct bt_conn *conn, const struct bt_gatt_attr
188188
static ssize_t read_output_desc(struct bt_conn *conn, const struct bt_gatt_attr *attr,
189189
void *buf, uint16_t len, uint16_t offset)
190190
{
191-
struct vocs_server *inst = attr->user_data;
191+
struct bt_vocs_server *inst = attr->user_data;
192192

193193
BT_DBG("%s", log_strdup(inst->output_desc));
194194
return bt_gatt_attr_read(conn, attr, buf, len, offset, &inst->output_desc,
@@ -221,7 +221,7 @@ static ssize_t read_output_desc(struct bt_conn *conn, const struct bt_gatt_attr
221221
BT_GATT_PERM_READ | BT_GATT_PERM_WRITE_ENCRYPT) \
222222
}
223223

224-
static struct vocs_server vocs_insts[CONFIG_BT_VOCS_MAX_INSTANCE_COUNT];
224+
static struct bt_vocs_server vocs_insts[CONFIG_BT_VOCS_MAX_INSTANCE_COUNT];
225225
BT_GATT_SERVICE_INSTANCE_DEFINE(vocs_service_list, vocs_insts, CONFIG_BT_VOCS_MAX_INSTANCE_COUNT,
226226
BT_VOCS_SERVICE_DEFINITION);
227227

@@ -404,10 +404,10 @@ int bt_vocs_state_set(struct bt_conn *conn, struct bt_vocs *inst, int16_t offset
404404
return bt_vocs_client_state_set(conn, inst, offset);
405405
} else if (IS_ENABLED(CONFIG_BT_VOCS) && !conn) {
406406
struct bt_gatt_attr attr;
407-
struct vocs_control_t cp;
407+
struct bt_vocs_control cp;
408408
int err;
409409

410-
cp.opcode = VOCS_OPCODE_SET_OFFSET;
410+
cp.opcode = BT_VOCS_OPCODE_SET_OFFSET;
411411
cp.counter = inst->srv.state.change_counter;
412412
cp.offset = sys_cpu_to_le16(offset);
413413

subsys/bluetooth/audio/vocs_client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ static uint8_t vocs_discover_func(struct bt_conn *conn, const struct bt_gatt_att
318318
struct bt_gatt_discover_params *params)
319319
{
320320
struct bt_vocs *inst = (struct bt_vocs *)CONTAINER_OF(
321-
params, struct vocs_client, discover_params);
321+
params, struct bt_vocs_client, discover_params);
322322

323323
if (!attr) {
324324
BT_DBG("Discovery complete for VOCS %p", inst);
@@ -514,7 +514,7 @@ int bt_vocs_client_state_set(struct bt_conn *conn, struct bt_vocs *inst, int16_t
514514
return -EBUSY;
515515
}
516516

517-
inst->cli.cp.opcode = VOCS_OPCODE_SET_OFFSET;
517+
inst->cli.cp.opcode = BT_VOCS_OPCODE_SET_OFFSET;
518518
inst->cli.cp.counter = inst->cli.state.change_counter;
519519
inst->cli.cp.offset = offset;
520520

subsys/bluetooth/audio/vocs_internal.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@
1111
#include <zephyr/types.h>
1212

1313
#if defined(CONFIG_BT_VOCS)
14-
#define VOCS_MAX_DESC_SIZE CONFIG_BT_VOCS_MAX_OUTPUT_DESCRIPTION_SIZE
14+
#define BT_VOCS_MAX_DESC_SIZE CONFIG_BT_VOCS_MAX_OUTPUT_DESCRIPTION_SIZE
1515
#else
16-
#define VOCS_MAX_DESC_SIZE 1
16+
#define BT_VOCS_MAX_DESC_SIZE 1
1717
#endif /* CONFIG_BT_VOCS */
1818

1919
/* VOCS opcodes */
20-
#define VOCS_OPCODE_SET_OFFSET 0x01
20+
#define BT_VOCS_OPCODE_SET_OFFSET 0x01
2121

22-
struct vocs_control_t {
22+
struct bt_vocs_control {
2323
uint8_t opcode;
2424
uint8_t counter;
2525
int16_t offset;
2626
} __packed;
2727

28-
struct vocs_state_t {
28+
struct bt_vocs_state {
2929
int16_t offset;
3030
uint8_t change_counter;
3131
} __packed;
3232

33-
struct vocs_client {
34-
struct vocs_state_t state;
33+
struct bt_vocs_client {
34+
struct bt_vocs_state state;
3535
bool location_writable;
3636
uint32_t location;
3737
bool desc_writable;
@@ -49,28 +49,28 @@ struct vocs_client {
4949
uint8_t subscribe_cnt;
5050

5151
bool busy;
52-
struct vocs_control_t cp;
52+
struct bt_vocs_control cp;
5353
struct bt_gatt_write_params write_params;
5454
struct bt_gatt_read_params read_params;
5555
struct bt_vocs_cb *cb;
5656
struct bt_gatt_discover_params discover_params;
5757
struct bt_conn *conn;
5858
};
5959

60-
struct vocs_server {
61-
struct vocs_state_t state;
60+
struct bt_vocs_server {
61+
struct bt_vocs_state state;
6262
uint32_t location;
6363
bool initialized;
64-
char output_desc[VOCS_MAX_DESC_SIZE];
64+
char output_desc[BT_VOCS_MAX_DESC_SIZE];
6565
struct bt_vocs_cb *cb;
6666

6767
struct bt_gatt_service *service_p;
6868
};
6969

7070
struct bt_vocs {
7171
union {
72-
struct vocs_server srv;
73-
struct vocs_client cli;
72+
struct bt_vocs_server srv;
73+
struct bt_vocs_client cli;
7474
};
7575
};
7676

0 commit comments

Comments
 (0)