Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
Microphone Input Control Service (Microphone Input Control Service)

Microphone Input Control Service (Microphone Input Control Service) More...

Data Structures

struct  bt_mics_register_param
 Register parameters structure for Microphone Input Control Service. More...
 
struct  bt_mics_included
 Microphone Input Control Service included services. More...
 
struct  bt_mics_cb
 

Macros

#define BT_MICS_AICS_CNT   0
 
#define BT_MICS_ERR_MUTE_DISABLED   0x80
 
#define BT_MICS_ERR_VAL_OUT_OF_RANGE   0x81
 
#define BT_MICS_MUTE_UNMUTED   0x00
 
#define BT_MICS_MUTE_MUTED   0x01
 
#define BT_MICS_MUTE_DISABLED   0x02
 

Typedefs

typedef void(* bt_mics_discover_cb) (struct bt_mics *mics, int err, uint8_t aics_count)
 Callback function for bt_mics_discover. More...
 
typedef void(* bt_mics_mute_read_cb) (struct bt_mics *mics, int err, uint8_t mute)
 Callback function for Microphone Input Control Service mute. More...
 
typedef void(* bt_mics_mute_write_cb) (struct bt_mics *mics, int err)
 Callback function for Microphone Input Control Service mute/unmute. More...
 

Functions

int bt_mics_register (struct bt_mics_register_param *param, struct bt_mics **mics)
 Initialize the Microphone Input Control Service. More...
 
int bt_mics_included_get (struct bt_mics *mics, struct bt_mics_included *included)
 Get Microphone Input Control Service included services. More...
 
int bt_mics_client_conn_get (const struct bt_mics *mics, struct bt_conn **conn)
 Get the connection pointer of a client instance. More...
 
int bt_mics_discover (struct bt_conn *conn, struct bt_mics **mics)
 Discover Microphone Input Control Service. More...
 
int bt_mics_unmute (struct bt_mics *mics)
 Unmute the server. More...
 
int bt_mics_mute (struct bt_mics *mics)
 Mute the server. More...
 
int bt_mics_mute_disable (struct bt_mics *mics)
 Disable the mute functionality. More...
 
int bt_mics_mute_get (struct bt_mics *mics)
 Read the mute state of a Microphone Input Control Service. More...
 
int bt_mics_aics_state_get (struct bt_mics *mics, struct bt_aics *inst)
 Read the Audio Input Control Service input state. More...
 
int bt_mics_aics_gain_setting_get (struct bt_mics *mics, struct bt_aics *inst)
 Read the Audio Input Control Service gain settings. More...
 
int bt_mics_aics_type_get (struct bt_mics *mics, struct bt_aics *inst)
 Read the Audio Input Control Service input type. More...
 
int bt_mics_aics_status_get (struct bt_mics *mics, struct bt_aics *inst)
 Read the Audio Input Control Service input status. More...
 
int bt_mics_aics_unmute (struct bt_mics *mics, struct bt_aics *inst)
 Unmute the Audio Input Control Service input. More...
 
int bt_mics_aics_mute (struct bt_mics *mics, struct bt_aics *inst)
 Mute the Audio Input Control Service input. More...
 
int bt_mics_aics_manual_gain_set (struct bt_mics *mics, struct bt_aics *inst)
 Set Audio Input Control Service gain mode to manual. More...
 
int bt_mics_aics_automatic_gain_set (struct bt_mics *mics, struct bt_aics *inst)
 Set Audio Input Control Service gain mode to automatic. More...
 
int bt_mics_aics_gain_set (struct bt_mics *mics, struct bt_aics *inst, int8_t gain)
 Set Audio Input Control Service input gain. More...
 
int bt_mics_aics_description_get (struct bt_mics *mics, struct bt_aics *inst)
 Read the Audio Input Control Service description. More...
 
int bt_mics_aics_description_set (struct bt_mics *mics, struct bt_aics *inst, const char *description)
 Set the Audio Input Control Service description. More...
 
int bt_mics_aics_deactivate (struct bt_mics *mics, struct bt_aics *inst)
 Deactivates a Audio Input Control Service instance. More...
 
int bt_mics_aics_activate (struct bt_mics *mics, struct bt_aics *inst)
 Activates a Audio Input Control Service instance. More...
 
int bt_mics_client_cb_register (struct bt_mics_cb *cb)
 Registers the callbacks used by Microphone Input Control Service client. More...
 

Detailed Description

Microphone Input Control Service (Microphone Input Control Service)

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

Macro Definition Documentation

◆ BT_MICS_AICS_CNT

#define BT_MICS_AICS_CNT   0

◆ BT_MICS_ERR_MUTE_DISABLED

#define BT_MICS_ERR_MUTE_DISABLED   0x80

#include <include/bluetooth/audio/mics.h>

Application error codes

◆ BT_MICS_ERR_VAL_OUT_OF_RANGE

#define BT_MICS_ERR_VAL_OUT_OF_RANGE   0x81

◆ BT_MICS_MUTE_DISABLED

#define BT_MICS_MUTE_DISABLED   0x02

◆ BT_MICS_MUTE_MUTED

#define BT_MICS_MUTE_MUTED   0x01

◆ BT_MICS_MUTE_UNMUTED

#define BT_MICS_MUTE_UNMUTED   0x00

#include <include/bluetooth/audio/mics.h>

Microphone Input Control Service mute states

Typedef Documentation

◆ bt_mics_discover_cb

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

#include <include/bluetooth/audio/mics.h>

Callback function for bt_mics_discover.

This callback is only used for the client.

Parameters
micsMicrophone Input Control Service instance pointer.
errError value. 0 on success, GATT error or errno on fail.
aics_countNumber of Audio Input Control Service instances on peer device.

◆ bt_mics_mute_read_cb

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

#include <include/bluetooth/audio/mics.h>

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.

Parameters
micsMicrophone Input Control Service instance pointer.
errError value. 0 on success, GATT error or errno on fail. For notifications, this will always be 0.
muteThe mute setting of the Microphone Input Control Service.

◆ bt_mics_mute_write_cb

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

#include <include/bluetooth/audio/mics.h>

Callback function for Microphone Input Control Service mute/unmute.

Parameters
micsMicrophone Input Control Service instance pointer.
errError value. 0 on success, GATT error or errno on fail.

Function Documentation

◆ bt_mics_aics_activate()

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

#include <include/bluetooth/audio/mics.h>

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
micsMicrophone Input Control Service instance pointer.
instPointer to the Audio Input Control Service instance.
Returns
0 if success, errno on failure.

◆ bt_mics_aics_automatic_gain_set()

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

#include <include/bluetooth/audio/mics.h>

Set Audio Input Control Service gain mode to automatic.

Parameters
micsMicrophone Input Control Service instance pointer.
instPointer to the Audio Input Control Service instance.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_aics_deactivate()

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

#include <include/bluetooth/audio/mics.h>

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
micsMicrophone Input Control Service instance pointer.
instPointer to the Audio Input Control Service instance.
Returns
0 if success, errno on failure.

◆ bt_mics_aics_description_get()

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

#include <include/bluetooth/audio/mics.h>

Read the Audio Input Control Service description.

Parameters
micsMicrophone Input Control Service instance pointer.
instPointer to the Audio Input Control Service instance.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_aics_description_set()

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

#include <include/bluetooth/audio/mics.h>

Set the Audio Input Control Service description.

Parameters
micsMicrophone Input Control Service instance pointer.
instPointer to the Audio Input Control Service instance.
descriptionThe description to set.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_aics_gain_set()

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

#include <include/bluetooth/audio/mics.h>

Set Audio Input Control Service input gain.

Parameters
micsMicrophone Input Control Service instance pointer.
instPointer to the Audio Input Control Service instance.
gainThe gain in dB to set (-128 to 127).
Returns
0 on success, GATT error value on fail.

◆ bt_mics_aics_gain_setting_get()

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

#include <include/bluetooth/audio/mics.h>

Read the Audio Input Control Service gain settings.

Parameters
micsMicrophone Input Control Service instance pointer.
instPointer to the Audio Input Control Service instance.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_aics_manual_gain_set()

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

#include <include/bluetooth/audio/mics.h>

Set Audio Input Control Service gain mode to manual.

Parameters
micsMicrophone Input Control Service instance pointer.
instPointer to the Audio Input Control Service instance.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_aics_mute()

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

#include <include/bluetooth/audio/mics.h>

Mute the Audio Input Control Service input.

Parameters
micsMicrophone Input Control Service instance pointer.
instPointer to the Audio Input Control Service instance.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_aics_state_get()

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

#include <include/bluetooth/audio/mics.h>

Read the Audio Input Control Service input state.

Parameters
micsMicrophone Input Control Service instance pointer.
instPointer to the Audio Input Control Service instance.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_aics_status_get()

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

#include <include/bluetooth/audio/mics.h>

Read the Audio Input Control Service input status.

Parameters
micsMicrophone Input Control Service instance pointer.
instPointer to the Audio Input Control Service instance.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_aics_type_get()

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

#include <include/bluetooth/audio/mics.h>

Read the Audio Input Control Service input type.

Parameters
micsMicrophone Input Control Service instance pointer.
instPointer to the Audio Input Control Service instance.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_aics_unmute()

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

#include <include/bluetooth/audio/mics.h>

Unmute the Audio Input Control Service input.

Parameters
micsMicrophone Input Control Service instance pointer.
instPointer to the Audio Input Control Service instance.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_client_cb_register()

int bt_mics_client_cb_register ( struct bt_mics_cb cb)

#include <include/bluetooth/audio/mics.h>

Registers the callbacks used by Microphone Input Control Service client.

This can only be done as the client.

Parameters
cbThe callback structure.
Returns
0 if success, errno on failure.

◆ bt_mics_client_conn_get()

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

#include <include/bluetooth/audio/mics.h>

Get the connection pointer of a client instance.

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

Parameters
micsMicrophone Input Control Service client instance pointer.
connConnection pointer.
Returns
0 if success, errno on failure.

◆ bt_mics_discover()

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

#include <include/bluetooth/audio/mics.h>

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
connThe connection to initialize the profile for.
[out]micsValid remote instance object on success.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_included_get()

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

#include <include/bluetooth/audio/mics.h>

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
micsMicrophone Input Control Service instance pointer.
[out]includedPointer to store the result in.
Returns
0 if success, errno on failure.

◆ bt_mics_mute()

int bt_mics_mute ( struct bt_mics *  mics)

#include <include/bluetooth/audio/mics.h>

Mute the server.

Parameters
micsMicrophone Input Control Service instance pointer.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_mute_disable()

int bt_mics_mute_disable ( struct bt_mics *  mics)

#include <include/bluetooth/audio/mics.h>

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
micsMicrophone Input Control Service instance pointer.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_mute_get()

int bt_mics_mute_get ( struct bt_mics *  mics)

#include <include/bluetooth/audio/mics.h>

Read the mute state of a Microphone Input Control Service.

Parameters
micsMicrophone Input Control Service instance pointer.
Returns
0 on success, GATT error value on fail.

◆ bt_mics_register()

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

#include <include/bluetooth/audio/mics.h>

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
paramPointer to an initialization structure.
[out]micsPointer 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.

◆ bt_mics_unmute()

int bt_mics_unmute ( struct bt_mics *  mics)

#include <include/bluetooth/audio/mics.h>

Unmute the server.

Parameters
micsMicrophone Input Control Service instance pointer.
Returns
0 on success, GATT error value on fail.