% !TEX root = btstack_gettingstarted.tex
\section{SDP Client API}
\label{appendix:api_sdp_client}
$ $
\begin{lstlisting}
/* SDP Client */

// Queries the SDP service of the remote device given a service 
// search pattern and a list of attribute IDs. The remote data is 
// handled by the SDP parser. The SDP parser delivers attribute 
// values and done event via a registered callback.
void sdp_client_query(bd_addr_t remote, uint8_t * des_serviceSearchPattern, uint8_t * des_attributeIDList);



/* SDP Parser */

// Basic SDP Parser event type.
typedef enum sdp_parser_event_type {
    SDP_PARSER_ATTRIBUTE_VALUE = 1,
    SDP_PARSER_COMPLETE,
} sdp_parser_event_type_t;

typedef struct sdp_parser_event {
    uint8_t type;
} sdp_parser_event_t;

// SDP Parser event to deliver an attribute value byte by byte.
typedef struct sdp_parser_attribute_value_event {
    uint8_t type;
    int record_id;
    uint16_t attribute_id;
    uint32_t attribute_length;
    int data_offset;
    uint8_t data;
} sdp_parser_attribute_value_event_t;

// SDP Parser event to indicate that parsing is complete.
typedef struct sdp_parser_complete_event {
    uint8_t type;
    uint8_t status; // 0 == OK
} sdp_parser_complete_event_t;

// Registers a callback to receive attribute value data and parse  
// complete event. 
void sdp_parser_register_callback(void (*sdp_callback)(sdp_parser_event_t* event));
\end{lstlisting}
\pagebreak