andrzej-kaczmarek commented on code in PR #1507:
URL: https://github.com/apache/mynewt-nimble/pull/1507#discussion_r1206580766


##########
nimble/host/include/host/ble_gap.h:
##########
@@ -982,6 +983,54 @@ struct ble_gap_event {
         } periodic_transfer;
 #endif
 
+#if MYNEWT_VAL(BLE_BIGINFO_REPORTS)
+        /**
+         * Represents a periodic advertising sync transfer received. Valid for
+         * the following event types:
+         *     o BLE_GAP_EVENT_BIGINFO_REPORT
+         */
+        struct {
+            /** Synchronization handle */
+            uint16_t sync_handle;
+
+            /** Number of present BISes */
+            uint8_t bis_cnt;
+
+            /** Number of SubEvents */
+            uint8_t nse;
+
+            /** ISO Interval */
+            uint16_t iso_interval;
+
+            /** Burst Number */
+            uint8_t bn;
+
+            /** Pre-Transmission Offset */
+            uint8_t pto;
+
+            /** Immediate Repetition Count */
+            uint8_t irc;
+
+            /** Maximum PDU size */
+            uint16_t max_pdu;
+
+            /** Service Data Unit Interval */
+            uint8_t sdu_interval[3];

Review Comment:
   `uint32_t` will be easier to handle by app
   also move below `max_sdu` so we don't waste space on alignment unnecessarily
   



##########
nimble/host/include/host/ble_gap.h:
##########
@@ -982,6 +983,54 @@ struct ble_gap_event {
         } periodic_transfer;
 #endif
 
+#if MYNEWT_VAL(BLE_BIGINFO_REPORTS)
+        /**
+         * Represents a periodic advertising sync transfer received. Valid for
+         * the following event types:
+         *     o BLE_GAP_EVENT_BIGINFO_REPORT
+         */
+        struct {
+            /** Synchronization handle */
+            uint16_t sync_handle;
+
+            /** Number of present BISes */
+            uint8_t bis_cnt;
+
+            /** Number of SubEvents */
+            uint8_t nse;
+
+            /** ISO Interval */
+            uint16_t iso_interval;
+
+            /** Burst Number */
+            uint8_t bn;
+
+            /** Pre-Transmission Offset */
+            uint8_t pto;
+
+            /** Immediate Repetition Count */
+            uint8_t irc;
+
+            /** Maximum PDU size */
+            uint16_t max_pdu;
+
+            /** Service Data Unit Interval */
+            uint8_t sdu_interval[3];
+
+            /** Maximum SDU size */
+            uint16_t max_sdu;
+
+            /** Advertising PHY */
+            uint8_t phy;
+
+            /** Framing of BIS Data PDUs */
+            uint8_t framing;
+
+            /** Encryption */
+            uint8_t encryption;

Review Comment:
   use bitfield for both



##########
nimble/host/include/host/ble_gap.h:
##########
@@ -982,6 +983,54 @@ struct ble_gap_event {
         } periodic_transfer;
 #endif
 
+#if MYNEWT_VAL(BLE_BIGINFO_REPORTS)
+        /**
+         * Represents a periodic advertising sync transfer received. Valid for
+         * the following event types:
+         *     o BLE_GAP_EVENT_BIGINFO_REPORT
+         */
+        struct {
+            /** Synchronization handle */
+            uint16_t sync_handle;
+
+            /** Number of present BISes */
+            uint8_t bis_cnt;
+
+            /** Number of SubEvents */
+            uint8_t nse;
+
+            /** ISO Interval */
+            uint16_t iso_interval;
+
+            /** Burst Number */
+            uint8_t bn;
+
+            /** Pre-Transmission Offset */
+            uint8_t pto;
+
+            /** Immediate Repetition Count */
+            uint8_t irc;
+
+            /** Maximum PDU size */
+            uint16_t max_pdu;
+
+            /** Service Data Unit Interval */
+            uint8_t sdu_interval[3];
+
+            /** Maximum SDU size */
+            uint16_t max_sdu;
+
+            /** Advertising PHY */
+            uint8_t phy;

Review Comment:
   this is big phy, not advertising phy



##########
nimble/host/src/ble_hs_hci_evt.c:
##########
@@ -128,6 +131,9 @@ static ble_hs_hci_evt_le_fn * const 
ble_hs_hci_evt_le_dispatch[] = {
     [BLE_HCI_LE_SUBEV_ADV_SET_TERMINATED] = 
ble_hs_hci_evt_le_adv_set_terminated,
     [BLE_HCI_LE_SUBEV_SCAN_REQ_RCVD] = ble_hs_hci_evt_le_scan_req_rcvd,
     [BLE_HCI_LE_SUBEV_PERIODIC_ADV_SYNC_TRANSFER] = 
ble_hs_hci_evt_le_periodic_adv_sync_transfer,
+#if MYNEWT_VAL(BLE_BIGINFO_REPORTS)
+    [BLE_HCI_LE_SUBEV_BIGINFO_ADV_REPORT] = ble_hs_hci_evt_le_biginfo_adv_rpt,

Review Comment:
   `...adv_report`



##########
nimble/host/src/ble_hs_startup.c:
##########
@@ -261,6 +261,16 @@ ble_hs_startup_le_set_evmask_tx(void)
     }
 #endif
 
+#if MYNEWT_VAL(BLE_BIGINFO_REPORTS)
+    if (version >= BLE_HCI_VER_BCS_5_2) {
+        /**
+         * Enable the following LE events:
+         * 0x0000000200000000 LE Periodic Advertising Sync Transfer Received 
event

Review Comment:
   this is not the proper event (at least according to description)



##########
nimble/host/src/ble_gap.c:
##########
@@ -1849,6 +1849,50 @@ ble_gap_rx_periodic_adv_sync_transfer(const struct 
ble_hci_ev_le_subev_periodic_
 
     ble_hs_unlock();
 
+    cb(&event, cb_arg);
+}
+#endif
+
+#if MYNEWT_VAL(BLE_BIGINFO_REPORTS)
+void
+ble_gap_rx_biginfo_adv_rpt(const struct ble_hci_ev_le_subev_biginfo_adv_report 
*ev)
+{
+    struct ble_hs_periodic_sync *psync;
+    struct ble_gap_event event;
+    ble_gap_event_fn *cb;
+    void *cb_arg;
+
+    ble_hs_lock();
+    psync = ble_hs_periodic_sync_find_by_handle(le16toh(ev->sync_handle));
+    if (psync) {
+        cb = psync->cb;
+        cb_arg = psync->cb_arg;
+    }
+    ble_hs_unlock();
+
+    if (!psync || !cb) {

Review Comment:
   it does not make sense to return if `!cb` since the same condition is 
checked below



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to