Bluetooth: Audio: Append bt_ for everything defined in vocs_internal
Was requested in the review for
ed2162c700
but was merged before it
could be fixed.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
2a42ebc743
commit
04232fe1ef
3 changed files with 28 additions and 28 deletions
|
@ -23,7 +23,7 @@
|
|||
#define LOG_MODULE_NAME bt_vocs
|
||||
#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)
|
||||
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
|
|||
static ssize_t read_offset_state(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
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);
|
||||
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
|
|||
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)
|
||||
{
|
||||
struct vocs_server *inst = attr->user_data;
|
||||
struct bt_vocs_server *inst = attr->user_data;
|
||||
uint32_t old_location = 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
|
|||
static ssize_t read_location(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
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);
|
||||
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
|
|||
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)
|
||||
{
|
||||
struct vocs_server *inst = attr->user_data;
|
||||
const struct vocs_control_t *cp = buf;
|
||||
struct bt_vocs_server *inst = attr->user_data;
|
||||
const struct bt_vocs_control *cp = buf;
|
||||
bool notify = false;
|
||||
|
||||
if (!len || !buf) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
if (len != sizeof(struct vocs_control_t)) {
|
||||
if (len != sizeof(struct bt_vocs_control)) {
|
||||
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
|
|||
}
|
||||
|
||||
switch (cp->opcode) {
|
||||
case VOCS_OPCODE_SET_OFFSET:
|
||||
case BT_VOCS_OPCODE_SET_OFFSET:
|
||||
BT_DBG("Set offset %d", cp->offset);
|
||||
if (cp->offset > BT_VOCS_MAX_OFFSET || cp->offset < BT_VOCS_MIN_OFFSET) {
|
||||
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
|
|||
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)
|
||||
{
|
||||
struct vocs_server *inst = attr->user_data;
|
||||
struct bt_vocs_server *inst = attr->user_data;
|
||||
|
||||
if (len >= sizeof(inst->output_desc)) {
|
||||
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
|
|||
static ssize_t read_output_desc(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
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));
|
||||
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
|
|||
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_VOCS_SERVICE_DEFINITION);
|
||||
|
||||
|
@ -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);
|
||||
} else if (IS_ENABLED(CONFIG_BT_VOCS) && !conn) {
|
||||
struct bt_gatt_attr attr;
|
||||
struct vocs_control_t cp;
|
||||
struct bt_vocs_control cp;
|
||||
int err;
|
||||
|
||||
cp.opcode = VOCS_OPCODE_SET_OFFSET;
|
||||
cp.opcode = BT_VOCS_OPCODE_SET_OFFSET;
|
||||
cp.counter = inst->srv.state.change_counter;
|
||||
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
|
|||
struct bt_gatt_discover_params *params)
|
||||
{
|
||||
struct bt_vocs *inst = (struct bt_vocs *)CONTAINER_OF(
|
||||
params, struct vocs_client, discover_params);
|
||||
params, struct bt_vocs_client, discover_params);
|
||||
|
||||
if (!attr) {
|
||||
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
|
|||
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.offset = offset;
|
||||
|
||||
|
|
|
@ -11,27 +11,27 @@
|
|||
#include <zephyr/types.h>
|
||||
|
||||
#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
|
||||
#define VOCS_MAX_DESC_SIZE 1
|
||||
#define BT_VOCS_MAX_DESC_SIZE 1
|
||||
#endif /* CONFIG_BT_VOCS */
|
||||
|
||||
/* 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 counter;
|
||||
int16_t offset;
|
||||
} __packed;
|
||||
|
||||
struct vocs_state_t {
|
||||
struct bt_vocs_state {
|
||||
int16_t offset;
|
||||
uint8_t change_counter;
|
||||
} __packed;
|
||||
|
||||
struct vocs_client {
|
||||
struct vocs_state_t state;
|
||||
struct bt_vocs_client {
|
||||
struct bt_vocs_state state;
|
||||
bool location_writable;
|
||||
uint32_t location;
|
||||
bool desc_writable;
|
||||
|
@ -49,7 +49,7 @@ struct vocs_client {
|
|||
uint8_t subscribe_cnt;
|
||||
|
||||
bool busy;
|
||||
struct vocs_control_t cp;
|
||||
struct bt_vocs_control cp;
|
||||
struct bt_gatt_write_params write_params;
|
||||
struct bt_gatt_read_params read_params;
|
||||
struct bt_vocs_cb *cb;
|
||||
|
@ -57,11 +57,11 @@ struct vocs_client {
|
|||
struct bt_conn *conn;
|
||||
};
|
||||
|
||||
struct vocs_server {
|
||||
struct vocs_state_t state;
|
||||
struct bt_vocs_server {
|
||||
struct bt_vocs_state state;
|
||||
uint32_t location;
|
||||
bool initialized;
|
||||
char output_desc[VOCS_MAX_DESC_SIZE];
|
||||
char output_desc[BT_VOCS_MAX_DESC_SIZE];
|
||||
struct bt_vocs_cb *cb;
|
||||
|
||||
struct bt_gatt_service *service_p;
|
||||
|
@ -69,8 +69,8 @@ struct vocs_server {
|
|||
|
||||
struct bt_vocs {
|
||||
union {
|
||||
struct vocs_server srv;
|
||||
struct vocs_client cli;
|
||||
struct bt_vocs_server srv;
|
||||
struct bt_vocs_client cli;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue