display received host events on console

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

Branch: refs/heads/master
Commit: fc281057e0ac3953e71017e20fc5a352bab781be
Parents: d49b73c
Author: Willam San Filippo <w...@micosa.io>
Authored: Wed Oct 28 11:55:15 2015 -0700
Committer: Willam San Filippo <w...@micosa.io>
Committed: Wed Oct 28 11:55:15 2015 -0700

----------------------------------------------------------------------
 net/nimble/controller/src/ble_ll_scan.c | 16 ++++++++--------
 net/nimble/host/egg.yml                 |  1 +
 net/nimble/host/src/host_hci.c          |  6 ++++++
 3 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/fc281057/net/nimble/controller/src/ble_ll_scan.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_scan.c 
b/net/nimble/controller/src/ble_ll_scan.c
index 28013e8..7597965 100644
--- a/net/nimble/controller/src/ble_ll_scan.c
+++ b/net/nimble/controller/src/ble_ll_scan.c
@@ -109,11 +109,11 @@ struct ble_ll_scan_advertisers
 #define BLE_LL_SC_ADV_F_ADV_RPT_SENT    (0x08)
 
 /* Contains list of advertisers that we have heard scan responses from */
-uint8_t g_ble_ll_num_scan_rsp_advs;
+uint8_t g_ble_ll_scan_num_rsp_advs;
 struct ble_ll_scan_advertisers 
g_ble_ll_scan_rsp_advs[BLE_LL_SCAN_CFG_NUM_SCAN_RSP_ADVS];
 
 /* Used to filter duplicate advertising events to host */
-uint8_t g_ble_ll_num_scan_dup_advs;
+uint8_t g_ble_ll_scan_num_dup_advs;
 struct ble_ll_scan_advertisers 
g_ble_ll_scan_dup_advs[BLE_LL_SCAN_CFG_NUM_DUP_ADVS];
 
 /* See Vol 6 Part B Section 4.4.3.2. Active scanning backoff */
@@ -215,7 +215,7 @@ ble_ll_scan_is_dup_adv(uint8_t pdu_type, uint8_t addr_type, 
uint8_t *addr)
 
     /* Do we have an address match? Must match address type */
     adv = &g_ble_ll_scan_dup_advs[0];
-    num_advs = g_ble_ll_num_scan_dup_advs;
+    num_advs = g_ble_ll_scan_num_dup_advs;
     while (num_advs) {
         if (!memcmp(&adv->adv_addr, addr, BLE_DEV_ADDR_LEN)) {
             /* Address type must match */
@@ -265,7 +265,7 @@ ble_ll_scan_add_dup_adv(uint8_t *addr, uint8_t addr_type)
     struct ble_ll_scan_advertisers *adv;
 
     /* XXX: for now, if we dont have room, just leave */
-    num_advs = g_ble_ll_num_scan_dup_advs;
+    num_advs = g_ble_ll_scan_num_dup_advs;
     if (num_advs == BLE_LL_SCAN_CFG_NUM_DUP_ADVS) {
         return;
     }
@@ -282,7 +282,7 @@ ble_ll_scan_add_dup_adv(uint8_t *addr, uint8_t addr_type)
     if (addr_type) {
         adv->sc_adv_flags |= BLE_LL_SC_ADV_F_RANDOM_ADDR;
     }
-    ++g_ble_ll_num_scan_dup_advs;
+    ++g_ble_ll_scan_num_dup_advs;
 }
 
 /**
@@ -301,7 +301,7 @@ ble_ll_scan_have_rxd_scan_rsp(uint8_t *addr, uint8_t 
addr_type)
 
     /* Do we have an address match? Must match address type */
     adv = &g_ble_ll_scan_rsp_advs[0];
-    num_advs = g_ble_ll_num_scan_rsp_advs;
+    num_advs = g_ble_ll_scan_num_rsp_advs;
     while (num_advs) {
         if (!memcmp(&adv->adv_addr, addr, BLE_DEV_ADDR_LEN)) {
             /* Address type must match */
@@ -329,7 +329,7 @@ ble_ll_scan_add_scan_rsp_adv(uint8_t *addr, uint8_t 
addr_type)
     struct ble_ll_scan_advertisers *adv;
 
     /* XXX: for now, if we dont have room, just leave */
-    num_advs = g_ble_ll_num_scan_rsp_advs;
+    num_advs = g_ble_ll_scan_num_rsp_advs;
     if (num_advs == BLE_LL_SCAN_CFG_NUM_SCAN_RSP_ADVS) {
         return;
     }
@@ -346,7 +346,7 @@ ble_ll_scan_add_scan_rsp_adv(uint8_t *addr, uint8_t 
addr_type)
     if (addr_type) {
         adv->sc_adv_flags |= BLE_LL_SC_ADV_F_RANDOM_ADDR;
     }
-    ++g_ble_ll_num_scan_rsp_advs;
+    ++g_ble_ll_scan_num_rsp_advs;
 
     return;
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/fc281057/net/nimble/host/egg.yml
----------------------------------------------------------------------
diff --git a/net/nimble/host/egg.yml b/net/nimble/host/egg.yml
index 77e7a1b..f70a496 100644
--- a/net/nimble/host/egg.yml
+++ b/net/nimble/host/egg.yml
@@ -3,3 +3,4 @@ egg.vers: 0.1
 egg.deps:
     - libs/os
     - net/nimble
+    - libs/console/full

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/fc281057/net/nimble/host/src/host_hci.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/host_hci.c b/net/nimble/host/src/host_hci.c
index aa13cbc..b658f99 100644
--- a/net/nimble/host/src/host_hci.c
+++ b/net/nimble/host/src/host_hci.c
@@ -17,6 +17,7 @@
 #include <assert.h>
 #include <string.h>
 #include "os/os.h"
+#include "console/console.h"
 #include "nimble/hci_common.h"
 #include "nimble/hci_transport.h"
 
@@ -279,11 +280,16 @@ host_hci_cmd_le_set_scan_enable(uint8_t enable, uint8_t 
filter_dups)
 void
 host_hci_event_proc(struct os_event *ev)
 {
+    uint8_t *evbuf;
     os_error_t err;
 
     /* Count events received */
     ++g_host_hci_stats.events_rxd;
 
+    /* Display to console */
+    evbuf = (uint8_t *)ev->ev_arg;
+    console_printf("Host received event %u", evbuf[0]);
+
     /* XXX: Process the event */
 
     /* Free the command buffer */

Reply via email to