mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(bt/bluedroid): Fixed the SDP API compatibility bug
This commit is contained in:
parent
cda2846558
commit
1cfb537813
@ -126,6 +126,7 @@ config BT_L2CAP_ENABLED
|
|||||||
config BT_SDP_COMMON_ENABLED
|
config BT_SDP_COMMON_ENABLED
|
||||||
bool "BT SDP COMMON"
|
bool "BT SDP COMMON"
|
||||||
depends on BT_CLASSIC_ENABLED
|
depends on BT_CLASSIC_ENABLED
|
||||||
|
default y if BT_L2CAP_ENABLED
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
This enables common SDP operation, such as SDP record creation and deletion.
|
This enables common SDP operation, such as SDP record creation and deletion.
|
||||||
|
@ -65,64 +65,66 @@ typedef enum {
|
|||||||
/**
|
/**
|
||||||
* @brief SDP header structure
|
* @brief SDP header structure
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_hdr_overlay {
|
||||||
esp_bluetooth_sdp_types_t type; /*!< SDP type */
|
esp_bluetooth_sdp_types_t type; /*!< SDP type */
|
||||||
uint32_t service_name_length; /*!< Service name length */
|
esp_bt_uuid_t uuid; /*!< UUID type, include uuid and uuid length, only needed to be set for RAW record creation */
|
||||||
char *service_name; /*!< Service name */
|
uint32_t service_name_length; /*!< Service name length */
|
||||||
int32_t rfcomm_channel_number; /*!< RFCOMM channel number, if not used set to -1*/
|
char *service_name; /*!< Service name */
|
||||||
int32_t l2cap_psm; /*!< L2CAP psm, if not used set to -1 */
|
int32_t rfcomm_channel_number; /*!< RFCOMM channel number, if not used set to -1*/
|
||||||
int32_t profile_version; /*!< Profile version */
|
int32_t l2cap_psm; /*!< L2CAP psm, if not used set to -1 */
|
||||||
} esp_bluetooth_sdp_hdr_t;
|
int32_t profile_version; /*!< Profile version */
|
||||||
|
int user1_ptr_len; /*!< User data1 length, only used for searching RAW record */
|
||||||
|
uint8_t *user1_ptr; /*!< User data1 pointer to the raw SDP response data, only used for searching RAW record */
|
||||||
|
int user2_ptr_len __attribute__((deprecated)); /*!< User data2 length, only used for searching RAW record */
|
||||||
|
uint8_t *user2_ptr __attribute__((deprecated)); /*!< User data2 pointer, only used for searching RAW record */
|
||||||
|
} esp_bluetooth_sdp_hdr_overlay_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Raw SDP record
|
* @brief Raw SDP record
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_raw_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
esp_bt_uuid_t uuid; /*!< UUID type, include uuid and uuid length */
|
|
||||||
int user1_ptr_len; /*!< Length of raw SDP data */
|
|
||||||
uint8_t *user1_ptr; /*!< Raw SDP data */
|
|
||||||
} esp_bluetooth_sdp_raw_record_t;
|
} esp_bluetooth_sdp_raw_record_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Message Access Profile - Server parameters
|
* @brief Message Access Profile - Server parameters
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_mas_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
uint32_t mas_instance_id; /*!< MAS Instance ID */
|
uint32_t mas_instance_id; /*!< MAS Instance ID */
|
||||||
uint32_t supported_features; /*!< Map supported features */
|
uint32_t supported_features; /*!< Map supported features */
|
||||||
uint32_t supported_message_types; /*!< Supported message types */
|
uint32_t supported_message_types; /*!< Supported message types */
|
||||||
} esp_bluetooth_sdp_mas_record_t;
|
} esp_bluetooth_sdp_mas_record_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Message Access Profile - Client (Notification Server) parameters
|
* @brief Message Access Profile - Client (Notification Server) parameters
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_mns_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
uint32_t supported_features; /*!< Supported features */
|
uint32_t supported_features; /*!< Supported features */
|
||||||
} esp_bluetooth_sdp_mns_record_t;
|
} esp_bluetooth_sdp_mns_record_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Phone Book Profile - Server parameters
|
* @brief Phone Book Profile - Server parameters
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_pse_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
uint32_t supported_features; /*!< PBAP Supported Features */
|
uint32_t supported_features; /*!< PBAP Supported Features */
|
||||||
uint32_t supported_repositories; /*!< Supported Repositories */
|
uint32_t supported_repositories; /*!< Supported Repositories */
|
||||||
} esp_bluetooth_sdp_pse_record_t;
|
} esp_bluetooth_sdp_pse_record_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Phone Book Profile - Client parameters
|
* @brief Phone Book Profile - Client parameters
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_pce_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
} esp_bluetooth_sdp_pce_record_t;
|
} esp_bluetooth_sdp_pce_record_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Object Push Profile parameters
|
* @brief Object Push Profile parameters
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_ops_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
int supported_formats_list_len; /*!< Supported formats list length */
|
int supported_formats_list_len; /*!< Supported formats list length */
|
||||||
uint8_t supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH]; /*!< Supported formats list */
|
uint8_t supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH]; /*!< Supported formats list */
|
||||||
} esp_bluetooth_sdp_ops_record_t;
|
} esp_bluetooth_sdp_ops_record_t;
|
||||||
@ -130,8 +132,8 @@ typedef struct {
|
|||||||
/**
|
/**
|
||||||
* @brief SIM Access Profile parameters
|
* @brief SIM Access Profile parameters
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_sap_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
} esp_bluetooth_sdp_sap_record_t;
|
} esp_bluetooth_sdp_sap_record_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,21 +150,21 @@ typedef enum {
|
|||||||
* @note Only one primary Device Identification service record can be added in the SDP database. If primary
|
* @note Only one primary Device Identification service record can be added in the SDP database. If primary
|
||||||
* Device Identification service is created multiple times, only the last one will take effect.
|
* Device Identification service is created multiple times, only the last one will take effect.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_dip_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
uint16_t vendor; /*!< Vendor ID */
|
uint16_t vendor; /*!< Vendor ID */
|
||||||
uint16_t vendor_id_source; /*!< Vendor ID source, 0x0001 for Bluetooth, 0x0002 for USB, other values reserved, see `esp_sdp_vendor_id_source_t` */
|
uint16_t vendor_id_source; /*!< Vendor ID source, 0x0001 for Bluetooth, 0x0002 for USB, other values reserved, see `esp_sdp_vendor_id_source_t` */
|
||||||
uint16_t product; /*!< Product ID */
|
uint16_t product; /*!< Product ID */
|
||||||
uint16_t version; /*!< Release version in format 0xJJMN(JJ – major number, M – minor number, N – sub-minor number) */
|
uint16_t version; /*!< Release version in format 0xJJMN(JJ – major number, M – minor number, N – sub-minor number) */
|
||||||
bool primary_record; /*!< Indicate if the record is primary, shall set to true if there is a only single device
|
bool primary_record; /*!< Indicate if the record is primary, shall set to true if there is a only single device
|
||||||
record, others shall be set to false */
|
record, others shall be set to false */
|
||||||
} esp_bluetooth_sdp_dip_record_t;
|
} esp_bluetooth_sdp_dip_record_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SDP record parameters union
|
* @brief SDP record parameters union
|
||||||
*/
|
*/
|
||||||
typedef union {
|
typedef union {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
esp_bluetooth_sdp_raw_record_t raw; /*!< Raw SDP search data for unknown UUIDs */
|
esp_bluetooth_sdp_raw_record_t raw; /*!< Raw SDP search data for unknown UUIDs */
|
||||||
esp_bluetooth_sdp_mas_record_t mas; /*!< Message Access Profile - Server */
|
esp_bluetooth_sdp_mas_record_t mas; /*!< Message Access Profile - Server */
|
||||||
esp_bluetooth_sdp_mns_record_t mns; /*!< Message Access Profile - Client (Notification Server) */
|
esp_bluetooth_sdp_mns_record_t mns; /*!< Message Access Profile - Client (Notification Server) */
|
||||||
@ -205,7 +207,7 @@ typedef union {
|
|||||||
/**
|
/**
|
||||||
* @brief ESP_SDP_CREATE_RECORD_COMP_EVT
|
* @brief ESP_SDP_CREATE_RECORD_COMP_EVT
|
||||||
*/
|
*/
|
||||||
struct sdp_crate_record_evt_param {
|
struct sdp_create_record_evt_param {
|
||||||
esp_sdp_status_t status; /*!< Status */
|
esp_sdp_status_t status; /*!< Status */
|
||||||
int record_handle; /*!< SDP record handle */
|
int record_handle; /*!< SDP record handle */
|
||||||
} create_record; /*!< SDP callback param of ESP_SDP_CREATE_RECORD_COMP_EVT */
|
} create_record; /*!< SDP callback param of ESP_SDP_CREATE_RECORD_COMP_EVT */
|
||||||
|
@ -395,29 +395,29 @@ static void bta_create_raw_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_RE
|
|||||||
tSDP_DISC_ATTR *p_attr;
|
tSDP_DISC_ATTR *p_attr;
|
||||||
tSDP_PROTOCOL_ELEM pe;
|
tSDP_PROTOCOL_ELEM pe;
|
||||||
|
|
||||||
record->hdr.type = SDP_TYPE_RAW;
|
record->raw.hdr.type = SDP_TYPE_RAW;
|
||||||
record->hdr.service_name_length = 0;
|
record->raw.hdr.service_name_length = 0;
|
||||||
record->hdr.service_name = NULL;
|
record->raw.hdr.service_name = NULL;
|
||||||
record->hdr.rfcomm_channel_number = -1;
|
record->raw.hdr.rfcomm_channel_number = -1;
|
||||||
record->hdr.l2cap_psm = -1;
|
record->raw.hdr.l2cap_psm = -1;
|
||||||
record->hdr.profile_version = -1;
|
record->raw.hdr.profile_version = -1;
|
||||||
|
|
||||||
/* Try to extract a service name */
|
/* Try to extract a service name */
|
||||||
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SERVICE_NAME)) != NULL) {
|
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SERVICE_NAME)) != NULL) {
|
||||||
record->pse.hdr.service_name_length = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
|
record->raw.hdr.service_name_length = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
|
||||||
record->pse.hdr.service_name = (char *)p_attr->attr_value.v.array;
|
record->raw.hdr.service_name = (char *)p_attr->attr_value.v.array;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_GOEP_L2CAP_PSM)) != NULL) {
|
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_GOEP_L2CAP_PSM)) != NULL) {
|
||||||
record->hdr.l2cap_psm = p_attr->attr_value.v.u16;
|
record->raw.hdr.l2cap_psm = p_attr->attr_value.v.u16;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to extract an RFCOMM channel */
|
/* Try to extract an RFCOMM channel */
|
||||||
if (SDP_FindProtocolListElemInRec(p_rec, UUID_PROTOCOL_RFCOMM, &pe)) {
|
if (SDP_FindProtocolListElemInRec(p_rec, UUID_PROTOCOL_RFCOMM, &pe)) {
|
||||||
record->pse.hdr.rfcomm_channel_number = pe.params[0];
|
record->raw.hdr.rfcomm_channel_number = pe.params[0];
|
||||||
}
|
}
|
||||||
record->raw.user1_ptr_len = p_bta_sdp_cfg->p_sdp_db->raw_size;
|
record->raw.hdr.user1_ptr_len = p_bta_sdp_cfg->p_sdp_db->raw_size;
|
||||||
record->raw.user1_ptr = p_bta_sdp_cfg->p_sdp_db->raw_data;
|
record->raw.hdr.user1_ptr = p_bta_sdp_cfg->p_sdp_db->raw_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,73 +38,79 @@ typedef enum {
|
|||||||
SDP_TYPE_DIP_SERVER, // Device Identification Profile
|
SDP_TYPE_DIP_SERVER, // Device Identification Profile
|
||||||
} bluetooth_sdp_types;
|
} bluetooth_sdp_types;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_hdr {
|
/**
|
||||||
|
* Some signals need additional pointers, hence we introduce a
|
||||||
|
* generic way to handle these pointers.
|
||||||
|
*/
|
||||||
|
typedef struct _bluetooth_sdp_hdr_overlay {
|
||||||
bluetooth_sdp_types type;
|
bluetooth_sdp_types type;
|
||||||
|
esp_bt_uuid_t uuid;
|
||||||
uint32_t service_name_length;
|
uint32_t service_name_length;
|
||||||
char *service_name;
|
char *service_name;
|
||||||
int32_t rfcomm_channel_number;
|
int32_t rfcomm_channel_number;
|
||||||
int32_t l2cap_psm;
|
int32_t l2cap_psm;
|
||||||
int32_t profile_version;
|
int32_t profile_version;
|
||||||
} bluetooth_sdp_hdr;
|
int user1_ptr_len;
|
||||||
|
uint8_t *user1_ptr;
|
||||||
|
int user2_ptr_len; // not used
|
||||||
|
uint8_t *user2_ptr; // not used
|
||||||
|
} bluetooth_sdp_hdr_overlay;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_raw_record {
|
typedef struct _bluetooth_sdp_raw_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
esp_bt_uuid_t uuid;
|
|
||||||
int user1_ptr_len;
|
|
||||||
uint8_t *user1_ptr;
|
|
||||||
} bluetooth_sdp_raw_record;
|
} bluetooth_sdp_raw_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_mas_record {
|
typedef struct _bluetooth_sdp_mas_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
uint32_t mas_instance_id;
|
uint32_t mas_instance_id;
|
||||||
uint32_t supported_features;
|
uint32_t supported_features;
|
||||||
uint32_t supported_message_types;
|
uint32_t supported_message_types;
|
||||||
} bluetooth_sdp_mas_record;
|
} bluetooth_sdp_mas_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_mns_record {
|
typedef struct _bluetooth_sdp_mns_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
uint32_t supported_features;
|
uint32_t supported_features;
|
||||||
} bluetooth_sdp_mns_record;
|
} bluetooth_sdp_mns_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_pse_record {
|
typedef struct _bluetooth_sdp_pse_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
uint32_t supported_features;
|
uint32_t supported_features;
|
||||||
uint32_t supported_repositories;
|
uint32_t supported_repositories;
|
||||||
} bluetooth_sdp_pse_record;
|
} bluetooth_sdp_pse_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_pce_record {
|
typedef struct _bluetooth_sdp_pce_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
} bluetooth_sdp_pce_record;
|
} bluetooth_sdp_pce_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_ops_record {
|
typedef struct _bluetooth_sdp_ops_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
int supported_formats_list_len;
|
int supported_formats_list_len;
|
||||||
uint8_t supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH];
|
uint8_t supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH];
|
||||||
} bluetooth_sdp_ops_record;
|
} bluetooth_sdp_ops_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_sap_record {
|
typedef struct _bluetooth_sdp_sap_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
} bluetooth_sdp_sap_record;
|
} bluetooth_sdp_sap_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_dip_record {
|
typedef struct _bluetooth_sdp_dip_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
uint16_t vendor;
|
uint16_t vendor;
|
||||||
uint16_t vendor_id_source;
|
uint16_t vendor_id_source;
|
||||||
uint16_t product;
|
uint16_t product;
|
||||||
uint16_t version;
|
uint16_t version;
|
||||||
bool primary_record;
|
bool primary_record;
|
||||||
} bluetooth_sdp_dip_record;
|
} bluetooth_sdp_dip_record;
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
bluetooth_sdp_raw_record raw;
|
bluetooth_sdp_raw_record raw;
|
||||||
bluetooth_sdp_mas_record mas;
|
bluetooth_sdp_mas_record mas;
|
||||||
bluetooth_sdp_mns_record mns;
|
bluetooth_sdp_mns_record mns;
|
||||||
bluetooth_sdp_pse_record pse;
|
bluetooth_sdp_pse_record pse;
|
||||||
bluetooth_sdp_pce_record pce;
|
bluetooth_sdp_pce_record pce;
|
||||||
bluetooth_sdp_ops_record ops;
|
bluetooth_sdp_ops_record ops;
|
||||||
bluetooth_sdp_sap_record sap;
|
bluetooth_sdp_sap_record sap;
|
||||||
bluetooth_sdp_dip_record dip;
|
bluetooth_sdp_dip_record dip;
|
||||||
} bluetooth_sdp_record;
|
} bluetooth_sdp_record;
|
||||||
|
|
||||||
#endif /* __BT_SDP_H__ */
|
#endif /* __BT_SDP_H__ */
|
||||||
|
@ -91,11 +91,6 @@ static int get_sdp_record_size(bluetooth_sdp_record* in_record)
|
|||||||
records_size = sizeof(bluetooth_sdp_record);
|
records_size = sizeof(bluetooth_sdp_record);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDP_TYPE_RAW:
|
|
||||||
if (record->raw.user1_ptr != NULL) {
|
|
||||||
records_size += record->raw.user1_ptr_len;
|
|
||||||
}
|
|
||||||
/* fall through */
|
|
||||||
default:
|
default:
|
||||||
records_size += sizeof(bluetooth_sdp_record);
|
records_size += sizeof(bluetooth_sdp_record);
|
||||||
records_size += record->hdr.service_name_length;
|
records_size += record->hdr.service_name_length;
|
||||||
@ -254,12 +249,6 @@ static void copy_sdp_record_common(bluetooth_sdp_record* in_record, bluetooth_sd
|
|||||||
*(free_ptr) = '\0'; // Set '\0' termination of string
|
*(free_ptr) = '\0'; // Set '\0' termination of string
|
||||||
free_ptr++;
|
free_ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_record->hdr.type == SDP_TYPE_RAW && in_record->raw.user1_ptr != NULL) {
|
|
||||||
out_record->raw.user1_ptr = (UINT8 *)free_ptr; // Update pointer
|
|
||||||
memcpy(free_ptr, in_record->raw.user1_ptr, in_record->raw.user1_ptr_len); // Copy content
|
|
||||||
free_ptr += in_record->raw.user1_ptr_len;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void copy_sdp_record(bluetooth_sdp_record* in_record, bluetooth_sdp_record* out_record)
|
static void copy_sdp_record(bluetooth_sdp_record* in_record, bluetooth_sdp_record* out_record)
|
||||||
@ -402,6 +391,7 @@ static int add_raw_sdp(const bluetooth_sdp_raw_record *rec)
|
|||||||
UINT8 temp[LEN_UUID_128];
|
UINT8 temp[LEN_UUID_128];
|
||||||
UINT8* p_temp = temp;
|
UINT8* p_temp = temp;
|
||||||
UINT32 sdp_handle = 0;
|
UINT32 sdp_handle = 0;
|
||||||
|
const esp_bt_uuid_t *p_uuid = &rec->hdr.uuid;
|
||||||
|
|
||||||
BTC_TRACE_DEBUG("%s(): scn 0x%02x, psm = 0x%04x\n service name %s", __func__,
|
BTC_TRACE_DEBUG("%s(): scn 0x%02x, psm = 0x%04x\n service name %s", __func__,
|
||||||
rec->hdr.rfcomm_channel_number, rec->hdr.l2cap_psm, rec->hdr.service_name);
|
rec->hdr.rfcomm_channel_number, rec->hdr.l2cap_psm, rec->hdr.service_name);
|
||||||
@ -411,15 +401,15 @@ static int add_raw_sdp(const bluetooth_sdp_raw_record *rec)
|
|||||||
return sdp_handle;
|
return sdp_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rec->uuid.len == ESP_UUID_LEN_16) {
|
if (p_uuid->len == ESP_UUID_LEN_16) {
|
||||||
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_TWO_BYTES);
|
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_TWO_BYTES);
|
||||||
UINT16_TO_BE_STREAM (p_temp, rec->uuid.uuid.uuid16);
|
UINT16_TO_BE_STREAM (p_temp, p_uuid->uuid.uuid16);
|
||||||
} else if (rec->uuid.len == ESP_UUID_LEN_32) {
|
} else if (p_uuid->len == ESP_UUID_LEN_32) {
|
||||||
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_FOUR_BYTES);
|
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_FOUR_BYTES);
|
||||||
UINT32_TO_BE_STREAM (p_temp, rec->uuid.uuid.uuid32);
|
UINT32_TO_BE_STREAM (p_temp, p_uuid->uuid.uuid32);
|
||||||
} else if (rec->uuid.len == ESP_UUID_LEN_128) {
|
} else if (p_uuid->len == ESP_UUID_LEN_128) {
|
||||||
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_SIXTEEN_BYTES);
|
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_SIXTEEN_BYTES);
|
||||||
ARRAY_TO_BE_STREAM (p_temp, rec->uuid.uuid.uuid128, LEN_UUID_128);
|
ARRAY_TO_BE_STREAM (p_temp, p_uuid->uuid.uuid128, LEN_UUID_128);
|
||||||
} else {
|
} else {
|
||||||
SDP_DeleteRecord(sdp_handle);
|
SDP_DeleteRecord(sdp_handle);
|
||||||
sdp_handle = 0;
|
sdp_handle = 0;
|
||||||
@ -466,12 +456,12 @@ static int add_raw_sdp(const bluetooth_sdp_raw_record *rec)
|
|||||||
sdp_handle = 0;
|
sdp_handle = 0;
|
||||||
BTC_TRACE_ERROR("%s() FAILED, status = %d", __func__, status);
|
BTC_TRACE_ERROR("%s() FAILED, status = %d", __func__, status);
|
||||||
} else {
|
} else {
|
||||||
if (rec->uuid.len == ESP_UUID_LEN_16) {
|
if (p_uuid->len == ESP_UUID_LEN_16) {
|
||||||
bta_sys_add_uuid(rec->uuid.uuid.uuid16);
|
bta_sys_add_uuid(p_uuid->uuid.uuid16);
|
||||||
} else if (rec->uuid.len == ESP_UUID_LEN_32) {
|
} else if (p_uuid->len == ESP_UUID_LEN_32) {
|
||||||
bta_sys_add_uuid_32(rec->uuid.uuid.uuid32);
|
bta_sys_add_uuid_32(p_uuid->uuid.uuid32);
|
||||||
} else if (rec->uuid.len == ESP_UUID_LEN_128) {
|
} else if (p_uuid->len == ESP_UUID_LEN_128) {
|
||||||
bta_sys_add_uuid_128((UINT8 *)&rec->uuid.uuid.uuid128);
|
bta_sys_add_uuid_128((UINT8 *)&p_uuid->uuid.uuid128);
|
||||||
}
|
}
|
||||||
BTC_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle);
|
BTC_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle);
|
||||||
}
|
}
|
||||||
@ -943,7 +933,7 @@ static int btc_handle_create_record_event(int id)
|
|||||||
switch (record->hdr.type) {
|
switch (record->hdr.type) {
|
||||||
case SDP_TYPE_RAW:
|
case SDP_TYPE_RAW:
|
||||||
sdp_handle = add_raw_sdp(&record->raw);
|
sdp_handle = add_raw_sdp(&record->raw);
|
||||||
memcpy(&service_uuid, &record->raw.uuid, sizeof(esp_bt_uuid_t));
|
memcpy(&service_uuid, &record->hdr.uuid, sizeof(esp_bt_uuid_t));
|
||||||
break;
|
break;
|
||||||
case SDP_TYPE_MAP_MAS:
|
case SDP_TYPE_MAP_MAS:
|
||||||
sdp_handle = add_maps_sdp(&record->mas);
|
sdp_handle = add_maps_sdp(&record->mas);
|
||||||
|
@ -11,6 +11,4 @@ Bluedroid
|
|||||||
|
|
||||||
- :component_file:`/bt/host/bluedroid/api/include/api/esp_sdp_api.h`
|
- :component_file:`/bt/host/bluedroid/api/include/api/esp_sdp_api.h`
|
||||||
|
|
||||||
- structure ``esp_bluetooth_sdp_hdr_overlay_t`` has been renamed to ``esp_bluetooth_sdp_hdr_t``
|
- Field ``user2_ptr_len`` and ``user2_ptr`` is deprecated in structure ``esp_bluetooth_sdp_hdr_overlay_t``, since they are not used in SDP record creation or searching.
|
||||||
- field ``uuid``, ``user1_ptr_len`` and ``user1_ptr`` in ``esp_bluetooth_sdp_hdr_overlay_t`` have been moved into ``esp_bluetooth_sdp_raw_record_t``
|
|
||||||
- field ``user2_ptr_len`` and ``user2_ptr`` in ``esp_bluetooth_sdp_hdr_overlay_t`` have been removed
|
|
||||||
|
@ -11,6 +11,4 @@ Bluedroid
|
|||||||
|
|
||||||
- :component_file:`/bt/host/bluedroid/api/include/api/esp_sdp_api.h`
|
- :component_file:`/bt/host/bluedroid/api/include/api/esp_sdp_api.h`
|
||||||
|
|
||||||
- 结构体 ``esp_bluetooth_sdp_hdr_overlay_t`` 被重命名为 ``esp_bluetooth_sdp_hdr_t``
|
- 结构体 ``esp_bluetooth_sdp_hdr_overlay_t`` 中的字段 ``user2_ptr_len`` 和 ``user2_ptr`` 被弃用,因为 SDP 的 API 或者事件中不会用到该字段。
|
||||||
- 结构体 ``esp_bluetooth_sdp_hdr_overlay_t`` 中的字段 ``uuid``, ``user1_ptr_len`` 和 ``user1_ptr`` 被移动到结构体 ``esp_bluetooth_sdp_raw_record_t`` 中
|
|
||||||
- 结构体 ``esp_bluetooth_sdp_hdr_overlay_t`` 中的字段 ``user2_ptr_len`` 和 ``user2_ptr`` 被删除
|
|
||||||
|
@ -340,15 +340,13 @@ static void esp_hdl_sdp_cb_evt(uint16_t event, void *p_param)
|
|||||||
ESP_LOGI(SDP_TAG, "ESP_SDP_INIT_EVT: status:%d", sdp_param->init.status);
|
ESP_LOGI(SDP_TAG, "ESP_SDP_INIT_EVT: status:%d", sdp_param->init.status);
|
||||||
if (sdp_param->init.status == ESP_SDP_SUCCESS) {
|
if (sdp_param->init.status == ESP_SDP_SUCCESS) {
|
||||||
record.hdr.type = ESP_SDP_TYPE_RAW;
|
record.hdr.type = ESP_SDP_TYPE_RAW;
|
||||||
|
record.hdr.uuid.len = sizeof(UUID_UNKNOWN);
|
||||||
|
memcpy(record.hdr.uuid.uuid.uuid128, UUID_UNKNOWN, sizeof(UUID_UNKNOWN));
|
||||||
record.hdr.service_name_length = strlen(sdp_service_name) + 1;
|
record.hdr.service_name_length = strlen(sdp_service_name) + 1;
|
||||||
record.hdr.service_name = sdp_service_name;
|
record.hdr.service_name = sdp_service_name;
|
||||||
record.hdr.rfcomm_channel_number = BT_UNUSED_RFCOMM;
|
record.hdr.rfcomm_channel_number = BT_UNUSED_RFCOMM;
|
||||||
record.hdr.l2cap_psm = BT_L2CAP_DYNMIC_PSM;
|
record.hdr.l2cap_psm = BT_L2CAP_DYNMIC_PSM;
|
||||||
record.hdr.profile_version = BT_UNKONWN_PROFILE_VERSION;
|
record.hdr.profile_version = BT_UNKONWN_PROFILE_VERSION;
|
||||||
record.uuid.len = sizeof(UUID_UNKNOWN);
|
|
||||||
memcpy(record.uuid.uuid.uuid128, UUID_UNKNOWN, sizeof(UUID_UNKNOWN));
|
|
||||||
record.user1_ptr = NULL;
|
|
||||||
record.user1_ptr_len = 0;
|
|
||||||
esp_sdp_create_record((esp_bluetooth_sdp_record_t *)&record);
|
esp_sdp_create_record((esp_bluetooth_sdp_record_t *)&record);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -250,15 +250,13 @@ static void esp_hdl_sdp_cb_evt(uint16_t event, void *p_param)
|
|||||||
ESP_LOGI(SDP_TAG, "ESP_SDP_INIT_EVT: status:%d", sdp_param->init.status);
|
ESP_LOGI(SDP_TAG, "ESP_SDP_INIT_EVT: status:%d", sdp_param->init.status);
|
||||||
if (sdp_param->init.status == ESP_SDP_SUCCESS) {
|
if (sdp_param->init.status == ESP_SDP_SUCCESS) {
|
||||||
record.hdr.type = ESP_SDP_TYPE_RAW;
|
record.hdr.type = ESP_SDP_TYPE_RAW;
|
||||||
|
record.hdr.uuid.len = sizeof(UUID_UNKNOWN);
|
||||||
|
memcpy(record.hdr.uuid.uuid.uuid128, UUID_UNKNOWN, sizeof(UUID_UNKNOWN));
|
||||||
record.hdr.service_name_length = strlen(sdp_service_name) + 1;
|
record.hdr.service_name_length = strlen(sdp_service_name) + 1;
|
||||||
record.hdr.service_name = sdp_service_name;
|
record.hdr.service_name = sdp_service_name;
|
||||||
record.hdr.rfcomm_channel_number = BT_UNUSED_RFCOMM;
|
record.hdr.rfcomm_channel_number = BT_UNUSED_RFCOMM;
|
||||||
record.hdr.l2cap_psm = BT_L2CAP_DYNMIC_PSM;
|
record.hdr.l2cap_psm = BT_L2CAP_DYNMIC_PSM;
|
||||||
record.hdr.profile_version = BT_UNKONWN_PROFILE_VERSION;
|
record.hdr.profile_version = BT_UNKONWN_PROFILE_VERSION;
|
||||||
record.uuid.len = sizeof(UUID_UNKNOWN);
|
|
||||||
memcpy(record.uuid.uuid.uuid128, UUID_UNKNOWN, sizeof(UUID_UNKNOWN));
|
|
||||||
record.user1_ptr = NULL;
|
|
||||||
record.user1_ptr_len = 0;
|
|
||||||
esp_sdp_create_record((esp_bluetooth_sdp_record_t *)&record);
|
esp_sdp_create_record((esp_bluetooth_sdp_record_t *)&record);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user