Bluetooth: Audio: MCC optional procedures actually optional
This change makes the optional procedures in the Media Control Client optional and configurable through Kconfig. Signed-off-by: Ping Wang <pinw@demant.com>
This commit is contained in:
parent
6fe676f4e8
commit
2f138fad5f
7 changed files with 543 additions and 54 deletions
|
@ -156,6 +156,7 @@ static uint8_t mcc_read_icon_obj_id_cb(struct bt_conn *conn, uint8_t err,
|
|||
}
|
||||
#endif /* CONFIG_BT_MCC_OTS */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_PLAYER_ICON_URL)
|
||||
static uint8_t mcc_read_icon_url_cb(struct bt_conn *conn, uint8_t err,
|
||||
struct bt_gatt_read_params *params,
|
||||
const void *data, uint16_t length)
|
||||
|
@ -185,7 +186,9 @@ static uint8_t mcc_read_icon_url_cb(struct bt_conn *conn, uint8_t err,
|
|||
|
||||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_PLAYER_ICON_URL) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_TITLE)
|
||||
static void mcc_track_title_cb(struct bt_conn *conn, uint8_t err, const void *data, uint16_t length)
|
||||
{
|
||||
int cb_err = err;
|
||||
|
@ -222,7 +225,9 @@ static uint8_t mcc_read_track_title_cb(struct bt_conn *conn, uint8_t err,
|
|||
|
||||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_TITLE)*/
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_DURATION)
|
||||
static void mcc_track_duration_cb(struct bt_conn *conn, uint8_t err, const void *data,
|
||||
uint16_t length)
|
||||
{
|
||||
|
@ -256,7 +261,9 @@ static uint8_t mcc_read_track_duration_cb(struct bt_conn *conn, uint8_t err,
|
|||
|
||||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_DURATION) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_POSITION)
|
||||
static void mcc_track_position_cb(struct bt_conn *conn, uint8_t err, const void *data,
|
||||
uint16_t length)
|
||||
{
|
||||
|
@ -290,7 +297,9 @@ static uint8_t mcc_read_track_position_cb(struct bt_conn *conn, uint8_t err,
|
|||
|
||||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_POSITION) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_SET_TRACK_POSITION)
|
||||
static void mcs_write_track_position_cb(struct bt_conn *conn, uint8_t err,
|
||||
struct bt_gatt_write_params *params)
|
||||
{
|
||||
|
@ -314,7 +323,9 @@ static void mcs_write_track_position_cb(struct bt_conn *conn, uint8_t err,
|
|||
mcc_cb->set_track_position(conn, cb_err, pos);
|
||||
}
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_SET_TRACK_POSITION) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYBACK_SPEED)
|
||||
static void mcc_playback_speed_cb(struct bt_conn *conn, uint8_t err, const void *data,
|
||||
uint16_t length)
|
||||
{
|
||||
|
@ -348,7 +359,9 @@ static uint8_t mcc_read_playback_speed_cb(struct bt_conn *conn, uint8_t err,
|
|||
|
||||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
#endif /* defined (CONFIG_BT_MCC_READ_PLAYBACK_SPEED) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_SET_PLAYBACK_SPEED)
|
||||
static void mcs_write_playback_speed_cb(struct bt_conn *conn, uint8_t err,
|
||||
struct bt_gatt_write_params *params)
|
||||
{
|
||||
|
@ -371,7 +384,9 @@ static void mcs_write_playback_speed_cb(struct bt_conn *conn, uint8_t err,
|
|||
mcc_cb->set_playback_speed(conn, cb_err, speed);
|
||||
}
|
||||
}
|
||||
#endif /* defined (CONFIG_BT_MCC_SET_PLAYBACK_SPEED) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_SEEKING_SPEED)
|
||||
static void mcc_seeking_speed_cb(struct bt_conn *conn, uint8_t err, const void *data,
|
||||
uint16_t length)
|
||||
{
|
||||
|
@ -405,6 +420,7 @@ static uint8_t mcc_read_seeking_speed_cb(struct bt_conn *conn, uint8_t err,
|
|||
|
||||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
#endif /* defined (CONFIG_BT_MCC_READ_SEEKING_SPEED) */
|
||||
|
||||
#ifdef CONFIG_BT_MCC_OTS
|
||||
static uint8_t mcc_read_segments_obj_id_cb(struct bt_conn *conn, uint8_t err,
|
||||
|
@ -679,6 +695,7 @@ static void mcs_write_current_group_obj_id_cb(struct bt_conn *conn, uint8_t err,
|
|||
}
|
||||
#endif /* CONFIG_BT_MCC_OTS */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYING_ORDER)
|
||||
static void mcc_playing_order_cb(struct bt_conn *conn, uint8_t err, const void *data,
|
||||
uint16_t length)
|
||||
{
|
||||
|
@ -712,7 +729,9 @@ static uint8_t mcc_read_playing_order_cb(struct bt_conn *conn, uint8_t err,
|
|||
|
||||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_PLAYING_ORDER) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_SET_PLAYING_ORDER)
|
||||
static void mcs_write_playing_order_cb(struct bt_conn *conn, uint8_t err,
|
||||
struct bt_gatt_write_params *params)
|
||||
{
|
||||
|
@ -735,7 +754,9 @@ static void mcs_write_playing_order_cb(struct bt_conn *conn, uint8_t err,
|
|||
mcc_cb->set_playing_order(conn, cb_err, order);
|
||||
}
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_SET_PLAYING_ORDER) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYING_ORDER_SUPPORTED)
|
||||
static uint8_t mcc_read_playing_orders_supported_cb(struct bt_conn *conn, uint8_t err,
|
||||
struct bt_gatt_read_params *params,
|
||||
const void *data, uint16_t length)
|
||||
|
@ -762,7 +783,9 @@ static uint8_t mcc_read_playing_orders_supported_cb(struct bt_conn *conn, uint8_
|
|||
|
||||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_PLAYING_ORDER_SUPPORTED) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_STATE)
|
||||
static void mcc_media_state_cb(struct bt_conn *conn, uint8_t err, const void *data, uint16_t length)
|
||||
{
|
||||
int cb_err = err;
|
||||
|
@ -795,7 +818,9 @@ static uint8_t mcc_read_media_state_cb(struct bt_conn *conn, uint8_t err,
|
|||
|
||||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_STATE) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_SET_MEDIA_CONTROL_POINT)
|
||||
static void mcs_write_cp_cb(struct bt_conn *conn, uint8_t err,
|
||||
struct bt_gatt_write_params *params)
|
||||
{
|
||||
|
@ -829,7 +854,9 @@ static void mcs_write_cp_cb(struct bt_conn *conn, uint8_t err,
|
|||
mcc_cb->send_cmd(conn, cb_err, &cmd);
|
||||
}
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_SET_MEDIA_CONTROL_POINT) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_CONTROL_POINT_OPCODES_SUPPORTED)
|
||||
static void mcc_opcodes_supported_cb(struct bt_conn *conn, uint8_t err, const void *data,
|
||||
uint16_t length)
|
||||
{
|
||||
|
@ -864,6 +891,7 @@ static uint8_t mcc_read_opcodes_supported_cb(struct bt_conn *conn, uint8_t err,
|
|||
|
||||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_CONTROL_POINT_OPCODES_SUPPORTED) */
|
||||
|
||||
#ifdef CONFIG_BT_MCC_OTS
|
||||
static void mcs_write_scp_cb(struct bt_conn *conn, uint8_t err,
|
||||
|
@ -935,6 +963,7 @@ static uint8_t mcc_read_search_results_obj_id_cb(struct bt_conn *conn, uint8_t e
|
|||
}
|
||||
#endif /* CONFIG_BT_MCC_OTS */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_CONTENT_CONTROL_ID)
|
||||
static uint8_t mcc_read_content_control_id_cb(struct bt_conn *conn, uint8_t err,
|
||||
struct bt_gatt_read_params *params,
|
||||
const void *data, uint16_t length)
|
||||
|
@ -962,6 +991,7 @@ static uint8_t mcc_read_content_control_id_cb(struct bt_conn *conn, uint8_t err,
|
|||
|
||||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_CONTENT_CONTROL_ID) */
|
||||
|
||||
static uint8_t mcs_notify_handler(struct bt_conn *conn,
|
||||
struct bt_gatt_subscribe_params *params,
|
||||
|
@ -1007,25 +1037,35 @@ static uint8_t mcs_notify_handler(struct bt_conn *conn,
|
|||
mcc_cb->track_changed_ntf(conn, cb_err);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_TITLE_ENABLE_SUBSCRIPTION)
|
||||
} else if (handle == mcs_inst->track_title_handle) {
|
||||
LOG_DBG("Track Title notification");
|
||||
mcc_track_title_cb(conn, 0, data, length);
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_TITLE_ENABLE_SUBSCRIPTION) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_DURATION)
|
||||
} else if (handle == mcs_inst->track_duration_handle) {
|
||||
LOG_DBG("Track Duration notification");
|
||||
mcc_track_duration_cb(conn, 0, data, length);
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_DURATION) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_POSITION)
|
||||
} else if (handle == mcs_inst->track_position_handle) {
|
||||
LOG_DBG("Track Position notification");
|
||||
mcc_track_position_cb(conn, 0, data, length);
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_POSITION) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYBACK_SPEED)
|
||||
} else if (handle == mcs_inst->playback_speed_handle) {
|
||||
LOG_DBG("Playback Speed notification");
|
||||
mcc_playback_speed_cb(conn, 0, data, length);
|
||||
#endif /* defined (CONFIG_BT_MCC_READ_PLAYBACK_SPEED) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_SEEKING_SPEED)
|
||||
} else if (handle == mcs_inst->seeking_speed_handle) {
|
||||
LOG_DBG("Seeking Speed notification");
|
||||
mcc_seeking_speed_cb(conn, 0, data, length);
|
||||
#endif /* defined (CONFIG_BT_MCC_READ_SEEKING_SPEED) */
|
||||
|
||||
#ifdef CONFIG_BT_MCC_OTS
|
||||
} else if (handle == mcs_inst->current_track_obj_id_handle) {
|
||||
|
@ -1045,13 +1085,17 @@ static uint8_t mcs_notify_handler(struct bt_conn *conn,
|
|||
mcc_current_group_obj_id_cb(conn, 0, data, length);
|
||||
#endif /* CONFIG_BT_MCC_OTS */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYING_ORDER)
|
||||
} else if (handle == mcs_inst->playing_order_handle) {
|
||||
LOG_DBG("Playing Order notification");
|
||||
mcc_playing_order_cb(conn, 0, data, length);
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_PLAYING_ORDER) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_STATE)
|
||||
} else if (handle == mcs_inst->media_state_handle) {
|
||||
LOG_DBG("Media State notification");
|
||||
mcc_media_state_cb(conn, 0, data, length);
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_STATE) */
|
||||
|
||||
} else if (handle == mcs_inst->cp_handle) {
|
||||
/* The control point is is a special case - only */
|
||||
|
@ -1075,9 +1119,11 @@ static uint8_t mcs_notify_handler(struct bt_conn *conn,
|
|||
mcc_cb->cmd_ntf(conn, cb_err, &ntf);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_CONTROL_POINT_OPCODES_SUPPORTED)
|
||||
} else if (handle == mcs_inst->opcodes_supported_handle) {
|
||||
LOG_DBG("Opcodes Supported notification");
|
||||
mcc_opcodes_supported_cb(conn, 0, data, length);
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_CONTROL_POINT_OPCODES_SUPPORTED) */
|
||||
|
||||
#ifdef CONFIG_BT_MCC_OTS
|
||||
} else if (handle == mcs_inst->scp_handle) {
|
||||
|
@ -1122,21 +1168,37 @@ static void reset_mcs_inst(struct mcs_instance_t *mcs_inst, struct bt_conn *conn
|
|||
*/
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->player_name_sub_params);
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->track_changed_sub_params);
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_TITLE_ENABLE_SUBSCRIPTION)
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->track_title_sub_params);
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_TITLE_ENABLE_SUBSCRIPTION) */
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_DURATION)
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->track_duration_sub_params);
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_DURATION) */
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_POSITION)
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->track_position_sub_params);
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_POSITION) */
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYBACK_SPEED)
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->playback_speed_sub_params);
|
||||
#endif /* defined (CONFIG_BT_MCC_READ_PLAYBACK_SPEED) */
|
||||
#if defined(CONFIG_BT_MCC_READ_SEEKING_SPEED)
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->seeking_speed_sub_params);
|
||||
#endif /* defined (CONFIG_BT_MCC_READ_SEEKING_SPEED) */
|
||||
#ifdef CONFIG_BT_MCC_OTS
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->current_track_obj_sub_params);
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->next_track_obj_sub_params);
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->parent_group_obj_sub_params);
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->current_group_obj_sub_params);
|
||||
#endif /* CONFIG_BT_MCC_OTS */
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYING_ORDER)
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->playing_order_sub_params);
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_PLAYING_ORDER) */
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_STATE)
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->media_state_sub_params);
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_STATE) */
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->cp_sub_params);
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_CONTROL_POINT_OPCODES_SUPPORTED)
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->opcodes_supported_sub_params);
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_CONTROL_POINT_OPCODES_SUPPORTED) */
|
||||
#ifdef CONFIG_BT_MCC_OTS
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->scp_sub_params);
|
||||
(void)bt_gatt_unsubscribe(conn, &mcs_inst->search_results_obj_sub_params);
|
||||
|
@ -1428,31 +1490,41 @@ static bool subscribe_next_mcs_char(struct mcs_instance_t *mcs_inst,
|
|||
mcs_inst->track_changed_sub_params.disc_params == NULL) {
|
||||
sub_params = &mcs_inst->track_changed_sub_params;
|
||||
handle = mcs_inst->track_changed_handle;
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_TITLE_ENABLE_SUBSCRIPTION)
|
||||
} else if (mcs_inst->track_title_handle &&
|
||||
mcs_inst->track_title_sub_params.value &&
|
||||
mcs_inst->track_title_sub_params.disc_params == NULL) {
|
||||
sub_params = &mcs_inst->track_title_sub_params;
|
||||
handle = mcs_inst->track_title_handle;
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_TITLE_ENABLE_SUBSCRIPTION) */
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_DURATION)
|
||||
} else if (mcs_inst->track_duration_handle &&
|
||||
mcs_inst->track_duration_sub_params.value &&
|
||||
mcs_inst->track_duration_sub_params.disc_params == NULL) {
|
||||
sub_params = &mcs_inst->track_duration_sub_params;
|
||||
handle = mcs_inst->track_duration_handle;
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_DURATION) */
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_POSITION)
|
||||
} else if (mcs_inst->track_position_handle &&
|
||||
mcs_inst->track_position_sub_params.value &&
|
||||
mcs_inst->track_position_sub_params.disc_params == NULL) {
|
||||
sub_params = &mcs_inst->track_position_sub_params;
|
||||
handle = mcs_inst->track_position_handle;
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_POSITION) */
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYBACK_SPEED)
|
||||
} else if (mcs_inst->playback_speed_handle &&
|
||||
mcs_inst->playback_speed_sub_params.value &&
|
||||
mcs_inst->playback_speed_sub_params.disc_params == NULL) {
|
||||
sub_params = &mcs_inst->playback_speed_sub_params;
|
||||
handle = mcs_inst->playback_speed_handle;
|
||||
#endif /* defined (CONFIG_BT_MCC_READ_PLAYBACK_SPEED) */
|
||||
#if defined(CONFIG_BT_MCC_READ_SEEKING_SPEED)
|
||||
} else if (mcs_inst->seeking_speed_handle &&
|
||||
mcs_inst->seeking_speed_sub_params.value &&
|
||||
mcs_inst->seeking_speed_sub_params.disc_params == NULL) {
|
||||
sub_params = &mcs_inst->seeking_speed_sub_params;
|
||||
handle = mcs_inst->seeking_speed_handle;
|
||||
#endif /* defined (CONFIG_BT_MCC_READ_SEEKING_SPEED) */
|
||||
#ifdef CONFIG_BT_MCC_OTS
|
||||
} else if (mcs_inst->current_track_obj_id_handle &&
|
||||
mcs_inst->current_track_obj_sub_params.value &&
|
||||
|
@ -1475,26 +1547,32 @@ static bool subscribe_next_mcs_char(struct mcs_instance_t *mcs_inst,
|
|||
sub_params = &mcs_inst->current_group_obj_sub_params;
|
||||
handle = mcs_inst->current_group_obj_id_handle;
|
||||
#endif /* CONFIG_BT_MCC_OTS */
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYING_ORDER)
|
||||
} else if (mcs_inst->playing_order_handle &&
|
||||
mcs_inst->playing_order_sub_params.value &&
|
||||
mcs_inst->playing_order_sub_params.disc_params == NULL) {
|
||||
sub_params = &mcs_inst->playing_order_sub_params;
|
||||
handle = mcs_inst->playing_order_handle;
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_PLAYING_ORDER) */
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_STATE)
|
||||
} else if (mcs_inst->media_state_handle &&
|
||||
mcs_inst->media_state_sub_params.value &&
|
||||
mcs_inst->media_state_sub_params.disc_params == NULL) {
|
||||
sub_params = &mcs_inst->media_state_sub_params;
|
||||
handle = mcs_inst->media_state_handle;
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_STATE) */
|
||||
} else if (mcs_inst->cp_handle &&
|
||||
mcs_inst->cp_sub_params.value &&
|
||||
mcs_inst->cp_sub_params.disc_params == NULL) {
|
||||
sub_params = &mcs_inst->cp_sub_params;
|
||||
handle = mcs_inst->cp_handle;
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_CONTROL_POINT_OPCODES_SUPPORTED)
|
||||
} else if (mcs_inst->opcodes_supported_handle &&
|
||||
mcs_inst->opcodes_supported_sub_params.value &&
|
||||
mcs_inst->opcodes_supported_sub_params.disc_params == NULL) {
|
||||
sub_params = &mcs_inst->opcodes_supported_sub_params;
|
||||
handle = mcs_inst->opcodes_supported_handle;
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_CONTROL_POINT_OPCODES_SUPPORTED) */
|
||||
#ifdef CONFIG_BT_MCC_OTS
|
||||
} else if (mcs_inst->scp_handle &&
|
||||
mcs_inst->scp_sub_params.value &&
|
||||
|
@ -1567,9 +1645,11 @@ static uint8_t discover_mcs_char_func(struct bt_conn *conn,
|
|||
LOG_DBG("Icon Object, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
mcs_inst->icon_obj_id_handle = chrc->value_handle;
|
||||
#endif /* CONFIG_BT_MCC_OTS */
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_PLAYER_ICON_URL)
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_ICON_URL)) {
|
||||
LOG_DBG("Icon URL, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
mcs_inst->icon_url_handle = chrc->value_handle;
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_PLAYER_ICON_URL) */
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_TRACK_CHANGED)) {
|
||||
LOG_DBG("Track Changed, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
mcs_inst->track_changed_handle = chrc->value_handle;
|
||||
|
@ -1577,13 +1657,18 @@ static uint8_t discover_mcs_char_func(struct bt_conn *conn,
|
|||
if (chrc->properties & BT_GATT_CHRC_NOTIFY) {
|
||||
mcs_inst->track_changed_sub_params.value = BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_TITLE)
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_TRACK_TITLE)) {
|
||||
LOG_DBG("Track Title, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
mcs_inst->track_title_handle = chrc->value_handle;
|
||||
#if defined(BT_MCC_READ_TRACK_TITLE_ENABLE_SUBSCRIPTION)
|
||||
mcs_inst->track_title_sub_params.disc_params = NULL;
|
||||
if (chrc->properties & BT_GATT_CHRC_NOTIFY) {
|
||||
mcs_inst->track_title_sub_params.value = BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
#endif /* defined(BT_MCC_READ_TRACK_TITLE_ENABLE_SUBSCRIPTION) */
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_TITLE) */
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_DURATION)
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_TRACK_DURATION)) {
|
||||
LOG_DBG("Track Duration, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
mcs_inst->track_duration_handle = chrc->value_handle;
|
||||
|
@ -1591,20 +1676,32 @@ static uint8_t discover_mcs_char_func(struct bt_conn *conn,
|
|||
if (chrc->properties & BT_GATT_CHRC_NOTIFY) {
|
||||
mcs_inst->track_duration_sub_params.value = BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_DURATION) */
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_POSITION) || defined(CONFIG_BT_MCC_SET_TRACK_POSITION)
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_TRACK_POSITION)) {
|
||||
LOG_DBG("Track Position, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
mcs_inst->track_position_handle = chrc->value_handle;
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_POSITION)
|
||||
mcs_inst->track_position_sub_params.disc_params = NULL;
|
||||
if (chrc->properties & BT_GATT_CHRC_NOTIFY) {
|
||||
mcs_inst->track_position_sub_params.value = BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_POSITION) */
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_POSITION) || defined(CONFIG_BT_MCC_SET_TRACK_POSITION) */
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYBACK_SPEED) || defined(CONFIG_BT_MCC_SET_PLAYBACK_SPEED)
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_PLAYBACK_SPEED)) {
|
||||
LOG_DBG("Playback Speed, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
mcs_inst->playback_speed_handle = chrc->value_handle;
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYBACK_SPEED)
|
||||
mcs_inst->playback_speed_sub_params.disc_params = NULL;
|
||||
if (chrc->properties & BT_GATT_CHRC_NOTIFY) {
|
||||
mcs_inst->playback_speed_sub_params.value = BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
#endif /* defined (CONFIG_BT_MCC_READ_PLAYBACK_SPEED) */
|
||||
#endif /* defined (CONFIG_BT_MCC_READ_PLAYBACK_SPEED) ||
|
||||
* defined (CONFIG_BT_MCC_SET_PLAYBACK_SPEED)
|
||||
*/
|
||||
#if defined(CONFIG_BT_MCC_READ_SEEKING_SPEED)
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_SEEKING_SPEED)) {
|
||||
LOG_DBG("Seeking Speed, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
mcs_inst->seeking_speed_handle = chrc->value_handle;
|
||||
|
@ -1612,6 +1709,7 @@ static uint8_t discover_mcs_char_func(struct bt_conn *conn,
|
|||
if (chrc->properties & BT_GATT_CHRC_NOTIFY) {
|
||||
mcs_inst->seeking_speed_sub_params.value = BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
#endif /* defined (CONFIG_BT_MCC_READ_SEEKING_SPEED) */
|
||||
#ifdef CONFIG_BT_MCC_OTS
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_TRACK_SEGMENTS_OBJ_ID)) {
|
||||
LOG_DBG("Track Segments Object, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
|
@ -1648,16 +1746,23 @@ static uint8_t discover_mcs_char_func(struct bt_conn *conn,
|
|||
BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
#endif /* CONFIG_BT_MCC_OTS */
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYING_ORDER) || defined(CONFIG_BT_MCC_SET_PLAYING_ORDER)
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_PLAYING_ORDER)) {
|
||||
LOG_DBG("Playing Order, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
mcs_inst->playing_order_handle = chrc->value_handle;
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYING_ORDER)
|
||||
mcs_inst->playing_order_sub_params.disc_params = NULL;
|
||||
if (chrc->properties & BT_GATT_CHRC_NOTIFY) {
|
||||
mcs_inst->playing_order_sub_params.value = BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_PLAYING_ORDER) */
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_PLAYING_ORDER) || defined(CONFIG_BT_MCC_SET_PLAYING_ORDER) */
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYING_ORDER_SUPPORTED)
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_PLAYING_ORDERS)) {
|
||||
LOG_DBG("Playing Orders supported, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
mcs_inst->playing_orders_supported_handle = chrc->value_handle;
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_PLAYING_ORDER_SUPPORTED) */
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_STATE)
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_MEDIA_STATE)) {
|
||||
LOG_DBG("Media State, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
mcs_inst->media_state_handle = chrc->value_handle;
|
||||
|
@ -1665,6 +1770,7 @@ static uint8_t discover_mcs_char_func(struct bt_conn *conn,
|
|||
if (chrc->properties & BT_GATT_CHRC_NOTIFY) {
|
||||
mcs_inst->media_state_sub_params.value = BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_STATE) */
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_MEDIA_CONTROL_POINT)) {
|
||||
LOG_DBG("Media Control Point, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
mcs_inst->cp_handle = chrc->value_handle;
|
||||
|
@ -1672,6 +1778,7 @@ static uint8_t discover_mcs_char_func(struct bt_conn *conn,
|
|||
if (chrc->properties & BT_GATT_CHRC_NOTIFY) {
|
||||
mcs_inst->cp_sub_params.value = BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_CONTROL_POINT_OPCODES_SUPPORTED)
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_MEDIA_CONTROL_OPCODES)) {
|
||||
LOG_DBG("Media control opcodes supported, UUID: %s",
|
||||
bt_uuid_str(chrc->uuid));
|
||||
|
@ -1681,6 +1788,7 @@ static uint8_t discover_mcs_char_func(struct bt_conn *conn,
|
|||
mcs_inst->opcodes_supported_sub_params.value =
|
||||
BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_CONTROL_POINT_OPCODES_SUPPORTED) */
|
||||
#ifdef CONFIG_BT_MCC_OTS
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_MCS_SEARCH_CONTROL_POINT)) {
|
||||
LOG_DBG("Search control point, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
|
@ -1698,9 +1806,11 @@ static uint8_t discover_mcs_char_func(struct bt_conn *conn,
|
|||
BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
#endif /* CONFIG_BT_MCC_OTS */
|
||||
#if defined(CONFIG_BT_MCC_READ_CONTENT_CONTROL_ID)
|
||||
} else if (!bt_uuid_cmp(chrc->uuid, BT_UUID_CCID)) {
|
||||
LOG_DBG("Content Control ID, UUID: %s", bt_uuid_str(chrc->uuid));
|
||||
mcs_inst->content_control_id_handle = chrc->value_handle;
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_CONTENT_CONTROL_ID) */
|
||||
}
|
||||
|
||||
|
||||
|
@ -1937,6 +2047,7 @@ int bt_mcc_read_icon_obj_id(struct bt_conn *conn)
|
|||
}
|
||||
#endif /* CONFIG_BT_MCC_OTS */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_PLAYER_ICON_URL)
|
||||
int bt_mcc_read_icon_url(struct bt_conn *conn)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -1974,7 +2085,9 @@ int bt_mcc_read_icon_url(struct bt_conn *conn)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_PLAYER_ICON_URL) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_TITLE)
|
||||
int bt_mcc_read_track_title(struct bt_conn *conn)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2012,7 +2125,9 @@ int bt_mcc_read_track_title(struct bt_conn *conn)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_TITLE) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_DURATION)
|
||||
int bt_mcc_read_track_duration(struct bt_conn *conn)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2050,7 +2165,9 @@ int bt_mcc_read_track_duration(struct bt_conn *conn)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_DURATION) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_TRACK_POSITION)
|
||||
int bt_mcc_read_track_position(struct bt_conn *conn)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2088,7 +2205,9 @@ int bt_mcc_read_track_position(struct bt_conn *conn)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_TRACK_POSITION) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_SET_TRACK_POSITION)
|
||||
int bt_mcc_set_track_position(struct bt_conn *conn, int32_t pos)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2131,7 +2250,9 @@ int bt_mcc_set_track_position(struct bt_conn *conn, int32_t pos)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_SET_TRACK_POSITION) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYBACK_SPEED)
|
||||
int bt_mcc_read_playback_speed(struct bt_conn *conn)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2169,7 +2290,9 @@ int bt_mcc_read_playback_speed(struct bt_conn *conn)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined (CONFIG_BT_MCC_READ_PLAYBACK_SPEED) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_SET_PLAYBACK_SPEED)
|
||||
int bt_mcc_set_playback_speed(struct bt_conn *conn, int8_t speed)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2212,7 +2335,9 @@ int bt_mcc_set_playback_speed(struct bt_conn *conn, int8_t speed)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined (CONFIG_BT_MCC_SET_PLAYBACK_SPEED) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_SEEKING_SPEED)
|
||||
int bt_mcc_read_seeking_speed(struct bt_conn *conn)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2250,6 +2375,7 @@ int bt_mcc_read_seeking_speed(struct bt_conn *conn)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined (CONFIG_BT_MCC_READ_SEEKING_SPEED) */
|
||||
|
||||
#ifdef CONFIG_BT_MCC_OTS
|
||||
int bt_mcc_read_segments_obj_id(struct bt_conn *conn)
|
||||
|
@ -2584,6 +2710,7 @@ int bt_mcc_set_current_group_obj_id(struct bt_conn *conn, uint64_t obj_id)
|
|||
}
|
||||
#endif /* CONFIG_BT_MCC_OTS */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYING_ORDER)
|
||||
int bt_mcc_read_playing_order(struct bt_conn *conn)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2621,7 +2748,9 @@ int bt_mcc_read_playing_order(struct bt_conn *conn)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_PLAYING_ORDER) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_SET_PLAYING_ORDER)
|
||||
int bt_mcc_set_playing_order(struct bt_conn *conn, uint8_t order)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2672,7 +2801,9 @@ int bt_mcc_set_playing_order(struct bt_conn *conn, uint8_t order)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_SET_PLAYING_ORDER) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_PLAYING_ORDER_SUPPORTED)
|
||||
int bt_mcc_read_playing_orders_supported(struct bt_conn *conn)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2710,7 +2841,9 @@ int bt_mcc_read_playing_orders_supported(struct bt_conn *conn)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_PLAYING_ORDER_SUPPORTED) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_STATE)
|
||||
int bt_mcc_read_media_state(struct bt_conn *conn)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2748,7 +2881,9 @@ int bt_mcc_read_media_state(struct bt_conn *conn)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_STATE) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_SET_MEDIA_CONTROL_POINT)
|
||||
int bt_mcc_send_cmd(struct bt_conn *conn, const struct mpl_cmd *cmd)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2810,7 +2945,9 @@ int bt_mcc_send_cmd(struct bt_conn *conn, const struct mpl_cmd *cmd)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_SET_MEDIA_CONTROL_POINT) */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_MEDIA_CONTROL_POINT_OPCODES_SUPPORTED)
|
||||
int bt_mcc_read_opcodes_supported(struct bt_conn *conn)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2848,6 +2985,7 @@ int bt_mcc_read_opcodes_supported(struct bt_conn *conn)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_MEDIA_CONTROL_POINT_OPCODES_SUPPORTED) */
|
||||
|
||||
#ifdef CONFIG_BT_MCC_OTS
|
||||
int bt_mcc_send_search(struct bt_conn *conn, const struct mpl_search *search)
|
||||
|
@ -2944,6 +3082,7 @@ int bt_mcc_read_search_results_obj_id(struct bt_conn *conn)
|
|||
}
|
||||
#endif /* CONFIG_BT_MCC_OTS */
|
||||
|
||||
#if defined(CONFIG_BT_MCC_READ_CONTENT_CONTROL_ID)
|
||||
int bt_mcc_read_content_control_id(struct bt_conn *conn)
|
||||
{
|
||||
struct mcs_instance_t *mcs_inst;
|
||||
|
@ -2981,6 +3120,7 @@ int bt_mcc_read_content_control_id(struct bt_conn *conn)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* defined(CONFIG_BT_MCC_READ_CONTENT_CONTROL_ID) */
|
||||
|
||||
#ifdef CONFIG_BT_MCC_OTS
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue