diff options
Diffstat (limited to 'Demos/Host/Incomplete/BluetoothHost/Lib')
6 files changed, 111 insertions, 13 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h index 4b16a8f48..fb25ec77d 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h @@ -95,12 +95,12 @@ */ typedef struct { - uint8_t State; - uint16_t LocalNumber; - uint16_t RemoteNumber; - uint16_t PSM; - uint16_t LocalMTU; - uint16_t RemoteMTU; + uint8_t State; /**< Current channel state, a value from the \ref BT_ChannelStates_t enum. */ + uint16_t LocalNumber; /**< Local channel number on the device. */ + uint16_t RemoteNumber; /**< Remote channel number on the connected device. */ + uint16_t PSM; /**< Protocol used on the channel. */ + uint16_t LocalMTU; /**< MTU of data sent from the connected device to the local device. */ + uint16_t RemoteMTU; /**< MTU of data sent from the local device to the connected device. */ } Bluetooth_Channel_t; /** Type define for a Bluetooth device connection information structure. This structure contains all the diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c new file mode 100644 index 000000000..052bf3fdb --- /dev/null +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c @@ -0,0 +1,36 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#include "RFCOMM.h"
+
+void RFCOMM_ProcessPacket(void* Data, Bluetooth_Channel_t* const Channel)
+{
+ BT_RFCOMM_DEBUG(1, "PACKET RECEIVED");
+}
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h new file mode 100644 index 000000000..7f1b6269a --- /dev/null +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h @@ -0,0 +1,57 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * Header file for RFCOMM.c.
+ */
+
+#ifndef _RFCOMM_H_
+#define _RFCOMM_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <string.h>
+ #include <stdbool.h>
+ #include <stdio.h>
+
+ #include <LUFA/Common/Common.h>
+ #include <LUFA/Drivers/Peripheral/SerialStream.h>
+
+ #include "BluetoothStack.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 2
+
+ /* Function Prototypes: */
+ void RFCOMM_ProcessPacket(void* Data, Bluetooth_Channel_t* const Channel);
+
+#endif
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c index 908be0c6d..d812252b1 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c @@ -113,7 +113,7 @@ const struct {(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(0x0100)},
}
}
- };
+ };
const struct
{
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c index df0db3bed..0ee0784c5 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c @@ -119,11 +119,10 @@ static void SDP_ProcessServiceSearch(const SDP_PDUHeader_t* const SDPHeader, Blu /* Copy over the service record handle to the response list */ uint8_t AttrHeaderSize; - SDP_GetLocalAttributeContainerSize(AttributeValue, &AttrHeaderSize); - memcpy_P(CurrResponsePos, AttributeValue + AttrHeaderSize, sizeof(uint32_t)); - CurrResponsePos += AttrHeaderSize + sizeof(uint32_t); + uint8_t AttrSize = SDP_GetLocalAttributeContainerSize(AttributeValue, &AttrHeaderSize); + memcpy_P(CurrResponsePos, AttributeValue + AttrHeaderSize, AttrSize); + CurrResponsePos += AttrHeaderSize + AttrSize; - /* Increment the total number of service records added to the list */ AddedServiceHandles++; } @@ -172,7 +171,7 @@ static void SDP_ProcessServiceAttribute(const SDP_PDUHeader_t* const SDPHeader, BT_SDP_DEBUG(2, "-- Max Return Attribute Bytes: 0x%04X", MaxAttributeSize); /* Retrieve the list of Attributes from the request */ - uint16_t AttributeList[15][2]; + uint16_t AttributeList[8][2]; uint8_t TotalAttributes = SDP_GetAttributeList(AttributeList, &CurrentParameter); BT_SDP_DEBUG(2, "-- Total Attributes: %d", TotalAttributes); @@ -263,7 +262,7 @@ static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHe BT_SDP_DEBUG(2, "-- Max Return Attribute Bytes: 0x%04X", MaxAttributeSize); /* Retrieve the list of Attributes from the request */ - uint16_t AttributeList[15][2]; + uint16_t AttributeList[8][2]; uint8_t TotalAttributes = SDP_GetAttributeList(AttributeList, &CurrentParameter); BT_SDP_DEBUG(2, "-- Total Attributes: %d", TotalAttributes); diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h index e46729cd9..dd5182c34 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h @@ -60,6 +60,12 @@ #define SDP_PDU_SERVICESEARCHATTRIBUTEREQUEST 0x06 #define SDP_PDU_SERVICESEARCHATTRIBUTERESPONSE 0x07 + /** Convenience macro - read a pointer out of PROGMEM space. + * + * \param[in] x Address of the pointer to read + * + * \return Pointer retrieved from PROGMEM space + */ #define pgm_read_ptr(x) (void*)pgm_read_word(x) /* Enums: */ |