Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: AVRCP: Implement unit message reception on the AVRCP target #85917

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions include/zephyr/bluetooth/classic/avrcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ typedef enum __packed {
BT_AVRCP_RSP_INTERIM = 0xf,
} bt_avrcp_rsp_t;

/** @brief AV/C subunit type, also used for unit type */
typedef enum __packed {
BT_AVRCP_SUBUNIT_TYPE_PANEL = 0x9,
BT_AVRCP_SUBUNIT_TYPE_UNIT = 0x1F,
} bt_avrcp_subunit_type_t;

/** @brief AV/C operation ids used in AVRCP passthrough commands */
typedef enum __packed {
BT_AVRCP_OPID_SELECT = 0x00,
Expand Down Expand Up @@ -113,12 +119,12 @@ typedef enum __packed {
struct bt_avrcp;

struct bt_avrcp_unit_info_rsp {
uint8_t unit_type;
bt_avrcp_subunit_type_t unit_type;
uint32_t company_id;
};

struct bt_avrcp_subunit_info_rsp {
uint8_t subunit_type;
bt_avrcp_subunit_type_t subunit_type;
uint8_t max_subunit_id;
const uint8_t *extended_subunit_type; /**< contains max_subunit_id items */
const uint8_t *extended_subunit_id; /**< contains max_subunit_id items */
Expand Down Expand Up @@ -177,6 +183,14 @@ struct bt_avrcp_cb {
* @param rsp The response for PASS THROUGH command.
*/
void (*passthrough_rsp)(struct bt_avrcp *avrcp, struct bt_avrcp_passthrough_rsp *rsp);

/** @brief Unit info request callback.
*
* This callback is called whenever an AVRCP unit info is requested.
*
* @param avrcp AVRCP connection object.
*/
void (*unit_info_req)(struct bt_avrcp *avrcp);
};

/** @brief Connect AVRCP.
Expand Down Expand Up @@ -249,6 +263,16 @@ int bt_avrcp_get_subunit_info(struct bt_avrcp *avrcp);
int bt_avrcp_passthrough(struct bt_avrcp *avrcp, bt_avrcp_opid_t operation_id,
bt_avrcp_button_state_t state, const uint8_t *payload, uint8_t len);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set -> Send?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also okay to use "send". I use set because I want it to correspond to the above API bt_avrcp_get_unit_info.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also okay to use "send". I use set because I want it to correspond to the above API bt_avrcp_get_unit_info.

I think set usualy means to provide a value and save at the local device, or set a configuration to the remote.
However, this interface is to inform the remote device, rather than a configuration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, Here using "Send" here can indeed better express the actual meaning than "Set" for this function. I'll update the comments and the function name.


/** @brief Send the unit info response.
*
* This function is called by the application to send the unit info response.
*
* @param avrcp The AVRCP instance.
* @param rsp The response for UNIT INFO command.
*
* @return 0 in case of success or error code in case of error.
*/
int bt_avrcp_send_unit_info_rsp(struct bt_avrcp *avrcp, struct bt_avrcp_unit_info_rsp *rsp);
#ifdef __cplusplus
}
#endif
Expand Down
Loading
Loading