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/10/05 07:57:04 UTC

[GitHub] michal-narajowski closed pull request #177: nimble: Add API to query the L2CAP channel for details

michal-narajowski closed pull request #177: nimble: Add API to query the L2CAP channel for details
URL: https://github.com/apache/mynewt-nimble/pull/177
 
 
   

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/apps/btshell/src/main.c b/apps/btshell/src/main.c
index a794fb87..c24480c9 100644
--- a/apps/btshell/src/main.c
+++ b/apps/btshell/src/main.c
@@ -1849,9 +1849,14 @@ btshell_l2cap_event(struct ble_l2cap_event *event, void *arg)
                 return 0;
             }
 
-            console_printf("LE COC connected, conn: %d, chan: 0x%08lx\n",
+            console_printf("LE COC connected, conn: %d, chan: 0x%08lx, scid: 0x%04x, "
+                           "dcid: 0x%04x, our_mtu: 0x%04x, peer_mtu: 0x%04x\n",
                            event->connect.conn_handle,
-                           (uint32_t) event->connect.chan);
+                           (uint32_t) event->connect.chan,
+                           ble_l2cap_get_scid(event->connect.chan),
+                           ble_l2cap_get_dcid(event->connect.chan),
+                           ble_l2cap_get_our_mtu(event->connect.chan),
+                           ble_l2cap_get_peer_mtu(event->connect.chan));
 
             btshell_l2cap_coc_add(event->connect.conn_handle,
                                   event->connect.chan);
diff --git a/nimble/host/include/host/ble_l2cap.h b/nimble/host/include/host/ble_l2cap.h
index 0b54189d..ac179be6 100644
--- a/nimble/host/include/host/ble_l2cap.h
+++ b/nimble/host/include/host/ble_l2cap.h
@@ -188,6 +188,10 @@ int ble_l2cap_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
 int ble_l2cap_disconnect(struct ble_l2cap_chan *chan);
 int ble_l2cap_send(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_tx);
 void ble_l2cap_recv_ready(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_rx);
+int ble_l2cap_get_scid(struct ble_l2cap_chan *chan);
+int ble_l2cap_get_dcid(struct ble_l2cap_chan *chan);
+int ble_l2cap_get_our_mtu(struct ble_l2cap_chan *chan);
+int ble_l2cap_get_peer_mtu(struct ble_l2cap_chan *chan);
 
 #ifdef __cplusplus
 }
diff --git a/nimble/host/src/ble_l2cap_coc.c b/nimble/host/src/ble_l2cap_coc.c
index b33c5489..5ceeec4e 100644
--- a/nimble/host/src/ble_l2cap_coc.c
+++ b/nimble/host/src/ble_l2cap_coc.c
@@ -499,6 +499,46 @@ ble_l2cap_coc_send(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_tx)
     return ble_l2cap_coc_continue_tx(chan);
 }
 
+int
+ble_l2cap_get_scid(struct ble_l2cap_chan *chan)
+{
+    if (!chan) {
+        return 0;
+    }
+
+    return chan->scid;
+}
+
+int
+ble_l2cap_get_dcid(struct ble_l2cap_chan *chan)
+{
+    if (!chan) {
+        return 0;
+    }
+
+    return chan->dcid;
+}
+
+int
+ble_l2cap_get_our_mtu(struct ble_l2cap_chan *chan)
+{
+    if (!chan) {
+        return 0;
+    }
+
+    return chan->my_mtu;
+}
+
+int
+ble_l2cap_get_peer_mtu(struct ble_l2cap_chan *chan)
+{
+    if (!chan) {
+        return 0;
+    }
+
+    return chan->peer_mtu;
+}
+
 int
 ble_l2cap_coc_init(void)
 {


 

----------------------------------------------------------------
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