Skip to content

Commit

Permalink
bluetooth: audio: Add API to get MICP service ATT handles
Browse files Browse the repository at this point in the history
This is needed for upper tester.

Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
  • Loading branch information
piotrnarajowski committed Aug 18, 2023
1 parent 45a4177 commit 1953a49
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 19 deletions.
1 change: 1 addition & 0 deletions include/zephyr/bluetooth/audio/micp.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/

#include <stdint.h>
#include <../../subsys/bluetooth/audio/micp_internal.h>

#include <zephyr/bluetooth/audio/aics.h>

Expand Down
36 changes: 36 additions & 0 deletions subsys/bluetooth/audio/micp_internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/** @file
* @brief Internal APIs for Bluetooth MICP.
*/

/*
* Copyright (c) 2020 Bose Corporation
* Copyright (c) 2020 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>

struct bt_micp_mic_ctlr {
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_AICS_CLIENT_MAX_INSTANCE_COUNT];
};

#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_MICP_INTERNAL_ */
21 changes: 2 additions & 19 deletions subsys/bluetooth/audio/micp_mic_ctlr.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,17 @@
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/audio/micp.h>

#include <zephyr/logging/log.h>

#include "micp_internal.h"

LOG_MODULE_REGISTER(bt_micp_mic_ctlr, CONFIG_BT_MICP_MIC_CTLR_LOG_LEVEL);

#include "common/bt_str.h"

/* Callback functions */
static struct bt_micp_mic_ctlr_cb *micp_mic_ctlr_cb;

struct bt_micp_mic_ctlr {
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_MIC_CTLR_MAX_AICS_INST];
};

static struct bt_micp_mic_ctlr mic_ctlrs[CONFIG_BT_MAX_CONN];
static struct bt_uuid *mics_uuid = BT_UUID_MICS;

Expand Down

0 comments on commit 1953a49

Please sign in to comment.