@@ -356,7 +356,8 @@ static struct bt_avdtp_sep *avdtp_get_cmd_sep(struct net_buf *buf, uint8_t *erro
356356 return sep ;
357357}
358358
359- static void avdtp_get_capabilities_cmd (struct bt_avdtp * session , struct net_buf * buf , uint8_t tid )
359+ static void avdtp_get_caps_cmd_internal (struct bt_avdtp * session , struct net_buf * buf , uint8_t tid ,
360+ bool get_all_caps )
360361{
361362 int err = 0 ;
362363 struct net_buf * rsp_buf ;
@@ -369,19 +370,22 @@ static void avdtp_get_capabilities_cmd(struct bt_avdtp *session, struct net_buf
369370 err = - ENOTSUP ;
370371 } else {
371372 rsp_buf = avdtp_create_reply_pdu (BT_AVDTP_ACCEPT , BT_AVDTP_PACKET_TYPE_SINGLE ,
373+ get_all_caps ? BT_AVDTP_GET_ALL_CAPABILITIES :
372374 BT_AVDTP_GET_CAPABILITIES , tid );
373375 if (!rsp_buf ) {
374376 return ;
375377 }
376378
377- err = session -> ops -> get_capabilities_ind (session , sep , rsp_buf , & error_code );
379+ err = session -> ops -> get_capabilities_ind (session , sep , rsp_buf , get_all_caps ,
380+ & error_code );
378381 if (err ) {
379382 net_buf_unref (rsp_buf );
380383 }
381384 }
382385
383386 if (err ) {
384387 rsp_buf = avdtp_create_reply_pdu (BT_AVDTP_REJECT , BT_AVDTP_PACKET_TYPE_SINGLE ,
388+ get_all_caps ? BT_AVDTP_GET_ALL_CAPABILITIES :
385389 BT_AVDTP_GET_CAPABILITIES , tid );
386390 if (!rsp_buf ) {
387391 return ;
@@ -403,6 +407,17 @@ static void avdtp_get_capabilities_cmd(struct bt_avdtp *session, struct net_buf
403407 }
404408}
405409
410+ static void avdtp_get_capabilities_cmd (struct bt_avdtp * session , struct net_buf * buf , uint8_t tid )
411+ {
412+ avdtp_get_caps_cmd_internal (session , buf , tid , false);
413+ }
414+
415+ static void avdtp_get_all_capabilities_cmd (struct bt_avdtp * session ,
416+ struct net_buf * buf , uint8_t tid )
417+ {
418+ avdtp_get_caps_cmd_internal (session , buf , tid , true);
419+ }
420+
406421static void avdtp_get_capabilities_rsp (struct bt_avdtp * session , struct net_buf * buf ,
407422 uint8_t msg_type )
408423{
@@ -1103,19 +1118,19 @@ void bt_avdtp_l2cap_disconnected(struct bt_l2cap_chan *chan)
11031118}
11041119
11051120void (* cmd_handler [])(struct bt_avdtp * session , struct net_buf * buf , uint8_t tid ) = {
1106- avdtp_discover_cmd , /* BT_AVDTP_DISCOVER */
1107- avdtp_get_capabilities_cmd , /* BT_AVDTP_GET_CAPABILITIES */
1108- avdtp_set_configuration_cmd , /* BT_AVDTP_SET_CONFIGURATION */
1109- NULL , /* BT_AVDTP_GET_CONFIGURATION */
1110- avdtp_re_configure_cmd , /* BT_AVDTP_RECONFIGURE */
1111- avdtp_open_cmd , /* BT_AVDTP_OPEN */
1112- avdtp_start_cmd , /* BT_AVDTP_START */
1113- avdtp_close_cmd , /* BT_AVDTP_CLOSE */
1114- avdtp_suspend_cmd , /* BT_AVDTP_SUSPEND */
1115- avdtp_abort_cmd , /* BT_AVDTP_ABORT */
1116- NULL , /* BT_AVDTP_SECURITY_CONTROL */
1117- NULL , /* BT_AVDTP_GET_ALL_CAPABILITIES */
1118- NULL , /* BT_AVDTP_DELAYREPORT */
1121+ avdtp_discover_cmd , /* BT_AVDTP_DISCOVER */
1122+ avdtp_get_capabilities_cmd , /* BT_AVDTP_GET_CAPABILITIES */
1123+ avdtp_set_configuration_cmd , /* BT_AVDTP_SET_CONFIGURATION */
1124+ NULL , /* BT_AVDTP_GET_CONFIGURATION */
1125+ avdtp_re_configure_cmd , /* BT_AVDTP_RECONFIGURE */
1126+ avdtp_open_cmd , /* BT_AVDTP_OPEN */
1127+ avdtp_start_cmd , /* BT_AVDTP_START */
1128+ avdtp_close_cmd , /* BT_AVDTP_CLOSE */
1129+ avdtp_suspend_cmd , /* BT_AVDTP_SUSPEND */
1130+ avdtp_abort_cmd , /* BT_AVDTP_ABORT */
1131+ NULL , /* BT_AVDTP_SECURITY_CONTROL */
1132+ avdtp_get_all_capabilities_cmd , /* BT_AVDTP_GET_ALL_CAPABILITIES */
1133+ NULL , /* BT_AVDTP_DELAYREPORT */
11191134};
11201135
11211136void (* rsp_handler [])(struct bt_avdtp * session , struct net_buf * buf , uint8_t msg_type ) = {
@@ -1130,7 +1145,7 @@ void (*rsp_handler[])(struct bt_avdtp *session, struct net_buf *buf, uint8_t msg
11301145 avdtp_suspend_rsp , /* BT_AVDTP_SUSPEND */
11311146 avdtp_abort_rsp , /* BT_AVDTP_ABORT */
11321147 NULL , /* BT_AVDTP_SECURITY_CONTROL */
1133- NULL , /* BT_AVDTP_GET_ALL_CAPABILITIES */
1148+ avdtp_get_capabilities_rsp , /* BT_AVDTP_GET_ALL_CAPABILITIES */
11341149 NULL , /* BT_AVDTP_DELAYREPORT */
11351150};
11361151
@@ -1436,6 +1451,7 @@ int bt_avdtp_get_capabilities(struct bt_avdtp *session,
14361451 }
14371452
14381453 buf = avdtp_create_pdu (BT_AVDTP_CMD , BT_AVDTP_PACKET_TYPE_SINGLE ,
1454+ param -> get_all_caps ? BT_AVDTP_GET_ALL_CAPABILITIES :
14391455 BT_AVDTP_GET_CAPABILITIES );
14401456 if (!buf ) {
14411457 LOG_ERR ("Error: No Buff available" );
0 commit comments