Commit 2a072db7 authored by Dean Camera's avatar Dean Camera
Browse files

Make Bluetooth signalling handler routines use the generic...

Make Bluetooth signalling handler routines use the generic Bluetooth_SendPacket() routine for their responses. Use a better method of controlling the debug output verbosity.
parent c77f1366
......@@ -41,8 +41,8 @@
#include "BluetoothStack.h"
/* Macros: */
#define BT_ACL_DEBUG(s, ...) printf_P(PSTR("(ACL) " s "\r\n"), __VA_ARGS__)
#define ACL_DEBUG_LEVEL 1
#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 2
#define BT_CHANNEL_SIGNALING 0x0001
#define BT_CHANNEL_CONNECTIONLESS 0x0002
......@@ -71,6 +71,8 @@
#define BT_CONFIGURATION_REJECTED 0x0002
#define BT_CONFIGURATION_UNKNOWNOPTIONS 0x0003
#define BT_CONFIG_OPTION_MTU 1
/* Type Defines: */
typedef struct
{
......@@ -140,10 +142,15 @@
uint16_t InfoType;
uint16_t Result;
} BT_Signal_InformationResp_t;
typedef struct
{
uint8_t Type;
uint16_t Length;
} BT_Config_Option_Header_t;
/* Function Prototypes: */
void Bluetooth_ACLTask(void);
uint8_t Bluetooth_SendPacket(uint8_t* Data, uint16_t DataLen, Bluetooth_Channel_t* Channel);
#if defined(INCLUDE_FROM_BLUETOOTH_ACLPACKETS_C)
static void Bluetooth_ProcessACLPackets(void);
......
......@@ -80,6 +80,7 @@ Bluetooth_Channel_t* Bluetooth_InitChannelData(uint16_t RemoteChannelNumber, uin
ChannelData->RemoteNumber = RemoteChannelNumber;
ChannelData->LocalNumber = (BLUETOOTH_CHANNELNUMBER_BASEOFFSET + i);
ChannelData->PSM = PSM;
ChannelData->LocalMTU = MAXIMUM_CHANNEL_MTU;
ChannelData->State = Channel_Config_WaitConfig;
return ChannelData;
......
......@@ -47,6 +47,8 @@
#define CHANNEL_PSM_SERVICEDISCOVERY 0x0001
#define CHANNEL_PSM_RFCOMM 0x0003
#define MAXIMUM_CHANNEL_MTU 255
/* Enums: */
enum BT_ChannelStates_t
{
......@@ -76,6 +78,7 @@
uint16_t LocalNumber;
uint16_t RemoteNumber;
uint16_t PSM;
uint16_t LocalMTU;
uint16_t RemoteMTU;
} Bluetooth_Channel_t;
......@@ -106,10 +109,11 @@
void Bluetooth_Stack_Init(void);
void Bluetooth_Stack_USBTask(void);
bool Bluetooth_ConnectionRequest(uint8_t* RemoteAddress);
void Bluetooth_ConnectionComplete(void);
void Bluetooth_DisconnectionComplete(void);
void Bluetooth_PacketReceived(uint16_t* PacketLength, Bluetooth_Channel_t* Channel);
bool Bluetooth_ConnectionRequest(uint8_t* RemoteAddress);
void Bluetooth_ConnectionComplete(void);
void Bluetooth_DisconnectionComplete(void);
void Bluetooth_PacketReceived(uint16_t* PacketLength, Bluetooth_Channel_t* Channel);
uint8_t Bluetooth_SendPacket(void* Data, uint16_t DataLen, Bluetooth_Channel_t* Channel);
/* External Variables: */
extern Bluetooth_Device_t Bluetooth_DeviceConfiguration;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment