You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by st...@apache.org on 2016/12/18 21:56:42 UTC

[14/50] incubator-mynewt-core git commit: bletiny: Add check for directed advertising type

bletiny: Add check for directed advertising type

Connectable directed advertising event does not contain advertising
data, therefore there is no need to print it.
In the same time we add log saying about event type as this is
useful for PTS testing


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/4fe1cb32
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/4fe1cb32
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/4fe1cb32

Branch: refs/heads/sensors_branch
Commit: 4fe1cb327edf900e470d8d95d7c745df4df6f7f1
Parents: c7a5c5d
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Mon Dec 12 12:04:24 2016 +0100
Committer: Sterling Hughes <st...@apache.org>
Committed: Sun Dec 18 13:56:16 2016 -0800

----------------------------------------------------------------------
 apps/bletiny/src/main.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4fe1cb32/apps/bletiny/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c
index d3a9d38..c78d160 100755
--- a/apps/bletiny/src/main.c
+++ b/apps/bletiny/src/main.c
@@ -936,12 +936,23 @@ bletiny_gap_event(struct ble_gap_event *event, void *arg)
         return 0;
 
     case BLE_GAP_EVENT_DISC:
-        console_printf("received advertisement; event_type=%d addr_type=%d "
-                       "addr=", event->disc.event_type,
-                       event->disc.addr_type);
+        console_printf("received advertisement; event_type=%d rssi=%d "
+                       "addr_type=%d addr=", event->disc.event_type,
+                       event->disc.rssi, event->disc.addr_type);
         print_addr(event->disc.addr);
-        console_printf(" length_data=%d rssi=%d data=",
-                       event->disc.length_data, event->disc.rssi);
+
+        /*
+         * There is no adv data to print in case of connectable
+         * directed advertising
+         */
+        if (event->disc.event_type == BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD ||
+                event->disc.event_type == BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_LD) {
+                console_printf("\nConnectable directed advertising event\n");
+                return 0;
+        }
+
+        console_printf(" length_data=%d data=",
+                               event->disc.length_data);
         print_bytes(event->disc.data, event->disc.length_data);
         console_printf(" fields:\n");
         bletiny_print_adv_fields(event->disc.fields);