Commit 04232fe1 authored by Emil Gydesen's avatar Emil Gydesen Committed by Anas Nashif
Browse files

Bluetooth: Audio: Append bt_ for everything defined in vocs_internal

Was requested in the review for
ed2162c7

 but was merged before it
could be fixed.
Signed-off-by: default avatarEmil Gydesen <emil.gydesen@nordicsemi.no>
parent 2a42ebc7
No related merge requests found
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#define LOG_MODULE_NAME bt_vocs #define LOG_MODULE_NAME bt_vocs
#include "common/log.h" #include "common/log.h"
#define VALID_VOCS_OPCODE(opcode) ((opcode) == VOCS_OPCODE_SET_OFFSET) #define VALID_VOCS_OPCODE(opcode) ((opcode) == BT_VOCS_OPCODE_SET_OFFSET)
#if defined(CONFIG_BT_VOCS) #if defined(CONFIG_BT_VOCS)
static void offset_state_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value) 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 ...@@ -34,7 +34,7 @@ static void offset_state_cfg_changed(const struct bt_gatt_attr *attr, uint16_t v
static ssize_t read_offset_state(struct bt_conn *conn, const struct bt_gatt_attr *attr, static ssize_t read_offset_state(struct bt_conn *conn, const struct bt_gatt_attr *attr,
void *buf, uint16_t len, uint16_t offset) void *buf, uint16_t len, uint16_t offset)
{ {
struct vocs_server *inst = attr->user_data; struct bt_vocs_server *inst = attr->user_data;
BT_DBG("offset %d, counter %u", inst->state.offset, inst->state.change_counter); BT_DBG("offset %d, counter %u", inst->state.offset, inst->state.change_counter);
return bt_gatt_attr_read(conn, attr, buf, len, offset, &inst->state, sizeof(inst->state)); 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 ...@@ -50,7 +50,7 @@ static void location_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value
static ssize_t write_location(struct bt_conn *conn, const struct bt_gatt_attr *attr, static ssize_t write_location(struct bt_conn *conn, const struct bt_gatt_attr *attr,
const void *buf, uint16_t len, uint16_t offset, uint8_t flags) const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ {
struct vocs_server *inst = attr->user_data; struct bt_vocs_server *inst = attr->user_data;
uint32_t old_location = inst->location; uint32_t old_location = inst->location;
if (len != sizeof(inst->location)) { if (len != sizeof(inst->location)) {
...@@ -76,7 +76,7 @@ static ssize_t write_location(struct bt_conn *conn, const struct bt_gatt_attr *a ...@@ -76,7 +76,7 @@ static ssize_t write_location(struct bt_conn *conn, const struct bt_gatt_attr *a
static ssize_t read_location(struct bt_conn *conn, const struct bt_gatt_attr *attr, static ssize_t read_location(struct bt_conn *conn, const struct bt_gatt_attr *attr,
void *buf, uint16_t len, uint16_t offset) void *buf, uint16_t len, uint16_t offset)
{ {
struct vocs_server *inst = attr->user_data; struct bt_vocs_server *inst = attr->user_data;
BT_DBG("0x%02x", inst->location); BT_DBG("0x%02x", inst->location);
return bt_gatt_attr_read(conn, attr, buf, len, offset, &inst->location, 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 ...@@ -87,8 +87,8 @@ static ssize_t read_location(struct bt_conn *conn, const struct bt_gatt_attr *at
static ssize_t write_vocs_control(struct bt_conn *conn, const struct bt_gatt_attr *attr, static ssize_t write_vocs_control(struct bt_conn *conn, const struct bt_gatt_attr *attr,
const void *buf, uint16_t len, uint16_t offset, uint8_t flags) const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ {
struct vocs_server *inst = attr->user_data; struct bt_vocs_server *inst = attr->user_data;
const struct vocs_control_t *cp = buf; const struct bt_vocs_control *cp = buf;
bool notify = false; bool notify = false;
if (!len || !buf) { if (!len || !buf) {
...@@ -105,7 +105,7 @@ static ssize_t write_vocs_control(struct bt_conn *conn, const struct bt_gatt_att ...@@ -105,7 +105,7 @@ static ssize_t write_vocs_control(struct bt_conn *conn, const struct bt_gatt_att
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
} }
if (len != sizeof(struct vocs_control_t)) { if (len != sizeof(struct bt_vocs_control)) {
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
} }
...@@ -117,7 +117,7 @@ static ssize_t write_vocs_control(struct bt_conn *conn, const struct bt_gatt_att ...@@ -117,7 +117,7 @@ static ssize_t write_vocs_control(struct bt_conn *conn, const struct bt_gatt_att
} }
switch (cp->opcode) { switch (cp->opcode) {
case VOCS_OPCODE_SET_OFFSET: case BT_VOCS_OPCODE_SET_OFFSET:
BT_DBG("Set offset %d", cp->offset); BT_DBG("Set offset %d", cp->offset);
if (cp->offset > BT_VOCS_MAX_OFFSET || cp->offset < BT_VOCS_MIN_OFFSET) { if (cp->offset > BT_VOCS_MAX_OFFSET || cp->offset < BT_VOCS_MIN_OFFSET) {
return BT_GATT_ERR(BT_VOCS_ERR_OUT_OF_RANGE); 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 ...@@ -158,7 +158,7 @@ static void output_desc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t va
static ssize_t write_output_desc(struct bt_conn *conn, const struct bt_gatt_attr *attr, static ssize_t write_output_desc(struct bt_conn *conn, const struct bt_gatt_attr *attr,
const void *buf, uint16_t len, uint16_t offset, uint8_t flags) const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ {
struct vocs_server *inst = attr->user_data; struct bt_vocs_server *inst = attr->user_data;
if (len >= sizeof(inst->output_desc)) { if (len >= sizeof(inst->output_desc)) {
BT_DBG("Output desc was clipped from length %u to %zu", 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 ...@@ -188,7 +188,7 @@ static ssize_t write_output_desc(struct bt_conn *conn, const struct bt_gatt_attr
static ssize_t read_output_desc(struct bt_conn *conn, const struct bt_gatt_attr *attr, static ssize_t read_output_desc(struct bt_conn *conn, const struct bt_gatt_attr *attr,
void *buf, uint16_t len, uint16_t offset) void *buf, uint16_t len, uint16_t offset)
{ {
struct vocs_server *inst = attr->user_data; struct bt_vocs_server *inst = attr->user_data;
BT_DBG("%s", log_strdup(inst->output_desc)); BT_DBG("%s", log_strdup(inst->output_desc));
return bt_gatt_attr_read(conn, attr, buf, len, offset, &inst->output_desc, 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 ...@@ -221,7 +221,7 @@ static ssize_t read_output_desc(struct bt_conn *conn, const struct bt_gatt_attr
BT_GATT_PERM_READ | BT_GATT_PERM_WRITE_ENCRYPT) \ BT_GATT_PERM_READ | BT_GATT_PERM_WRITE_ENCRYPT) \
} }
static struct vocs_server vocs_insts[CONFIG_BT_VOCS_MAX_INSTANCE_COUNT]; static struct bt_vocs_server vocs_insts[CONFIG_BT_VOCS_MAX_INSTANCE_COUNT];
BT_GATT_SERVICE_INSTANCE_DEFINE(vocs_service_list, vocs_insts, CONFIG_BT_VOCS_MAX_INSTANCE_COUNT, BT_GATT_SERVICE_INSTANCE_DEFINE(vocs_service_list, vocs_insts, CONFIG_BT_VOCS_MAX_INSTANCE_COUNT,
BT_VOCS_SERVICE_DEFINITION); BT_VOCS_SERVICE_DEFINITION);
...@@ -404,10 +404,10 @@ int bt_vocs_state_set(struct bt_conn *conn, struct bt_vocs *inst, int16_t offset ...@@ -404,10 +404,10 @@ int bt_vocs_state_set(struct bt_conn *conn, struct bt_vocs *inst, int16_t offset
return bt_vocs_client_state_set(conn, inst, offset); return bt_vocs_client_state_set(conn, inst, offset);
} else if (IS_ENABLED(CONFIG_BT_VOCS) && !conn) { } else if (IS_ENABLED(CONFIG_BT_VOCS) && !conn) {
struct bt_gatt_attr attr; struct bt_gatt_attr attr;
struct vocs_control_t cp; struct bt_vocs_control cp;
int err; int err;
cp.opcode = VOCS_OPCODE_SET_OFFSET; cp.opcode = BT_VOCS_OPCODE_SET_OFFSET;
cp.counter = inst->srv.state.change_counter; cp.counter = inst->srv.state.change_counter;
cp.offset = sys_cpu_to_le16(offset); cp.offset = sys_cpu_to_le16(offset);
......
...@@ -318,7 +318,7 @@ static uint8_t vocs_discover_func(struct bt_conn *conn, const struct bt_gatt_att ...@@ -318,7 +318,7 @@ static uint8_t vocs_discover_func(struct bt_conn *conn, const struct bt_gatt_att
struct bt_gatt_discover_params *params) struct bt_gatt_discover_params *params)
{ {
struct bt_vocs *inst = (struct bt_vocs *)CONTAINER_OF( struct bt_vocs *inst = (struct bt_vocs *)CONTAINER_OF(
params, struct vocs_client, discover_params); params, struct bt_vocs_client, discover_params);
if (!attr) { if (!attr) {
BT_DBG("Discovery complete for VOCS %p", inst); 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 ...@@ -514,7 +514,7 @@ int bt_vocs_client_state_set(struct bt_conn *conn, struct bt_vocs *inst, int16_t
return -EBUSY; return -EBUSY;
} }
inst->cli.cp.opcode = VOCS_OPCODE_SET_OFFSET; inst->cli.cp.opcode = BT_VOCS_OPCODE_SET_OFFSET;
inst->cli.cp.counter = inst->cli.state.change_counter; inst->cli.cp.counter = inst->cli.state.change_counter;
inst->cli.cp.offset = offset; inst->cli.cp.offset = offset;
......
...@@ -11,27 +11,27 @@ ...@@ -11,27 +11,27 @@
#include <zephyr/types.h> #include <zephyr/types.h>
#if defined(CONFIG_BT_VOCS) #if defined(CONFIG_BT_VOCS)
#define VOCS_MAX_DESC_SIZE CONFIG_BT_VOCS_MAX_OUTPUT_DESCRIPTION_SIZE #define BT_VOCS_MAX_DESC_SIZE CONFIG_BT_VOCS_MAX_OUTPUT_DESCRIPTION_SIZE
#else #else
#define VOCS_MAX_DESC_SIZE 1 #define BT_VOCS_MAX_DESC_SIZE 1
#endif /* CONFIG_BT_VOCS */ #endif /* CONFIG_BT_VOCS */
/* VOCS opcodes */ /* VOCS opcodes */
#define VOCS_OPCODE_SET_OFFSET 0x01 #define BT_VOCS_OPCODE_SET_OFFSET 0x01
struct vocs_control_t { struct bt_vocs_control {
uint8_t opcode; uint8_t opcode;
uint8_t counter; uint8_t counter;
int16_t offset; int16_t offset;
} __packed; } __packed;
struct vocs_state_t { struct bt_vocs_state {
int16_t offset; int16_t offset;
uint8_t change_counter; uint8_t change_counter;
} __packed; } __packed;
struct vocs_client { struct bt_vocs_client {
struct vocs_state_t state; struct bt_vocs_state state;
bool location_writable; bool location_writable;
uint32_t location; uint32_t location;
bool desc_writable; bool desc_writable;
...@@ -49,7 +49,7 @@ struct vocs_client { ...@@ -49,7 +49,7 @@ struct vocs_client {
uint8_t subscribe_cnt; uint8_t subscribe_cnt;
bool busy; bool busy;
struct vocs_control_t cp; struct bt_vocs_control cp;
struct bt_gatt_write_params write_params; struct bt_gatt_write_params write_params;
struct bt_gatt_read_params read_params; struct bt_gatt_read_params read_params;
struct bt_vocs_cb *cb; struct bt_vocs_cb *cb;
...@@ -57,11 +57,11 @@ struct vocs_client { ...@@ -57,11 +57,11 @@ struct vocs_client {
struct bt_conn *conn; struct bt_conn *conn;
}; };
struct vocs_server { struct bt_vocs_server {
struct vocs_state_t state; struct bt_vocs_state state;
uint32_t location; uint32_t location;
bool initialized; bool initialized;
char output_desc[VOCS_MAX_DESC_SIZE]; char output_desc[BT_VOCS_MAX_DESC_SIZE];
struct bt_vocs_cb *cb; struct bt_vocs_cb *cb;
struct bt_gatt_service *service_p; struct bt_gatt_service *service_p;
...@@ -69,8 +69,8 @@ struct vocs_server { ...@@ -69,8 +69,8 @@ struct vocs_server {
struct bt_vocs { struct bt_vocs {
union { union {
struct vocs_server srv; struct bt_vocs_server srv;
struct vocs_client cli; struct bt_vocs_client cli;
}; };
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment