Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
avrcp.h
Go to the documentation of this file.
1
4
5/*
6 * Copyright (c) 2015-2016 Intel Corporation
7 * Copyright (C) 2024 Xiaomi Corporation
8 *
9 * SPDX-License-Identifier: Apache-2.0
10 */
11
12#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AVRCP_H_
13#define ZEPHYR_INCLUDE_BLUETOOTH_AVRCP_H_
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19#define BT_AVRCP_COMPANY_ID_SIZE (3)
20#define BT_AVRCP_COMPANY_ID_BLUETOOTH_SIG (0x001958)
21
27
44
53
65
71
73typedef enum __packed {
88
102
112
126
129
137
143
261
263struct bt_avrcp_ct;
265struct bt_avrcp_tg;
266
271
278
279#define BT_AVRCP_PASSTHROUGH_GET_STATE(payload) \
280 ((bt_avrcp_button_state_t)(FIELD_GET(BIT(7), ((payload)->byte0))))
281#define BT_AVRCP_PASSTHROUGH_GET_OPID(payload) \
282 ((bt_avrcp_opid_t)(FIELD_GET(GENMASK(6, 0), ((payload)->byte0))))
283
289
295
297typedef enum __packed {
300
306
316
326 void (*connected)(struct bt_conn *conn, struct bt_avrcp_ct *ct);
327
335 void (*disconnected)(struct bt_avrcp_ct *ct);
336
345 void (*browsing_connected)(struct bt_conn *conn, struct bt_avrcp_ct *ct);
346
354 void (*browsing_disconnected)(struct bt_avrcp_ct *ct);
355
364 void (*get_cap_rsp)(struct bt_avrcp_ct *ct, uint8_t tid,
365 const struct bt_avrcp_get_cap_rsp *rsp);
366
375 void (*unit_info_rsp)(struct bt_avrcp_ct *ct, uint8_t tid,
376 struct bt_avrcp_unit_info_rsp *rsp);
377
386 void (*subunit_info_rsp)(struct bt_avrcp_ct *ct, uint8_t tid,
387 struct bt_avrcp_subunit_info_rsp *rsp);
388
398 void (*passthrough_rsp)(struct bt_avrcp_ct *ct, uint8_t tid, bt_avrcp_rsp_t result,
399 const struct bt_avrcp_passthrough_rsp *rsp);
400
412 void (*browsed_player_rsp)(struct bt_avrcp_ct *ct, uint8_t tid, struct net_buf *buf);
413};
414
426int bt_avrcp_connect(struct bt_conn *conn);
427
436int bt_avrcp_disconnect(struct bt_conn *conn);
437
450
460int bt_avrcp_browsing_connect(struct bt_conn *conn);
461
470int bt_avrcp_browsing_disconnect(struct bt_conn *conn);
471
481
492int bt_avrcp_ct_get_cap(struct bt_avrcp_ct *ct, uint8_t tid, uint8_t cap_id);
493
503int bt_avrcp_ct_get_unit_info(struct bt_avrcp_ct *ct, uint8_t tid);
504
515int bt_avrcp_ct_get_subunit_info(struct bt_avrcp_ct *ct, uint8_t tid);
516
531int bt_avrcp_ct_passthrough(struct bt_avrcp_ct *ct, uint8_t tid, uint8_t opid, uint8_t state,
532 const uint8_t *payload, uint8_t len);
533
544int bt_avrcp_ct_set_browsed_player(struct bt_avrcp_ct *ct, uint8_t tid, uint16_t player_id);
545
555 void (*connected)(struct bt_conn *conn, struct bt_avrcp_tg *tg);
556
564 void (*disconnected)(struct bt_avrcp_tg *tg);
565
573 void (*unit_info_req)(struct bt_avrcp_tg *tg, uint8_t tid);
574
583 void (*browsing_connected)(struct bt_conn *conn, struct bt_avrcp_tg *tg);
584
592 void (*browsing_disconnected)(struct bt_avrcp_tg *tg);
593
602 void (*set_browsed_player_req)(struct bt_avrcp_tg *tg, uint8_t tid, uint16_t player_id);
603};
604
614
625int bt_avrcp_tg_send_unit_info_rsp(struct bt_avrcp_tg *tg, uint8_t tid,
626 struct bt_avrcp_unit_info_rsp *rsp);
627
638int bt_avrcp_tg_send_set_browsed_player_rsp(struct bt_avrcp_tg *tg, uint8_t tid,
639 struct net_buf *buf);
640#ifdef __cplusplus
641}
642#endif
643
644#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AVRCP_H_ */
int bt_avrcp_ct_get_unit_info(struct bt_avrcp_ct *ct, uint8_t tid)
Get AVRCP Unit Info.
bt_avrcp_button_state_t
AVRCP button state flag.
Definition avrcp.h:139
@ BT_AVRCP_BUTTON_RELEASED
Definition avrcp.h:141
@ BT_AVRCP_BUTTON_PRESSED
Definition avrcp.h:140
int bt_avrcp_ct_passthrough(struct bt_avrcp_ct *ct, uint8_t tid, uint8_t opid, uint8_t state, const uint8_t *payload, uint8_t len)
Send AVRCP Pass Through command.
bt_avrcp_ctype_t
AV/C command types.
Definition avrcp.h:46
@ BT_AVRCP_CTYPE_GENERAL_INQUIRY
Definition avrcp.h:51
@ BT_AVRCP_CTYPE_CONTROL
Definition avrcp.h:47
@ BT_AVRCP_CTYPE_STATUS
Definition avrcp.h:48
@ BT_AVRCP_CTYPE_SPECIFIC_INQUIRY
Definition avrcp.h:49
@ BT_AVRCP_CTYPE_NOTIFY
Definition avrcp.h:50
int bt_avrcp_ct_get_cap(struct bt_avrcp_ct *ct, uint8_t tid, uint8_t cap_id)
Get AVRCP Capabilities.
bt_avrcp_opid_t
AV/C operation ids used in AVRCP passthrough commands.
Definition avrcp.h:73
@ BT_AVRCP_OPID_ROOT_MENU
Definition avrcp.h:83
@ BT_AVRCP_OPID_BACKWARD
Definition avrcp.h:125
@ BT_AVRCP_OPID_FORWARD
Definition avrcp.h:124
@ BT_AVRCP_OPID_F4
Definition avrcp.h:133
@ BT_AVRCP_OPID_6
Definition avrcp.h:95
@ BT_AVRCP_OPID_9
Definition avrcp.h:98
@ BT_AVRCP_OPID_DOWN
Definition avrcp.h:76
@ BT_AVRCP_OPID_PAUSE
Definition avrcp.h:119
@ BT_AVRCP_OPID_F3
Definition avrcp.h:132
@ BT_AVRCP_OPID_SOUND_SELECT
Definition avrcp.h:106
@ BT_AVRCP_OPID_4
Definition avrcp.h:93
@ BT_AVRCP_OPID_ENTER
Definition avrcp.h:100
@ BT_AVRCP_OPID_CHANNEL_DOWN
Definition avrcp.h:104
@ BT_AVRCP_OPID_PAGE_DOWN
Definition avrcp.h:111
@ BT_AVRCP_OPID_PREVIOUS_CHANNEL
Definition avrcp.h:105
@ BT_AVRCP_OPID_FAVORITE_MENU
Definition avrcp.h:86
@ BT_AVRCP_OPID_VOLUME_DOWN
Definition avrcp.h:115
@ BT_AVRCP_OPID_REWIND
Definition avrcp.h:121
@ BT_AVRCP_OPID_MUTE
Definition avrcp.h:116
@ BT_AVRCP_OPID_DOT
Definition avrcp.h:99
@ BT_AVRCP_OPID_RIGHT_DOWN
Definition avrcp.h:80
@ BT_AVRCP_OPID_LEFT_DOWN
Definition avrcp.h:82
@ BT_AVRCP_OPID_STOP
Definition avrcp.h:118
@ BT_AVRCP_OPID_FAST_FORWARD
Definition avrcp.h:122
@ BT_AVRCP_OPID_LEFT
Definition avrcp.h:77
@ BT_AVRCP_OPID_DISPLAY_INFORMATION
Definition avrcp.h:108
@ BT_AVRCP_OPID_SETUP_MENU
Definition avrcp.h:84
@ BT_AVRCP_OPID_RIGHT_UP
Definition avrcp.h:79
@ BT_AVRCP_OPID_RECORD
Definition avrcp.h:120
@ BT_AVRCP_OPID_LEFT_UP
Definition avrcp.h:81
@ BT_AVRCP_OPID_F5
Definition avrcp.h:134
@ BT_AVRCP_OPID_F2
Definition avrcp.h:131
@ BT_AVRCP_OPID_INPUT_SELECT
Definition avrcp.h:107
@ BT_AVRCP_OPID_RIGHT
Definition avrcp.h:78
@ BT_AVRCP_OPID_F1
Definition avrcp.h:130
@ BT_AVRCP_OPID_5
Definition avrcp.h:94
@ BT_AVRCP_OPID_PAGE_UP
Definition avrcp.h:110
@ BT_AVRCP_OPID_1
Definition avrcp.h:90
@ BT_AVRCP_OPID_POWER
Definition avrcp.h:113
@ BT_AVRCP_OPID_EXIT
Definition avrcp.h:87
@ BT_AVRCP_OPID_CONTENTS_MENU
Definition avrcp.h:85
@ BT_AVRCP_OPID_7
Definition avrcp.h:96
@ BT_AVRCP_OPID_UP
Definition avrcp.h:75
@ BT_AVRCP_OPID_HELP
Definition avrcp.h:109
@ BT_AVRCP_OPID_SUBPICTURE
Definition avrcp.h:128
@ BT_AVRCP_OPID_8
Definition avrcp.h:97
@ BT_AVRCP_OPID_2
Definition avrcp.h:91
@ BT_AVRCP_OPID_SELECT
Definition avrcp.h:74
@ BT_AVRCP_OPID_CHANNEL_UP
Definition avrcp.h:103
@ BT_AVRCP_OPID_VENDOR_UNIQUE
Definition avrcp.h:135
@ BT_AVRCP_OPID_EJECT
Definition avrcp.h:123
@ BT_AVRCP_OPID_CLEAR
Definition avrcp.h:101
@ BT_AVRCP_OPID_0
Definition avrcp.h:89
@ BT_AVRCP_OPID_PLAY
Definition avrcp.h:117
@ BT_AVRCP_OPID_3
Definition avrcp.h:92
@ BT_AVRCP_OPID_VOLUME_UP
Definition avrcp.h:114
@ BT_AVRCP_OPID_ANGLE
Definition avrcp.h:127
int bt_avrcp_ct_get_subunit_info(struct bt_avrcp_ct *ct, uint8_t tid)
Get AVRCP Subunit Info.
bt_avrcp_status_t
AVRCP status and error codes.
Definition avrcp.h:149
@ BT_AVRCP_STATUS_NO_VALID_SEARCH_RESULTS
No valid search results.
Definition avrcp.h:249
@ BT_AVRCP_STATUS_UID_CHANGED
The UIDs on the device have changed.
Definition avrcp.h:178
@ BT_AVRCP_STATUS_INVALID_COMMAND
Invalid command.
Definition avrcp.h:153
@ BT_AVRCP_STATUS_PLAYER_NOT_BROWSABLE
Player not browsable.
Definition avrcp.h:239
@ BT_AVRCP_STATUS_FOLDER_ITEM_IS_NOT_PLAYABLE
Folder item is not playable.
Definition avrcp.h:209
@ BT_AVRCP_STATUS_NOW_PLAYING_LIST_FULL
Now Playing List full.
Definition avrcp.h:219
@ BT_AVRCP_STATUS_PLAYER_NOT_ADDRESSED
Player not addressed.
Definition avrcp.h:244
@ BT_AVRCP_STATUS_SEARCH_IN_PROGRESS
Search in progress.
Definition avrcp.h:229
@ BT_AVRCP_STATUS_ADDRESSED_PLAYER_CHANGED
Addressed player changed.
Definition avrcp.h:259
@ BT_AVRCP_STATUS_INVALID_DIRECTION
The Direction parameter is invalid.
Definition avrcp.h:183
@ BT_AVRCP_STATUS_SEARCH_NOT_SUPPORTED
Search not supported.
Definition avrcp.h:224
@ BT_AVRCP_STATUS_NO_AVAILABLE_PLAYERS
No available players.
Definition avrcp.h:254
@ BT_AVRCP_STATUS_INVALID_PLAYER_ID
The specified Player Id does not refer to a valid player.
Definition avrcp.h:234
@ BT_AVRCP_STATUS_NOT_A_DIRECTORY
The UID provided does not refer to a folder item.
Definition avrcp.h:188
@ BT_AVRCP_STATUS_PARAMETER_CONTENT_ERROR
Parameter content error.
Definition avrcp.h:163
@ BT_AVRCP_STATUS_RANGE_OUT_OF_BOUNDS
Range out of bounds.
Definition avrcp.h:204
@ BT_AVRCP_STATUS_INVALID_PARAMETER
Invalid parameter.
Definition avrcp.h:158
@ BT_AVRCP_STATUS_DOES_NOT_EXIST
The UID provided does not refer to any currently valid item.
Definition avrcp.h:193
@ BT_AVRCP_STATUS_INVALID_SCOPE
Invalid scope.
Definition avrcp.h:199
@ BT_AVRCP_STATUS_OPERATION_COMPLETED
Operation completed without error.
Definition avrcp.h:173
@ BT_AVRCP_STATUS_MEDIA_IN_USE
Media in use.
Definition avrcp.h:214
@ BT_AVRCP_STATUS_INTERNAL_ERROR
Internal error.
Definition avrcp.h:168
int bt_avrcp_connect(struct bt_conn *conn)
Connect AVRCP.
int bt_avrcp_ct_register_cb(const struct bt_avrcp_ct_cb *cb)
Register callback.
bt_avrcp_subunit_type_t
AV/C subunit type, also used for unit type.
Definition avrcp.h:67
@ BT_AVRCP_SUBUNIT_TYPE_PANEL
Definition avrcp.h:68
@ BT_AVRCP_SUBUNIT_TYPE_UNIT
Definition avrcp.h:69
int bt_avrcp_tg_register_cb(const struct bt_avrcp_tg_cb *cb)
Register callback.
int bt_avrcp_disconnect(struct bt_conn *conn)
Disconnect AVRCP.
bt_avrcp_charset_t
AVRCP Character Set IDs.
Definition avrcp.h:297
@ BT_AVRCP_CHARSET_UTF8
Definition avrcp.h:298
int bt_avrcp_browsing_disconnect(struct bt_conn *conn)
Disconnect AVRCP browsing channel.
int bt_avrcp_ct_set_browsed_player(struct bt_avrcp_ct *ct, uint8_t tid, uint16_t player_id)
Set browsed player.
bt_avrcp_rsp_t
AV/C response codes.
Definition avrcp.h:55
@ BT_AVRCP_RSP_REJECTED
Definition avrcp.h:58
@ BT_AVRCP_RSP_ACCEPTED
Definition avrcp.h:57
@ BT_AVRCP_RSP_STABLE
For STATUS commands.
Definition avrcp.h:61
@ BT_AVRCP_RSP_INTERIM
Definition avrcp.h:63
@ BT_AVRCP_RSP_NOT_IMPLEMENTED
Definition avrcp.h:56
@ BT_AVRCP_RSP_IMPLEMENTED
For SPECIFIC_INQUIRY and GENERAL_INQUIRY commands.
Definition avrcp.h:60
@ BT_AVRCP_RSP_IN_TRANSITION
Definition avrcp.h:59
@ BT_AVRCP_RSP_CHANGED
Definition avrcp.h:62
bt_avrcp_cap_t
AVRCP Capability ID.
Definition avrcp.h:23
@ BT_AVRCP_CAP_EVENTS_SUPPORTED
Definition avrcp.h:25
@ BT_AVRCP_CAP_COMPANY_ID
Definition avrcp.h:24
struct net_buf * bt_avrcp_create_pdu(struct net_buf_pool *pool)
Allocate a net_buf for AVRCP PDU transmission, reserving headroom for AVRCP, AVRCTP,...
int bt_avrcp_browsing_connect(struct bt_conn *conn)
Connect AVRCP browsing channel.
int bt_avrcp_tg_send_set_browsed_player_rsp(struct bt_avrcp_tg *tg, uint8_t tid, struct net_buf *buf)
Send the set browsed player response.
int bt_avrcp_tg_send_unit_info_rsp(struct bt_avrcp_tg *tg, uint8_t tid, struct bt_avrcp_unit_info_rsp *rsp)
Send the unit info response.
bt_avrcp_evt_t
AVRCP Notification Events.
Definition avrcp.h:29
@ BT_AVRCP_EVT_TRACK_CHANGED
Definition avrcp.h:31
@ BT_AVRCP_EVT_TRACK_REACHED_END
Definition avrcp.h:32
@ BT_AVRCP_EVT_PLAYBACK_STATUS_CHANGED
Definition avrcp.h:30
@ BT_AVRCP_EVT_UIDS_CHANGED
Definition avrcp.h:41
@ BT_AVRCP_EVT_VOLUME_CHANGED
Definition avrcp.h:42
@ BT_AVRCP_EVT_BATT_STATUS_CHANGED
Definition avrcp.h:35
@ BT_AVRCP_EVT_PLAYER_APP_SETTING_CHANGED
Definition avrcp.h:37
@ BT_AVRCP_EVT_ADDRESSED_PLAYER_CHANGED
Definition avrcp.h:40
@ BT_AVRCP_EVT_AVAILABLE_PLAYERS_CHANGED
Definition avrcp.h:39
@ BT_AVRCP_EVT_NOW_PLAYING_CONTENT_CHANGED
Definition avrcp.h:38
@ BT_AVRCP_EVT_SYSTEM_STATUS_CHANGED
Definition avrcp.h:36
@ BT_AVRCP_EVT_TRACK_REACHED_START
Definition avrcp.h:33
@ BT_AVRCP_EVT_PLAYBACK_POS_CHANGED
Definition avrcp.h:34
state
Definition parser_state.h:29
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Definition avrcp.h:317
void(* connected)(struct bt_conn *conn, struct bt_avrcp_ct *ct)
An AVRCP CT connection has been established.
Definition avrcp.h:326
void(* browsing_connected)(struct bt_conn *conn, struct bt_avrcp_ct *ct)
An AVRCP CT browsing connection has been established.
Definition avrcp.h:345
void(* subunit_info_rsp)(struct bt_avrcp_ct *ct, uint8_t tid, struct bt_avrcp_subunit_info_rsp *rsp)
Callback function for bt_avrcp_get_subunit_info().
Definition avrcp.h:386
void(* passthrough_rsp)(struct bt_avrcp_ct *ct, uint8_t tid, bt_avrcp_rsp_t result, const struct bt_avrcp_passthrough_rsp *rsp)
Callback function for bt_avrcp_passthrough().
Definition avrcp.h:398
void(* disconnected)(struct bt_avrcp_ct *ct)
An AVRCP CT connection has been disconnected.
Definition avrcp.h:335
void(* browsed_player_rsp)(struct bt_avrcp_ct *ct, uint8_t tid, struct net_buf *buf)
Callback function for bt_avrcp_ct_set_browsed_player().
Definition avrcp.h:412
void(* unit_info_rsp)(struct bt_avrcp_ct *ct, uint8_t tid, struct bt_avrcp_unit_info_rsp *rsp)
Callback function for bt_avrcp_get_unit_info().
Definition avrcp.h:375
void(* browsing_disconnected)(struct bt_avrcp_ct *ct)
An AVRCP CT browsing connection has been disconnected.
Definition avrcp.h:354
void(* get_cap_rsp)(struct bt_avrcp_ct *ct, uint8_t tid, const struct bt_avrcp_get_cap_rsp *rsp)
Callback function for bt_avrcp_get_cap().
Definition avrcp.h:364
get folder name (response)
Definition avrcp.h:302
uint8_t folder_name[]
Definition avrcp.h:304
uint16_t folder_name_len
Definition avrcp.h:303
Definition avrcp.h:290
uint8_t cap_cnt
number of items contained in *cap
Definition avrcp.h:292
uint8_t cap[]
1 or 3 octets each depends on cap_id
Definition avrcp.h:293
uint8_t cap_id
bt_avrcp_cap_t
Definition avrcp.h:291
Definition avrcp.h:284
uint8_t byte0
[7]: state_flag, [6:0]: opid
Definition avrcp.h:285
uint8_t data_len
Definition avrcp.h:286
uint8_t data[]
Definition avrcp.h:287
Set browsed player response structure.
Definition avrcp.h:308
uint16_t uid_counter
UID counter.
Definition avrcp.h:310
uint16_t charset_id
Character set ID.
Definition avrcp.h:312
uint8_t status
Status see bt_avrcp_status_t.
Definition avrcp.h:309
struct bt_avrcp_folder_name folder_names[0]
Folder names data.
Definition avrcp.h:314
uint32_t num_items
Number of items in the folder.
Definition avrcp.h:311
uint8_t folder_depth
Folder depth.
Definition avrcp.h:313
Definition avrcp.h:272
const uint8_t * extended_subunit_id
contains max_subunit_id items
Definition avrcp.h:276
bt_avrcp_subunit_type_t subunit_type
Definition avrcp.h:273
const uint8_t * extended_subunit_type
contains max_subunit_id items
Definition avrcp.h:275
uint8_t max_subunit_id
Definition avrcp.h:274
Definition avrcp.h:546
void(* browsing_connected)(struct bt_conn *conn, struct bt_avrcp_tg *tg)
An AVRCP TG browsing connection has been established.
Definition avrcp.h:583
void(* connected)(struct bt_conn *conn, struct bt_avrcp_tg *tg)
An AVRCP TG connection has been established.
Definition avrcp.h:555
void(* unit_info_req)(struct bt_avrcp_tg *tg, uint8_t tid)
Unit info request callback.
Definition avrcp.h:573
void(* disconnected)(struct bt_avrcp_tg *tg)
An AVRCP TG connection has been disconnected.
Definition avrcp.h:564
void(* set_browsed_player_req)(struct bt_avrcp_tg *tg, uint8_t tid, uint16_t player_id)
Set browsed player request callback.
Definition avrcp.h:602
void(* browsing_disconnected)(struct bt_avrcp_tg *tg)
An AVRCP TG browsing connection has been disconnected.
Definition avrcp.h:592
Definition avrcp.h:267
uint32_t company_id
Definition avrcp.h:269
bt_avrcp_subunit_type_t unit_type
Definition avrcp.h:268
Network buffer pool representation.
Definition net_buf.h:1079
Network buffer representation.
Definition net_buf.h:1006
uint16_t len
Length of the data behind the data pointer.
Definition net_buf.h:1035