X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/32ab52a2987f086d34d8ac691eaed5e1af085719..f73f01235e17807661bd7aab2f6499e5418e4ea3:/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 ec55b2fb1..18592ec1c 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h @@ -38,6 +38,7 @@ /* Includes: */ #include + #include #include #include #include @@ -50,7 +51,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 +60,14 @@ #define SDP_PDU_SERVICEATTRIBUTERESPONSE 0x05 #define SDP_PDU_SERVICESEARCHATTRIBUTEREQUEST 0x06 #define SDP_PDU_SERVICESEARCHATTRIBUTERESPONSE 0x07 + + /** Convenience macro - read a pointer out of PROGMEM space. + * + * \param[in] x Address of the pointer to read + * + * \return Pointer retrieved from PROGMEM space + */ + #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 @@ -202,20 +211,27 @@ } /* Function Prototypes: */ + void SDP_Initialize(void); void SDP_ProcessPacket(void* Data, Bluetooth_Channel_t* const Channel); #if defined(INCLUDE_FROM_SERVICEDISCOVERYPROTOCOL_C) - static void SDP_ProcessServiceSearch(const SDP_PDUHeader_t* const SDPHeader, Bluetooth_Channel_t* const Channel); - static void SDP_ProcessServiceAttribute(const SDP_PDUHeader_t* const SDPHeader, Bluetooth_Channel_t* const Channel); - static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHeader, Bluetooth_Channel_t* const Channel); + static void SDP_ProcessServiceSearch(const SDP_PDUHeader_t* const SDPHeader, Bluetooth_Channel_t* const Channel); + static void SDP_ProcessServiceAttribute(const SDP_PDUHeader_t* const SDPHeader, Bluetooth_Channel_t* const Channel); + static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHeader, Bluetooth_Channel_t* const Channel); static uint16_t SDP_AddListedAttributesToResponse(const ServiceAttributeTable_t* AttributeTable, uint16_t AttributeList[][2], 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