You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by "m-gorecki (via GitHub)" <gi...@apache.org> on 2023/02/28 13:58:15 UTC

[GitHub] [mynewt-nimble] m-gorecki opened a new pull request, #1469: nimble/host: Add connection handle related GAP APIs

m-gorecki opened a new pull request, #1469:
URL: https://github.com/apache/mynewt-nimble/pull/1469

   This adds two new GAP APIs:
   
   void ble_gap_conn_foreach_handle(ble_gap_conn_foreach_handle_fn *cb, void *arg) API can be used to call function declared by the user for every connection that is currently established. As arguments, it takes a pointer to the function, that will be called and a void pointer, which is used to pass the optional argument of any type to the called function. Function from passed pointer should return an int value and take two arguments - uint16_t for conn_handle and void* for the optional argument (see ble_gap_conn_foreach_handle_fn typedef).
   
   int ble_gap_conn_func_handle_by_addr(const ble_addr_t *addr, uint16_t *out_conn_handle) The API will look for the connection with address specified in the first argument and if it succeds, it will write the connection handle to the variable pointed by out_conn_handle. Returns 0 on success or BLE_HS_ENOTCONN if connection with specified address was not found.


-- 
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-unsubscribe@mynewt.apache.org

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


[GitHub] [mynewt-nimble] andrzej-kaczmarek merged pull request #1469: nimble/host: Add connection handle related GAP APIs

Posted by "andrzej-kaczmarek (via GitHub)" <gi...@apache.org>.
andrzej-kaczmarek merged PR #1469:
URL: https://github.com/apache/mynewt-nimble/pull/1469


-- 
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-unsubscribe@mynewt.apache.org

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


[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a diff in pull request #1469: nimble/host: Add connection handle related GAP APIs

Posted by "andrzej-kaczmarek (via GitHub)" <gi...@apache.org>.
andrzej-kaczmarek commented on code in PR #1469:
URL: https://github.com/apache/mynewt-nimble/pull/1469#discussion_r1123879313


##########
nimble/host/src/ble_gap.c:
##########
@@ -509,6 +509,54 @@ ble_gap_conn_find_by_addr(const ble_addr_t *addr,
 #endif
 }
 
+int
+ble_gap_conn_find_handle_by_addr(const ble_addr_t *addr, uint16_t *out_conn_handle)
+{
+#if NIMBLE_BLE_CONNECT
+    struct ble_hs_conn *conn;
+
+    ble_hs_lock();
+
+    conn = ble_hs_conn_find_by_addr(addr);
+
+    *out_conn_handle = conn->bhc_handle;

Review Comment:
   need to check if conn!=NULL first



-- 
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-unsubscribe@mynewt.apache.org

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