Update all demos, projects and bootloaders to indent all function parameters, one per line, for better readability.

Add missing const qualifiers to the demos.
This commit is contained in:
Dean Camera 2010-07-21 16:19:32 +00:00
parent 83e293a6ec
commit 6bda628718
271 changed files with 1312 additions and 621 deletions

View file

@ -123,7 +123,8 @@ void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device.
*/
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode)
{
printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"
" -- Error Code %d\r\n"

View file

@ -79,7 +79,8 @@
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
/* Function Prototypes: */
void SetupHardware(void);

View file

@ -211,7 +211,8 @@ static void Bluetooth_ProcessIncomingACLPackets(void)
*
* \return Pointer to the matching channel information structure in the channel table if found, NULL otherwise
*/
Bluetooth_Channel_t* Bluetooth_GetChannelData(const uint16_t SearchValue, const uint8_t SearchKey)
Bluetooth_Channel_t* Bluetooth_GetChannelData(const uint16_t SearchValue,
const uint8_t SearchKey)
{
for (uint8_t i = 0; i < BLUETOOTH_MAX_OPEN_CHANNELS; i++)
{
@ -253,7 +254,9 @@ Bluetooth_Channel_t* Bluetooth_GetChannelData(const uint16_t SearchValue, const
*
* \return A value from the \ref BT_SendPacket_ErrorCodes_t enum
*/
uint8_t Bluetooth_SendPacket(void* Data, const uint16_t DataLen, Bluetooth_Channel_t* const ACLChannel)
uint8_t Bluetooth_SendPacket(void* Data,
const uint16_t DataLen,
Bluetooth_Channel_t* const ACLChannel)
{
BT_ACL_Header_t ACLPacketHeader;
BT_DataPacket_Header_t DataHeader;

View file

@ -374,7 +374,9 @@ void Bluetooth_HCITask(void)
*
* \return A value from the USB_Host_SendControlErrorCodes_t enum.
*/
static uint8_t Bluetooth_SendHCICommand(const BT_HCICommand_Header_t* const HCICommandHeader, const void* Parameters, const uint16_t ParameterLength)
static uint8_t Bluetooth_SendHCICommand(const BT_HCICommand_Header_t* const HCICommandHeader,
const void* Parameters,
const uint16_t ParameterLength)
{
/* Need to reserve the amount of bytes given in the header for the complete payload */
uint8_t CommandBuffer[sizeof(BT_HCICommand_Header_t) + HCICommandHeader->ParameterLength];

View file

@ -204,7 +204,8 @@
void Bluetooth_HCITask(void);
#if defined(INCLUDE_FROM_BLUETOOTHHCICOMMANDS_C)
static uint8_t Bluetooth_SendHCICommand(const BT_HCICommand_Header_t* const HCICommandHeader, const void* Parameters,
static uint8_t Bluetooth_SendHCICommand(const BT_HCICommand_Header_t* const HCICommandHeader,
const void* Parameters,
const uint16_t ParameterLength);
#endif

View file

@ -155,13 +155,17 @@
void Bluetooth_ConnectionComplete(void);
void Bluetooth_DisconnectionComplete(void);
bool Bluetooth_ChannelConnectionRequest(const uint16_t PSM);
void Bluetooth_PacketReceived(void* Data, uint16_t DataLen, Bluetooth_Channel_t* const ACLChannel);
void Bluetooth_PacketReceived(void* Data, uint16_t DataLen,
Bluetooth_Channel_t* const ACLChannel);
void Bluetooth_ChannelOpened(Bluetooth_Channel_t* const ACLChannel);
Bluetooth_Channel_t* Bluetooth_GetChannelData(const uint16_t SearchValue, const uint8_t SearchKey);
Bluetooth_Channel_t* Bluetooth_GetChannelData(const uint16_t SearchValue,
const uint8_t SearchKey);
Bluetooth_Channel_t* Bluetooth_OpenChannel(const uint16_t PSM);
void Bluetooth_CloseChannel(Bluetooth_Channel_t* const ACLChannel);
uint8_t Bluetooth_SendPacket(void* Data, uint16_t DataLen, Bluetooth_Channel_t* const ACLChannel);
uint8_t Bluetooth_SendPacket(void* Data,
uint16_t DataLen,
Bluetooth_Channel_t* const ACLChannel);
/* External Variables: */
extern Bluetooth_Device_t Bluetooth_DeviceConfiguration;

View file

@ -118,7 +118,8 @@ void RFCOMM_ServiceChannels(Bluetooth_Channel_t* const ACLChannel)
* \param[in] Data Incoming packet data containing the RFCOMM packet
* \param[in] ACLChannel ACL channel the request was issued to by the remote device
*/
void RFCOMM_ProcessPacket(void* Data, Bluetooth_Channel_t* const ACLChannel)
void RFCOMM_ProcessPacket(void* Data,
Bluetooth_Channel_t* const ACLChannel)
{
const RFCOMM_Header_t* FrameHeader = (const RFCOMM_Header_t*)Data;
const uint8_t* FrameData = (const uint8_t*)Data + sizeof(RFCOMM_Header_t);
@ -154,7 +155,8 @@ void RFCOMM_ProcessPacket(void* Data, Bluetooth_Channel_t* const ACLChannel)
* \param[in] RFCOMMChannel RFCOMM logical channel whose local terminal signals have changed
* \param[in] ACLChannel ACL channel which has been opened to carry RFCOMM traffic between devices
*/
void RFCOMM_SendChannelSignals(const RFCOMM_Channel_t* const RFCOMMChannel, Bluetooth_Channel_t* const ACLChannel)
void RFCOMM_SendChannelSignals(const RFCOMM_Channel_t* const RFCOMMChannel,
Bluetooth_Channel_t* const ACLChannel)
{
BT_RFCOMM_DEBUG(1, ">> MSC Command");
BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", RFCOMMChannel->DLCI);
@ -184,7 +186,9 @@ void RFCOMM_SendChannelSignals(const RFCOMM_Channel_t* const RFCOMMChannel, Blue
* \param[in] RFCOMMChannel RFCOMM logical channel which is to be transmitted to
* \param[in] ACLChannel ACL channel which has been opened to carry RFCOMM traffic between devices
*/
void RFCOMM_SendData(const uint16_t DataLen, const uint8_t* Data, const RFCOMM_Channel_t* const RFCOMMChannel,
void RFCOMM_SendData(const uint16_t DataLen,
const uint8_t* Data,
const RFCOMM_Channel_t* const RFCOMMChannel,
Bluetooth_Channel_t* const ACLChannel)
{
if (RFCOMMChannel->State != RFCOMM_Channel_Open)
@ -263,8 +267,12 @@ uint16_t RFCOMM_GetVariableFieldValue(const uint8_t** BufferPos)
return (((uint16_t)SecondOctet << 7) | FirstOctet >> 1);
}
void RFCOMM_SendFrame(const uint8_t DLCI, const bool CommandResponse, const uint8_t Control, const uint16_t DataLen,
const void* Data, Bluetooth_Channel_t* const ACLChannel)
void RFCOMM_SendFrame(const uint8_t DLCI,
const bool CommandResponse,
const uint8_t Control,
const uint16_t DataLen,
const void* Data,
Bluetooth_Channel_t* const ACLChannel)
{
struct
{
@ -304,7 +312,8 @@ void RFCOMM_SendFrame(const uint8_t DLCI, const bool CommandResponse, const uint
Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), ACLChannel);
}
static uint8_t RFCOMM_GetFCSValue(const void* FrameStart, uint8_t Length)
static uint8_t RFCOMM_GetFCSValue(const void* FrameStart,
uint8_t Length)
{
uint8_t FCS = 0xFF;
@ -315,13 +324,15 @@ static uint8_t RFCOMM_GetFCSValue(const void* FrameStart, uint8_t Length)
return ~FCS;
}
static void RFCOMM_ProcessDM(const RFCOMM_Address_t* const FrameAddress, Bluetooth_Channel_t* const ACLChannel)
static void RFCOMM_ProcessDM(const RFCOMM_Address_t* const FrameAddress,
Bluetooth_Channel_t* const ACLChannel)
{
BT_RFCOMM_DEBUG(1, "<< DM Received");
BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", FrameAddress->DLCI);
}
static void RFCOMM_ProcessDISC(const RFCOMM_Address_t* const FrameAddress, Bluetooth_Channel_t* const ACLChannel)
static void RFCOMM_ProcessDISC(const RFCOMM_Address_t* const FrameAddress,
Bluetooth_Channel_t* const ACLChannel)
{
BT_RFCOMM_DEBUG(1, "<< DISC Received");
BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", FrameAddress->DLCI);
@ -336,7 +347,8 @@ static void RFCOMM_ProcessDISC(const RFCOMM_Address_t* const FrameAddress, Bluet
RFCOMM_SendFrame(FrameAddress->DLCI, true, (RFCOMM_Frame_UA | FRAME_POLL_FINAL), 0, NULL, ACLChannel);
}
static void RFCOMM_ProcessSABM(const RFCOMM_Address_t* const FrameAddress, Bluetooth_Channel_t* const ACLChannel)
static void RFCOMM_ProcessSABM(const RFCOMM_Address_t* const FrameAddress,
Bluetooth_Channel_t* const ACLChannel)
{
BT_RFCOMM_DEBUG(1, "<< SABM Received");
BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", FrameAddress->DLCI);
@ -375,14 +387,17 @@ static void RFCOMM_ProcessSABM(const RFCOMM_Address_t* const FrameAddress, Bluet
}
}
static void RFCOMM_ProcessUA(const RFCOMM_Address_t* const FrameAddress, Bluetooth_Channel_t* const ACLChannel)
static void RFCOMM_ProcessUA(const RFCOMM_Address_t* const FrameAddress,
Bluetooth_Channel_t* const ACLChannel)
{
BT_RFCOMM_DEBUG(1, "<< UA Received");
BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", FrameAddress->DLCI);
}
static void RFCOMM_ProcessUIH(const RFCOMM_Address_t* const FrameAddress, const uint16_t FrameLength,
const uint8_t* FrameData, Bluetooth_Channel_t* const ACLChannel)
static void RFCOMM_ProcessUIH(const RFCOMM_Address_t* const FrameAddress,
const uint16_t FrameLength,
const uint8_t* FrameData,
Bluetooth_Channel_t* const ACLChannel)
{
if (FrameAddress->DLCI == RFCOMM_CONTROL_DLCI)
{

View file

@ -102,33 +102,48 @@
/* Function Prototypes: */
void RFCOMM_Initialize(void);
void RFCOMM_ServiceChannels(Bluetooth_Channel_t* const ACLChannel);
void RFCOMM_ProcessPacket(void* Data, Bluetooth_Channel_t* const ACLChannel);
void RFCOMM_ProcessPacket(void* Data,
Bluetooth_Channel_t* const ACLChannel);
void RFCOMM_SendChannelSignals(const RFCOMM_Channel_t* const RFCOMMChannel,
Bluetooth_Channel_t* const ACLChannel);
void RFCOMM_SendData(const uint16_t DataLen, const uint8_t* Data,
void RFCOMM_SendData(const uint16_t DataLen,
const uint8_t* Data,
const RFCOMM_Channel_t* const RFCOMMChannel,
Bluetooth_Channel_t* const ACLChannel);
void RFCOMM_ChannelOpened(RFCOMM_Channel_t* const RFCOMMChannel);
void RFCOMM_DataReceived(RFCOMM_Channel_t* const RFCOMMChannel, uint16_t DataLen, const uint8_t* Data);
void RFCOMM_DataReceived(RFCOMM_Channel_t* const RFCOMMChannel,
uint16_t DataLen,
const uint8_t* Data);
void RFCOMM_ChannelSignalsReceived(RFCOMM_Channel_t* const RFCOMMChannel);
RFCOMM_Channel_t* RFCOMM_GetFreeChannelEntry(const uint8_t DLCI);
RFCOMM_Channel_t* RFCOMM_GetChannelData(const uint8_t DLCI);
uint16_t RFCOMM_GetVariableFieldValue(const uint8_t** BufferPos);
void RFCOMM_SendFrame(const uint8_t DLCI, const bool CommandResponse, const uint8_t Control,
const uint16_t DataLen, const void* Data, Bluetooth_Channel_t* const ACLChannel);
void RFCOMM_SendFrame(const uint8_t DLCI,
const bool CommandResponse,
const uint8_t Control,
const uint16_t DataLen,
const void* Data,
Bluetooth_Channel_t* const ACLChannel);
#if defined(INCLUDE_FROM_RFCOMM_C)
static uint8_t RFCOMM_GetFCSValue(const void* FrameStart, uint8_t Length);
static uint8_t RFCOMM_GetFCSValue(const void* FrameStart,
uint8_t Length);
static void RFCOMM_ProcessDM(const RFCOMM_Address_t* const FrameAddress, Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessDISC(const RFCOMM_Address_t* const FrameAddress, Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessSABM(const RFCOMM_Address_t* const FrameAddress, Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessUA(const RFCOMM_Address_t* const FrameAddress, Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessUIH(const RFCOMM_Address_t* const FrameAddress, const uint16_t FrameLength,
const uint8_t* FrameData, Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessDM(const RFCOMM_Address_t* const FrameAddress,
Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessDISC(const RFCOMM_Address_t* const FrameAddress,
Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessSABM(const RFCOMM_Address_t* const FrameAddress,
Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessUA(const RFCOMM_Address_t* const FrameAddress,
Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessUIH(const RFCOMM_Address_t* const FrameAddress,
const uint16_t FrameLength,
const uint8_t* FrameData,
Bluetooth_Channel_t* const ACLChannel);
#endif
#endif

View file

@ -38,7 +38,8 @@
#define INCLUDE_FROM_RFCOMM_CONTROL_C
#include "RFCOMMControl.h"
void RFCOMM_ProcessControlCommand(const uint8_t* Command, Bluetooth_Channel_t* const ACLChannel)
void RFCOMM_ProcessControlCommand(const uint8_t* Command,
Bluetooth_Channel_t* const ACLChannel)
{
const RFCOMM_Command_t* CommandHeader = (const RFCOMM_Command_t*)Command;
const uint8_t* CommandData = (const uint8_t*)Command + sizeof(RFCOMM_Command_t);
@ -73,8 +74,10 @@ void RFCOMM_ProcessControlCommand(const uint8_t* Command, Bluetooth_Channel_t* c
}
}
static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t CommandDataLen,
const uint8_t* CommandData, Bluetooth_Channel_t* const ACLChannel)
static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t CommandDataLen,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel)
{
const uint8_t* Params = (const uint8_t*)CommandData;
@ -98,20 +101,24 @@ static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeade
RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, false, RFCOMM_Frame_UIH, sizeof(TestResponse), &TestResponse, ACLChannel);
}
static void RFCOMM_ProcessFCECommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
static void RFCOMM_ProcessFCECommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel)
{
BT_RFCOMM_DEBUG(1, "<< FCE Command");
}
static void RFCOMM_ProcessFCDCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
static void RFCOMM_ProcessFCDCommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel)
{
BT_RFCOMM_DEBUG(1, "<< FCD Command");
}
static void RFCOMM_ProcessMSCCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t CommandDataLen,
const uint8_t* CommandData, Bluetooth_Channel_t* const ACLChannel)
static void RFCOMM_ProcessMSCCommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t CommandDataLen,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel)
{
const RFCOMM_MSC_Parameters_t* Params = (const RFCOMM_MSC_Parameters_t*)CommandData;
@ -168,19 +175,22 @@ static void RFCOMM_ProcessMSCCommand(const RFCOMM_Command_t* const CommandHeader
}
}
static void RFCOMM_ProcessRPNCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
static void RFCOMM_ProcessRPNCommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel)
{
BT_RFCOMM_DEBUG(1, "<< RPN Command");
}
static void RFCOMM_ProcessRLSCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
static void RFCOMM_ProcessRLSCommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel)
{
BT_RFCOMM_DEBUG(1, "<< RLS Command");
}
static void RFCOMM_ProcessDPNCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
static void RFCOMM_ProcessDPNCommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel)
{
const RFCOMM_DPN_Parameters_t* Params = (const RFCOMM_DPN_Parameters_t*)CommandData;

View file

@ -115,22 +115,32 @@
} RFCOMM_MSC_Parameters_t;
/* Function Prototypes: */
void RFCOMM_ProcessControlCommand(const uint8_t* Command, Bluetooth_Channel_t* const Channel);
void RFCOMM_ProcessControlCommand(const uint8_t* Command,
Bluetooth_Channel_t* const Channel);
#if defined(INCLUDE_FROM_RFCOMM_CONTROL_C)
static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t CommandDataLen,
const uint8_t* CommandData, Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessFCECommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t CommandDataLen,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessFCECommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessFCDCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
static void RFCOMM_ProcessFCDCommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessMSCCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t CommandDataLen,
const uint8_t* CommandData, Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessRPNCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
static void RFCOMM_ProcessMSCCommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t CommandDataLen,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessRLSCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
static void RFCOMM_ProcessRPNCommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessDPNCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
static void RFCOMM_ProcessRLSCommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessDPNCommand(const RFCOMM_Command_t* const CommandHeader,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel);
#endif

View file

@ -88,7 +88,8 @@ void SDP_ProcessPacket(void* Data, Bluetooth_Channel_t* const Channel)
* \param[in] SDPHeader Pointer to the start of the issued SDP request
* \param[in] Channel Pointer to the Bluetooth channel structure the request was issued to
*/
static void SDP_ProcessServiceSearch(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)
{
const void* CurrentParameter = ((const void*)SDPHeader + sizeof(SDP_PDUHeader_t));
@ -169,7 +170,8 @@ static void SDP_ProcessServiceSearch(const SDP_PDUHeader_t* const SDPHeader, Blu
* \param[in] SDPHeader Pointer to the start of the issued SDP request
* \param[in] Channel Pointer to the Bluetooth channel structure the request was issued to
*/
static void SDP_ProcessServiceAttribute(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)
{
const void* CurrentParameter = ((const void*)SDPHeader + sizeof(SDP_PDUHeader_t));
@ -259,7 +261,8 @@ static void SDP_ProcessServiceAttribute(const SDP_PDUHeader_t* const SDPHeader,
* \param[in] SDPHeader Pointer to the start of the issued SDP request
* \param[in] Channel Pointer to the Bluetooth channel structure the request was issued to
*/
static void SDP_ProcessServiceSearchAttribute(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)
{
const void* CurrentParameter = ((const void*)SDPHeader + sizeof(SDP_PDUHeader_t));
@ -348,8 +351,10 @@ static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHe
*
* \return Number of bytes added to the output buffer
*/
static uint16_t SDP_AddListedAttributesToResponse(const ServiceAttributeTable_t* AttributeTable, uint16_t AttributeList[][2],
const uint8_t TotalAttributes, void** const BufferPos)
static uint16_t SDP_AddListedAttributesToResponse(const ServiceAttributeTable_t* AttributeTable,
uint16_t AttributeList[][2],
const uint8_t TotalAttributes,
void** const BufferPos)
{
uint16_t TotalResponseSize;
@ -396,7 +401,9 @@ static uint16_t SDP_AddListedAttributesToResponse(const ServiceAttributeTable_t*
*
* \return Number of bytes added to the response buffer
*/
static uint16_t SDP_AddAttributeToResponse(const uint16_t AttributeID, const void* AttributeValue, void** ResponseBuffer)
static uint16_t SDP_AddAttributeToResponse(const uint16_t AttributeID,
const void* AttributeValue,
void** ResponseBuffer)
{
/* Retrieve the size of the attribute value from its container header */
uint8_t AttributeHeaderLength;
@ -424,7 +431,8 @@ static uint16_t SDP_AddAttributeToResponse(const uint16_t AttributeID, const voi
*
* \return Pointer to the start of the Attribute's value if found within the table, NULL otherwise
*/
static void* SDP_GetAttributeValue(const ServiceAttributeTable_t* AttributeTable, const uint16_t AttributeID)
static void* SDP_GetAttributeValue(const ServiceAttributeTable_t* AttributeTable,
const uint16_t AttributeID)
{
void* CurrTableItemData;
@ -449,7 +457,8 @@ static void* SDP_GetAttributeValue(const ServiceAttributeTable_t* AttributeTable
*
* \return True if all the UUIDs given in the UUID list appear in the given attribute table, false otherwise
*/
static bool SDP_SearchServiceTable(uint8_t UUIDList[][UUID_SIZE_BYTES], const uint8_t TotalUUIDs,
static bool SDP_SearchServiceTable(uint8_t UUIDList[][UUID_SIZE_BYTES],
const uint8_t TotalUUIDs,
const ServiceAttributeTable_t* CurrAttributeTable)
{
const void* CurrAttribute;
@ -481,8 +490,10 @@ static bool SDP_SearchServiceTable(uint8_t UUIDList[][UUID_SIZE_BYTES], const ui
*
* \return True if all the UUIDs given in the UUID list appear in the given attribute table, false otherwise
*/
static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES], const uint8_t TotalUUIDs,
uint16_t* const UUIDMatchFlags, const void* CurrAttribute)
static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES],
const uint8_t TotalUUIDs,
uint16_t* const UUIDMatchFlags,
const void* CurrAttribute)
{
uint8_t CurrAttributeType = (pgm_read_byte(CurrAttribute) & ~0x07);
@ -536,7 +547,8 @@ static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES], const uint8_
*
* \return Total number of Attribute ranges stored in the Data Element Sequence
*/
static uint8_t SDP_GetAttributeList(uint16_t AttributeList[][2], const void** const CurrentParameter)
static uint8_t SDP_GetAttributeList(uint16_t AttributeList[][2],
const void** const CurrentParameter)
{
uint8_t ElementHeaderSize;
uint8_t TotalAttributes = 0;
@ -578,7 +590,8 @@ static uint8_t SDP_GetAttributeList(uint16_t AttributeList[][2], const void** co
*
* \return Total number of UUIDs stored in the Data Element Sequence
*/
static uint8_t SDP_GetUUIDList(uint8_t UUIDList[][UUID_SIZE_BYTES], const void** const CurrentParameter)
static uint8_t SDP_GetUUIDList(uint8_t UUIDList[][UUID_SIZE_BYTES],
const void** const CurrentParameter)
{
uint8_t ElementHeaderSize;
uint8_t TotalUUIDs = 0;
@ -629,7 +642,8 @@ static uint8_t SDP_GetUUIDList(uint8_t UUIDList[][UUID_SIZE_BYTES], const void**
*
* \return Size in bytes of the entire attribute container, including the header
*/
static uint32_t SDP_GetLocalAttributeContainerSize(const void* const AttributeData, uint8_t* const HeaderSize)
static uint32_t SDP_GetLocalAttributeContainerSize(const void* const AttributeData,
uint8_t* const HeaderSize)
{
/* Fetch the size of the Data Element structure from the header */
uint8_t SizeIndex = (pgm_read_byte(AttributeData) & 0x07);
@ -668,7 +682,8 @@ static uint32_t SDP_GetLocalAttributeContainerSize(const void* const AttributeDa
*
* \return Size in bytes of the Data Element container's contents, minus the header
*/
static uint32_t SDP_GetDataElementSize(const void** const DataElementHeader, uint8_t* const ElementHeaderSize)
static uint32_t SDP_GetDataElementSize(const void** const DataElementHeader,
uint8_t* const ElementHeaderSize)
{
/* Fetch the size of the Data Element structure from the header, increment the current buffer pos */
uint8_t SizeIndex = (SDP_ReadData8(DataElementHeader) & 0x07);

View file

@ -110,7 +110,8 @@
* \param[in, out] BufferPos Current position in the buffer where the data is to be written to
* \param[in] Data Data to write to the buffer
*/
static inline void SDP_WriteData8(void** BufferPos, uint8_t Data)
static inline void SDP_WriteData8(void** BufferPos,
const uint8_t Data)
{
*((uint8_t*)*BufferPos) = Data;
*BufferPos += sizeof(uint8_t);
@ -121,7 +122,8 @@
* \param[in, out] BufferPos Current position in the buffer where the data is to be written to
* \param[in] Data Data to write to the buffer
*/
static inline void SDP_WriteData16(void** BufferPos, uint16_t Data)
static inline void SDP_WriteData16(void** BufferPos,
const uint16_t Data)
{
*((uint16_t*)*BufferPos) = SwapEndian_16(Data);
*BufferPos += sizeof(uint16_t);
@ -132,7 +134,8 @@
* \param[in, out] BufferPos Current position in the buffer where the data is to be written to
* \param[in] Data Data to write to the buffer
*/
static inline void SDP_WriteData32(void** BufferPos, uint32_t Data)
static inline void SDP_WriteData32(void** BufferPos,
const uint32_t Data)
{
*((uint32_t*)*BufferPos) = SwapEndian_32(Data);
*BufferPos += sizeof(uint32_t);
@ -203,28 +206,44 @@
}
/* Function Prototypes: */
void SDP_ProcessPacket(void* Data, Bluetooth_Channel_t* const Channel);
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 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 bool SDP_SearchServiceTable(uint8_t UUIDList[][UUID_SIZE_BYTES], const uint8_t TotalUUIDs,
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,
uint16_t* const UUIDMatchFlags, const void* CurrAttribute);
static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES],
const uint8_t TotalUUIDs,
uint16_t* const UUIDMatchFlags,
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 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);
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
#endif