Zephyr API Documentation  3.0.0
A Scalable Open Source RTOS
3.0.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mcc.h
Go to the documentation of this file.
1
15/*
16 * Copyright (c) 2019 - 2021 Nordic Semiconductor ASA
17 *
18 * SPDX-License-Identifier: Apache-2.0
19 */
20
21#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_MCC_
22#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_MCC_
23
24#include <zephyr/types.h>
25#include <bluetooth/conn.h>
26#include <net/buf.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/**** Callback functions ******************************************************/
34
43typedef void (*bt_mcc_discover_mcs_cb)(struct bt_conn *conn, int err);
44
54typedef void (*bt_mcc_read_player_name_cb)(struct bt_conn *conn, int err, const char *name);
55
56#ifdef CONFIG_BT_OTC
66typedef void (*bt_mcc_read_icon_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id);
67#endif /* CONFIG_BT_OTC */
68
78typedef void (*bt_mcc_read_icon_url_cb)(struct bt_conn *conn, int err, const char *icon_url);
79
91typedef void (*bt_mcc_track_changed_ntf_cb)(struct bt_conn *conn, int err);
92
93
103typedef void (*bt_mcc_read_track_title_cb)(struct bt_conn *conn, int err, const char *title);
104
114typedef void (*bt_mcc_read_track_duration_cb)(struct bt_conn *conn, int err, int32_t dur);
115
125typedef void (*bt_mcc_read_track_position_cb)(struct bt_conn *conn, int err, int32_t pos);
126
136typedef void (*bt_mcc_set_track_position_cb)(struct bt_conn *conn, int err, int32_t pos);
137
147typedef void (*bt_mcc_read_playback_speed_cb)(struct bt_conn *conn, int err, int8_t speed);
148
158typedef void (*bt_mcc_set_playback_speed_cb)(struct bt_conn *conn, int err, int8_t speed);
159
169typedef void (*bt_mcc_read_seeking_speed_cb)(struct bt_conn *conn, int err, int8_t speed);
170
171#ifdef CONFIG_BT_OTC
181typedef void (*bt_mcc_read_segments_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id);
182
192typedef void (*bt_mcc_read_current_track_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id);
193
203typedef void (*bt_mcc_set_current_track_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id);
204
214typedef void (*bt_mcc_read_next_track_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id);
215
225typedef void (*bt_mcc_set_next_track_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id);
226
236typedef void (*bt_mcc_read_parent_group_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id);
237
247typedef void (*bt_mcc_read_current_group_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id);
248
258typedef void (*bt_mcc_set_current_group_obj_id_cb)(struct bt_conn *conn, int err, uint64_t obj_id);
259
260#endif /* CONFIG_BT_OTC */
261
271typedef void (*bt_mcc_read_playing_order_cb)(struct bt_conn *conn, int err, uint8_t order);
272
282typedef void (*bt_mcc_set_playing_order_cb)(struct bt_conn *conn, int err, uint8_t order);
283
293typedef void (*bt_mcc_read_playing_orders_supported_cb)(struct bt_conn *conn, int err,
294 uint16_t orders);
295
305typedef void (*bt_mcc_read_media_state_cb)(struct bt_conn *conn, int err, uint8_t state);
306
316typedef void (*bt_mcc_send_cmd_cb)(struct bt_conn *conn, int err, struct mpl_cmd cmd);
317
331typedef void (*bt_mcc_cmd_ntf_cb)(struct bt_conn *conn, int err, struct mpl_cmd_ntf ntf);
332
342typedef void (*bt_mcc_read_opcodes_supported_cb)(struct bt_conn *conn, int err,
343 uint32_t opcodes);
344
345#ifdef CONFIG_BT_OTC
355typedef void (*bt_mcc_send_search_cb)(struct bt_conn *conn, int err,
356 struct mpl_search search);
357
371typedef void (*bt_mcc_search_ntf_cb)(struct bt_conn *conn, int err,
372 uint8_t result_code);
373
387typedef void (*bt_mcc_read_search_results_obj_id_cb)(struct bt_conn *conn,
388 int err, uint64_t id);
389#endif /* CONFIG_BT_OTC */
390
400typedef void (*bt_mcc_read_content_control_id_cb)(struct bt_conn *conn,
401 int err, uint8_t ccid);
402#ifdef CONFIG_BT_OTC
403/**** Callback functions for the included Object Transfer service *************/
404
413typedef void (*bt_mcc_otc_obj_selected_cb)(struct bt_conn *conn, int err);
414
423typedef void (*bt_mcc_otc_obj_metadata_cb)(struct bt_conn *conn, int err);
424
436typedef void (*bt_mcc_otc_read_icon_object_cb)(struct bt_conn *conn, int err,
437 struct net_buf_simple *buf);
438
450typedef void (*bt_mcc_otc_read_track_segments_object_cb)(struct bt_conn *conn, int err,
451 struct net_buf_simple *buf);
452
464typedef void (*bt_mcc_otc_read_current_track_object_cb)(struct bt_conn *conn, int err,
465 struct net_buf_simple *buf);
466
478typedef void (*bt_mcc_otc_read_next_track_object_cb)(struct bt_conn *conn, int err,
479 struct net_buf_simple *buf);
480
492typedef void (*bt_mcc_otc_read_parent_group_object_cb)(struct bt_conn *conn, int err,
493 struct net_buf_simple *buf);
494
506typedef void (*bt_mcc_otc_read_current_group_object_cb)(struct bt_conn *conn, int err,
507 struct net_buf_simple *buf);
508
509#endif /* CONFIG_BT_OTC */
510
511
515struct bt_mcc_cb {
518#ifdef CONFIG_BT_OTC
519 bt_mcc_read_icon_obj_id_cb read_icon_obj_id;
520#endif /* CONFIG_BT_OTC */
530#ifdef CONFIG_BT_OTC
531 bt_mcc_read_segments_obj_id_cb read_segments_obj_id;
532 bt_mcc_read_current_track_obj_id_cb read_current_track_obj_id;
533 bt_mcc_set_current_track_obj_id_cb set_current_track_obj_id;
534 bt_mcc_read_next_track_obj_id_cb read_next_track_obj_id;
535 bt_mcc_set_next_track_obj_id_cb set_next_track_obj_id;
536 bt_mcc_read_current_group_obj_id_cb read_current_group_obj_id;
537 bt_mcc_set_current_group_obj_id_cb set_current_group_obj_id;
538 bt_mcc_read_parent_group_obj_id_cb read_parent_group_obj_id;
539#endif /* CONFIG_BT_OTC */
547#ifdef CONFIG_BT_OTC
548 bt_mcc_send_search_cb send_search;
549 bt_mcc_search_ntf_cb search_ntf;
550 bt_mcc_read_search_results_obj_id_cb read_search_results_obj_id;
551#endif /* CONFIG_BT_OTC */
553#ifdef CONFIG_BT_OTC
554 bt_mcc_otc_obj_selected_cb otc_obj_selected;
555 bt_mcc_otc_obj_metadata_cb otc_obj_metadata;
556 bt_mcc_otc_read_icon_object_cb otc_icon_object;
557 bt_mcc_otc_read_track_segments_object_cb otc_track_segments_object;
558 bt_mcc_otc_read_current_track_object_cb otc_current_track_object;
559 bt_mcc_otc_read_next_track_object_cb otc_next_track_object;
560 bt_mcc_otc_read_current_group_object_cb otc_current_group_object;
561 bt_mcc_otc_read_parent_group_object_cb otc_parent_group_object;
562#endif /* CONFIG_BT_OTC */
563};
564
565/**** Functions ***************************************************************/
566
574int bt_mcc_init(struct bt_mcc_cb *cb);
575
576
591int bt_mcc_discover_mcs(struct bt_conn *conn, bool subscribe);
592
600int bt_mcc_read_player_name(struct bt_conn *conn);
601
602#ifdef CONFIG_BT_OTC
610int bt_mcc_read_icon_obj_id(struct bt_conn *conn);
611#endif /* CONFIG_BT_OTC */
612
620int bt_mcc_read_icon_url(struct bt_conn *conn);
621
629int bt_mcc_read_track_title(struct bt_conn *conn);
630
638int bt_mcc_read_track_duration(struct bt_conn *conn);
639
647int bt_mcc_read_track_position(struct bt_conn *conn);
648
657int bt_mcc_set_track_position(struct bt_conn *conn, int32_t pos);
658
666int bt_mcc_read_playback_speed(struct bt_conn *conn);
667
676int bt_mcc_set_playback_speed(struct bt_conn *conn, int8_t speed);
677
685int bt_mcc_read_seeking_speed(struct bt_conn *conn);
686
687#ifdef CONFIG_BT_OTC
695int bt_mcc_read_segments_obj_id(struct bt_conn *conn);
696
704int bt_mcc_read_current_track_obj_id(struct bt_conn *conn);
705
716int bt_mcc_set_current_track_obj_id(struct bt_conn *conn, uint64_t id);
717
726int bt_mcc_read_next_track_obj_id(struct bt_conn *conn);
727
738int bt_mcc_set_next_track_obj_id(struct bt_conn *conn, uint64_t id);
739
747int bt_mcc_read_current_group_obj_id(struct bt_conn *conn);
748
759int bt_mcc_set_current_group_obj_id(struct bt_conn *conn, uint64_t id);
760
768int bt_mcc_read_parent_group_obj_id(struct bt_conn *conn);
769#endif /* CONFIG_BT_OTC */
770
778int bt_mcc_read_playing_order(struct bt_conn *conn);
779
788int bt_mcc_set_playing_order(struct bt_conn *conn, uint8_t order);
789
797int bt_mcc_read_playing_orders_supported(struct bt_conn *conn);
798
806int bt_mcc_read_media_state(struct bt_conn *conn);
807
818int bt_mcc_send_cmd(struct bt_conn *conn, struct mpl_cmd cmd);
819
827int bt_mcc_read_opcodes_supported(struct bt_conn *conn);
828
829#ifdef CONFIG_BT_OTC
840int bt_mcc_send_search(struct bt_conn *conn, struct mpl_search search);
841
849int bt_mcc_read_search_results_obj_id(struct bt_conn *conn);
850#endif /* CONFIG_BT_OTC */
851
859int bt_mcc_read_content_control_id(struct bt_conn *conn);
860
861#ifdef CONFIG_BT_OTC
869int bt_mcc_otc_read_object_metadata(struct bt_conn *conn);
870
878int bt_mcc_otc_read_icon_object(struct bt_conn *conn);
879
887int bt_mcc_otc_read_track_segments_object(struct bt_conn *conn);
888
896int bt_mcc_otc_read_current_track_object(struct bt_conn *conn);
897
905int bt_mcc_otc_read_next_track_object(struct bt_conn *conn);
906
914int bt_mcc_otc_read_current_group_object(struct bt_conn *conn);
915
923int bt_mcc_otc_read_parent_group_object(struct bt_conn *conn);
924
925#if defined(CONFIG_BT_MCC_SHELL)
926struct bt_otc_instance_t *bt_mcc_otc_inst(void);
927#endif /* defined(CONFIG_BT_MCC_SHELL) */
928#endif /* CONFIG_BT_OTC */
929
930#ifdef __cplusplus
931}
932#endif
933
938#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_MCC__ */
Bluetooth connection handling.
int bt_mcc_set_playing_order(struct bt_conn *conn, uint8_t order)
Set Playing Order.
int bt_mcc_read_playing_order(struct bt_conn *conn)
Read Playing Order.
void(* bt_mcc_set_track_position_cb)(struct bt_conn *conn, int err, int32_t pos)
Callback function for bt_mcc_set_track_position()
Definition: mcc.h:136
void(* bt_mcc_read_track_position_cb)(struct bt_conn *conn, int err, int32_t pos)
Callback function for bt_mcc_read_track_position()
Definition: mcc.h:125
void(* bt_mcc_set_playback_speed_cb)(struct bt_conn *conn, int err, int8_t speed)
Callback function for bt_mcc_set_playback_speed()
Definition: mcc.h:158
int bt_mcc_set_playback_speed(struct bt_conn *conn, int8_t speed)
Set Playback Speed.
void(* bt_mcc_set_playing_order_cb)(struct bt_conn *conn, int err, uint8_t order)
Callback function for bt_mcc_set_playing_order()
Definition: mcc.h:282
void(* bt_mcc_read_media_state_cb)(struct bt_conn *conn, int err, uint8_t state)
Callback function for bt_mcc_read_media_state()
Definition: mcc.h:305
void(* bt_mcc_cmd_ntf_cb)(struct bt_conn *conn, int err, struct mpl_cmd_ntf ntf)
Callback function for command notifications.
Definition: mcc.h:331
void(* bt_mcc_read_seeking_speed_cb)(struct bt_conn *conn, int err, int8_t speed)
Callback function for bt_mcc_read_seeking_speed()
Definition: mcc.h:169
int bt_mcc_read_seeking_speed(struct bt_conn *conn)
Read Seeking speed.
int bt_mcc_read_icon_url(struct bt_conn *conn)
Read Icon Object URL.
int bt_mcc_read_track_duration(struct bt_conn *conn)
Read Track Duration.
void(* bt_mcc_track_changed_ntf_cb)(struct bt_conn *conn, int err)
Callback function for track changed notifications.
Definition: mcc.h:91
int bt_mcc_read_opcodes_supported(struct bt_conn *conn)
Read Opcodes Supported.
void(* bt_mcc_read_track_title_cb)(struct bt_conn *conn, int err, const char *title)
Callback function for bt_mcc_read_track_title()
Definition: mcc.h:103
void(* bt_mcc_read_playback_speed_cb)(struct bt_conn *conn, int err, int8_t speed)
Callback function for bt_mcc_read_playback_speed()
Definition: mcc.h:147
int bt_mcc_read_player_name(struct bt_conn *conn)
Read Media Player Name.
int bt_mcc_read_content_control_id(struct bt_conn *conn)
Read Content Control ID.
void(* bt_mcc_read_track_duration_cb)(struct bt_conn *conn, int err, int32_t dur)
Callback function for bt_mcc_read_track_duration()
Definition: mcc.h:114
int bt_mcc_read_track_title(struct bt_conn *conn)
Read Track Title.
int bt_mcc_init(struct bt_mcc_cb *cb)
Initialize Media Control Client.
int bt_mcc_discover_mcs(struct bt_conn *conn, bool subscribe)
Discover Media Control Service.
int bt_mcc_read_playback_speed(struct bt_conn *conn)
Read Playback speed.
void(* bt_mcc_read_player_name_cb)(struct bt_conn *conn, int err, const char *name)
Callback function for bt_mcc_read_player_name()
Definition: mcc.h:54
int bt_mcc_send_cmd(struct bt_conn *conn, struct mpl_cmd cmd)
Send a command.
void(* bt_mcc_read_icon_url_cb)(struct bt_conn *conn, int err, const char *icon_url)
Callback function for bt_mcc_read_icon_url()
Definition: mcc.h:78
void(* bt_mcc_discover_mcs_cb)(struct bt_conn *conn, int err)
Callback function for bt_mcc_discover_mcs()
Definition: mcc.h:43
void(* bt_mcc_read_opcodes_supported_cb)(struct bt_conn *conn, int err, uint32_t opcodes)
Callback function for bt_mcc_read_opcodes_supported()
Definition: mcc.h:342
void(* bt_mcc_send_cmd_cb)(struct bt_conn *conn, int err, struct mpl_cmd cmd)
Callback function for bt_mcc_send_cmd()
Definition: mcc.h:316
int bt_mcc_read_media_state(struct bt_conn *conn)
Read Media State.
void(* bt_mcc_read_playing_orders_supported_cb)(struct bt_conn *conn, int err, uint16_t orders)
Callback function for bt_mcc_read_playing_orders_supported()
Definition: mcc.h:293
int bt_mcc_set_track_position(struct bt_conn *conn, int32_t pos)
Set Track position.
void(* bt_mcc_read_content_control_id_cb)(struct bt_conn *conn, int err, uint8_t ccid)
Callback function for bt_mcc_read_content_control_id()
Definition: mcc.h:400
int bt_mcc_read_track_position(struct bt_conn *conn)
Read Track Position.
int bt_mcc_read_playing_orders_supported(struct bt_conn *conn)
Read Playing Orders Supported.
void(* bt_mcc_read_playing_order_cb)(struct bt_conn *conn, int err, uint8_t order)
Callback function for bt_mcc_read_playing_order()
Definition: mcc.h:271
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition: ft8xx_reference_api.h:153
state
Definition: http_parser_state.h:30
Buffer management.
static int pos
Definition: printk.c:11
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__INT32_TYPE__ int32_t
Definition: stdint.h:44
__UINT64_TYPE__ uint64_t
Definition: stdint.h:61
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
__INT8_TYPE__ int8_t
Definition: stdint.h:42
Media control client callbacks.
Definition: mcc.h:515
bt_mcc_set_playing_order_cb set_playing_order
Definition: mcc.h:541
bt_mcc_discover_mcs_cb discover_mcs
Definition: mcc.h:516
bt_mcc_read_playing_order_cb read_playing_order
Definition: mcc.h:540
bt_mcc_read_media_state_cb read_media_state
Definition: mcc.h:543
bt_mcc_read_track_title_cb read_track_title
Definition: mcc.h:523
bt_mcc_read_playback_speed_cb read_playback_speed
Definition: mcc.h:527
bt_mcc_set_playback_speed_cb set_playback_speed
Definition: mcc.h:528
bt_mcc_read_seeking_speed_cb read_seeking_speed
Definition: mcc.h:529
bt_mcc_cmd_ntf_cb cmd_ntf
Definition: mcc.h:545
bt_mcc_read_track_duration_cb read_track_duration
Definition: mcc.h:524
bt_mcc_read_icon_url_cb read_icon_url
Definition: mcc.h:521
bt_mcc_send_cmd_cb send_cmd
Definition: mcc.h:544
bt_mcc_read_playing_orders_supported_cb read_playing_orders_supported
Definition: mcc.h:542
bt_mcc_track_changed_ntf_cb track_changed_ntf
Definition: mcc.h:522
bt_mcc_read_track_position_cb read_track_position
Definition: mcc.h:525
bt_mcc_read_opcodes_supported_cb read_opcodes_supported
Definition: mcc.h:546
bt_mcc_read_content_control_id_cb read_content_control_id
Definition: mcc.h:552
bt_mcc_read_player_name_cb read_player_name
Definition: mcc.h:517
bt_mcc_set_track_position_cb set_track_position
Definition: mcc.h:526
Media command notification.
Definition: media_proxy.h:58
Media proxy module.
Definition: media_proxy.h:49
Search.
Definition: media_proxy.h:75
char search[64]
Definition: media_proxy.h:77
Simple network buffer representation.
Definition: buf.h:83