[GitHub] [mynewt-nimble] KKopyscinski commented on a diff in pull request #1549: nimble: [WIP] Eatt initial implementation

2023-07-19 Thread via GitHub


KKopyscinski commented on code in PR #1549:
URL: https://github.com/apache/mynewt-nimble/pull/1549#discussion_r1267702716


##
nimble/host/src/ble_hs.c:
##
@@ -734,6 +734,9 @@ ble_hs_init(void)
 rc = ble_l2cap_init();
 SYSINIT_PANIC_ASSERT(rc == 0);
 
+rc = ble_gap_init();

Review Comment:
   fixed



##
nimble/host/src/ble_att_cmd.c:
##
@@ -55,28 +55,64 @@ ble_att_cmd_get(uint8_t opcode, size_t len, struct os_mbuf 
**txom)
 }
 
 int
-ble_att_tx(uint16_t conn_handle, struct os_mbuf *txom)
+ble_att_tx_with_conn(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan, 
struct os_mbuf *txom)
 {
-struct ble_l2cap_chan *chan;
-struct ble_hs_conn *conn;
 int rc;
+struct os_mbuf_pkthdr *omp;
+
+if (!txom) {
+if (conn->client_att_busy) {
+return 0;
+}
+omp = STAILQ_FIRST(>att_tx_q);
+if (omp == NULL) {
+return 0;
+}
+STAILQ_REMOVE_HEAD(>att_tx_q, omp_next);
+txom = OS_MBUF_PKTHDR_TO_MBUF(omp);
+}
 
 BLE_HS_DBG_ASSERT_EVAL(txom->om_len >= 1);
+
+if (ble_att_is_request_op(txom->om_data[0])) {
+if (conn->client_att_busy) {
+STAILQ_INSERT_TAIL(>att_tx_q, OS_MBUF_PKTHDR(txom), 
omp_next);
+return 0;
+}
+conn->client_att_busy = true;
+}
+
 ble_att_inc_tx_stat(txom->om_data[0]);
 
-ble_hs_lock();
+ble_att_truncate_to_mtu(chan, txom);
+rc = ble_l2cap_tx(conn, chan, txom);
+assert(rc == 0);
+return rc;
+}
+
+int
+ble_att_tx(uint16_t conn_handle, uint16_t cid, struct os_mbuf *txom)
+{
+struct ble_l2cap_chan *chan;
+struct ble_hs_conn *conn;
+int rc;
 
+#if MYNEWT_VAL(BLE_EATT_CHAN_NUM) > 0
+if (cid != BLE_L2CAP_CID_ATT) {
+return ble_eatt_tx(conn_handle, cid, txom);

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [mynewt-nimble] KKopyscinski commented on a diff in pull request #1549: nimble: [WIP] Eatt initial implementation

2023-07-19 Thread via GitHub


KKopyscinski commented on code in PR #1549:
URL: https://github.com/apache/mynewt-nimble/pull/1549#discussion_r1267669032


##
nimble/host/src/ble_hs.c:
##
@@ -734,6 +734,9 @@ ble_hs_init(void)
 rc = ble_l2cap_init();
 SYSINIT_PANIC_ASSERT(rc == 0);
 
+rc = ble_gap_init();

Review Comment:
   Also, `ble_gap_init` should be outside `#if NIMBLE_BLE_CONNECT` - it 
includes code for features without connection



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org