Bluetooth: Audio: Rename MICS to MICP
Use the profile abbreviation, MICP, instead of the service abbreviation, MICS, for the MICP implementation. The server implementation will use MICP and the client implementation will use MICP_CLIENT for now, as that will be updated in a future commit. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
67e570ea7e
commit
9eb5d0795f
19 changed files with 942 additions and 940 deletions
|
@ -7,4 +7,4 @@ Bluetooth Microphone Control
|
||||||
API Reference
|
API Reference
|
||||||
*************
|
*************
|
||||||
|
|
||||||
.. doxygengroup:: bt_gatt_mics
|
.. doxygengroup:: bt_gatt_micp
|
||||||
|
|
|
@ -97,8 +97,8 @@ The VCP implementation supports the following roles
|
||||||
|
|
||||||
The MICP implementation supports the following roles
|
The MICP implementation supports the following roles
|
||||||
|
|
||||||
* Microphone Input Control Service (MICS) Server
|
* Microphone Input Control Profile (MICP) Microphone Device (server)
|
||||||
* Microphone Input Control Service (MICS) Client
|
* Microphone Input Control Profile (MICP) Microphone Controller (client)
|
||||||
|
|
||||||
The API reference for volume control can be found in
|
The API reference for volume control can be found in
|
||||||
:ref:`Bluetooth Volume Control <bluetooth_volume>`.
|
:ref:`Bluetooth Volume Control <bluetooth_volume>`.
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 Nordic Semiconductor ASA
|
* Copyright (c) 2020-2022 Nordic Semiconductor ASA
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_MICS_H_
|
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MICP_H_
|
||||||
#define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_MICS_H_
|
#define ZEPHYR_INCLUDE_BLUETOOTH_MICP_H_
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Microphone Input Control Service (Microphone Input Control Service)
|
* @brief Microphone Input Control Profile (MICP)
|
||||||
*
|
*
|
||||||
* @defgroup bt_gatt_mics Microphone Input Control Service (Microphone Input Control Service)
|
* @defgroup bt_gatt_micp Microphone Input Control Profile (MICP)
|
||||||
*
|
*
|
||||||
* @ingroup bluetooth
|
* @ingroup bluetooth
|
||||||
* @{
|
* @{
|
||||||
|
@ -26,41 +26,41 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MICS)
|
#if defined(CONFIG_BT_MICP)
|
||||||
#define BT_MICS_AICS_CNT CONFIG_BT_MICS_AICS_INSTANCE_COUNT
|
#define BT_MICP_AICS_CNT CONFIG_BT_MICP_AICS_INSTANCE_COUNT
|
||||||
#else
|
#else
|
||||||
#define BT_MICS_AICS_CNT 0
|
#define BT_MICP_AICS_CNT 0
|
||||||
#endif /* CONFIG_BT_MICS */
|
#endif /* CONFIG_BT_MICP */
|
||||||
|
|
||||||
/** Application error codes */
|
/** Application error codes */
|
||||||
#define BT_MICS_ERR_MUTE_DISABLED 0x80
|
#define BT_MICP_ERR_MUTE_DISABLED 0x80
|
||||||
#define BT_MICS_ERR_VAL_OUT_OF_RANGE 0x81
|
#define BT_MICP_ERR_VAL_OUT_OF_RANGE 0x81
|
||||||
|
|
||||||
/** Microphone Input Control Service mute states */
|
/** Microphone Input Control Profile mute states */
|
||||||
#define BT_MICS_MUTE_UNMUTED 0x00
|
#define BT_MICP_MUTE_UNMUTED 0x00
|
||||||
#define BT_MICS_MUTE_MUTED 0x01
|
#define BT_MICP_MUTE_MUTED 0x01
|
||||||
#define BT_MICS_MUTE_DISABLED 0x02
|
#define BT_MICP_MUTE_DISABLED 0x02
|
||||||
|
|
||||||
/** @brief Opaque Microphone Input Control Service instance. */
|
/** @brief Opaque Microphone Input Control Profile instance. */
|
||||||
struct bt_mics;
|
struct bt_micp;
|
||||||
|
|
||||||
/** @brief Register parameters structure for Microphone Input Control Service */
|
/** @brief Register parameters structure for Microphone Input Control Profile instance */
|
||||||
struct bt_mics_register_param {
|
struct bt_micp_register_param {
|
||||||
/** Register parameter structure for Audio Input Control Services */
|
/** Register parameter structure for Audio Input Control Services */
|
||||||
struct bt_aics_register_param aics_param[BT_MICS_AICS_CNT];
|
struct bt_aics_register_param aics_param[BT_MICP_AICS_CNT];
|
||||||
|
|
||||||
/** Microphone Input Control Service callback structure. */
|
/** Microphone Input Control Profile callback structure. */
|
||||||
struct bt_mics_cb *cb;
|
struct bt_micp_cb *cb;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Microphone Input Control Service included services
|
* @brief Microphone Input Control Profile included services
|
||||||
*
|
*
|
||||||
* Used for to represent the Microphone Input Control Service included service
|
* Used for to represent the Microphone Input Control Profile included service
|
||||||
* instances, for either a client or a server instance. The instance pointers
|
* instances, for either a client or a server instance. The instance pointers
|
||||||
* either represent local server instances, or remote service instances.
|
* either represent local server instances, or remote service instances.
|
||||||
*/
|
*/
|
||||||
struct bt_mics_included {
|
struct bt_micp_included {
|
||||||
/** Number of Audio Input Control Service instances */
|
/** Number of Audio Input Control Service instances */
|
||||||
uint8_t aics_cnt;
|
uint8_t aics_cnt;
|
||||||
/** Array of pointers to Audio Input Control Service instances */
|
/** Array of pointers to Audio Input Control Service instances */
|
||||||
|
@ -68,264 +68,266 @@ struct bt_mics_included {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the Microphone Input Control Service
|
* @brief Initialize the Microphone Input Control Profile
|
||||||
*
|
*
|
||||||
* This will enable the service and make it discoverable by clients.
|
* This will enable the Microphone Input Control Profile instance and make it
|
||||||
|
* discoverable by clients.
|
||||||
* This can only be done as the server.
|
* This can only be done as the server.
|
||||||
*
|
*
|
||||||
* @param param Pointer to an initialization structure.
|
* @param param Pointer to an initialization structure.
|
||||||
* @param[out] mics Pointer to the registered Microphone Input Control Service.
|
* @param[out] micp Pointer to the registered Microphone Input Control Profile
|
||||||
* This will still be valid if the return value is -EALREADY.
|
* instance. This will still be valid if the return value is
|
||||||
|
* -EALREADY.
|
||||||
*
|
*
|
||||||
* @return 0 if success, errno on failure.
|
* @return 0 if success, errno on failure.
|
||||||
*/
|
*/
|
||||||
int bt_mics_register(struct bt_mics_register_param *param,
|
int bt_micp_register(struct bt_micp_register_param *param,
|
||||||
struct bt_mics **mics);
|
struct bt_micp **micp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get Microphone Input Control Service included services
|
* @brief Get Microphone Input Control Profile included services
|
||||||
*
|
*
|
||||||
* Returns a pointer to a struct that contains information about the
|
* Returns a pointer to a struct that contains information about the
|
||||||
* Microphone Input Control Service included services instances, such as
|
* Microphone Input Control Profile included services instances, such as
|
||||||
* pointers to the Audio Input Control Service instances.
|
* pointers to the Audio Input Control Service instances.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance pointer.
|
||||||
* @param[out] included Pointer to store the result in.
|
* @param[out] included Pointer to store the result in.
|
||||||
*
|
*
|
||||||
* @return 0 if success, errno on failure.
|
* @return 0 if success, errno on failure.
|
||||||
*/
|
*/
|
||||||
int bt_mics_included_get(struct bt_mics *mics,
|
int bt_micp_included_get(struct bt_micp *micp,
|
||||||
struct bt_mics_included *included);
|
struct bt_micp_included *included);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the connection pointer of a client instance
|
* @brief Get the connection pointer of a client instance
|
||||||
*
|
*
|
||||||
* Get the Bluetooth connection pointer of a Microphone Input Control Service
|
* Get the Bluetooth connection pointer of a Microphone Input Control Profile
|
||||||
* client instance.
|
* client instance.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service client instance pointer.
|
* @param micp Microphone Input Control Profile client instance pointer.
|
||||||
* @param conn Connection pointer.
|
* @param conn Connection pointer.
|
||||||
*
|
*
|
||||||
* @return 0 if success, errno on failure.
|
* @return 0 if success, errno on failure.
|
||||||
*/
|
*/
|
||||||
int bt_mics_client_conn_get(const struct bt_mics *mics, struct bt_conn **conn);
|
int bt_micp_client_conn_get(const struct bt_micp *micp, struct bt_conn **conn);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Callback function for @ref bt_mics_discover.
|
* @brief Callback function for @ref bt_micp_discover.
|
||||||
*
|
*
|
||||||
* This callback is only used for the client.
|
* This callback is only used for the client.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance pointer.
|
||||||
* @param err Error value. 0 on success, GATT error or errno on fail.
|
* @param err Error value. 0 on success, GATT error or errno on fail.
|
||||||
* @param aics_count Number of Audio Input Control Service instances on
|
* @param aics_count Number of Audio Input Control Service instances on
|
||||||
* peer device.
|
* peer device.
|
||||||
*/
|
*/
|
||||||
typedef void (*bt_mics_discover_cb)(struct bt_mics *mics, int err,
|
typedef void (*bt_micp_discover_cb)(struct bt_micp *micp, int err,
|
||||||
uint8_t aics_count);
|
uint8_t aics_count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Callback function for Microphone Input Control Service mute.
|
* @brief Callback function for Microphone Input Control Profile mute.
|
||||||
*
|
*
|
||||||
* Called when the value is read,
|
* Called when the value is read,
|
||||||
* or if the value is changed by either the server or client.
|
* or if the value is changed by either the server or client.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance pointer.
|
||||||
* @param err Error value. 0 on success, GATT error or errno on fail.
|
* @param err Error value. 0 on success, GATT error or errno on fail.
|
||||||
* For notifications, this will always be 0.
|
* For notifications, this will always be 0.
|
||||||
* @param mute The mute setting of the Microphone Input Control Service.
|
* @param mute The mute setting of the Microphone Input Control Profile instance.
|
||||||
*/
|
*/
|
||||||
typedef void (*bt_mics_mute_read_cb)(struct bt_mics *mics, int err,
|
typedef void (*bt_micp_mute_read_cb)(struct bt_micp *micp, int err,
|
||||||
uint8_t mute);
|
uint8_t mute);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Callback function for Microphone Input Control Service mute/unmute.
|
* @brief Callback function for Microphone Input Control Profile mute/unmute.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance pointer.
|
||||||
* @param err Error value. 0 on success, GATT error or errno on fail.
|
* @param err Error value. 0 on success, GATT error or errno on fail.
|
||||||
*/
|
*/
|
||||||
typedef void (*bt_mics_mute_write_cb)(struct bt_mics *mics, int err);
|
typedef void (*bt_micp_mute_write_cb)(struct bt_micp *micp, int err);
|
||||||
|
|
||||||
struct bt_mics_cb {
|
struct bt_micp_cb {
|
||||||
bt_mics_mute_read_cb mute;
|
bt_micp_mute_read_cb mute;
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MICS_CLIENT)
|
#if defined(CONFIG_BT_MICP_CLIENT)
|
||||||
bt_mics_discover_cb discover;
|
bt_micp_discover_cb discover;
|
||||||
bt_mics_mute_write_cb mute_write;
|
bt_micp_mute_write_cb mute_write;
|
||||||
bt_mics_mute_write_cb unmute_write;
|
bt_micp_mute_write_cb unmute_write;
|
||||||
|
|
||||||
/** Audio Input Control Service client callback */
|
/** Audio Input Control Service client callback */
|
||||||
struct bt_aics_cb aics_cb;
|
struct bt_aics_cb aics_cb;
|
||||||
#endif /* CONFIG_BT_MICS_CLIENT */
|
#endif /* CONFIG_BT_MICP_CLIENT */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Discover Microphone Input Control Service
|
* @brief Discover Microphone Input Control Profile instance
|
||||||
*
|
*
|
||||||
* This will start a GATT discovery and setup handles and subscriptions.
|
* 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
|
* This shall be called once before any other actions can be executed for the
|
||||||
* peer device, and the @ref bt_mics_discover_cb callback will notify when it
|
* peer device, and the @ref bt_micp_discover_cb callback will notify when it
|
||||||
* is possible to start remote operations.
|
* is possible to start remote operations.
|
||||||
*
|
*
|
||||||
* This shall only be done as the client.
|
* This shall only be done as the client.
|
||||||
*
|
*
|
||||||
* @param conn The connection to initialize the profile for.
|
* @param conn The connection to initialize the profile for.
|
||||||
* @param[out] mics Valid remote instance object on success.
|
* @param[out] micp Valid remote instance object on success.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_discover(struct bt_conn *conn, struct bt_mics **mics);
|
int bt_micp_discover(struct bt_conn *conn, struct bt_micp **micp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Unmute the server.
|
* @brief Unmute the server.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance pointer.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_unmute(struct bt_mics *mics);
|
int bt_micp_unmute(struct bt_micp *micp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Mute the server.
|
* @brief Mute the server.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance pointer.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_mute(struct bt_mics *mics);
|
int bt_micp_mute(struct bt_micp *micp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Disable the mute functionality.
|
* @brief Disable the mute functionality.
|
||||||
*
|
*
|
||||||
* Can be reenabled by called @ref bt_mics_mute or @ref bt_mics_unmute.
|
* Can be reenabled by called @ref bt_micp_mute or @ref bt_micp_unmute.
|
||||||
* This can only be done as the server.
|
* This can only be done as the server.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance pointer.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_mute_disable(struct bt_mics *mics);
|
int bt_micp_mute_disable(struct bt_micp *micp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read the mute state of a Microphone Input Control Service.
|
* @brief Read the mute state of a Microphone Input Control Profile instance.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance pointer.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_mute_get(struct bt_mics *mics);
|
int bt_micp_mute_get(struct bt_micp *micp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read the Audio Input Control Service input state.
|
* @brief Read the Audio Input Control Service input state.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance pointer.
|
||||||
* @param inst Pointer to the Audio Input Control Service instance.
|
* @param inst Pointer to the Audio Input Control Service instance.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_aics_state_get(struct bt_mics *mics, struct bt_aics *inst);
|
int bt_micp_aics_state_get(struct bt_micp *micp, struct bt_aics *inst);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read the Audio Input Control Service gain settings.
|
* @brief Read the Audio Input Control Service gain settings.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance pointer.
|
||||||
* @param inst Pointer to the Audio Input Control Service instance.
|
* @param inst Pointer to the Audio Input Control Service instance.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_aics_gain_setting_get(struct bt_mics *mics, struct bt_aics *inst);
|
int bt_micp_aics_gain_setting_get(struct bt_micp *micp, struct bt_aics *inst);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read the Audio Input Control Service input type.
|
* @brief Read the Audio Input Control Service input type.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance instance pointer.
|
||||||
* @param inst Pointer to the Audio Input Control Service instance.
|
* @param inst Pointer to the Audio Input Control Service instance.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_aics_type_get(struct bt_mics *mics, struct bt_aics *inst);
|
int bt_micp_aics_type_get(struct bt_micp *micp, struct bt_aics *inst);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read the Audio Input Control Service input status.
|
* @brief Read the Audio Input Control Service input status.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance instance pointer.
|
||||||
* @param inst Pointer to the Audio Input Control Service instance.
|
* @param inst Pointer to the Audio Input Control Service instance.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_aics_status_get(struct bt_mics *mics, struct bt_aics *inst);
|
int bt_micp_aics_status_get(struct bt_micp *micp, struct bt_aics *inst);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Unmute the Audio Input Control Service input.
|
* @brief Unmute the Audio Input Control Service input.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance instance pointer.
|
||||||
* @param inst Pointer to the Audio Input Control Service instance.
|
* @param inst Pointer to the Audio Input Control Service instance.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_aics_unmute(struct bt_mics *mics, struct bt_aics *inst);
|
int bt_micp_aics_unmute(struct bt_micp *micp, struct bt_aics *inst);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Mute the Audio Input Control Service input.
|
* @brief Mute the Audio Input Control Service input.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance instance pointer.
|
||||||
* @param inst Pointer to the Audio Input Control Service instance.
|
* @param inst Pointer to the Audio Input Control Service instance.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_aics_mute(struct bt_mics *mics, struct bt_aics *inst);
|
int bt_micp_aics_mute(struct bt_micp *micp, struct bt_aics *inst);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set Audio Input Control Service gain mode to manual.
|
* @brief Set Audio Input Control Service gain mode to manual.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance instance pointer.
|
||||||
* @param inst Pointer to the Audio Input Control Service instance.
|
* @param inst Pointer to the Audio Input Control Service instance.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_aics_manual_gain_set(struct bt_mics *mics, struct bt_aics *inst);
|
int bt_micp_aics_manual_gain_set(struct bt_micp *micp, struct bt_aics *inst);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set Audio Input Control Service gain mode to automatic.
|
* @brief Set Audio Input Control Service gain mode to automatic.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance instance pointer.
|
||||||
* @param inst Pointer to the Audio Input Control Service instance.
|
* @param inst Pointer to the Audio Input Control Service instance.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_aics_automatic_gain_set(struct bt_mics *mics, struct bt_aics *inst);
|
int bt_micp_aics_automatic_gain_set(struct bt_micp *micp, struct bt_aics *inst);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set Audio Input Control Service input gain.
|
* @brief Set Audio Input Control Service input gain.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance instance pointer.
|
||||||
* @param inst Pointer to the Audio Input Control Service instance.
|
* @param inst Pointer to the Audio Input Control Service instance.
|
||||||
* @param gain The gain in dB to set (-128 to 127).
|
* @param gain The gain in dB to set (-128 to 127).
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_aics_gain_set(struct bt_mics *mics, struct bt_aics *inst,
|
int bt_micp_aics_gain_set(struct bt_micp *micp, struct bt_aics *inst,
|
||||||
int8_t gain);
|
int8_t gain);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read the Audio Input Control Service description.
|
* @brief Read the Audio Input Control Service description.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance instance pointer.
|
||||||
* @param inst Pointer to the Audio Input Control Service instance.
|
* @param inst Pointer to the Audio Input Control Service instance.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_aics_description_get(struct bt_mics *mics, struct bt_aics *inst);
|
int bt_micp_aics_description_get(struct bt_micp *micp, struct bt_aics *inst);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the Audio Input Control Service description.
|
* @brief Set the Audio Input Control Service description.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance instance pointer.
|
||||||
* @param inst Pointer to the Audio Input Control Service instance.
|
* @param inst Pointer to the Audio Input Control Service instance.
|
||||||
* @param description The description to set.
|
* @param description The description to set.
|
||||||
*
|
*
|
||||||
* @return 0 on success, GATT error value on fail.
|
* @return 0 on success, GATT error value on fail.
|
||||||
*/
|
*/
|
||||||
int bt_mics_aics_description_set(struct bt_mics *mics, struct bt_aics *inst,
|
int bt_micp_aics_description_set(struct bt_micp *micp, struct bt_aics *inst,
|
||||||
const char *description);
|
const char *description);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -335,30 +337,30 @@ int bt_mics_aics_description_set(struct bt_mics *mics, struct bt_aics *inst,
|
||||||
* the server to deactivate a Audio Input Control Service.
|
* the server to deactivate a Audio Input Control Service.
|
||||||
* This can only be done as the server.
|
* This can only be done as the server.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance instance pointer.
|
||||||
* @param inst Pointer to the Audio Input Control Service instance.
|
* @param inst Pointer to the Audio Input Control Service instance.
|
||||||
*
|
*
|
||||||
* @return 0 if success, errno on failure.
|
* @return 0 if success, errno on failure.
|
||||||
*/
|
*/
|
||||||
int bt_mics_aics_deactivate(struct bt_mics *mics, struct bt_aics *inst);
|
int bt_micp_aics_deactivate(struct bt_micp *micp, struct bt_aics *inst);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Activates a Audio Input Control Service instance.
|
* @brief Activates a Audio Input Control Service instance.
|
||||||
*
|
*
|
||||||
* Audio Input Control Services are activated by default, but this will allow
|
* Audio Input Control Services are activated by default, but this will allow
|
||||||
* the server to reactivate a Audio Input Control Service instance after it has
|
* the server to reactivate a Audio Input Control Service instance after it has
|
||||||
* been deactivated with @ref bt_mics_aics_deactivate.
|
* been deactivated with @ref bt_micp_aics_deactivate.
|
||||||
* This can only be done as the server.
|
* This can only be done as the server.
|
||||||
*
|
*
|
||||||
* @param mics Microphone Input Control Service instance pointer.
|
* @param micp Microphone Input Control Profile instance instance pointer.
|
||||||
* @param inst Pointer to the Audio Input Control Service instance.
|
* @param inst Pointer to the Audio Input Control Service instance.
|
||||||
*
|
*
|
||||||
* @return 0 if success, errno on failure.
|
* @return 0 if success, errno on failure.
|
||||||
*/
|
*/
|
||||||
int bt_mics_aics_activate(struct bt_mics *mics, struct bt_aics *inst);
|
int bt_micp_aics_activate(struct bt_micp *micp, struct bt_aics *inst);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Registers the callbacks used by Microphone Input Control Service client.
|
* @brief Registers the callbacks used by Microphone Input Control Profile client.
|
||||||
*
|
*
|
||||||
* This can only be done as the client.
|
* This can only be done as the client.
|
||||||
*
|
*
|
||||||
|
@ -366,7 +368,7 @@ int bt_mics_aics_activate(struct bt_mics *mics, struct bt_aics *inst);
|
||||||
*
|
*
|
||||||
* @return 0 if success, errno on failure.
|
* @return 0 if success, errno on failure.
|
||||||
*/
|
*/
|
||||||
int bt_mics_client_cb_register(struct bt_mics_cb *cb);
|
int bt_micp_client_cb_register(struct bt_micp_cb *cb);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -376,4 +378,4 @@ int bt_mics_client_cb_register(struct bt_mics_cb *cb);
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_MICS_H_ */
|
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MICP_H_ */
|
||||||
|
|
|
@ -17,10 +17,10 @@ if (CONFIG_BT_VCS OR CONFIG_BT_VCS_CLIENT)
|
||||||
endif()
|
endif()
|
||||||
zephyr_library_sources_ifdef(CONFIG_BT_VCS_CLIENT vcs_client.c)
|
zephyr_library_sources_ifdef(CONFIG_BT_VCS_CLIENT vcs_client.c)
|
||||||
|
|
||||||
if (CONFIG_BT_MICS OR CONFIG_BT_MICS_CLIENT)
|
if (CONFIG_BT_MICP OR CONFIG_BT_MICP_CLIENT)
|
||||||
zephyr_library_sources(mics.c)
|
zephyr_library_sources(mics.c)
|
||||||
endif()
|
endif()
|
||||||
zephyr_library_sources_ifdef(CONFIG_BT_MICS_CLIENT mics_client.c)
|
zephyr_library_sources_ifdef(CONFIG_BT_MICP_CLIENT mics_client.c)
|
||||||
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_BT_CCID ccid.c)
|
zephyr_library_sources_ifdef(CONFIG_BT_CCID ccid.c)
|
||||||
|
|
||||||
|
|
|
@ -8,42 +8,42 @@
|
||||||
|
|
||||||
##################### Microphone Input Control Service #####################
|
##################### Microphone Input Control Service #####################
|
||||||
|
|
||||||
config BT_MICS
|
config BT_MICP
|
||||||
bool "Microphone Input Control Service Support [EXPERIMENTAL]"
|
bool "Microphone Input Control Profile Support [EXPERIMENTAL]"
|
||||||
select EXPERIMENTAL
|
select EXPERIMENTAL
|
||||||
help
|
help
|
||||||
This option enables support for Microphone Input Control Service.
|
This option enables support for Microphone Input Control Service.
|
||||||
|
|
||||||
if BT_MICS
|
if BT_MICP
|
||||||
|
|
||||||
config BT_MICS_AICS_INSTANCE_COUNT
|
config BT_MICP_AICS_INSTANCE_COUNT
|
||||||
int "Audio Input Control Service instance count for Microphone Input Control Service"
|
int "Audio Input Control Service instance count for Microphone Input Control Service"
|
||||||
default 0
|
default 0
|
||||||
range 0 BT_AICS_MAX_INSTANCE_COUNT
|
range 0 BT_AICS_MAX_INSTANCE_COUNT
|
||||||
help
|
help
|
||||||
This option sets the number of instances of Audio Input Control
|
This option sets the number of instances of Audio Input Control
|
||||||
Services for MICS.
|
Services for MICP.
|
||||||
|
|
||||||
config BT_MICS_AICS
|
config BT_MICP_AICS
|
||||||
bool # Hidden
|
bool # Hidden
|
||||||
default y if BT_MICS_AICS_INSTANCE_COUNT > 0
|
default y if BT_MICP_AICS_INSTANCE_COUNT > 0
|
||||||
help
|
help
|
||||||
This hidden option makes it possible to easily check if AICS is
|
This hidden option makes it possible to easily check if AICS is
|
||||||
enabled for MICS.
|
enabled for MICP.
|
||||||
|
|
||||||
############# DEBUG #############
|
############# DEBUG #############
|
||||||
|
|
||||||
config BT_DEBUG_MICS
|
config BT_DEBUG_MICP
|
||||||
bool "Microphone Input Control Service debug"
|
bool "Microphone Input Control Service debug"
|
||||||
help
|
help
|
||||||
Use this option to enable Microphone Input Control Service debug logs
|
Use this option to enable Microphone Input Control Service debug logs
|
||||||
for the Bluetooth Audio functionality.
|
for the Bluetooth Audio functionality.
|
||||||
|
|
||||||
endif # BT_MICS
|
endif # BT_MICP
|
||||||
|
|
||||||
##################### Microphone Control Profile Client #####################
|
##################### Microphone Control Profile Client #####################
|
||||||
|
|
||||||
config BT_MICS_CLIENT
|
config BT_MICP_CLIENT
|
||||||
bool "Microphone Control Profile Support [EXPERIMENTAL]"
|
bool "Microphone Control Profile Support [EXPERIMENTAL]"
|
||||||
select BT_GATT_CLIENT
|
select BT_GATT_CLIENT
|
||||||
select BT_GATT_AUTO_DISCOVER_CCC
|
select BT_GATT_AUTO_DISCOVER_CCC
|
||||||
|
@ -51,9 +51,9 @@ config BT_MICS_CLIENT
|
||||||
help
|
help
|
||||||
This option enables support for Microphone Control Profile.
|
This option enables support for Microphone Control Profile.
|
||||||
|
|
||||||
if BT_MICS_CLIENT
|
if BT_MICP_CLIENT
|
||||||
|
|
||||||
config BT_MICS_CLIENT_MAX_AICS_INST
|
config BT_MICP_CLIENT_MAX_AICS_INST
|
||||||
int "Maximum number of Audio Input Control Service instances to setup"
|
int "Maximum number of Audio Input Control Service instances to setup"
|
||||||
default 0
|
default 0
|
||||||
range 0 3
|
range 0 3
|
||||||
|
@ -61,19 +61,19 @@ config BT_MICS_CLIENT_MAX_AICS_INST
|
||||||
Sets the maximum number of Audio Input Control Service (AICS)
|
Sets the maximum number of Audio Input Control Service (AICS)
|
||||||
instances to setup and use.
|
instances to setup and use.
|
||||||
|
|
||||||
config BT_MICS_CLIENT_AICS
|
config BT_MICP_CLIENT_AICS
|
||||||
bool # Hidden
|
bool # Hidden
|
||||||
default y if BT_MICS_CLIENT_MAX_AICS_INST > 0
|
default y if BT_MICP_CLIENT_MAX_AICS_INST > 0
|
||||||
help
|
help
|
||||||
This hidden option makes it possible to easily check if AICS is
|
This hidden option makes it possible to easily check if AICS is
|
||||||
enabled for MICS client.
|
enabled for MICP client.
|
||||||
|
|
||||||
############# DEBUG #############
|
############# DEBUG #############
|
||||||
|
|
||||||
config BT_DEBUG_MICS_CLIENT
|
config BT_DEBUG_MICP_CLIENT
|
||||||
bool "Microphone Control Profile debug"
|
bool "Microphone Control Profile debug"
|
||||||
help
|
help
|
||||||
Use this option to enable Microphone Control Profile debug logs for
|
Use this option to enable Microphone Control Profile debug logs for
|
||||||
the Bluetooth Audio functionality.
|
the Bluetooth Audio functionality.
|
||||||
|
|
||||||
endif # BT_MICS_CLIENT
|
endif # BT_MICP_CLIENT
|
||||||
|
|
61
subsys/bluetooth/audio/micp_internal.h
Normal file
61
subsys/bluetooth/audio/micp_internal.h
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020-2022 Nordic Semiconductor ASA
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_MICP_INTERNAL_
|
||||||
|
#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_MICP_INTERNAL_
|
||||||
|
#include <zephyr/types.h>
|
||||||
|
#include <zephyr/bluetooth/gatt.h>
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_MICP)
|
||||||
|
struct bt_micp_server {
|
||||||
|
uint8_t mute;
|
||||||
|
struct bt_micp_cb *cb;
|
||||||
|
struct bt_gatt_service *service_p;
|
||||||
|
struct bt_aics *aics_insts[CONFIG_BT_MICP_AICS_INSTANCE_COUNT];
|
||||||
|
};
|
||||||
|
#endif /* CONFIG_BT_MICP */
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_MICP_CLIENT)
|
||||||
|
struct bt_micp_client {
|
||||||
|
uint16_t start_handle;
|
||||||
|
uint16_t end_handle;
|
||||||
|
uint16_t mute_handle;
|
||||||
|
struct bt_gatt_subscribe_params mute_sub_params;
|
||||||
|
struct bt_gatt_discover_params mute_sub_disc_params;
|
||||||
|
|
||||||
|
bool busy;
|
||||||
|
uint8_t mute_val_buf[1]; /* Mute value is a single octet */
|
||||||
|
struct bt_gatt_write_params write_params;
|
||||||
|
struct bt_gatt_read_params read_params;
|
||||||
|
struct bt_gatt_discover_params discover_params;
|
||||||
|
struct bt_conn *conn;
|
||||||
|
|
||||||
|
uint8_t aics_inst_cnt;
|
||||||
|
struct bt_aics *aics[CONFIG_BT_MICP_CLIENT_MAX_AICS_INST];
|
||||||
|
};
|
||||||
|
#endif /* CONFIG_BT_MICP_CLIENT */
|
||||||
|
|
||||||
|
/* Struct used as a common type for the api */
|
||||||
|
struct bt_micp {
|
||||||
|
bool client_instance;
|
||||||
|
union {
|
||||||
|
#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 */
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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);
|
||||||
|
bool bt_micp_client_valid_aics_inst(struct bt_micp *micp, struct bt_aics *aics);
|
||||||
|
|
||||||
|
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_MICS_INTERNAL_ */
|
|
@ -1,7 +1,7 @@
|
||||||
/* Bluetooth MICS
|
/* Bluetooth MICS
|
||||||
*
|
*
|
||||||
* Copyright (c) 2020 Bose Corporation
|
* Copyright (c) 2020 Bose Corporation
|
||||||
* Copyright (c) 2020-2021 Nordic Semiconductor ASA
|
* Copyright (c) 2020-2022 Nordic Semiconductor ASA
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -19,15 +19,15 @@
|
||||||
#include <zephyr/bluetooth/audio/micp.h>
|
#include <zephyr/bluetooth/audio/micp.h>
|
||||||
#include <zephyr/bluetooth/audio/aics.h>
|
#include <zephyr/bluetooth/audio/aics.h>
|
||||||
|
|
||||||
#include "mics_internal.h"
|
#include "micp_internal.h"
|
||||||
|
|
||||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_MICS)
|
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_MICP)
|
||||||
#define LOG_MODULE_NAME bt_mics
|
#define LOG_MODULE_NAME bt_micp
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MICS)
|
#if defined(CONFIG_BT_MICP)
|
||||||
|
|
||||||
static struct bt_mics mics_inst;
|
static struct bt_micp micp_inst;
|
||||||
|
|
||||||
static void mute_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
|
static void mute_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
|
||||||
{
|
{
|
||||||
|
@ -38,10 +38,10 @@ static ssize_t read_mute(struct bt_conn *conn,
|
||||||
const struct bt_gatt_attr *attr, void *buf,
|
const struct bt_gatt_attr *attr, void *buf,
|
||||||
uint16_t len, uint16_t offset)
|
uint16_t len, uint16_t offset)
|
||||||
{
|
{
|
||||||
BT_DBG("Mute %u", mics_inst.srv.mute);
|
BT_DBG("Mute %u", micp_inst.srv.mute);
|
||||||
|
|
||||||
return bt_gatt_attr_read(conn, attr, buf, len, offset,
|
return bt_gatt_attr_read(conn, attr, buf, len, offset,
|
||||||
&mics_inst.srv.mute, sizeof(mics_inst.srv.mute));
|
&micp_inst.srv.mute, sizeof(micp_inst.srv.mute));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t write_mute(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
static ssize_t write_mute(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||||
|
@ -54,30 +54,30 @@ static ssize_t write_mute(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||||
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
|
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len != sizeof(mics_inst.srv.mute)) {
|
if (len != sizeof(micp_inst.srv.mute)) {
|
||||||
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
|
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((conn != NULL && *val == BT_MICS_MUTE_DISABLED) ||
|
if ((conn != NULL && *val == BT_MICP_MUTE_DISABLED) ||
|
||||||
*val > BT_MICS_MUTE_DISABLED) {
|
*val > BT_MICP_MUTE_DISABLED) {
|
||||||
return BT_GATT_ERR(BT_MICS_ERR_VAL_OUT_OF_RANGE);
|
return BT_GATT_ERR(BT_MICP_ERR_VAL_OUT_OF_RANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn != NULL && mics_inst.srv.mute == BT_MICS_MUTE_DISABLED) {
|
if (conn != NULL && micp_inst.srv.mute == BT_MICP_MUTE_DISABLED) {
|
||||||
return BT_GATT_ERR(BT_MICS_ERR_MUTE_DISABLED);
|
return BT_GATT_ERR(BT_MICP_ERR_MUTE_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
BT_DBG("%u", *val);
|
BT_DBG("%u", *val);
|
||||||
|
|
||||||
if (*val != mics_inst.srv.mute) {
|
if (*val != micp_inst.srv.mute) {
|
||||||
mics_inst.srv.mute = *val;
|
micp_inst.srv.mute = *val;
|
||||||
|
|
||||||
bt_gatt_notify_uuid(NULL, BT_UUID_MICS_MUTE,
|
bt_gatt_notify_uuid(NULL, BT_UUID_MICS_MUTE,
|
||||||
mics_inst.srv.service_p->attrs,
|
micp_inst.srv.service_p->attrs,
|
||||||
&mics_inst.srv.mute, sizeof(mics_inst.srv.mute));
|
&micp_inst.srv.mute, sizeof(micp_inst.srv.mute));
|
||||||
|
|
||||||
if (mics_inst.srv.cb != NULL && mics_inst.srv.cb->mute != NULL) {
|
if (micp_inst.srv.cb != NULL && micp_inst.srv.cb->mute != NULL) {
|
||||||
mics_inst.srv.cb->mute(NULL, 0, mics_inst.srv.mute);
|
micp_inst.srv.cb->mute(NULL, 0, micp_inst.srv.mute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,9 +88,9 @@ static ssize_t write_mute(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||||
#define DUMMY_INCLUDE(i, _) BT_GATT_INCLUDE_SERVICE(NULL),
|
#define DUMMY_INCLUDE(i, _) BT_GATT_INCLUDE_SERVICE(NULL),
|
||||||
#define AICS_INCLUDES(cnt) LISTIFY(cnt, DUMMY_INCLUDE, ())
|
#define AICS_INCLUDES(cnt) LISTIFY(cnt, DUMMY_INCLUDE, ())
|
||||||
|
|
||||||
#define BT_MICS_SERVICE_DEFINITION \
|
#define BT_MICP_SERVICE_DEFINITION \
|
||||||
BT_GATT_PRIMARY_SERVICE(BT_UUID_MICS), \
|
BT_GATT_PRIMARY_SERVICE(BT_UUID_MICS), \
|
||||||
AICS_INCLUDES(CONFIG_BT_MICS_AICS_INSTANCE_COUNT) \
|
AICS_INCLUDES(CONFIG_BT_MICP_AICS_INSTANCE_COUNT) \
|
||||||
BT_GATT_CHARACTERISTIC(BT_UUID_MICS_MUTE, \
|
BT_GATT_CHARACTERISTIC(BT_UUID_MICS_MUTE, \
|
||||||
BT_GATT_CHRC_READ | BT_GATT_CHRC_WRITE | BT_GATT_CHRC_NOTIFY, \
|
BT_GATT_CHRC_READ | BT_GATT_CHRC_WRITE | BT_GATT_CHRC_NOTIFY, \
|
||||||
BT_GATT_PERM_READ_ENCRYPT | BT_GATT_PERM_WRITE_ENCRYPT, \
|
BT_GATT_PERM_READ_ENCRYPT | BT_GATT_PERM_WRITE_ENCRYPT, \
|
||||||
|
@ -99,13 +99,13 @@ static ssize_t write_mute(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||||
BT_GATT_PERM_READ | BT_GATT_PERM_WRITE_ENCRYPT)
|
BT_GATT_PERM_READ | BT_GATT_PERM_WRITE_ENCRYPT)
|
||||||
|
|
||||||
#define MICS_ATTR_COUNT \
|
#define MICS_ATTR_COUNT \
|
||||||
ARRAY_SIZE(((struct bt_gatt_attr []){ BT_MICS_SERVICE_DEFINITION }))
|
ARRAY_SIZE(((struct bt_gatt_attr []){ BT_MICP_SERVICE_DEFINITION }))
|
||||||
#define MICS_INCL_COUNT (CONFIG_BT_MICS_AICS_INSTANCE_COUNT)
|
#define MICS_INCL_COUNT (CONFIG_BT_MICP_AICS_INSTANCE_COUNT)
|
||||||
|
|
||||||
static struct bt_gatt_attr mics_attrs[] = { BT_MICS_SERVICE_DEFINITION };
|
static struct bt_gatt_attr mics_attrs[] = { BT_MICP_SERVICE_DEFINITION };
|
||||||
static struct bt_gatt_service mics_svc;
|
static struct bt_gatt_service mics_svc;
|
||||||
|
|
||||||
static int prepare_aics_inst(struct bt_mics_register_param *param)
|
static int prepare_aics_inst(struct bt_micp_register_param *param)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
@ -113,72 +113,72 @@ static int prepare_aics_inst(struct bt_mics_register_param *param)
|
||||||
|
|
||||||
for (j = 0, i = 0; i < ARRAY_SIZE(mics_attrs); i++) {
|
for (j = 0, i = 0; i < ARRAY_SIZE(mics_attrs); i++) {
|
||||||
if (bt_uuid_cmp(mics_attrs[i].uuid, BT_UUID_GATT_INCLUDE) == 0) {
|
if (bt_uuid_cmp(mics_attrs[i].uuid, BT_UUID_GATT_INCLUDE) == 0) {
|
||||||
mics_inst.srv.aics_insts[j] = bt_aics_free_instance_get();
|
micp_inst.srv.aics_insts[j] = bt_aics_free_instance_get();
|
||||||
if (mics_inst.srv.aics_insts[j] == NULL) {
|
if (micp_inst.srv.aics_insts[j] == NULL) {
|
||||||
BT_DBG("Could not get free AICS instances[%u]", j);
|
BT_DBG("Could not get free AICS instances[%u]", j);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = bt_aics_register(mics_inst.srv.aics_insts[j],
|
err = bt_aics_register(micp_inst.srv.aics_insts[j],
|
||||||
¶m->aics_param[j]);
|
¶m->aics_param[j]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
BT_DBG("Could not register AICS instance[%u]: %d", j, err);
|
BT_DBG("Could not register AICS instance[%u]: %d", j, err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
mics_attrs[i].user_data = bt_aics_svc_decl_get(mics_inst.srv.aics_insts[j]);
|
mics_attrs[i].user_data = bt_aics_svc_decl_get(micp_inst.srv.aics_insts[j]);
|
||||||
j++;
|
j++;
|
||||||
|
|
||||||
if (j == CONFIG_BT_MICS_AICS_INSTANCE_COUNT) {
|
if (j == CONFIG_BT_MICP_AICS_INSTANCE_COUNT) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__ASSERT(j == CONFIG_BT_MICS_AICS_INSTANCE_COUNT,
|
__ASSERT(j == CONFIG_BT_MICP_AICS_INSTANCE_COUNT,
|
||||||
"Invalid AICS instance count");
|
"Invalid AICS instance count");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************** PUBLIC API ******************************/
|
/****************************** PUBLIC API ******************************/
|
||||||
int bt_mics_register(struct bt_mics_register_param *param,
|
int bt_micp_register(struct bt_micp_register_param *param,
|
||||||
struct bt_mics **mics)
|
struct bt_micp **micp)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
static bool registered;
|
static bool registered;
|
||||||
|
|
||||||
if (registered) {
|
if (registered) {
|
||||||
*mics = &mics_inst;
|
*micp = &micp_inst;
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
}
|
}
|
||||||
|
|
||||||
__ASSERT(param, "MICS register parameter cannot be NULL");
|
__ASSERT(param, "MICS register parameter cannot be NULL");
|
||||||
|
|
||||||
if (CONFIG_BT_MICS_AICS_INSTANCE_COUNT > 0) {
|
if (CONFIG_BT_MICP_AICS_INSTANCE_COUNT > 0) {
|
||||||
prepare_aics_inst(param);
|
prepare_aics_inst(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
mics_svc = (struct bt_gatt_service)BT_GATT_SERVICE(mics_attrs);
|
mics_svc = (struct bt_gatt_service)BT_GATT_SERVICE(mics_attrs);
|
||||||
mics_inst.srv.service_p = &mics_svc;
|
micp_inst.srv.service_p = &mics_svc;
|
||||||
err = bt_gatt_service_register(&mics_svc);
|
err = bt_gatt_service_register(&mics_svc);
|
||||||
|
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
BT_ERR("MICS service register failed: %d", err);
|
BT_ERR("MICS service register failed: %d", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
mics_inst.srv.cb = param->cb;
|
micp_inst.srv.cb = param->cb;
|
||||||
|
|
||||||
*mics = &mics_inst;
|
*micp = &micp_inst;
|
||||||
registered = true;
|
registered = true;
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_aics_deactivate(struct bt_mics *mics, struct bt_aics *inst)
|
int bt_micp_aics_deactivate(struct bt_micp *micp, struct bt_aics *inst)
|
||||||
{
|
{
|
||||||
CHECKIF(mics == NULL) {
|
CHECKIF(micp == NULL) {
|
||||||
BT_DBG("NULL mics");
|
BT_DBG("NULL micp");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,22 +186,22 @@ int bt_mics_aics_deactivate(struct bt_mics *mics, struct bt_aics *inst)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics->client_instance) {
|
if (micp->client_instance) {
|
||||||
BT_DBG("Can only deactivate AICS on a server instance");
|
BT_DBG("Can only deactivate AICS on a server instance");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CONFIG_BT_MICS_AICS_INSTANCE_COUNT > 0) {
|
if (CONFIG_BT_MICP_AICS_INSTANCE_COUNT > 0) {
|
||||||
return bt_aics_deactivate(inst);
|
return bt_aics_deactivate(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_aics_activate(struct bt_mics *mics, struct bt_aics *inst)
|
int bt_micp_aics_activate(struct bt_micp *micp, struct bt_aics *inst)
|
||||||
{
|
{
|
||||||
CHECKIF(mics == NULL) {
|
CHECKIF(micp == NULL) {
|
||||||
BT_DBG("NULL mics");
|
BT_DBG("NULL micp");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,24 +209,24 @@ int bt_mics_aics_activate(struct bt_mics *mics, struct bt_aics *inst)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics->client_instance) {
|
if (micp->client_instance) {
|
||||||
BT_DBG("Can only activate AICS on a server instance");
|
BT_DBG("Can only activate AICS on a server instance");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CONFIG_BT_MICS_AICS_INSTANCE_COUNT > 0) {
|
if (CONFIG_BT_MICP_AICS_INSTANCE_COUNT > 0) {
|
||||||
return bt_aics_activate(inst);
|
return bt_aics_activate(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_mute_disable(struct bt_mics *mics)
|
int bt_micp_mute_disable(struct bt_micp *micp)
|
||||||
{
|
{
|
||||||
uint8_t val = BT_MICS_MUTE_DISABLED;
|
uint8_t val = BT_MICP_MUTE_DISABLED;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (mics->client_instance) {
|
if (micp->client_instance) {
|
||||||
BT_DBG("Can only disable mute on a server instance");
|
BT_DBG("Can only disable mute on a server instance");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -236,11 +236,11 @@ int bt_mics_mute_disable(struct bt_mics *mics)
|
||||||
return err > 0 ? 0 : err;
|
return err > 0 ? 0 : err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_BT_MICS */
|
#endif /* CONFIG_BT_MICP */
|
||||||
|
|
||||||
static bool valid_aics_inst(struct bt_mics *mics, struct bt_aics *aics)
|
static bool valid_aics_inst(struct bt_micp *micp, struct bt_aics *aics)
|
||||||
{
|
{
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,25 +248,25 @@ static bool valid_aics_inst(struct bt_mics *mics, struct bt_aics *aics)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics->client_instance) {
|
if (micp->client_instance) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MICS)
|
#if defined(CONFIG_BT_MICP)
|
||||||
for (int i = 0; i < ARRAY_SIZE(mics_inst.srv.aics_insts); i++) {
|
for (int i = 0; i < ARRAY_SIZE(micp_inst.srv.aics_insts); i++) {
|
||||||
if (mics_inst.srv.aics_insts[i] == aics) {
|
if (micp_inst.srv.aics_insts[i] == aics) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_MICS */
|
#endif /* CONFIG_BT_MICP */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_included_get(struct bt_mics *mics,
|
int bt_micp_included_get(struct bt_micp *micp,
|
||||||
struct bt_mics_included *included)
|
struct bt_micp_included *included)
|
||||||
{
|
{
|
||||||
CHECKIF(mics == NULL) {
|
CHECKIF(micp == NULL) {
|
||||||
BT_DBG("NULL mics pointer");
|
BT_DBG("NULL micp pointer");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,249 +276,249 @@ int bt_mics_included_get(struct bt_mics *mics,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT) && mics->client_instance) {
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT) && micp->client_instance) {
|
||||||
return bt_mics_client_included_get(mics, included);
|
return bt_micp_client_included_get(micp, included);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MICS)
|
#if defined(CONFIG_BT_MICP)
|
||||||
included->aics_cnt = ARRAY_SIZE(mics_inst.srv.aics_insts);
|
included->aics_cnt = ARRAY_SIZE(micp_inst.srv.aics_insts);
|
||||||
included->aics = mics_inst.srv.aics_insts;
|
included->aics = micp_inst.srv.aics_insts;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
#endif /* CONFIG_BT_MICS */
|
#endif /* CONFIG_BT_MICP */
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_unmute(struct bt_mics *mics)
|
int bt_micp_unmute(struct bt_micp *micp)
|
||||||
{
|
{
|
||||||
CHECKIF(mics == NULL) {
|
CHECKIF(micp == NULL) {
|
||||||
BT_DBG("NULL mics pointer");
|
BT_DBG("NULL micp pointer");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT) && mics->client_instance) {
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT) && micp->client_instance) {
|
||||||
return bt_mics_client_unmute(mics);
|
return bt_micp_client_unmute(micp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MICS)
|
#if defined(CONFIG_BT_MICP)
|
||||||
uint8_t val = BT_MICS_MUTE_UNMUTED;
|
uint8_t val = BT_MICP_MUTE_UNMUTED;
|
||||||
int err = write_mute(NULL, NULL, &val, sizeof(val), 0, 0);
|
int err = write_mute(NULL, NULL, &val, sizeof(val), 0, 0);
|
||||||
|
|
||||||
return err > 0 ? 0 : err;
|
return err > 0 ? 0 : err;
|
||||||
#else
|
#else
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
#endif /* CONFIG_BT_MICS */
|
#endif /* CONFIG_BT_MICP */
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_mute(struct bt_mics *mics)
|
int bt_micp_mute(struct bt_micp *micp)
|
||||||
{
|
{
|
||||||
CHECKIF(mics == NULL) {
|
CHECKIF(micp == NULL) {
|
||||||
BT_DBG("NULL mics pointer");
|
BT_DBG("NULL micp pointer");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT) && mics->client_instance) {
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT) && micp->client_instance) {
|
||||||
return bt_mics_client_mute(mics);
|
return bt_micp_client_mute(micp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MICS)
|
#if defined(CONFIG_BT_MICP)
|
||||||
uint8_t val = BT_MICS_MUTE_MUTED;
|
uint8_t val = BT_MICP_MUTE_MUTED;
|
||||||
int err = write_mute(NULL, NULL, &val, sizeof(val), 0, 0);
|
int err = write_mute(NULL, NULL, &val, sizeof(val), 0, 0);
|
||||||
|
|
||||||
return err > 0 ? 0 : err;
|
return err > 0 ? 0 : err;
|
||||||
#else
|
#else
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
#endif /* CONFIG_BT_MICS */
|
#endif /* CONFIG_BT_MICP */
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_mute_get(struct bt_mics *mics)
|
int bt_micp_mute_get(struct bt_micp *micp)
|
||||||
{
|
{
|
||||||
CHECKIF(mics == NULL) {
|
CHECKIF(micp == NULL) {
|
||||||
BT_DBG("NULL mics pointer");
|
BT_DBG("NULL micp pointer");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT) && mics->client_instance) {
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT) && micp->client_instance) {
|
||||||
return bt_mics_client_mute_get(mics);
|
return bt_micp_client_mute_get(micp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MICS)
|
#if defined(CONFIG_BT_MICP)
|
||||||
if (mics_inst.srv.cb && mics_inst.srv.cb->mute) {
|
if (micp_inst.srv.cb && micp_inst.srv.cb->mute) {
|
||||||
mics_inst.srv.cb->mute(NULL, 0, mics_inst.srv.mute);
|
micp_inst.srv.cb->mute(NULL, 0, micp_inst.srv.mute);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
#endif /* CONFIG_BT_MICS */
|
#endif /* CONFIG_BT_MICP */
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_aics_state_get(struct bt_mics *mics, struct bt_aics *inst)
|
int bt_micp_aics_state_get(struct bt_micp *micp, struct bt_aics *inst)
|
||||||
{
|
{
|
||||||
CHECKIF(mics == NULL) {
|
CHECKIF(micp == NULL) {
|
||||||
BT_DBG("NULL mics pointer");
|
BT_DBG("NULL micp pointer");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT_AICS) &&
|
||||||
bt_mics_client_valid_aics_inst(mics, inst)) {
|
bt_micp_client_valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_state_get(inst);
|
return bt_aics_state_get(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_AICS) &&
|
||||||
valid_aics_inst(mics, inst)) {
|
valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_state_get(inst);
|
return bt_aics_state_get(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_aics_gain_setting_get(struct bt_mics *mics, struct bt_aics *inst)
|
int bt_micp_aics_gain_setting_get(struct bt_micp *micp, struct bt_aics *inst)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT_AICS) &&
|
||||||
bt_mics_client_valid_aics_inst(mics, inst)) {
|
bt_micp_client_valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_gain_setting_get(inst);
|
return bt_aics_gain_setting_get(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_AICS) &&
|
||||||
valid_aics_inst(mics, inst)) {
|
valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_gain_setting_get(inst);
|
return bt_aics_gain_setting_get(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_aics_type_get(struct bt_mics *mics, struct bt_aics *inst)
|
int bt_micp_aics_type_get(struct bt_micp *micp, struct bt_aics *inst)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT_AICS) &&
|
||||||
bt_mics_client_valid_aics_inst(mics, inst)) {
|
bt_micp_client_valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_type_get(inst);
|
return bt_aics_type_get(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_AICS) &&
|
||||||
valid_aics_inst(mics, inst)) {
|
valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_type_get(inst);
|
return bt_aics_type_get(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_aics_status_get(struct bt_mics *mics, struct bt_aics *inst)
|
int bt_micp_aics_status_get(struct bt_micp *micp, struct bt_aics *inst)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT_AICS) &&
|
||||||
bt_mics_client_valid_aics_inst(mics, inst)) {
|
bt_micp_client_valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_status_get(inst);
|
return bt_aics_status_get(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_AICS) &&
|
||||||
valid_aics_inst(mics, inst)) {
|
valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_status_get(inst);
|
return bt_aics_status_get(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
int bt_mics_aics_unmute(struct bt_mics *mics, struct bt_aics *inst)
|
int bt_micp_aics_unmute(struct bt_micp *micp, struct bt_aics *inst)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT_AICS) &&
|
||||||
bt_mics_client_valid_aics_inst(mics, inst)) {
|
bt_micp_client_valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_unmute(inst);
|
return bt_aics_unmute(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_AICS) &&
|
||||||
valid_aics_inst(mics, inst)) {
|
valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_unmute(inst);
|
return bt_aics_unmute(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_aics_mute(struct bt_mics *mics, struct bt_aics *inst)
|
int bt_micp_aics_mute(struct bt_micp *micp, struct bt_aics *inst)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT_AICS) &&
|
||||||
bt_mics_client_valid_aics_inst(mics, inst)) {
|
bt_micp_client_valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_mute(inst);
|
return bt_aics_mute(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_AICS) &&
|
||||||
valid_aics_inst(mics, inst)) {
|
valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_mute(inst);
|
return bt_aics_mute(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_aics_manual_gain_set(struct bt_mics *mics, struct bt_aics *inst)
|
int bt_micp_aics_manual_gain_set(struct bt_micp *micp, struct bt_aics *inst)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT_AICS) &&
|
||||||
bt_mics_client_valid_aics_inst(mics, inst)) {
|
bt_micp_client_valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_manual_gain_set(inst);
|
return bt_aics_manual_gain_set(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_AICS) &&
|
||||||
valid_aics_inst(mics, inst)) {
|
valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_manual_gain_set(inst);
|
return bt_aics_manual_gain_set(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_aics_automatic_gain_set(struct bt_mics *mics, struct bt_aics *inst)
|
int bt_micp_aics_automatic_gain_set(struct bt_micp *micp, struct bt_aics *inst)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT_AICS) &&
|
||||||
bt_mics_client_valid_aics_inst(mics, inst)) {
|
bt_micp_client_valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_automatic_gain_set(inst);
|
return bt_aics_automatic_gain_set(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_AICS) &&
|
||||||
valid_aics_inst(mics, inst)) {
|
valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_automatic_gain_set(inst);
|
return bt_aics_automatic_gain_set(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_aics_gain_set(struct bt_mics *mics, struct bt_aics *inst,
|
int bt_micp_aics_gain_set(struct bt_micp *micp, struct bt_aics *inst,
|
||||||
int8_t gain)
|
int8_t gain)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT_AICS) &&
|
||||||
bt_mics_client_valid_aics_inst(mics, inst)) {
|
bt_micp_client_valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_gain_set(inst, gain);
|
return bt_aics_gain_set(inst, gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_AICS) &&
|
||||||
valid_aics_inst(mics, inst)) {
|
valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_gain_set(inst, gain);
|
return bt_aics_gain_set(inst, gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_aics_description_get(struct bt_mics *mics, struct bt_aics *inst)
|
int bt_micp_aics_description_get(struct bt_micp *micp, struct bt_aics *inst)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT_AICS) &&
|
||||||
bt_mics_client_valid_aics_inst(mics, inst)) {
|
bt_micp_client_valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_description_get(inst);
|
return bt_aics_description_get(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_AICS) &&
|
||||||
valid_aics_inst(mics, inst)) {
|
valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_description_get(inst);
|
return bt_aics_description_get(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_aics_description_set(struct bt_mics *mics, struct bt_aics *inst,
|
int bt_micp_aics_description_set(struct bt_micp *micp, struct bt_aics *inst,
|
||||||
const char *description)
|
const char *description)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_CLIENT_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_CLIENT_AICS) &&
|
||||||
bt_mics_client_valid_aics_inst(mics, inst)) {
|
bt_micp_client_valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_description_set(inst, description);
|
return bt_aics_description_set(inst, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MICS_AICS) &&
|
if (IS_ENABLED(CONFIG_BT_MICP_AICS) &&
|
||||||
valid_aics_inst(mics, inst)) {
|
valid_aics_inst(micp, inst)) {
|
||||||
return bt_aics_description_set(inst, description);
|
return bt_aics_description_set(inst, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* Bluetooth MICS client - Microphone Control Profile - Client */
|
/* Bluetooth MICP client - Microphone Control Profile - Client */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 Bose Corporation
|
* Copyright (c) 2020 Bose Corporation
|
||||||
* Copyright (c) 2020-2021 Nordic Semiconductor ASA
|
* Copyright (c) 2020-2022 Nordic Semiconductor ASA
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -20,21 +20,21 @@
|
||||||
#include <zephyr/bluetooth/gatt.h>
|
#include <zephyr/bluetooth/gatt.h>
|
||||||
#include <zephyr/bluetooth/audio/micp.h>
|
#include <zephyr/bluetooth/audio/micp.h>
|
||||||
|
|
||||||
#include "mics_internal.h"
|
#include "micp_internal.h"
|
||||||
|
|
||||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_MICS_CLIENT)
|
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_MICP_CLIENT)
|
||||||
#define LOG_MODULE_NAME bt_mics_client
|
#define LOG_MODULE_NAME bt_micp_client
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
|
||||||
/* Callback functions */
|
/* Callback functions */
|
||||||
static struct bt_mics_cb *mics_client_cb;
|
static struct bt_micp_cb *micp_client_cb;
|
||||||
|
|
||||||
static struct bt_mics mics_insts[CONFIG_BT_MAX_CONN];
|
static struct bt_micp micp_insts[CONFIG_BT_MAX_CONN];
|
||||||
static struct bt_uuid *mics_uuid = BT_UUID_MICS;
|
static struct bt_uuid *mics_uuid = BT_UUID_MICS;
|
||||||
|
|
||||||
bool bt_mics_client_valid_aics_inst(struct bt_mics *mics, struct bt_aics *aics)
|
bool bt_micp_client_valid_aics_inst(struct bt_micp *micp, struct bt_aics *aics)
|
||||||
{
|
{
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,12 +42,12 @@ bool bt_mics_client_valid_aics_inst(struct bt_mics *mics, struct bt_aics *aics)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mics->client_instance) {
|
if (!micp->client_instance) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_SIZE(mics->cli.aics); i++) {
|
for (int i = 0; i < ARRAY_SIZE(micp->cli.aics); i++) {
|
||||||
if (mics->cli.aics[i] == aics) {
|
if (micp->cli.aics[i] == aics) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,21 +60,21 @@ static uint8_t mute_notify_handler(struct bt_conn *conn,
|
||||||
const void *data, uint16_t length)
|
const void *data, uint16_t length)
|
||||||
{
|
{
|
||||||
uint8_t *mute_val;
|
uint8_t *mute_val;
|
||||||
struct bt_mics *mics_inst;
|
struct bt_micp *micp_inst;
|
||||||
|
|
||||||
if (conn == NULL) {
|
if (conn == NULL) {
|
||||||
return BT_GATT_ITER_CONTINUE;
|
return BT_GATT_ITER_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mics_inst = &mics_insts[bt_conn_index(conn)];
|
micp_inst = &micp_insts[bt_conn_index(conn)];
|
||||||
|
|
||||||
if (data != NULL) {
|
if (data != NULL) {
|
||||||
if (length == sizeof(*mute_val)) {
|
if (length == sizeof(*mute_val)) {
|
||||||
mute_val = (uint8_t *)data;
|
mute_val = (uint8_t *)data;
|
||||||
BT_DBG("Mute %u", *mute_val);
|
BT_DBG("Mute %u", *mute_val);
|
||||||
if (mics_client_cb != NULL &&
|
if (micp_client_cb != NULL &&
|
||||||
mics_client_cb->mute != NULL) {
|
micp_client_cb->mute != NULL) {
|
||||||
mics_client_cb->mute(mics_inst, 0, *mute_val);
|
micp_client_cb->mute(micp_inst, 0, *mute_val);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BT_DBG("Invalid length %u (expected %zu)",
|
BT_DBG("Invalid length %u (expected %zu)",
|
||||||
|
@ -86,15 +86,15 @@ static uint8_t mute_notify_handler(struct bt_conn *conn,
|
||||||
return BT_GATT_ITER_CONTINUE;
|
return BT_GATT_ITER_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t mics_client_read_mute_cb(struct bt_conn *conn, uint8_t err,
|
static uint8_t micp_client_read_mute_cb(struct bt_conn *conn, uint8_t err,
|
||||||
struct bt_gatt_read_params *params,
|
struct bt_gatt_read_params *params,
|
||||||
const void *data, uint16_t length)
|
const void *data, uint16_t length)
|
||||||
{
|
{
|
||||||
uint8_t cb_err = err;
|
uint8_t cb_err = err;
|
||||||
uint8_t mute_val = 0;
|
uint8_t mute_val = 0;
|
||||||
struct bt_mics *mics_inst = &mics_insts[bt_conn_index(conn)];
|
struct bt_micp *micp_inst = &micp_insts[bt_conn_index(conn)];
|
||||||
|
|
||||||
mics_inst->cli.busy = false;
|
micp_inst->cli.busy = false;
|
||||||
|
|
||||||
if (err > 0) {
|
if (err > 0) {
|
||||||
BT_DBG("err: 0x%02X", err);
|
BT_DBG("err: 0x%02X", err);
|
||||||
|
@ -109,46 +109,46 @@ static uint8_t mics_client_read_mute_cb(struct bt_conn *conn, uint8_t err,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics_client_cb != NULL && mics_client_cb->mute != NULL) {
|
if (micp_client_cb != NULL && micp_client_cb->mute != NULL) {
|
||||||
mics_client_cb->mute(mics_inst, cb_err, mute_val);
|
micp_client_cb->mute(micp_inst, cb_err, mute_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
return BT_GATT_ITER_STOP;
|
return BT_GATT_ITER_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_client_write_mics_mute_cb(struct bt_conn *conn, uint8_t err,
|
static void micp_client_write_mics_mute_cb(struct bt_conn *conn, uint8_t err,
|
||||||
struct bt_gatt_write_params *params)
|
struct bt_gatt_write_params *params)
|
||||||
{
|
{
|
||||||
struct bt_mics *mics_inst = &mics_insts[bt_conn_index(conn)];
|
struct bt_micp *micp_inst = &micp_insts[bt_conn_index(conn)];
|
||||||
uint8_t mute_val = mics_inst->cli.mute_val_buf[0];
|
uint8_t mute_val = micp_inst->cli.mute_val_buf[0];
|
||||||
|
|
||||||
BT_DBG("Write %s (0x%02X)", err ? "failed" : "successful", err);
|
BT_DBG("Write %s (0x%02X)", err ? "failed" : "successful", err);
|
||||||
|
|
||||||
mics_inst->cli.busy = false;
|
micp_inst->cli.busy = false;
|
||||||
|
|
||||||
if (mute_val == BT_MICS_MUTE_UNMUTED) {
|
if (mute_val == BT_MICP_MUTE_UNMUTED) {
|
||||||
if (mics_client_cb != NULL &&
|
if (micp_client_cb != NULL &&
|
||||||
mics_client_cb->unmute_write != NULL) {
|
micp_client_cb->unmute_write != NULL) {
|
||||||
mics_client_cb->unmute_write(mics_inst, err);
|
micp_client_cb->unmute_write(micp_inst, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (mics_client_cb != NULL &&
|
if (micp_client_cb != NULL &&
|
||||||
mics_client_cb->mute_write != NULL) {
|
micp_client_cb->mute_write != NULL) {
|
||||||
mics_client_cb->mute_write(mics_inst, err);
|
micp_client_cb->mute_write(micp_inst, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MICS_CLIENT_AICS)
|
#if defined(CONFIG_BT_MICP_CLIENT_AICS)
|
||||||
static struct bt_mics *lookup_mics_by_aics(const struct bt_aics *aics)
|
static struct bt_micp *lookup_micp_by_aics(const struct bt_aics *aics)
|
||||||
{
|
{
|
||||||
__ASSERT(aics != NULL, "AICS pointer cannot be NULL");
|
__ASSERT(aics != NULL, "AICS pointer cannot be NULL");
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_SIZE(mics_insts); i++) {
|
for (int i = 0; i < ARRAY_SIZE(micp_insts); i++) {
|
||||||
for (int j = 0; j < ARRAY_SIZE(mics_insts[i].cli.aics); j++) {
|
for (int j = 0; j < ARRAY_SIZE(micp_insts[i].cli.aics); j++) {
|
||||||
if (mics_insts[i].cli.aics[j] == aics) {
|
if (micp_insts[i].cli.aics[j] == aics) {
|
||||||
return &mics_insts[i];
|
return &micp_insts[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,38 +158,38 @@ static struct bt_mics *lookup_mics_by_aics(const struct bt_aics *aics)
|
||||||
|
|
||||||
static void aics_discover_cb(struct bt_aics *inst, int err)
|
static void aics_discover_cb(struct bt_aics *inst, int err)
|
||||||
{
|
{
|
||||||
struct bt_mics *mics_inst = lookup_mics_by_aics(inst);
|
struct bt_micp *micp_inst = lookup_micp_by_aics(inst);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
/* Continue discovery of included services */
|
/* Continue discovery of included services */
|
||||||
err = bt_gatt_discover(mics_inst->cli.conn,
|
err = bt_gatt_discover(micp_inst->cli.conn,
|
||||||
&mics_inst->cli.discover_params);
|
&micp_inst->cli.discover_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
BT_DBG("Discover failed (err %d)", err);
|
BT_DBG("Discover failed (err %d)", err);
|
||||||
if (mics_client_cb != NULL &&
|
if (micp_client_cb != NULL &&
|
||||||
mics_client_cb->discover != NULL) {
|
micp_client_cb->discover != NULL) {
|
||||||
mics_client_cb->discover(mics_inst, err, 0);
|
micp_client_cb->discover(micp_inst, err, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_MICS_CLIENT_AICS */
|
#endif /* CONFIG_BT_MICP_CLIENT_AICS */
|
||||||
|
|
||||||
static uint8_t mics_discover_include_func(
|
static uint8_t micp_discover_include_func(
|
||||||
struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||||
struct bt_gatt_discover_params *params)
|
struct bt_gatt_discover_params *params)
|
||||||
{
|
{
|
||||||
struct bt_mics *mics_inst = &mics_insts[bt_conn_index(conn)];
|
struct bt_micp *micp_inst = &micp_insts[bt_conn_index(conn)];
|
||||||
|
|
||||||
if (attr == NULL) {
|
if (attr == NULL) {
|
||||||
BT_DBG("Discover include complete for MICS: %u AICS",
|
BT_DBG("Discover include complete for MICP: %u AICS",
|
||||||
mics_inst->cli.aics_inst_cnt);
|
micp_inst->cli.aics_inst_cnt);
|
||||||
(void)memset(params, 0, sizeof(*params));
|
(void)memset(params, 0, sizeof(*params));
|
||||||
|
|
||||||
if (mics_client_cb != NULL &&
|
if (micp_client_cb != NULL &&
|
||||||
mics_client_cb->discover != NULL) {
|
micp_client_cb->discover != NULL) {
|
||||||
mics_client_cb->discover(mics_inst, 0, 0);
|
micp_client_cb->discover(micp_inst, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return BT_GATT_ITER_STOP;
|
return BT_GATT_ITER_STOP;
|
||||||
|
@ -203,7 +203,7 @@ static uint8_t mics_discover_include_func(
|
||||||
BT_DBG("Include UUID %s", bt_uuid_str(include->uuid));
|
BT_DBG("Include UUID %s", bt_uuid_str(include->uuid));
|
||||||
|
|
||||||
if (bt_uuid_cmp(include->uuid, BT_UUID_AICS) == 0 &&
|
if (bt_uuid_cmp(include->uuid, BT_UUID_AICS) == 0 &&
|
||||||
mics_inst->cli.aics_inst_cnt < CONFIG_BT_MICS_CLIENT_MAX_AICS_INST) {
|
micp_inst->cli.aics_inst_cnt < CONFIG_BT_MICP_CLIENT_MAX_AICS_INST) {
|
||||||
uint8_t inst_idx;
|
uint8_t inst_idx;
|
||||||
int err;
|
int err;
|
||||||
struct bt_aics_discover_param param = {
|
struct bt_aics_discover_param param = {
|
||||||
|
@ -214,16 +214,16 @@ static uint8_t mics_discover_include_func(
|
||||||
/* Update discover params so we can continue where we
|
/* Update discover params so we can continue where we
|
||||||
* left off after bt_aics_discover
|
* left off after bt_aics_discover
|
||||||
*/
|
*/
|
||||||
mics_inst->cli.discover_params.start_handle = attr->handle + 1;
|
micp_inst->cli.discover_params.start_handle = attr->handle + 1;
|
||||||
|
|
||||||
inst_idx = mics_inst->cli.aics_inst_cnt++;
|
inst_idx = micp_inst->cli.aics_inst_cnt++;
|
||||||
err = bt_aics_discover(conn, mics_inst->cli.aics[inst_idx],
|
err = bt_aics_discover(conn, micp_inst->cli.aics[inst_idx],
|
||||||
¶m);
|
¶m);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
BT_DBG("AICS Discover failed (err %d)", err);
|
BT_DBG("AICS Discover failed (err %d)", err);
|
||||||
if (mics_client_cb != NULL &&
|
if (micp_client_cb != NULL &&
|
||||||
mics_client_cb->discover != NULL) {
|
micp_client_cb->discover != NULL) {
|
||||||
mics_client_cb->discover(mics_inst, err,
|
micp_client_cb->discover(micp_inst, err,
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,37 +239,37 @@ static uint8_t mics_discover_include_func(
|
||||||
* handles of the writeable characteristics and subscribing to all notify and
|
* handles of the writeable characteristics and subscribing to all notify and
|
||||||
* indicate characteristics.
|
* indicate characteristics.
|
||||||
*/
|
*/
|
||||||
static uint8_t mics_discover_func(struct bt_conn *conn,
|
static uint8_t micp_discover_func(struct bt_conn *conn,
|
||||||
const struct bt_gatt_attr *attr,
|
const struct bt_gatt_attr *attr,
|
||||||
struct bt_gatt_discover_params *params)
|
struct bt_gatt_discover_params *params)
|
||||||
{
|
{
|
||||||
struct bt_mics *mics_inst = &mics_insts[bt_conn_index(conn)];
|
struct bt_micp *micp_inst = &micp_insts[bt_conn_index(conn)];
|
||||||
|
|
||||||
if (attr == NULL) {
|
if (attr == NULL) {
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
BT_DBG("Setup complete for MICS");
|
BT_DBG("Setup complete for MICP");
|
||||||
(void)memset(params, 0, sizeof(*params));
|
(void)memset(params, 0, sizeof(*params));
|
||||||
if (CONFIG_BT_MICS_CLIENT_MAX_AICS_INST > 0) {
|
if (CONFIG_BT_MICP_CLIENT_MAX_AICS_INST > 0) {
|
||||||
/* Discover included services */
|
/* Discover included services */
|
||||||
mics_inst->cli.discover_params.start_handle = mics_inst->cli.start_handle;
|
micp_inst->cli.discover_params.start_handle = micp_inst->cli.start_handle;
|
||||||
mics_inst->cli.discover_params.end_handle = mics_inst->cli.end_handle;
|
micp_inst->cli.discover_params.end_handle = micp_inst->cli.end_handle;
|
||||||
mics_inst->cli.discover_params.type = BT_GATT_DISCOVER_INCLUDE;
|
micp_inst->cli.discover_params.type = BT_GATT_DISCOVER_INCLUDE;
|
||||||
mics_inst->cli.discover_params.func = mics_discover_include_func;
|
micp_inst->cli.discover_params.func = micp_discover_include_func;
|
||||||
|
|
||||||
err = bt_gatt_discover(conn,
|
err = bt_gatt_discover(conn,
|
||||||
&mics_inst->cli.discover_params);
|
&micp_inst->cli.discover_params);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
BT_DBG("Discover failed (err %d)", err);
|
BT_DBG("Discover failed (err %d)", err);
|
||||||
if (mics_client_cb != NULL &&
|
if (micp_client_cb != NULL &&
|
||||||
mics_client_cb->discover != NULL) {
|
micp_client_cb->discover != NULL) {
|
||||||
mics_client_cb->discover(mics_inst, err, 0);
|
micp_client_cb->discover(micp_inst, err, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mics_client_cb != NULL &&
|
if (micp_client_cb != NULL &&
|
||||||
mics_client_cb->discover != NULL) {
|
micp_client_cb->discover != NULL) {
|
||||||
mics_client_cb->discover(mics_inst, err, 0);
|
micp_client_cb->discover(micp_inst, err, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BT_GATT_ITER_STOP;
|
return BT_GATT_ITER_STOP;
|
||||||
|
@ -283,9 +283,9 @@ static uint8_t mics_discover_func(struct bt_conn *conn,
|
||||||
|
|
||||||
if (bt_uuid_cmp(chrc->uuid, BT_UUID_MICS_MUTE) == 0) {
|
if (bt_uuid_cmp(chrc->uuid, BT_UUID_MICS_MUTE) == 0) {
|
||||||
BT_DBG("Mute");
|
BT_DBG("Mute");
|
||||||
mics_inst->cli.mute_handle = chrc->value_handle;
|
micp_inst->cli.mute_handle = chrc->value_handle;
|
||||||
sub_params = &mics_inst->cli.mute_sub_params;
|
sub_params = &micp_inst->cli.mute_sub_params;
|
||||||
sub_params->disc_params = &mics_inst->cli.mute_sub_disc_params;
|
sub_params->disc_params = &micp_inst->cli.mute_sub_disc_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sub_params != NULL) {
|
if (sub_params != NULL) {
|
||||||
|
@ -293,7 +293,7 @@ static uint8_t mics_discover_func(struct bt_conn *conn,
|
||||||
|
|
||||||
/* With ccc_handle == 0 it will use auto discovery */
|
/* With ccc_handle == 0 it will use auto discovery */
|
||||||
sub_params->ccc_handle = 0;
|
sub_params->ccc_handle = 0;
|
||||||
sub_params->end_handle = mics_inst->cli.end_handle;
|
sub_params->end_handle = micp_inst->cli.end_handle;
|
||||||
sub_params->value = BT_GATT_CCC_NOTIFY;
|
sub_params->value = BT_GATT_CCC_NOTIFY;
|
||||||
sub_params->value_handle = chrc->value_handle;
|
sub_params->value_handle = chrc->value_handle;
|
||||||
sub_params->notify = mute_notify_handler;
|
sub_params->notify = mute_notify_handler;
|
||||||
|
@ -316,13 +316,13 @@ static uint8_t primary_discover_func(struct bt_conn *conn,
|
||||||
const struct bt_gatt_attr *attr,
|
const struct bt_gatt_attr *attr,
|
||||||
struct bt_gatt_discover_params *params)
|
struct bt_gatt_discover_params *params)
|
||||||
{
|
{
|
||||||
struct bt_mics *mics_inst = &mics_insts[bt_conn_index(conn)];
|
struct bt_micp *micp_inst = &micp_insts[bt_conn_index(conn)];
|
||||||
|
|
||||||
if (attr == NULL) {
|
if (attr == NULL) {
|
||||||
BT_DBG("Could not find a MICS instance on the server");
|
BT_DBG("Could not find a MICS instance on the server");
|
||||||
if (mics_client_cb != NULL &&
|
if (micp_client_cb != NULL &&
|
||||||
mics_client_cb->discover != NULL) {
|
micp_client_cb->discover != NULL) {
|
||||||
mics_client_cb->discover(mics_inst, -ENODATA, 0);
|
micp_client_cb->discover(micp_inst, -ENODATA, 0);
|
||||||
}
|
}
|
||||||
return BT_GATT_ITER_STOP;
|
return BT_GATT_ITER_STOP;
|
||||||
}
|
}
|
||||||
|
@ -335,22 +335,22 @@ static uint8_t primary_discover_func(struct bt_conn *conn,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
BT_DBG("Primary discover complete");
|
BT_DBG("Primary discover complete");
|
||||||
mics_inst->cli.start_handle = attr->handle + 1;
|
micp_inst->cli.start_handle = attr->handle + 1;
|
||||||
mics_inst->cli.end_handle = prim_service->end_handle;
|
micp_inst->cli.end_handle = prim_service->end_handle;
|
||||||
|
|
||||||
/* Discover characteristics */
|
/* Discover characteristics */
|
||||||
mics_inst->cli.discover_params.uuid = NULL;
|
micp_inst->cli.discover_params.uuid = NULL;
|
||||||
mics_inst->cli.discover_params.start_handle = mics_inst->cli.start_handle;
|
micp_inst->cli.discover_params.start_handle = micp_inst->cli.start_handle;
|
||||||
mics_inst->cli.discover_params.end_handle = mics_inst->cli.end_handle;
|
micp_inst->cli.discover_params.end_handle = micp_inst->cli.end_handle;
|
||||||
mics_inst->cli.discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
micp_inst->cli.discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
||||||
mics_inst->cli.discover_params.func = mics_discover_func;
|
micp_inst->cli.discover_params.func = micp_discover_func;
|
||||||
|
|
||||||
err = bt_gatt_discover(conn, &mics_inst->cli.discover_params);
|
err = bt_gatt_discover(conn, &micp_inst->cli.discover_params);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
BT_DBG("Discover failed (err %d)", err);
|
BT_DBG("Discover failed (err %d)", err);
|
||||||
if (mics_client_cb != NULL &&
|
if (micp_client_cb != NULL &&
|
||||||
mics_client_cb->discover != NULL) {
|
micp_client_cb->discover != NULL) {
|
||||||
mics_client_cb->discover(mics_inst, err, 0);
|
micp_client_cb->discover(micp_inst, err, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,15 +360,15 @@ static uint8_t primary_discover_func(struct bt_conn *conn,
|
||||||
return BT_GATT_ITER_CONTINUE;
|
return BT_GATT_ITER_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_client_reset(struct bt_mics *mics)
|
static void micp_client_reset(struct bt_micp *micp)
|
||||||
{
|
{
|
||||||
mics->cli.start_handle = 0;
|
micp->cli.start_handle = 0;
|
||||||
mics->cli.end_handle = 0;
|
micp->cli.end_handle = 0;
|
||||||
mics->cli.mute_handle = 0;
|
micp->cli.mute_handle = 0;
|
||||||
mics->cli.aics_inst_cnt = 0;
|
micp->cli.aics_inst_cnt = 0;
|
||||||
|
|
||||||
if (mics->cli.conn != NULL) {
|
if (micp->cli.conn != NULL) {
|
||||||
struct bt_conn *conn = mics->cli.conn;
|
struct bt_conn *conn = micp->cli.conn;
|
||||||
|
|
||||||
/* It's okay if this fails. In case of disconnect, we can't
|
/* It's okay if this fails. In case of disconnect, we can't
|
||||||
* unsubscribe and it will just fail.
|
* unsubscribe and it will just fail.
|
||||||
|
@ -376,19 +376,19 @@ static void mics_client_reset(struct bt_mics *mics)
|
||||||
* function, we will unsubscribe (regardless of bonding state)
|
* function, we will unsubscribe (regardless of bonding state)
|
||||||
* to accommodate the new discovery values.
|
* to accommodate the new discovery values.
|
||||||
*/
|
*/
|
||||||
(void)bt_gatt_unsubscribe(conn, &mics->cli.mute_sub_params);
|
(void)bt_gatt_unsubscribe(conn, &micp->cli.mute_sub_params);
|
||||||
|
|
||||||
bt_conn_unref(conn);
|
bt_conn_unref(conn);
|
||||||
mics->cli.conn = NULL;
|
micp->cli.conn = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disconnected(struct bt_conn *conn, uint8_t reason)
|
static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
{
|
{
|
||||||
struct bt_mics *mics = &mics_insts[bt_conn_index(conn)];
|
struct bt_micp *micp = &micp_insts[bt_conn_index(conn)];
|
||||||
|
|
||||||
if (mics->cli.conn == conn) {
|
if (micp->cli.conn == conn) {
|
||||||
mics_client_reset(mics);
|
micp_client_reset(micp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,10 +396,10 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
|
||||||
int bt_mics_discover(struct bt_conn *conn, struct bt_mics **mics)
|
int bt_micp_discover(struct bt_conn *conn, struct bt_micp **micp)
|
||||||
{
|
{
|
||||||
static bool initialized;
|
static bool initialized;
|
||||||
struct bt_mics *mics_inst;
|
struct bt_micp *micp_inst;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -417,49 +417,49 @@ int bt_mics_discover(struct bt_conn *conn, struct bt_mics **mics)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mics_inst = &mics_insts[bt_conn_index(conn)];
|
micp_inst = &micp_insts[bt_conn_index(conn)];
|
||||||
|
|
||||||
(void)memset(&mics_inst->cli.discover_params, 0,
|
(void)memset(&micp_inst->cli.discover_params, 0,
|
||||||
sizeof(mics_inst->cli.discover_params));
|
sizeof(micp_inst->cli.discover_params));
|
||||||
mics_client_reset(mics_inst);
|
micp_client_reset(micp_inst);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_AICS_CLIENT) &&
|
if (IS_ENABLED(CONFIG_BT_AICS_CLIENT) &&
|
||||||
CONFIG_BT_MICS_CLIENT_MAX_AICS_INST > 0) {
|
CONFIG_BT_MICP_CLIENT_MAX_AICS_INST > 0) {
|
||||||
for (int i = 0; i < ARRAY_SIZE(mics_inst->cli.aics); i++) {
|
for (int i = 0; i < ARRAY_SIZE(micp_inst->cli.aics); i++) {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
mics_inst->cli.aics[i] = bt_aics_client_free_instance_get();
|
micp_inst->cli.aics[i] = bt_aics_client_free_instance_get();
|
||||||
|
|
||||||
if (mics_inst->cli.aics[i] == NULL) {
|
if (micp_inst->cli.aics[i] == NULL) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_aics_client_cb_register(mics_inst->cli.aics[i],
|
bt_aics_client_cb_register(micp_inst->cli.aics[i],
|
||||||
&mics_client_cb->aics_cb);
|
&micp_client_cb->aics_cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mics_inst->cli.conn = bt_conn_ref(conn);
|
micp_inst->cli.conn = bt_conn_ref(conn);
|
||||||
mics_inst->client_instance = true;
|
micp_inst->client_instance = true;
|
||||||
mics_inst->cli.discover_params.func = primary_discover_func;
|
micp_inst->cli.discover_params.func = primary_discover_func;
|
||||||
mics_inst->cli.discover_params.uuid = mics_uuid;
|
micp_inst->cli.discover_params.uuid = mics_uuid;
|
||||||
mics_inst->cli.discover_params.type = BT_GATT_DISCOVER_PRIMARY;
|
micp_inst->cli.discover_params.type = BT_GATT_DISCOVER_PRIMARY;
|
||||||
mics_inst->cli.discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE;
|
micp_inst->cli.discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE;
|
||||||
mics_inst->cli.discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE;
|
micp_inst->cli.discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE;
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
|
|
||||||
err = bt_gatt_discover(conn, &mics_inst->cli.discover_params);
|
err = bt_gatt_discover(conn, &micp_inst->cli.discover_params);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
*mics = mics_inst;
|
*micp = micp_inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_client_cb_register(struct bt_mics_cb *cb)
|
int bt_micp_client_cb_register(struct bt_micp_cb *cb)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_BT_MICS_CLIENT_AICS)
|
#if defined(CONFIG_BT_MICP_CLIENT_AICS)
|
||||||
struct bt_aics_cb *aics_cb = NULL;
|
struct bt_aics_cb *aics_cb = NULL;
|
||||||
|
|
||||||
if (cb != NULL) {
|
if (cb != NULL) {
|
||||||
|
@ -472,27 +472,27 @@ int bt_mics_client_cb_register(struct bt_mics_cb *cb)
|
||||||
aics_cb = &cb->aics_cb;
|
aics_cb = &cb->aics_cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_SIZE(mics_insts); i++) {
|
for (int i = 0; i < ARRAY_SIZE(micp_insts); i++) {
|
||||||
for (int j = 0; j < ARRAY_SIZE(mics_insts[i].cli.aics); j++) {
|
for (int j = 0; j < ARRAY_SIZE(micp_insts[i].cli.aics); j++) {
|
||||||
struct bt_aics *aics = mics_insts[i].cli.aics[j];
|
struct bt_aics *aics = micp_insts[i].cli.aics[j];
|
||||||
|
|
||||||
if (aics != NULL) {
|
if (aics != NULL) {
|
||||||
bt_aics_client_cb_register(aics, aics_cb);
|
bt_aics_client_cb_register(aics, aics_cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_MICS_CLIENT_AICS */
|
#endif /* CONFIG_BT_MICP_CLIENT_AICS */
|
||||||
|
|
||||||
mics_client_cb = cb;
|
micp_client_cb = cb;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_client_included_get(struct bt_mics *mics,
|
int bt_micp_client_included_get(struct bt_micp *micp,
|
||||||
struct bt_mics_included *included)
|
struct bt_micp_included *included)
|
||||||
{
|
{
|
||||||
CHECKIF(mics == NULL) {
|
CHECKIF(micp == NULL) {
|
||||||
BT_DBG("NULL mics");
|
BT_DBG("NULL micp");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,100 +500,100 @@ int bt_mics_client_included_get(struct bt_mics *mics,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
included->aics_cnt = mics->cli.aics_inst_cnt;
|
included->aics_cnt = micp->cli.aics_inst_cnt;
|
||||||
included->aics = mics->cli.aics;
|
included->aics = micp->cli.aics;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_client_conn_get(const struct bt_mics *mics, struct bt_conn **conn)
|
int bt_micp_client_conn_get(const struct bt_micp *micp, struct bt_conn **conn)
|
||||||
{
|
{
|
||||||
CHECKIF(mics == NULL) {
|
CHECKIF(micp == NULL) {
|
||||||
BT_DBG("NULL mics pointer");
|
BT_DBG("NULL micp pointer");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mics->client_instance) {
|
if (!micp->client_instance) {
|
||||||
BT_DBG("mics pointer shall be client instance");
|
BT_DBG("micp pointer shall be client instance");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics->cli.conn == NULL) {
|
if (micp->cli.conn == NULL) {
|
||||||
BT_DBG("mics pointer not associated with a connection. "
|
BT_DBG("micp pointer not associated with a connection. "
|
||||||
"Do discovery first");
|
"Do discovery first");
|
||||||
return -ENOTCONN;
|
return -ENOTCONN;
|
||||||
}
|
}
|
||||||
|
|
||||||
*conn = mics->cli.conn;
|
*conn = micp->cli.conn;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_client_mute_get(struct bt_mics *mics)
|
int bt_micp_client_mute_get(struct bt_micp *micp)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
CHECKIF(mics == NULL) {
|
CHECKIF(micp == NULL) {
|
||||||
BT_DBG("NULL mics");
|
BT_DBG("NULL micp");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics->cli.mute_handle == 0) {
|
if (micp->cli.mute_handle == 0) {
|
||||||
BT_DBG("Handle not set");
|
BT_DBG("Handle not set");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
} else if (mics->cli.busy) {
|
} else if (micp->cli.busy) {
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
mics->cli.read_params.func = mics_client_read_mute_cb;
|
micp->cli.read_params.func = micp_client_read_mute_cb;
|
||||||
mics->cli.read_params.handle_count = 1;
|
micp->cli.read_params.handle_count = 1;
|
||||||
mics->cli.read_params.single.handle = mics->cli.mute_handle;
|
micp->cli.read_params.single.handle = micp->cli.mute_handle;
|
||||||
mics->cli.read_params.single.offset = 0U;
|
micp->cli.read_params.single.offset = 0U;
|
||||||
|
|
||||||
err = bt_gatt_read(mics->cli.conn, &mics->cli.read_params);
|
err = bt_gatt_read(micp->cli.conn, &micp->cli.read_params);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
mics->cli.busy = true;
|
micp->cli.busy = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_client_write_mute(struct bt_mics *mics, bool mute)
|
int bt_micp_client_write_mute(struct bt_micp *micp, bool mute)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
CHECKIF(mics == NULL) {
|
CHECKIF(micp == NULL) {
|
||||||
BT_DBG("NULL mics");
|
BT_DBG("NULL micp");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics->cli.mute_handle == 0) {
|
if (micp->cli.mute_handle == 0) {
|
||||||
BT_DBG("Handle not set");
|
BT_DBG("Handle not set");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
} else if (mics->cli.busy) {
|
} else if (micp->cli.busy) {
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
mics->cli.mute_val_buf[0] = mute;
|
micp->cli.mute_val_buf[0] = mute;
|
||||||
mics->cli.write_params.offset = 0;
|
micp->cli.write_params.offset = 0;
|
||||||
mics->cli.write_params.data = mics->cli.mute_val_buf;
|
micp->cli.write_params.data = micp->cli.mute_val_buf;
|
||||||
mics->cli.write_params.length = sizeof(mute);
|
micp->cli.write_params.length = sizeof(mute);
|
||||||
mics->cli.write_params.handle = mics->cli.mute_handle;
|
micp->cli.write_params.handle = micp->cli.mute_handle;
|
||||||
mics->cli.write_params.func = mics_client_write_mics_mute_cb;
|
micp->cli.write_params.func = micp_client_write_mics_mute_cb;
|
||||||
|
|
||||||
err = bt_gatt_write(mics->cli.conn, &mics->cli.write_params);
|
err = bt_gatt_write(micp->cli.conn, &micp->cli.write_params);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
mics->cli.busy = true;
|
micp->cli.busy = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_client_mute(struct bt_mics *mics)
|
int bt_micp_client_mute(struct bt_micp *micp)
|
||||||
{
|
{
|
||||||
return bt_mics_client_write_mute(mics, true);
|
return bt_micp_client_write_mute(micp, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mics_client_unmute(struct bt_mics *mics)
|
int bt_micp_client_unmute(struct bt_micp *micp)
|
||||||
{
|
{
|
||||||
return bt_mics_client_write_mute(mics, false);
|
return bt_micp_client_write_mute(micp, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2020-2021 Nordic Semiconductor ASA
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_MICS_INTERNAL_
|
|
||||||
#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_MICS_INTERNAL_
|
|
||||||
#include <zephyr/types.h>
|
|
||||||
#include <zephyr/bluetooth/gatt.h>
|
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MICS)
|
|
||||||
struct bt_mics_server {
|
|
||||||
uint8_t mute;
|
|
||||||
struct bt_mics_cb *cb;
|
|
||||||
struct bt_gatt_service *service_p;
|
|
||||||
struct bt_aics *aics_insts[CONFIG_BT_MICS_AICS_INSTANCE_COUNT];
|
|
||||||
};
|
|
||||||
#endif /* CONFIG_BT_MICS */
|
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MICS_CLIENT)
|
|
||||||
struct bt_mics_client {
|
|
||||||
uint16_t start_handle;
|
|
||||||
uint16_t end_handle;
|
|
||||||
uint16_t mute_handle;
|
|
||||||
struct bt_gatt_subscribe_params mute_sub_params;
|
|
||||||
struct bt_gatt_discover_params mute_sub_disc_params;
|
|
||||||
|
|
||||||
bool busy;
|
|
||||||
uint8_t mute_val_buf[1]; /* Mute value is a single octet */
|
|
||||||
struct bt_gatt_write_params write_params;
|
|
||||||
struct bt_gatt_read_params read_params;
|
|
||||||
struct bt_gatt_discover_params discover_params;
|
|
||||||
struct bt_conn *conn;
|
|
||||||
|
|
||||||
uint8_t aics_inst_cnt;
|
|
||||||
struct bt_aics *aics[CONFIG_BT_MICS_CLIENT_MAX_AICS_INST];
|
|
||||||
};
|
|
||||||
#endif /* CONFIG_BT_MICS_CLIENT */
|
|
||||||
|
|
||||||
/* Struct used as a common type for the api */
|
|
||||||
struct bt_mics {
|
|
||||||
bool client_instance;
|
|
||||||
union {
|
|
||||||
#if defined(CONFIG_BT_MICS)
|
|
||||||
struct bt_mics_server srv;
|
|
||||||
#endif /* CONFIG_BT_MICS */
|
|
||||||
#if defined(CONFIG_BT_MICS_CLIENT)
|
|
||||||
struct bt_mics_client cli;
|
|
||||||
#endif /* CONFIG_BT_MICS_CLIENT */
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
int bt_mics_client_included_get(struct bt_mics *mics,
|
|
||||||
struct bt_mics_included *included);
|
|
||||||
int bt_mics_client_mute_get(struct bt_mics *mics);
|
|
||||||
int bt_mics_client_mute(struct bt_mics *mics);
|
|
||||||
int bt_mics_client_unmute(struct bt_mics *mics);
|
|
||||||
bool bt_mics_client_valid_aics_inst(struct bt_mics *mics, struct bt_aics *aics);
|
|
||||||
|
|
||||||
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_MICS_INTERNAL_ */
|
|
|
@ -34,11 +34,11 @@ zephyr_library_sources_ifdef(
|
||||||
vcs_client.c
|
vcs_client.c
|
||||||
)
|
)
|
||||||
zephyr_library_sources_ifdef(
|
zephyr_library_sources_ifdef(
|
||||||
CONFIG_BT_MICS
|
CONFIG_BT_MICP
|
||||||
mics.c
|
mics.c
|
||||||
)
|
)
|
||||||
zephyr_library_sources_ifdef(
|
zephyr_library_sources_ifdef(
|
||||||
CONFIG_BT_MICS_CLIENT
|
CONFIG_BT_MICP_CLIENT
|
||||||
mics_client.c
|
mics_client.c
|
||||||
)
|
)
|
||||||
zephyr_library_sources_ifdef(
|
zephyr_library_sources_ifdef(
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/** @file
|
/** @file
|
||||||
* @brief Bluetooth MICS shell.
|
* @brief Bluetooth MICP shell.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2020 Bose Corporation
|
* Copyright (c) 2020 Bose Corporation
|
||||||
* Copyright (c) 2020-2021 Nordic Semiconductor ASA
|
* Copyright (c) 2020-2022 Nordic Semiconductor ASA
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -16,10 +16,10 @@
|
||||||
|
|
||||||
#include "bt.h"
|
#include "bt.h"
|
||||||
|
|
||||||
static struct bt_mics *mics;
|
static struct bt_micp *micp;
|
||||||
static struct bt_mics_included mics_included;
|
static struct bt_micp_included micp_included;
|
||||||
|
|
||||||
static void mics_mute_cb(struct bt_mics *mics, int err, uint8_t mute)
|
static void micp_mute_cb(struct bt_micp *micp, int err, uint8_t mute)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
shell_error(ctx_shell, "Mute get failed (%d)", err);
|
shell_error(ctx_shell, "Mute get failed (%d)", err);
|
||||||
|
@ -28,7 +28,7 @@ static void mics_mute_cb(struct bt_mics *mics, int err, uint8_t mute)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_aics_state_cb(struct bt_aics *inst, int err, int8_t gain,
|
static void micp_aics_state_cb(struct bt_aics *inst, int err, int8_t gain,
|
||||||
uint8_t mute, uint8_t mode)
|
uint8_t mute, uint8_t mode)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
|
@ -40,7 +40,7 @@ static void mics_aics_state_cb(struct bt_aics *inst, int err, int8_t gain,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
static void mics_aics_gain_setting_cb(struct bt_aics *inst, int err,
|
static void micp_aics_gain_setting_cb(struct bt_aics *inst, int err,
|
||||||
uint8_t units, int8_t minimum,
|
uint8_t units, int8_t minimum,
|
||||||
int8_t maximum)
|
int8_t maximum)
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,7 @@ static void mics_aics_gain_setting_cb(struct bt_aics *inst, int err,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
static void mics_aics_input_type_cb(struct bt_aics *inst, int err,
|
static void micp_aics_input_type_cb(struct bt_aics *inst, int err,
|
||||||
uint8_t input_type)
|
uint8_t input_type)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
|
@ -66,7 +66,7 @@ static void mics_aics_input_type_cb(struct bt_aics *inst, int err,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
static void mics_aics_status_cb(struct bt_aics *inst, int err, bool active)
|
static void micp_aics_status_cb(struct bt_aics *inst, int err, bool active)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
shell_error(ctx_shell, "AICS status get failed (%d) for "
|
shell_error(ctx_shell, "AICS status get failed (%d) for "
|
||||||
|
@ -77,7 +77,7 @@ static void mics_aics_status_cb(struct bt_aics *inst, int err, bool active)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
static void mics_aics_description_cb(struct bt_aics *inst, int err,
|
static void micp_aics_description_cb(struct bt_aics *inst, int err,
|
||||||
char *description)
|
char *description)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
|
@ -89,65 +89,65 @@ static void mics_aics_description_cb(struct bt_aics *inst, int err,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_mics_cb mics_cbs = {
|
static struct bt_micp_cb micp_cbs = {
|
||||||
.mute = mics_mute_cb,
|
.mute = micp_mute_cb,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct bt_aics_cb aics_cb = {
|
static struct bt_aics_cb aics_cb = {
|
||||||
.state = mics_aics_state_cb,
|
.state = micp_aics_state_cb,
|
||||||
.gain_setting = mics_aics_gain_setting_cb,
|
.gain_setting = micp_aics_gain_setting_cb,
|
||||||
.type = mics_aics_input_type_cb,
|
.type = micp_aics_input_type_cb,
|
||||||
.status = mics_aics_status_cb,
|
.status = micp_aics_status_cb,
|
||||||
.description = mics_aics_description_cb,
|
.description = micp_aics_description_cb,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int cmd_mics_param(const struct shell *sh, size_t argc, char **argv)
|
static int cmd_micp_param(const struct shell *sh, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
struct bt_mics_register_param mics_param;
|
struct bt_micp_register_param micp_param;
|
||||||
char input_desc[CONFIG_BT_MICS_AICS_INSTANCE_COUNT][16];
|
char input_desc[CONFIG_BT_MICP_AICS_INSTANCE_COUNT][16];
|
||||||
|
|
||||||
if (ctx_shell == NULL) {
|
if (ctx_shell == NULL) {
|
||||||
ctx_shell = sh;
|
ctx_shell = sh;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)memset(&mics_param, 0, sizeof(mics_param));
|
(void)memset(&micp_param, 0, sizeof(micp_param));
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_SIZE(mics_param.aics_param); i++) {
|
for (int i = 0; i < ARRAY_SIZE(micp_param.aics_param); i++) {
|
||||||
mics_param.aics_param[i].desc_writable = true;
|
micp_param.aics_param[i].desc_writable = true;
|
||||||
snprintf(input_desc[i], sizeof(input_desc[i]),
|
snprintf(input_desc[i], sizeof(input_desc[i]),
|
||||||
"Input %d", i + 1);
|
"Input %d", i + 1);
|
||||||
mics_param.aics_param[i].description = input_desc[i];
|
micp_param.aics_param[i].description = input_desc[i];
|
||||||
mics_param.aics_param[i].type = BT_AICS_INPUT_TYPE_UNSPECIFIED;
|
micp_param.aics_param[i].type = BT_AICS_INPUT_TYPE_UNSPECIFIED;
|
||||||
mics_param.aics_param[i].status = true;
|
micp_param.aics_param[i].status = true;
|
||||||
mics_param.aics_param[i].gain_mode = BT_AICS_MODE_MANUAL;
|
micp_param.aics_param[i].gain_mode = BT_AICS_MODE_MANUAL;
|
||||||
mics_param.aics_param[i].units = 1;
|
micp_param.aics_param[i].units = 1;
|
||||||
mics_param.aics_param[i].min_gain = -100;
|
micp_param.aics_param[i].min_gain = -100;
|
||||||
mics_param.aics_param[i].max_gain = 100;
|
micp_param.aics_param[i].max_gain = 100;
|
||||||
mics_param.aics_param[i].cb = &aics_cb;
|
micp_param.aics_param[i].cb = &aics_cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
mics_param.cb = &mics_cbs;
|
micp_param.cb = &micp_cbs;
|
||||||
|
|
||||||
result = bt_mics_register(&mics_param, &mics);
|
result = bt_micp_register(&micp_param, &micp);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "MICS register failed: %d", result);
|
shell_error(sh, "MICP register failed: %d", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
shell_print(sh, "MICS initialized: %d", result);
|
shell_print(sh, "MICP initialized: %d", result);
|
||||||
|
|
||||||
result = bt_mics_included_get(NULL, &mics_included);
|
result = bt_micp_included_get(NULL, &micp_included);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "MICS get failed: %d", result);
|
shell_error(sh, "MICP get failed: %d", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_mute_get(const struct shell *sh, size_t argc, char **argv)
|
static int cmd_micp_mute_get(const struct shell *sh, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result = bt_mics_mute_get(NULL);
|
int result = bt_micp_mute_get(NULL);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
|
@ -156,9 +156,9 @@ static int cmd_mics_mute_get(const struct shell *sh, size_t argc, char **argv)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_mute(const struct shell *sh, size_t argc, char **argv)
|
static int cmd_micp_mute(const struct shell *sh, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result = bt_mics_mute(NULL);
|
int result = bt_micp_mute(NULL);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
|
@ -167,9 +167,9 @@ static int cmd_mics_mute(const struct shell *sh, size_t argc, char **argv)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_unmute(const struct shell *sh, size_t argc, char **argv)
|
static int cmd_micp_unmute(const struct shell *sh, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result = bt_mics_unmute(NULL);
|
int result = bt_micp_unmute(NULL);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
|
@ -178,10 +178,10 @@ static int cmd_mics_unmute(const struct shell *sh, size_t argc, char **argv)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_mute_disable(const struct shell *sh, size_t argc,
|
static int cmd_micp_mute_disable(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result = bt_mics_mute_disable(mics);
|
int result = bt_micp_mute_disable(micp);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
|
@ -190,19 +190,19 @@ static int cmd_mics_mute_disable(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_aics_deactivate(const struct shell *sh, size_t argc,
|
static int cmd_micp_aics_deactivate(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_deactivate(mics, mics_included.aics[index]);
|
result = bt_micp_aics_deactivate(micp, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -210,19 +210,19 @@ static int cmd_mics_aics_deactivate(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_aics_activate(const struct shell *sh, size_t argc,
|
static int cmd_micp_aics_activate(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_activate(mics, mics_included.aics[index]);
|
result = bt_micp_aics_activate(micp, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -230,19 +230,19 @@ static int cmd_mics_aics_activate(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_aics_input_state_get(const struct shell *sh, size_t argc,
|
static int cmd_micp_aics_input_state_get(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_state_get(NULL, mics_included.aics[index]);
|
result = bt_micp_aics_state_get(NULL, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -250,19 +250,19 @@ static int cmd_mics_aics_input_state_get(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_aics_gain_setting_get(const struct shell *sh, size_t argc,
|
static int cmd_micp_aics_gain_setting_get(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_gain_setting_get(NULL, mics_included.aics[index]);
|
result = bt_micp_aics_gain_setting_get(NULL, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -270,19 +270,19 @@ static int cmd_mics_aics_gain_setting_get(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_aics_input_type_get(const struct shell *sh, size_t argc,
|
static int cmd_micp_aics_input_type_get(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_type_get(NULL, mics_included.aics[index]);
|
result = bt_micp_aics_type_get(NULL, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -290,19 +290,19 @@ static int cmd_mics_aics_input_type_get(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_aics_input_status_get(const struct shell *sh, size_t argc,
|
static int cmd_micp_aics_input_status_get(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_status_get(NULL, mics_included.aics[index]);
|
result = bt_micp_aics_status_get(NULL, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -310,19 +310,19 @@ static int cmd_mics_aics_input_status_get(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_aics_input_unmute(const struct shell *sh, size_t argc,
|
static int cmd_micp_aics_input_unmute(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_unmute(NULL, mics_included.aics[index]);
|
result = bt_micp_aics_unmute(NULL, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -330,19 +330,19 @@ static int cmd_mics_aics_input_unmute(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_aics_input_mute(const struct shell *sh, size_t argc,
|
static int cmd_micp_aics_input_mute(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_mute(NULL, mics_included.aics[index]);
|
result = bt_micp_aics_mute(NULL, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -350,19 +350,19 @@ static int cmd_mics_aics_input_mute(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_aics_manual_input_gain_set(const struct shell *sh,
|
static int cmd_micp_aics_manual_input_gain_set(const struct shell *sh,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_manual_gain_set(NULL, mics_included.aics[index]);
|
result = bt_micp_aics_manual_gain_set(NULL, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -370,19 +370,19 @@ static int cmd_mics_aics_manual_input_gain_set(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_aics_automatic_input_gain_set(const struct shell *sh,
|
static int cmd_micp_aics_automatic_input_gain_set(const struct shell *sh,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_automatic_gain_set(NULL, mics_included.aics[index]);
|
result = bt_micp_aics_automatic_gain_set(NULL, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -390,16 +390,16 @@ static int cmd_mics_aics_automatic_input_gain_set(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_aics_gain_set(const struct shell *sh, size_t argc,
|
static int cmd_micp_aics_gain_set(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
int gain = strtol(argv[2], NULL, 0);
|
int gain = strtol(argv[2], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ static int cmd_mics_aics_gain_set(const struct shell *sh, size_t argc,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_gain_set(NULL, mics_included.aics[index], gain);
|
result = bt_micp_aics_gain_set(NULL, micp_included.aics[index], gain);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -417,19 +417,19 @@ static int cmd_mics_aics_gain_set(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_aics_input_description_get(const struct shell *sh,
|
static int cmd_micp_aics_input_description_get(const struct shell *sh,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_description_get(NULL, mics_included.aics[index]);
|
result = bt_micp_aics_description_get(NULL, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -437,20 +437,20 @@ static int cmd_mics_aics_input_description_get(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_aics_input_description_set(const struct shell *sh,
|
static int cmd_micp_aics_input_description_set(const struct shell *sh,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
char *description = argv[2];
|
char *description = argv[2];
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_description_set(NULL, mics_included.aics[index],
|
result = bt_micp_aics_description_set(NULL, micp_included.aics[index],
|
||||||
description);
|
description);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_error(sh, "Fail: %d", result);
|
shell_error(sh, "Fail: %d", result);
|
||||||
|
@ -459,7 +459,7 @@ static int cmd_mics_aics_input_description_set(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics(const struct shell *sh, size_t argc, char **argv)
|
static int cmd_micp(const struct shell *sh, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
shell_error(sh, "%s unknown parameter: %s",
|
shell_error(sh, "%s unknown parameter: %s",
|
||||||
|
@ -471,68 +471,68 @@ static int cmd_mics(const struct shell *sh, size_t argc, char **argv)
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_STATIC_SUBCMD_SET_CREATE(mics_cmds,
|
SHELL_STATIC_SUBCMD_SET_CREATE(micp_cmds,
|
||||||
SHELL_CMD_ARG(init, NULL,
|
SHELL_CMD_ARG(init, NULL,
|
||||||
"Initialize the service and register callbacks",
|
"Initialize the service and register callbacks",
|
||||||
cmd_mics_param, 1, 0),
|
cmd_micp_param, 1, 0),
|
||||||
SHELL_CMD_ARG(mute_get, NULL,
|
SHELL_CMD_ARG(mute_get, NULL,
|
||||||
"Get the mute state",
|
"Get the mute state",
|
||||||
cmd_mics_mute_get, 1, 0),
|
cmd_micp_mute_get, 1, 0),
|
||||||
SHELL_CMD_ARG(mute, NULL,
|
SHELL_CMD_ARG(mute, NULL,
|
||||||
"Mute the MICS server",
|
"Mute the MICP server",
|
||||||
cmd_mics_mute, 1, 0),
|
cmd_micp_mute, 1, 0),
|
||||||
SHELL_CMD_ARG(unmute, NULL,
|
SHELL_CMD_ARG(unmute, NULL,
|
||||||
"Unmute the MICS server",
|
"Unmute the MICP server",
|
||||||
cmd_mics_unmute, 1, 0),
|
cmd_micp_unmute, 1, 0),
|
||||||
SHELL_CMD_ARG(mute_disable, NULL,
|
SHELL_CMD_ARG(mute_disable, NULL,
|
||||||
"Disable the MICS mute",
|
"Disable the MICP mute",
|
||||||
cmd_mics_mute_disable, 1, 0),
|
cmd_micp_mute_disable, 1, 0),
|
||||||
SHELL_CMD_ARG(aics_deactivate, NULL,
|
SHELL_CMD_ARG(aics_deactivate, NULL,
|
||||||
"Deactivates a AICS instance <inst_index>",
|
"Deactivates a AICS instance <inst_index>",
|
||||||
cmd_mics_aics_deactivate, 2, 0),
|
cmd_micp_aics_deactivate, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_activate, NULL,
|
SHELL_CMD_ARG(aics_activate, NULL,
|
||||||
"Activates a AICS instance <inst_index>",
|
"Activates a AICS instance <inst_index>",
|
||||||
cmd_mics_aics_activate, 2, 0),
|
cmd_micp_aics_activate, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_input_state_get, NULL,
|
SHELL_CMD_ARG(aics_input_state_get, NULL,
|
||||||
"Get the input state of a AICS instance <inst_index>",
|
"Get the input state of a AICS instance <inst_index>",
|
||||||
cmd_mics_aics_input_state_get, 2, 0),
|
cmd_micp_aics_input_state_get, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_gain_setting_get, NULL,
|
SHELL_CMD_ARG(aics_gain_setting_get, NULL,
|
||||||
"Get the gain settings of a AICS instance <inst_index>",
|
"Get the gain settings of a AICS instance <inst_index>",
|
||||||
cmd_mics_aics_gain_setting_get, 2, 0),
|
cmd_micp_aics_gain_setting_get, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_input_type_get, NULL,
|
SHELL_CMD_ARG(aics_input_type_get, NULL,
|
||||||
"Get the input type of a AICS instance <inst_index>",
|
"Get the input type of a AICS instance <inst_index>",
|
||||||
cmd_mics_aics_input_type_get, 2, 0),
|
cmd_micp_aics_input_type_get, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_input_status_get, NULL,
|
SHELL_CMD_ARG(aics_input_status_get, NULL,
|
||||||
"Get the input status of a AICS instance <inst_index>",
|
"Get the input status of a AICS instance <inst_index>",
|
||||||
cmd_mics_aics_input_status_get, 2, 0),
|
cmd_micp_aics_input_status_get, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_input_unmute, NULL,
|
SHELL_CMD_ARG(aics_input_unmute, NULL,
|
||||||
"Unmute the input of a AICS instance <inst_index>",
|
"Unmute the input of a AICS instance <inst_index>",
|
||||||
cmd_mics_aics_input_unmute, 2, 0),
|
cmd_micp_aics_input_unmute, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_input_mute, NULL,
|
SHELL_CMD_ARG(aics_input_mute, NULL,
|
||||||
"Mute the input of a AICS instance <inst_index>",
|
"Mute the input of a AICS instance <inst_index>",
|
||||||
cmd_mics_aics_input_mute, 2, 0),
|
cmd_micp_aics_input_mute, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_manual_input_gain_set, NULL,
|
SHELL_CMD_ARG(aics_manual_input_gain_set, NULL,
|
||||||
"Set the gain mode of a AICS instance to manual "
|
"Set the gain mode of a AICS instance to manual "
|
||||||
"<inst_index>",
|
"<inst_index>",
|
||||||
cmd_mics_aics_manual_input_gain_set, 2, 0),
|
cmd_micp_aics_manual_input_gain_set, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_automatic_input_gain_set, NULL,
|
SHELL_CMD_ARG(aics_automatic_input_gain_set, NULL,
|
||||||
"Set the gain mode of a AICS instance to automatic "
|
"Set the gain mode of a AICS instance to automatic "
|
||||||
"<inst_index>",
|
"<inst_index>",
|
||||||
cmd_mics_aics_automatic_input_gain_set, 2, 0),
|
cmd_micp_aics_automatic_input_gain_set, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_gain_set, NULL,
|
SHELL_CMD_ARG(aics_gain_set, NULL,
|
||||||
"Set the gain in dB of a AICS instance <inst_index> "
|
"Set the gain in dB of a AICS instance <inst_index> "
|
||||||
"<gain (-128 to 127)>",
|
"<gain (-128 to 127)>",
|
||||||
cmd_mics_aics_gain_set, 3, 0),
|
cmd_micp_aics_gain_set, 3, 0),
|
||||||
SHELL_CMD_ARG(aics_input_description_get, NULL,
|
SHELL_CMD_ARG(aics_input_description_get, NULL,
|
||||||
"Get the input description of a AICS instance "
|
"Get the input description of a AICS instance "
|
||||||
"<inst_index>",
|
"<inst_index>",
|
||||||
cmd_mics_aics_input_description_get, 2, 0),
|
cmd_micp_aics_input_description_get, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_input_description_set, NULL,
|
SHELL_CMD_ARG(aics_input_description_set, NULL,
|
||||||
"Set the input description of a AICS instance "
|
"Set the input description of a AICS instance "
|
||||||
"<inst_index> <description>",
|
"<inst_index> <description>",
|
||||||
cmd_mics_aics_input_description_set, 3, 0),
|
cmd_micp_aics_input_description_set, 3, 0),
|
||||||
SHELL_SUBCMD_SET_END
|
SHELL_SUBCMD_SET_END
|
||||||
);
|
);
|
||||||
|
|
||||||
SHELL_CMD_ARG_REGISTER(mics, &mics_cmds, "Bluetooth MICS shell commands",
|
SHELL_CMD_ARG_REGISTER(micp, &micp_cmds, "Bluetooth MICP shell commands",
|
||||||
cmd_mics, 1, 1);
|
cmd_micp, 1, 1);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/** @file
|
/** @file
|
||||||
* @brief Bluetooth MICS client shell.
|
* @brief Bluetooth MICP client shell.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2020 Bose Corporation
|
* Copyright (c) 2020 Bose Corporation
|
||||||
* Copyright (c) 2020-2021 Nordic Semiconductor ASA
|
* Copyright (c) 2020-2022 Nordic Semiconductor ASA
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -16,24 +16,24 @@
|
||||||
|
|
||||||
#include "bt.h"
|
#include "bt.h"
|
||||||
|
|
||||||
static struct bt_mics *mics;
|
static struct bt_micp *micp;
|
||||||
static struct bt_mics_included mics_included;
|
static struct bt_micp_included micp_included;
|
||||||
|
|
||||||
static void mics_discover_cb(struct bt_mics *mics, int err, uint8_t aics_count)
|
static void micp_discover_cb(struct bt_micp *micp, int err, uint8_t aics_count)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
shell_error(ctx_shell, "MICS discover failed (%d)", err);
|
shell_error(ctx_shell, "MICP discover failed (%d)", err);
|
||||||
} else {
|
} else {
|
||||||
shell_print(ctx_shell, "MICS discover done with %u AICS",
|
shell_print(ctx_shell, "MICP discover done with %u AICS",
|
||||||
aics_count);
|
aics_count);
|
||||||
|
|
||||||
if (bt_mics_included_get(mics, &mics_included) != 0) {
|
if (bt_micp_included_get(micp, &micp_included) != 0) {
|
||||||
shell_error(ctx_shell, "Could not get MICS context");
|
shell_error(ctx_shell, "Could not get MICP context");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_mute_write_cb(struct bt_mics *mics, int err)
|
static void micp_mute_write_cb(struct bt_micp *micp, int err)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
shell_error(ctx_shell, "Mute write failed (%d)", err);
|
shell_error(ctx_shell, "Mute write failed (%d)", err);
|
||||||
|
@ -43,7 +43,7 @@ static void mics_mute_write_cb(struct bt_mics *mics, int err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void mics_unmute_write_cb(struct bt_mics *mics, int err)
|
static void micp_unmute_write_cb(struct bt_micp *micp, int err)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
shell_error(ctx_shell, "Unmute write failed (%d)", err);
|
shell_error(ctx_shell, "Unmute write failed (%d)", err);
|
||||||
|
@ -52,7 +52,7 @@ static void mics_unmute_write_cb(struct bt_mics *mics, int err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_aics_set_gain_cb(struct bt_aics *inst, int err)
|
static void micp_aics_set_gain_cb(struct bt_aics *inst, int err)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
shell_error(ctx_shell, "Set gain failed (%d) for inst %p",
|
shell_error(ctx_shell, "Set gain failed (%d) for inst %p",
|
||||||
|
@ -62,7 +62,7 @@ static void mics_aics_set_gain_cb(struct bt_aics *inst, int err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_aics_unmute_cb(struct bt_aics *inst, int err)
|
static void micp_aics_unmute_cb(struct bt_aics *inst, int err)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
shell_error(ctx_shell, "Unmute failed (%d) for inst %p",
|
shell_error(ctx_shell, "Unmute failed (%d) for inst %p",
|
||||||
|
@ -72,7 +72,7 @@ static void mics_aics_unmute_cb(struct bt_aics *inst, int err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_aics_mute_cb(struct bt_aics *inst, int err)
|
static void micp_aics_mute_cb(struct bt_aics *inst, int err)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
shell_error(ctx_shell, "Mute failed (%d) for inst %p",
|
shell_error(ctx_shell, "Mute failed (%d) for inst %p",
|
||||||
|
@ -82,7 +82,7 @@ static void mics_aics_mute_cb(struct bt_aics *inst, int err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_aics_set_manual_mode_cb(struct bt_aics *inst, int err)
|
static void micp_aics_set_manual_mode_cb(struct bt_aics *inst, int err)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
shell_error(ctx_shell,
|
shell_error(ctx_shell,
|
||||||
|
@ -93,7 +93,7 @@ static void mics_aics_set_manual_mode_cb(struct bt_aics *inst, int err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_aics_automatic_mode_cb(struct bt_aics *inst, int err)
|
static void micp_aics_automatic_mode_cb(struct bt_aics *inst, int err)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
shell_error(ctx_shell,
|
shell_error(ctx_shell,
|
||||||
|
@ -105,7 +105,7 @@ static void mics_aics_automatic_mode_cb(struct bt_aics *inst, int err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_mute_cb(struct bt_mics *mics, int err, uint8_t mute)
|
static void micp_mute_cb(struct bt_micp *micp, int err, uint8_t mute)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
shell_error(ctx_shell, "Mute get failed (%d)", err);
|
shell_error(ctx_shell, "Mute get failed (%d)", err);
|
||||||
|
@ -114,7 +114,7 @@ static void mics_mute_cb(struct bt_mics *mics, int err, uint8_t mute)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_aics_state_cb(struct bt_aics *inst, int err, int8_t gain,
|
static void micp_aics_state_cb(struct bt_aics *inst, int err, int8_t gain,
|
||||||
uint8_t mute, uint8_t mode)
|
uint8_t mute, uint8_t mode)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
|
@ -127,7 +127,7 @@ static void mics_aics_state_cb(struct bt_aics *inst, int err, int8_t gain,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_aics_gain_setting_cb(struct bt_aics *inst, int err,
|
static void micp_aics_gain_setting_cb(struct bt_aics *inst, int err,
|
||||||
uint8_t units, int8_t minimum,
|
uint8_t units, int8_t minimum,
|
||||||
int8_t maximum)
|
int8_t maximum)
|
||||||
{
|
{
|
||||||
|
@ -142,7 +142,7 @@ static void mics_aics_gain_setting_cb(struct bt_aics *inst, int err,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_aics_input_type_cb(struct bt_aics *inst, int err,
|
static void micp_aics_input_type_cb(struct bt_aics *inst, int err,
|
||||||
uint8_t input_type)
|
uint8_t input_type)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
|
@ -155,7 +155,7 @@ static void mics_aics_input_type_cb(struct bt_aics *inst, int err,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_aics_status_cb(struct bt_aics *inst, int err, bool active)
|
static void micp_aics_status_cb(struct bt_aics *inst, int err, bool active)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
shell_error(ctx_shell, "AICS status get failed (%d) for "
|
shell_error(ctx_shell, "AICS status get failed (%d) for "
|
||||||
|
@ -167,7 +167,7 @@ static void mics_aics_status_cb(struct bt_aics *inst, int err, bool active)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_aics_description_cb(struct bt_aics *inst, int err,
|
static void micp_aics_description_cb(struct bt_aics *inst, int err,
|
||||||
char *description)
|
char *description)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
|
@ -179,28 +179,28 @@ static void mics_aics_description_cb(struct bt_aics *inst, int err,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_mics_cb mics_cbs = {
|
static struct bt_micp_cb micp_cbs = {
|
||||||
.discover = mics_discover_cb,
|
.discover = micp_discover_cb,
|
||||||
.mute_write = mics_mute_write_cb,
|
.mute_write = micp_mute_write_cb,
|
||||||
.unmute_write = mics_unmute_write_cb,
|
.unmute_write = micp_unmute_write_cb,
|
||||||
.mute = mics_mute_cb,
|
.mute = micp_mute_cb,
|
||||||
|
|
||||||
/* Audio Input Control Service */
|
/* Audio Input Control Service */
|
||||||
.aics_cb = {
|
.aics_cb = {
|
||||||
.state = mics_aics_state_cb,
|
.state = micp_aics_state_cb,
|
||||||
.gain_setting = mics_aics_gain_setting_cb,
|
.gain_setting = micp_aics_gain_setting_cb,
|
||||||
.type = mics_aics_input_type_cb,
|
.type = micp_aics_input_type_cb,
|
||||||
.status = mics_aics_status_cb,
|
.status = micp_aics_status_cb,
|
||||||
.description = mics_aics_description_cb,
|
.description = micp_aics_description_cb,
|
||||||
.set_gain = mics_aics_set_gain_cb,
|
.set_gain = micp_aics_set_gain_cb,
|
||||||
.unmute = mics_aics_unmute_cb,
|
.unmute = micp_aics_unmute_cb,
|
||||||
.mute = mics_aics_mute_cb,
|
.mute = micp_aics_mute_cb,
|
||||||
.set_manual_mode = mics_aics_set_manual_mode_cb,
|
.set_manual_mode = micp_aics_set_manual_mode_cb,
|
||||||
.set_auto_mode = mics_aics_automatic_mode_cb,
|
.set_auto_mode = micp_aics_automatic_mode_cb,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int cmd_mics_client_discover(const struct shell *sh, size_t argc,
|
static int cmd_micp_client_discover(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
@ -209,7 +209,7 @@ static int cmd_mics_client_discover(const struct shell *sh, size_t argc,
|
||||||
ctx_shell = sh;
|
ctx_shell = sh;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_client_cb_register(&mics_cbs);
|
result = bt_micp_client_cb_register(&micp_cbs);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Failed to register callbacks: %d", result);
|
shell_print(sh, "Failed to register callbacks: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ static int cmd_mics_client_discover(const struct shell *sh, size_t argc,
|
||||||
return -ENOTCONN;
|
return -ENOTCONN;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_discover(default_conn, &mics);
|
result = bt_micp_discover(default_conn, &micp);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -226,16 +226,16 @@ static int cmd_mics_client_discover(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_mute_get(const struct shell *sh, size_t argc,
|
static int cmd_micp_client_mute_get(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_mute_get(mics);
|
result = bt_micp_mute_get(micp);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
|
@ -244,16 +244,16 @@ static int cmd_mics_client_mute_get(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_mute(const struct shell *sh, size_t argc,
|
static int cmd_micp_client_mute(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_mute(mics);
|
result = bt_micp_mute(micp);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
|
@ -262,16 +262,16 @@ static int cmd_mics_client_mute(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_unmute(const struct shell *sh, size_t argc,
|
static int cmd_micp_client_unmute(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_unmute(mics);
|
result = bt_micp_unmute(micp);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
|
@ -280,23 +280,23 @@ static int cmd_mics_client_unmute(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_aics_input_state_get(const struct shell *sh,
|
static int cmd_micp_client_aics_input_state_get(const struct shell *sh,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_state_get(mics, mics_included.aics[index]);
|
result = bt_micp_aics_state_get(micp, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -304,23 +304,23 @@ static int cmd_mics_client_aics_input_state_get(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_aics_gain_setting_get(const struct shell *sh,
|
static int cmd_micp_client_aics_gain_setting_get(const struct shell *sh,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_gain_setting_get(mics, mics_included.aics[index]);
|
result = bt_micp_aics_gain_setting_get(micp, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -328,23 +328,23 @@ static int cmd_mics_client_aics_gain_setting_get(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_aics_input_type_get(const struct shell *sh,
|
static int cmd_micp_client_aics_input_type_get(const struct shell *sh,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_type_get(mics, mics_included.aics[index]);
|
result = bt_micp_aics_type_get(micp, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -352,23 +352,23 @@ static int cmd_mics_client_aics_input_type_get(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_aics_input_status_get(const struct shell *sh,
|
static int cmd_micp_client_aics_input_status_get(const struct shell *sh,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_status_get(mics, mics_included.aics[index]);
|
result = bt_micp_aics_status_get(micp, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -376,23 +376,23 @@ static int cmd_mics_client_aics_input_status_get(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_aics_input_unmute(const struct shell *sh,
|
static int cmd_micp_client_aics_input_unmute(const struct shell *sh,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_unmute(mics, mics_included.aics[index]);
|
result = bt_micp_aics_unmute(micp, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -400,23 +400,23 @@ static int cmd_mics_client_aics_input_unmute(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_aics_input_mute(const struct shell *sh,
|
static int cmd_micp_client_aics_input_mute(const struct shell *sh,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_mute(mics, mics_included.aics[index]);
|
result = bt_micp_aics_mute(micp, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -424,23 +424,23 @@ static int cmd_mics_client_aics_input_mute(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_aics_manual_input_gain_set(const struct shell *sh,
|
static int cmd_micp_client_aics_manual_input_gain_set(const struct shell *sh,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_manual_gain_set(mics, mics_included.aics[index]);
|
result = bt_micp_aics_manual_gain_set(micp, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -448,25 +448,25 @@ static int cmd_mics_client_aics_manual_input_gain_set(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_aics_automatic_input_gain_set(const struct shell *sh,
|
static int cmd_micp_client_aics_automatic_input_gain_set(const struct shell *sh,
|
||||||
size_t argc,
|
size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_automatic_gain_set(mics,
|
result = bt_micp_aics_automatic_gain_set(micp,
|
||||||
mics_included.aics[index]);
|
micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -474,16 +474,16 @@ static int cmd_mics_client_aics_automatic_input_gain_set(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_aics_gain_set(const struct shell *sh, size_t argc,
|
static int cmd_micp_client_aics_gain_set(const struct shell *sh, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
int gain = strtol(argv[2], NULL, 0);
|
int gain = strtol(argv[2], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,11 +493,11 @@ static int cmd_mics_client_aics_gain_set(const struct shell *sh, size_t argc,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_gain_set(mics, mics_included.aics[index], gain);
|
result = bt_micp_aics_gain_set(micp, micp_included.aics[index], gain);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -505,23 +505,23 @@ static int cmd_mics_client_aics_gain_set(const struct shell *sh, size_t argc,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_aics_input_description_get(const struct shell *sh,
|
static int cmd_micp_client_aics_input_description_get(const struct shell *sh,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_description_get(mics, mics_included.aics[index]);
|
result = bt_micp_aics_description_get(micp, micp_included.aics[index]);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -529,24 +529,24 @@ static int cmd_mics_client_aics_input_description_get(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client_aics_input_description_set(const struct shell *sh,
|
static int cmd_micp_client_aics_input_description_set(const struct shell *sh,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index = strtol(argv[1], NULL, 0);
|
int index = strtol(argv[1], NULL, 0);
|
||||||
char *description = argv[2];
|
char *description = argv[2];
|
||||||
|
|
||||||
if (index >= mics_included.aics_cnt) {
|
if (index >= micp_included.aics_cnt) {
|
||||||
shell_error(sh, "Index shall be less than %u, was %u",
|
shell_error(sh, "Index shall be less than %u, was %u",
|
||||||
mics_included.aics_cnt, index);
|
micp_included.aics_cnt, index);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mics == NULL) {
|
if (micp == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_mics_aics_description_set(mics, mics_included.aics[index],
|
result = bt_micp_aics_description_set(micp, micp_included.aics[index],
|
||||||
description);
|
description);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
|
@ -555,7 +555,7 @@ static int cmd_mics_client_aics_input_description_set(const struct shell *sh,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_mics_client(const struct shell *sh, size_t argc, char **argv)
|
static int cmd_micp_client(const struct shell *sh, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
shell_error(sh, "%s unknown parameter: %s",
|
shell_error(sh, "%s unknown parameter: %s",
|
||||||
|
@ -567,59 +567,59 @@ static int cmd_mics_client(const struct shell *sh, size_t argc, char **argv)
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_STATIC_SUBCMD_SET_CREATE(mics_client_cmds,
|
SHELL_STATIC_SUBCMD_SET_CREATE(micp_client_cmds,
|
||||||
SHELL_CMD_ARG(discover, NULL,
|
SHELL_CMD_ARG(discover, NULL,
|
||||||
"Discover MICS on remote device",
|
"Discover MICS on remote device",
|
||||||
cmd_mics_client_discover, 1, 0),
|
cmd_micp_client_discover, 1, 0),
|
||||||
SHELL_CMD_ARG(mute_get, NULL,
|
SHELL_CMD_ARG(mute_get, NULL,
|
||||||
"Read the mute state of the MICS server.",
|
"Read the mute state of the MICP server.",
|
||||||
cmd_mics_client_mute_get, 1, 0),
|
cmd_micp_client_mute_get, 1, 0),
|
||||||
SHELL_CMD_ARG(mute, NULL,
|
SHELL_CMD_ARG(mute, NULL,
|
||||||
"Mute the MICS server",
|
"Mute the MICP server",
|
||||||
cmd_mics_client_mute, 1, 0),
|
cmd_micp_client_mute, 1, 0),
|
||||||
SHELL_CMD_ARG(unmute, NULL,
|
SHELL_CMD_ARG(unmute, NULL,
|
||||||
"Unmute the MICS server",
|
"Unmute the MICP server",
|
||||||
cmd_mics_client_unmute, 1, 0),
|
cmd_micp_client_unmute, 1, 0),
|
||||||
SHELL_CMD_ARG(aics_input_state_get, NULL,
|
SHELL_CMD_ARG(aics_input_state_get, NULL,
|
||||||
"Read the input state of a AICS instance <inst_index>",
|
"Read the input state of a AICS instance <inst_index>",
|
||||||
cmd_mics_client_aics_input_state_get, 2, 0),
|
cmd_micp_client_aics_input_state_get, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_gain_setting_get, NULL,
|
SHELL_CMD_ARG(aics_gain_setting_get, NULL,
|
||||||
"Read the gain settings of a AICS instance <inst_index>",
|
"Read the gain settings of a AICS instance <inst_index>",
|
||||||
cmd_mics_client_aics_gain_setting_get, 2, 0),
|
cmd_micp_client_aics_gain_setting_get, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_input_type_get, NULL,
|
SHELL_CMD_ARG(aics_input_type_get, NULL,
|
||||||
"Read the input type of a AICS instance <inst_index>",
|
"Read the input type of a AICS instance <inst_index>",
|
||||||
cmd_mics_client_aics_input_type_get, 2, 0),
|
cmd_micp_client_aics_input_type_get, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_input_status_get, NULL,
|
SHELL_CMD_ARG(aics_input_status_get, NULL,
|
||||||
"Read the input status of a AICS instance <inst_index>",
|
"Read the input status of a AICS instance <inst_index>",
|
||||||
cmd_mics_client_aics_input_status_get, 2, 0),
|
cmd_micp_client_aics_input_status_get, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_input_unmute, NULL,
|
SHELL_CMD_ARG(aics_input_unmute, NULL,
|
||||||
"Unmute the input of a AICS instance <inst_index>",
|
"Unmute the input of a AICS instance <inst_index>",
|
||||||
cmd_mics_client_aics_input_unmute, 2, 0),
|
cmd_micp_client_aics_input_unmute, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_input_mute, NULL,
|
SHELL_CMD_ARG(aics_input_mute, NULL,
|
||||||
"Mute the input of a AICS instance <inst_index>",
|
"Mute the input of a AICS instance <inst_index>",
|
||||||
cmd_mics_client_aics_input_mute, 2, 0),
|
cmd_micp_client_aics_input_mute, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_manual_input_gain_set, NULL,
|
SHELL_CMD_ARG(aics_manual_input_gain_set, NULL,
|
||||||
"Set the gain mode of a AICS instance to manual "
|
"Set the gain mode of a AICS instance to manual "
|
||||||
"<inst_index>",
|
"<inst_index>",
|
||||||
cmd_mics_client_aics_manual_input_gain_set, 2, 0),
|
cmd_micp_client_aics_manual_input_gain_set, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_automatic_input_gain_set, NULL,
|
SHELL_CMD_ARG(aics_automatic_input_gain_set, NULL,
|
||||||
"Set the gain mode of a AICS instance to automatic "
|
"Set the gain mode of a AICS instance to automatic "
|
||||||
"<inst_index>",
|
"<inst_index>",
|
||||||
cmd_mics_client_aics_automatic_input_gain_set, 2, 0),
|
cmd_micp_client_aics_automatic_input_gain_set, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_gain_set, NULL,
|
SHELL_CMD_ARG(aics_gain_set, NULL,
|
||||||
"Set the gain of a AICS instance <inst_index> <gain>",
|
"Set the gain of a AICS instance <inst_index> <gain>",
|
||||||
cmd_mics_client_aics_gain_set, 3, 0),
|
cmd_micp_client_aics_gain_set, 3, 0),
|
||||||
SHELL_CMD_ARG(aics_input_description_get, NULL,
|
SHELL_CMD_ARG(aics_input_description_get, NULL,
|
||||||
"Read the input description of a AICS instance "
|
"Read the input description of a AICS instance "
|
||||||
"<inst_index>",
|
"<inst_index>",
|
||||||
cmd_mics_client_aics_input_description_get, 2, 0),
|
cmd_micp_client_aics_input_description_get, 2, 0),
|
||||||
SHELL_CMD_ARG(aics_input_description_set, NULL,
|
SHELL_CMD_ARG(aics_input_description_set, NULL,
|
||||||
"Set the input description of a AICS instance "
|
"Set the input description of a AICS instance "
|
||||||
"<inst_index> <description>",
|
"<inst_index> <description>",
|
||||||
cmd_mics_client_aics_input_description_set, 3, 0),
|
cmd_micp_client_aics_input_description_set, 3, 0),
|
||||||
SHELL_SUBCMD_SET_END
|
SHELL_SUBCMD_SET_END
|
||||||
);
|
);
|
||||||
|
|
||||||
SHELL_CMD_ARG_REGISTER(mics_client, &mics_client_cmds,
|
SHELL_CMD_ARG_REGISTER(micp_client, &micp_client_cmds,
|
||||||
"Bluetooth MICS client shell commands",
|
"Bluetooth MICP client shell commands",
|
||||||
cmd_mics_client, 1, 1);
|
cmd_micp_client, 1, 1);
|
||||||
|
|
|
@ -47,10 +47,10 @@ CONFIG_BT_VCS_CLIENT=y
|
||||||
CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST=2
|
CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST=2
|
||||||
CONFIG_BT_VCS_CLIENT_MAX_AICS_INST=2
|
CONFIG_BT_VCS_CLIENT_MAX_AICS_INST=2
|
||||||
|
|
||||||
CONFIG_BT_MICS=y
|
CONFIG_BT_MICP=y
|
||||||
CONFIG_BT_MICS_AICS_INSTANCE_COUNT=2
|
CONFIG_BT_MICP_AICS_INSTANCE_COUNT=2
|
||||||
CONFIG_BT_MICS_CLIENT=y
|
CONFIG_BT_MICP_CLIENT=y
|
||||||
CONFIG_BT_MICS_CLIENT_MAX_AICS_INST=2
|
CONFIG_BT_MICP_CLIENT_MAX_AICS_INST=2
|
||||||
|
|
||||||
# Coordinated Set Identification
|
# Coordinated Set Identification
|
||||||
CONFIG_BT_CSIS=y
|
CONFIG_BT_CSIS=y
|
||||||
|
@ -108,8 +108,8 @@ CONFIG_BT_DEBUG_AICS=y
|
||||||
CONFIG_BT_DEBUG_AICS_CLIENT=y
|
CONFIG_BT_DEBUG_AICS_CLIENT=y
|
||||||
CONFIG_BT_DEBUG_VOCS=y
|
CONFIG_BT_DEBUG_VOCS=y
|
||||||
CONFIG_BT_DEBUG_VOCS_CLIENT=y
|
CONFIG_BT_DEBUG_VOCS_CLIENT=y
|
||||||
CONFIG_BT_DEBUG_MICS=y
|
CONFIG_BT_DEBUG_MICP=y
|
||||||
CONFIG_BT_DEBUG_MICS_CLIENT=y
|
CONFIG_BT_DEBUG_MICP_CLIENT=y
|
||||||
CONFIG_BT_DEBUG_MPL=y
|
CONFIG_BT_DEBUG_MPL=y
|
||||||
CONFIG_BT_DEBUG_TBS=y
|
CONFIG_BT_DEBUG_TBS=y
|
||||||
CONFIG_BT_DEBUG_TBS_CLIENT=y
|
CONFIG_BT_DEBUG_TBS_CLIENT=y
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
extern struct bst_test_list *test_vcs_install(struct bst_test_list *tests);
|
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_vcs_client_install(struct bst_test_list *tests);
|
||||||
extern struct bst_test_list *test_mics_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_mics_client_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_csis_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_csis_client_install(struct bst_test_list *tests);
|
||||||
extern struct bst_test_list *test_tbs_install(struct bst_test_list *tests);
|
extern struct bst_test_list *test_tbs_install(struct bst_test_list *tests);
|
||||||
|
@ -30,8 +30,8 @@ extern struct bst_test_list *test_has_client_install(struct bst_test_list *tests
|
||||||
bst_test_install_t test_installers[] = {
|
bst_test_install_t test_installers[] = {
|
||||||
test_vcs_install,
|
test_vcs_install,
|
||||||
test_vcs_client_install,
|
test_vcs_client_install,
|
||||||
test_mics_install,
|
test_micp_install,
|
||||||
test_mics_client_install,
|
test_micp_client_install,
|
||||||
test_csis_install,
|
test_csis_install,
|
||||||
test_csis_client_install,
|
test_csis_client_install,
|
||||||
test_tbs_install,
|
test_tbs_install,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021 Nordic Semiconductor ASA
|
* Copyright (c) 2021-2022 Nordic Semiconductor ASA
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_BT_MICS_CLIENT
|
#ifdef CONFIG_BT_MICP_CLIENT
|
||||||
|
|
||||||
#include <zephyr/bluetooth/bluetooth.h>
|
#include <zephyr/bluetooth/bluetooth.h>
|
||||||
#include <zephyr/bluetooth/audio/micp.h>
|
#include <zephyr/bluetooth/audio/micp.h>
|
||||||
|
@ -17,8 +17,8 @@
|
||||||
|
|
||||||
extern enum bst_result_t bst_result;
|
extern enum bst_result_t bst_result;
|
||||||
|
|
||||||
static struct bt_mics *mics;
|
static struct bt_micp *micp;
|
||||||
static struct bt_mics_included mics_included;
|
static struct bt_micp_included micp_included;
|
||||||
static volatile bool g_bt_init;
|
static volatile bool g_bt_init;
|
||||||
static volatile bool g_is_connected;
|
static volatile bool g_is_connected;
|
||||||
static volatile bool g_discovery_complete;
|
static volatile bool g_discovery_complete;
|
||||||
|
@ -121,10 +121,10 @@ static void aics_write_cb(struct bt_aics *inst, int err)
|
||||||
g_write_complete = true;
|
g_write_complete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_discover_cb(struct bt_mics *mics, int err, uint8_t aics_count)
|
static void micp_discover_cb(struct bt_micp *micp, int err, uint8_t aics_count)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("MICS could not be discovered (%d)\n", err);
|
FAIL("MICP could not be discovered (%d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,30 +132,30 @@ static void mics_discover_cb(struct bt_mics *mics, int err, uint8_t aics_count)
|
||||||
g_discovery_complete = true;
|
g_discovery_complete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_mute_write_cb(struct bt_mics *mics, int err)
|
static void micp_mute_write_cb(struct bt_micp *micp, int err)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("MICS mute write failed (%d)\n", err);
|
FAIL("MICP mute write failed (%d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_write_complete = true;
|
g_write_complete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_unmute_write_cb(struct bt_mics *mics, int err)
|
static void micp_unmute_write_cb(struct bt_micp *micp, int err)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("MICS unmute write failed (%d)\n", err);
|
FAIL("MICP unmute write failed (%d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_write_complete = true;
|
g_write_complete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mics_mute_cb(struct bt_mics *mics, int err, uint8_t mute)
|
static void micp_mute_cb(struct bt_micp *micp, int err, uint8_t mute)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("MICS mute read failed (%d)\n", err);
|
FAIL("MICP mute read failed (%d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,11 +163,11 @@ static void mics_mute_cb(struct bt_mics *mics, int err, uint8_t mute)
|
||||||
g_cb = true;
|
g_cb = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_mics_cb mics_cbs = {
|
static struct bt_micp_cb micp_cbs = {
|
||||||
.discover = mics_discover_cb,
|
.discover = micp_discover_cb,
|
||||||
.mute = mics_mute_cb,
|
.mute = micp_mute_cb,
|
||||||
.mute_write = mics_mute_write_cb,
|
.mute_write = micp_mute_write_cb,
|
||||||
.unmute_write = mics_unmute_write_cb,
|
.unmute_write = micp_unmute_write_cb,
|
||||||
.aics_cb = {
|
.aics_cb = {
|
||||||
.state = aics_state_cb,
|
.state = aics_state_cb,
|
||||||
.gain_setting = aics_gain_setting_cb,
|
.gain_setting = aics_gain_setting_cb,
|
||||||
|
@ -225,7 +225,7 @@ static int test_aics(void)
|
||||||
struct bt_conn *cached_conn;
|
struct bt_conn *cached_conn;
|
||||||
|
|
||||||
printk("Getting AICS client conn\n");
|
printk("Getting AICS client conn\n");
|
||||||
err = bt_aics_client_conn_get(mics_included.aics[0], &cached_conn);
|
err = bt_aics_client_conn_get(micp_included.aics[0], &cached_conn);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not get AICS client conn (err %d)\n", err);
|
FAIL("Could not get AICS client conn (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -237,7 +237,7 @@ static int test_aics(void)
|
||||||
|
|
||||||
printk("Getting AICS state\n");
|
printk("Getting AICS state\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
err = bt_mics_aics_state_get(mics, mics_included.aics[0]);
|
err = bt_micp_aics_state_get(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not get AICS state (err %d)\n", err);
|
FAIL("Could not get AICS state (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -247,7 +247,7 @@ static int test_aics(void)
|
||||||
|
|
||||||
printk("Getting AICS gain setting\n");
|
printk("Getting AICS gain setting\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
err = bt_mics_aics_gain_setting_get(mics, mics_included.aics[0]);
|
err = bt_micp_aics_gain_setting_get(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not get AICS gain setting (err %d)\n", err);
|
FAIL("Could not get AICS gain setting (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -258,7 +258,7 @@ static int test_aics(void)
|
||||||
printk("Getting AICS input type\n");
|
printk("Getting AICS input type\n");
|
||||||
expected_input_type = BT_AICS_INPUT_TYPE_DIGITAL;
|
expected_input_type = BT_AICS_INPUT_TYPE_DIGITAL;
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
err = bt_mics_aics_type_get(mics, mics_included.aics[0]);
|
err = bt_micp_aics_type_get(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not get AICS input type (err %d)\n", err);
|
FAIL("Could not get AICS input type (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -269,7 +269,7 @@ static int test_aics(void)
|
||||||
|
|
||||||
printk("Getting AICS status\n");
|
printk("Getting AICS status\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
err = bt_mics_aics_status_get(mics, mics_included.aics[0]);
|
err = bt_micp_aics_status_get(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not get AICS status (err %d)\n", err);
|
FAIL("Could not get AICS status (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -279,7 +279,7 @@ static int test_aics(void)
|
||||||
|
|
||||||
printk("Getting AICS description\n");
|
printk("Getting AICS description\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
err = bt_mics_aics_description_get(mics, mics_included.aics[0]);
|
err = bt_micp_aics_description_get(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not get AICS description (err %d)\n", err);
|
FAIL("Could not get AICS description (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -290,7 +290,7 @@ static int test_aics(void)
|
||||||
printk("Setting AICS mute\n");
|
printk("Setting AICS mute\n");
|
||||||
expected_input_mute = BT_AICS_STATE_MUTED;
|
expected_input_mute = BT_AICS_STATE_MUTED;
|
||||||
g_write_complete = g_cb = false;
|
g_write_complete = g_cb = false;
|
||||||
err = bt_mics_aics_mute(mics, mics_included.aics[0]);
|
err = bt_micp_aics_mute(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not set AICS mute (err %d)\n", err);
|
FAIL("Could not set AICS mute (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -302,7 +302,7 @@ static int test_aics(void)
|
||||||
printk("Setting AICS unmute\n");
|
printk("Setting AICS unmute\n");
|
||||||
expected_input_mute = BT_AICS_STATE_UNMUTED;
|
expected_input_mute = BT_AICS_STATE_UNMUTED;
|
||||||
g_write_complete = g_cb = false;
|
g_write_complete = g_cb = false;
|
||||||
err = bt_mics_aics_unmute(mics, mics_included.aics[0]);
|
err = bt_micp_aics_unmute(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not set AICS unmute (err %d)\n", err);
|
FAIL("Could not set AICS unmute (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -314,7 +314,7 @@ static int test_aics(void)
|
||||||
printk("Setting AICS auto mode\n");
|
printk("Setting AICS auto mode\n");
|
||||||
expected_mode = BT_AICS_MODE_AUTO;
|
expected_mode = BT_AICS_MODE_AUTO;
|
||||||
g_write_complete = g_cb = false;
|
g_write_complete = g_cb = false;
|
||||||
err = bt_mics_aics_automatic_gain_set(mics, mics_included.aics[0]);
|
err = bt_micp_aics_automatic_gain_set(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not set AICS auto mode (err %d)\n", err);
|
FAIL("Could not set AICS auto mode (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -325,7 +325,7 @@ static int test_aics(void)
|
||||||
printk("Setting AICS manual mode\n");
|
printk("Setting AICS manual mode\n");
|
||||||
expected_mode = BT_AICS_MODE_MANUAL;
|
expected_mode = BT_AICS_MODE_MANUAL;
|
||||||
g_write_complete = g_cb = false;
|
g_write_complete = g_cb = false;
|
||||||
err = bt_mics_aics_manual_gain_set(mics, mics_included.aics[0]);
|
err = bt_micp_aics_manual_gain_set(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not set AICS manual mode (err %d)\n", err);
|
FAIL("Could not set AICS manual mode (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -336,7 +336,7 @@ static int test_aics(void)
|
||||||
printk("Setting AICS gain\n");
|
printk("Setting AICS gain\n");
|
||||||
expected_gain = g_aics_gain_max - 1;
|
expected_gain = g_aics_gain_max - 1;
|
||||||
g_write_complete = g_cb = false;
|
g_write_complete = g_cb = false;
|
||||||
err = bt_mics_aics_gain_set(mics, mics_included.aics[0], expected_gain);
|
err = bt_micp_aics_gain_set(micp, micp_included.aics[0], expected_gain);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not set AICS gain (err %d)\n", err);
|
FAIL("Could not set AICS gain (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -349,7 +349,7 @@ static int test_aics(void)
|
||||||
sizeof(expected_aics_desc));
|
sizeof(expected_aics_desc));
|
||||||
expected_aics_desc[sizeof(expected_aics_desc) - 1] = '\0';
|
expected_aics_desc[sizeof(expected_aics_desc) - 1] = '\0';
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
err = bt_mics_aics_description_set(mics, mics_included.aics[0],
|
err = bt_micp_aics_description_set(micp, micp_included.aics[0],
|
||||||
expected_aics_desc);
|
expected_aics_desc);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not set AICS Description (err %d)\n", err);
|
FAIL("Could not set AICS Description (err %d)\n", err);
|
||||||
|
@ -376,7 +376,7 @@ static void test_main(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_mics_client_cb_register(&mics_cbs);
|
bt_micp_client_cb_register(&micp_cbs);
|
||||||
|
|
||||||
WAIT_FOR_COND(g_bt_init);
|
WAIT_FOR_COND(g_bt_init);
|
||||||
|
|
||||||
|
@ -388,22 +388,22 @@ static void test_main(void)
|
||||||
printk("Scanning successfully started\n");
|
printk("Scanning successfully started\n");
|
||||||
WAIT_FOR_COND(g_is_connected);
|
WAIT_FOR_COND(g_is_connected);
|
||||||
|
|
||||||
err = bt_mics_discover(default_conn, &mics);
|
err = bt_micp_discover(default_conn, &micp);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Failed to discover MICS %d", err);
|
FAIL("Failed to discover MICP %d", err);
|
||||||
}
|
}
|
||||||
WAIT_FOR_COND(g_discovery_complete);
|
WAIT_FOR_COND(g_discovery_complete);
|
||||||
|
|
||||||
err = bt_mics_included_get(mics, &mics_included);
|
err = bt_micp_included_get(micp, &micp_included);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Failed to get MICS context (err %d)\n", err);
|
FAIL("Failed to get MICP context (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("Getting MICS client conn\n");
|
printk("Getting MICP client conn\n");
|
||||||
err = bt_mics_client_conn_get(mics, &cached_conn);
|
err = bt_micp_client_conn_get(micp, &cached_conn);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Failed to get MICS client conn (err %d)\n", err);
|
FAIL("Failed to get MICP client conn (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (cached_conn != default_conn) {
|
if (cached_conn != default_conn) {
|
||||||
|
@ -411,50 +411,50 @@ static void test_main(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("Getting MICS mute state\n");
|
printk("Getting MICP mute state\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
err = bt_mics_mute_get(mics);
|
err = bt_micp_mute_get(micp);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not get MICS mute state (err %d)\n", err);
|
FAIL("Could not get MICP mute state (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WAIT_FOR_COND(g_cb);
|
WAIT_FOR_COND(g_cb);
|
||||||
printk("MICS mute state received\n");
|
printk("MICP mute state received\n");
|
||||||
|
|
||||||
printk("Muting MICS\n");
|
printk("Muting MICP\n");
|
||||||
expected_mute = 1;
|
expected_mute = 1;
|
||||||
g_write_complete = g_cb = false;
|
g_write_complete = g_cb = false;
|
||||||
err = bt_mics_mute(mics);
|
err = bt_micp_mute(micp);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not mute MICS (err %d)\n", err);
|
FAIL("Could not mute MICP (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WAIT_FOR_COND(g_mute == expected_mute && g_cb && g_write_complete);
|
WAIT_FOR_COND(g_mute == expected_mute && g_cb && g_write_complete);
|
||||||
printk("MICS muted\n");
|
printk("MICP muted\n");
|
||||||
|
|
||||||
printk("Unmuting MICS\n");
|
printk("Unmuting MICP\n");
|
||||||
expected_mute = 0;
|
expected_mute = 0;
|
||||||
g_write_complete = g_cb = false;
|
g_write_complete = g_cb = false;
|
||||||
err = bt_mics_unmute(mics);
|
err = bt_micp_unmute(micp);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not unmute MICS (err %d)\n", err);
|
FAIL("Could not unmute MICP (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WAIT_FOR_COND(g_mute == expected_mute && g_cb && g_write_complete);
|
WAIT_FOR_COND(g_mute == expected_mute && g_cb && g_write_complete);
|
||||||
printk("MICS unmuted\n");
|
printk("MICP unmuted\n");
|
||||||
|
|
||||||
if (CONFIG_BT_MICS_CLIENT_MAX_AICS_INST > 0 && g_aics_count > 0) {
|
if (CONFIG_BT_MICP_CLIENT_MAX_AICS_INST > 0 && g_aics_count > 0) {
|
||||||
if (test_aics()) {
|
if (test_aics()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PASS("MICS client Passed\n");
|
PASS("MICP client Passed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct bst_test_instance test_mics[] = {
|
static const struct bst_test_instance test_micp[] = {
|
||||||
{
|
{
|
||||||
.test_id = "mics_client",
|
.test_id = "micp_client",
|
||||||
.test_post_init_f = test_init,
|
.test_post_init_f = test_init,
|
||||||
.test_tick_f = test_tick,
|
.test_tick_f = test_tick,
|
||||||
.test_main_f = test_main
|
.test_main_f = test_main
|
||||||
|
@ -462,16 +462,16 @@ static const struct bst_test_instance test_mics[] = {
|
||||||
BSTEST_END_MARKER
|
BSTEST_END_MARKER
|
||||||
};
|
};
|
||||||
|
|
||||||
struct bst_test_list *test_mics_client_install(struct bst_test_list *tests)
|
struct bst_test_list *test_micp_client_install(struct bst_test_list *tests)
|
||||||
{
|
{
|
||||||
return bst_add_tests(tests, test_mics);
|
return bst_add_tests(tests, test_micp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
struct bst_test_list *test_mics_client_install(struct bst_test_list *tests)
|
struct bst_test_list *test_micp_client_install(struct bst_test_list *tests)
|
||||||
{
|
{
|
||||||
return tests;
|
return tests;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_BT_MICS_CLIENT */
|
#endif /* CONFIG_BT_MICP_CLIENT */
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Nordic Semiconductor ASA
|
* Copyright (c) 2020-2022 Nordic Semiconductor ASA
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_BT_MICS
|
#ifdef CONFIG_BT_MICP
|
||||||
#include <zephyr/bluetooth/audio/micp.h>
|
#include <zephyr/bluetooth/audio/micp.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ extern enum bst_result_t bst_result;
|
||||||
#define AICS_DESC_SIZE 0
|
#define AICS_DESC_SIZE 0
|
||||||
#endif /* CONFIG_BT_AICS */
|
#endif /* CONFIG_BT_AICS */
|
||||||
|
|
||||||
static struct bt_mics *mics;
|
static struct bt_micp *micp;
|
||||||
static struct bt_mics_included mics_included;
|
static struct bt_micp_included micp_included;
|
||||||
|
|
||||||
static volatile uint8_t g_mute;
|
static volatile uint8_t g_mute;
|
||||||
static volatile int8_t g_aics_gain;
|
static volatile int8_t g_aics_gain;
|
||||||
|
@ -32,10 +32,10 @@ static char g_aics_desc[AICS_DESC_SIZE];
|
||||||
static volatile bool g_cb;
|
static volatile bool g_cb;
|
||||||
static bool g_is_connected;
|
static bool g_is_connected;
|
||||||
|
|
||||||
static void mics_mute_cb(struct bt_mics *mics, int err, uint8_t mute)
|
static void micp_mute_cb(struct bt_micp *micp, int err, uint8_t mute)
|
||||||
{
|
{
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("MICS mute cb err (%d)", err);
|
FAIL("MICP mute cb err (%d)", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,8 +108,8 @@ static void aics_description_cb(struct bt_aics *inst, int err,
|
||||||
g_cb = true;
|
g_cb = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_mics_cb mics_cb = {
|
static struct bt_micp_cb micp_cb = {
|
||||||
.mute = mics_mute_cb,
|
.mute = micp_mute_cb,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct bt_aics_cb aics_cb = {
|
static struct bt_aics_cb aics_cb = {
|
||||||
|
@ -153,7 +153,7 @@ static int test_aics_server_only(void)
|
||||||
|
|
||||||
printk("Deactivating AICS\n");
|
printk("Deactivating AICS\n");
|
||||||
expected_aics_active = false;
|
expected_aics_active = false;
|
||||||
err = bt_mics_aics_deactivate(mics, mics_included.aics[0]);
|
err = bt_micp_aics_deactivate(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not deactivate AICS (err %d)\n", err);
|
FAIL("Could not deactivate AICS (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -163,7 +163,7 @@ static int test_aics_server_only(void)
|
||||||
|
|
||||||
printk("Activating AICS\n");
|
printk("Activating AICS\n");
|
||||||
expected_aics_active = true;
|
expected_aics_active = true;
|
||||||
err = bt_mics_aics_activate(mics, mics_included.aics[0]);
|
err = bt_micp_aics_activate(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not activate AICS (err %d)\n", err);
|
FAIL("Could not activate AICS (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -173,7 +173,7 @@ static int test_aics_server_only(void)
|
||||||
|
|
||||||
printk("Getting AICS state\n");
|
printk("Getting AICS state\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
err = bt_mics_aics_state_get(mics, mics_included.aics[0]);
|
err = bt_micp_aics_state_get(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not get AICS state (err %d)\n", err);
|
FAIL("Could not get AICS state (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -183,7 +183,7 @@ static int test_aics_server_only(void)
|
||||||
|
|
||||||
printk("Getting AICS gain setting\n");
|
printk("Getting AICS gain setting\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
err = bt_mics_aics_gain_setting_get(mics, mics_included.aics[0]);
|
err = bt_micp_aics_gain_setting_get(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not get AICS gain setting (err %d)\n", err);
|
FAIL("Could not get AICS gain setting (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -194,7 +194,7 @@ static int test_aics_server_only(void)
|
||||||
printk("Getting AICS input type\n");
|
printk("Getting AICS input type\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
expected_input_type = BT_AICS_INPUT_TYPE_DIGITAL;
|
expected_input_type = BT_AICS_INPUT_TYPE_DIGITAL;
|
||||||
err = bt_mics_aics_type_get(mics, mics_included.aics[0]);
|
err = bt_micp_aics_type_get(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not get AICS input type (err %d)\n", err);
|
FAIL("Could not get AICS input type (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -205,7 +205,7 @@ static int test_aics_server_only(void)
|
||||||
|
|
||||||
printk("Getting AICS status\n");
|
printk("Getting AICS status\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
err = bt_mics_aics_status_get(mics, mics_included.aics[0]);
|
err = bt_micp_aics_status_get(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not get AICS status (err %d)\n", err);
|
FAIL("Could not get AICS status (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -215,7 +215,7 @@ static int test_aics_server_only(void)
|
||||||
|
|
||||||
printk("Getting AICS description\n");
|
printk("Getting AICS description\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
err = bt_mics_aics_description_get(mics, mics_included.aics[0]);
|
err = bt_micp_aics_description_get(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not get AICS description (err %d)\n", err);
|
FAIL("Could not get AICS description (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -226,7 +226,7 @@ static int test_aics_server_only(void)
|
||||||
printk("Setting AICS mute\n");
|
printk("Setting AICS mute\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
expected_input_mute = BT_AICS_STATE_MUTED;
|
expected_input_mute = BT_AICS_STATE_MUTED;
|
||||||
err = bt_mics_aics_mute(mics, mics_included.aics[0]);
|
err = bt_micp_aics_mute(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not set AICS mute (err %d)\n", err);
|
FAIL("Could not set AICS mute (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -237,7 +237,7 @@ static int test_aics_server_only(void)
|
||||||
printk("Setting AICS unmute\n");
|
printk("Setting AICS unmute\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
expected_input_mute = BT_AICS_STATE_UNMUTED;
|
expected_input_mute = BT_AICS_STATE_UNMUTED;
|
||||||
err = bt_mics_aics_unmute(mics, mics_included.aics[0]);
|
err = bt_micp_aics_unmute(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not set AICS unmute (err %d)\n", err);
|
FAIL("Could not set AICS unmute (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -248,7 +248,7 @@ static int test_aics_server_only(void)
|
||||||
printk("Setting AICS auto mode\n");
|
printk("Setting AICS auto mode\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
expected_mode = BT_AICS_MODE_AUTO;
|
expected_mode = BT_AICS_MODE_AUTO;
|
||||||
err = bt_mics_aics_automatic_gain_set(mics, mics_included.aics[0]);
|
err = bt_micp_aics_automatic_gain_set(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not set AICS auto mode (err %d)\n", err);
|
FAIL("Could not set AICS auto mode (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -259,7 +259,7 @@ static int test_aics_server_only(void)
|
||||||
printk("Setting AICS manual mode\n");
|
printk("Setting AICS manual mode\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
expected_mode = BT_AICS_MODE_MANUAL;
|
expected_mode = BT_AICS_MODE_MANUAL;
|
||||||
err = bt_mics_aics_manual_gain_set(mics, mics_included.aics[0]);
|
err = bt_micp_aics_manual_gain_set(micp, micp_included.aics[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not set AICS manual mode (err %d)\n", err);
|
FAIL("Could not set AICS manual mode (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -270,7 +270,7 @@ static int test_aics_server_only(void)
|
||||||
printk("Setting AICS gain\n");
|
printk("Setting AICS gain\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
expected_gain = g_aics_gain_max - 1;
|
expected_gain = g_aics_gain_max - 1;
|
||||||
err = bt_mics_aics_gain_set(mics, mics_included.aics[0], expected_gain);
|
err = bt_micp_aics_gain_set(micp, micp_included.aics[0], expected_gain);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not set AICS gain (err %d)\n", err);
|
FAIL("Could not set AICS gain (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -283,7 +283,7 @@ static int test_aics_server_only(void)
|
||||||
strncpy(expected_aics_desc, "New Input Description",
|
strncpy(expected_aics_desc, "New Input Description",
|
||||||
sizeof(expected_aics_desc));
|
sizeof(expected_aics_desc));
|
||||||
expected_aics_desc[sizeof(expected_aics_desc) - 1] = '\0';
|
expected_aics_desc[sizeof(expected_aics_desc) - 1] = '\0';
|
||||||
err = bt_mics_aics_description_set(mics, mics_included.aics[0], expected_aics_desc);
|
err = bt_micp_aics_description_set(micp, micp_included.aics[0], expected_aics_desc);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not set AICS Description (err %d)\n", err);
|
FAIL("Could not set AICS Description (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -298,8 +298,8 @@ static int test_aics_server_only(void)
|
||||||
static void test_server_only(void)
|
static void test_server_only(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct bt_mics_register_param mics_param;
|
struct bt_micp_register_param micp_param;
|
||||||
char input_desc[CONFIG_BT_MICS_AICS_INSTANCE_COUNT][16];
|
char input_desc[CONFIG_BT_MICP_AICS_INSTANCE_COUNT][16];
|
||||||
uint8_t expected_mute;
|
uint8_t expected_mute;
|
||||||
|
|
||||||
err = bt_enable(NULL);
|
err = bt_enable(NULL);
|
||||||
|
@ -310,90 +310,90 @@ static void test_server_only(void)
|
||||||
|
|
||||||
printk("Bluetooth initialized\n");
|
printk("Bluetooth initialized\n");
|
||||||
|
|
||||||
(void)memset(&mics_param, 0, sizeof(mics_param));
|
(void)memset(&micp_param, 0, sizeof(micp_param));
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_SIZE(mics_param.aics_param); i++) {
|
for (int i = 0; i < ARRAY_SIZE(micp_param.aics_param); i++) {
|
||||||
mics_param.aics_param[i].desc_writable = true;
|
micp_param.aics_param[i].desc_writable = true;
|
||||||
snprintf(input_desc[i], sizeof(input_desc[i]), "Input %d", i + 1);
|
snprintf(input_desc[i], sizeof(input_desc[i]), "Input %d", i + 1);
|
||||||
mics_param.aics_param[i].description = input_desc[i];
|
micp_param.aics_param[i].description = input_desc[i];
|
||||||
mics_param.aics_param[i].type = BT_AICS_INPUT_TYPE_DIGITAL;
|
micp_param.aics_param[i].type = BT_AICS_INPUT_TYPE_DIGITAL;
|
||||||
mics_param.aics_param[i].status = g_aics_active;
|
micp_param.aics_param[i].status = g_aics_active;
|
||||||
mics_param.aics_param[i].gain_mode = BT_AICS_MODE_MANUAL;
|
micp_param.aics_param[i].gain_mode = BT_AICS_MODE_MANUAL;
|
||||||
mics_param.aics_param[i].units = 1;
|
micp_param.aics_param[i].units = 1;
|
||||||
mics_param.aics_param[i].min_gain = 0;
|
micp_param.aics_param[i].min_gain = 0;
|
||||||
mics_param.aics_param[i].max_gain = 100;
|
micp_param.aics_param[i].max_gain = 100;
|
||||||
mics_param.aics_param[i].cb = &aics_cb;
|
micp_param.aics_param[i].cb = &aics_cb;
|
||||||
}
|
}
|
||||||
mics_param.cb = &mics_cb;
|
micp_param.cb = &micp_cb;
|
||||||
|
|
||||||
err = bt_mics_register(&mics_param, &mics);
|
err = bt_micp_register(&micp_param, &micp);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("MICS init failed (err %d)\n", err);
|
FAIL("MICP init failed (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = bt_mics_included_get(mics, &mics_included);
|
err = bt_micp_included_get(micp, &micp_included);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("MICS get failed (err %d)\n", err);
|
FAIL("MICP get failed (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("MICS initialized\n");
|
printk("MICP initialized\n");
|
||||||
|
|
||||||
printk("Getting MICS mute\n");
|
printk("Getting MICP mute\n");
|
||||||
g_cb = false;
|
g_cb = false;
|
||||||
err = bt_mics_mute_get(mics);
|
err = bt_micp_mute_get(micp);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("Could not get MICS mute (err %d)\n", err);
|
FAIL("Could not get MICP mute (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WAIT_FOR_COND(g_cb);
|
WAIT_FOR_COND(g_cb);
|
||||||
printk("MICS mute get\n");
|
printk("MICP mute get\n");
|
||||||
|
|
||||||
printk("Setting MICS mute\n");
|
printk("Setting MICP mute\n");
|
||||||
expected_mute = BT_MICS_MUTE_MUTED;
|
expected_mute = BT_MICP_MUTE_MUTED;
|
||||||
err = bt_mics_mute(mics);
|
err = bt_micp_mute(micp);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("MICS mute failed (err %d)\n", err);
|
FAIL("MICP mute failed (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WAIT_FOR_COND(expected_mute == g_mute);
|
WAIT_FOR_COND(expected_mute == g_mute);
|
||||||
printk("MICS mute set\n");
|
printk("MICP mute set\n");
|
||||||
|
|
||||||
printk("Setting MICS unmute\n");
|
printk("Setting MICP unmute\n");
|
||||||
expected_mute = BT_MICS_MUTE_UNMUTED;
|
expected_mute = BT_MICP_MUTE_UNMUTED;
|
||||||
err = bt_mics_unmute(mics);
|
err = bt_micp_unmute(micp);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("MICS unmute failed (err %d)\n", err);
|
FAIL("MICP unmute failed (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WAIT_FOR_COND(expected_mute == g_mute);
|
WAIT_FOR_COND(expected_mute == g_mute);
|
||||||
printk("MICS unmute set\n");
|
printk("MICP unmute set\n");
|
||||||
|
|
||||||
printk("Setting MICS disable\n");
|
printk("Setting MICP disable\n");
|
||||||
expected_mute = BT_MICS_MUTE_DISABLED;
|
expected_mute = BT_MICP_MUTE_DISABLED;
|
||||||
err = bt_mics_mute_disable(mics);
|
err = bt_micp_mute_disable(micp);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("MICS disable failed (err %d)\n", err);
|
FAIL("MICP disable failed (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WAIT_FOR_COND(expected_mute == g_mute);
|
WAIT_FOR_COND(expected_mute == g_mute);
|
||||||
printk("MICS disable set\n");
|
printk("MICP disable set\n");
|
||||||
|
|
||||||
if (CONFIG_BT_MICS_AICS_INSTANCE_COUNT > 0) {
|
if (CONFIG_BT_MICP_AICS_INSTANCE_COUNT > 0) {
|
||||||
if (test_aics_server_only()) {
|
if (test_aics_server_only()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PASS("MICS passed\n");
|
PASS("MICP passed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_main(void)
|
static void test_main(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct bt_mics_register_param mics_param;
|
struct bt_micp_register_param micp_param;
|
||||||
char input_desc[CONFIG_BT_MICS_AICS_INSTANCE_COUNT][16];
|
char input_desc[CONFIG_BT_MICP_AICS_INSTANCE_COUNT][16];
|
||||||
|
|
||||||
err = bt_enable(NULL);
|
err = bt_enable(NULL);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
|
@ -403,36 +403,36 @@ static void test_main(void)
|
||||||
|
|
||||||
printk("Bluetooth initialized\n");
|
printk("Bluetooth initialized\n");
|
||||||
|
|
||||||
(void)memset(&mics_param, 0, sizeof(mics_param));
|
(void)memset(&micp_param, 0, sizeof(micp_param));
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_SIZE(mics_param.aics_param); i++) {
|
for (int i = 0; i < ARRAY_SIZE(micp_param.aics_param); i++) {
|
||||||
mics_param.aics_param[i].desc_writable = true;
|
micp_param.aics_param[i].desc_writable = true;
|
||||||
snprintf(input_desc[i], sizeof(input_desc[i]),
|
snprintf(input_desc[i], sizeof(input_desc[i]),
|
||||||
"Input %d", i + 1);
|
"Input %d", i + 1);
|
||||||
mics_param.aics_param[i].description = input_desc[i];
|
micp_param.aics_param[i].description = input_desc[i];
|
||||||
mics_param.aics_param[i].type = BT_AICS_INPUT_TYPE_UNSPECIFIED;
|
micp_param.aics_param[i].type = BT_AICS_INPUT_TYPE_UNSPECIFIED;
|
||||||
mics_param.aics_param[i].status = g_aics_active;
|
micp_param.aics_param[i].status = g_aics_active;
|
||||||
mics_param.aics_param[i].gain_mode = BT_AICS_MODE_MANUAL;
|
micp_param.aics_param[i].gain_mode = BT_AICS_MODE_MANUAL;
|
||||||
mics_param.aics_param[i].units = 1;
|
micp_param.aics_param[i].units = 1;
|
||||||
mics_param.aics_param[i].min_gain = 0;
|
micp_param.aics_param[i].min_gain = 0;
|
||||||
mics_param.aics_param[i].max_gain = 100;
|
micp_param.aics_param[i].max_gain = 100;
|
||||||
mics_param.aics_param[i].cb = &aics_cb;
|
micp_param.aics_param[i].cb = &aics_cb;
|
||||||
}
|
}
|
||||||
mics_param.cb = &mics_cb;
|
micp_param.cb = &micp_cb;
|
||||||
|
|
||||||
err = bt_mics_register(&mics_param, &mics);
|
err = bt_micp_register(&micp_param, &micp);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("MICS init failed (err %d)\n", err);
|
FAIL("MICP init failed (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = bt_mics_included_get(mics, &mics_included);
|
err = bt_micp_included_get(micp, &micp_included);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("MICS get failed (err %d)\n", err);
|
FAIL("MICP get failed (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("MICS initialized\n");
|
printk("MICP initialized\n");
|
||||||
|
|
||||||
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, AD_SIZE, NULL, 0);
|
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, AD_SIZE, NULL, 0);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
|
@ -444,18 +444,18 @@ static void test_main(void)
|
||||||
|
|
||||||
WAIT_FOR_COND(g_is_connected);
|
WAIT_FOR_COND(g_is_connected);
|
||||||
|
|
||||||
PASS("MICS passed\n");
|
PASS("MICP passed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct bst_test_instance test_mics[] = {
|
static const struct bst_test_instance test_micp[] = {
|
||||||
{
|
{
|
||||||
.test_id = "mics_server_only",
|
.test_id = "micp_server_only",
|
||||||
.test_post_init_f = test_init,
|
.test_post_init_f = test_init,
|
||||||
.test_tick_f = test_tick,
|
.test_tick_f = test_tick,
|
||||||
.test_main_f = test_server_only
|
.test_main_f = test_server_only
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.test_id = "mics",
|
.test_id = "micp",
|
||||||
.test_post_init_f = test_init,
|
.test_post_init_f = test_init,
|
||||||
.test_tick_f = test_tick,
|
.test_tick_f = test_tick,
|
||||||
.test_main_f = test_main
|
.test_main_f = test_main
|
||||||
|
@ -463,14 +463,14 @@ static const struct bst_test_instance test_mics[] = {
|
||||||
BSTEST_END_MARKER
|
BSTEST_END_MARKER
|
||||||
};
|
};
|
||||||
|
|
||||||
struct bst_test_list *test_mics_install(struct bst_test_list *tests)
|
struct bst_test_list *test_micp_install(struct bst_test_list *tests)
|
||||||
{
|
{
|
||||||
return bst_add_tests(tests, test_mics);
|
return bst_add_tests(tests, test_micp);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
struct bst_test_list *test_mics_install(struct bst_test_list *tests)
|
struct bst_test_list *test_micp_install(struct bst_test_list *tests)
|
||||||
{
|
{
|
||||||
return tests;
|
return tests;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_BT_MICS */
|
#endif /* CONFIG_BT_MICP */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
SIMULATION_ID="mics"
|
SIMULATION_ID="micp"
|
||||||
VERBOSITY_LEVEL=2
|
VERBOSITY_LEVEL=2
|
||||||
PROCESS_IDS=""; EXIT_CODE=0
|
PROCESS_IDS=""; EXIT_CODE=0
|
||||||
|
|
||||||
|
@ -24,10 +24,10 @@ BOARD="${BOARD:-nrf52_bsim}"
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
printf "\n\n======== Running MICS Server Only (API) test =========\n\n"
|
printf "\n\n======== Running MICP Server Only (API) test =========\n\n"
|
||||||
|
|
||||||
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
|
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
|
||||||
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=mics_server_only -rs=23
|
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=micp_server_only -rs=23
|
||||||
|
|
||||||
# Simulation time should be larger than the WAIT_TIME in common.h
|
# Simulation time should be larger than the WAIT_TIME in common.h
|
||||||
Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} \
|
Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} \
|
||||||
|
@ -37,13 +37,13 @@ for PROCESS_ID in $PROCESS_IDS; do
|
||||||
wait $PROCESS_ID || let "EXIT_CODE=$?"
|
wait $PROCESS_ID || let "EXIT_CODE=$?"
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "\n\n======== Running MICS and MICS client test =========\n\n"
|
printf "\n\n======== Running MICP and MICP client test =========\n\n"
|
||||||
|
|
||||||
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
|
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
|
||||||
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=mics -rs=23
|
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=micp -rs=23
|
||||||
|
|
||||||
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
|
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
|
||||||
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=mics_client -rs=46
|
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=micp_client -rs=46
|
||||||
|
|
||||||
# Simulation time should be larger than the WAIT_TIME in common.h
|
# Simulation time should be larger than the WAIT_TIME in common.h
|
||||||
Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} \
|
Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} \
|
||||||
|
|
|
@ -54,10 +54,10 @@ CONFIG_BT_VCS_CLIENT=y
|
||||||
CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST=1
|
CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST=1
|
||||||
CONFIG_BT_VCS_CLIENT_MAX_AICS_INST=1
|
CONFIG_BT_VCS_CLIENT_MAX_AICS_INST=1
|
||||||
|
|
||||||
CONFIG_BT_MICS=y
|
CONFIG_BT_MICP=y
|
||||||
CONFIG_BT_MICS_AICS_INSTANCE_COUNT=1
|
CONFIG_BT_MICP_AICS_INSTANCE_COUNT=1
|
||||||
CONFIG_BT_MICS_CLIENT=y
|
CONFIG_BT_MICP_CLIENT=y
|
||||||
CONFIG_BT_MICS_CLIENT_MAX_AICS_INST=1
|
CONFIG_BT_MICP_CLIENT_MAX_AICS_INST=1
|
||||||
|
|
||||||
# Coordinated Set Identification
|
# Coordinated Set Identification
|
||||||
CONFIG_BT_CSIS=y
|
CONFIG_BT_CSIS=y
|
||||||
|
|
|
@ -58,7 +58,7 @@ tests:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_BT_AICS_MAX_INSTANCE_COUNT=0
|
- CONFIG_BT_AICS_MAX_INSTANCE_COUNT=0
|
||||||
- CONFIG_BT_VCS_AICS_INSTANCE_COUNT=0
|
- CONFIG_BT_VCS_AICS_INSTANCE_COUNT=0
|
||||||
- CONFIG_BT_MICS_AICS_INSTANCE_COUNT=0
|
- CONFIG_BT_MICP_AICS_INSTANCE_COUNT=0
|
||||||
tags: bluetooth
|
tags: bluetooth
|
||||||
bluetooth.shell.audio.no_aics_vocs:
|
bluetooth.shell.audio.no_aics_vocs:
|
||||||
extra_args: CONF_FILE="audio.conf"
|
extra_args: CONF_FILE="audio.conf"
|
||||||
|
@ -69,7 +69,7 @@ tests:
|
||||||
- CONFIG_BT_VCS_VOCS_INSTANCE_COUNT=0
|
- CONFIG_BT_VCS_VOCS_INSTANCE_COUNT=0
|
||||||
- CONFIG_BT_AICS_MAX_INSTANCE_COUNT=0
|
- CONFIG_BT_AICS_MAX_INSTANCE_COUNT=0
|
||||||
- CONFIG_BT_VCS_AICS_INSTANCE_COUNT=0
|
- CONFIG_BT_VCS_AICS_INSTANCE_COUNT=0
|
||||||
- CONFIG_BT_MICS_AICS_INSTANCE_COUNT=0
|
- CONFIG_BT_MICP_AICS_INSTANCE_COUNT=0
|
||||||
tags: bluetooth
|
tags: bluetooth
|
||||||
bluetooth.shell.audio.no_vcs_client:
|
bluetooth.shell.audio.no_vcs_client:
|
||||||
extra_args: CONF_FILE="audio.conf"
|
extra_args: CONF_FILE="audio.conf"
|
||||||
|
@ -100,34 +100,34 @@ tests:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST=0
|
- CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST=0
|
||||||
tags: bluetooth
|
tags: bluetooth
|
||||||
bluetooth.shell.audio.no_mics:
|
bluetooth.shell.audio.no_micp:
|
||||||
extra_args: CONF_FILE="audio.conf"
|
extra_args: CONF_FILE="audio.conf"
|
||||||
build_only: true
|
build_only: true
|
||||||
platform_allow: native_posix
|
platform_allow: native_posix
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_BT_MICS=n
|
- CONFIG_BT_MICP=n
|
||||||
tags: bluetooth
|
tags: bluetooth
|
||||||
bluetooth.shell.audio.no_mics_client:
|
bluetooth.shell.audio.no_micp_client:
|
||||||
extra_args: CONF_FILE="audio.conf"
|
extra_args: CONF_FILE="audio.conf"
|
||||||
build_only: true
|
build_only: true
|
||||||
platform_allow: native_posix
|
platform_allow: native_posix
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_BT_MICS_CLIENT=n
|
- CONFIG_BT_MICP_CLIENT=n
|
||||||
tags: bluetooth
|
tags: bluetooth
|
||||||
bluetooth.shell.audio.no_mics_mics_client:
|
bluetooth.shell.audio.no_micp_micp_client:
|
||||||
extra_args: CONF_FILE="audio.conf"
|
extra_args: CONF_FILE="audio.conf"
|
||||||
build_only: true
|
build_only: true
|
||||||
platform_allow: native_posix
|
platform_allow: native_posix
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_BT_MICS=n
|
- CONFIG_BT_MICP=n
|
||||||
- CONFIG_BT_MICS_CLIENT=n
|
- CONFIG_BT_MICP_CLIENT=n
|
||||||
tags: bluetooth
|
tags: bluetooth
|
||||||
bluetooth.shell.audio.mics_client_no_aics_client:
|
bluetooth.shell.audio.micp_client_no_aics_client:
|
||||||
extra_args: CONF_FILE="audio.conf"
|
extra_args: CONF_FILE="audio.conf"
|
||||||
build_only: true
|
build_only: true
|
||||||
platform_allow: native_posix
|
platform_allow: native_posix
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_BT_MICS_CLIENT_MAX_AICS_INST=0
|
- CONFIG_BT_MICP_CLIENT_MAX_AICS_INST=0
|
||||||
tags: bluetooth
|
tags: bluetooth
|
||||||
bluetooth.shell.audio.no_mcs:
|
bluetooth.shell.audio.no_mcs:
|
||||||
extra_args: CONF_FILE="audio.conf"
|
extra_args: CONF_FILE="audio.conf"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue