xref: /btstack/src/classic/sdp_client.h (revision 6c927b22a98b3f4b0e3ed7d77829cb530efde76d)
13deb3ec6SMatthias Ringwald /*
23deb3ec6SMatthias Ringwald  * Copyright (C) 2014 BlueKitchen GmbH
33deb3ec6SMatthias Ringwald  *
43deb3ec6SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
53deb3ec6SMatthias Ringwald  * modification, are permitted provided that the following conditions
63deb3ec6SMatthias Ringwald  * are met:
73deb3ec6SMatthias Ringwald  *
83deb3ec6SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
93deb3ec6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
103deb3ec6SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
113deb3ec6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
123deb3ec6SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
133deb3ec6SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
143deb3ec6SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
153deb3ec6SMatthias Ringwald  *    from this software without specific prior written permission.
163deb3ec6SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
173deb3ec6SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
183deb3ec6SMatthias Ringwald  *    monetary gain.
193deb3ec6SMatthias Ringwald  *
203deb3ec6SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
213deb3ec6SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
223deb3ec6SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
233deb3ec6SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
243deb3ec6SMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
253deb3ec6SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
263deb3ec6SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
273deb3ec6SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
283deb3ec6SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
293deb3ec6SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
303deb3ec6SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
313deb3ec6SMatthias Ringwald  * SUCH DAMAGE.
323deb3ec6SMatthias Ringwald  *
333deb3ec6SMatthias Ringwald  * Please inquire about commercial licensing options at
343deb3ec6SMatthias Ringwald  * [email protected]
353deb3ec6SMatthias Ringwald  *
363deb3ec6SMatthias Ringwald  */
373deb3ec6SMatthias Ringwald 
383deb3ec6SMatthias Ringwald /*
393deb3ec6SMatthias Ringwald  *  sdp_client.h
403deb3ec6SMatthias Ringwald  */
413deb3ec6SMatthias Ringwald 
423deb3ec6SMatthias Ringwald #ifndef __SDP_CLIENT_H
433deb3ec6SMatthias Ringwald #define __SDP_CLIENT_H
443deb3ec6SMatthias Ringwald 
457907f069SMatthias Ringwald #include "btstack_config.h"
463deb3ec6SMatthias Ringwald 
47eb886013SMatthias Ringwald #include "btstack_util.h"
483deb3ec6SMatthias Ringwald 
493deb3ec6SMatthias Ringwald #if defined __cplusplus
503deb3ec6SMatthias Ringwald extern "C" {
513deb3ec6SMatthias Ringwald #endif
523deb3ec6SMatthias Ringwald 
533deb3ec6SMatthias Ringwald /* API_START */
543deb3ec6SMatthias Ringwald 
55*6c927b22SMatthias Ringwald typedef struct de_state {
56*6c927b22SMatthias Ringwald     uint8_t  in_state_GET_DE_HEADER_LENGTH ;
57*6c927b22SMatthias Ringwald     uint32_t addon_header_bytes;
58*6c927b22SMatthias Ringwald     uint32_t de_size;
59*6c927b22SMatthias Ringwald     uint32_t de_offset;
60*6c927b22SMatthias Ringwald } de_state_t;
61*6c927b22SMatthias Ringwald 
62*6c927b22SMatthias Ringwald void de_state_init(de_state_t * state);
63*6c927b22SMatthias Ringwald int  de_state_size(uint8_t eventByte, de_state_t *de_state);
64*6c927b22SMatthias Ringwald 
65*6c927b22SMatthias Ringwald /**
66*6c927b22SMatthias Ringwald  * @brief Checks if the SDP Client is ready
67*6c927b22SMatthias Ringwald  * @return 1 when no query is active
68*6c927b22SMatthias Ringwald  */
69*6c927b22SMatthias Ringwald int sdp_client_ready(void);
70*6c927b22SMatthias Ringwald 
713deb3ec6SMatthias Ringwald /**
7289374882SMatthias Ringwald  * @brief Queries the SDP service of the remote device given a service search pattern and a list of attribute IDs.
73*6c927b22SMatthias Ringwald  * The remote data is handled by the SDP parser. The SDP parser delivers attribute values and done event via the callback.
74*6c927b22SMatthias Ringwald  * @param callback for attributes values and done event
75*6c927b22SMatthias Ringwald  * @param remote address
76*6c927b22SMatthias Ringwald  * @param des_service_search_pattern
77*6c927b22SMatthias Ringwald  * @param des_attribute_id_list
783deb3ec6SMatthias Ringwald  */
79*6c927b22SMatthias Ringwald void sdp_client_query(btstack_packet_handler_t callback, bd_addr_t remote, const uint8_t * des_service_search_pattern, const uint8_t * des_attribute_id_list);
803deb3ec6SMatthias Ringwald 
81*6c927b22SMatthias Ringwald /**
82*6c927b22SMatthias Ringwald  * @brief Retrieves all attribute IDs of a SDP record specified by its service record handle and a list of attribute IDs.
83*6c927b22SMatthias Ringwald  * The remote data is handled by the SDP parser. The SDP parser delivers attribute values and done event via the callback.
84*6c927b22SMatthias Ringwald  * @note only provided if ENABLE_SDP_EXTRA_QUERIES is defined
85*6c927b22SMatthias Ringwald  * @param callback for attributes values and done event
86*6c927b22SMatthias Ringwald  * @param remote address
87*6c927b22SMatthias Ringwald  * @param search_service_record_handle
88*6c927b22SMatthias Ringwald  * @param des_attributeIDList
89*6c927b22SMatthias Ringwald  */
90*6c927b22SMatthias Ringwald void sdp_client_service_attribute_search(btstack_packet_handler_t callback, bd_addr_t remote, uint32_t search_service_record_handle, const uint8_t * des_attributeIDList);
91*6c927b22SMatthias Ringwald 
92*6c927b22SMatthias Ringwald /**
93*6c927b22SMatthias Ringwald  * @brief Query the list of SDP records that match a given service search pattern.
94*6c927b22SMatthias Ringwald  * The remote data is handled by the SDP parser. The SDP parser delivers attribute values and done event via the callback.
95*6c927b22SMatthias Ringwald  * @note only provided if ENABLE_SDP_EXTRA_QUERIES is defined
96*6c927b22SMatthias Ringwald  * @param callback for attributes values and done event
97*6c927b22SMatthias Ringwald  * @param remote address
98*6c927b22SMatthias Ringwald  * @param des_service_search_pattern
99*6c927b22SMatthias Ringwald  */
100*6c927b22SMatthias Ringwald void sdp_client_service_search(btstack_packet_handler_t callback, bd_addr_t remote, const uint8_t * des_service_search_pattern);
101*6c927b22SMatthias Ringwald 
102*6c927b22SMatthias Ringwald 
1033deb3ec6SMatthias Ringwald /* API_END */
1043deb3ec6SMatthias Ringwald 
1053deb3ec6SMatthias Ringwald #if defined __cplusplus
1063deb3ec6SMatthias Ringwald }
1073deb3ec6SMatthias Ringwald #endif
1083deb3ec6SMatthias Ringwald 
1093deb3ec6SMatthias Ringwald #endif // __SDP_CLIENT_H
110