AIROC™ BTSDK v4.9 - Documentation | ||||
The Service Discovery Protocol (SDP) allows a device to discover services offered by other devices, and their associated parameters. More...
Data Structures | |
struct | wiced_bt_sdp_discovery_attribute_value_t |
Attribute value. More... | |
struct | t_sdp_discovery_attr |
SDP Attribute. More... | |
struct | sdp_discovery_record_t |
Discovery record from SDP search result. More... | |
struct | wiced_bt_sdp_discovery_db_t |
Discovery database (used for performing service searches and holding search results) More... | |
struct | wiced_bt_sdp_protocol_elem_t |
This structure is used to add protocol lists and find protocol elements. More... | |
Macros | |
#define | SDP_PSM 0x0001 |
Define the PSM that SDP uses. | |
#define | SDP_DISC_ATTR_LEN_MASK 0x0FFF |
Masks for attr_value field of wiced_bt_sdp_discovery_attribute_t. | |
#define | SDP_DISC_ATTR_TYPE(len_type) (len_type >> 12) |
Masks for attr_len_type field of wiced_bt_sdp_discovery_attribute_t. | |
#define | SDP_DISC_ATTR_LEN(len_type) (len_type & SDP_DISC_ATTR_LEN_MASK) |
Masks for attr_len. | |
#define | SDP_MAX_LIST_ELEMS 3 |
Maximum number of protocol list items (list_elem in wiced_bt_sdp_protocol_elem_t) | |
#define | SDP_MAX_UUID_FILTERS 3 |
SDP Max UUID filters. More... | |
#define | SDP_MAX_ATTR_FILTERS 12 |
SDP Max Attribute filters. More... | |
#define | SDP_MAX_PROTOCOL_PARAMS 2 |
SDP Max Protocol Parameters. More... | |
#define | SDP_UINT1(value) (value) |
SDP attribute 1 byte. | |
#define | SDP_UINT2(value) (value) >> 8, (value) & 0xff |
SDP attribute 2 byte. | |
#define | SDP_UINT4(value) (value) >> 24, ((value) >> 16) & 0xff, ((value) >> 8) & 0xff, (value) & 0xff |
SDP attribute 4 byte. | |
#define | SDP_UINT8(value) |
SDP attribute 8 byte. More... | |
#define | SDP_BOOLEAN SDP_UINT1 |
SDP attribute BOOLEAN type. | |
#define | SDP_ATTR_VALUE_UINT1(value) (UINT_DESC_TYPE << 3) | SIZE_ONE_BYTE, SDP_UINT1(value) |
SDP attribute value UINT 1 byte. | |
#define | SDP_ATTR_VALUE_UINT2(value) (UINT_DESC_TYPE << 3) | SIZE_TWO_BYTES, SDP_UINT2(value) |
SDP attribute value UINT 2 byte. | |
#define | SDP_ATTR_VALUE_UINT4(value) (UINT_DESC_TYPE << 3) | SIZE_FOUR_BYTES, SDP_UINT4(value) |
SDP attribute value UINT 4 byte. | |
#define | SDP_ATTR_VALUE_UINT8(value) (UINT_DESC_TYPE << 3) | SIZE_EIGHT_BYTES, SDP_UINT8(value) |
SDP attribute value UINT 8 byte. | |
#define | SDP_ATTR_VALUE_BOOLEAN(value) (BOOLEAN_DESC_TYPE << 3), SDP_UINT1(value) |
SDP attribute value BOOLEAN type. | |
#define | SDP_ATTR_VALUE_TEXT (TEXT_STR_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE |
SDP attribute value text. | |
#define | SDP_ATTR_VALUE_TEXT_1(len) (TEXT_STR_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE, SDP_UINT1(len) |
SDP attribute value text 1 byte. | |
#define | SDP_ATTR_VALUE_TEXT_2(len) (TEXT_STR_DESC_TYPE << 3) | SIZE_IN_NEXT_WORD, SDP_UINT2(len) |
SDP attribute value text 2 byte. | |
#define | SDP_ATTR_VALUE_TEXT_4(len) (TEXT_STR_DESC_TYPE << 3) | SIZE_IN_NEXT_LONG, SDP_UINT4(len) |
SDP attribute value text 4 byte. | |
#define | SDP_ATTR_UINT1(id, value) SDP_ATTR_ID(id), SDP_ATTR_VALUE_UINT1(value) |
SDP attribute id with 1 byte value. | |
#define | SDP_ATTR_UINT2(id, value) SDP_ATTR_ID(id), SDP_ATTR_VALUE_UINT2(value) |
SDP attribute id with 2 byte value. | |
#define | SDP_ATTR_UINT4(id, value) SDP_ATTR_ID(id), SDP_ATTR_VALUE_UINT4(value) |
SDP attribute id with 4 byte value. | |
#define | SDP_ATTR_UINT8(id, value) SDP_ATTR_ID(id), SDP_ATTR_VALUE_UINT8(value) |
SDP attribute id with 8 byte value. | |
#define | SDP_ATTR_BOOLEAN(id, value) SDP_ATTR_ID(id), SDP_ATTR_VALUE_BOOLEAN(value) |
SDP attribute id with BOOLEAN value. | |
#define | SDP_ATTR_ID SDP_ATTR_VALUE_UINT2 |
SDP attribute id. | |
#define | SDP_ATTR_UUID16(uuid) ((UUID_DESC_TYPE << 3) | SIZE_TWO_BYTES), SDP_UINT2(uuid) |
SDP attribute 16 bit UUID. | |
#define | SDP_ATTR_TEXT(id, len) SDP_ATTR_ID(id), SDP_ATTR_VALUE_TEXT, (len) |
SDP attribute id with text. | |
#define | SDP_ATTR_TEXT_1(id, len) SDP_ATTR_ID(id), SDP_ATTR_VALUE_TEXT_1(len) |
SDP attribute id with 1 byte text value. | |
#define | SDP_ATTR_TEXT_2(id, len) SDP_ATTR_ID(id), SDP_ATTR_VALUE_TEXT_2(len) |
SDP attribute id with 2 byte text value. | |
#define | SDP_ATTR_TEXT_4(id, len) SDP_ATTR_ID(id), SDP_ATTR_VALUE_TEXT_4(len) |
SDP attribute id with 4 byte text value. | |
#define | SDP_ATTR_SEQUENCE_1(length) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE), (length) |
SDP attribute Sequence 1 byte. | |
#define | SDP_ATTR_SEQUENCE_2(length) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_WORD), SDP_UINT2(length) |
SDP attribute Sequence 2 byte. | |
#define | SDP_ATTR_SEQUENCE_4(length) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_LONG), SDP_UINT4(length) |
SDP attribute Sequence 4 byte. | |
#define | SDP_ATTR_RECORD_HANDLE(handle) SDP_ATTR_UINT4(ATTR_ID_SERVICE_RECORD_HDL, handle) |
Service Record Handle 0x0000. | |
#define | SDP_ATTR_CLASS_ID(uuid) |
Service Class ID List 0x0001. More... | |
#define | SDP_ATTR_SERVICE_RECORD_STATE(state) SDP_ATTR_UINT4(ATTR_ID_SERVICE_RECORD_STATE, state) |
Service Record State 0x0002. | |
#define | SDP_ATTR_SERVICE_ID(uuid) |
Service ID 0x0003. More... | |
#define | SDP_ATTR_PROTOCOL_DESC_LIST(l2cap_chan) |
Protocol Descriptor List 0x0004 for L2CAP. More... | |
#define | SDP_ATTR_SDP_PROTOCOL_DESC_LIST(l2cap_chan) |
Protocol Descriptor List 0x0004 for SDP. More... | |
#define | SDP_ATTR_HIDP_PROTOCOL_DESC_LIST(l2cap_chan) |
Protocol Descriptor List 0x0004 for HIDP. More... | |
#define | SDP_ATTR_RFCOMM_PROTOCOL_DESC_LIST(scn) |
Protocol Descriptor List 0x0004 for RFCOMM. More... | |
#define | SDP_ATTR_BROWSE_LIST |
Browse Group List 0x0005. More... | |
#define | SDP_ATTR_LANGUAGE_BASE_ATTR_ID_LIST |
Language Base 0x0006. More... | |
#define | SDP_ATTR_SERVICE_INFO_TIME_TO_LIVE(seconds) SDP_ATTR_UINT4(ATTR_ID_SERVICE_INFO_TIME_TO_LIVE, seconds) |
Service Info Time to Live 0x0007. | |
#define | SDP_ATTR_SERVICE_AVAILABILITY(availability) SDP_ATTR_UINT1(ATTR_ID_SERVICE_AVAILABILITY, availability) |
Service Availability 0x0008. | |
#define | SDP_ATTR_PROFILE_DESC_LIST(uuid, version) |
Bluetooth Profile Descriptor List 0x0009. More... | |
#define | SDP_ATTR_DOCUMENTATION_URL(len) SDP_ATTR_TEXT_1(ATTR_ID_DOCUMENTATION_URL, len) |
Documentation URL 0x000A. | |
#define | SDP_ATTR_CLIENT_EXECUTABLE_URL(len) SDP_ATTR_TEXT_1(ATTR_ID_CLIENT_EXE_URL, len) |
Client Executable URL 0x000B. | |
#define | SDP_ATTR_ICON_URL(len) SDP_ATTR_TEXT_1(ATTR_ID_ICON_URL, len) |
Icon URL 0x000C. | |
#define | SDP_ATTR_SERVICE_NAME(len) SDP_ATTR_TEXT_1(ATTR_ID_SERVICE_NAME, len) |
Service Name LANGUAGE_BASE_ID (0x0100) + 0x0000 = 0x0100. | |
#define | SDP_ATTR_SERVICE_DESCRIPTION(len) SDP_ATTR_TEXT_1(ATTR_ID_SERVICE_DESCRIPTION, len) |
Service Description LANGUAGE_BASE_ID (0x0100) + 0x0001 = 0x0101. | |
#define | SDP_ATTR_PROVIDER_NAME(len) SDP_ATTR_TEXT_1(ATTR_ID_PROVIDER_NAME, len) |
Provider Name LANGUAGE_BASE_ID (0x0100) + 0x0002 = 0x0102. | |
#define | SDP_ATTR_GROUP_ID(uuid) |
Group ID 0x0200. More... | |
#define | SDP_ATTR_VERSION_NUMBER_LIST(version) SDP_ATTR_UINT2(ATTR_ID_SPECIFICATION_ID, version) |
Version Number List 0x0200. | |
#define | SDP_ATTR_SERVICE_DATABASE_STATE(state) SDP_ATTR_UINT4(ATTR_ID_VENDOR_ID, state) |
Service Database State 0x0201. | |
Typedefs | |
typedef void( | wiced_bt_sdp_discovery_complete_cback_t )(uint16_t sdp_result) |
Service discovery complete callback. More... | |
typedef struct t_sdp_discovery_attr | wiced_bt_sdp_discovery_attribute_t |
SDP Attribute. | |
typedef struct sdp_discovery_record_t | wiced_bt_sdp_discovery_record_t |
Discovery record from SDP search result. | |
Enumerations | |
enum | wiced_bt_sdp_result_t { WICED_BT_SDP_SUCCESS = WICED_BT_SUCCESS, WICED_BT_SDP_INVALID_VERSION = 0x0001, WICED_BT_SDP_INVALID_SERV_REC_HDL = 0x0002, WICED_BT_SDP_INVALID_REQ_SYNTAX = 0x0003, WICED_BT_SDP_INVALID_PDU_SIZE = 0x0004, WICED_BT_SDP_INVALID_CONT_STATE = 0x0005, WICED_BT_SDP_NO_RESOURCES = 0x0006, WICED_BT_SDP_DI_REG_FAILED = 0x0007, WICED_BT_SDP_DI_DISC_FAILED = 0x0008, WICED_BT_SDP_NO_DI_RECORD_FOUND = 0x0009, WICED_BT_SDP_ERR_ATTR_NOT_PRESENT = 0x000A, WICED_BT_SDP_ILLEGAL_PARAMETER = 0x000B, WICED_BT_SDP_NO_RECS_MATCH = 0xFFF0, WICED_BT_SDP_CONN_FAILED = 0xFFF1, WICED_BT_SDP_CFG_FAILED = 0xFFF2, WICED_BT_SDP_GENERIC_ERROR = 0xFFF3, WICED_BT_SDP_DB_FULL = 0xFFF4, WICED_BT_SDP_INVALID_PDU = 0xFFF5, WICED_BT_SDP_SECURITY_ERR = 0xFFF6, WICED_BT_SDP_CONN_REJECTED = 0xFFF7, WICED_BT_SDP_CANCEL = 0xFFF8 } |
SDP result - Success code and error codes. More... | |
The Service Discovery Protocol (SDP) allows a device to discover services offered by other devices, and their associated parameters.
For example, when you use a mobile phone with a Bluetooth headset, the phone uses SDP to determine which Bluetooth profiles the headset can use (Headset Profile, Hands Free Profile, Advanced Audio Distribution Profile (A2DP) etc.) and the protocol multiplexer settings needed for the phone to connect to the headset using each of them. Each service is identified by a Universally Unique Identifier (UUID), with official services (Bluetooth profiles) assigned a short form UUID (16 bits rather than the full 128).
#define SDP_ATTR_BROWSE_LIST |
Browse Group List 0x0005.
#define SDP_ATTR_CLASS_ID | ( | uuid | ) |
Service Class ID List 0x0001.
#define SDP_ATTR_GROUP_ID | ( | uuid | ) |
Group ID 0x0200.
#define SDP_ATTR_HIDP_PROTOCOL_DESC_LIST | ( | l2cap_chan | ) |
Protocol Descriptor List 0x0004 for HIDP.
#define SDP_ATTR_LANGUAGE_BASE_ATTR_ID_LIST |
Language Base 0x0006.
#define SDP_ATTR_PROFILE_DESC_LIST | ( | uuid, | |
version | |||
) |
Bluetooth Profile Descriptor List 0x0009.
#define SDP_ATTR_PROTOCOL_DESC_LIST | ( | l2cap_chan | ) |
Protocol Descriptor List 0x0004 for L2CAP.
#define SDP_ATTR_RFCOMM_PROTOCOL_DESC_LIST | ( | scn | ) |
Protocol Descriptor List 0x0004 for RFCOMM.
#define SDP_ATTR_SDP_PROTOCOL_DESC_LIST | ( | l2cap_chan | ) |
Protocol Descriptor List 0x0004 for SDP.
#define SDP_ATTR_SERVICE_ID | ( | uuid | ) |
Service ID 0x0003.
#define SDP_MAX_ATTR_FILTERS 12 |
SDP Max Attribute filters.
num_attr field of wiced_bt_sdp_init_discovery_db API should be less than SDP_MAX_ATTR_FILTERS
#define SDP_MAX_PROTOCOL_PARAMS 2 |
SDP Max Protocol Parameters.
num_params field in wiced_bt_sdp_protocol_elem_t structure
#define SDP_MAX_UUID_FILTERS 3 |
SDP Max UUID filters.
num_uuid field of wiced_bt_sdp_init_discovery_db API should be less than SDP_MAX_UUID_FILTERS
#define SDP_UINT8 | ( | value | ) |
SDP attribute 8 byte.
typedef void( wiced_bt_sdp_discovery_complete_cback_t)(uint16_t sdp_result) |
Service discovery complete callback.
If discovery was successful, the discovery results database (provided when wiced_bt_sdp_service_search_request or wiced_bt_sdp_service_search_attribute_request was called) will be filled.
Use the wiced_bt_sdp_find_* utility functions to parse the results.
[in] | sdp_result | : SDP result code (see wiced_bt_sdp_result_t ) |
SDP result - Success code and error codes.
wiced_bool_t wiced_bt_sdp_cancel_service_search | ( | wiced_bt_sdp_discovery_db_t * | p_db | ) |
Cancel service search request.
[in] | p_db | : Discovery database of the request being cancelled |
wiced_bool_t wiced_bt_sdp_db_init | ( | const uint8_t * | p_sdp_db, |
uint16_t | size | ||
) |
Initialize local SDP server database.
[in] | p_sdp_db | First element in database array |
[in] | size | size (in bytes) of SDP database |
wiced_bt_sdp_discovery_record_t* wiced_bt_sdp_find_attribute_in_db | ( | wiced_bt_sdp_discovery_db_t * | p_db, |
uint16_t | attr_id, | ||
wiced_bt_sdp_discovery_record_t * | p_start_rec | ||
) |
Parse results from service search.
Look next record in discovery database containing attribute ID.
[in] | p_db | : Discovery results database |
[in] | attr_id | : Attribute ID to find |
[in] | p_start_rec | : Starting record to search from (if NULL, start from beginning of database) |
wiced_bt_sdp_discovery_attribute_t* wiced_bt_sdp_find_attribute_in_rec | ( | wiced_bt_sdp_discovery_record_t * | p_rec, |
uint16_t | attr_id | ||
) |
Parse SDP record.
Look for requested attribute in the service record.
[in] | p_rec | : Service record |
[in] | attr_id | : Attribute ID to find |
wiced_bool_t wiced_bt_sdp_find_profile_version_in_rec | ( | wiced_bt_sdp_discovery_record_t * | p_rec, |
uint16_t | profile_uuid, | ||
uint16_t * | p_version | ||
) |
Parse SDP record.
Look for version of requested profile.
[in] | p_rec | : Service record |
[in] | profile_uuid | Profile to find |
[out] | p_version | : Major/minor version of profile (if found) |
wiced_bool_t wiced_bt_sdp_find_protocol_list_elem_in_rec | ( | wiced_bt_sdp_discovery_record_t * | p_rec, |
uint16_t | layer_uuid, | ||
wiced_bt_sdp_protocol_elem_t * | p_elem | ||
) |
Parse SDP record.
Look for requested protocol list element in the service record.
[in] | p_rec | : Service record |
[in] | layer_uuid | : protocol list element to find |
[out] | p_elem | : protocol list element (if found) |
wiced_bool_t wiced_bt_sdp_find_protocol_lists_elem_in_rec | ( | wiced_bt_sdp_discovery_record_t * | p_rec, |
uint16_t | layer_uuid, | ||
wiced_bt_sdp_protocol_elem_t * | p_elem | ||
) |
Parse SDP record.
Look for requested protocol lists element in the service record.
[in] | p_rec | : Service record |
[in] | layer_uuid | : protocol lists element to find |
[out] | p_elem | : protocol lists element (if found) |
wiced_bt_sdp_discovery_record_t* wiced_bt_sdp_find_service_in_db | ( | wiced_bt_sdp_discovery_db_t * | p_db, |
uint16_t | service_uuid, | ||
wiced_bt_sdp_discovery_record_t * | p_start_rec | ||
) |
Parse results from service search.
Look next record in discovery database containing requested service UUID (specified using uint16_t)
[in] | p_db | : Discovery results database |
[in] | service_uuid | Service to find |
[in] | p_start_rec | : Starting record to search from (if NULL, start from beginning of database) |
wiced_bt_sdp_discovery_record_t* wiced_bt_sdp_find_service_uuid_in_db | ( | wiced_bt_sdp_discovery_db_t * | p_db, |
wiced_bt_uuid_t * | p_uuid, | ||
wiced_bt_sdp_discovery_record_t * | p_start_rec | ||
) |
Parse results from service search.
Look next record in discovery database containing requested service UUID (specified using wiced_bt_uuid_t structure)
[in] | p_db | : Discovery results database |
[in] | p_uuid | : Service to find |
[in] | p_start_rec | : Starting record to search from (if NULL, start from beginning of database) |
wiced_bool_t wiced_bt_sdp_find_service_uuid_in_rec | ( | wiced_bt_sdp_discovery_record_t * | p_rec, |
wiced_bt_uuid_t * | p_uuid | ||
) |
Parse SDP record.
Look for service UUID
[in] | p_rec | : Service record |
[out] | p_uuid | : Service UUID of the record |
wiced_bool_t wiced_bt_sdp_init_discovery_db | ( | wiced_bt_sdp_discovery_db_t * | p_db, |
uint32_t | len, | ||
uint16_t | num_uuid, | ||
wiced_bt_uuid_t * | p_uuid_list, | ||
uint16_t | num_attr, | ||
uint16_t * | p_attr_list | ||
) |
Initialize discovery database prior to performing service discovery (using wiced_bt_sdp_service_search_request or wiced_bt_sdp_service_search_request ).
Provides a list of UUIDs and/or attribute IDs to search for.
[in] | p_db | : Discovery database to initialize |
[in] | len | : size of discovery database |
[in] | num_uuid | : Number of UUIDs in p_uuid_list |
[in] | p_uuid_list | : UUIDs to add to discovery database |
[in] | num_attr | : Number of attributes in p_attr_list |
[in] | p_attr_list | : Attributes to add to discovery database |
wiced_bool_t wiced_bt_sdp_service_search_attribute_request | ( | uint8_t * | p_bd_addr, |
wiced_bt_sdp_discovery_db_t * | p_db, | ||
wiced_bt_sdp_discovery_complete_cback_t * | p_cb | ||
) |
Initiate combined service search and attribute request on remote device.
[in] | p_bd_addr | : Remote device address |
[in] | p_db | : Discovery database of UUIDs and attribute IDs to search for (intialized using wiced_bt_sdp_init_discovery_db ) |
[in] | p_cb | : Callback for discovery results |
wiced_bool_t wiced_bt_sdp_service_search_request | ( | uint8_t * | p_bd_addr, |
wiced_bt_sdp_discovery_db_t * | p_db, | ||
wiced_bt_sdp_discovery_complete_cback_t * | p_cb | ||
) |
Initiate service search on remote device.
[in] | p_bd_addr | : Remote device address |
[in] | p_db | : Discovery database of UUIDs and attribute IDs to search for (intialized using wiced_bt_sdp_init_discovery_db ) |
[in] | p_cb | : Callback for discovery results |