diff --git a/CHANGELOG.md b/CHANGELOG.md index 93735d571..ed97abfbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - GAP: request role change for classic connection via `gap_request_role` - GAP: LE Whitelist API with 'gap_le_whitelist_x' with x = add, remove, clear and new `gap_connect_with_whitelist` - SDP Client: add sdp_client_register_query_callback() allows to register query request instead of polling sdp_client_ready() +- BNEP lwIP: add `bnep_lwip_connect` to establish BNEP connection and manage lwIP network interface ### Changed - GAP: treat AES-CCM encrypted connection as mutually authenticated (BIAS) diff --git a/platform/lwip/bnep_lwip.c b/platform/lwip/bnep_lwip.c index bb2e9a5a2..fd1a5e8ee 100644 --- a/platform/lwip/bnep_lwip.c +++ b/platform/lwip/bnep_lwip.c @@ -528,3 +528,21 @@ void bnep_lwip_register_packet_handler(btstack_packet_handler_t handler){ uint8_t bnep_lwip_register_service(uint16_t service_uuid, uint16_t max_frame_size){ return bnep_register_service(packet_handler, service_uuid, max_frame_size); } + +/** + * @brief Creates BNEP connection (channel) to a given server on a remote device with baseband address. A new baseband connection will be initiated if necessary. + * @note: uses our packet handler to manage lwIP network interface + * @param addr + * @param l2cap_psm + * @param uuid_src + * @param uuid_dest + * @return status + */ +uint8_t bnep_lwip_connect(bd_addr_t addr, uint16_t l2cap_psm, uint16_t uuid_src, uint16_t uuid_dest){ + int status = bnep_connect(packet_handler, addr, l2cap_psm, uuid_src, uuid_dest); + if (status != 0){ + return ERROR_CODE_UNSPECIFIED_ERROR; + } else { + return ERROR_CODE_SUCCESS; + } +} diff --git a/platform/lwip/bnep_lwip.h b/platform/lwip/bnep_lwip.h index 79f0fcbf1..f5cf07cc6 100644 --- a/platform/lwip/bnep_lwip.h +++ b/platform/lwip/bnep_lwip.h @@ -71,6 +71,14 @@ void bnep_lwip_register_packet_handler(btstack_packet_handler_t handler); */ uint8_t bnep_lwip_register_service(uint16_t service_uuid, uint16_t max_frame_size); +/** + * @brief Creates BNEP connection (channel) to a given server on a remote device with baseband address. A new baseband connection will be initiated if necessary. + * @param addr + * @param l2cap_psm + * @param uuid_src + * @param uuid_dest + */ +uint8_t bnep_lwip_connect(bd_addr_t addr, uint16_t l2cap_psm, uint16_t uuid_src, uint16_t uuid_dest); #if defined __cplusplus }