-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Bluetooth: Classic: AVRCP: Support vendor dependent cmd #96273
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
Open
makeshi
wants to merge
4
commits into
zephyrproject-rtos:main
Choose a base branch
from
nxp-upstream:br_avrcp_vendor_dependent_cmd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+7,332
−1,065
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d50ad68
Bluetooth: AVCTP: Fix payload length check in avctp_tx_processor
makeshi 541c729
bluetooth: avrcp: Add vendor-dependent with fragmentation support
makeshi 52d91a8
Bluetooth: AVRCP: Add support for notification events
makeshi 660cae6
bluetooth: avrcp: Add support for vendor dependent commands
makeshi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -690,6 +690,26 @@ struct bt_avrcp_event_data { | |
}; | ||
}; | ||
|
||
/** @brief Callback function type for AVRCP event notifications for event changed. | ||
* | ||
* This callback is invoked by the AVRCP Target (TG) when a registered event | ||
* occurs and a "changed" notification needs to be sent to the Controller (CT). | ||
* | ||
* For interim and rejected error cases, the callback will trigger the | ||
* `notification_rsp` function registered by the Controller | ||
|
||
* @param event_id The AVRCP event identifier. @ref bt_avrcp_event_data | ||
* This corresponds to one of the AVRCP event types such as | ||
* EVENT_PLAYBACK_STATUS_CHANGED, EVENT_TRACK_CHANGED, etc. | ||
* | ||
* @param data Pointer to @ref bt_avrcp_event_data structure containing the event-specific | ||
* data. The content of the union depends on the event_id. | ||
* | ||
* @note The callback implementation should not block or perform heavy operations. | ||
* If needed, defer processing to another thread or task. | ||
*/ | ||
typedef void(*bt_avrcp_notification_cb_t)(uint8_t event_id, struct bt_avrcp_event_data *data); | ||
|
||
struct bt_avrcp_ct_cb { | ||
/** @brief An AVRCP CT connection has been established. | ||
* | ||
|
@@ -797,6 +817,34 @@ struct bt_avrcp_ct_cb { | |
* big-endian format. | ||
*/ | ||
void (*browsed_player_rsp)(struct bt_avrcp_ct *ct, uint8_t tid, struct net_buf *buf); | ||
|
||
/** @brief Callback function for Event Notification response (CT). | ||
* | ||
* Called when the AVRCP Target (TG) sends a response to a previously | ||
* registered event (Register Notification). This callback reports the | ||
* event type, the response phase (e.g., Interim), and the event-specific | ||
* payload. | ||
* | ||
* @param ct AVRCP Controller (CT) connection context. | ||
* @param tid Transaction label that correlates this notification | ||
* with the original Register Notification request. | ||
* @param status TG status/phase code (BT_AVRCP_STATUS_*). Typically | ||
* BT_AVRCP_STATUS_SUCCESS for an interim notification. | ||
* Error codes may be returned for invalid parameters or | ||
* unsupported events. | ||
* @param event_id The AVRCP event identifier. @ref bt_avrcp_event_data | ||
* This corresponds to one of the AVRCP event types such as | ||
* EVENT_PLAYBACK_STATUS_CHANGED, EVENT_TRACK_CHANGED, etc. | ||
* | ||
* @param data Pointer to @ref bt_avrcp_event_data structure containing the | ||
* event-specific data. The content of the union depends on the event_id. | ||
* | ||
* @note This callback is only invoked for interim notifications and error | ||
* statuses from the TG. For CHANGED event notifications, the event must | ||
* first be registered using @ref bt_avrcp_notification_cb_t. | ||
*/ | ||
void (*notification_rsp)(struct bt_avrcp_ct *ct, uint8_t tid, uint8_t status, | ||
uint8_t event_id, struct bt_avrcp_event_data *data); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO, suggest to callback |
||
}; | ||
|
||
/** @brief Connect AVRCP. | ||
|
@@ -945,6 +993,23 @@ int bt_avrcp_ct_passthrough(struct bt_avrcp_ct *ct, uint8_t tid, uint8_t opid, u | |
*/ | ||
int bt_avrcp_ct_set_browsed_player(struct bt_avrcp_ct *ct, uint8_t tid, uint16_t player_id); | ||
|
||
/** @brief Register for AVRCP changed notifications with callback. | ||
* | ||
* This function registers for notifications from the target device. | ||
* The notification response will be received through the provided callback function. | ||
* | ||
* @param ct The AVRCP CT instance. | ||
* @param tid The transaction label of the response, valid from 0 to 15. | ||
* @param event_id The event ID to register for, see @ref bt_avrcp_evt_t. | ||
* @param interval The playback interval for position changed events. | ||
* Other events will have this value set to 0 to ignore. | ||
* @param cb The callback function to handle the changed notification response. | ||
* | ||
* @return 0 in case of success or error code in case of error. | ||
*/ | ||
int bt_avrcp_ct_register_notification(struct bt_avrcp_ct *ct, uint8_t tid, uint8_t event_id, | ||
uint32_t interval, bt_avrcp_notification_cb_t cb); | ||
|
||
struct bt_avrcp_tg_cb { | ||
/** @brief An AVRCP TG connection has been established. | ||
* | ||
|
@@ -974,6 +1039,19 @@ struct bt_avrcp_tg_cb { | |
*/ | ||
void (*unit_info_req)(struct bt_avrcp_tg *tg, uint8_t tid); | ||
|
||
/** @brief Register notification request callback. | ||
* | ||
* This callback is called whenever an AVRCP register notification is requested. | ||
* | ||
* @param tg AVRCP TG connection object. | ||
* @param tid The transaction label of the request. | ||
* @param event_id The event ID that the CT wants to register for @ref bt_avrcp_evt_t. | ||
* @param interval The playback interval for position changed event. | ||
* other events will have this value set to 0 for ingnoring. | ||
*/ | ||
void (*register_notification_req)(struct bt_avrcp_tg *tg, uint8_t tid, uint8_t event_id, | ||
uint32_t interval); | ||
|
||
/** @brief Subunit Info Request callback. | ||
* | ||
* This callback is called whenever an AVRCP subunit info is requested. | ||
|
@@ -1086,6 +1164,33 @@ int bt_avrcp_tg_send_subunit_info_rsp(struct bt_avrcp_tg *tg, uint8_t tid); | |
int bt_avrcp_tg_send_get_caps_rsp(struct bt_avrcp_tg *tg, uint8_t tid, uint8_t status, | ||
struct net_buf *buf); | ||
|
||
/** @brief Send notification response. | ||
* | ||
* This function sends a notification response from the AVRCP Target (TG) to | ||
* the Controller (CT) for a previously registered event. The response can be: | ||
* | ||
* - **INTERIM**: Sent on the first call for the given @p event_id to indicate | ||
* that the event is being monitored. | ||
* - **CHANGED**: Sent on the next call for the same @p event_id when the event | ||
* state has changed. | ||
* | ||
* @param tg The AVRCP TG instance. | ||
* @param tid The transaction label of the response, valid from 0 to 15. | ||
* @param status Status code of the operation @ref bt_avrcp_status_t. | ||
* @param event_id The AVRCP event ID for which the notification is sent, @ref bt_avrcp_evt_t. | ||
* @param data Pointer to an bt_avrcp_event_data structure containing the event-specific | ||
* data. The content of the union depends on the event_id. | ||
* | ||
* @return 0 in case of success or error code in case of error. | ||
* | ||
* @note | ||
* - The first successful call for a given @p event_id sends an INTERIM response. | ||
* - The next successful call for the same @p event_id sends a CHANGED response. | ||
* - If @p status is not SUCCESS, a REJECTED or NOT_IMPLEMENTED response is sent. | ||
*/ | ||
int bt_avrcp_tg_send_notification_rsp(struct bt_avrcp_tg *tg, uint8_t tid, uint8_t status, | ||
uint8_t event_id, struct bt_avrcp_event_data *data); | ||
|
||
/** @brief Send the set browsed player response. | ||
* | ||
* This function is called by the application to send the set browsed player response. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, suggest:
typedef void(*bt_avrcp_notification_cb_t)(uint8_t event_id, bool changed, struct bt_avrcp_event_data *data);
then all the event data related callback is here.