Bluetooth: Audio: Add separate API for MICP mic ctlr
Add a bt_micp_mic_ctlr API that is used only
for the MICP Microphone Controller (Client).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
diff --git a/doc/connectivity/bluetooth/bluetooth-audio-arch.rst b/doc/connectivity/bluetooth/bluetooth-audio-arch.rst
index 3e5b568..9282adb 100644
--- a/doc/connectivity/bluetooth/bluetooth-audio-arch.rst
+++ b/doc/connectivity/bluetooth/bluetooth-audio-arch.rst
@@ -104,7 +104,7 @@
:ref:`Bluetooth Volume Control <bluetooth_volume>`.
The API reference for microphone input control can be found in
-:ref:`Bluetooth Microphone Control <bluetooth_microphone>`.
+:ref:`Bluetooth Microphone Input Control <bluetooth_microphone>`.
Content Control
diff --git a/include/zephyr/bluetooth/audio/micp.h b/include/zephyr/bluetooth/audio/micp.h
index 1937799..a8dc406 100644
--- a/include/zephyr/bluetooth/audio/micp.h
+++ b/include/zephyr/bluetooth/audio/micp.h
@@ -93,8 +93,7 @@
* Microphone Input Control Profile included services instances, such as
* pointers to the Audio Input Control Service instances.
*
- * Requires that @kconfig{CONFIG_BT_MICP_AICS} or
- * @kconfig{CONFIG_BT_MICP_CLIENT_AICS} is enabled.
+ * Requires that @kconfig{CONFIG_BT_MICP_AICS}
*
* @param micp Microphone Input Control Profile instance pointer.
* @param[out] included Pointer to store the result in.
@@ -105,32 +104,6 @@
struct bt_micp_included *included);
/**
- * @brief Get the connection pointer of a client instance
- *
- * Get the Bluetooth connection pointer of a Microphone Input Control Profile
- * client instance.
- *
- * @param micp Microphone Input Control Profile client instance pointer.
- * @param conn Connection pointer.
- *
- * @return 0 if success, errno on failure.
- */
-int bt_micp_client_conn_get(const struct bt_micp *micp, struct bt_conn **conn);
-
-/**
- * @brief Callback function for @ref bt_micp_discover.
- *
- * This callback is only used for the client.
- *
- * @param micp Microphone Input Control Profile instance pointer.
- * @param err Error value. 0 on success, GATT error or errno on fail.
- * @param aics_count Number of Audio Input Control Service instances on
- * peer device.
- */
-typedef void (*bt_micp_discover_cb)(struct bt_micp *micp, int err,
- uint8_t aics_count);
-
-/**
* @brief Callback function for Microphone Input Control Profile mute.
*
* Called when the value is read,
@@ -144,47 +117,11 @@
typedef void (*bt_micp_mute_read_cb)(struct bt_micp *micp, int err,
uint8_t mute);
-/**
- * @brief Callback function for Microphone Input Control Profile mute/unmute.
- *
- * @param micp Microphone Input Control Profile instance pointer.
- * @param err Error value. 0 on success, GATT error or errno on fail.
- */
-typedef void (*bt_micp_mute_write_cb)(struct bt_micp *micp, int err);
-
struct bt_micp_cb {
bt_micp_mute_read_cb mute;
-
-#if defined(CONFIG_BT_MICP_CLIENT)
- bt_micp_discover_cb discover;
- bt_micp_mute_write_cb mute_write;
- bt_micp_mute_write_cb unmute_write;
-
-#if defined(CONFIG_BT_MICP_CLIENT_AICS)
- /** Audio Input Control Service client callback */
- struct bt_aics_cb aics_cb;
-#endif /* CONFIG_BT_MICP_CLIENT_AICS */
-#endif /* CONFIG_BT_MICP_CLIENT */
};
/**
- * @brief Discover Microphone Input Control Profile instance
- *
- * This will start a GATT discovery and setup handles and subscriptions.
- * This shall be called once before any other actions can be executed for the
- * peer device, and the @ref bt_micp_discover_cb callback will notify when it
- * is possible to start remote operations.
- *
- * This shall only be done as the client.
- *
- * @param conn The connection to initialize the profile for.
- * @param[out] micp Valid remote instance object on success.
- *
- * @return 0 on success, GATT error value on fail.
- */
-int bt_micp_discover(struct bt_conn *conn, struct bt_micp **micp);
-
-/**
* @brief Unmute the server.
*
* @param micp Microphone Input Control Profile instance pointer.
@@ -223,6 +160,129 @@
*/
int bt_micp_mute_get(struct bt_micp *micp);
+struct bt_micp_mic_ctlr_cb {
+ /**
+ * @brief Callback function for Microphone Input Control Profile mute.
+ *
+ * Called when the value is read,
+ * or if the value is changed by either the server or client.
+ *
+ * @param micp Microphone Input Control Profile instance pointer.
+ * @param err Error value. 0 on success, GATT error or errno on fail.
+ * For notifications, this will always be 0.
+ * @param mute The mute setting of the Microphone Input Control Profile instance.
+ */
+ void (*mute)(struct bt_micp *micp, int err, uint8_t mute);
+
+ /**
+ * @brief Callback function for bt_micp_mic_ctlr_discover().
+ *
+ * This callback is only used for the client.
+ *
+ * @param micp Microphone Input Control Profile instance pointer.
+ * @param err Error value. 0 on success, GATT error or errno on fail.
+ * @param aics_count Number of Audio Input Control Service instances on
+ * peer device.
+ */
+ void (*discover)(struct bt_micp *micp, int err, uint8_t aics_count);
+
+ /**
+ * @brief Callback function for Microphone Input Control Profile mute/unmute.
+ *
+ * @param micp Microphone Input Control Profile instance pointer.
+ * @param err Error value. 0 on success, GATT error or errno on fail.
+ */
+ void (*mute_written)(struct bt_micp *micp, int err);
+
+ /**
+ * @brief Callback function for Microphone Input Control Profile mute/unmute.
+ *
+ * @param micp Microphone Input Control Profile instance pointer.
+ * @param err Error value. 0 on success, GATT error or errno on fail.
+ */
+ void (*unmute_written)(struct bt_micp *micp, int err);
+
+#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
+ /** Audio Input Control Service client callback */
+ struct bt_aics_cb aics_cb;
+#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
+};
+
+/**
+ * @brief Get Microphone Input Control Profile included services
+ *
+ * Returns a pointer to a struct that contains information about the
+ * Microphone Input Control Profile included services instances, such as
+ * pointers to the Audio Input Control Service instances.
+ *
+ * Requires that @kconfig{CONFIG_BT_MICP_MIC_CTLR_AICS} is enabled.
+ *
+ * @param micp Microphone Input Control Profile instance pointer.
+ * @param[out] included Pointer to store the result in.
+ *
+ * @return 0 if success, errno on failure.
+ */
+int bt_micp_mic_ctlr_included_get(struct bt_micp *micp,
+ struct bt_micp_included *included);
+
+/**
+ * @brief Get the connection pointer of a client instance
+ *
+ * Get the Bluetooth connection pointer of a Microphone Input Control Profile
+ * client instance.
+ *
+ * @param micp Microphone Input Control Profile client instance pointer.
+ * @param conn Connection pointer.
+ *
+ * @return 0 if success, errno on failure.
+ */
+int bt_micp_mic_ctlr_conn_get(const struct bt_micp *micp,
+ struct bt_conn **conn);
+
+/**
+ * @brief Discover Microphone Input Control Profile instance
+ *
+ * This will start a GATT discovery and setup handles and subscriptions.
+ * This shall be called once before any other actions can be executed for the
+ * peer device, and the @ref bt_micp_mic_ctlr_cb.discover callback will notify
+ * when it is possible to start remote operations.
+ *
+ * This shall only be done as the client.
+ *
+ * @param conn The connection to initialize the profile for.
+ * @param[out] micp Valid remote instance object on success.
+ *
+ * @return 0 on success, GATT error value on fail.
+ */
+int bt_micp_mic_ctlr_discover(struct bt_conn *conn, struct bt_micp **micp);
+
+/**
+ * @brief Unmute the server.
+ *
+ * @param micp Microphone Input Control Profile instance pointer.
+ *
+ * @return 0 on success, GATT error value on fail.
+ */
+int bt_micp_mic_ctlr_unmute(struct bt_micp *micp);
+
+/**
+ * @brief Mute the server.
+ *
+ * @param micp Microphone Input Control Profile instance pointer.
+ *
+ * @return 0 on success, GATT error value on fail.
+ */
+int bt_micp_mic_ctlr_mute(struct bt_micp *micp);
+
+/**
+ * @brief Read the mute state of a Microphone Input Control Profile instance.
+ *
+ * @param micp Microphone Input Control Profile instance pointer.
+ *
+ * @return 0 on success, GATT error value on fail.
+ */
+int bt_micp_mic_ctlr_mute_get(struct bt_micp *micp);
+
/**
* @brief Registers the callbacks used by Microphone Input Control Profile client.
*
@@ -232,8 +292,7 @@
*
* @return 0 if success, errno on failure.
*/
-int bt_micp_client_cb_register(struct bt_micp_cb *cb);
-
+int bt_micp_mic_ctlr_cb_register(struct bt_micp_mic_ctlr_cb *cb);
#ifdef __cplusplus
}
#endif
diff --git a/subsys/bluetooth/audio/CMakeLists.txt b/subsys/bluetooth/audio/CMakeLists.txt
index 4fb9f90..9f1ff19 100644
--- a/subsys/bluetooth/audio/CMakeLists.txt
+++ b/subsys/bluetooth/audio/CMakeLists.txt
@@ -17,10 +17,10 @@
endif()
zephyr_library_sources_ifdef(CONFIG_BT_VCS_CLIENT vcs_client.c)
-if (CONFIG_BT_MICP OR CONFIG_BT_MICP_CLIENT)
+if (CONFIG_BT_MICP)
zephyr_library_sources(micp_mic_dev.c)
endif()
-zephyr_library_sources_ifdef(CONFIG_BT_MICP_CLIENT micp_mic_ctlr.c)
+zephyr_library_sources_ifdef(CONFIG_BT_MICP_MIC_CTLR micp_mic_ctlr.c)
zephyr_library_sources_ifdef(CONFIG_BT_CCID ccid.c)
diff --git a/subsys/bluetooth/audio/Kconfig.micp b/subsys/bluetooth/audio/Kconfig.micp
index 873dfa2..08d0ddd 100644
--- a/subsys/bluetooth/audio/Kconfig.micp
+++ b/subsys/bluetooth/audio/Kconfig.micp
@@ -41,19 +41,20 @@
endif # BT_MICP
-##################### Microphone Control Profile Client #####################
+########### Microphone Input Control Profile Microphone Controller ###########
-config BT_MICP_CLIENT
- bool "Microphone Control Profile Support [EXPERIMENTAL]"
+config BT_MICP_MIC_CTLR
+ bool "Microphone Input Control Profile Microphone Controller Support [EXPERIMENTAL]"
select BT_GATT_CLIENT
select BT_GATT_AUTO_DISCOVER_CCC
select EXPERIMENTAL
help
- This option enables support for Microphone Control Profile.
+ This option enables support for the Microphone Input Control Profile
+ Microphone Controller role
-if BT_MICP_CLIENT
+if BT_MICP_MIC_CTLR
-config BT_MICP_CLIENT_MAX_AICS_INST
+config BT_MICP_MIC_CTLR_MAX_AICS_INST
int "Maximum number of Audio Input Control Service instances to setup"
default 0
range 0 BT_AICS_CLIENT_MAX_INSTANCE_COUNT
@@ -61,19 +62,19 @@
Sets the maximum number of Audio Input Control Service (AICS)
instances to setup and use.
-config BT_MICP_CLIENT_AICS
+config BT_MICP_MIC_CTLR_AICS
bool # Hidden
- default y if BT_MICP_CLIENT_MAX_AICS_INST > 0
+ default y if BT_MICP_MIC_CTLR_MAX_AICS_INST > 0
help
This hidden option makes it possible to easily check if AICS is
enabled for MICP client.
############# DEBUG #############
-config BT_DEBUG_MICP_CLIENT
- bool "Microphone Control Profile debug"
+config BT_DEBUG_MICP_MIC_CTLR
+ bool "Microphone Input Control Profile Microphone Controller debug"
help
- Use this option to enable Microphone Control Profile debug logs for
- the Bluetooth Audio functionality.
+ Use this option to enable Microphone Input Control Profile Microphone
+ Controller debug logs for the Bluetooth Audio functionality.
-endif # BT_MICP_CLIENT
+endif # BT_MICP_MIC_CTLR
diff --git a/subsys/bluetooth/audio/micp_internal.h b/subsys/bluetooth/audio/micp_internal.h
index e874658..d2c58e9 100644
--- a/subsys/bluetooth/audio/micp_internal.h
+++ b/subsys/bluetooth/audio/micp_internal.h
@@ -18,8 +18,8 @@
};
#endif /* CONFIG_BT_MICP */
-#if defined(CONFIG_BT_MICP_CLIENT)
-struct bt_micp_client {
+#if defined(CONFIG_BT_MICP_MIC_CTLR)
+struct bt_micp_mic_ctlr {
uint16_t start_handle;
uint16_t end_handle;
uint16_t mute_handle;
@@ -34,9 +34,9 @@
struct bt_conn *conn;
uint8_t aics_inst_cnt;
- struct bt_aics *aics[CONFIG_BT_MICP_CLIENT_MAX_AICS_INST];
+ struct bt_aics *aics[CONFIG_BT_MICP_MIC_CTLR_MAX_AICS_INST];
};
-#endif /* CONFIG_BT_MICP_CLIENT */
+#endif /* CONFIG_BT_MICP_MIC_CTLR */
/* Struct used as a common type for the api */
struct bt_micp {
@@ -45,16 +45,10 @@
#if defined(CONFIG_BT_MICP)
struct bt_micp_server srv;
#endif /* CONFIG_BT_MICP */
-#if defined(CONFIG_BT_MICP_CLIENT)
- struct bt_micp_client cli;
-#endif /* CONFIG_BT_MICP_CLIENT */
+#if defined(CONFIG_BT_MICP_MIC_CTLR)
+ struct bt_micp_mic_ctlr cli;
+#endif /* CONFIG_BT_MICP_MIC_CTLR */
};
};
-int bt_micp_client_included_get(struct bt_micp *micp,
- struct bt_micp_included *included);
-int bt_micp_client_mute_get(struct bt_micp *micp);
-int bt_micp_client_mute(struct bt_micp *micp);
-int bt_micp_client_unmute(struct bt_micp *micp);
-
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_MICS_INTERNAL_ */
diff --git a/subsys/bluetooth/audio/micp_mic_ctlr.c b/subsys/bluetooth/audio/micp_mic_ctlr.c
index 3c2a448..6652014 100644
--- a/subsys/bluetooth/audio/micp_mic_ctlr.c
+++ b/subsys/bluetooth/audio/micp_mic_ctlr.c
@@ -1,4 +1,4 @@
-/* Bluetooth MICP client - Microphone Control Profile - Client */
+/* Bluetooth MICP - Microphone Input Control Profile - Microphone Controller */
/*
* Copyright (c) 2020 Bose Corporation
@@ -22,12 +22,12 @@
#include "micp_internal.h"
-#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_MICP_CLIENT)
-#define LOG_MODULE_NAME bt_micp_client
+#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_MICP_MIC_CTLR)
+#define LOG_MODULE_NAME bt_micp_mic_ctlr
#include "common/log.h"
/* Callback functions */
-static struct bt_micp_cb *micp_client_cb;
+static struct bt_micp_mic_ctlr_cb *micp_mic_ctlr_cb;
static struct bt_micp micp_insts[CONFIG_BT_MAX_CONN];
static struct bt_uuid *mics_uuid = BT_UUID_MICS;
@@ -49,9 +49,9 @@
if (length == sizeof(*mute_val)) {
mute_val = (uint8_t *)data;
BT_DBG("Mute %u", *mute_val);
- if (micp_client_cb != NULL &&
- micp_client_cb->mute != NULL) {
- micp_client_cb->mute(micp_inst, 0, *mute_val);
+ if (micp_mic_ctlr_cb != NULL &&
+ micp_mic_ctlr_cb->mute != NULL) {
+ micp_mic_ctlr_cb->mute(micp_inst, 0, *mute_val);
}
} else {
BT_DBG("Invalid length %u (expected %zu)",
@@ -63,7 +63,7 @@
return BT_GATT_ITER_CONTINUE;
}
-static uint8_t micp_client_read_mute_cb(struct bt_conn *conn, uint8_t err,
+static uint8_t micp_mic_ctlr_read_mute_cb(struct bt_conn *conn, uint8_t err,
struct bt_gatt_read_params *params,
const void *data, uint16_t length)
{
@@ -86,14 +86,14 @@
}
}
- if (micp_client_cb != NULL && micp_client_cb->mute != NULL) {
- micp_client_cb->mute(micp_inst, cb_err, mute_val);
+ if (micp_mic_ctlr_cb != NULL && micp_mic_ctlr_cb->mute != NULL) {
+ micp_mic_ctlr_cb->mute(micp_inst, cb_err, mute_val);
}
return BT_GATT_ITER_STOP;
}
-static void micp_client_write_mics_mute_cb(struct bt_conn *conn, uint8_t err,
+static void micp_mic_ctlr_write_mics_mute_cb(struct bt_conn *conn, uint8_t err,
struct bt_gatt_write_params *params)
{
struct bt_micp *micp_inst = &micp_insts[bt_conn_index(conn)];
@@ -104,20 +104,20 @@
micp_inst->cli.busy = false;
if (mute_val == BT_MICP_MUTE_UNMUTED) {
- if (micp_client_cb != NULL &&
- micp_client_cb->unmute_write != NULL) {
- micp_client_cb->unmute_write(micp_inst, err);
+ if (micp_mic_ctlr_cb != NULL &&
+ micp_mic_ctlr_cb->unmute_written != NULL) {
+ micp_mic_ctlr_cb->unmute_written(micp_inst, err);
}
} else {
- if (micp_client_cb != NULL &&
- micp_client_cb->mute_write != NULL) {
- micp_client_cb->mute_write(micp_inst, err);
+ if (micp_mic_ctlr_cb != NULL &&
+ micp_mic_ctlr_cb->mute_written != NULL) {
+ micp_mic_ctlr_cb->mute_written(micp_inst, err);
}
}
}
-#if defined(CONFIG_BT_MICP_CLIENT_AICS)
+#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
static struct bt_micp *lookup_micp_by_aics(const struct bt_aics *aics)
{
__ASSERT(aics != NULL, "AICS pointer cannot be NULL");
@@ -145,13 +145,13 @@
if (err != 0) {
BT_DBG("Discover failed (err %d)", err);
- if (micp_client_cb != NULL &&
- micp_client_cb->discover != NULL) {
- micp_client_cb->discover(micp_inst, err, 0);
+ if (micp_mic_ctlr_cb != NULL &&
+ micp_mic_ctlr_cb->discover != NULL) {
+ micp_mic_ctlr_cb->discover(micp_inst, err, 0);
}
}
}
-#endif /* CONFIG_BT_MICP_CLIENT_AICS */
+#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
static uint8_t micp_discover_include_func(
struct bt_conn *conn, const struct bt_gatt_attr *attr,
@@ -164,9 +164,10 @@
micp_inst->cli.aics_inst_cnt);
(void)memset(params, 0, sizeof(*params));
- if (micp_client_cb != NULL &&
- micp_client_cb->discover != NULL) {
- micp_client_cb->discover(micp_inst, 0, 0);
+ if (micp_mic_ctlr_cb != NULL &&
+ micp_mic_ctlr_cb->discover != NULL) {
+ micp_mic_ctlr_cb->discover(micp_inst, 0,
+ micp_inst->cli.aics_inst_cnt);
}
return BT_GATT_ITER_STOP;
@@ -180,7 +181,7 @@
BT_DBG("Include UUID %s", bt_uuid_str(include->uuid));
if (bt_uuid_cmp(include->uuid, BT_UUID_AICS) == 0 &&
- micp_inst->cli.aics_inst_cnt < CONFIG_BT_MICP_CLIENT_MAX_AICS_INST) {
+ micp_inst->cli.aics_inst_cnt < CONFIG_BT_MICP_MIC_CTLR_MAX_AICS_INST) {
uint8_t inst_idx;
int err;
struct bt_aics_discover_param param = {
@@ -198,9 +199,9 @@
¶m);
if (err != 0) {
BT_DBG("AICS Discover failed (err %d)", err);
- if (micp_client_cb != NULL &&
- micp_client_cb->discover != NULL) {
- micp_client_cb->discover(micp_inst, err,
+ if (micp_mic_ctlr_cb != NULL &&
+ micp_mic_ctlr_cb->discover != NULL) {
+ micp_mic_ctlr_cb->discover(micp_inst, err,
0);
}
}
@@ -227,7 +228,7 @@
BT_DBG("Setup complete for MICP");
(void)memset(params, 0, sizeof(*params));
- if (CONFIG_BT_MICP_CLIENT_MAX_AICS_INST > 0) {
+ if (CONFIG_BT_MICP_MIC_CTLR_MAX_AICS_INST > 0) {
/* Discover included services */
micp_inst->cli.discover_params.start_handle = micp_inst->cli.start_handle;
micp_inst->cli.discover_params.end_handle = micp_inst->cli.end_handle;
@@ -238,15 +239,15 @@
&micp_inst->cli.discover_params);
if (err != 0) {
BT_DBG("Discover failed (err %d)", err);
- if (micp_client_cb != NULL &&
- micp_client_cb->discover != NULL) {
- micp_client_cb->discover(micp_inst, err, 0);
+ if (micp_mic_ctlr_cb != NULL &&
+ micp_mic_ctlr_cb->discover != NULL) {
+ micp_mic_ctlr_cb->discover(micp_inst, err, 0);
}
}
} else {
- if (micp_client_cb != NULL &&
- micp_client_cb->discover != NULL) {
- micp_client_cb->discover(micp_inst, err, 0);
+ if (micp_mic_ctlr_cb != NULL &&
+ micp_mic_ctlr_cb->discover != NULL) {
+ micp_mic_ctlr_cb->discover(micp_inst, err, 0);
}
}
return BT_GATT_ITER_STOP;
@@ -297,9 +298,9 @@
if (attr == NULL) {
BT_DBG("Could not find a MICS instance on the server");
- if (micp_client_cb != NULL &&
- micp_client_cb->discover != NULL) {
- micp_client_cb->discover(micp_inst, -ENODATA, 0);
+ if (micp_mic_ctlr_cb != NULL &&
+ micp_mic_ctlr_cb->discover != NULL) {
+ micp_mic_ctlr_cb->discover(micp_inst, -ENODATA, 0);
}
return BT_GATT_ITER_STOP;
}
@@ -325,9 +326,9 @@
err = bt_gatt_discover(conn, &micp_inst->cli.discover_params);
if (err != 0) {
BT_DBG("Discover failed (err %d)", err);
- if (micp_client_cb != NULL &&
- micp_client_cb->discover != NULL) {
- micp_client_cb->discover(micp_inst, err, 0);
+ if (micp_mic_ctlr_cb != NULL &&
+ micp_mic_ctlr_cb->discover != NULL) {
+ micp_mic_ctlr_cb->discover(micp_inst, err, 0);
}
}
@@ -337,7 +338,7 @@
return BT_GATT_ITER_CONTINUE;
}
-static void micp_client_reset(struct bt_micp *micp)
+static void micp_mic_ctlr_reset(struct bt_micp *micp)
{
micp->cli.start_handle = 0;
micp->cli.end_handle = 0;
@@ -365,7 +366,7 @@
struct bt_micp *micp = &micp_insts[bt_conn_index(conn)];
if (micp->cli.conn == conn) {
- micp_client_reset(micp);
+ micp_mic_ctlr_reset(micp);
}
}
@@ -373,7 +374,7 @@
.disconnected = disconnected,
};
-int bt_micp_discover(struct bt_conn *conn, struct bt_micp **micp)
+int bt_micp_mic_ctlr_discover(struct bt_conn *conn, struct bt_micp **micp)
{
struct bt_micp *micp_inst;
int err;
@@ -397,9 +398,9 @@
(void)memset(&micp_inst->cli.discover_params, 0,
sizeof(micp_inst->cli.discover_params));
- micp_client_reset(micp_inst);
+ micp_mic_ctlr_reset(micp_inst);
-#if defined(CONFIG_BT_MICP_CLIENT_AICS)
+#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
static bool initialized;
if (!initialized) {
@@ -411,12 +412,12 @@
}
bt_aics_client_cb_register(micp_inst->cli.aics[i],
- &micp_client_cb->aics_cb);
+ &micp_mic_ctlr_cb->aics_cb);
}
}
initialized = true;
-#endif /* CONFIG_BT_MICP_CLIENT_AICS */
+#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
micp_inst->cli.conn = bt_conn_ref(conn);
micp_inst->client_instance = true;
@@ -434,9 +435,9 @@
return err;
}
-int bt_micp_client_cb_register(struct bt_micp_cb *cb)
+int bt_micp_mic_ctlr_cb_register(struct bt_micp_mic_ctlr_cb *cb)
{
-#if defined(CONFIG_BT_MICP_CLIENT_AICS)
+#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
struct bt_aics_cb *aics_cb = NULL;
if (cb != NULL) {
@@ -458,15 +459,15 @@
}
}
}
-#endif /* CONFIG_BT_MICP_CLIENT_AICS */
+#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
- micp_client_cb = cb;
+ micp_mic_ctlr_cb = cb;
return 0;
}
-int bt_micp_client_included_get(struct bt_micp *micp,
- struct bt_micp_included *included)
+int bt_micp_mic_ctlr_included_get(struct bt_micp *micp,
+ struct bt_micp_included *included)
{
CHECKIF(micp == NULL) {
BT_DBG("NULL micp");
@@ -483,7 +484,7 @@
return 0;
}
-int bt_micp_client_conn_get(const struct bt_micp *micp, struct bt_conn **conn)
+int bt_micp_mic_ctlr_conn_get(const struct bt_micp *micp, struct bt_conn **conn)
{
CHECKIF(micp == NULL) {
BT_DBG("NULL micp pointer");
@@ -505,7 +506,7 @@
return 0;
}
-int bt_micp_client_mute_get(struct bt_micp *micp)
+int bt_micp_mic_ctlr_mute_get(struct bt_micp *micp)
{
int err;
@@ -521,7 +522,7 @@
return -EBUSY;
}
- micp->cli.read_params.func = micp_client_read_mute_cb;
+ micp->cli.read_params.func = micp_mic_ctlr_read_mute_cb;
micp->cli.read_params.handle_count = 1;
micp->cli.read_params.single.handle = micp->cli.mute_handle;
micp->cli.read_params.single.offset = 0U;
@@ -534,7 +535,7 @@
return err;
}
-int bt_micp_client_write_mute(struct bt_micp *micp, bool mute)
+int bt_micp_mic_ctlr_write_mute(struct bt_micp *micp, bool mute)
{
int err;
@@ -555,7 +556,7 @@
micp->cli.write_params.data = micp->cli.mute_val_buf;
micp->cli.write_params.length = sizeof(mute);
micp->cli.write_params.handle = micp->cli.mute_handle;
- micp->cli.write_params.func = micp_client_write_mics_mute_cb;
+ micp->cli.write_params.func = micp_mic_ctlr_write_mics_mute_cb;
err = bt_gatt_write(micp->cli.conn, &micp->cli.write_params);
if (err == 0) {
@@ -565,12 +566,12 @@
return err;
}
-int bt_micp_client_mute(struct bt_micp *micp)
+int bt_micp_mic_ctlr_mute(struct bt_micp *micp)
{
- return bt_micp_client_write_mute(micp, true);
+ return bt_micp_mic_ctlr_write_mute(micp, true);
}
-int bt_micp_client_unmute(struct bt_micp *micp)
+int bt_micp_mic_ctlr_unmute(struct bt_micp *micp)
{
- return bt_micp_client_write_mute(micp, false);
+ return bt_micp_mic_ctlr_write_mute(micp, false);
}
diff --git a/subsys/bluetooth/audio/micp_mic_dev.c b/subsys/bluetooth/audio/micp_mic_dev.c
index 28c2805..2704ce4 100644
--- a/subsys/bluetooth/audio/micp_mic_dev.c
+++ b/subsys/bluetooth/audio/micp_mic_dev.c
@@ -25,8 +25,6 @@
#define LOG_MODULE_NAME bt_micp
#include "common/log.h"
-#if defined(CONFIG_BT_MICP)
-
static struct bt_micp micp_inst;
static void mute_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
@@ -197,8 +195,6 @@
return err > 0 ? 0 : err;
}
-#endif /* CONFIG_BT_MICP */
-
int bt_micp_included_get(struct bt_micp *micp,
struct bt_micp_included *included)
{
@@ -212,63 +208,42 @@
return -EINVAL;
}
-
- if (IS_ENABLED(CONFIG_BT_MICP_CLIENT) &&
- IS_ENABLED(CONFIG_BT_MICP_CLIENT_AICS) &&
- micp->client_instance) {
- return bt_micp_client_included_get(micp, included);
- }
-
-#if defined(CONFIG_BT_MICP) && defined(CONFIG_BT_MICP_AICS)
+#if defined(CONFIG_BT_MICP_AICS)
included->aics_cnt = ARRAY_SIZE(micp_inst.srv.aics_insts);
included->aics = micp_inst.srv.aics_insts;
+#endif /* CONFIG_BT_MICP_AICS */
return 0;
-#else
- return -EOPNOTSUPP;
-#endif /* CONFIG_BT_MICP && CONFIG_BT_MICP_AICS */
}
int bt_micp_unmute(struct bt_micp *micp)
{
+ const uint8_t val = BT_MICP_MUTE_UNMUTED;
+ int err;
+
CHECKIF(micp == NULL) {
BT_DBG("NULL micp pointer");
return -EINVAL;
}
- if (IS_ENABLED(CONFIG_BT_MICP_CLIENT) && micp->client_instance) {
- return bt_micp_client_unmute(micp);
- }
-
-#if defined(CONFIG_BT_MICP)
- uint8_t val = BT_MICP_MUTE_UNMUTED;
- int err = write_mute(NULL, NULL, &val, sizeof(val), 0, 0);
+ err = write_mute(NULL, NULL, &val, sizeof(val), 0, 0);
return err > 0 ? 0 : err;
-#else
- return -EOPNOTSUPP;
-#endif /* CONFIG_BT_MICP */
}
int bt_micp_mute(struct bt_micp *micp)
{
+ const uint8_t val = BT_MICP_MUTE_MUTED;
+ int err;
+
CHECKIF(micp == NULL) {
BT_DBG("NULL micp pointer");
return -EINVAL;
}
- if (IS_ENABLED(CONFIG_BT_MICP_CLIENT) && micp->client_instance) {
- return bt_micp_client_mute(micp);
- }
-
-#if defined(CONFIG_BT_MICP)
- uint8_t val = BT_MICP_MUTE_MUTED;
- int err = write_mute(NULL, NULL, &val, sizeof(val), 0, 0);
+ err = write_mute(NULL, NULL, &val, sizeof(val), 0, 0);
return err > 0 ? 0 : err;
-#else
- return -EOPNOTSUPP;
-#endif /* CONFIG_BT_MICP */
}
int bt_micp_mute_get(struct bt_micp *micp)
@@ -278,17 +253,9 @@
return -EINVAL;
}
- if (IS_ENABLED(CONFIG_BT_MICP_CLIENT) && micp->client_instance) {
- return bt_micp_client_mute_get(micp);
- }
-
-#if defined(CONFIG_BT_MICP)
if (micp_inst.srv.cb && micp_inst.srv.cb->mute) {
micp_inst.srv.cb->mute(NULL, 0, micp_inst.srv.mute);
}
return 0;
-#else
- return -EOPNOTSUPP;
-#endif /* CONFIG_BT_MICP */
}
diff --git a/subsys/bluetooth/shell/CMakeLists.txt b/subsys/bluetooth/shell/CMakeLists.txt
index 048298c..f3c2026 100644
--- a/subsys/bluetooth/shell/CMakeLists.txt
+++ b/subsys/bluetooth/shell/CMakeLists.txt
@@ -38,7 +38,7 @@
micp_mic_dev.c
)
zephyr_library_sources_ifdef(
- CONFIG_BT_MICP_CLIENT
+ CONFIG_BT_MICP_MIC_CTLR
micp_mic_ctlr.c
)
zephyr_library_sources_ifdef(
diff --git a/subsys/bluetooth/shell/micp_mic_ctlr.c b/subsys/bluetooth/shell/micp_mic_ctlr.c
index 76283cf..3407d93 100644
--- a/subsys/bluetooth/shell/micp_mic_ctlr.c
+++ b/subsys/bluetooth/shell/micp_mic_ctlr.c
@@ -17,11 +17,11 @@
#include "bt.h"
static struct bt_micp *micp;
-#if defined(CONFIG_BT_MICP_CLIENT_AICS)
+#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
static struct bt_micp_included micp_included;
-#endif /* CONFIG_BT_MICP_CLIENT_AICS */
+#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
-static void micp_discover_cb(struct bt_micp *micp, int err, uint8_t aics_count)
+static void micp_mic_ctlr_discover_cb(struct bt_micp *micp, int err, uint8_t aics_count)
{
if (err != 0) {
shell_error(ctx_shell, "MICP discover failed (%d)", err);
@@ -29,15 +29,15 @@
shell_print(ctx_shell, "MICP discover done with %u AICS",
aics_count);
-#if defined(CONFIG_BT_MICP_CLIENT_AICS)
- if (bt_micp_included_get(micp, &micp_included) != 0) {
+#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
+ if (bt_micp_mic_ctlr_included_get(micp, &micp_included) != 0) {
shell_error(ctx_shell, "Could not get MICP context");
}
-#endif /* CONFIG_BT_MICP_CLIENT_AICS */
+#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
}
}
-static void micp_mute_write_cb(struct bt_micp *micp, int err)
+static void micp_mic_ctlr_mute_written_cb(struct bt_micp *micp, int err)
{
if (err != 0) {
shell_error(ctx_shell, "Mute write failed (%d)", err);
@@ -46,7 +46,7 @@
}
}
-static void micp_unmute_write_cb(struct bt_micp *micp, int err)
+static void micp_mic_ctlr_unmute_written_cb(struct bt_micp *micp, int err)
{
if (err != 0) {
shell_error(ctx_shell, "Unmute write failed (%d)", err);
@@ -55,7 +55,7 @@
}
}
-static void micp_mute_cb(struct bt_micp *micp, int err, uint8_t mute)
+static void micp_mic_ctlr_mute_cb(struct bt_micp *micp, int err, uint8_t mute)
{
if (err != 0) {
shell_error(ctx_shell, "Mute get failed (%d)", err);
@@ -64,10 +64,10 @@
}
}
-#if defined(CONFIG_BT_MICP_CLIENT_AICS)
+#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
static struct bt_micp_included micp_included;
-static void micp_aics_set_gain_cb(struct bt_aics *inst, int err)
+static void micp_mic_ctlr_aics_set_gain_cb(struct bt_aics *inst, int err)
{
if (err != 0) {
shell_error(ctx_shell, "Set gain failed (%d) for inst %p",
@@ -77,7 +77,7 @@
}
}
-static void micp_aics_unmute_cb(struct bt_aics *inst, int err)
+static void micp_mic_ctlr_aics_unmute_cb(struct bt_aics *inst, int err)
{
if (err != 0) {
shell_error(ctx_shell, "Unmute failed (%d) for inst %p",
@@ -87,7 +87,7 @@
}
}
-static void micp_aics_mute_cb(struct bt_aics *inst, int err)
+static void micp_mic_ctlr_aics_mute_cb(struct bt_aics *inst, int err)
{
if (err != 0) {
shell_error(ctx_shell, "Mute failed (%d) for inst %p",
@@ -97,7 +97,7 @@
}
}
-static void micp_aics_set_manual_mode_cb(struct bt_aics *inst, int err)
+static void micp_mic_ctlr_aics_set_manual_mode_cb(struct bt_aics *inst, int err)
{
if (err != 0) {
shell_error(ctx_shell,
@@ -108,7 +108,7 @@
}
}
-static void micp_aics_automatic_mode_cb(struct bt_aics *inst, int err)
+static void micp_mic_ctlr_aics_automatic_mode_cb(struct bt_aics *inst, int err)
{
if (err != 0) {
shell_error(ctx_shell,
@@ -120,8 +120,8 @@
}
}
-static void micp_aics_state_cb(struct bt_aics *inst, int err, int8_t gain,
- uint8_t mute, uint8_t mode)
+static void micp_mic_ctlr_aics_state_cb(struct bt_aics *inst, int err,
+ int8_t gain, uint8_t mute, uint8_t mode)
{
if (err != 0) {
shell_error(ctx_shell, "AICS state get failed (%d) for "
@@ -133,9 +133,9 @@
}
-static void micp_aics_gain_setting_cb(struct bt_aics *inst, int err,
- uint8_t units, int8_t minimum,
- int8_t maximum)
+static void micp_mic_ctlr_aics_gain_setting_cb(struct bt_aics *inst, int err,
+ uint8_t units, int8_t minimum,
+ int8_t maximum)
{
if (err != 0) {
shell_error(ctx_shell, "AICS gain settings get failed (%d) for "
@@ -148,8 +148,8 @@
}
-static void micp_aics_input_type_cb(struct bt_aics *inst, int err,
- uint8_t input_type)
+static void micp_mic_ctlr_aics_input_type_cb(struct bt_aics *inst, int err,
+ uint8_t input_type)
{
if (err != 0) {
shell_error(ctx_shell, "AICS input type get failed (%d) for "
@@ -161,7 +161,8 @@
}
-static void micp_aics_status_cb(struct bt_aics *inst, int err, bool active)
+static void micp_mic_ctlr_aics_status_cb(struct bt_aics *inst, int err,
+ bool active)
{
if (err != 0) {
shell_error(ctx_shell, "AICS status get failed (%d) for "
@@ -173,8 +174,8 @@
}
-static void micp_aics_description_cb(struct bt_aics *inst, int err,
- char *description)
+static void micp_mic_ctlr_aics_description_cb(struct bt_aics *inst, int err,
+ char *description)
{
if (err != 0) {
shell_error(ctx_shell, "AICS description get failed (%d) for "
@@ -184,32 +185,32 @@
inst, description);
}
}
-#endif /* CONFIG_BT_MICP_CLIENT_AICS */
+#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
-static struct bt_micp_cb micp_cbs = {
- .discover = micp_discover_cb,
- .mute_write = micp_mute_write_cb,
- .unmute_write = micp_unmute_write_cb,
- .mute = micp_mute_cb,
+static struct bt_micp_mic_ctlr_cb micp_cbs = {
+ .discover = micp_mic_ctlr_discover_cb,
+ .mute_written = micp_mic_ctlr_mute_written_cb,
+ .unmute_written = micp_mic_ctlr_unmute_written_cb,
+ .mute = micp_mic_ctlr_mute_cb,
-#if defined(CONFIG_BT_MICP_CLIENT_AICS)
+#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
/* Audio Input Control Service */
.aics_cb = {
- .state = micp_aics_state_cb,
- .gain_setting = micp_aics_gain_setting_cb,
- .type = micp_aics_input_type_cb,
- .status = micp_aics_status_cb,
- .description = micp_aics_description_cb,
- .set_gain = micp_aics_set_gain_cb,
- .unmute = micp_aics_unmute_cb,
- .mute = micp_aics_mute_cb,
- .set_manual_mode = micp_aics_set_manual_mode_cb,
- .set_auto_mode = micp_aics_automatic_mode_cb,
+ .state = micp_mic_ctlr_aics_state_cb,
+ .gain_setting = micp_mic_ctlr_aics_gain_setting_cb,
+ .type = micp_mic_ctlr_aics_input_type_cb,
+ .status = micp_mic_ctlr_aics_status_cb,
+ .description = micp_mic_ctlr_aics_description_cb,
+ .set_gain = micp_mic_ctlr_aics_set_gain_cb,
+ .unmute = micp_mic_ctlr_aics_unmute_cb,
+ .mute = micp_mic_ctlr_aics_mute_cb,
+ .set_manual_mode = micp_mic_ctlr_aics_set_manual_mode_cb,
+ .set_auto_mode = micp_mic_ctlr_aics_automatic_mode_cb,
}
-#endif /* CONFIG_BT_MICP_CLIENT_AICS */
+#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
};
-static int cmd_micp_client_discover(const struct shell *sh, size_t argc,
+static int cmd_micp_mic_ctlr_discover(const struct shell *sh, size_t argc,
char **argv)
{
int result;
@@ -218,7 +219,7 @@
ctx_shell = sh;
}
- result = bt_micp_client_cb_register(&micp_cbs);
+ result = bt_micp_mic_ctlr_cb_register(&micp_cbs);
if (result != 0) {
shell_print(sh, "Failed to register callbacks: %d", result);
}
@@ -227,7 +228,7 @@
return -ENOTCONN;
}
- result = bt_micp_discover(default_conn, &micp);
+ result = bt_micp_mic_ctlr_discover(default_conn, &micp);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@@ -235,7 +236,7 @@
return result;
}
-static int cmd_micp_client_mute_get(const struct shell *sh, size_t argc,
+static int cmd_micp_mic_ctlr_mute_get(const struct shell *sh, size_t argc,
char **argv)
{
int result;
@@ -244,7 +245,7 @@
return -ENOENT;
}
- result = bt_micp_mute_get(micp);
+ result = bt_micp_mic_ctlr_mute_get(micp);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
@@ -253,7 +254,7 @@
return result;
}
-static int cmd_micp_client_mute(const struct shell *sh, size_t argc,
+static int cmd_micp_mic_ctlr_mute(const struct shell *sh, size_t argc,
char **argv)
{
int result;
@@ -262,7 +263,7 @@
return -ENOENT;
}
- result = bt_micp_mute(micp);
+ result = bt_micp_mic_ctlr_mute(micp);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
@@ -271,7 +272,7 @@
return result;
}
-static int cmd_micp_client_unmute(const struct shell *sh, size_t argc,
+static int cmd_micp_mic_ctlr_unmute(const struct shell *sh, size_t argc,
char **argv)
{
int result;
@@ -280,7 +281,7 @@
return -ENOENT;
}
- result = bt_micp_unmute(micp);
+ result = bt_micp_mic_ctlr_unmute(micp);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
@@ -289,8 +290,8 @@
return result;
}
-#if defined(CONFIG_BT_MICP_CLIENT_AICS)
-static int cmd_micp_client_aics_input_state_get(const struct shell *sh,
+#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
+static int cmd_micp_mic_ctlr_aics_input_state_get(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@@ -314,7 +315,7 @@
return result;
}
-static int cmd_micp_client_aics_gain_setting_get(const struct shell *sh,
+static int cmd_micp_mic_ctlr_aics_gain_setting_get(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@@ -338,7 +339,7 @@
return result;
}
-static int cmd_micp_client_aics_input_type_get(const struct shell *sh,
+static int cmd_micp_mic_ctlr_aics_input_type_get(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@@ -362,7 +363,7 @@
return result;
}
-static int cmd_micp_client_aics_input_status_get(const struct shell *sh,
+static int cmd_micp_mic_ctlr_aics_input_status_get(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@@ -386,7 +387,7 @@
return result;
}
-static int cmd_micp_client_aics_input_unmute(const struct shell *sh,
+static int cmd_micp_mic_ctlr_aics_input_unmute(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@@ -410,7 +411,7 @@
return result;
}
-static int cmd_micp_client_aics_input_mute(const struct shell *sh,
+static int cmd_micp_mic_ctlr_aics_input_mute(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@@ -434,7 +435,7 @@
return result;
}
-static int cmd_micp_client_aics_manual_input_gain_set(const struct shell *sh,
+static int cmd_micp_mic_ctlr_aics_manual_input_gain_set(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@@ -458,7 +459,7 @@
return result;
}
-static int cmd_micp_client_aics_automatic_input_gain_set(const struct shell *sh,
+static int cmd_micp_mic_ctlr_aics_automatic_input_gain_set(const struct shell *sh,
size_t argc,
char **argv)
{
@@ -483,7 +484,7 @@
return result;
}
-static int cmd_micp_client_aics_gain_set(const struct shell *sh, size_t argc,
+static int cmd_micp_mic_ctlr_aics_gain_set(const struct shell *sh, size_t argc,
char **argv)
{
int result;
@@ -514,7 +515,7 @@
return result;
}
-static int cmd_micp_client_aics_input_description_get(const struct shell *sh,
+static int cmd_micp_mic_ctlr_aics_input_description_get(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@@ -538,7 +539,7 @@
return result;
}
-static int cmd_micp_client_aics_input_description_set(const struct shell *sh,
+static int cmd_micp_mic_ctlr_aics_input_description_set(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@@ -563,9 +564,9 @@
return result;
}
-#endif /* CONFIG_BT_MICP_CLIENT_AICS */
+#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
-static int cmd_micp_client(const struct shell *sh, size_t argc, char **argv)
+static int cmd_micp_mic_ctlr(const struct shell *sh, size_t argc, char **argv)
{
if (argc > 1) {
shell_error(sh, "%s unknown parameter: %s",
@@ -577,61 +578,61 @@
return -ENOEXEC;
}
-SHELL_STATIC_SUBCMD_SET_CREATE(micp_client_cmds,
+SHELL_STATIC_SUBCMD_SET_CREATE(micp_mic_ctlr_cmds,
SHELL_CMD_ARG(discover, NULL,
"Discover MICS on remote device",
- cmd_micp_client_discover, 1, 0),
+ cmd_micp_mic_ctlr_discover, 1, 0),
SHELL_CMD_ARG(mute_get, NULL,
"Read the mute state of the MICP server.",
- cmd_micp_client_mute_get, 1, 0),
+ cmd_micp_mic_ctlr_mute_get, 1, 0),
SHELL_CMD_ARG(mute, NULL,
"Mute the MICP server",
- cmd_micp_client_mute, 1, 0),
+ cmd_micp_mic_ctlr_mute, 1, 0),
SHELL_CMD_ARG(unmute, NULL,
"Unmute the MICP server",
- cmd_micp_client_unmute, 1, 0),
-#if defined(CONFIG_BT_MICP_CLIENT_AICS)
+ cmd_micp_mic_ctlr_unmute, 1, 0),
+#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
SHELL_CMD_ARG(aics_input_state_get, NULL,
"Read the input state of a AICS instance <inst_index>",
- cmd_micp_client_aics_input_state_get, 2, 0),
+ cmd_micp_mic_ctlr_aics_input_state_get, 2, 0),
SHELL_CMD_ARG(aics_gain_setting_get, NULL,
"Read the gain settings of a AICS instance <inst_index>",
- cmd_micp_client_aics_gain_setting_get, 2, 0),
+ cmd_micp_mic_ctlr_aics_gain_setting_get, 2, 0),
SHELL_CMD_ARG(aics_input_type_get, NULL,
"Read the input type of a AICS instance <inst_index>",
- cmd_micp_client_aics_input_type_get, 2, 0),
+ cmd_micp_mic_ctlr_aics_input_type_get, 2, 0),
SHELL_CMD_ARG(aics_input_status_get, NULL,
"Read the input status of a AICS instance <inst_index>",
- cmd_micp_client_aics_input_status_get, 2, 0),
+ cmd_micp_mic_ctlr_aics_input_status_get, 2, 0),
SHELL_CMD_ARG(aics_input_unmute, NULL,
"Unmute the input of a AICS instance <inst_index>",
- cmd_micp_client_aics_input_unmute, 2, 0),
+ cmd_micp_mic_ctlr_aics_input_unmute, 2, 0),
SHELL_CMD_ARG(aics_input_mute, NULL,
"Mute the input of a AICS instance <inst_index>",
- cmd_micp_client_aics_input_mute, 2, 0),
+ cmd_micp_mic_ctlr_aics_input_mute, 2, 0),
SHELL_CMD_ARG(aics_manual_input_gain_set, NULL,
"Set the gain mode of a AICS instance to manual "
"<inst_index>",
- cmd_micp_client_aics_manual_input_gain_set, 2, 0),
+ cmd_micp_mic_ctlr_aics_manual_input_gain_set, 2, 0),
SHELL_CMD_ARG(aics_automatic_input_gain_set, NULL,
"Set the gain mode of a AICS instance to automatic "
"<inst_index>",
- cmd_micp_client_aics_automatic_input_gain_set, 2, 0),
+ cmd_micp_mic_ctlr_aics_automatic_input_gain_set, 2, 0),
SHELL_CMD_ARG(aics_gain_set, NULL,
"Set the gain of a AICS instance <inst_index> <gain>",
- cmd_micp_client_aics_gain_set, 3, 0),
+ cmd_micp_mic_ctlr_aics_gain_set, 3, 0),
SHELL_CMD_ARG(aics_input_description_get, NULL,
"Read the input description of a AICS instance "
"<inst_index>",
- cmd_micp_client_aics_input_description_get, 2, 0),
+ cmd_micp_mic_ctlr_aics_input_description_get, 2, 0),
SHELL_CMD_ARG(aics_input_description_set, NULL,
"Set the input description of a AICS instance "
"<inst_index> <description>",
- cmd_micp_client_aics_input_description_set, 3, 0),
-#endif /* CONFIG_BT_MICP_CLIENT_AICS */
+ cmd_micp_mic_ctlr_aics_input_description_set, 3, 0),
+#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
SHELL_SUBCMD_SET_END
);
-SHELL_CMD_ARG_REGISTER(micp_client, &micp_client_cmds,
+SHELL_CMD_ARG_REGISTER(micp_mic_ctlr, &micp_mic_ctlr_cmds,
"Bluetooth MICP client shell commands",
- cmd_micp_client, 1, 1);
+ cmd_micp_mic_ctlr, 1, 1);
diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/prj.conf b/tests/bluetooth/bsim_bt/bsim_test_audio/prj.conf
index 0493db4..86aad0c 100644
--- a/tests/bluetooth/bsim_bt/bsim_test_audio/prj.conf
+++ b/tests/bluetooth/bsim_bt/bsim_test_audio/prj.conf
@@ -49,8 +49,8 @@
CONFIG_BT_MICP=y
CONFIG_BT_MICP_AICS_INSTANCE_COUNT=2
-CONFIG_BT_MICP_CLIENT=y
-CONFIG_BT_MICP_CLIENT_MAX_AICS_INST=2
+CONFIG_BT_MICP_MIC_CTLR=y
+CONFIG_BT_MICP_MIC_CTLR_MAX_AICS_INST=2
# Coordinated Set Identification
CONFIG_BT_CSIS=y
@@ -109,7 +109,7 @@
CONFIG_BT_DEBUG_VOCS=y
CONFIG_BT_DEBUG_VOCS_CLIENT=y
CONFIG_BT_DEBUG_MICP=y
-CONFIG_BT_DEBUG_MICP_CLIENT=y
+CONFIG_BT_DEBUG_MICP_MIC_CTLR=y
CONFIG_BT_DEBUG_MPL=y
CONFIG_BT_DEBUG_TBS=y
CONFIG_BT_DEBUG_TBS_CLIENT=y
diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/src/main.c b/tests/bluetooth/bsim_bt/bsim_test_audio/src/main.c
index b86b8d4..6db028f 100644
--- a/tests/bluetooth/bsim_bt/bsim_test_audio/src/main.c
+++ b/tests/bluetooth/bsim_bt/bsim_test_audio/src/main.c
@@ -9,7 +9,7 @@
extern struct bst_test_list *test_vcs_install(struct bst_test_list *tests);
extern struct bst_test_list *test_vcs_client_install(struct bst_test_list *tests);
extern struct bst_test_list *test_micp_install(struct bst_test_list *tests);
-extern struct bst_test_list *test_micp_client_install(struct bst_test_list *tests);
+extern struct bst_test_list *test_micp_mic_ctlr_install(struct bst_test_list *tests);
extern struct bst_test_list *test_csis_install(struct bst_test_list *tests);
extern struct bst_test_list *test_csis_client_install(struct bst_test_list *tests);
extern struct bst_test_list *test_tbs_install(struct bst_test_list *tests);
@@ -31,7 +31,7 @@
test_vcs_install,
test_vcs_client_install,
test_micp_install,
- test_micp_client_install,
+ test_micp_mic_ctlr_install,
test_csis_install,
test_csis_client_install,
test_tbs_install,
diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/src/micp_mic_ctlr_test.c b/tests/bluetooth/bsim_bt/bsim_test_audio/src/micp_mic_ctlr_test.c
index 9cd0af9..a3281ed 100644
--- a/tests/bluetooth/bsim_bt/bsim_test_audio/src/micp_mic_ctlr_test.c
+++ b/tests/bluetooth/bsim_bt/bsim_test_audio/src/micp_mic_ctlr_test.c
@@ -4,15 +4,13 @@
* SPDX-License-Identifier: Apache-2.0
*/
-#ifdef CONFIG_BT_MICP_CLIENT
+#ifdef CONFIG_BT_MICP_MIC_CTLR
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/audio/micp.h>
#include "common.h"
-
-#define VOCS_DESC_SIZE 64
#define AICS_DESC_SIZE 64
extern enum bst_result_t bst_result;
@@ -121,7 +119,8 @@
g_write_complete = true;
}
-static void micp_discover_cb(struct bt_micp *micp, int err, uint8_t aics_count)
+static void micp_mic_ctlr_discover_cb(struct bt_micp *micp, int err,
+ uint8_t aics_count)
{
if (err != 0) {
FAIL("MICP could not be discovered (%d)\n", err);
@@ -132,7 +131,7 @@
g_discovery_complete = true;
}
-static void micp_mute_write_cb(struct bt_micp *micp, int err)
+static void micp_mic_ctlr_mute_written_cb(struct bt_micp *micp, int err)
{
if (err != 0) {
FAIL("MICP mute write failed (%d)\n", err);
@@ -142,7 +141,7 @@
g_write_complete = true;
}
-static void micp_unmute_write_cb(struct bt_micp *micp, int err)
+static void micp_mic_ctlr_unmute_written_cb(struct bt_micp *micp, int err)
{
if (err != 0) {
FAIL("MICP unmute write failed (%d)\n", err);
@@ -152,7 +151,7 @@
g_write_complete = true;
}
-static void micp_mute_cb(struct bt_micp *micp, int err, uint8_t mute)
+static void micp_mic_ctlr_mute_cb(struct bt_micp *micp, int err, uint8_t mute)
{
if (err != 0) {
FAIL("MICP mute read failed (%d)\n", err);
@@ -163,11 +162,11 @@
g_cb = true;
}
-static struct bt_micp_cb micp_cbs = {
- .discover = micp_discover_cb,
- .mute = micp_mute_cb,
- .mute_write = micp_mute_write_cb,
- .unmute_write = micp_unmute_write_cb,
+static struct bt_micp_mic_ctlr_cb micp_mic_ctlr_cbs = {
+ .discover = micp_mic_ctlr_discover_cb,
+ .mute = micp_mic_ctlr_mute_cb,
+ .mute_written = micp_mic_ctlr_mute_written_cb,
+ .unmute_written = micp_mic_ctlr_unmute_written_cb,
.aics_cb = {
.state = aics_state_cb,
.gain_setting = aics_gain_setting_cb,
@@ -256,7 +255,7 @@
printk("AICS gain setting get\n");
printk("Getting AICS input type\n");
- expected_input_type = BT_AICS_INPUT_TYPE_DIGITAL;
+ expected_input_type = BT_AICS_INPUT_TYPE_UNSPECIFIED;
g_cb = false;
err = bt_aics_type_get(micp_included.aics[0]);
if (err != 0) {
@@ -356,7 +355,8 @@
return err;
}
WAIT_FOR_COND(g_cb &&
- strncmp(expected_aics_desc, g_aics_desc, sizeof(expected_aics_desc) == 0));
+ (strncmp(expected_aics_desc, g_aics_desc,
+ sizeof(expected_aics_desc)) == 0));
printk("AICS Description set\n");
printk("AICS passed\n");
@@ -376,7 +376,7 @@
return;
}
- bt_micp_client_cb_register(&micp_cbs);
+ bt_micp_mic_ctlr_cb_register(&micp_mic_ctlr_cbs);
WAIT_FOR_COND(g_bt_init);
@@ -388,20 +388,20 @@
printk("Scanning successfully started\n");
WAIT_FOR_COND(g_is_connected);
- err = bt_micp_discover(default_conn, &micp);
+ err = bt_micp_mic_ctlr_discover(default_conn, &micp);
if (err != 0) {
FAIL("Failed to discover MICP %d", err);
}
WAIT_FOR_COND(g_discovery_complete);
- err = bt_micp_included_get(micp, &micp_included);
+ err = bt_micp_mic_ctlr_included_get(micp, &micp_included);
if (err != 0) {
FAIL("Failed to get MICP context (err %d)\n", err);
return;
}
printk("Getting MICP client conn\n");
- err = bt_micp_client_conn_get(micp, &cached_conn);
+ err = bt_micp_mic_ctlr_conn_get(micp, &cached_conn);
if (err != 0) {
FAIL("Failed to get MICP client conn (err %d)\n", err);
return;
@@ -413,7 +413,7 @@
printk("Getting MICP mute state\n");
g_cb = false;
- err = bt_micp_mute_get(micp);
+ err = bt_micp_mic_ctlr_mute_get(micp);
if (err != 0) {
FAIL("Could not get MICP mute state (err %d)\n", err);
return;
@@ -424,7 +424,7 @@
printk("Muting MICP\n");
expected_mute = 1;
g_write_complete = g_cb = false;
- err = bt_micp_mute(micp);
+ err = bt_micp_mic_ctlr_mute(micp);
if (err != 0) {
FAIL("Could not mute MICP (err %d)\n", err);
return;
@@ -435,7 +435,7 @@
printk("Unmuting MICP\n");
expected_mute = 0;
g_write_complete = g_cb = false;
- err = bt_micp_unmute(micp);
+ err = bt_micp_mic_ctlr_unmute(micp);
if (err != 0) {
FAIL("Could not unmute MICP (err %d)\n", err);
return;
@@ -443,7 +443,7 @@
WAIT_FOR_COND(g_mute == expected_mute && g_cb && g_write_complete);
printk("MICP unmuted\n");
- if (CONFIG_BT_MICP_CLIENT_MAX_AICS_INST > 0 && g_aics_count > 0) {
+ if (CONFIG_BT_MICP_MIC_CTLR_MAX_AICS_INST > 0 && g_aics_count > 0) {
if (test_aics()) {
return;
}
@@ -454,7 +454,7 @@
static const struct bst_test_instance test_micp[] = {
{
- .test_id = "micp_client",
+ .test_id = "micp_mic_ctlr",
.test_post_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main
@@ -462,16 +462,16 @@
BSTEST_END_MARKER
};
-struct bst_test_list *test_micp_client_install(struct bst_test_list *tests)
+struct bst_test_list *test_micp_mic_ctlr_install(struct bst_test_list *tests)
{
return bst_add_tests(tests, test_micp);
}
#else
-struct bst_test_list *test_micp_client_install(struct bst_test_list *tests)
+struct bst_test_list *test_micp_mic_ctlr_install(struct bst_test_list *tests)
{
return tests;
}
-#endif /* CONFIG_BT_MICP_CLIENT */
+#endif /* CONFIG_BT_MICP_MIC_CTLR */
diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/test_scripts/micp.sh b/tests/bluetooth/bsim_bt/bsim_test_audio/test_scripts/micp.sh
index 6b543e8..49cc418 100755
--- a/tests/bluetooth/bsim_bt/bsim_test_audio/test_scripts/micp.sh
+++ b/tests/bluetooth/bsim_bt/bsim_test_audio/test_scripts/micp.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
-# Copyright (c) 2020-2021 Nordic Semiconductor ASA
+# Copyright (c) 2020-2022 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
@@ -43,7 +43,7 @@
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=micp -rs=23
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
- -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=micp_client -rs=46
+ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=micp_mic_ctlr -rs=46
# Simulation time should be larger than the WAIT_TIME in common.h
Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} \
diff --git a/tests/bluetooth/shell/audio.conf b/tests/bluetooth/shell/audio.conf
index a6cdb5d..040c04d 100644
--- a/tests/bluetooth/shell/audio.conf
+++ b/tests/bluetooth/shell/audio.conf
@@ -56,8 +56,8 @@
CONFIG_BT_MICP=y
CONFIG_BT_MICP_AICS_INSTANCE_COUNT=1
-CONFIG_BT_MICP_CLIENT=y
-CONFIG_BT_MICP_CLIENT_MAX_AICS_INST=1
+CONFIG_BT_MICP_MIC_CTLR=y
+CONFIG_BT_MICP_MIC_CTLR_MAX_AICS_INST=1
# Coordinated Set Identification
CONFIG_BT_CSIS=y
diff --git a/tests/bluetooth/shell/testcase.yaml b/tests/bluetooth/shell/testcase.yaml
index c0f9c3c..fd6a80d 100644
--- a/tests/bluetooth/shell/testcase.yaml
+++ b/tests/bluetooth/shell/testcase.yaml
@@ -107,27 +107,27 @@
extra_configs:
- CONFIG_BT_MICP=n
tags: bluetooth
- bluetooth.shell.audio.no_micp_client:
+ bluetooth.shell.audio.no_micp_mic_ctlr:
extra_args: CONF_FILE="audio.conf"
build_only: true
platform_allow: native_posix
extra_configs:
- - CONFIG_BT_MICP_CLIENT=n
+ - CONFIG_BT_MICP_MIC_CTLR=n
tags: bluetooth
- bluetooth.shell.audio.no_micp_micp_client:
+ bluetooth.shell.audio.no_micp_micp_mic_ctlr:
extra_args: CONF_FILE="audio.conf"
build_only: true
platform_allow: native_posix
extra_configs:
- CONFIG_BT_MICP=n
- - CONFIG_BT_MICP_CLIENT=n
+ - CONFIG_BT_MICP_MIC_CTLR=n
tags: bluetooth
- bluetooth.shell.audio.micp_client_no_aics_client:
+ bluetooth.shell.audio.micp_mic_ctlr_no_aics_client:
extra_args: CONF_FILE="audio.conf"
build_only: true
platform_allow: native_posix
extra_configs:
- - CONFIG_BT_MICP_CLIENT_MAX_AICS_INST=0
+ - CONFIG_BT_MICP_MIC_CTLR_MAX_AICS_INST=0
tags: bluetooth
bluetooth.shell.audio.no_mcs:
extra_args: CONF_FILE="audio.conf"