@@ -227,7 +227,7 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type,
227227 lll_sync -> filter_policy = scan -> per_scan .filter_policy ;
228228#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
229229
230- /* TODO: Add support for reporting initially enabled/disabled */
230+ /* Reporting initially enabled/disabled */
231231 lll_sync -> is_rx_enabled =
232232 !(options & BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED );
233233
@@ -361,8 +361,27 @@ uint8_t ll_sync_terminate(uint16_t handle)
361361
362362uint8_t ll_sync_recv_enable (uint16_t handle , uint8_t enable )
363363{
364- /* TODO: Add support for reporting enable/disable */
365- return BT_HCI_ERR_CMD_DISALLOWED ;
364+ struct ll_sync_set * sync ;
365+ struct lll_sync * lll ;
366+
367+ sync = ull_sync_is_enabled_get (handle );
368+ if (!sync ) {
369+ return BT_HCI_ERR_UNKNOWN_ADV_IDENTIFIER ;
370+ }
371+
372+ /* Reporting enabled/disabled */
373+ lll = & sync -> lll ;
374+ lll -> is_rx_enabled = (enable &
375+ BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_ENABLE ) ?
376+ 1U : 0U ;
377+
378+ #if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT )
379+ sync -> nodups = (enable &
380+ BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_FILTER_DUPLICATE ) ?
381+ 1U : 0U ;
382+ #endif
383+
384+ return 0 ;
366385}
367386
368387int ull_sync_init (void )
@@ -716,6 +735,7 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
716735 struct lll_sync * lll ;
717736
718737 ftr = & rx -> rx_ftr ;
738+ lll = ftr -> param ;
719739
720740#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING )
721741 enum sync_status sync_status ;
@@ -725,8 +745,6 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
725745#else
726746 struct pdu_cte_info * rx_cte_info ;
727747
728- lll = ftr -> param ;
729-
730748 rx_cte_info = pdu_cte_info_get ((struct pdu_adv * )((struct node_rx_pdu * )rx )-> pdu );
731749 if (rx_cte_info != NULL ) {
732750 sync_status = lll_sync_cte_is_allowed (lll -> cte_type , lll -> filter_policy ,
@@ -741,14 +759,14 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
741759 * or the CTE type is incorrect and filter policy doesn't allow to continue scanning.
742760 */
743761 if (sync_status != SYNC_STAT_READY_OR_CONT_SCAN ) {
744- #else
762+ #else /* !CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
763+
745764 if (1 ) {
746- #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
765+ #endif /* ! CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
747766
748767 /* Set the sync handle corresponding to the LLL context passed in the node rx
749768 * footer field.
750769 */
751- lll = ftr -> param ;
752770 ull_sync = HDR_LLL2ULL (lll );
753771
754772 /* Prepare and dispatch sync notification */
@@ -783,15 +801,20 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
783801 * scanning is terminated due to wrong CTE type.
784802 */
785803 if (sync_status != SYNC_STAT_TERM ) {
786- #else
804+ #else /* !CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
805+
787806 if (1 ) {
788- #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
807+ #endif /* ! CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
789808 /* Switch sync event prepare function to one reposnsible for regular PDUs receive */
790809 mfy_lll_prepare .fp = lll_sync_prepare ;
791810
792- /* Change node type to appropriately handle periodic advertising PDU report */
793- rx -> type = NODE_RX_TYPE_SYNC_REPORT ;
794- ull_scan_aux_setup (link , rx );
811+ if (lll -> is_rx_enabled ) {
812+ /* Change node type to appropriately handle periodic
813+ * advertising PDU report.
814+ */
815+ rx -> type = NODE_RX_TYPE_SYNC_REPORT ;
816+ ull_scan_aux_setup (link , rx );
817+ }
795818 }
796819}
797820
0 commit comments