This is the documentation for the latest (main) development branch of Zephyr. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

Bluetooth Microphone Control

API Reference

group bt_gatt_micp

Microphone Control Profile (MICP)

[Experimental] Users should note that the APIs can change as a part of ongoing development.

Defines

BT_MICP_MIC_DEV_AICS_CNT
BT_MICP_ERR_MUTE_DISABLED

Application error codes.

BT_MICP_MUTE_UNMUTED

Microphone Control Profile mute states.

BT_MICP_MUTE_MUTED
BT_MICP_MUTE_DISABLED

Functions

int bt_micp_mic_dev_register(struct bt_micp_mic_dev_register_param *param)

Initialize the Microphone Control Profile Microphone Device.

This will enable the Microphone Control Service instance and make it discoverable by Microphone Controllers.

Parameters:
  • param – Pointer to an initialization structure.

Returns:

0 if success, errno on failure.

int bt_micp_mic_dev_included_get(struct bt_micp_included *included)

Get Microphone Device included services.

Returns a pointer to a struct that contains information about the Microphone Device included Audio Input Control Service instances.

Requires that CONFIG_BT_MICP_MIC_DEV_AICS is enabled.

Parameters:
  • included – Pointer to store the result in.

Returns:

0 if success, errno on failure.

int bt_micp_mic_dev_unmute(void)

Unmute the Microphone Device.

Returns:

0 on success, GATT error value on fail.

int bt_micp_mic_dev_mute(void)

Mute the Microphone Device.

Returns:

0 on success, GATT error value on fail.

int bt_micp_mic_dev_mute_disable(void)

Disable the mute functionality on the Microphone Device.

Can be reenabled by called bt_micp_mic_dev_mute or bt_micp_mic_dev_unmute.

Returns:

0 on success, GATT error value on fail.

int bt_micp_mic_dev_mute_get(void)

Read the mute state on the Microphone Device.

Returns:

0 on success, GATT error value on fail.

int bt_micp_mic_ctlr_included_get(struct bt_micp_mic_ctlr *mic_ctlr, struct bt_micp_included *included)

Get Microphone Control Profile included services.

Returns a pointer to a struct that contains information about the Microphone Control Profile included services instances, such as pointers to the Audio Input Control Service instances.

Requires that CONFIG_BT_MICP_MIC_CTLR_AICS is enabled.

Parameters:
  • mic_ctlr – Microphone Controller instance pointer.

  • included[out] Pointer to store the result in.

Returns:

0 if success, errno on failure.

int bt_micp_mic_ctlr_conn_get(const struct bt_micp_mic_ctlr *mic_ctlr, struct bt_conn **conn)

Get the connection pointer of a Microphone Controller instance.

Get the Bluetooth connection pointer of a Microphone Controller instance.

Parameters:
  • mic_ctlr – Microphone Controller instance pointer.

  • conn – Connection pointer.

Returns:

0 if success, errno on failure.

struct bt_micp_mic_ctlr *bt_micp_mic_ctlr_get_by_conn(const struct bt_conn *conn)

Get the volume controller from a connection pointer.

Get the Volume Control Profile Volume Controller pointer from a connection pointer. Only volume controllers that have been initiated via bt_micp_mic_ctlr_discover() can be retrieved.

Parameters:
  • conn – Connection pointer.

Return values:
  • Pointer – to a Microphone Control Profile Microphone Controller instance

  • NULL – if conn is NULL or if the connection has not done discovery yet

int bt_micp_mic_ctlr_discover(struct bt_conn *conn, struct bt_micp_mic_ctlr **mic_ctlr)

Discover Microphone Control Service.

This will start a GATT discovery and setup handles and subscriptions. This shall be called once before any other actions can be executed for the peer device, and the bt_micp_mic_ctlr_cb::discover callback will notify when it is possible to start remote operations.

Parameters:
  • conn – The connection to initialize the profile for.

  • mic_ctlr[out] Valid remote instance object on success.

Returns:

0 on success, GATT error value on fail.

int bt_micp_mic_ctlr_unmute(struct bt_micp_mic_ctlr *mic_ctlr)

Unmute a remote Microphone Device.

Parameters:
  • mic_ctlr – Microphone Controller instance pointer.

Returns:

0 on success, GATT error value on fail.

int bt_micp_mic_ctlr_mute(struct bt_micp_mic_ctlr *mic_ctlr)

Mute a remote Microphone Device.

Parameters:
  • mic_ctlr – Microphone Controller instance pointer.

Returns:

0 on success, GATT error value on fail.

int bt_micp_mic_ctlr_mute_get(struct bt_micp_mic_ctlr *mic_ctlr)

Read the mute state of a remote Microphone Device.

Parameters:
  • mic_ctlr – Microphone Controller instance pointer.

Returns:

0 on success, GATT error value on fail.

int bt_micp_mic_ctlr_cb_register(struct bt_micp_mic_ctlr_cb *cb)

Registers the callbacks used by Microphone Controller.

This can only be done as the client.

Parameters:
  • cb – The callback structure.

Returns:

0 if success, errno on failure.

struct bt_micp_mic_dev_register_param
#include <micp.h>

Register parameters structure for Microphone Control Service.

Public Members

struct bt_micp_mic_dev_cb *cb

Microphone Control Profile callback structure.

struct bt_micp_included
#include <micp.h>

Microphone Control Profile included services.

Used for to represent the Microphone Control Profile included service instances, for either a Microphone Controller or a Microphone Device. The instance pointers either represent local service instances, or remote service instances.

Public Members

uint8_t aics_cnt

Number of Audio Input Control Service instances.

struct bt_aics **aics

Array of pointers to Audio Input Control Service instances.

struct bt_micp_mic_dev_cb
#include <micp.h>

Public Members

void (*mute)(uint8_t mute)

Callback function for Microphone Device mute.

Called when the value is read with bt_micp_mic_dev_mute_get(), or if the value is changed by either the Microphone Device or a Microphone Controller.

Param mute:

The mute setting of the Microphone Control Service.

struct bt_micp_mic_ctlr_cb
#include <micp.h>

Public Members

void (*mute)(struct bt_micp_mic_ctlr *mic_ctlr, int err, uint8_t mute)

Callback function for Microphone Control Profile mute.

Called when the value is read, or if the value is changed by either the Microphone Device or a Microphone Controller.

Param mic_ctlr:

Microphone Controller instance pointer.

Param err:

Error value. 0 on success, GATT error or errno on fail. For notifications, this will always be 0.

Param mute:

The mute setting of the Microphone Control Service.

void (*discover)(struct bt_micp_mic_ctlr *mic_ctlr, int err, uint8_t aics_count)

Callback function for bt_micp_mic_ctlr_discover().

Param mic_ctlr:

Microphone Controller instance pointer.

Param err:

Error value. 0 on success, GATT error or errno on fail.

Param aics_count:

Number of Audio Input Control Service instances on peer device.

void (*mute_written)(struct bt_micp_mic_ctlr *mic_ctlr, int err)

Callback function for Microphone Control Profile mute/unmute.

Param mic_ctlr:

Microphone Controller instance pointer.

Param err:

Error value. 0 on success, GATT error or errno on fail.

void (*unmute_written)(struct bt_micp_mic_ctlr *mic_ctlr, int err)

Callback function for Microphone Control Profile mute/unmute.

Param mic_ctlr:

Microphone Controller instance pointer.

Param err:

Error value. 0 on success, GATT error or errno on fail.