MT2523 API Reference  LinkIt SDK v4
bt_sdp.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __BT_SDP_H__
36 #define __BT_SDP_H__
37 
137 #include <stdint.h>
138 #include "bt_type.h"
139 
140 BT_EXTERN_C_BEGIN
141 
164 typedef uint8_t bt_sdp_data_element_type_t;
166 #define BT_SDP_DATA_ELEMENT_TYPE_NIL 0x00
168 #define BT_SDP_DATA_ELEMENT_TYPE_UINT 0x08
171 #define BT_SDP_DATA_ELEMENT_TYPE_SINT 0x10
174 #define BT_SDP_DATA_ELEMENT_TYPE_UUID 0x18
177 #define BT_SDP_DATA_ELEMENT_TYPE_TEXT 0x20
180 #define BT_SDP_DATA_ELEMENT_TYPE_BOOL 0x28
182 #define BT_SDP_DATA_ELEMENT_TYPE_SEQ 0x30
185 #define BT_SDP_DATA_ELEMENT_TYPE_ALT 0x38
189 #define BT_SDP_DATA_ELEMENT_TYPE_URL 0x40
192 #define BT_SDP_DATA_ELEMENT_TYPE_MASK 0xf8
195 typedef uint8_t bt_sdp_data_element_size_t;
197 #define BT_SDP_DATA_ELEMENT_SIZE_1BYTE 0x00
199 #define BT_SDP_DATA_ELEMENT_SIZE_2BYTE 0x01
200 #define BT_SDP_DATA_ELEMENT_SIZE_4BYTE 0x02
201 #define BT_SDP_DATA_ELEMENT_SIZE_8BYTE 0x03
202 #define BT_SDP_DATA_ELEMENT_SIZE_16BYTE 0x04
203 #define BT_SDP_DATA_ELEMENT_SIZE_ADDITIONAL_8BIT 0x05
205 #define BT_SDP_DATA_ELEMENT_SIZE_ADDITIONAL_16BIT 0x06
207 #define BT_SDP_DATA_ELEMENT_SIZE_ADDITIONAL_32BIT 0x07
209 #define BT_SDP_DATA_ELEMENT_SIZE_MASK 0x07
220 typedef uint16_t bt_sdp_attribute_id_t;
223 #define BT_SDP_ATTRIBUTE_ID_INVALID 0xFFFF
239 #define BT_SDP_ATTRIBUTE_ID_SERVICE_CLASS_ID_LIST 0x0001
240 
249 #define BT_SDP_ATTRIBUTE_ID_SERVICE_RECORD_STATE 0x0002
250 #define BT_SDP_ATTRIBUTE_ID_SERVICE_ID 0x0003
251 #define BT_SDP_ATTRIBUTE_ID_PROTOCOL_DESC_LIST 0x0004
252 #define BT_SDP_ATTRIBUTE_ID_BROWSE_GROUP_LIST 0x0005
253 #define BT_SDP_ATTRIBUTE_ID_LANG_BASE_ID_LIST 0x0006
255 #define BT_SDP_ATTRIBUTE_ID_SERVICE_INFO_TIME_TO_LIVE 0x0007
256 #define BT_SDP_ATTRIBUTE_ID_SERVICE_AVAILABILITY 0x0008
257 #define BT_SDP_ATTRIBUTE_ID_BT_PROFILE_DESC_LIST 0x0009
258 #define BT_SDP_ATTRIBUTE_ID_DOC_URL 0x000a
259 #define BT_SDP_ATTRIBUTE_ID_CLIENT_EXEC_URL 0x000b
260 #define BT_SDP_ATTRIBUTE_ID_ICON_URL 0x000c
261 #define BT_SDP_ATTRIBUTE_ID_ADDITIONAL_PROT_DESC_LISTS 0x000d
268 #define BT_SDP_ATTRIBUTE_ID_SERVICE_NAME 0x0000
269 #define BT_SDP_ATTRIBUTE_ID_SERVICE_DESCRIPTION 0x0001
270 #define BT_SDP_ATTRIBUTE_ID_PROVIDER_NAME 0x0002
280 #define BT_SDP_ATTRIBUTE_ID_GROUP_ID 0x0200
281 
288 #define BT_SDP_ATTRIBUTE_ID_VERSION_NUMBER_LIST 0x0200
289 #define BT_SDP_ATTRIBUTE_ID_SERVICE_DATABASE_STATE 0x0201
295 #define BT_SDP_ATTRIBUTE_ID_SUPPORTED_FEATURES 0x0311
300 #define BT_SDP_ATTRIBUTE_ID_SUPPORTED_REPOSITORIES 0x0314
301 
308 typedef uint16_t bt_sdp_service_class_id_t;
313 #define BT_SDP_SERVICE_CLASS_SERVICE_DISCOVERY_SERVER 0x1000
314 
318 #define BT_SDP_SERVICE_CLASS_BROWSE_GROUP_DESC 0x1001
319 
323 #define BT_SDP_SERVICE_CLASS_PUBLIC_BROWSE_GROUP 0x1002
324 
328 #define BT_SDP_SERVICE_CLASS_SERIAL_PORT 0x1101
329 
333 #define BT_SDP_SERVICE_CLASS_OBEX_OBJECT_PUSH 0x1105
334 
338 #define BT_SDP_SERVICE_CLASS_OBEX_FILE_TRANSFER 0x1106
339 
340 
344 #define BT_SDP_SERVICE_CLASS_HEADSET 0x1108
345 
349 #define BT_SDP_SERVICE_CLASS_AUDIO_SOURCE 0x110A
350 
354 #define BT_SDP_SERVICE_CLASS_AUDIO_SINK 0x110B
355 
359 #define BT_SDP_SERVICE_CLASS_AV_REMOTE_CONTROL_TARGET 0x110C
360 
364 #define BT_SDP_SERVICE_CLASS_AUDIO_DISTRIBUTION 0x110D
365 
369 #define BT_SDP_SERVICE_CLASS_AV_REMOTE_CONTROL 0x110E
370 
374 #define BT_SDP_SERVICE_CLASS_AV_REMOTE_CONTROL_CONTROL 0x110F
375 
379 #define BT_SDP_SERVICE_CLASS_HEADSET_AUDIO_GATEWAY 0x1112
380 
384 #define BT_SDP_SERVICE_CLASS_HANDSFREE 0x111E
385 
389 #define BT_SDP_SERVICE_CLASS_HANDSFREE_AUDIO_GATEWAY 0x111F
390 
394 #define BT_SDP_SERVICE_CLASS_HUMAN_INTERFACE_DEVICE 0x1124
395 
396 
400 #define BT_SDP_SERVICE_CLASS_SIM_ACCESS 0x112D
401 
405 #define BT_SDP_SERVICE_CLASS_PBAP_CLIENT 0x112E
406 
410 #define BT_SDP_SERVICE_CLASS_PBAP_SERVER 0x112F
411 
415 #define BT_SDP_SERVICE_CLASS_PBAP 0x1130
416 
420 #define BT_SDP_SERVICE_CLASS_HEADSET_HS 0x1131
421 
425 #define BT_SDP_SERVICE_CLASS_GENERIC_AUDIO 0x1203
426 
427 
434 typedef uint16_t bt_sdp_protocol_uuid_t;
436 #define BT_SDP_INVALID_UUID 0xFFFF
438 #define BT_SDP_PROTOCOL_SDP 0x0001
440 #define BT_SDP_PROTOCOL_RFCOMM 0x0003
442 #define BT_SDP_PROTOCOL_ATT 0x0007
444 #define BT_SDP_PROTOCOL_OBEX 0x0008
446 #define BT_SDP_PROTOCOL_AVCTP 0x0017
448 #define BT_SDP_PROTOCOL_AVDTP 0x0019
450 #define BT_SDP_PROTOCOL_L2CAP 0x0100
465 #define BT_SDP_ATTRIBUTE(attribute_id, attribute) \
466  { attribute_id, /* Attribute ID. */ \
467  sizeof(attribute), /* Attribute size. */ \
468  attribute } /* Attribute value. */
469 
480 #define BT_SDP_ATTRIBUTE_HEADER_8BIT(size) \
481  BT_SDP_DATA_ELEMENT_TYPE_SEQ + BT_SDP_DATA_ELEMENT_SIZE_ADDITIONAL_8BIT, /* Type and size index is 0x35. */ \
482  size /* 8-bit size. */
483 
494 #define BT_SDP_ATTRIBUTE_HEADER_16BIT(size) \
495  BT_SDP_DATA_ELEMENT_TYPE_SEQ + BT_SDP_DATA_ELEMENT_SIZE_ADDITIONAL_16BIT, /* Type and size index is 0x36. */ \
496  (uint8_t)(((size) & 0xff00) >> 8), /* Bits[15:8] of size. */ \
497  (uint8_t)((size) & 0x00ff) /* Bits[7:0] of size. */
498 
509 #define BT_SDP_ATTRIBUTE_HEADER_32BIT(size) \
510  BT_SDP_DATA_ELEMENT_TYPE_SEQ + BT_SDP_DATA_ELEMENT_SIZE_ADDITIONAL_32BIT, /* Type and size index is 0x37. */ \
511  (uint8_t)(((size) & 0xff000000) >> 24), /* Bits[32:24] of size. */ \
512  (uint8_t)(((size) & 0x00ff0000) >> 16), /* Bits[23:16] of size. */ \
513  (uint8_t)(((size) & 0x0000ff00) >> 8), /* Bits[15:8] of size. */ \
514  (uint8_t)((size) & 0x000000ff) /* Bits[7:0] of size. */
515 
523 #define BT_SDP_UUID_16BIT(uuid) \
524  BT_SDP_DATA_ELEMENT_TYPE_UUID + BT_SDP_DATA_ELEMENT_SIZE_2BYTE, /* Type and size index is 0x19 */ \
525  (uint8_t)(((uuid) & 0xff00) >> 8), /* Bits[15:8] of UUID */ \
526  (uint8_t)((uuid) & 0x00ff) /* Bits[7:0] of UUID */
527 
536 #define BT_SDP_UUID_32BIT(uuid) \
537  BT_SDP_DATA_ELEMENT_TYPE_UUID + BT_SDP_DATA_ELEMENT_SIZE_4BYTE, /* Type and size index is 0x1A */ \
538  (uint8_t)(((uuid) & 0xff000000) >> 24), /* Bits[32:24] of UUID */ \
539  (uint8_t)(((uuid) & 0x00ff0000) >> 16), /* Bits[23:16] of UUID */ \
540  (uint8_t)(((uuid) & 0x0000ff00) >> 8), /* Bits[15:8] of UUID */ \
541  (uint8_t)((uuid) & 0x000000ff) /* Bits[7:0] of UUID */
542 
553 #define BT_SDP_UUID_128BIT(uuid) /* UUID must be a 16-byte array */ \
554  BT_SDP_DATA_ELEMENT_TYPE_UUID + BT_SDP_DATA_ELEMENT_SIZE_16BYTE, /* Type and size index is 0x1C. */ \
555  uuid /* 128-bit UUID */
556 
564 #define BT_SDP_UINT_8BIT(uint) \
565  BT_SDP_DATA_ELEMENT_TYPE_UINT + BT_SDP_DATA_ELEMENT_SIZE_1BYTE, /* Type and size index is 0x08. */ \
566  (uint8_t)(uint) /* 8-bit unsigned integer */
567 
575 #define BT_SDP_UINT_16BIT(uint) \
576  BT_SDP_DATA_ELEMENT_TYPE_UINT + BT_SDP_DATA_ELEMENT_SIZE_2BYTE, /* Type and size index is 0x09. */ \
577  (uint8_t)(((uint) & 0xff00) >> 8), /* Bits[15:8] of unsigned integer */ \
578  (uint8_t)((uint) & 0x00ff) /* Bits[7:0] of unsigned integer */
579 
587 #define BT_SDP_UINT_32BIT(uint) \
588  BT_SDP_DATA_ELEMENT_TYPE_UINT + BT_SDP_DATA_ELEMENT_SIZE_4BYTE, /* Type and size index is 0x0A. */ \
589  (uint8_t)(((uint) & 0xff000000) >> 24), /* Bits[31:24] of unsigned integer */ \
590  (uint8_t)(((uint) & 0x00ff0000) >> 16), /* Bits[23:16] of unsigned integer */ \
591  (uint8_t)(((uint) & 0x0000ff00) >> 8), /* Bits[15:8] of unsigned integer */ \
592  (uint8_t)((uint) & 0x000000ff) /* Bits[7:0] of unsigned integer */
593 
601 #define BT_SDP_UINT_64BIT(uint) /* unsigned integer must be an 8-byte array */ \
602  BT_SDP_DATA_ELEMENT_TYPE_UINT + BT_SDP_DATA_ELEMENT_SIZE_8BYTE, /* Type and size index is 0x0B. */ \
603  uint /* 64-bit unsigned integer */
604 
612 #define BT_SDP_UINT_128BIT(uint) /* unsigned integer must be a 16-byte array */ \
613  BT_SDP_DATA_ELEMENT_TYPE_UINT + BT_SDP_DATA_ELEMENT_SIZE_16BYTE, /* Type and size index is 0x0C. */ \
614  uint /* 128-bit unsigned integer */
615 
626 #define BT_SDP_TEXT_8BIT(size) \
627  BT_SDP_DATA_ELEMENT_TYPE_TEXT + BT_SDP_DATA_ELEMENT_SIZE_ADDITIONAL_8BIT, /* Type and size index is 0x25. */ \
628  (uint8_t)(size) /* 8-bit size */
629 
640 #define BT_SDP_TEXT_16BIT(size) \
641  BT_SDP_DATA_ELEMENT_TYPE_TEXT + BT_SDP_DATA_ELEMENT_SIZE_ADDITIONAL_16BIT, /* Type and size index is 0x26. */ \
642  (uint8_t)(((size) & 0xff00) >> 8), /* Bits[15:8] of size */ \
643  (uint8_t)((size) & 0x00ff) /* Bits[7:0] of size */
644 
655 #define BT_SDP_TEXT_32BIT(size) \
656  BT_SDP_DATA_ELEMENT_TYPE_TEXT + BT_SDP_DATA_ELEMENT_SIZE_ADDITIONAL_32BIT, /* Type and size index is 0x27. */ \
657  (uint8_t)(((size) & 0xff000000) >> 24), /* Bits[32:24] of size */ \
658  (uint8_t)(((size) & 0x00ff0000) >> 16), /* Bits[23:16] of size */ \
659  (uint8_t)(((size) & 0x0000ff00) >> 8), /* Bits[15:8] of size */ \
660  (uint8_t)((size) & 0x000000ff) /* Bits[7:0] of size */
661 
672 #define BT_SDP_URL_8BIT(size) \
673  BT_SDP_DATA_ELEMENT_TYPE_URL + BT_SDP_DATA_ELEMENT_SIZE_ADDITIONAL_8BIT, \
674  (uint8_t)(size)
675 
683 #define BT_SDP_BOOL(value) \
684  BT_SDP_DATA_ELEMENT_TYPE_BOOL + BT_SDP_DATA_ELEMENT_SIZE_1BYTE, /* Type and size index is 0x28. */ \
685  (uint8_t)(value) /* Boolean value */
686 
700 typedef struct {
701  uint16_t attribute_id;
702  uint16_t length;
703  const uint8_t *value;
705 
709 typedef struct {
710  uint16_t attribute_list_length;
711  const bt_sdps_attribute_t *attribute_list;
713 
723 uint8_t bt_sdps_get_customized_record(const bt_sdps_record_t *** record_list);
724 
725 BT_EXTERN_C_END
726 
734 #endif /* __BT_SDP_H__ */
735 
uint8_t bt_sdp_data_element_type_t
Data elements begin with a single byte that contains both type and size information.
Definition: bt_sdp.h:164
uint8_t bt_sdps_get_customized_record(const bt_sdps_record_t ***record_list)
This is a user defined callback and called by the SDP.
uint16_t bt_sdp_service_class_id_t
The UUIDs associated with a specific service and profile.
Definition: bt_sdp.h:317
Defines the attribute list of the SDP record.
Definition: bt_sdp.h:718
Defines the attribute of the SDP record.
Definition: bt_sdp.h:709
uint16_t bt_sdp_protocol_uuid_t
The UUIDs associated with protocols.
Definition: bt_sdp.h:443