If you need urgent consulting help click here

Bluetooth Microphone Control

API Reference

group bt_gatt_mics

Microphone Input Control Service (Microphone Input Control Service)

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

Defines

BT_MICS_AICS_CNT
BT_MICS_ERR_MUTE_DISABLED

Application error codes

BT_MICS_ERR_VAL_OUT_OF_RANGE
BT_MICS_MUTE_UNMUTED

Microphone Input Control Service mute states

BT_MICS_MUTE_MUTED
BT_MICS_MUTE_DISABLED

Typedefs

typedef void (*bt_mics_discover_cb)(struct bt_mics *mics, int err, uint8_t aics_count)

Callback function for bt_mics_discover.

This callback is only used for the client.

Param mics

Microphone Input Control Service instance pointer.

Param err

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

Param aics_count

Number of Audio Input Control Service instances on peer device.

typedef void (*bt_mics_mute_read_cb)(struct bt_mics *mics, int err, uint8_t mute)

Callback function for Microphone Input Control Service mute.

Called when the value is read, or if the value is changed by either the server or client.

Param mics

Microphone Input Control Service instance pointer.

Param err

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

Param mute

The mute setting of the Microphone Input Control Service.

typedef void (*bt_mics_mute_write_cb)(struct bt_mics *mics, int err)

Callback function for Microphone Input Control Service mute/unmute.

Param mics

Microphone Input Control Service instance pointer.

Param err

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

Functions

int bt_mics_register(struct bt_mics_register_param *param, struct bt_mics **mics)

Initialize the Microphone Input Control Service.

This will enable the service and make it discoverable by clients. This can only be done as the server.

Parameters
  • param – Pointer to an initialization structure.

  • mics[out] Pointer to the registered Microphone Input Control Service. This will still be valid if the return value is -EALREADY.

Returns

0 if success, errno on failure.

int bt_mics_included_get(struct bt_mics *mics, struct bt_mics_included *included)

Get Microphone Input Control Service included services.

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

Parameters
  • mics – Microphone Input Control Service instance pointer.

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

Returns

0 if success, errno on failure.

int bt_mics_client_conn_get(const struct bt_mics *mics, struct bt_conn **conn)

Get the connection pointer of a client instance.

Get the Bluetooth connection pointer of a Microphone Input Control Service client instance.

Parameters
  • mics – Microphone Input Control Service client instance pointer.

  • conn – Connection pointer.

Returns

0 if success, errno on failure.

int bt_mics_discover(struct bt_conn *conn, struct bt_mics **mics)

Discover Microphone Input 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_mics_discover_cb callback will notify when it is possible to start remote operations.

This shall only be done as the client.

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

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

Returns

0 on success, GATT error value on fail.

int bt_mics_unmute(struct bt_mics *mics)

Unmute the server.

Parameters
  • mics – Microphone Input Control Service instance pointer.

Returns

0 on success, GATT error value on fail.

int bt_mics_mute(struct bt_mics *mics)

Mute the server.

Parameters
  • mics – Microphone Input Control Service instance pointer.

Returns

0 on success, GATT error value on fail.

int bt_mics_mute_disable(struct bt_mics *mics)

Disable the mute functionality.

Can be reenabled by called bt_mics_mute or bt_mics_unmute. This can only be done as the server.

Parameters
  • mics – Microphone Input Control Service instance pointer.

Returns

0 on success, GATT error value on fail.

int bt_mics_mute_get(struct bt_mics *mics)

Read the mute state of a Microphone Input Control Service.

Parameters
  • mics – Microphone Input Control Service instance pointer.

Returns

0 on success, GATT error value on fail.

int bt_mics_aics_state_get(struct bt_mics *mics, struct bt_aics *inst)

Read the Audio Input Control Service input state.

Parameters
  • mics – Microphone Input Control Service instance pointer.

  • inst – Pointer to the Audio Input Control Service instance.

Returns

0 on success, GATT error value on fail.

int bt_mics_aics_gain_setting_get(struct bt_mics *mics, struct bt_aics *inst)

Read the Audio Input Control Service gain settings.

Parameters
  • mics – Microphone Input Control Service instance pointer.

  • inst – Pointer to the Audio Input Control Service instance.

Returns

0 on success, GATT error value on fail.

int bt_mics_aics_type_get(struct bt_mics *mics, struct bt_aics *inst)

Read the Audio Input Control Service input type.

Parameters
  • mics – Microphone Input Control Service instance pointer.

  • inst – Pointer to the Audio Input Control Service instance.

Returns

0 on success, GATT error value on fail.

int bt_mics_aics_status_get(struct bt_mics *mics, struct bt_aics *inst)

Read the Audio Input Control Service input status.

Parameters
  • mics – Microphone Input Control Service instance pointer.

  • inst – Pointer to the Audio Input Control Service instance.

Returns

0 on success, GATT error value on fail.

int bt_mics_aics_unmute(struct bt_mics *mics, struct bt_aics *inst)

Unmute the Audio Input Control Service input.

Parameters
  • mics – Microphone Input Control Service instance pointer.

  • inst – Pointer to the Audio Input Control Service instance.

Returns

0 on success, GATT error value on fail.

int bt_mics_aics_mute(struct bt_mics *mics, struct bt_aics *inst)

Mute the Audio Input Control Service input.

Parameters
  • mics – Microphone Input Control Service instance pointer.

  • inst – Pointer to the Audio Input Control Service instance.

Returns

0 on success, GATT error value on fail.

int bt_mics_aics_manual_gain_set(struct bt_mics *mics, struct bt_aics *inst)

Set Audio Input Control Service gain mode to manual.

Parameters
  • mics – Microphone Input Control Service instance pointer.

  • inst – Pointer to the Audio Input Control Service instance.

Returns

0 on success, GATT error value on fail.

int bt_mics_aics_automatic_gain_set(struct bt_mics *mics, struct bt_aics *inst)

Set Audio Input Control Service gain mode to automatic.

Parameters
  • mics – Microphone Input Control Service instance pointer.

  • inst – Pointer to the Audio Input Control Service instance.

Returns

0 on success, GATT error value on fail.

int bt_mics_aics_gain_set(struct bt_mics *mics, struct bt_aics *inst, int8_t gain)

Set Audio Input Control Service input gain.

Parameters
  • mics – Microphone Input Control Service instance pointer.

  • inst – Pointer to the Audio Input Control Service instance.

  • gain – The gain in dB to set (-128 to 127).

Returns

0 on success, GATT error value on fail.

int bt_mics_aics_description_get(struct bt_mics *mics, struct bt_aics *inst)

Read the Audio Input Control Service description.

Parameters
  • mics – Microphone Input Control Service instance pointer.

  • inst – Pointer to the Audio Input Control Service instance.

Returns

0 on success, GATT error value on fail.

int bt_mics_aics_description_set(struct bt_mics *mics, struct bt_aics *inst, const char *description)

Set the Audio Input Control Service description.

Parameters
  • mics – Microphone Input Control Service instance pointer.

  • inst – Pointer to the Audio Input Control Service instance.

  • description – The description to set.

Returns

0 on success, GATT error value on fail.

int bt_mics_aics_deactivate(struct bt_mics *mics, struct bt_aics *inst)

Deactivates a Audio Input Control Service instance.

Audio Input Control Services are activated by default, but this will allow the server to deactivate a Audio Input Control Service. This can only be done as the server.

Parameters
  • mics – Microphone Input Control Service instance pointer.

  • inst – Pointer to the Audio Input Control Service instance.

Returns

0 if success, errno on failure.

int bt_mics_aics_activate(struct bt_mics *mics, struct bt_aics *inst)

Activates a Audio Input Control Service instance.

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 been deactivated with bt_mics_aics_deactivate. This can only be done as the server.

Parameters
  • mics – Microphone Input Control Service instance pointer.

  • inst – Pointer to the Audio Input Control Service instance.

Returns

0 if success, errno on failure.

int bt_mics_client_cb_register(struct bt_mics_cb *cb)

Registers the callbacks used by Microphone Input Control Service client.

This can only be done as the client.

Parameters
  • cb – The callback structure.

Returns

0 if success, errno on failure.

struct bt_mics_register_param
#include <mics.h>

Register parameters structure for Microphone Input Control Service.

Public Members

struct bt_aics_register_param aics_param[0]

Register parameter structure for Audio Input Control Services

struct bt_mics_cb *cb

Microphone Input Control Service callback structure.

struct bt_mics_included
#include <mics.h>

Microphone Input Control Service included services.

Used for to represent the Microphone Input Control Service included service instances, for either a client or a server instance. The instance pointers either represent local server 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_mics_cb
#include <mics.h>