From 7d2c9f1338264c647180e0f28fb11a9a1909d3c4 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Fri, 8 Apr 2016 15:38:45 +0200 Subject: [PATCH] test: fix sm and sdp client --- test/sdp_client/mock.c | 12 +++++++++++- test/security_manager/mock.c | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/test/sdp_client/mock.c b/test/sdp_client/mock.c index ebd46e7f5..5d3a8eac4 100644 --- a/test/sdp_client/mock.c +++ b/test/sdp_client/mock.c @@ -3,12 +3,22 @@ #include "btstack_defines.h" #include "btstack_debug.h" +#include "btstack_util.h" #include "bluetooth.h" +static btstack_packet_handler_t packet_handler; + extern "C" int l2cap_can_send_packet_now(uint16_t cid){ return 1; } -extern "C" uint8_t l2cap_create_channel(btstack_packet_handler_t packet_handler, bd_addr_t address, uint16_t psm, uint16_t mtu, uint16_t * out_local_cid){ +extern "C" void l2cap_request_can_send_now_event(uint16_t cid){ + uint8_t event[] = { L2CAP_EVENT_CAN_SEND_NOW, 2, 0, 0}; + little_endian_store_16(event, 2, cid); + packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); +} + +extern "C" uint8_t l2cap_create_channel(btstack_packet_handler_t handler, bd_addr_t address, uint16_t psm, uint16_t mtu, uint16_t * out_local_cid){ + packet_handler = handler; return 0x41; } extern "C" void l2cap_disconnect(uint16_t local_cid, uint8_t reason){ diff --git a/test/security_manager/mock.c b/test/security_manager/mock.c index da8966b0a..ac46a2f0e 100644 --- a/test/security_manager/mock.c +++ b/test/security_manager/mock.c @@ -147,6 +147,13 @@ void gap_advertisements_get_address(uint8_t * addr_type, bd_addr_t addr){ uint8_t channel_map, uint8_t filter_policy) { } +extern "C" void l2cap_request_can_send_fix_channel_now_event(hci_con_handle_t con_handle, uint16_t cid){ + if (packet_buffer_len) return; + uint8_t event[] = { L2CAP_EVENT_CAN_SEND_NOW, 2, 0, 0}; + little_endian_store_16(event, 2, cid); + le_data_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); +} + int l2cap_can_send_connectionless_packet_now(void){ return packet_buffer_len == 0; }