You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/04/26 07:20:03 UTC

[GitHub] sjanc closed pull request #60: Fix data_status in BLE_GAP_EVENT_EXT_DISC

sjanc closed pull request #60: Fix data_status in BLE_GAP_EVENT_EXT_DISC
URL: https://github.com/apache/mynewt-nimble/pull/60
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/nimble/host/include/host/ble_gap.h b/nimble/host/include/host/ble_gap.h
index 6170f63f..10350319 100644
--- a/nimble/host/include/host/ble_gap.h
+++ b/nimble/host/include/host/ble_gap.h
@@ -225,6 +225,11 @@ struct ble_gap_passkey_params {
 };
 
 #if MYNEWT_VAL(BLE_EXT_ADV)
+
+#define BLE_GAP_EXT_ADV_DATA_STATUS_COMPLETE   0x00
+#define BLE_GAP_EXT_ADV_DATA_STATUS_INCOMPLETE 0x01
+#define BLE_GAP_EXT_ADV_DATA_STATUS_TRUNCATED  0x02
+
 struct ble_gap_ext_disc_desc {
     /*** Common fields. */
     uint8_t props;
diff --git a/nimble/host/src/ble_hs_hci_evt.c b/nimble/host/src/ble_hs_hci_evt.c
index 989bc3d2..db62d54f 100644
--- a/nimble/host/src/ble_hs_hci_evt.c
+++ b/nimble/host/src/ble_hs_hci_evt.c
@@ -553,7 +553,7 @@ static int
 ble_hs_hci_evt_le_ext_adv_rpt(uint8_t subevent, uint8_t *data, int len)
 {
 #if MYNEWT_VAL(BLE_EXT_ADV)
-    struct ble_gap_ext_disc_desc desc = {0};
+    struct ble_gap_ext_disc_desc desc;
     struct hci_ext_adv_report *ext_adv;
     struct hci_ext_adv_report_param *params;
     int num_reports;
@@ -578,6 +578,8 @@ ble_hs_hci_evt_le_ext_adv_rpt(uint8_t subevent, uint8_t *data, int len)
 
     params = &ext_adv->params[0];
     for (i = 0; i < num_reports; i++) {
+        memset(&desc, 0, sizeof(desc));
+
         desc.props = (params->evt_type) & 0x1F;
         if (desc.props & BLE_HCI_ADV_LEGACY_MASK) {
             legacy_event_type = ble_hs_hci_decode_legacy_type(params->evt_type);
@@ -586,8 +588,21 @@ ble_hs_hci_evt_le_ext_adv_rpt(uint8_t subevent, uint8_t *data, int len)
                 continue;
             }
             desc.legacy_event_type = legacy_event_type;
+            desc.data_status = BLE_GAP_EXT_ADV_DATA_STATUS_COMPLETE;
         } else {
-            desc.data_status = (params->evt_type & BLE_HCI_ADV_DATA_STATUS_MASK) >> 5;
+            switch(params->evt_type & BLE_HCI_ADV_DATA_STATUS_MASK) {
+            case BLE_HCI_ADV_DATA_STATUS_COMPLETE:
+                desc.data_status = BLE_GAP_EXT_ADV_DATA_STATUS_COMPLETE;
+                break;
+            case BLE_HCI_ADV_DATA_STATUS_INCOMPLETE:
+                desc.data_status = BLE_GAP_EXT_ADV_DATA_STATUS_INCOMPLETE;
+                break;
+            case BLE_HCI_ADV_DATA_STATUS_TRUNCATED:
+                desc.data_status = BLE_GAP_EXT_ADV_DATA_STATUS_TRUNCATED;
+                break;
+            default:
+                assert(false);
+            }
         }
         desc.addr.type = params->addr_type;
         memcpy(desc.addr.val, params->addr, 6);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services