X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/0902ff9651d18bf6da259b73092fd33b841b4dc4..5144ea76f646cd9f649de16e3d67dfead2d3c2bf:/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h index c9ce9511d..e46729cd9 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h @@ -50,7 +50,7 @@ /* Macros: */ #define BT_SDP_DEBUG(l, s, ...) do { if (SDP_DEBUG_LEVEL >= l) printf_P(PSTR("(SDP) " s "\r\n"), ##__VA_ARGS__); } while (0) - #define SDP_DEBUG_LEVEL 2 + #define SDP_DEBUG_LEVEL 0 #define SDP_PDU_ERRORRESPONSE 0x01 #define SDP_PDU_SERVICESEARCHREQUEST 0x02 @@ -59,6 +59,8 @@ #define SDP_PDU_SERVICEATTRIBUTERESPONSE 0x05 #define SDP_PDU_SERVICESEARCHATTRIBUTEREQUEST 0x06 #define SDP_PDU_SERVICESEARCHATTRIBUTERESPONSE 0x07 + + #define pgm_read_ptr(x) (void*)pgm_read_word(x) /* Enums: */ /** Data sizes for SDP Data Element headers, to indicate the size of the data contained in the element. When creating @@ -179,25 +181,23 @@ return Data; } - /** Adds a new Data Element container of the given type with a 16-bit size header to the buffer. The - * buffer pointer's position is advanced past the added header once the element has been added. The - * returned size header value is pre-zeroed out so that it can be incremented as data is placed into - * the Data Element container. + /** Adds a new Data Element Sequence container with a 16-bit size header to the buffer. The buffer + * pointer's position is advanced past the added header once the element has been added. The returned + * size header value is pre-zeroed out so that it can be incremented as data is placed into the Data + * Element Sequence container. * * The total added size of the container header is three bytes, regardless of the size of its contents * as long as the contents' size in bytes fits into a 16-bit integer. * * \param[in, out] BufferPos Pointer to a buffer where the container header is to be placed - * \param[in] Type Type of data the container is to store, a value from the \ref ServiceDiscovery_DataTypes_t enum * * \return Pointer to the 16-bit size value of the contaner header, which has been pre-zeroed */ - static inline uint16_t* SDP_AddDataElementHeader16(void** BufferPos, const uint8_t Type) + static inline uint16_t* SDP_AddSequence16(void** BufferPos) { - SDP_WriteData8(BufferPos, (SDP_DATASIZE_Variable16Bit | Type)); + SDP_WriteData8(BufferPos, (SDP_DATASIZE_Variable16Bit | SDP_DATATYPE_Sequence)); - uint16_t* SizePos = (uint16_t*)*BufferPos; - + uint16_t* SizePos = *BufferPos; SDP_WriteData16(BufferPos, 0); return SizePos; @@ -215,9 +215,15 @@ const uint8_t TotalAttributes, void** const BufferPos); static uint16_t SDP_AddAttributeToResponse(const uint16_t AttributeID, const void* AttributeValue, void** ResponseBuffer); static void* SDP_GetAttributeValue(const ServiceAttributeTable_t* AttributeTable, const uint16_t AttributeID); - static ServiceAttributeTable_t* SDP_GetAttributeTable(const uint8_t* const UUID); + + static bool SDP_SearchServiceTable(uint8_t UUIDList[][UUID_SIZE_BYTES], const uint8_t TotalUUIDs, + const ServiceAttributeTable_t* CurrAttributeTable); + static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES], const uint8_t TotalUUIDs, bool UUIDMatch[], + const void* CurrAttribute); + static uint8_t SDP_GetAttributeList(uint16_t AttributeList[][2], const void** const CurrentParameter); static uint8_t SDP_GetUUIDList(uint8_t UUIDList[][UUID_SIZE_BYTES], const void** const CurrentParameter); + static uint32_t SDP_GetLocalAttributeContainerSize(const void* const AttributeData, uint8_t* const HeaderSize); static uint32_t SDP_GetDataElementSize(const void** const AttributeHeader, uint8_t* const ElementHeaderSize); #endif