From 2e97921ee036166f364b69a758fba79c0f3ed306 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald@gmail.com" Date: Sun, 19 Jan 2014 17:23:08 +0000 Subject: [PATCH] only compile SDP DES Dump functionality if SDP_DES_DUMP is defined --- configure.in | 1 + example/libusb/btstack-config.h | 1 + src/sdp_util.c | 7 ++++++- test/btstack-config.h | 2 ++ test/sdp_client/btstack-config.h | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index a2291be17..65bee04ba 100644 --- a/configure.in +++ b/configure.in @@ -272,6 +272,7 @@ echo "#define HAVE_BZERO" >> btstack-config.h echo "#define ENABLE_LOG_INFO " >> btstack-config.h echo "#define ENABLE_LOG_ERROR" >> btstack-config.h echo "#define HCI_ACL_PAYLOAD_SIZE 1021" >> btstack-config.h +echo "#define SDP_DES_DUMP" >> btstack-config.h AC_SUBST(IPHONE_IP) AC_SUBST(HAVE_LIBUSB) diff --git a/example/libusb/btstack-config.h b/example/libusb/btstack-config.h index 3e852230a..bb2528ad8 100644 --- a/example/libusb/btstack-config.h +++ b/example/libusb/btstack-config.h @@ -9,6 +9,7 @@ #define HAVE_TIME #define HAVE_MALLOC #define HAVE_BZERO +#define SDP_DES_DUMP #define ENABLE_LOG_INFO #define ENABLE_LOG_ERROR #define HCI_ACL_PAYLOAD_SIZE 1021 diff --git a/src/sdp_util.c b/src/sdp_util.c index 803e9e062..2542a7d30 100644 --- a/src/sdp_util.c +++ b/src/sdp_util.c @@ -47,14 +47,15 @@ #include #include // PRIx32 +#ifdef SDP_DES_DUMP // workaround for missing PRIx32 on mspgcc (16-bit MCU) #ifndef PRIx32 #warning Using own: #define PRIx32 "lx" #define PRIx32 "lx" #endif - // date element type names const char * const type_names[] = { "NIL", "UINT", "INT", "UUID", "STRING", "BOOL", "DES", "DEA", "URL"}; +#endif // Bluetooth Base UUID: 00000000-0000-1000-8000- 00805F9B34FB const uint8_t sdp_bluetooth_base_uuid[] = { 0x00, 0x00, 0x00, 0x00, /* - */ 0x00, 0x00, /* - */ 0x10, 0x00, /* - */ @@ -566,6 +567,7 @@ int sdp_record_matches_service_search_pattern(uint8_t *record, uint8_t *serviceS // MARK: Dump DataElement // context { indent } +#ifdef SDP_DES_DUMP static int de_traversal_dump_data(uint8_t * element, de_type_t de_type, de_size_t de_size, void *my_context){ int indent = *(int*) my_context; int i; @@ -616,13 +618,16 @@ static int de_traversal_dump_data(uint8_t * element, de_type_t de_type, de_size_ } return 0; } +#endif void de_dump_data_element(uint8_t * record){ +#ifdef SDP_DES_DUMP int indent = 0; // hack to get root DES, too. de_type_t type = de_get_element_type(record); de_size_t size = de_get_size_type(record); de_traversal_dump_data(record, type, size, (void*) &indent); +#endif } void sdp_create_spp_service(uint8_t *service, int service_id, const char *name){ diff --git a/test/btstack-config.h b/test/btstack-config.h index 28a93dc45..68353b16d 100644 --- a/test/btstack-config.h +++ b/test/btstack-config.h @@ -4,6 +4,7 @@ #define HAVE_INIT_SCRIPT #define HAVE_BZERO #define HAVE_TIME +#define SDP_DES_DUMP // #define ENABLE_LOG_INFO // #define ENABLE_LOG_ERROR @@ -23,3 +24,4 @@ #define MAX_NO_DB_MEM_DEVICE_NAMES 10 #define MAX_NO_DB_MEM_SERVICES 1 + diff --git a/test/sdp_client/btstack-config.h b/test/sdp_client/btstack-config.h index 19df7c673..3fa069bfa 100644 --- a/test/sdp_client/btstack-config.h +++ b/test/sdp_client/btstack-config.h @@ -11,6 +11,7 @@ #define ENABLE_LOG_INFO #define ENABLE_LOG_ERROR #define HAVE_SDP_EXTRA_QUERIES +#define SDP_DES_DUMP #define HCI_ACL_PAYLOAD_SIZE 1021 // #define HCI_ACL_PAYLOAD_SIZE 52