You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/08/24 00:53:26 UTC
[12/50] [abbrv] incubator-mynewt-core git commit: BLE Host - Function
to retrieve preferred ATT MTU.
BLE Host - Function to retrieve preferred ATT MTU.
uint16_t ble_att_preferred_mtu(void);
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/567c9c1d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/567c9c1d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/567c9c1d
Branch: refs/heads/master
Commit: 567c9c1df35c0c7399fd060145f50072f8e7b6a9
Parents: 1f50420
Author: Christopher Collins <cc...@apache.org>
Authored: Fri Aug 12 17:43:28 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Fri Aug 12 18:16:35 2016 -0700
----------------------------------------------------------------------
net/nimble/host/include/host/ble_att.h | 1 +
net/nimble/host/src/ble_att.c | 19 +++++++++++++++----
2 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/567c9c1d/net/nimble/host/include/host/ble_att.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_att.h b/net/nimble/host/include/host/ble_att.h
index 6afca97..24b4496 100644
--- a/net/nimble/host/include/host/ble_att.h
+++ b/net/nimble/host/include/host/ble_att.h
@@ -98,6 +98,7 @@ int ble_att_svr_read_local(uint16_t attr_handle, struct os_mbuf **out_om);
int ble_att_svr_write_local(uint16_t attr_handle, struct os_mbuf *om);
uint16_t ble_att_mtu(uint16_t conn_handle);
+uint16_t ble_att_preferred_mtu(void);
int ble_att_set_preferred_mtu(uint16_t mtu);
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/567c9c1d/net/nimble/host/src/ble_att.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att.c b/net/nimble/host/src/ble_att.c
index 29e359a..608904a 100644
--- a/net/nimble/host/src/ble_att.c
+++ b/net/nimble/host/src/ble_att.c
@@ -22,7 +22,7 @@
#include "bsp/bsp.h"
#include "ble_hs_priv.h"
-static uint16_t ble_att_preferred_mtu;
+static uint16_t ble_att_preferred_mtu_val;
/** Dispatch table for incoming ATT requests. Sorted by op code. */
typedef int ble_att_rx_fn(uint16_t conn_handle, struct os_mbuf **om);
@@ -467,6 +467,17 @@ ble_att_rx(uint16_t conn_handle, struct os_mbuf **om)
}
/**
+ * Retrieves the preferred ATT MTU.
+ *
+ * @return The preferred ATT MTU.
+ */
+uint16_t
+ble_att_preferred_mtu(void)
+{
+ return ble_att_preferred_mtu_val;
+}
+
+/**
* Sets the preferred ATT MTU; the device will indicate this value in all
* subseqeunt ATT MTU exchanges. The ATT MTU of a connection is equal to the
* lower of the two peers' preferred MTU values. The ATT MTU is what dictates
@@ -492,7 +503,7 @@ ble_att_set_preferred_mtu(uint16_t mtu)
return BLE_HS_EINVAL;
}
- ble_att_preferred_mtu = mtu;
+ ble_att_preferred_mtu_val = mtu;
/* XXX: Set my_mtu for established connections that haven't exchanged. */
@@ -510,7 +521,7 @@ ble_att_create_chan(void)
}
chan->blc_cid = BLE_L2CAP_CID_ATT;
- chan->blc_my_mtu = ble_att_preferred_mtu;
+ chan->blc_my_mtu = ble_att_preferred_mtu_val;
chan->blc_default_mtu = BLE_ATT_MTU_DFLT;
chan->blc_rx_fn = ble_att_rx;
@@ -522,7 +533,7 @@ ble_att_init(void)
{
int rc;
- ble_att_preferred_mtu = BLE_ATT_MTU_PREFERRED_DFLT;
+ ble_att_preferred_mtu_val = BLE_ATT_MTU_PREFERRED_DFLT;
rc = stats_init_and_reg(
STATS_HDR(ble_att_stats), STATS_SIZE_INIT_PARMS(ble_att_stats,