aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-04-22 14:08:00 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-04-22 14:08:00 +0000
commit5993e1efe789418e3773d37aae119f48093a3439 (patch)
tree347f581dc48d44e74970c7627d6dfc60810866b4 /Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
parent8252b4febd928718c4b416d7be262afa6a39075f (diff)
downloadlufa-5993e1efe789418e3773d37aae119f48093a3439.tar.gz
lufa-5993e1efe789418e3773d37aae119f48093a3439.tar.bz2
lufa-5993e1efe789418e3773d37aae119f48093a3439.zip
Added ability to search by Channel PSM to the GetChannelData() function in the BluetoothHost demo.
Added new HCI states to properly initialize the bluetooth dongle and retrieve the local BDADDR. Factored out Bluetooth state information into a new state structure for easy reference in the user application. Added new StackInitialized() Bluetooth stack callback function.
Diffstat (limited to 'Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h')
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
index a97ac089a..aebdd96e2 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
@@ -51,6 +51,10 @@
#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: */
@@ -115,6 +119,20 @@
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.
+ */
+ typedef struct
+ {
+ uint8_t CurrentHCIState; /**< Current HCI state machine state. */
+ uint8_t NextHCIState; /**< Next HCI state machine state to progress to once the currently issued command completes. */
+ bool IsInitialized; /**< Indicates if the Bluetooth stack is currently initialized and ready for connections
+ * to or from a remote Bluetooth device.
+ */
+ uint8_t LocalBDADDR[6]; /**< Local bluetooth adapter's BDADDR, valid when the stack is fully initialized. */
+ } Bluetooth_Stack_State_t;
/* Includes: */
#include "BluetoothHCICommands.h"
@@ -124,18 +142,20 @@
void Bluetooth_Stack_Init(void);
void Bluetooth_Stack_USBTask(void);
+ void Bluetooth_StackInitialized(void);
bool Bluetooth_ConnectionRequest(const uint8_t* RemoteAddress);
void Bluetooth_ConnectionComplete(void);
void Bluetooth_DisconnectionComplete(void);
bool Bluetooth_ChannelConnectionRequest(const uint16_t PSM);
void Bluetooth_PacketReceived(void* Data, uint16_t DataLen, Bluetooth_Channel_t* const Channel);
- Bluetooth_Channel_t* Bluetooth_GetChannelData(const uint16_t ChannelNumber, const bool SearchByRemoteChannel);
+ Bluetooth_Channel_t* Bluetooth_GetChannelData(const uint16_t SearchValue, const uint8_t SearchKey);
Bluetooth_Channel_t* Bluetooth_OpenChannel(const uint16_t PSM);
void Bluetooth_CloseChannel(Bluetooth_Channel_t* const Channel);
uint8_t Bluetooth_SendPacket(void* Data, uint16_t DataLen, Bluetooth_Channel_t* const Channel);
/* External Variables: */
- extern Bluetooth_Device_t Bluetooth_DeviceConfiguration;
- extern Bluetooth_Connection_t Bluetooth_Connection;
+ extern Bluetooth_Device_t Bluetooth_DeviceConfiguration;
+ extern Bluetooth_Connection_t Bluetooth_Connection;
+ extern Bluetooth_Stack_State_t Bluetooth_State;
#endif