Skip to content

Commit

Permalink
Added the primary/rentramist slot type to the audio callback (zephyrp…
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-whisper authored and Nahal Farhi committed Aug 3, 2022
1 parent 5444bac commit c608b2f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 8 additions & 2 deletions subsys/bluetooth/controller/ll_sw/ull_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,8 +1060,14 @@ int ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx)
// *** Whisper added for MFI. MFI audio packets come in with the reserved
// LLID. When we see these packets, pass the payload on to the mfi audio callback
// if the callback exists
if(ull_mfi_audio_cb) {
ull_mfi_audio_cb(pdu_rx->lldata, pdu_rx->len);
if (ull_mfi_audio_cb) {
mfi_audio_slot_type_t slot_type;
if(pdu_rx->sn == 0) {
slot_type = MFI_AUDIO_SLOT_TYPE_PRIMARY;
} else {
slot_type = MFI_AUDIO_SLOT_TYPE_RETRANSMIT;
}
ull_mfi_audio_cb(pdu_rx->lldata, pdu_rx->len, slot_type);
}
// fallthrough (this existed before whisper modification)
default:
Expand Down
8 changes: 7 additions & 1 deletion subsys/bluetooth/controller/ll_sw/ull_mfi_audio_internal.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#ifndef ULL_MFI_AUDIO_INTERNAL_H
#define ULL_MFI_AUDIO_INTERNAL_H

typedef enum {
MFI_AUDIO_SLOT_TYPE_PRIMARY,
MFI_AUDIO_SLOT_TYPE_RETRANSMIT
} mfi_audio_slot_type_t;

// *** Whisper added for MFI. Register a callback for when audio packets are
// received so the BLE stack knows where to pass them
typedef void (*mfi_audio_recv_cb_fn)(const uint8_t *data, uint8_t data_len);
typedef void (*mfi_audio_recv_cb_fn)(const uint8_t *data, uint8_t data_len,
mfi_audio_slot_type_t slot_type);
void ull_mfi_audio_register_cb(mfi_audio_recv_cb_fn mfi_audio_cb);

#endif // ULL_MFI_AUDIO_INTERNAL_H

0 comments on commit c608b2f

Please sign in to comment.