@@ -477,6 +477,7 @@ ble_svc_audio_bass_modify_source(uint8_t *data, uint16_t data_len, uint16_t conn
477477 .status = 0
478478 }
479479 };
480+ uint8_t * metadata_ptr ;
480481 uint8_t offset = 0 ;
481482 int rc = 0 ;
482483 int i ;
@@ -518,6 +519,16 @@ ble_svc_audio_bass_modify_source(uint8_t *data, uint16_t data_len, uint16_t conn
518519 for (i = 0 ; i < operation .modify_source .num_subgroups ; i ++ ) {
519520 operation .modify_source .bis_sync [i ] = get_le32 (& data [offset ]);
520521 offset += 4 ;
522+ operation .modify_source .subgroups [i ].metadata_length = data [offset ++ ];
523+ data_len -= 5 ;
524+ if (data_len < operation .modify_source .subgroups [i ].metadata_length ) {
525+ rc = BLE_ATT_ERR_WRITE_REQ_REJECTED ;
526+ ev .bass_operation_status .status = BLE_HS_ERJECT ;
527+ goto done ;
528+ }
529+ operation .modify_source .subgroups [i ].metadata = & data [offset ];
530+ offset += operation_modify_source .subgroups [i ].metadata_length ;
531+ data_len -= operation .modify_source .subgroups [i ].metadata_length ;
521532 }
522533
523534 if (check_bis_sync (operation .modify_source .num_subgroups ,
@@ -527,6 +538,18 @@ ble_svc_audio_bass_modify_source(uint8_t *data, uint16_t data_len, uint16_t conn
527538 goto done ;
528539 }
529540
541+ for (i = 0 ; i < operation .modify_source .num_subgroups ; i ++ ) {
542+ metadata_ptr = os_memblock_get (& ble_audio_svc_bass_metadata_pool );
543+ if (metadata_ptr == NULL ) {
544+ rc = BLE_HS_ENOMEM ;
545+ ev .bass_operation_status .status = BLE_HS_ENOMEM ;
546+ goto done ;
547+ }
548+ memcpy (metadata_ptr , operation .modify_source .subgroups [i ].metadata ,
549+ min (operation .modify_source .subgroups [i ].metadata_length ,
550+ MYNEWT_VAL (BLE_SVC_AUDIO_BASS_METADATA_MAX_SZ )));
551+ }
552+
530553 if (accept_fn .ctrl_point_ev_fn ) {
531554 rc = accept_fn .ctrl_point_ev_fn (& operation , accept_fn .arg );
532555 if (rc != 0 ) {
@@ -542,7 +565,6 @@ ble_svc_audio_bass_modify_source(uint8_t *data, uint16_t data_len, uint16_t conn
542565 if (!rc ) {
543566 rc = ble_svc_audio_bass_receive_state_notify (rcv_state );
544567 ev .bass_operation_status .status = rc ;
545- goto done ;
546568 }
547569
548570 ble_audio_event_listener_call (& ev );
0 commit comments