From ae8d9208a978fc26c133dc237f3fc9f25345c1e5 Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Tue, 24 Sep 2019 11:39:26 +0200 Subject: [PATCH] bluetooth.h: remove unused SDP defines, move SDP defines and SDP_PDU_ID_t to sdp_util.h --- src/bluetooth.h | 59 ------------------------------------------ src/classic/sdp_util.h | 18 +++++++++++++ test/pts/hfp_test.c | 4 +-- 3 files changed, 20 insertions(+), 61 deletions(-) diff --git a/src/bluetooth.h b/src/bluetooth.h index f088b7eb6..b453c5400 100644 --- a/src/bluetooth.h +++ b/src/bluetooth.h @@ -774,7 +774,6 @@ typedef enum { // // Fixed PSM numbers from https://www.bluetooth.com/specifications/assigned-numbers/logical-link-control // -// @TODO: replace with BLUETOOTH_PROTOCOL_xxx in rest of code #define PSM_SDP BLUETOOTH_PROTOCOL_SDP #define PSM_RFCOMM BLUETOOTH_PROTOCOL_RFCOMM #define PSM_BNEP BLUETOOTH_PROTOCOL_BNEP @@ -788,65 +787,7 @@ typedef enum { */ // PDU Types -typedef enum { - SDP_Invalid = 0, - SDP_ErrorResponse = 1, - SDP_ServiceSearchRequest, - SDP_ServiceSearchResponse, - SDP_ServiceAttributeRequest, - SDP_ServiceAttributeResponse, - SDP_ServiceSearchAttributeRequest, - SDP_ServiceSearchAttributeResponse -} SDP_PDU_ID_t; -/* Please use assigned numbers from bluetooth_sdp.h instead for thsese ...*/ - -// UNIVERSAL ATTRIBUTE DEFINITIONS -#define SDP_ServiceRecordHandle BLUETOOTH_ATTRIBUTE_SERVICE_RECORD_HANDLE -#define SDP_ServiceClassIDList BLUETOOTH_ATTRIBUTE_SERVICE_CLASS_ID_LIST -#define SDP_ServiceRecordState BLUETOOTH_ATTRIBUTE_SERVICE_RECORD_STATE -#define SDP_ServiceID BLUETOOTH_ATTRIBUTE_SERVICE_ID -#define SDP_ProtocolDescriptorList BLUETOOTH_ATTRIBUTE_PROTOCOL_DESCRIPTOR_LIST -#define SDP_BrowseGroupList BLUETOOTH_ATTRIBUTE_BROWSE_GROUP_LIST -#define SDP_LanguageBaseAttributeIDList BLUETOOTH_ATTRIBUTE_LANGUAGE_BASE_ATTRIBUTE_ID_LIST -#define SDP_ServiceInfoTimeToLive BLUETOOTH_ATTRIBUTE_SERVICE_INFO_TIME_TO_LIVE -#define SDP_ServiceAvailability BLUETOOTH_ATTRIBUTE_SERVICE_AVAILABILITY -#define SDP_BluetoothProfileDescriptorList BLUETOOTH_ATTRIBUTE_BLUETOOTH_PROFILE_DESCRIPTOR_LIST -#define SDP_DocumentationURL BLUETOOTH_ATTRIBUTE_DOCUMENTATION_URL -#define SDP_ClientExecutableURL BLUETOOTH_ATTRIBUTE_CLIENT_EXECUTABLE_URL -#define SDP_IconURL BLUETOOTH_ATTRIBUTE_ICON_URL -#define SDP_AdditionalProtocolDescriptorList BLUETOOTH_ATTRIBUTE_ADDITIONAL_PROTOCOL_DESCRIPTOR_LISTS -#define SDP_SupportedFormatsList BLUETOOTH_ATTRIBUTE_SUPPORTED_FORMATS_LIST - -// SERVICE CLASSES -#define SDP_OBEXObjectPush BLUETOOTH_SERVICE_CLASS_OBEX_OBJECT_PUSH -#define SDP_OBEXFileTransfer BLUETOOTH_SERVICE_CLASS_OBEX_FILE_TRANSFER -#define SDP_PublicBrowseGroup BLUETOOTH_ATTRIBUTE_PUBLIC_BROWSE_ROOT -#define SDP_HSP BLUETOOTH_SERVICE_CLASS_HEADSET -#define SDP_Headset_AG BLUETOOTH_SERVICE_CLASS_HEADSET_AUDIO_GATEWAY_AG -#define SDP_PANU BLUETOOTH_SERVICE_CLASS_PANU -#define SDP_NAP BLUETOOTH_SERVICE_CLASS_NAP -#define SDP_GN BLUETOOTH_SERVICE_CLASS_GN -#define SDP_Handsfree BLUETOOTH_SERVICE_CLASS_HANDSFREE -#define SDP_HandsfreeAudioGateway BLUETOOTH_SERVICE_CLASS_HANDSFREE_AUDIO_GATEWAY -#define SDP_Headset_HS BLUETOOTH_SERVICE_CLASS_HEADSET_HS -#define SDP_GenericAudio BLUETOOTH_SERVICE_CLASS_GENERIC_AUDIO - -// PROTOCOLS -#define SDP_SDPProtocol BLUETOOTH_PROTOCOL_SDP -#define SDP_UDPProtocol BLUETOOTH_PROTOCOL_UDP -#define SDP_RFCOMMProtocol BLUETOOTH_PROTOCOL_RFCOMM -#define SDP_OBEXProtocol BLUETOOTH_PROTOCOL_OBEX -#define SDP_L2CAPProtocol BLUETOOTH_PROTOCOL_L2CAP -#define SDP_BNEPProtocol BLUETOOTH_PROTOCOL_BNEP -#define SDP_AVDTPProtocol BLUETOOTH_PROTOCOL_AVDTP - -/** .. until here ..*/ - -// OFFSETS FOR LOCALIZED ATTRIBUTES - SDP_LanguageBaseAttributeIDList -#define SDP_Offest_ServiceName 0x0000 -#define SDP_Offest_ServiceDescription 0x0001 -#define SDP_Offest_ProviderName 0x0002 // Device Vendor ID Sources #define DEVICE_ID_VENDOR_ID_SOURCE_BLUETOOTH 0x0001 diff --git a/src/classic/sdp_util.h b/src/classic/sdp_util.h index 6a86a8029..a0c5be1b1 100644 --- a/src/classic/sdp_util.h +++ b/src/classic/sdp_util.h @@ -48,8 +48,26 @@ extern "C" { #endif + +typedef enum { + SDP_Invalid = 0, + SDP_ErrorResponse = 1, + SDP_ServiceSearchRequest, + SDP_ServiceSearchResponse, + SDP_ServiceAttributeRequest, + SDP_ServiceAttributeResponse, + SDP_ServiceSearchAttributeRequest, + SDP_ServiceSearchAttributeResponse +} SDP_PDU_ID_t; + + /* API_START */ +// OFFSETS FOR LOCALIZED ATTRIBUTES - BLUETOOTH_ATTRIBUTE_LANGUAGE_BASE_ATTRIBUTE_ID_LIST +#define SDP_Offset_ServiceName 0x0000 +#define SDP_Offset_ServiceDescription 0x0001 +#define SDP_Offset_ProviderName 0x0002 + typedef enum { DE_NIL = 0, DE_UINT, diff --git a/test/pts/hfp_test.c b/test/pts/hfp_test.c index 895393a90..cffeab4e5 100644 --- a/test/pts/hfp_test.c +++ b/test/pts/hfp_test.c @@ -106,8 +106,8 @@ static void packet_handler(void * connection, uint8_t packet_type, uint16_t chan case BTSTACK_EVENT_STATE: // bt stack activated, get started if (btstack_event_state_get_state(packet) == HCI_STATE_WORKING){ - printf("Start SDP RFCOMM Query for UUID 0x%02x\n", SDP_Handsfree); - sdp_client_query_rfcomm_channel_and_name_for_uuid(&handle_query_rfcomm_event, remote, SDP_Handsfree); + printf("Start SDP RFCOMM Query for UUID 0x%02x\n", BLUETOOTH_SERVICE_CLASS_HANDSFREE); + sdp_client_query_rfcomm_channel_and_name_for_uuid(&handle_query_rfcomm_event, remote, BLUETOOTH_SERVICE_CLASS_HANDSFREE); } break;