sdp_server: add sdp_server_set_single_record_response

This commit is contained in:
Matthias Ringwald 2024-11-11 22:55:02 +01:00
parent db96503f81
commit 22d58ff8de
2 changed files with 20 additions and 2 deletions

View File

@ -84,6 +84,10 @@ static uint16_t sdp_server_response_size;
static uint16_t sdp_server_l2cap_waiting_list_cids[SDP_WAITING_LIST_MAX_COUNT]; static uint16_t sdp_server_l2cap_waiting_list_cids[SDP_WAITING_LIST_MAX_COUNT];
static int sdp_server_l2cap_waiting_list_count; static int sdp_server_l2cap_waiting_list_count;
#ifdef ENABLE_TESTING_SUPPORT
static bool sdp_server_testing_single_record_reponse = false;
#endif
void sdp_init(void){ void sdp_init(void){
sdp_server_next_service_record_handle = ((uint32_t) MAX_RESERVED_SERVICE_RECORD_HANDLE) + 2; sdp_server_next_service_record_handle = ((uint32_t) MAX_RESERVED_SERVICE_RECORD_HANDLE) + 2;
// register with l2cap psm sevices - max MTU // register with l2cap psm sevices - max MTU
@ -205,6 +209,11 @@ int sdp_handle_service_search_request(uint8_t * packet, uint16_t remote_mtu){
// calc maximumServiceRecordCount based on remote MTU // calc maximumServiceRecordCount based on remote MTU
uint16_t maxNrServiceRecordsPerResponse = (remote_mtu - (9+3))/4; uint16_t maxNrServiceRecordsPerResponse = (remote_mtu - (9+3))/4;
#ifdef ENABLE_TESTING_SUPPORT
if (sdp_server_testing_single_record_reponse){
maxNrServiceRecordsPerResponse = 1;
}
#endif
// continuation state contains index of next service record to examine // continuation state contains index of next service record to examine
int continuation = 0; int continuation = 0;
@ -632,3 +641,8 @@ static void sdp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *p
} }
} }
#ifdef ENABLE_TESTING_SUPPORT
void sdp_server_set_single_record_response(bool enable){
sdp_server_testing_single_record_reponse = enable;
}
#endif

View File

@ -111,6 +111,10 @@ void sdp_deinit(void);
/* API_END */ /* API_END */
#ifdef ENABLE_TESTING_SUPPORT
void sdp_server_set_single_record_response(bool enabled);
#endif
#if defined __cplusplus #if defined __cplusplus
} }