From d9de98852d0f665dc7b2e7e9432052d2f5eb765d Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Wed, 4 Dec 2019 17:29:22 +0100 Subject: [PATCH] auto-pts: support log message command --- test/auto-pts/btp.h | 1 + test/auto-pts/btpclient.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/test/auto-pts/btp.h b/test/auto-pts/btp.h index d6073805a..915bdd4a0 100644 --- a/test/auto-pts/btp.h +++ b/test/auto-pts/btp.h @@ -76,6 +76,7 @@ extern "C" { #define BTP_CORE_OP_READ_SUPPORTED_SERVICES 0x02 #define BTP_CORE_OP_REGISTER 0x03 #define BTP_CORE_OP_UNREGISTER 0x04 +#define BTP_CORE_OP_LOG_MESSAGE 0x05 #define BTP_CORE_EV_READY 0x80 diff --git a/test/auto-pts/btpclient.c b/test/auto-pts/btpclient.c index 5c4d6b89b..479d2f010 100644 --- a/test/auto-pts/btpclient.c +++ b/test/auto-pts/btpclient.c @@ -90,7 +90,8 @@ static uint8_t gap_inquriy_scan_active; static uint32_t current_settings; -static bd_addr_t pts_addr = { 0x00, 0x1b, 0xdc, 0x07, 0x32, 0xef}; +// static bd_addr_t pts_addr = { 0x00, 0x1b, 0xdc, 0x07, 0x32, 0xef}; +static bd_addr_t pts_addr = { 0x00, 0x1b, 0xdc, 0x08, 0xe2, 0x5c}; // log/debug output #define MESSAGE(format, ...) log_info(format, ## __VA_ARGS__); printf(format "\n", ## __VA_ARGS__) @@ -382,6 +383,8 @@ static void gap_limited_discovery_timeout_handler(btstack_timer_source_t * ts){ static void btp_core_handler(uint8_t opcode, uint8_t controller_index, uint16_t length, const uint8_t *data){ uint8_t status; + uint8_t message_buffer[100]; + switch (opcode){ case BTP_OP_ERROR: MESSAGE("BTP_OP_ERROR"); @@ -426,6 +429,14 @@ static void btp_core_handler(uint8_t opcode, uint8_t controller_index, uint16_t btp_send(BTP_SERVICE_ID_CORE, opcode, controller_index, 0, NULL); } break; + case BTP_CORE_OP_LOG_MESSAGE: + if (controller_index == BTP_INDEX_NON_CONTROLLER){ + uint16_t len = btstack_min(sizeof(message_buffer)-1,length); + memcpy(message_buffer, data, len); + MESSAGE("BTP_CORE_LOG_MESSAGE %s", message_buffer); + btp_send(BTP_SERVICE_ID_CORE, opcode, controller_index, 0, NULL); + } + break; default: btp_send_error_unknown_command(BTP_SERVICE_ID_CORE); break;