aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/Incomplete
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-10-13 14:05:35 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-10-13 14:05:35 +0000
commit5a4def747897c1c6ffbe465506d846c7c686d3e9 (patch)
treee5a9ca31ab554e993f1a9041e44976cf7b253921 /Demos/Host/Incomplete
parenta8871c7fba73307226bd13e2cad4c840c850e6f1 (diff)
downloadlufa-5a4def747897c1c6ffbe465506d846c7c686d3e9.tar.gz
lufa-5a4def747897c1c6ffbe465506d846c7c686d3e9.tar.bz2
lufa-5a4def747897c1c6ffbe465506d846c7c686d3e9.zip
Clean up excessive whitespace at the end of each line using the wspurify tool made by Laszlo Monda
Diffstat (limited to 'Demos/Host/Incomplete')
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c1
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h1
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c31
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h19
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c22
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.h19
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.c21
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.h19
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c149
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h49
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h21
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c63
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h37
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c13
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h37
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c61
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h31
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c51
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h29
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c121
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h37
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c13
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h41
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/makefile49
24 files changed, 479 insertions, 456 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c b/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
index 543e1b879..de4db0c50 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
@@ -191,3 +191,4 @@ void RFCOMM_ChannelSignalsReceived(RFCOMM_Channel_t* const RFCOMMChannel)
{
// Currently do nothing in response to the remote device sending new terminal control signals
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h b/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h
index 336f61d5e..3e1b70457 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h
@@ -69,3 +69,4 @@
extern RFCOMM_Channel_t* SerialChannel_RFCOMM;
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
index 8301e85bd..c2139154c 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -52,14 +52,14 @@ int main(void)
SetupHardware();
puts_P(PSTR(ESC_FG_CYAN "Bluetooth Host Demo running.\r\n" ESC_FG_WHITE));
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
for (;;)
{
RFCOMM_ServiceChannels(SerialChannel_ACL);
-
+
Bluetooth_Host_Task();
Bluetooth_Stack_USBTask();
USB_USBTask();
@@ -130,7 +130,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -143,7 +143,7 @@ void Bluetooth_Host_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Device Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessDeviceDescriptor()) != SuccessfulDeviceRead)
{
@@ -153,7 +153,7 @@ void Bluetooth_Host_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDS_LED1);
@@ -177,9 +177,9 @@ void Bluetooth_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -189,7 +189,7 @@ void Bluetooth_Host_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDS_LED1);
@@ -199,7 +199,7 @@ void Bluetooth_Host_Task(void)
}
puts_P(PSTR("Bluetooth Dongle Enumerated.\r\n"));
-
+
/* Initialize the Bluetooth stack */
Bluetooth_Stack_Init();
@@ -207,3 +207,4 @@ void Bluetooth_Host_Task(void)
break;
}
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h
index 0814845a0..a5148900f 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -54,7 +54,7 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -73,7 +73,7 @@
/* Task Definitions: */
void Bluetooth_Host_Task(void);
-
+
/* Event Handlers: */
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -84,5 +84,6 @@
/* Function Prototypes: */
void SetupHardware(void);
-
+
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c b/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c
index cc7570387..447bf00a4 100644
--- a/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c
+++ b/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
USB_Descriptor_Endpoint_t* EventsEndpoint = NULL;
@@ -67,11 +67,11 @@ uint8_t ProcessConfigurationDescriptor(void)
default:
return DevControlError;
}
-
+
/* The Bluetooth USB transport addendum mandates that the data (not streaming voice) endpoints
be in the first interface descriptor (interface 0) */
USB_GetNextDescriptorOfType(&CurrConfigBytesRem, &CurrConfigLocation, DTYPE_Interface);
-
+
/* Ensure that an interface was found, and the end of the descriptor was not reached */
if (!(CurrConfigBytesRem))
return NoCompatibleInterfaceFound;
@@ -103,7 +103,7 @@ uint8_t ProcessConfigurationDescriptor(void)
DataOUTEndpoint = EndpointData;
}
}
-
+
/* Configure the Bluetooth data IN pipe */
Pipe_ConfigurePipe(BLUETOOTH_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -125,7 +125,7 @@ uint8_t ProcessConfigurationDescriptor(void)
* configuration descriptor, to search for a specific sub descriptor. It can also be used to abort the configuration
* descriptor processing if an incompatible descriptor configuration is found.
*
- * This comparator searches for the next Endpoint descriptor inside the current interface descriptor, aborting the
+ * This comparator searches for the next Endpoint descriptor inside the current interface descriptor, aborting the
* search if another interface descriptor is found before the required endpoint.
*
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
diff --git a/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.h b/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.h
index 25442b87b..6d1ec2d49 100644
--- a/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.h
+++ b/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,7 +38,7 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
/* Macros: */
#define BLUETOOTH_DATA_IN_PIPE 1
#define BLUETOOTH_DATA_OUT_PIPE 2
@@ -54,10 +54,11 @@
InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */
NoCompatibleInterfaceFound = 4, /**< A compatible interface with the required endpoints was not found */
};
-
+
/* Function Prototypes: */
uint8_t ProcessConfigurationDescriptor(void);
-
+
uint8_t DComp_NextInterfaceBluetoothDataEndpoint(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.c b/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.c
index 22a9c3506..707180023 100644
--- a/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.c
+++ b/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,7 +30,7 @@
/** \file
*
- * USB Device Descriptor processing routines, to determine the overall device parameters. Descriptors are special
+ * USB Device Descriptor processing routines, to determine the overall device parameters. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine information about
* the attached device.
*/
@@ -50,11 +50,11 @@ uint8_t ProcessDeviceDescriptor(void)
/* Send the request to retrieve the device descriptor */
if (USB_Host_GetDeviceDescriptor(&DeviceDescriptor) != HOST_SENDCONTROL_Successful)
return DevControlError;
-
+
/* Validate returned data - ensure the returned data is a device descriptor */
if (DeviceDescriptor.Header.Type != DTYPE_Device)
return InvalidDeviceDataReturned;
-
+
/* Validate returned device Class, SubClass and Protocol values against the Bluetooth spec values */
if ((DeviceDescriptor.Class != BLUETOOTH_DEVICE_CLASS) ||
(DeviceDescriptor.SubClass != BLUETOOTH_DEVICE_SUBCLASS) ||
@@ -62,6 +62,7 @@ uint8_t ProcessDeviceDescriptor(void)
{
return IncorrectBTDevice;
}
-
+
return SuccessfulDeviceRead;
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.h b/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.h
index 06bbc8526..1c017d386 100644
--- a/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.h
+++ b/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "BluetoothHost.h"
-
+
/* Macros: */
/** Device Class value for the Bluetooth Device class. */
#define BLUETOOTH_DEVICE_CLASS 0xE0
@@ -62,6 +62,7 @@
};
/* Function Prototypes: */
- uint8_t ProcessDeviceDescriptor(void);
+ uint8_t ProcessDeviceDescriptor(void);
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
index 939b2ae5f..35b1e920d 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,14 +50,14 @@ void Bluetooth_ACLTask(void)
{
/* Process incoming ACL packets, if any */
Bluetooth_ProcessIncomingACLPackets();
-
+
/* Check for any half-open channels, send configuration details to the remote device if found */
for (uint8_t i = 0; i < BLUETOOTH_MAX_OPEN_CHANNELS; i++)
{
Bluetooth_Channel_t* ChannelData = &Bluetooth_Connection.Channels[i];
-
+
bool MustSendConfigReq = true;
-
+
/* Check if we are in a channel state which requires a configuration request to be sent */
switch (ChannelData->State)
{
@@ -71,7 +71,7 @@ void Bluetooth_ACLTask(void)
MustSendConfigReq = false;
break;
}
-
+
/* Only send a configuration request if it the channel was in a state which required it */
if (MustSendConfigReq)
{
@@ -79,14 +79,14 @@ void Bluetooth_ACLTask(void)
{
BT_Signal_Header_t SignalCommandHeader;
BT_Signal_ConfigurationReq_t ConfigurationRequest;
-
+
struct
{
BT_Config_Option_Header_t Header;
uint16_t Value;
} Option_LocalMTU;
} PacketData;
-
+
/* Fill out the Signal Command header in the response packet */
PacketData.SignalCommandHeader.Code = BT_SIGNAL_CONFIGURATION_REQUEST;
PacketData.SignalCommandHeader.Identifier = ++Bluetooth_Connection.SignalingIdentifier;
@@ -101,7 +101,7 @@ void Bluetooth_ACLTask(void)
PacketData.Option_LocalMTU.Value = ChannelData->LocalMTU;
Bluetooth_SendPacket(&PacketData, sizeof(PacketData), NULL);
-
+
BT_ACL_DEBUG(1, ">> L2CAP Configuration Request");
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", PacketData.ConfigurationRequest.DestinationChannel);
}
@@ -119,13 +119,13 @@ static void Bluetooth_ProcessIncomingACLPackets(void)
Pipe_SelectPipe(BLUETOOTH_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
if (!(Pipe_IsReadWriteAllowed()))
{
Pipe_Freeze();
return;
}
-
+
/* Read in the received ACL packet headers when it has been discovered that a packet has been received */
Pipe_Read_Stream_LE(&ACLPacketHeader, sizeof(ACLPacketHeader));
Pipe_Read_Stream_LE(&DataHeader, sizeof(DataHeader));
@@ -143,7 +143,7 @@ static void Bluetooth_ProcessIncomingACLPackets(void)
/* Read in the Signal Command header of the incoming packet */
BT_Signal_Header_t SignalCommandHeader;
Pipe_Read_Stream_LE(&SignalCommandHeader, sizeof(SignalCommandHeader));
-
+
/* Dispatch to the appropriate handler function based on the Signal message code */
switch (SignalCommandHeader.Code)
{
@@ -173,20 +173,20 @@ static void Bluetooth_ProcessIncomingACLPackets(void)
break;
case BT_SIGNAL_COMMAND_REJECT:
BT_ACL_DEBUG(1, "<< Command Reject");
-
+
uint16_t RejectReason;
Pipe_Read_Stream_LE(&RejectReason, sizeof(RejectReason));
Pipe_Discard_Stream(ACLPacketHeader.DataLength - sizeof(RejectReason));
Pipe_ClearIN();
- Pipe_Freeze();
-
+ Pipe_Freeze();
+
BT_ACL_DEBUG(2, "-- Reason: %d", RejectReason);
break;
default:
BT_ACL_DEBUG(1, "<< Unknown Signaling Command 0x%02X", SignalCommandHeader.Code);
-
+
Pipe_Discard_Stream(ACLPacketHeader.DataLength);
- Pipe_ClearIN();
+ Pipe_ClearIN();
Pipe_Freeze();
break;
}
@@ -198,7 +198,7 @@ static void Bluetooth_ProcessIncomingACLPackets(void)
Pipe_Read_Stream_LE(PacketData, DataHeader.PayloadLength);
Pipe_ClearIN();
Pipe_Freeze();
-
+
Bluetooth_PacketReceived(PacketData, DataHeader.PayloadLength,
Bluetooth_GetChannelData(DataHeader.DestinationChannel, CHANNEL_SEARCH_LOCALNUMBER));
}
@@ -221,9 +221,9 @@ Bluetooth_Channel_t* Bluetooth_GetChannelData(const uint16_t SearchValue,
/* Closed channels should be ignored as they are not considered valid data */
if (ChannelData->State == BT_Channel_Closed)
continue;
-
+
bool FoundMatch = false;
-
+
/* Search the current channel for the search key to see if it matches */
switch (SearchKey)
{
@@ -237,7 +237,7 @@ Bluetooth_Channel_t* Bluetooth_GetChannelData(const uint16_t SearchValue,
FoundMatch = (SearchValue == ChannelData->PSM);
break;
}
-
+
if (FoundMatch)
return ChannelData;
}
@@ -285,9 +285,9 @@ uint8_t Bluetooth_SendPacket(void* Data,
Pipe_Write_Stream_LE(&DataHeader, sizeof(DataHeader));
Pipe_Write_Stream_LE(Data, DataLen);
Pipe_ClearOUT();
-
+
Pipe_Freeze();
-
+
BT_ACL_DEBUG(2, "");
BT_ACL_DEBUG(2, "Packet Sent");
BT_ACL_DEBUG(2, "-- Connection Handle: 0x%04X", (ACLPacketHeader.ConnectionHandle & 0x0FFF));
@@ -319,7 +319,7 @@ Bluetooth_Channel_t* Bluetooth_OpenChannel(const uint16_t PSM)
if (Bluetooth_Connection.Channels[i].State == BT_Channel_Closed)
{
ChannelData = &Bluetooth_Connection.Channels[i];
-
+
/* Set the new channel structure's local channel number to a unique value within the connection orientated
channel address space */
ChannelData->LocalNumber = (BT_CHANNELNUMBER_BASEOFFSET + i);
@@ -336,7 +336,7 @@ Bluetooth_Channel_t* Bluetooth_OpenChannel(const uint16_t PSM)
ChannelData->PSM = PSM;
ChannelData->LocalMTU = MAXIMUM_CHANNEL_MTU;
ChannelData->State = BT_Channel_WaitConnectRsp;
-
+
struct
{
BT_Signal_Header_t SignalCommandHeader;
@@ -347,11 +347,11 @@ Bluetooth_Channel_t* Bluetooth_OpenChannel(const uint16_t PSM)
PacketData.SignalCommandHeader.Code = BT_SIGNAL_CONNECTION_REQUEST;
PacketData.SignalCommandHeader.Identifier = ++Bluetooth_Connection.SignalingIdentifier;
PacketData.SignalCommandHeader.Length = sizeof(PacketData.ConnectionRequest);
-
+
/* Fill out the Connection Request in the response packet */
PacketData.ConnectionRequest.PSM = PSM;
PacketData.ConnectionRequest.SourceChannel = ChannelData->LocalNumber;
-
+
Bluetooth_SendPacket(&PacketData, sizeof(PacketData), NULL);
BT_ACL_DEBUG(1, ">> L2CAP Connection Request");
@@ -385,7 +385,7 @@ void Bluetooth_CloseChannel(Bluetooth_Channel_t* const ACLChannel)
BT_Signal_Header_t SignalCommandHeader;
BT_Signal_DisconnectionReq_t DisconnectionRequest;
} PacketData;
-
+
/* Fill out the Signal Command header in the response packet */
PacketData.SignalCommandHeader.Code = BT_SIGNAL_DISCONNECTION_REQUEST;
PacketData.SignalCommandHeader.Identifier = ++Bluetooth_Connection.SignalingIdentifier;
@@ -396,10 +396,10 @@ void Bluetooth_CloseChannel(Bluetooth_Channel_t* const ACLChannel)
PacketData.DisconnectionRequest.SourceChannel = ACLChannel->LocalNumber;
Bluetooth_SendPacket(&PacketData, sizeof(PacketData), NULL);
-
+
BT_ACL_DEBUG(1, ">> L2CAP Disconnection Request");
- BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", PacketData.DisconnectionRequest.DestinationChannel);
- BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", PacketData.DisconnectionRequest.SourceChannel);
+ BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", PacketData.DisconnectionRequest.DestinationChannel);
+ BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", PacketData.DisconnectionRequest.SourceChannel);
}
/** Internal Bluetooth stack Signal Command processing routine for a Connection Request command.
@@ -409,12 +409,12 @@ void Bluetooth_CloseChannel(Bluetooth_Channel_t* const ACLChannel)
static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_Signal_ConnectionReq_t ConnectionRequest;
-
+
Pipe_Read_Stream_LE(&ConnectionRequest, sizeof(ConnectionRequest));
Pipe_ClearIN();
Pipe_Freeze();
-
+
BT_ACL_DEBUG(1, "<< L2CAP Connection Request");
BT_ACL_DEBUG(2, "-- PSM: 0x%04X", ConnectionRequest.PSM);
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConnectionRequest.SourceChannel);
@@ -439,7 +439,7 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
}
}
}
-
+
uint8_t ChannelStatus = BT_CONNECTION_REFUSED_RESOURCES;
/* Reset the channel item contents only if a channel entry was found for it */
@@ -452,15 +452,15 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
ChannelData->PSM = ConnectionRequest.PSM;
ChannelData->LocalMTU = MAXIMUM_CHANNEL_MTU;
ChannelData->State = BT_Channel_Config_WaitConfig;
-
+
ChannelStatus = BT_CONNECTION_SUCCESSFUL;
}
else
{
- ChannelStatus = BT_CONNECTION_REFUSED_PSM;
+ ChannelStatus = BT_CONNECTION_REFUSED_PSM;
}
}
-
+
struct
{
BT_Signal_Header_t SignalCommandHeader;
@@ -477,7 +477,7 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
ResponsePacket.ConnectionResponse.SourceChannel = ChannelData->RemoteNumber;
ResponsePacket.ConnectionResponse.Result = ChannelStatus;
ResponsePacket.ConnectionResponse.Status = 0x00;
-
+
Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);
BT_ACL_DEBUG(1, ">> L2CAP Connection Response");
@@ -493,16 +493,16 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
static inline void Bluetooth_Signal_ConnectionResp(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_Signal_ConnectionResp_t ConnectionResponse;
-
+
Pipe_Read_Stream_LE(&ConnectionResponse, sizeof(ConnectionResponse));
Pipe_ClearIN();
Pipe_Freeze();
BT_ACL_DEBUG(1, "<< L2CAP Connection Response");
- BT_ACL_DEBUG(2, "-- Result: 0x%02X", ConnectionResponse.Result);
- BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConnectionResponse.SourceChannel);
- BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ConnectionResponse.DestinationChannel);
+ BT_ACL_DEBUG(2, "-- Result: 0x%02X", ConnectionResponse.Result);
+ BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConnectionResponse.SourceChannel);
+ BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ConnectionResponse.DestinationChannel);
/* Search for the referenced channel in the channel information list */
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConnectionResponse.SourceChannel, CHANNEL_SEARCH_LOCALNUMBER);
@@ -524,12 +524,12 @@ static inline void Bluetooth_Signal_ConnectionResp(const BT_Signal_Header_t* con
static inline void Bluetooth_Signal_ConfigurationReq(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_Signal_ConfigurationReq_t ConfigurationRequest;
-
+
/* Allocate a buffer large enough to hold the variable number of configuration options in the request */
uint8_t OptionsLen = (SignalCommandHeader->Length - sizeof(ConfigurationRequest));
uint8_t Options[OptionsLen];
- Pipe_Read_Stream_LE(&ConfigurationRequest, sizeof(ConfigurationRequest));
+ Pipe_Read_Stream_LE(&ConfigurationRequest, sizeof(ConfigurationRequest));
Pipe_Read_Stream_LE(&Options, sizeof(Options));
Pipe_ClearIN();
@@ -554,7 +554,7 @@ static inline void Bluetooth_Signal_ConfigurationReq(const BT_Signal_Header_t* c
BT_ACL_DEBUG(2, "-- Option Type: 0x%04X", OptionHeader->Type);
BT_ACL_DEBUG(2, "-- Option Length: 0x%04X", (sizeof(BT_Config_Option_Header_t) + OptionHeader->Length));
-
+
/* Store the remote MTU option's value if present */
if (OptionHeader->Type == BT_CONFIG_OPTION_MTU)
ChannelData->RemoteMTU = *((uint16_t*)OptionData);
@@ -563,7 +563,7 @@ static inline void Bluetooth_Signal_ConfigurationReq(const BT_Signal_Header_t* c
OptionPos += (sizeof(BT_Config_Option_Header_t) + OptionHeader->Length);
}
}
-
+
struct
{
BT_Signal_Header_t SignalCommandHeader;
@@ -616,14 +616,14 @@ static inline void Bluetooth_Signal_ConfigurationResp(const BT_Signal_Header_t*
Pipe_ClearIN();
Pipe_Freeze();
-
+
BT_ACL_DEBUG(1, "<< L2CAP Configuration Response");
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConfigurationResponse.SourceChannel);
BT_ACL_DEBUG(2, "-- Result: 0x%02X", ConfigurationResponse.Result);
/* Search for the referenced channel in the channel information list */
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConfigurationResponse.SourceChannel, CHANNEL_SEARCH_REMOTENUMBER);
-
+
/* Only update the channel's state if it was found in the channel list */
if (ChannelData != NULL)
{
@@ -639,7 +639,7 @@ static inline void Bluetooth_Signal_ConfigurationResp(const BT_Signal_Header_t*
ChannelData->State = BT_Channel_Open;
Bluetooth_ChannelOpened(ChannelData);
break;
- }
+ }
}
else
{
@@ -656,16 +656,16 @@ static inline void Bluetooth_Signal_ConfigurationResp(const BT_Signal_Header_t*
static inline void Bluetooth_Signal_DisconnectionReq(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_Signal_DisconnectionReq_t DisconnectionRequest;
-
+
Pipe_Read_Stream_LE(&DisconnectionRequest, sizeof(DisconnectionRequest));
BT_ACL_DEBUG(1, "<< L2CAP Disconnection Request");
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", DisconnectionRequest.DestinationChannel);
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", DisconnectionRequest.SourceChannel);
-
+
Pipe_ClearIN();
Pipe_Freeze();
-
+
/* Search for the referenced channel in the channel information list */
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(DisconnectionRequest.SourceChannel, CHANNEL_SEARCH_REMOTENUMBER);
@@ -702,20 +702,20 @@ static inline void Bluetooth_Signal_DisconnectionReq(const BT_Signal_Header_t* c
static inline void Bluetooth_Signal_DisconnectionResp(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_Signal_DisconnectionResp_t DisconnectionResponse;
-
+
Pipe_Read_Stream_LE(&DisconnectionResponse, sizeof(DisconnectionResponse));
BT_ACL_DEBUG(1, "<< L2CAP Disconnection Response");
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", DisconnectionResponse.DestinationChannel);
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", DisconnectionResponse.SourceChannel);
-
+
Pipe_ClearIN();
Pipe_Freeze();
-
+
/* Search for the referenced channel in the channel information list */
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(DisconnectionResponse.SourceChannel, CHANNEL_SEARCH_REMOTENUMBER);
-
- /* If the channel was found in the channel list, close it */
+
+ /* If the channel was found in the channel list, close it */
if (ChannelData != NULL)
ChannelData->State = BT_Channel_Closed;
}
@@ -727,10 +727,10 @@ static inline void Bluetooth_Signal_DisconnectionResp(const BT_Signal_Header_t*
static inline void Bluetooth_Signal_EchoReq(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_ACL_DEBUG(1, "<< L2CAP Echo Request");
-
+
Pipe_ClearIN();
Pipe_Freeze();
-
+
struct
{
BT_Signal_Header_t SignalCommandHeader;
@@ -740,7 +740,7 @@ static inline void Bluetooth_Signal_EchoReq(const BT_Signal_Header_t* const Sign
ResponsePacket.SignalCommandHeader.Code = BT_SIGNAL_ECHO_RESPONSE;
ResponsePacket.SignalCommandHeader.Identifier = SignalCommandHeader->Identifier;
ResponsePacket.SignalCommandHeader.Length = 0;
-
+
Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);
BT_ACL_DEBUG(1, ">> L2CAP Echo Response");
@@ -758,7 +758,7 @@ static inline void Bluetooth_Signal_InformationReq(const BT_Signal_Header_t* con
BT_ACL_DEBUG(1, "<< L2CAP Information Request");
BT_ACL_DEBUG(2, "-- Info Type: 0x%04X", InformationRequest.InfoType);
-
+
Pipe_ClearIN();
Pipe_Freeze();
@@ -766,25 +766,25 @@ static inline void Bluetooth_Signal_InformationReq(const BT_Signal_Header_t* con
{
BT_Signal_Header_t SignalCommandHeader;
BT_Signal_InformationResp_t InformationResponse;
-
+
uint8_t Data[4];
} ResponsePacket;
-
+
uint8_t DataLen = 0;
-
+
/* Retrieve the requested information and store it in the outgoing packet, if found */
switch (InformationRequest.InfoType)
{
- case BT_INFOREQ_MTU:
+ case BT_INFOREQ_MTU:
ResponsePacket.InformationResponse.Result = BT_INFORMATION_SUCCESSFUL;
DataLen = 2;
-
+
*((uint16_t*)&ResponsePacket.Data) = MAXIMUM_CHANNEL_MTU;
break;
case BT_INFOREQ_EXTENDEDFEATURES:
ResponsePacket.InformationResponse.Result = BT_INFORMATION_SUCCESSFUL;
DataLen = 4;
-
+
*((uint32_t*)&ResponsePacket.Data) = 0;
break;
default:
@@ -792,7 +792,7 @@ static inline void Bluetooth_Signal_InformationReq(const BT_Signal_Header_t* con
DataLen = 0;
break;
}
-
+
/* Fill out the Signal Command header in the response packet */
ResponsePacket.SignalCommandHeader.Code = BT_SIGNAL_INFORMATION_RESPONSE;
ResponsePacket.SignalCommandHeader.Identifier = SignalCommandHeader->Identifier;
@@ -800,9 +800,10 @@ static inline void Bluetooth_Signal_InformationReq(const BT_Signal_Header_t* con
/* Fill out the Information Response in the response packet */
ResponsePacket.InformationResponse.InfoType = InformationRequest.InfoType;
-
+
Bluetooth_SendPacket(&ResponsePacket, (sizeof(ResponsePacket) - sizeof(ResponsePacket.Data) + DataLen), NULL);
- BT_ACL_DEBUG(1, ">> L2CAP Information Response");
+ BT_ACL_DEBUG(1, ">> L2CAP Information Response");
BT_ACL_DEBUG(2, "-- Result: 0x%02X", ResponsePacket.InformationResponse.Result);
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h
index efe9d39f6..4c587d597 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -44,13 +44,13 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
-
+
#include "BluetoothStack.h"
-
+
/* Macros: */
#define BT_ACL_DEBUG(l, s, ...) do { if (ACL_DEBUG_LEVEL >= l) printf_P(PSTR("(ACL) " s "\r\n"), ##__VA_ARGS__); } while (0)
#define ACL_DEBUG_LEVEL 0
-
+
/** Lowest possible channel number for L2CAP data channels. */
#define BT_CHANNELNUMBER_BASEOFFSET 0x0040
@@ -59,7 +59,7 @@
/** Bluetooth specification defined channel number for connectionless data. */
#define BT_CHANNEL_CONNECTIONLESS 0x0002
-
+
#define BT_ACL_FIRST_AUTOFLUSH (1 << 13)
#define BT_SIGNAL_COMMAND_REJECT 0x01
@@ -73,23 +73,23 @@
#define BT_SIGNAL_ECHO_RESPONSE 0x09
#define BT_SIGNAL_INFORMATION_REQUEST 0x0A
#define BT_SIGNAL_INFORMATION_RESPONSE 0x0B
-
+
#define BT_INFOREQ_MTU 0x0001
#define BT_INFOREQ_EXTENDEDFEATURES 0x0002
-
+
#define BT_INFORMATION_SUCCESSFUL 0x0000
#define BT_INFORMATION_NOTSUPPORTED 0x0001
-
+
#define BT_CONNECTION_SUCCESSFUL 0x0000
#define BT_CONNECTION_REFUSED_PSM 0x0002
#define BT_CONNECTION_REFUSED_RESOURCES 0x0004
-
+
#define BT_CONFIGURATION_SUCCESSFUL 0x0000
#define BT_CONFIGURATION_REJECTED 0x0002
#define BT_CONFIGURATION_UNKNOWNOPTIONS 0x0003
-
+
#define BT_CONFIG_OPTION_MTU 1
-
+
/* Type Defines: */
/** Bluetooth ACL header structure, common to all ACL data packets. */
typedef struct
@@ -104,7 +104,7 @@
uint16_t PayloadLength; /**< Size of the data payload, in bytes */
uint16_t DestinationChannel; /**< Destination channel in the device the data is directed to */
} BT_DataPacket_Header_t;
-
+
/** Bluetooth signaling command header structure, for all ACL packets containing a signaling command. */
typedef struct
{
@@ -112,7 +112,7 @@
uint8_t Identifier; /**< Unique signal command identifier to link requests and responses */
uint16_t Length; /**< Length of the signaling command data, in bytes */
} BT_Signal_Header_t;
-
+
/** Connection Request signaling command structure, for channel connection requests. */
typedef struct
{
@@ -135,13 +135,13 @@
uint16_t DestinationChannel; /**< Destination channel address which is to be disconnected */
uint16_t SourceChannel; /**< Source channel address which is to be disconnected */
} BT_Signal_DisconnectionReq_t;
-
+
/** Disconnection response signaling command structure, for responses to channel disconnection requests. */
typedef struct
{
uint16_t DestinationChannel; /**< Destination channel address which was disconnected */
uint16_t SourceChannel; /**< Source channel address which was disconnected */
- } BT_Signal_DisconnectionResp_t;
+ } BT_Signal_DisconnectionResp_t;
/** Configuration Request signaling command structure, for channel configuration requests. */
typedef struct
@@ -163,14 +163,14 @@
{
uint16_t InfoType; /**< Data type that is being requested, a BT_INFOREQ_* mask value */
} BT_Signal_InformationReq_t;
-
+
/** Information Response signaling command structure, for responses to information requests. */
typedef struct
{
uint16_t InfoType; /**< Data type that was requested, a BT_INFOREQ_* mask value */
uint16_t Result; /**< Result of the request, a BT_INFORMATION_* mask value */
} BT_Signal_InformationResp_t;
-
+
/** Configuration Option header structure, placed at the start of each option in a Channel Configuration
* request's options list.
*/
@@ -182,7 +182,7 @@
/* Function Prototypes: */
void Bluetooth_ACLTask(void);
-
+
#if defined(INCLUDE_FROM_BLUETOOTH_ACLPACKETS_C)
static void Bluetooth_ProcessIncomingACLPackets(void);
@@ -195,5 +195,6 @@
static inline void Bluetooth_Signal_EchoReq(const BT_Signal_Header_t* const SignalCommandHeader);
static inline void Bluetooth_Signal_InformationReq(const BT_Signal_Header_t* const SignalCommandHeader);
#endif
-
+
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h
index c4690f4a8..f0699373d 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -46,7 +46,7 @@
#define DEVICE_CLASS_SERVICE_AUDIO (1UL << 21)
#define DEVICE_CLASS_SERVICE_TELEPHONY (1UL << 22)
#define DEVICE_CLASS_SERVICE_INFORMATION (1UL << 23)
-
+
#define DEVICE_CLASS_MAJOR_MISC (0x00 << 8)
#define DEVICE_CLASS_MAJOR_COMPUTER (0x01 << 8)
#define DEVICE_CLASS_MAJOR_PHONE (0x02 << 8)
@@ -63,7 +63,7 @@
#define DEVICE_CLASS_MINOR_COMPUTER_HANDHELD (0x04 << 2)
#define DEVICE_CLASS_MINOR_COMPUTER_PALM (0x05 << 2)
#define DEVICE_CLASS_MINOR_COMPUTER_WEARABLE (0x06 << 2)
-
+
#define DEVICE_CLASS_MINOR_PHONE_UNCATEGORIZED (0x00 << 2)
#define DEVICE_CLASS_MINOR_PHONE_CELLULAR (0x01 << 2)
#define DEVICE_CLASS_MINOR_PHONE_CORDLESS (0x02 << 2)
@@ -79,7 +79,7 @@
#define DEVICE_CLASS_MINOR_LAN_67_TO_83_PC_UTILIZED (0x05 << 5)
#define DEVICE_CLASS_MINOR_LAN_83_TO_99_PC_UTILIZED (0x06 << 5)
#define DEVICE_CLASS_MINOR_LAN_NO_SERVICE_AVAILABLE (0x07 << 5)
-
+
#define DEVICE_CLASS_MINOR_AV_UNCATEGORIZED (0x00 << 2)
#define DEVICE_CLASS_MINOR_AV_HEADSET (0x01 << 2)
#define DEVICE_CLASS_MINOR_AV_HANDSFREE (0x02 << 2)
@@ -97,7 +97,7 @@
#define DEVICE_CLASS_MINOR_AV_DISPLAY_AND_LOUDSPEAKER (0x0F << 2)
#define DEVICE_CLASS_MINOR_AV_VIDEO_CONFERENCING (0x10 << 2)
#define DEVICE_CLASS_MINOR_AV_GAMING_TOY (0x12 << 2)
-
+
#define DEVICE_CLASS_MINOR_PERIPHERAL_KEYBOARD (0x01 << 6)
#define DEVICE_CLASS_MINOR_PERIPHERAL_POINTING (0x02 << 6)
#define DEVICE_CLASS_MINOR_PERIPHERAL_COMBO (0x03 << 6)
@@ -115,3 +115,4 @@
#define DEVICE_CLASS_MINOR_IMAGING_PRINTER (1 << 7)
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c
index 7f6f8b78d..0cf18f21c 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -59,28 +59,28 @@ void Bluetooth_HCITask(void)
case Bluetooth_ProcessEvents:
Pipe_SelectPipe(BLUETOOTH_EVENTS_PIPE);
Pipe_Unfreeze();
-
+
if (Pipe_IsReadWriteAllowed())
{
BT_HCIEvent_Header_t HCIEventHeader;
/* Read in the event header to fetch the event code and payload length */
Pipe_Read_Stream_LE(&HCIEventHeader, sizeof(HCIEventHeader));
-
+
/* Create a temporary buffer for the event parameters */
uint8_t EventParams[HCIEventHeader.ParameterLength];
/* Read in the event parameters into the temporary buffer */
Pipe_Read_Stream_LE(&EventParams, HCIEventHeader.ParameterLength);
Pipe_ClearIN();
-
+
BT_HCI_DEBUG(1, "Event Received (0x%02X)", HCIEventHeader.EventCode);
switch (HCIEventHeader.EventCode)
{
case EVENT_COMMAND_COMPLETE:
BT_HCI_DEBUG(1, "<< Command Complete");
-
+
/* Check which operation was completed in case we need to process the even parameters */
switch (((BT_HCIEvent_CommandComplete_t*)&EventParams)->Opcode)
{
@@ -91,7 +91,7 @@ void Bluetooth_HCITask(void)
sizeof(Bluetooth_State.LocalBDADDR));
break;
}
-
+
Bluetooth_State.CurrentHCIState = Bluetooth_State.NextHCIState;
break;
case EVENT_COMMAND_STATUS:
@@ -110,7 +110,7 @@ void Bluetooth_HCITask(void)
memcpy(Bluetooth_TempDeviceAddress,
&((BT_HCIEvent_ConnectionRequest_t*)&EventParams)->RemoteAddress,
sizeof(Bluetooth_TempDeviceAddress));
-
+
bool IsACLConnection = (((BT_HCIEvent_ConnectionRequest_t*)&EventParams)->LinkType == 0x01);
/* Only accept the connection if it is a ACL (data) connection, a device is not already connected
@@ -135,12 +135,12 @@ void Bluetooth_HCITask(void)
break;
case EVENT_LINK_KEY_REQUEST:
BT_HCI_DEBUG(1, "<< Link Key Request");
-
+
/* Need to store the remote device's BT address in a temporary buffer for later use */
memcpy(Bluetooth_TempDeviceAddress,
&((BT_HCIEvent_LinkKeyReq_t*)&EventParams)->RemoteAddress,
- sizeof(Bluetooth_TempDeviceAddress));
-
+ sizeof(Bluetooth_TempDeviceAddress));
+
Bluetooth_State.CurrentHCIState = Bluetooth_Conn_SendLinkKeyNAK;
break;
case EVENT_CONNECTION_COMPLETE:
@@ -155,22 +155,22 @@ void Bluetooth_HCITask(void)
/* Store the created connection handle and indicate that the connection has been established */
Bluetooth_Connection.ConnectionHandle = ((BT_HCIEvent_ConnectionComplete_t*)&EventParams)->ConnectionHandle;
Bluetooth_Connection.IsConnected = true;
-
- Bluetooth_ConnectionComplete();
+
+ Bluetooth_ConnectionComplete();
break;
case EVENT_DISCONNECTION_COMPLETE:
BT_HCI_DEBUG(1, "<< Disconnection Complete");
/* Device disconnected, indicate connection information no longer valid */
Bluetooth_Connection.IsConnected = false;
-
+
Bluetooth_DisconnectionComplete();
break;
}
}
-
+
Pipe_Freeze();
-
+
break;
case Bluetooth_Init:
BT_HCI_DEBUG(1, "# Init");
@@ -180,7 +180,7 @@ void Bluetooth_HCITask(void)
/* Reset the connection information structure to destroy any previous connection state */
memset(&Bluetooth_Connection, 0x00, sizeof(Bluetooth_Connection));
- Bluetooth_State.CurrentHCIState = Bluetooth_Init_Reset;
+ Bluetooth_State.CurrentHCIState = Bluetooth_Init_Reset;
break;
case Bluetooth_Init_Reset:
BT_HCI_DEBUG(1, "# Reset");
@@ -193,13 +193,13 @@ void Bluetooth_HCITask(void)
/* Send the command to reset the Bluetooth dongle controller */
Bluetooth_SendHCICommand(&HCICommandHeader, NULL, 0);
-
+
Bluetooth_State.NextHCIState = Bluetooth_Init_ReadBufferSize;
Bluetooth_State.CurrentHCIState = Bluetooth_ProcessEvents;
break;
case Bluetooth_Init_ReadBufferSize:
BT_HCI_DEBUG(1, "# Read Buffer Size");
-
+
HCICommandHeader = (BT_HCICommand_Header_t)
{
OpCode: (OGF_CTRLR_INFORMATIONAL | OCF_CTRLR_INFORMATIONAL_READBUFFERSIZE),
@@ -214,7 +214,7 @@ void Bluetooth_HCITask(void)
break;
case Bluetooth_Init_GetBDADDR:
BT_HCI_DEBUG(1, "# Get BDADDR");
-
+
HCICommandHeader = (BT_HCICommand_Header_t)
{
OpCode: (OGF_CTRLR_INFORMATIONAL | OCF_CTRLR_INFORMATIONAL_READBDADDR),
@@ -267,10 +267,10 @@ void Bluetooth_HCITask(void)
};
uint8_t Interval = BT_SCANMODE_InquiryAndPageScans;
-
+
/* Send the command to set the remote device scanning mode */
Bluetooth_SendHCICommand(&HCICommandHeader, &Interval, 1);
-
+
Bluetooth_State.NextHCIState = Bluetooth_Init_FinalizeInit;
Bluetooth_State.CurrentHCIState = Bluetooth_ProcessEvents;
break;
@@ -301,7 +301,7 @@ void Bluetooth_HCITask(void)
/* Send the command to accept the remote connection request */
Bluetooth_SendHCICommand(&HCICommandHeader, &AcceptConnectionParams, sizeof(BT_HCICommand_AcceptConnectionReq_t));
-
+
Bluetooth_State.CurrentHCIState = Bluetooth_ProcessEvents;
break;
case Bluetooth_Conn_RejectConnection:
@@ -321,7 +321,7 @@ void Bluetooth_HCITask(void)
/* Send the command to reject the remote connection request */
Bluetooth_SendHCICommand(&HCICommandHeader, &RejectConnectionParams, sizeof(BT_HCICommand_RejectConnectionReq_t));
-
+
Bluetooth_State.CurrentHCIState = Bluetooth_ProcessEvents;
break;
case Bluetooth_Conn_SendPINCode:
@@ -339,7 +339,7 @@ void Bluetooth_HCITask(void)
memcpy(PINCodeRequestParams.RemoteAddress, Bluetooth_TempDeviceAddress, sizeof(PINCodeRequestParams.RemoteAddress));
PINCodeRequestParams.PINCodeLength = strlen(Bluetooth_DeviceConfiguration.PINCode);
memcpy(PINCodeRequestParams.PINCode, Bluetooth_DeviceConfiguration.PINCode, sizeof(PINCodeRequestParams.PINCode));
-
+
/* Send the command to transmit the device's local PIN number for authentication */
Bluetooth_SendHCICommand(&HCICommandHeader, &PINCodeRequestParams, sizeof(BT_HCICommand_PinCodeResp_t));
@@ -392,14 +392,15 @@ static uint8_t Bluetooth_SendHCICommand(const BT_HCICommand_Header_t* const HCIC
/* Copy over the HCI command header to the allocated buffer */
memcpy(CommandBuffer, HCICommandHeader, sizeof(BT_HCICommand_Header_t));
-
+
/* Zero out the parameter section of the response so that all padding bytes are known to be zero */
memset(&CommandBuffer[sizeof(BT_HCICommand_Header_t)], 0x00, HCICommandHeader->ParameterLength);
/* Copy over the command parameters (if any) to the command buffer - note, the number of actual source parameter bytes
may differ to those in the header; any difference in length is filled with 0x00 padding bytes */
memcpy(&CommandBuffer[sizeof(BT_HCICommand_Header_t)], Parameters, ParameterLength);
-
+
Pipe_SelectPipe(PIPE_CONTROLPIPE);
return USB_Host_SendControlRequest(CommandBuffer);
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h
index 9476446f6..90074e841 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -82,7 +82,7 @@
#define OCF_CTRLR_BASEBAND_WRITE_AUTHENTICATION_ENABLE 0x0020
#define OCF_CTRLR_INFORMATIONAL_READBUFFERSIZE 0x0005
#define OCF_CTRLR_INFORMATIONAL_READBDADDR 0x0009
-
+
#define EVENT_COMMAND_STATUS 0x0F
#define EVENT_COMMAND_COMPLETE 0x0E
#define EVENT_CONNECTION_COMPLETE 0x03
@@ -91,10 +91,10 @@
#define EVENT_REMOTE_NAME_REQUEST_COMPLETE 0x07
#define EVENT_PIN_CODE_REQUEST 0x16
#define EVENT_LINK_KEY_REQUEST 0x17
-
+
#define ERROR_LIMITED_RESOURCES 0x0D
#define ERROR_UNACCEPTABLE_BDADDR 0x0F
-
+
/* Type Defines: */
typedef struct
{
@@ -115,7 +115,7 @@
uint8_t Packets;
uint16_t OpCode;
} BT_HCIEvent_CommandStatus_t;
-
+
typedef struct
{
uint8_t HCIPacketsAllowable;
@@ -139,7 +139,7 @@
uint8_t LinkType;
uint8_t EncryptionEnabled;
} BT_HCIEvent_ConnectionComplete_t;
-
+
typedef struct
{
uint8_t RemoteAddress[6];
@@ -149,7 +149,7 @@
{
uint8_t RemoteAddress[6];
} BT_HCIEvent_LinkKeyReq_t;
-
+
typedef struct
{
uint8_t RemoteAddress[6];
@@ -161,18 +161,18 @@
uint8_t PINCodeLength;
char PINCode[16];
} BT_HCICommand_PinCodeResp_t;
-
+
typedef struct
{
uint8_t RemoteAddress[6];
uint8_t SlaveRole;
} BT_HCICommand_AcceptConnectionReq_t;
-
+
typedef struct
{
uint8_t RemoteAddress[6];
uint8_t Reason;
- } BT_HCICommand_RejectConnectionReq_t;
+ } BT_HCICommand_RejectConnectionReq_t;
/* Enums: */
enum BT_ScanEnable_Modes_t
@@ -199,14 +199,15 @@
Bluetooth_Conn_SendPINCode = 11,
Bluetooth_Conn_SendLinkKeyNAK = 12,
};
-
+
/* Function Prototypes: */
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,
const uint16_t ParameterLength);
#endif
-
+
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c
index 1fa8079f3..d85b1f983 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -71,3 +71,4 @@ void Bluetooth_Stack_USBTask(void)
Bluetooth_HCITask();
Bluetooth_ACLTask();
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
index e434e6c4f..9483198c7 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,12 +38,12 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "../ConfigDescriptor.h"
-
+
/* Macros: */
#define BLUETOOTH_MAX_OPEN_CHANNELS 6
-
+
#define CHANNEL_PSM_SDP 0x0001
#define CHANNEL_PSM_UDP 0x0002
#define CHANNEL_PSM_RFCOMM 0x0003
@@ -53,13 +53,13 @@
#define CHANNEL_PSM_HTTP 0x000C
#define CHANNEL_PSM_UPNP 0x0010
#define CHANNEL_PSM_HIDP 0x0011
-
+
#define CHANNEL_SEARCH_LOCALNUMBER 0
#define CHANNEL_SEARCH_REMOTENUMBER 1
#define CHANNEL_SEARCH_PSM 2
-
+
#define MAXIMUM_CHANNEL_MTU 255
-
+
/* Enums: */
/** Enum for the possible states for a Bluetooth ACL channel. */
enum BT_ChannelStates_t
@@ -117,7 +117,7 @@
Bluetooth_Channel_t Channels[BLUETOOTH_MAX_OPEN_CHANNELS]; /**< Channel information structures for the connection. */
uint8_t SignalingIdentifier; /**< Next Signaling Channel unique command sequence identifier. */
} Bluetooth_Connection_t;
-
+
/** Local Bluetooth device information structure, for the defining of local device characteristics for the Bluetooth stack. */
typedef struct
{
@@ -125,7 +125,7 @@
char PINCode[16]; /**< Pin code required to send or receive in order to authenticate with a remote device. */
char Name[]; /**< Name of the local Bluetooth device, up to 248 characters. */
} Bluetooth_Device_t;
-
+
/** Bluetooth stack state information structure, for the containment of the Bluetooth stack state. The values in
* this structure are set by the Bluetooth stack internally, and should all be treated as read only by the user
* application.
@@ -139,12 +139,12 @@
*/
uint8_t LocalBDADDR[6]; /**< Local Bluetooth adapter's BDADDR, valid when the stack is fully initialized. */
} Bluetooth_Stack_State_t;
-
+
/* Includes: */
#include "BluetoothHCICommands.h"
- #include "BluetoothACLPackets.h"
-
- /* Function Prototypes: */
+ #include "BluetoothACLPackets.h"
+
+ /* Function Prototypes: */
void Bluetooth_Stack_Init(void);
void Bluetooth_Stack_USBTask(void);
@@ -171,3 +171,4 @@
extern Bluetooth_Stack_State_t Bluetooth_State;
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c
index 2638dee35..636b5a454 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -124,7 +124,7 @@ void RFCOMM_ProcessPacket(void* Data,
const RFCOMM_Header_t* FrameHeader = (const RFCOMM_Header_t*)Data;
const uint8_t* FrameData = (const uint8_t*)Data + sizeof(RFCOMM_Header_t);
uint16_t FrameDataLen = RFCOMM_GetVariableFieldValue(&FrameData);
-
+
/* Decode the RFCOMM frame type from the header */
switch (FrameHeader->Control & ~FRAME_POLL_FINAL)
{
@@ -167,7 +167,7 @@ void RFCOMM_SendChannelSignals(const RFCOMM_Channel_t* const RFCOMMChannel,
uint8_t Length;
RFCOMM_MSC_Parameters_t Params;
} MSCommand;
-
+
MSCommand.CommandHeader = (RFCOMM_Command_t){.Command = RFCOMM_Control_ModemStatus, .EA = true, .CR = true};
MSCommand.Length = (sizeof(MSCommand.Params) << 1) | 0x01;
MSCommand.Params.Channel = (RFCOMM_Address_t){.DLCI = RFCOMMChannel->DLCI, .EA = true, .CR = true};
@@ -175,7 +175,7 @@ void RFCOMM_SendChannelSignals(const RFCOMM_Channel_t* const RFCOMMChannel,
MSCommand.Params.BreakSignal = RFCOMMChannel->Local.BreakSignal;
/* Send the MSC command to the remote device */
- RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, true, RFCOMM_Frame_UIH, sizeof(MSCommand), &MSCommand, ACLChannel);
+ RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, true, RFCOMM_Frame_UIH, sizeof(MSCommand), &MSCommand, ACLChannel);
}
/** Sends new data through an open logical RFCOMM channel. This should be used to transmit data through a
@@ -193,12 +193,12 @@ void RFCOMM_SendData(const uint16_t DataLen,
{
if (RFCOMMChannel->State != RFCOMM_Channel_Open)
return;
-
+
BT_RFCOMM_DEBUG(1, ">> UIH Frame");
BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", RFCOMMChannel->DLCI);
/* Send the MSC command to the remote device */
- RFCOMM_SendFrame(RFCOMMChannel->DLCI, false, RFCOMM_Frame_UIH, DataLen, Data, ACLChannel);
+ RFCOMM_SendFrame(RFCOMMChannel->DLCI, false, RFCOMM_Frame_UIH, DataLen, Data, ACLChannel);
}
RFCOMM_Channel_t* RFCOMM_GetFreeChannelEntry(const uint8_t DLCI)
@@ -220,11 +220,11 @@ RFCOMM_Channel_t* RFCOMM_GetFreeChannelEntry(const uint8_t DLCI)
RFCOMMChannel->Local.Signals = RFCOMM_SIGNAL_RTC | RFCOMM_SIGNAL_RTR | RFCOMM_SIGNAL_DV | (1 << 0);
RFCOMMChannel->Local.BreakSignal = 0 | (1 << 0);
RFCOMMChannel->ConfigFlags = 0;
-
+
return RFCOMMChannel;
}
}
-
+
return NULL;
}
@@ -234,7 +234,7 @@ RFCOMM_Channel_t* RFCOMM_GetChannelData(const uint8_t DLCI)
for (uint8_t i = 0; i < RFCOMM_MAX_OPEN_CHANNELS; i++)
{
RFCOMM_Channel_t* CurrRFCOMMChannel = &RFCOMM_Channels[i];
-
+
/* If the current non-closed channel's DLCI matches the search DLCI, return it to the caller */
if ((CurrRFCOMMChannel->State != RFCOMM_Channel_Closed) && (CurrRFCOMMChannel->DLCI == DLCI))
return CurrRFCOMMChannel;
@@ -248,10 +248,10 @@ uint16_t RFCOMM_GetVariableFieldValue(const uint8_t** BufferPos)
{
uint8_t FirstOctet;
uint8_t SecondOctet = 0;
-
+
FirstOctet = **BufferPos;
(*BufferPos)++;
-
+
/* If the field size is more than a single byte, fetch the next byte in the variable length field */
if (!(FirstOctet & 0x01))
{
@@ -281,30 +281,30 @@ void RFCOMM_SendFrame(const uint8_t DLCI,
uint8_t Data[DataLen];
uint8_t FCS;
} ResponsePacket;
-
+
/* Set the frame header values to the specified address and frame type */
ResponsePacket.FrameHeader.Control = Control;
ResponsePacket.FrameHeader.Address = (RFCOMM_Address_t){.DLCI = DLCI, .EA = true, .CR = CommandResponse};
-
+
/* Set the lower 7 bits of the packet length */
ResponsePacket.Size[0] = (DataLen << 1);
-
+
/* Terminate the size field if size is 7 bits or lower, otherwise set the upper 8 bits of the length */
if (DataLen < 128)
ResponsePacket.Size[0] |= 0x01;
else
ResponsePacket.Size[1] = (DataLen >> 7);
-
+
/* Copy over the packet data from the source buffer to the response packet buffer */
memcpy(ResponsePacket.Data, Data, DataLen);
-
+
/* Determine the length of the frame which is to be used to calculate the CRC value */
uint8_t CRCLength = sizeof(ResponsePacket.FrameHeader);
/* UIH frames do not have the CRC calculated on the Size field in the response, all other frames do */
if ((Control & ~FRAME_POLL_FINAL) != RFCOMM_Frame_UIH)
CRCLength += sizeof(ResponsePacket.Size);
-
+
/* Calculate the frame checksum from the appropriate fields */
ResponsePacket.FCS = RFCOMM_GetFCSValue(&ResponsePacket, CRCLength);
@@ -316,7 +316,7 @@ static uint8_t RFCOMM_GetFCSValue(const void* FrameStart,
uint8_t Length)
{
uint8_t FCS = 0xFF;
-
+
/* Calculate new Frame CRC value via the given data bytes and the CRC table */
for (uint8_t i = 0; i < Length; i++)
FCS = pgm_read_byte(&CRC8_Table[FCS ^ ((const uint8_t*)FrameStart)[i]]);
@@ -338,7 +338,7 @@ static void RFCOMM_ProcessDISC(const RFCOMM_Address_t* const FrameAddress,
BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", FrameAddress->DLCI);
RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(FrameAddress->DLCI);
-
+
/* If the requested channel is currently open, destroy it */
if (RFCOMMChannel != NULL)
RFCOMMChannel->State = RFCOMM_Channel_Closed;
@@ -356,7 +356,7 @@ static void RFCOMM_ProcessSABM(const RFCOMM_Address_t* const FrameAddress,
if (FrameAddress->DLCI == RFCOMM_CONTROL_DLCI)
{
BT_RFCOMM_DEBUG(1, ">> UA Sent");
-
+
/* Free channel found, or request was to the control channel - accept SABM by sending a UA frame */
RFCOMM_SendFrame(FrameAddress->DLCI, true, (RFCOMM_Frame_UA | FRAME_POLL_FINAL), 0, NULL, ACLChannel);
@@ -365,7 +365,7 @@ static void RFCOMM_ProcessSABM(const RFCOMM_Address_t* const FrameAddress,
/* Find the existing channel's entry in the channel table */
RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(FrameAddress->DLCI);
-
+
/* Existing entry not found, create a new entry for the channel */
if (RFCOMMChannel == NULL)
RFCOMMChannel = RFCOMM_GetFreeChannelEntry(FrameAddress->DLCI);
@@ -374,7 +374,7 @@ static void RFCOMM_ProcessSABM(const RFCOMM_Address_t* const FrameAddress,
if (RFCOMMChannel != NULL)
{
BT_RFCOMM_DEBUG(1, ">> UA Sent");
-
+
/* Free channel found, or request was to the control channel - accept SABM by sending a UA frame */
RFCOMM_SendFrame(FrameAddress->DLCI, true, (RFCOMM_Frame_UA | FRAME_POLL_FINAL), 0, NULL, ACLChannel);
}
@@ -395,7 +395,7 @@ static void RFCOMM_ProcessUA(const RFCOMM_Address_t* const FrameAddress,
}
static void RFCOMM_ProcessUIH(const RFCOMM_Address_t* const FrameAddress,
- const uint16_t FrameLength,
+ const uint16_t FrameLength,
const uint8_t* FrameData,
Bluetooth_Channel_t* const ACLChannel)
{
@@ -408,9 +408,10 @@ static void RFCOMM_ProcessUIH(const RFCOMM_Address_t* const FrameAddress,
BT_RFCOMM_DEBUG(1, "<< UIH Received");
BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", FrameAddress->DLCI);
BT_RFCOMM_DEBUG(2, "-- Length 0x%02X", FrameLength);
-
+
RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(FrameAddress->DLCI);
-
+
if (RFCOMMChannel != NULL)
RFCOMM_DataReceived(RFCOMMChannel, FrameLength, FrameData);
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h
index 7b74f4fab..be862a2b3 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,13 +48,13 @@
#include "BluetoothStack.h"
#include "RFCOMMControl.h"
-
+
/* Macros: */
#define BT_RFCOMM_DEBUG(l, s, ...) do { if (RFCOMM_DEBUG_LEVEL >= l) printf_P(PSTR("(RFCOMM) " s "\r\n"), ##__VA_ARGS__); } while (0)
#define RFCOMM_DEBUG_LEVEL 0
-
+
#define FRAME_POLL_FINAL (1 << 4)
-
+
#define RFCOMM_CONTROL_DLCI 0
#define RFCOMM_MAX_OPEN_CHANNELS 5
@@ -68,14 +68,14 @@
RFCOMM_Frame_UA = 0x63, /**< Unnumbered Acknowledgement Field */
RFCOMM_Frame_UIH = 0xEF, /**< Unnumbered Information with Header check Field */
};
-
+
enum RFCOMM_Channel_States_t
{
RFCOMM_Channel_Closed = 0,
RFCOMM_Channel_Configure = 1,
RFCOMM_Channel_Open = 2,
};
-
+
/* Type Defines: */
typedef struct
{
@@ -95,7 +95,7 @@
uint8_t BreakSignal;
} Local;
} RFCOMM_Channel_t;
-
+
/* External Variables: */
extern RFCOMM_Channel_t RFCOMM_Channels[RFCOMM_MAX_OPEN_CHANNELS];
@@ -104,7 +104,7 @@
void RFCOMM_ServiceChannels(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,
@@ -141,9 +141,10 @@
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 uint16_t FrameLength,
const uint8_t* FrameData,
Bluetooth_Channel_t* const ACLChannel);
#endif
-
+
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c
index 5bd884572..871d3627f 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -69,7 +69,7 @@ void RFCOMM_ProcessControlCommand(const uint8_t* Command,
RFCOMM_ProcessDPNCommand(CommandHeader, CommandData, ACLChannel);
break;
default:
- BT_RFCOMM_DEBUG(1, "<< Unknown Command");
+ BT_RFCOMM_DEBUG(1, "<< Unknown Command");
break;
}
}
@@ -82,7 +82,7 @@ static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeade
const uint8_t* Params = (const uint8_t*)CommandData;
BT_RFCOMM_DEBUG(1, "<< TEST Command");
-
+
struct
{
RFCOMM_Command_t CommandHeader;
@@ -94,7 +94,7 @@ static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeade
TestResponse.CommandHeader = (RFCOMM_Command_t){.Command = RFCOMM_Control_Test, .EA = true, .CR = false};
TestResponse.Length = (CommandDataLen << 1) | 0x01;
memcpy(TestResponse.TestData, Params, CommandDataLen);
-
+
BT_RFCOMM_DEBUG(1, ">> TEST Response");
/* Send the PDN response to acknowledge the command */
@@ -124,14 +124,14 @@ static void RFCOMM_ProcessMSCCommand(const RFCOMM_Command_t* const CommandHeader
BT_RFCOMM_DEBUG(1, "<< MSC %s", (CommandHeader->CR) ? "Command" : "Response");
BT_RFCOMM_DEBUG(2, "-- DLCI: 0x%02X", Params->Channel.DLCI);
-
+
/* Ignore status flags sent to the control channel */
if (Params->Channel.DLCI == RFCOMM_CONTROL_DLCI)
return;
-
+
/* Retrieve existing channel configuration data, if already opened */
- RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(Params->Channel.DLCI);
-
+ RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(Params->Channel.DLCI);
+
/* If the channel does not exist, abort */
if (RFCOMMChannel == NULL)
return;
@@ -140,16 +140,16 @@ static void RFCOMM_ProcessMSCCommand(const RFCOMM_Command_t* const CommandHeader
if (CommandHeader->CR)
{
/* Save the new channel signals to the channel state structure */
- RFCOMMChannel->Remote.Signals = Params->Signals;
+ RFCOMMChannel->Remote.Signals = Params->Signals;
RFCOMMChannel->ConfigFlags |= RFCOMM_CONFIG_REMOTESIGNALS;
-
+
/* If the command contains the optional break signals field, store the value */
if (CommandDataLen == sizeof(RFCOMM_MSC_Parameters_t))
RFCOMMChannel->Remote.BreakSignal = Params->BreakSignal;
/* Notify the user application that the signals have been received */
RFCOMM_ChannelSignalsReceived(RFCOMMChannel);
-
+
struct
{
RFCOMM_Command_t CommandHeader;
@@ -172,7 +172,7 @@ static void RFCOMM_ProcessMSCCommand(const RFCOMM_Command_t* const CommandHeader
{
/* Indicate that the remote device has acknowledged the sent signals */
RFCOMMChannel->ConfigFlags |= RFCOMM_CONFIG_LOCALSIGNALS;
- }
+ }
}
static void RFCOMM_ProcessRPNCommand(const RFCOMM_Command_t* const CommandHeader,
@@ -197,20 +197,20 @@ static void RFCOMM_ProcessDPNCommand(const RFCOMM_Command_t* const CommandHeader
BT_RFCOMM_DEBUG(1, "<< DPN Command");
BT_RFCOMM_DEBUG(2, "-- DLCI: 0x%02X", Params->DLCI);
-
+
/* Ignore parameter negotiations to the control channel */
if (Params->DLCI == RFCOMM_CONTROL_DLCI)
return;
-
+
/* Retrieve existing channel configuration data, if already opened */
RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(Params->DLCI);
-
+
/* Check if the channel has no corresponding entry - remote did not open it first */
if (RFCOMMChannel == NULL)
{
/* Create a new entry in the channel table for the new channel */
RFCOMMChannel = RFCOMM_GetFreeChannelEntry(Params->DLCI);
-
+
/* No free entry was found, discard the request */
if (RFCOMMChannel == NULL)
{
@@ -218,27 +218,28 @@ static void RFCOMM_ProcessDPNCommand(const RFCOMM_Command_t* const CommandHeader
return;
}
}
-
+
/* Save the new channel configuration */
RFCOMMChannel->State = RFCOMM_Channel_Configure;
RFCOMMChannel->Priority = Params->Priority;
RFCOMMChannel->MTU = Params->MaximumFrameSize;
-
+
struct
{
RFCOMM_Command_t CommandHeader;
uint8_t Length;
RFCOMM_DPN_Parameters_t Params;
} DPNResponse;
-
+
/* Fill out the DPN response data */
DPNResponse.CommandHeader = (RFCOMM_Command_t){.Command = RFCOMM_Control_DLCParameterNegotiation, .EA = true, .CR = false};
DPNResponse.Length = (sizeof(DPNResponse.Params) << 1) | 0x01;
memcpy(&DPNResponse.Params, Params, sizeof(RFCOMM_DPN_Parameters_t));
DPNResponse.Params.ConvergenceLayer = 0x00; // TODO: Enable credit based transaction support
-
+
BT_RFCOMM_DEBUG(1, ">> DPN Response");
/* Send the DPN response to acknowledge the command */
RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, false, RFCOMM_Frame_UIH, sizeof(DPNResponse), &DPNResponse, ACLChannel);
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h
index b527bfa7c..b65e0d5a0 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,14 +48,14 @@
#include "BluetoothStack.h"
#include "RFCOMM.h"
-
+
/* Macros: */
#define RFCOMM_SIGNAL_FC (1 << 1)
#define RFCOMM_SIGNAL_RTC (1 << 2)
#define RFCOMM_SIGNAL_RTR (1 << 3)
#define RFCOMM_SIGNAL_IC (1 << 6)
#define RFCOMM_SIGNAL_DV (1 << 7)
-
+
#define RFCOMM_CONFIG_REMOTESIGNALS (1 << 0)
#define RFCOMM_CONFIG_LOCALSIGNALS (1 << 1)
#define RFCOMM_CONFIG_LOCALSIGNALSSENT (1 << 2)
@@ -73,7 +73,7 @@
RFCOMM_Control_DLCParameterNegotiation = (0x80 >> 2),
RFCOMM_Control_NonSupportedCommand = (0x10 >> 2),
};
-
+
/* Type Defines: */
typedef struct
{
@@ -94,7 +94,7 @@
unsigned char CR : 1;
unsigned char Command : 6;
} RFCOMM_Command_t;
-
+
typedef struct
{
uint8_t DLCI;
@@ -104,9 +104,9 @@
uint8_t ACKTimerTicks;
uint16_t MaximumFrameSize;
uint8_t MaxRetransmissions;
- uint8_t RecoveryWindowSize;
+ uint8_t RecoveryWindowSize;
} RFCOMM_DPN_Parameters_t;
-
+
typedef struct
{
RFCOMM_Address_t Channel;
@@ -120,7 +120,7 @@
#if defined(INCLUDE_FROM_RFCOMM_CONTROL_C)
static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeader,
- const uint8_t CommandDataLen,
+ const uint8_t CommandDataLen,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessFCECommand(const RFCOMM_Command_t* const CommandHeader,
@@ -143,5 +143,6 @@
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel);
#endif
-
+
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c b/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c
index 19d42e264..3c1acfe28 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -73,7 +73,7 @@ void SDP_ProcessPacket(void* Data, Bluetooth_Channel_t* const Channel)
{
case SDP_PDU_SERVICESEARCHREQUEST:
SDP_ProcessServiceSearch(SDPHeader, Channel);
- break;
+ break;
case SDP_PDU_SERVICEATTRIBUTEREQUEST:
SDP_ProcessServiceAttribute(SDPHeader, Channel);
break;
@@ -99,11 +99,11 @@ static void SDP_ProcessServiceSearch(const SDP_PDUHeader_t* const SDPHeader,
uint8_t UUIDList[12][UUID_SIZE_BYTES];
uint8_t TotalUUIDs = SDP_GetUUIDList(UUIDList, &CurrentParameter);
BT_SDP_DEBUG(2, "-- Total UUIDs: %d", TotalUUIDs);
-
+
/* Retrieve the maximum service record response count from the request */
uint16_t MaxServiceRecordCount = SDP_ReadData16(&CurrentParameter);
BT_SDP_DEBUG(2, "-- Max Return Service Count: 0x%04X", MaxServiceRecordCount);
-
+
struct
{
SDP_PDUHeader_t SDPHeader;
@@ -111,7 +111,7 @@ static void SDP_ProcessServiceSearch(const SDP_PDUHeader_t* const SDPHeader,
uint16_t CurrentServiceRecordCount;
uint8_t ResponseData[100];
} ResponsePacket;
-
+
uint8_t AddedServiceHandles = 0;
/* Create a pointer to the buffer to indicate the current location for response data to be added */
@@ -136,7 +136,7 @@ static void SDP_ProcessServiceSearch(const SDP_PDUHeader_t* const SDPHeader,
uint8_t AttrSize = SDP_GetLocalAttributeContainerSize(AttributeValue, &AttrHeaderSize);
memcpy_P(CurrResponsePos, AttributeValue + AttrHeaderSize, AttrSize);
CurrResponsePos += AttrHeaderSize + AttrSize;
-
+
AddedServiceHandles++;
}
@@ -180,11 +180,11 @@ static void SDP_ProcessServiceAttribute(const SDP_PDUHeader_t* const SDPHeader,
/* Retrieve the service handle whose attributes are to be examined */
uint32_t ServiceHandle = SDP_ReadData32(&CurrentParameter);
BT_SDP_DEBUG(2, "-- Service Handle: 0x%08lX", ServiceHandle);
-
+
/* Retrieve the maximum Attribute response size from the request */
uint16_t MaxAttributeSize = SDP_ReadData16(&CurrentParameter);
BT_SDP_DEBUG(2, "-- Max Return Attribute Bytes: 0x%04X", MaxAttributeSize);
-
+
/* Retrieve the list of Attributes from the request */
uint16_t AttributeList[8][2];
uint8_t TotalAttributes = SDP_GetAttributeList(AttributeList, &CurrentParameter);
@@ -211,24 +211,24 @@ static void SDP_ProcessServiceAttribute(const SDP_PDUHeader_t* const SDPHeader,
{
/* Read in a pointer to the current UUID table entry's Attribute table */
ServiceAttributeTable_t* CurrAttributeTable = pgm_read_ptr(&SDP_Services_Table[CurrTableItem]);
-
+
/* Retrieve a PROGMEM pointer to the value of the Service Record Handle */
const void* ServiceRecord = SDP_GetAttributeValue(CurrAttributeTable, SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE);
-
+
/* Get the size of the header for the Service Record Handle */
uint8_t AttrHeaderSize;
SDP_GetLocalAttributeContainerSize(ServiceRecord, &AttrHeaderSize);
-
+
/* Retrieve the endian-swapped service handle of the current service being examined */
uint32_t CurrServiceHandle = SwapEndian_32(pgm_read_dword(ServiceRecord + AttrHeaderSize));
-
+
/* Check if the current service in the service table has the requested service handle */
if (ServiceHandle == CurrServiceHandle)
{
/* Add the listed attributes for the found UUID to the response */
TotalResponseSize = SDP_AddListedAttributesToResponse(CurrAttributeTable, AttributeList, TotalAttributes,
&CurrResponsePos);
-
+
/* Requested service found, abort the search through the service table */
break;
}
@@ -243,7 +243,7 @@ static void SDP_ProcessServiceAttribute(const SDP_PDUHeader_t* const SDPHeader,
/* Calculate the total parameter length that is to be sent, including the fixed return parameters, the created attribute
value list and the SDP continuation state */
uint16_t ParamLength = (sizeof(ResponsePacket.AttributeListByteCount) + TotalResponseSize + sizeof(uint8_t));
-
+
/* Fill in the response packet's header */
ResponsePacket.SDPHeader.PDU = SDP_PDU_SERVICEATTRIBUTERESPONSE;
ResponsePacket.SDPHeader.TransactionID = SDPHeader->TransactionID;
@@ -265,30 +265,30 @@ static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHe
Bluetooth_Channel_t* const Channel)
{
const void* CurrentParameter = ((const void*)SDPHeader + sizeof(SDP_PDUHeader_t));
-
+
BT_SDP_DEBUG(1, "<< Service Search Attribute");
/* Retrieve the list of search UUIDs from the request */
uint8_t UUIDList[12][UUID_SIZE_BYTES];
uint8_t TotalUUIDs = SDP_GetUUIDList(UUIDList, &CurrentParameter);
BT_SDP_DEBUG(2, "-- Total UUIDs: %d", TotalUUIDs);
-
+
/* Retrieve the maximum Attribute response size from the request */
uint16_t MaxAttributeSize = SDP_ReadData16(&CurrentParameter);
BT_SDP_DEBUG(2, "-- Max Return Attribute Bytes: 0x%04X", MaxAttributeSize);
-
+
/* Retrieve the list of Attributes from the request */
uint16_t AttributeList[8][2];
uint8_t TotalAttributes = SDP_GetAttributeList(AttributeList, &CurrentParameter);
BT_SDP_DEBUG(2, "-- Total Attributes: %d", TotalAttributes);
-
+
struct
{
SDP_PDUHeader_t SDPHeader;
uint16_t AttributeListByteCount;
uint8_t ResponseData[100];
} ResponsePacket;
-
+
/* Create a pointer to the buffer to indicate the current location for response data to be added */
void* CurrResponsePos = ResponsePacket.ResponseData;
@@ -298,7 +298,7 @@ static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHe
/* Add the outer Data Element Sequence header for all of the retrieved Attributes */
uint16_t* TotalResponseSize = SDP_AddSequence16(&CurrResponsePos);
-
+
/* Search through the global service list an item at a time */
for (uint8_t CurrTableItem = 0; CurrTableItem < (sizeof(SDP_Services_Table) / sizeof(void*)); CurrTableItem++)
{
@@ -307,14 +307,14 @@ static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHe
if (!(SDP_SearchServiceTable(UUIDList, TotalUUIDs, CurrAttributeTable)))
continue;
-
+
BT_SDP_DEBUG(2, " -- Found search match in table");
/* Add the listed attributes for the found UUID to the response */
- *TotalResponseSize += SDP_AddListedAttributesToResponse(CurrAttributeTable, AttributeList, TotalAttributes,
+ *TotalResponseSize += SDP_AddListedAttributesToResponse(CurrAttributeTable, AttributeList, TotalAttributes,
&CurrResponsePos);
}
-
+
/* Continuation state - always zero */
SDP_WriteData8(&CurrResponsePos, 0);
@@ -323,7 +323,7 @@ static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHe
/* Calculate the total parameter length that is to be sent, including the fixed return parameters, the created attribute
value list and the SDP continuation state */
- uint16_t ParamLength = (sizeof(ResponsePacket.AttributeListByteCount) +
+ uint16_t ParamLength = (sizeof(ResponsePacket.AttributeListByteCount) +
(3 + *TotalResponseSize) +
sizeof(uint8_t));
@@ -366,7 +366,7 @@ static uint16_t SDP_AddListedAttributesToResponse(const ServiceAttributeTable_t*
{
uint16_t* AttributeIDRange = AttributeList[CurrAttribute];
void* AttributeValue;
-
+
/* Look through the current service's attribute list, examining all the attributes */
while ((AttributeValue = pgm_read_ptr(&AttributeTable->Data)) != NULL)
{
@@ -377,9 +377,9 @@ static uint16_t SDP_AddListedAttributesToResponse(const ServiceAttributeTable_t*
if ((CurrAttributeID >= AttributeIDRange[0]) && (CurrAttributeID <= AttributeIDRange[1]))
{
/* Increment the current UUID's returned Attribute container size by the number of added bytes */
- *AttributeListSize += SDP_AddAttributeToResponse(CurrAttributeID, AttributeValue, BufferPos);
+ *AttributeListSize += SDP_AddAttributeToResponse(CurrAttributeID, AttributeValue, BufferPos);
}
-
+
AttributeTable++;
}
}
@@ -408,19 +408,19 @@ static uint16_t SDP_AddAttributeToResponse(const uint16_t AttributeID,
/* Retrieve the size of the attribute value from its container header */
uint8_t AttributeHeaderLength;
uint16_t AttributeValueLength = SDP_GetLocalAttributeContainerSize(AttributeValue, &AttributeHeaderLength);
-
+
BT_SDP_DEBUG(2, " -- Add Attribute (0x%04X) 0x%04X", (AttributeHeaderLength + AttributeValueLength), AttributeID);
/* Add a Data Element header to the response for the Attribute ID */
SDP_WriteData8(ResponseBuffer, (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit));
-
+
/* Add the Attribute ID to the created Data Element */
SDP_WriteData16(ResponseBuffer, AttributeID);
-
+
/* Copy over the Attribute value Data Element container to the response */
memcpy_P(*ResponseBuffer, AttributeValue, AttributeHeaderLength + AttributeValueLength);
*ResponseBuffer += AttributeHeaderLength + AttributeValueLength;
-
+
return (sizeof(uint8_t) + sizeof(uint16_t) + AttributeHeaderLength + AttributeValueLength);
}
@@ -435,17 +435,17 @@ static void* SDP_GetAttributeValue(const ServiceAttributeTable_t* AttributeTable
const uint16_t AttributeID)
{
void* CurrTableItemData;
-
+
/* Search through the current Attribute table, abort when the terminator item has been reached */
while ((CurrTableItemData = pgm_read_ptr(&AttributeTable->Data)) != NULL)
{
/* Check if the current Attribute ID matches the search ID - if so return a pointer to it */
if (pgm_read_word(&AttributeTable->AttributeID) == AttributeID)
return CurrTableItemData;
-
+
AttributeTable++;
}
-
+
return NULL;
}
@@ -463,7 +463,7 @@ static bool SDP_SearchServiceTable(uint8_t UUIDList[][UUID_SIZE_BYTES],
{
const void* CurrAttribute;
uint16_t UUIDMatchFlags = 0;
-
+
/* Search through the current attribute table, checking each attribute value for UUID matches */
while ((CurrAttribute = pgm_read_ptr(&CurrAttributeTable->Data)) != NULL)
{
@@ -475,7 +475,7 @@ static bool SDP_SearchServiceTable(uint8_t UUIDList[][UUID_SIZE_BYTES],
uint8_t UUIDMatches;
for (UUIDMatches = 0; UUIDMatchFlags; UUIDMatches++)
UUIDMatchFlags &= (UUIDMatchFlags - 1);
-
+
/* If all UUIDs have been matched to the current service, return true */
return (UUIDMatches == TotalUUIDs);
}
@@ -501,7 +501,7 @@ static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES],
if (CurrAttributeType == SDP_DATATYPE_UUID)
{
uint16_t CurrUUIDMatchMask = (1 << 0);
-
+
/* Look for matches in the UUID list against the current attribute UUID value */
for (uint8_t i = 0; i < TotalUUIDs; i++)
{
@@ -512,7 +512,7 @@ static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES],
*UUIDMatchFlags |= CurrUUIDMatchMask;
break;
}
-
+
CurrUUIDMatchMask <<= 1;
}
}
@@ -520,15 +520,15 @@ static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES],
{
uint8_t SequenceHeaderSize;
uint16_t SequenceSize = SDP_GetLocalAttributeContainerSize(CurrAttribute, &SequenceHeaderSize);
-
+
CurrAttribute += SequenceHeaderSize;
-
+
/* Recursively unwrap the sequence container, and re-search its contents for UUIDs */
while (SequenceSize)
{
uint8_t InnerHeaderSize;
uint16_t InnerSize = SDP_GetLocalAttributeContainerSize(CurrAttribute, &InnerHeaderSize);
-
+
/* Recursively search of the next element in the sequence, trying to match UUIDs with the UUID list */
SDP_CheckUUIDMatch(UUIDList, TotalUUIDs, UUIDMatchFlags, CurrAttribute);
@@ -536,10 +536,10 @@ static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES],
SequenceSize -= InnerHeaderSize + InnerSize;
CurrAttribute += InnerHeaderSize + InnerSize;
}
- }
+ }
}
-/** Reads in the collection of Attribute ranges from the input buffer's Data Element Sequence container, into the given
+/** Reads in the collection of Attribute ranges from the input buffer's Data Element Sequence container, into the given
* Attribute list for later use. Once complete, the input buffer pointer is advanced to the end of the Attribute container.
*
* \param[out] AttributeList Pointer to a buffer where the list of Attribute ranges are to be stored
@@ -561,10 +561,10 @@ static uint8_t SDP_GetAttributeList(uint16_t AttributeList[][2],
/* Retrieve the size of the next Attribute in the container and get a pointer to the next free Attribute element in the list */
uint16_t* CurrentAttributeRange = AttributeList[TotalAttributes++];
uint8_t AttributeLength = SDP_GetDataElementSize(CurrentParameter, &ElementHeaderSize);
-
+
/* Copy over the starting Attribute ID and (if it the current element is a range) the ending Attribute ID */
memcpy(&CurrentAttributeRange[0], *CurrentParameter, AttributeLength);
-
+
/* If the element is not an Attribute Range, copy over the starting ID to the ending ID to make a range of 1 */
if (AttributeLength == 2)
CurrentAttributeRange[1] = CurrentAttributeRange[0];
@@ -574,15 +574,15 @@ static uint8_t SDP_GetAttributeList(uint16_t AttributeList[][2],
CurrentAttributeRange[1] = SwapEndian_16(CurrentAttributeRange[1]);
BT_SDP_DEBUG(2, "-- Attribute: 0x%04X-0x%04X", CurrentAttributeRange[0], CurrentAttributeRange[1]);
-
+
AttributeIDListLength -= (AttributeLength + ElementHeaderSize);
*CurrentParameter += AttributeLength;
}
-
+
return TotalAttributes;
}
-/** Reads in the collection of UUIDs from the input buffer's Data Element Sequence container, into the given
+/** Reads in the collection of UUIDs from the input buffer's Data Element Sequence container, into the given
* UUID list for later use. Once complete, the input buffer pointer is advanced to the end of the UUID container.
*
* \param[out] UUIDList Pointer to a buffer where the list of UUIDs are to be stored
@@ -604,7 +604,7 @@ static uint8_t SDP_GetUUIDList(uint8_t UUIDList[][UUID_SIZE_BYTES],
/* Retrieve the size of the next UUID in the container and get a pointer to the next free UUID element in the list */
uint8_t* CurrentUUID = UUIDList[TotalUUIDs++];
uint8_t UUIDLength = SDP_GetDataElementSize(CurrentParameter, &ElementHeaderSize);
-
+
/* Copy over UUID from the container to the free slot */
if (UUIDLength <= 4)
{
@@ -617,9 +617,9 @@ static uint8_t SDP_GetUUIDList(uint8_t UUIDList[][UUID_SIZE_BYTES],
else
{
/* Copy over full UUID */
- memcpy(CurrentUUID, *CurrentParameter, UUIDLength);
+ memcpy(CurrentUUID, *CurrentParameter, UUIDLength);
}
-
+
BT_SDP_DEBUG(2, "-- UUID (%d): %02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
UUIDLength,
CurrentUUID[0], CurrentUUID[1], CurrentUUID[2], CurrentUUID[3],
@@ -631,7 +631,7 @@ static uint8_t SDP_GetUUIDList(uint8_t UUIDList[][UUID_SIZE_BYTES],
ServicePatternLength -= (UUIDLength + ElementHeaderSize);
*CurrentParameter += UUIDLength;
}
-
+
return TotalUUIDs;
}
@@ -647,7 +647,7 @@ static uint32_t SDP_GetLocalAttributeContainerSize(const void* const AttributeDa
{
/* Fetch the size of the Data Element structure from the header */
uint8_t SizeIndex = (pgm_read_byte(AttributeData) & 0x07);
-
+
uint32_t ElementValueSize;
/* Convert the Data Element size index into a size in bytes */
@@ -686,7 +686,7 @@ 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);
+ uint8_t SizeIndex = (SDP_ReadData8(DataElementHeader) & 0x07);
uint32_t ElementValueSize;
@@ -710,6 +710,7 @@ static uint32_t SDP_GetDataElementSize(const void** const DataElementHeader,
ElementValueSize = (1 << SizeIndex);
break;
}
-
+
return ElementValueSize;
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h b/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h
index 2df8c225d..733889a4d 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,11 +48,11 @@
#include "BluetoothStack.h"
#include "SDPServices.h"
-
+
/* 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 0
-
+
#define SDP_PDU_ERRORRESPONSE 0x01
#define SDP_PDU_SERVICESEARCHREQUEST 0x02
#define SDP_PDU_SERVICESEARCHRESPONSE 0x03
@@ -103,7 +103,7 @@
uint16_t TransactionID; /**< Unique transaction ID number to associate requests and responses */
uint16_t ParameterLength; /**< Length of the data following the SDP header */
} SDP_PDUHeader_t;
-
+
/* Inline Functions: */
/** Writes 8 bits of raw data to the given buffer, incrementing the buffer position afterwards.
*
@@ -116,7 +116,7 @@
*((uint8_t*)*BufferPos) = Data;
*BufferPos += sizeof(uint8_t);
}
-
+
/** Writes 16 bits of raw data to the given buffer, incrementing the buffer position afterwards.
*
* \param[in, out] BufferPos Current position in the buffer where the data is to be written to
@@ -127,7 +127,7 @@
{
*((uint16_t*)*BufferPos) = SwapEndian_16(Data);
*BufferPos += sizeof(uint16_t);
- }
+ }
/** Writes 32 bits of raw data to the given buffer, incrementing the buffer position afterwards.
*
@@ -151,7 +151,7 @@
{
uint8_t Data = *((const uint8_t*)*BufferPos);
*BufferPos += sizeof(uint8_t);
-
+
return Data;
}
@@ -165,7 +165,7 @@
{
uint16_t Data = SwapEndian_16(*((const uint16_t*)*BufferPos));
*BufferPos += sizeof(uint16_t);
-
+
return Data;
}
@@ -179,13 +179,13 @@
{
uint32_t Data = SwapEndian_32(*((const uint32_t*)*BufferPos));
*BufferPos += sizeof(uint32_t);
-
+
return Data;
}
- /** Adds a new Data Element Sequence container with a 16-bit size header to the buffer. The buffer
+ /** 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
+ * 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
@@ -199,12 +199,12 @@
{
SDP_WriteData8(BufferPos, (SDP_DATASIZE_Variable16Bit | SDP_DATATYPE_Sequence));
- uint16_t* SizePos = *BufferPos;
+ uint16_t* SizePos = *BufferPos;
SDP_WriteData16(BufferPos, 0);
return SizePos;
}
-
+
/* Function Prototypes: */
void SDP_ProcessPacket(void* Data,
Bluetooth_Channel_t* const Channel);
@@ -247,3 +247,4 @@
#endif
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c
index 93f5519fe..9f7855e63 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -181,3 +181,4 @@ const ServiceAttributeTable_t PROGMEM SerialPort_Attribute_Table[] =
SERVICE_ATTRIBUTE_TABLE_TERMINATOR
};
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h
index afa8e0024..3ec95c4d1 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -35,22 +35,22 @@
#ifndef _SDPSERVICES_H_
#define _SDPSERVICES_H_
-
+
/* Includes: */
#include "SDP.h"
/* Macros: */
/** Size of a full 128 bit UUID, in bytes. */
#define UUID_SIZE_BYTES 16
-
+
/** First 80 bits common to all standardized Bluetooth services. */
#define BASE_80BIT_UUID 0x0000, 0x0010, 0x0080, {0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB}
-
+
#define RFCOMM_UUID {SWAPENDIAN_32(0x00000003), BASE_80BIT_UUID}
#define L2CAP_UUID {SWAPENDIAN_32(0x00000100), BASE_80BIT_UUID}
#define SP_CLASS_UUID {SWAPENDIAN_32(0x00001101), BASE_80BIT_UUID}
#define PUBLICBROWSEGROUP_CLASS_UUID {SWAPENDIAN_32(0x00001002), BASE_80BIT_UUID}
-
+
#define SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE 0x0000
#define SDP_ATTRIBUTE_ID_SERVICECLASSIDS 0x0001
#define SDP_ATTRIBUTE_ID_PROTOCOLDESCRIPTORLIST 0x0004
@@ -58,10 +58,10 @@
#define SDP_ATTRIBUTE_ID_LANGUAGEBASEATTROFFSET 0x0006
#define SDP_ATTRIBUTE_ID_SERVICENAME 0x0100
#define SDP_ATTRIBUTE_ID_SERVICEDESCRIPTION 0x0101
-
+
/** Terminator for a service attribute table of type \ref ServiceAttributeTable_t. */
#define SERVICE_ATTRIBUTE_TABLE_TERMINATOR {.Data = NULL}
-
+
/* Type Defines: */
/** Type define for a UUID value structure. This struct can be used to hold full 128-bit UUIDs. */
typedef struct
@@ -72,7 +72,7 @@
uint16_t D; /**< Bits 64-79 of the UUID. */
uint8_t E[6]; /**< Bits 80-128 of the UUID. */
} UUID_t;
-
+
/** Structure for the association of attribute ID values to an attribute value in FLASH. A table of these
* structures can then be built up for each supported UUID service within the device.
*
@@ -111,7 +111,7 @@
uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit) */
UUID_t UUID; /**< UUID to store in the list Data Element */
} ItemUUID_t;
-
+
/** Structure for a list of Data Elements Sequences containing UUID Data Elements, for service attributes requiring
* protocol lists.
*/
@@ -119,7 +119,7 @@
{
uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
uint8_t Size; /**< Size of the inner Data Element sequence */
-
+
struct
{
ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */
@@ -133,14 +133,14 @@
{
uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
uint8_t Size; /**< Size of the inner Data Element sequence */
-
+
struct
{
ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */
Item8Bit_t Param; /**< 8-Bit Parameter associated with the service */
} Protocol;
} ItemProtocol_8BitParam_t;
-
+
/** Structure for a list of Data Elements Sequences containing UUID Data Elements and an 16-bit param value, for service
* attributes requiring extended protocol lists containing an 16-bit value.
*/
@@ -148,7 +148,7 @@
{
uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
uint8_t Size; /**< Size of the inner Data Element sequence */
-
+
struct
{
ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */
@@ -165,9 +165,10 @@
Item16Bit_t EncodingID; /**< Encoding used for the current language */
Item16Bit_t OffsetID; /**< Attribute offset added to all strings using this language within the service */
} ItemLangEncoding_t;
-
+
/* External Variables: */
extern const ServiceAttributeTable_t SerialPort_Attribute_Table[];
extern const ServiceAttributeTable_t PnP_Attribute_Table[];
-
+
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/makefile b/Demos/Host/Incomplete/BluetoothHost/makefile
index 21f7d5a57..c8fd05907 100644
--- a/Demos/Host/Incomplete/BluetoothHost/makefile
+++ b/Demos/Host/Incomplete/BluetoothHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -143,7 +143,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -156,7 +156,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -270,7 +270,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -283,7 +283,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -295,7 +295,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -307,7 +307,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -330,7 +330,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -364,7 +364,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -398,7 +398,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -427,7 +427,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -446,10 +446,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -514,11 +514,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -545,9 +545,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -645,14 +645,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -674,7 +674,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -718,3 +718,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+