forked from mfulz_github/qmk_firmware
Make Bluetooth signalling handler routines use the generic Bluetooth_SendPacket() routine for their responses. Use a better method of controlling the debug output verbosity.
This commit is contained in:
parent
c77f136661
commit
2a072db703
|
@ -56,45 +56,32 @@ void Bluetooth_ACLTask(void)
|
||||||
|
|
||||||
if (MustSendConfigReq)
|
if (MustSendConfigReq)
|
||||||
{
|
{
|
||||||
BT_ACL_Header_t ACLPacketHeader;
|
struct
|
||||||
BT_DataPacket_Header_t DataHeader;
|
{
|
||||||
BT_Signal_Header_t SignalCommandHeader;
|
BT_Signal_Header_t SignalCommandHeader;
|
||||||
BT_Signal_ConfigurationReq_t ConfigurationRequest;
|
BT_Signal_ConfigurationReq_t ConfigurationRequest;
|
||||||
|
|
||||||
ACLPacketHeader.ConnectionHandle = Bluetooth_Connection.ConnectionHandle;
|
struct
|
||||||
ACLPacketHeader.DataLength = sizeof(DataHeader) + sizeof(SignalCommandHeader) + sizeof(ConfigurationRequest);
|
{
|
||||||
DataHeader.PayloadLength = sizeof(SignalCommandHeader) + sizeof(ConfigurationRequest);
|
BT_Config_Option_Header_t Header;
|
||||||
DataHeader.DestinationChannel = BT_CHANNEL_SIGNALING;
|
uint16_t Value;
|
||||||
SignalCommandHeader.Code = BT_SIGNAL_CONFIGURATION_REQUEST;
|
} Option_LocalMTU;
|
||||||
SignalCommandHeader.Identifier = ++Bluetooth_Connection.SignallingIdentifier;
|
} PacketData;
|
||||||
SignalCommandHeader.Length = sizeof(ConfigurationRequest);
|
|
||||||
|
|
||||||
ConfigurationRequest.DestinationChannel = ChannelData->RemoteNumber;
|
PacketData.SignalCommandHeader.Code = BT_SIGNAL_CONFIGURATION_REQUEST;
|
||||||
ConfigurationRequest.Flags = 0;
|
PacketData.SignalCommandHeader.Identifier = ++Bluetooth_Connection.SignallingIdentifier;
|
||||||
|
PacketData.SignalCommandHeader.Length = sizeof(PacketData.ConfigurationRequest) +
|
||||||
|
sizeof(PacketData.Option_LocalMTU);
|
||||||
|
PacketData.ConfigurationRequest.DestinationChannel = ChannelData->RemoteNumber;
|
||||||
|
PacketData.ConfigurationRequest.Flags = 0;
|
||||||
|
PacketData.Option_LocalMTU.Header.Type = BT_CONFIG_OPTION_MTU;
|
||||||
|
PacketData.Option_LocalMTU.Header.Length = sizeof(PacketData.Option_LocalMTU.Value);
|
||||||
|
PacketData.Option_LocalMTU.Value = ChannelData->LocalMTU;
|
||||||
|
|
||||||
Pipe_SelectPipe(BLUETOOTH_DATA_OUT_PIPE);
|
Bluetooth_SendPacket(&PacketData, sizeof(PacketData), NULL);
|
||||||
Pipe_Unfreeze();
|
|
||||||
|
|
||||||
Pipe_Write_Stream_LE(&ACLPacketHeader, sizeof(ACLPacketHeader));
|
BT_ACL_DEBUG(1, ">> L2CAP Configuration Request", NULL);
|
||||||
Pipe_Write_Stream_LE(&DataHeader, sizeof(DataHeader));
|
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", PacketData.ConfigurationRequest.DestinationChannel);
|
||||||
Pipe_Write_Stream_LE(&SignalCommandHeader, sizeof(SignalCommandHeader));
|
|
||||||
Pipe_Write_Stream_LE(&ConfigurationRequest, sizeof(ConfigurationRequest));
|
|
||||||
|
|
||||||
Pipe_Freeze();
|
|
||||||
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
|
||||||
BT_ACL_DEBUG("Packet Sent", NULL);
|
|
||||||
BT_ACL_DEBUG("-- Connection Handle: 0x%04X", (ACLPacketHeader.ConnectionHandle & 0x0FFF));
|
|
||||||
BT_ACL_DEBUG("-- Data Length: 0x%04X", ACLPacketHeader.DataLength);
|
|
||||||
BT_ACL_DEBUG("-- Destination Channel: 0x%04X", DataHeader.DestinationChannel);
|
|
||||||
BT_ACL_DEBUG("-- Payload Length: 0x%04X", DataHeader.PayloadLength);
|
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 0)
|
|
||||||
BT_ACL_DEBUG(">> L2CAP Configuration Request", NULL);
|
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
|
||||||
BT_ACL_DEBUG("-- Destination Channel: 0x%04X", ConfigurationRequest.DestinationChannel);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,13 +103,12 @@ static void Bluetooth_ProcessACLPackets(void)
|
||||||
Pipe_Read_Stream_LE(&ACLPacketHeader, sizeof(ACLPacketHeader));
|
Pipe_Read_Stream_LE(&ACLPacketHeader, sizeof(ACLPacketHeader));
|
||||||
Pipe_Read_Stream_LE(&DataHeader, sizeof(DataHeader));
|
Pipe_Read_Stream_LE(&DataHeader, sizeof(DataHeader));
|
||||||
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
BT_ACL_DEBUG(2, "", NULL);
|
||||||
BT_ACL_DEBUG("Packet Received", NULL);
|
BT_ACL_DEBUG(2, "Packet Received", NULL);
|
||||||
BT_ACL_DEBUG("-- Connection Handle: 0x%04X", (ACLPacketHeader.ConnectionHandle & 0x0FFF));
|
BT_ACL_DEBUG(2, "-- Connection Handle: 0x%04X", (ACLPacketHeader.ConnectionHandle & 0x0FFF));
|
||||||
BT_ACL_DEBUG("-- Data Length: 0x%04X", ACLPacketHeader.DataLength);
|
BT_ACL_DEBUG(2, "-- Data Length: 0x%04X", ACLPacketHeader.DataLength);
|
||||||
BT_ACL_DEBUG("-- Destination Channel: 0x%04X", DataHeader.DestinationChannel);
|
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", DataHeader.DestinationChannel);
|
||||||
BT_ACL_DEBUG("-- Payload Length: 0x%04X", DataHeader.PayloadLength);
|
BT_ACL_DEBUG(2, "-- Payload Length: 0x%04X", DataHeader.PayloadLength);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (DataHeader.DestinationChannel == BT_CHANNEL_SIGNALING)
|
if (DataHeader.DestinationChannel == BT_CHANNEL_SIGNALING)
|
||||||
{
|
{
|
||||||
|
@ -147,9 +133,7 @@ static void Bluetooth_ProcessACLPackets(void)
|
||||||
Bluetooth_Signal_InformationReq(&ACLPacketHeader, &DataHeader, &SignalCommandHeader);
|
Bluetooth_Signal_InformationReq(&ACLPacketHeader, &DataHeader, &SignalCommandHeader);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#if (ACL_DEBUG_LEVEL > 0)
|
BT_ACL_DEBUG(1, "<< Unknown Signaling Command 0x%02X", SignalCommandHeader.Code);
|
||||||
BT_ACL_DEBUG("<< Unknown Signaling Command 0x%02X", SignalCommandHeader.Code);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Pipe_Discard_Stream(ACLPacketHeader.DataLength);
|
Pipe_Discard_Stream(ACLPacketHeader.DataLength);
|
||||||
Pipe_ClearIN();
|
Pipe_ClearIN();
|
||||||
|
@ -168,21 +152,23 @@ static void Bluetooth_ProcessACLPackets(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Bluetooth_SendPacket(uint8_t* Data, uint16_t DataLen, Bluetooth_Channel_t* Channel)
|
uint8_t Bluetooth_SendPacket(void* Data, uint16_t DataLen, Bluetooth_Channel_t* Channel)
|
||||||
{
|
{
|
||||||
BT_ACL_Header_t ACLPacketHeader;
|
BT_ACL_Header_t ACLPacketHeader;
|
||||||
BT_DataPacket_Header_t DataHeader;
|
BT_DataPacket_Header_t DataHeader;
|
||||||
|
|
||||||
if (Bluetooth_Connection.IsConnected)
|
if (!(Bluetooth_Connection.IsConnected))
|
||||||
return BT_SENDPACKET_NotConnected;
|
return BT_SENDPACKET_NotConnected;
|
||||||
|
|
||||||
if (Channel->State != Channel_Open)
|
if ((Channel != NULL) && (Channel->State != Channel_Open))
|
||||||
return BT_SENDPACKET_ChannelNotOpen;
|
return BT_SENDPACKET_ChannelNotOpen;
|
||||||
|
|
||||||
ACLPacketHeader.ConnectionHandle = Bluetooth_Connection.ConnectionHandle;
|
// TODO: Add packet fragmentation here after retrieving the device's signal channel MTU
|
||||||
|
|
||||||
|
ACLPacketHeader.ConnectionHandle = Bluetooth_Connection.ConnectionHandle | (1 << 13);
|
||||||
ACLPacketHeader.DataLength = sizeof(DataHeader) + DataLen;
|
ACLPacketHeader.DataLength = sizeof(DataHeader) + DataLen;
|
||||||
DataHeader.DestinationChannel = Channel->RemoteNumber;
|
|
||||||
DataHeader.PayloadLength = DataLen;
|
DataHeader.PayloadLength = DataLen;
|
||||||
|
DataHeader.DestinationChannel = (Channel == NULL) ? BT_CHANNEL_SIGNALING : Channel->RemoteNumber;
|
||||||
|
|
||||||
Pipe_SelectPipe(BLUETOOTH_DATA_OUT_PIPE);
|
Pipe_SelectPipe(BLUETOOTH_DATA_OUT_PIPE);
|
||||||
Pipe_Unfreeze();
|
Pipe_Unfreeze();
|
||||||
|
@ -190,9 +176,16 @@ uint8_t Bluetooth_SendPacket(uint8_t* Data, uint16_t DataLen, Bluetooth_Channel_
|
||||||
Pipe_Write_Stream_LE(&ACLPacketHeader, sizeof(ACLPacketHeader));
|
Pipe_Write_Stream_LE(&ACLPacketHeader, sizeof(ACLPacketHeader));
|
||||||
Pipe_Write_Stream_LE(&DataHeader, sizeof(DataHeader));
|
Pipe_Write_Stream_LE(&DataHeader, sizeof(DataHeader));
|
||||||
Pipe_Write_Stream_LE(Data, DataLen);
|
Pipe_Write_Stream_LE(Data, DataLen);
|
||||||
|
|
||||||
Pipe_Freeze();
|
Pipe_Freeze();
|
||||||
|
|
||||||
|
BT_ACL_DEBUG(2, "", NULL);
|
||||||
|
BT_ACL_DEBUG(2, "Packet Sent", NULL);
|
||||||
|
BT_ACL_DEBUG(2, "-- Connection Handle: 0x%04X", (ACLPacketHeader.ConnectionHandle & 0x0FFF));
|
||||||
|
BT_ACL_DEBUG(2, "-- Data Length: 0x%04X", ACLPacketHeader.DataLength);
|
||||||
|
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", DataHeader.DestinationChannel);
|
||||||
|
BT_ACL_DEBUG(2, "-- Payload Length: 0x%04X", DataHeader.PayloadLength);
|
||||||
|
|
||||||
return BT_SENDPACKET_NoError;
|
return BT_SENDPACKET_NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,56 +197,35 @@ static inline void Bluetooth_Signal_ConnectionReq(BT_ACL_Header_t* ACLPacketHead
|
||||||
|
|
||||||
Pipe_Read_Stream_LE(&ConnectionRequest, sizeof(ConnectionRequest));
|
Pipe_Read_Stream_LE(&ConnectionRequest, sizeof(ConnectionRequest));
|
||||||
|
|
||||||
#if (ACL_DEBUG_LEVEL > 0)
|
|
||||||
BT_ACL_DEBUG("<< L2CAP Connection Request", NULL);
|
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
|
||||||
BT_ACL_DEBUG("-- PSM: 0x%04X", ConnectionRequest.PSM);
|
|
||||||
BT_ACL_DEBUG("-- Source Channel: 0x%04X", ConnectionRequest.SourceChannel);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Pipe_ClearIN();
|
Pipe_ClearIN();
|
||||||
Pipe_Freeze();
|
Pipe_Freeze();
|
||||||
Pipe_SelectPipe(BLUETOOTH_DATA_OUT_PIPE);
|
|
||||||
Pipe_Unfreeze();
|
|
||||||
|
|
||||||
BT_Signal_ConnectionResp_t ConnectionResponse;
|
|
||||||
|
|
||||||
ACLPacketHeader->DataLength = sizeof(*DataHeader) + sizeof(*SignalCommandHeader) + sizeof(ConnectionResponse);
|
BT_ACL_DEBUG(1, "<< L2CAP Connection Request", NULL);
|
||||||
DataHeader->PayloadLength = sizeof(*SignalCommandHeader) + sizeof(ConnectionResponse);
|
BT_ACL_DEBUG(2, "-- PSM: 0x%04X", ConnectionRequest.PSM);
|
||||||
DataHeader->DestinationChannel = BT_CHANNEL_SIGNALING;
|
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConnectionRequest.SourceChannel);
|
||||||
SignalCommandHeader->Code = BT_SIGNAL_CONNECTION_RESPONSE;
|
|
||||||
SignalCommandHeader->Length = sizeof(ConnectionResponse);
|
|
||||||
|
|
||||||
Bluetooth_Channel_t* ChannelData = Bluetooth_InitChannelData(ConnectionRequest.SourceChannel, ConnectionRequest.PSM);
|
Bluetooth_Channel_t* ChannelData = Bluetooth_InitChannelData(ConnectionRequest.SourceChannel, ConnectionRequest.PSM);
|
||||||
|
|
||||||
ConnectionResponse.Result = (ChannelData == NULL) ? BT_CONNECTION_REFUSED_RESOURCES : BT_CONNECTION_SUCCESSFUL;
|
|
||||||
ConnectionResponse.DestinationChannel = ChannelData->LocalNumber;
|
|
||||||
ConnectionResponse.SourceChannel = ChannelData->RemoteNumber;
|
|
||||||
ConnectionResponse.Status = 0x00;
|
|
||||||
|
|
||||||
Pipe_Write_Stream_LE(ACLPacketHeader, sizeof(*ACLPacketHeader));
|
struct
|
||||||
Pipe_Write_Stream_LE(DataHeader, sizeof(*DataHeader));
|
{
|
||||||
Pipe_Write_Stream_LE(SignalCommandHeader, sizeof(*SignalCommandHeader));
|
BT_Signal_Header_t SignalCommandHeader;
|
||||||
Pipe_Write_Stream_LE(&ConnectionResponse, sizeof(ConnectionResponse));
|
BT_Signal_ConnectionResp_t ConnectionResponse;
|
||||||
|
} ResponsePacket;
|
||||||
|
|
||||||
|
ResponsePacket.SignalCommandHeader.Code = BT_SIGNAL_CONNECTION_RESPONSE;
|
||||||
|
ResponsePacket.SignalCommandHeader.Identifier = SignalCommandHeader->Identifier;
|
||||||
|
ResponsePacket.SignalCommandHeader.Length = sizeof(ResponsePacket.ConnectionResponse);
|
||||||
|
ResponsePacket.ConnectionResponse.Result = (ChannelData == NULL) ? BT_CONNECTION_REFUSED_RESOURCES : BT_CONNECTION_SUCCESSFUL;
|
||||||
|
ResponsePacket.ConnectionResponse.DestinationChannel = ChannelData->LocalNumber;
|
||||||
|
ResponsePacket.ConnectionResponse.SourceChannel = ChannelData->RemoteNumber;
|
||||||
|
ResponsePacket.ConnectionResponse.Status = 0x00;
|
||||||
|
|
||||||
Pipe_ClearOUT();
|
Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);
|
||||||
Pipe_Freeze();
|
|
||||||
|
BT_ACL_DEBUG(1, ">> L2CAP Connection Response", NULL);
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
BT_ACL_DEBUG(2, "-- Result: 0x%02X", ResponsePacket.ConnectionResponse.Result);
|
||||||
BT_ACL_DEBUG("Packet Sent", NULL);
|
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ResponsePacket.ConnectionResponse.SourceChannel);
|
||||||
BT_ACL_DEBUG("-- Connection Handle: 0x%04X", (ACLPacketHeader->ConnectionHandle & 0x0FFF));
|
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ResponsePacket.ConnectionResponse.DestinationChannel);
|
||||||
BT_ACL_DEBUG("-- Data Length: 0x%04X", ACLPacketHeader->DataLength);
|
|
||||||
BT_ACL_DEBUG("-- Destination Channel: 0x%04X", DataHeader->DestinationChannel);
|
|
||||||
BT_ACL_DEBUG("-- Payload Length: 0x%04X", DataHeader->PayloadLength);
|
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 0)
|
|
||||||
BT_ACL_DEBUG(">> L2CAP Connection Response", NULL);
|
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
|
||||||
BT_ACL_DEBUG("-- Source Channel: 0x%04X", ConnectionResponse.SourceChannel);
|
|
||||||
BT_ACL_DEBUG("-- Destination Channel: 0x%04X", ConnectionResponse.DestinationChannel);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void Bluetooth_Signal_ConfigurationReq(BT_ACL_Header_t* ACLPacketHeader,
|
static inline void Bluetooth_Signal_ConfigurationReq(BT_ACL_Header_t* ACLPacketHeader,
|
||||||
|
@ -261,32 +233,49 @@ static inline void Bluetooth_Signal_ConfigurationReq(BT_ACL_Header_t* ACLPacketH
|
||||||
BT_Signal_Header_t* SignalCommandHeader)
|
BT_Signal_Header_t* SignalCommandHeader)
|
||||||
{
|
{
|
||||||
BT_Signal_ConfigurationReq_t ConfigurationRequest;
|
BT_Signal_ConfigurationReq_t ConfigurationRequest;
|
||||||
Pipe_Read_Stream_LE(&ConfigurationRequest, sizeof(ConfigurationRequest));
|
uint8_t OptionsLen;
|
||||||
|
|
||||||
// TODO: Process/Discard configuration options here
|
|
||||||
Pipe_Discard_Stream(DataHeader->PayloadLength - sizeof(*SignalCommandHeader));
|
|
||||||
|
|
||||||
#if (ACL_DEBUG_LEVEL > 0)
|
Pipe_Read_Stream_LE(&ConfigurationRequest, sizeof(ConfigurationRequest));
|
||||||
BT_ACL_DEBUG("<< L2CAP Configuration Request", NULL);
|
OptionsLen = (DataHeader->PayloadLength - sizeof(*SignalCommandHeader));
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
|
||||||
BT_ACL_DEBUG("-- Destination Channel: 0x%04X", ConfigurationRequest.DestinationChannel);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConfigurationRequest.DestinationChannel, false);
|
||||||
|
|
||||||
|
while (OptionsLen)
|
||||||
|
{
|
||||||
|
BT_Config_Option_Header_t OptionHeader;
|
||||||
|
|
||||||
|
Pipe_Read_Stream_LE(&OptionHeader, sizeof(OptionHeader));
|
||||||
|
|
||||||
|
if ((OptionHeader.Type == BT_CONFIG_OPTION_MTU) && (ChannelData != NULL))
|
||||||
|
Pipe_Read_Stream_LE(&ChannelData->RemoteMTU, sizeof(ChannelData->RemoteMTU));
|
||||||
|
else
|
||||||
|
Pipe_Discard_Stream(OptionHeader.Length);
|
||||||
|
|
||||||
|
OptionsLen -= (sizeof(OptionHeader) + OptionHeader.Length);
|
||||||
|
}
|
||||||
|
|
||||||
Pipe_ClearIN();
|
Pipe_ClearIN();
|
||||||
Pipe_Freeze();
|
Pipe_Freeze();
|
||||||
Pipe_SelectPipe(BLUETOOTH_DATA_OUT_PIPE);
|
|
||||||
Pipe_Unfreeze();
|
|
||||||
|
|
||||||
BT_Signal_ConfigurationResp_t ConfigurationResponse;
|
|
||||||
|
|
||||||
ACLPacketHeader->DataLength = sizeof(*DataHeader) + sizeof(*SignalCommandHeader) + sizeof(ConfigurationResponse);
|
BT_ACL_DEBUG(1, "<< L2CAP Configuration Request", NULL);
|
||||||
DataHeader->PayloadLength = sizeof(*SignalCommandHeader) + sizeof(ConfigurationResponse);
|
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ConfigurationRequest.DestinationChannel);
|
||||||
DataHeader->DestinationChannel = BT_CHANNEL_SIGNALING;
|
BT_ACL_DEBUG(2, "-- Options Len: 0x%04X", ConfigurationRequest.DestinationChannel);
|
||||||
SignalCommandHeader->Code = BT_SIGNAL_CONFIGURATION_RESPONSE;
|
BT_ACL_DEBUG(2, "-- Remote MTU: 0x%04X", ChannelData->RemoteMTU);
|
||||||
SignalCommandHeader->Length = sizeof(ConfigurationResponse);
|
|
||||||
|
|
||||||
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConfigurationRequest.DestinationChannel, false);
|
struct
|
||||||
|
{
|
||||||
|
BT_Signal_Header_t SignalCommandHeader;
|
||||||
|
BT_Signal_ConfigurationResp_t ConfigurationResponse;
|
||||||
|
} ResponsePacket;
|
||||||
|
|
||||||
|
ResponsePacket.SignalCommandHeader.Code = BT_SIGNAL_CONFIGURATION_RESPONSE;
|
||||||
|
ResponsePacket.SignalCommandHeader.Identifier = SignalCommandHeader->Identifier;
|
||||||
|
ResponsePacket.SignalCommandHeader.Length = sizeof(ResponsePacket.ConfigurationResponse);
|
||||||
|
ResponsePacket.ConfigurationResponse.SourceChannel = ChannelData->RemoteNumber;
|
||||||
|
ResponsePacket.ConfigurationResponse.Flags = 0x00;
|
||||||
|
ResponsePacket.ConfigurationResponse.Result = (ChannelData != NULL) ? BT_CONFIGURATION_SUCCESSFUL : BT_CONFIGURATION_REJECTED;
|
||||||
|
|
||||||
|
Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);
|
||||||
|
|
||||||
if (ChannelData != NULL)
|
if (ChannelData != NULL)
|
||||||
{
|
{
|
||||||
|
@ -303,34 +292,10 @@ static inline void Bluetooth_Signal_ConfigurationReq(BT_ACL_Header_t* ACLPacketH
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add channel config data to the tail of ConfigurationResponse
|
|
||||||
|
|
||||||
ConfigurationResponse.SourceChannel = ChannelData->RemoteNumber;
|
BT_ACL_DEBUG(1, ">> L2CAP Configuration Response", NULL);
|
||||||
ConfigurationResponse.Flags = 0x00;
|
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ResponsePacket.ConfigurationResponse.SourceChannel);
|
||||||
ConfigurationResponse.Result = (ChannelData != NULL) ? BT_CONFIGURATION_SUCCESSFUL : BT_CONFIGURATION_REJECTED;
|
BT_ACL_DEBUG(2, "-- Result: 0x%02X", ResponsePacket.ConfigurationResponse.Result);
|
||||||
|
|
||||||
Pipe_Write_Stream_LE(ACLPacketHeader, sizeof(*ACLPacketHeader));
|
|
||||||
Pipe_Write_Stream_LE(DataHeader, sizeof(*DataHeader));
|
|
||||||
Pipe_Write_Stream_LE(SignalCommandHeader, sizeof(*SignalCommandHeader));
|
|
||||||
Pipe_Write_Stream_LE(&ConfigurationResponse, sizeof(ConfigurationResponse));
|
|
||||||
|
|
||||||
Pipe_ClearOUT();
|
|
||||||
Pipe_Freeze();
|
|
||||||
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
|
||||||
BT_ACL_DEBUG("Packet Sent", NULL);
|
|
||||||
BT_ACL_DEBUG("-- Connection Handle: 0x%04X", (ACLPacketHeader->ConnectionHandle & 0x0FFF));
|
|
||||||
BT_ACL_DEBUG("-- Data Length: 0x%04X", ACLPacketHeader->DataLength);
|
|
||||||
BT_ACL_DEBUG("-- Destination Channel: 0x%04X", DataHeader->DestinationChannel);
|
|
||||||
BT_ACL_DEBUG("-- Payload Length: 0x%04X", DataHeader->PayloadLength);
|
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 0)
|
|
||||||
BT_ACL_DEBUG(">> L2CAP Configuration Response", NULL);
|
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
|
||||||
BT_ACL_DEBUG("-- Result: 0x%02X", ConfigurationResponse.Result);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void Bluetooth_Signal_DisconnectionReq(BT_ACL_Header_t* ACLPacketHeader,
|
static inline void Bluetooth_Signal_DisconnectionReq(BT_ACL_Header_t* ACLPacketHeader,
|
||||||
|
@ -341,95 +306,58 @@ static inline void Bluetooth_Signal_DisconnectionReq(BT_ACL_Header_t* ACLPacketH
|
||||||
|
|
||||||
Pipe_Read_Stream_LE(&DisconnectionRequest, sizeof(DisconnectionRequest));
|
Pipe_Read_Stream_LE(&DisconnectionRequest, sizeof(DisconnectionRequest));
|
||||||
|
|
||||||
#if (ACL_DEBUG_LEVEL > 0)
|
BT_ACL_DEBUG(1, "<< L2CAP Disconnection Request", NULL);
|
||||||
BT_ACL_DEBUG("<< L2CAP Disconnection Request", NULL);
|
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", DisconnectionRequest.DestinationChannel);
|
||||||
#endif
|
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", DisconnectionRequest.SourceChannel);
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
|
||||||
BT_ACL_DEBUG("-- Destination Channel: 0x%04X", DisconnectionRequest.DestinationChannel);
|
|
||||||
BT_ACL_DEBUG("-- Source Channel: 0x%04X", DisconnectionRequest.SourceChannel);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Pipe_ClearIN();
|
Pipe_ClearIN();
|
||||||
Pipe_Freeze();
|
Pipe_Freeze();
|
||||||
Pipe_SelectPipe(BLUETOOTH_DATA_OUT_PIPE);
|
|
||||||
Pipe_Unfreeze();
|
|
||||||
|
|
||||||
BT_Signal_DisconnectionResp_t DisconnectionResponse;
|
|
||||||
|
|
||||||
ACLPacketHeader->DataLength = sizeof(*DataHeader) + sizeof(*SignalCommandHeader) + sizeof(DisconnectionResponse);
|
|
||||||
DataHeader->PayloadLength = sizeof(*SignalCommandHeader) + sizeof(DisconnectionResponse);
|
|
||||||
DataHeader->DestinationChannel = BT_CHANNEL_SIGNALING;
|
|
||||||
SignalCommandHeader->Code = BT_SIGNAL_DISCONNECTION_RESPONSE;
|
|
||||||
SignalCommandHeader->Length = sizeof(DisconnectionResponse);
|
|
||||||
|
|
||||||
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(DisconnectionRequest.SourceChannel, true);
|
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(DisconnectionRequest.SourceChannel, true);
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
BT_Signal_Header_t SignalCommandHeader;
|
||||||
|
BT_Signal_DisconnectionResp_t DisconnectionResponse;
|
||||||
|
} ResponsePacket;
|
||||||
|
|
||||||
|
ResponsePacket.SignalCommandHeader.Code = BT_SIGNAL_DISCONNECTION_RESPONSE;
|
||||||
|
ResponsePacket.SignalCommandHeader.Identifier = SignalCommandHeader->Identifier;
|
||||||
|
ResponsePacket.SignalCommandHeader.Length = sizeof(ResponsePacket.DisconnectionResponse);
|
||||||
|
ResponsePacket.DisconnectionResponse.DestinationChannel = ChannelData->LocalNumber;
|
||||||
|
ResponsePacket.DisconnectionResponse.SourceChannel = ChannelData->RemoteNumber;
|
||||||
|
|
||||||
|
Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);
|
||||||
|
|
||||||
if (ChannelData != NULL)
|
if (ChannelData != NULL)
|
||||||
ChannelData->State = Channel_Closed;
|
ChannelData->State = Channel_Closed;
|
||||||
|
|
||||||
DisconnectionResponse.DestinationChannel = ChannelData->LocalNumber;
|
|
||||||
DisconnectionResponse.SourceChannel = ChannelData->RemoteNumber;
|
|
||||||
|
|
||||||
Pipe_Write_Stream_LE(ACLPacketHeader, sizeof(*ACLPacketHeader));
|
BT_ACL_DEBUG(1, ">> L2CAP Disconnection Response", NULL);
|
||||||
Pipe_Write_Stream_LE(DataHeader, sizeof(*DataHeader));
|
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ResponsePacket.DisconnectionResponse.SourceChannel);
|
||||||
Pipe_Write_Stream_LE(SignalCommandHeader, sizeof(*SignalCommandHeader));
|
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ResponsePacket.DisconnectionResponse.DestinationChannel);
|
||||||
Pipe_Write_Stream_LE(&DisconnectionResponse, sizeof(DisconnectionResponse));
|
|
||||||
|
|
||||||
Pipe_ClearOUT();
|
|
||||||
Pipe_Freeze();
|
|
||||||
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
|
||||||
BT_ACL_DEBUG("Packet Sent", NULL);
|
|
||||||
BT_ACL_DEBUG("-- Connection Handle: 0x%04X", (ACLPacketHeader->ConnectionHandle & 0x0FFF));
|
|
||||||
BT_ACL_DEBUG("-- Data Length: 0x%04X", ACLPacketHeader->DataLength);
|
|
||||||
BT_ACL_DEBUG("-- Destination Channel: 0x%04X", DataHeader->DestinationChannel);
|
|
||||||
BT_ACL_DEBUG("-- Payload Length: 0x%04X", DataHeader->PayloadLength);
|
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 0)
|
|
||||||
BT_ACL_DEBUG(">> L2CAP Disconnection Response", NULL);
|
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
|
||||||
BT_ACL_DEBUG("-- Source Channel: 0x%04X", DisconnectionResponse.SourceChannel);
|
|
||||||
BT_ACL_DEBUG("-- Destination Channel: 0x%04X", DisconnectionResponse.DestinationChannel);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void Bluetooth_Signal_EchoReq(BT_ACL_Header_t* ACLPacketHeader,
|
static inline void Bluetooth_Signal_EchoReq(BT_ACL_Header_t* ACLPacketHeader,
|
||||||
BT_DataPacket_Header_t* DataHeader,
|
BT_DataPacket_Header_t* DataHeader,
|
||||||
BT_Signal_Header_t* SignalCommandHeader)
|
BT_Signal_Header_t* SignalCommandHeader)
|
||||||
{
|
{
|
||||||
#if (ACL_DEBUG_LEVEL > 0)
|
BT_ACL_DEBUG(1, "<< L2CAP Echo Request", NULL);
|
||||||
BT_ACL_DEBUG("<< L2CAP Echo Request", NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Pipe_ClearIN();
|
Pipe_ClearIN();
|
||||||
Pipe_Freeze();
|
Pipe_Freeze();
|
||||||
Pipe_SelectPipe(BLUETOOTH_DATA_OUT_PIPE);
|
|
||||||
Pipe_Unfreeze();
|
|
||||||
|
|
||||||
ACLPacketHeader->DataLength = sizeof(*DataHeader) + sizeof(*SignalCommandHeader);
|
struct
|
||||||
DataHeader->PayloadLength = sizeof(*SignalCommandHeader);
|
{
|
||||||
DataHeader->DestinationChannel = BT_CHANNEL_SIGNALING;
|
BT_Signal_Header_t SignalCommandHeader;
|
||||||
SignalCommandHeader->Code = BT_SIGNAL_ECHO_RESPONSE;
|
} ResponsePacket;
|
||||||
SignalCommandHeader->Length = 0;
|
|
||||||
|
ResponsePacket.SignalCommandHeader.Code = BT_SIGNAL_ECHO_RESPONSE;
|
||||||
|
ResponsePacket.SignalCommandHeader.Identifier = SignalCommandHeader->Identifier;
|
||||||
|
ResponsePacket.SignalCommandHeader.Length = 0;
|
||||||
|
|
||||||
Pipe_Write_Stream_LE(ACLPacketHeader, sizeof(*ACLPacketHeader));
|
Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);
|
||||||
Pipe_Write_Stream_LE(DataHeader, sizeof(*DataHeader));
|
|
||||||
Pipe_Write_Stream_LE(SignalCommandHeader, sizeof(*SignalCommandHeader));
|
BT_ACL_DEBUG(1, ">> L2CAP Echo Response", NULL);
|
||||||
|
|
||||||
Pipe_ClearOUT();
|
|
||||||
Pipe_Freeze();
|
|
||||||
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
|
||||||
BT_ACL_DEBUG("Packet Sent", NULL);
|
|
||||||
BT_ACL_DEBUG("-- Connection Handle: 0x%04X", (ACLPacketHeader->ConnectionHandle & 0x0FFF));
|
|
||||||
BT_ACL_DEBUG("-- Data Length: 0x%04X", ACLPacketHeader->DataLength);
|
|
||||||
BT_ACL_DEBUG("-- Destination Channel: 0x%04X", DataHeader->DestinationChannel);
|
|
||||||
BT_ACL_DEBUG("-- Payload Length: 0x%04X", DataHeader->PayloadLength);
|
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 0)
|
|
||||||
BT_ACL_DEBUG(">> L2CAP Echo Response", NULL);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void Bluetooth_Signal_InformationReq(BT_ACL_Header_t* ACLPacketHeader,
|
static inline void Bluetooth_Signal_InformationReq(BT_ACL_Header_t* ACLPacketHeader,
|
||||||
|
@ -440,69 +368,48 @@ static inline void Bluetooth_Signal_InformationReq(BT_ACL_Header_t* ACLPacketHea
|
||||||
|
|
||||||
Pipe_Read_Stream_LE(&InformationRequest, sizeof(InformationRequest));
|
Pipe_Read_Stream_LE(&InformationRequest, sizeof(InformationRequest));
|
||||||
|
|
||||||
#if (ACL_DEBUG_LEVEL > 0)
|
BT_ACL_DEBUG(1, "<< L2CAP Information Request", NULL);
|
||||||
BT_ACL_DEBUG("<< Information Request", NULL);
|
BT_ACL_DEBUG(2, "-- Info Type: 0x%04X", InformationRequest.InfoType);
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
|
||||||
BT_ACL_DEBUG("-- Info Type: 0x%04X", InformationRequest.InfoType);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Pipe_ClearIN();
|
Pipe_ClearIN();
|
||||||
Pipe_Freeze();
|
Pipe_Freeze();
|
||||||
Pipe_SelectPipe(BLUETOOTH_DATA_OUT_PIPE);
|
|
||||||
Pipe_Unfreeze();
|
|
||||||
|
|
||||||
BT_Signal_InformationResp_t InformationResponse;
|
|
||||||
uint8_t ResponseData[4];
|
|
||||||
uint8_t ResponseLen;
|
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
BT_Signal_Header_t SignalCommandHeader;
|
||||||
|
BT_Signal_InformationResp_t InformationResponse;
|
||||||
|
|
||||||
|
uint8_t Data[4];
|
||||||
|
} ResponsePacket;
|
||||||
|
|
||||||
|
uint8_t DataLen = 0;
|
||||||
|
|
||||||
switch (InformationRequest.InfoType)
|
switch (InformationRequest.InfoType)
|
||||||
{
|
{
|
||||||
case BT_INFOREQ_MTU:
|
case BT_INFOREQ_MTU:
|
||||||
InformationResponse.Result = BT_INFORMATION_SUCCESSFUL;
|
ResponsePacket.InformationResponse.Result = BT_INFORMATION_SUCCESSFUL;
|
||||||
ResponseLen = 2;
|
DataLen = 2;
|
||||||
|
|
||||||
*((uint16_t*)&ResponseData) = 65533;
|
*((uint16_t*)&ResponsePacket.Data) = MAXIMUM_CHANNEL_MTU;
|
||||||
break;
|
break;
|
||||||
case BT_INFOREQ_EXTENDEDFEATURES:
|
case BT_INFOREQ_EXTENDEDFEATURES:
|
||||||
InformationResponse.Result = BT_INFORMATION_SUCCESSFUL;
|
ResponsePacket.InformationResponse.Result = BT_INFORMATION_SUCCESSFUL;
|
||||||
ResponseLen = 4;
|
DataLen = 4;
|
||||||
|
|
||||||
*((uint32_t*)&ResponseData) = 0;
|
*((uint32_t*)&ResponsePacket.Data) = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
InformationResponse.Result = BT_INFORMATION_NOTSUPPORTED;
|
ResponsePacket.InformationResponse.Result = BT_INFORMATION_NOTSUPPORTED;
|
||||||
ResponseLen = 0;
|
DataLen = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACLPacketHeader->DataLength = sizeof(*DataHeader) + sizeof(*SignalCommandHeader) + sizeof(InformationResponse) +
|
ResponsePacket.SignalCommandHeader.Code = BT_SIGNAL_INFORMATION_RESPONSE;
|
||||||
ResponseLen;
|
ResponsePacket.SignalCommandHeader.Identifier = SignalCommandHeader->Identifier;
|
||||||
DataHeader->PayloadLength = sizeof(*SignalCommandHeader) + sizeof(InformationResponse) + ResponseLen;
|
ResponsePacket.SignalCommandHeader.Length = sizeof(ResponsePacket.InformationResponse) + DataLen;
|
||||||
DataHeader->DestinationChannel = BT_CHANNEL_SIGNALING;
|
|
||||||
SignalCommandHeader->Code = BT_SIGNAL_INFORMATION_RESPONSE;
|
|
||||||
SignalCommandHeader->Length = sizeof(InformationResponse) + ResponseLen;
|
|
||||||
|
|
||||||
Pipe_Write_Stream_LE(ACLPacketHeader, sizeof(*ACLPacketHeader));
|
|
||||||
Pipe_Write_Stream_LE(DataHeader, sizeof(*DataHeader));
|
|
||||||
Pipe_Write_Stream_LE(SignalCommandHeader, sizeof(*SignalCommandHeader));
|
|
||||||
Pipe_Write_Stream_LE(&InformationResponse, sizeof(InformationResponse));
|
|
||||||
Pipe_Write_Stream_LE(ResponseData, ResponseLen);
|
|
||||||
|
|
||||||
Pipe_ClearOUT();
|
|
||||||
Pipe_Freeze();
|
|
||||||
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
Bluetooth_SendPacket(&ResponsePacket, (sizeof(ResponsePacket) - sizeof(ResponsePacket.Data) + DataLen), NULL);
|
||||||
BT_ACL_DEBUG("Packet Sent", NULL);
|
|
||||||
BT_ACL_DEBUG("-- Connection Handle: 0x%04X", (ACLPacketHeader->ConnectionHandle & 0x0FFF));
|
BT_ACL_DEBUG(1, ">> L2CAP Information Response", NULL);
|
||||||
BT_ACL_DEBUG("-- Data Length: 0x%04X", ACLPacketHeader->DataLength);
|
BT_ACL_DEBUG(2, "-- Result: 0x%02X", ResponsePacket.InformationResponse.Result);
|
||||||
BT_ACL_DEBUG("-- Destination Channel: 0x%04X", DataHeader->DestinationChannel);
|
|
||||||
BT_ACL_DEBUG("-- Payload Length: 0x%04X", DataHeader->PayloadLength);
|
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 0)
|
|
||||||
BT_ACL_DEBUG(">> L2CAP Information Response", NULL);
|
|
||||||
#endif
|
|
||||||
#if (ACL_DEBUG_LEVEL > 1)
|
|
||||||
BT_ACL_DEBUG("-- Result: 0x%02X", InformationResponse.Result);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,8 @@
|
||||||
#include "BluetoothStack.h"
|
#include "BluetoothStack.h"
|
||||||
|
|
||||||
/* Macros: */
|
/* Macros: */
|
||||||
#define BT_ACL_DEBUG(s, ...) printf_P(PSTR("(ACL) " s "\r\n"), __VA_ARGS__)
|
#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 1
|
#define ACL_DEBUG_LEVEL 2
|
||||||
|
|
||||||
#define BT_CHANNEL_SIGNALING 0x0001
|
#define BT_CHANNEL_SIGNALING 0x0001
|
||||||
#define BT_CHANNEL_CONNECTIONLESS 0x0002
|
#define BT_CHANNEL_CONNECTIONLESS 0x0002
|
||||||
|
@ -71,6 +71,8 @@
|
||||||
#define BT_CONFIGURATION_REJECTED 0x0002
|
#define BT_CONFIGURATION_REJECTED 0x0002
|
||||||
#define BT_CONFIGURATION_UNKNOWNOPTIONS 0x0003
|
#define BT_CONFIGURATION_UNKNOWNOPTIONS 0x0003
|
||||||
|
|
||||||
|
#define BT_CONFIG_OPTION_MTU 1
|
||||||
|
|
||||||
/* Type Defines: */
|
/* Type Defines: */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -140,10 +142,15 @@
|
||||||
uint16_t InfoType;
|
uint16_t InfoType;
|
||||||
uint16_t Result;
|
uint16_t Result;
|
||||||
} BT_Signal_InformationResp_t;
|
} BT_Signal_InformationResp_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t Type;
|
||||||
|
uint16_t Length;
|
||||||
|
} BT_Config_Option_Header_t;
|
||||||
|
|
||||||
/* Function Prototypes: */
|
/* Function Prototypes: */
|
||||||
void Bluetooth_ACLTask(void);
|
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)
|
#if defined(INCLUDE_FROM_BLUETOOTH_ACLPACKETS_C)
|
||||||
static void Bluetooth_ProcessACLPackets(void);
|
static void Bluetooth_ProcessACLPackets(void);
|
||||||
|
|
|
@ -80,6 +80,7 @@ Bluetooth_Channel_t* Bluetooth_InitChannelData(uint16_t RemoteChannelNumber, uin
|
||||||
ChannelData->RemoteNumber = RemoteChannelNumber;
|
ChannelData->RemoteNumber = RemoteChannelNumber;
|
||||||
ChannelData->LocalNumber = (BLUETOOTH_CHANNELNUMBER_BASEOFFSET + i);
|
ChannelData->LocalNumber = (BLUETOOTH_CHANNELNUMBER_BASEOFFSET + i);
|
||||||
ChannelData->PSM = PSM;
|
ChannelData->PSM = PSM;
|
||||||
|
ChannelData->LocalMTU = MAXIMUM_CHANNEL_MTU;
|
||||||
ChannelData->State = Channel_Config_WaitConfig;
|
ChannelData->State = Channel_Config_WaitConfig;
|
||||||
|
|
||||||
return ChannelData;
|
return ChannelData;
|
||||||
|
|
|
@ -47,6 +47,8 @@
|
||||||
#define CHANNEL_PSM_SERVICEDISCOVERY 0x0001
|
#define CHANNEL_PSM_SERVICEDISCOVERY 0x0001
|
||||||
#define CHANNEL_PSM_RFCOMM 0x0003
|
#define CHANNEL_PSM_RFCOMM 0x0003
|
||||||
|
|
||||||
|
#define MAXIMUM_CHANNEL_MTU 255
|
||||||
|
|
||||||
/* Enums: */
|
/* Enums: */
|
||||||
enum BT_ChannelStates_t
|
enum BT_ChannelStates_t
|
||||||
{
|
{
|
||||||
|
@ -76,6 +78,7 @@
|
||||||
uint16_t LocalNumber;
|
uint16_t LocalNumber;
|
||||||
uint16_t RemoteNumber;
|
uint16_t RemoteNumber;
|
||||||
uint16_t PSM;
|
uint16_t PSM;
|
||||||
|
uint16_t LocalMTU;
|
||||||
uint16_t RemoteMTU;
|
uint16_t RemoteMTU;
|
||||||
} Bluetooth_Channel_t;
|
} Bluetooth_Channel_t;
|
||||||
|
|
||||||
|
@ -106,10 +109,11 @@
|
||||||
void Bluetooth_Stack_Init(void);
|
void Bluetooth_Stack_Init(void);
|
||||||
void Bluetooth_Stack_USBTask(void);
|
void Bluetooth_Stack_USBTask(void);
|
||||||
|
|
||||||
bool Bluetooth_ConnectionRequest(uint8_t* RemoteAddress);
|
bool Bluetooth_ConnectionRequest(uint8_t* RemoteAddress);
|
||||||
void Bluetooth_ConnectionComplete(void);
|
void Bluetooth_ConnectionComplete(void);
|
||||||
void Bluetooth_DisconnectionComplete(void);
|
void Bluetooth_DisconnectionComplete(void);
|
||||||
void Bluetooth_PacketReceived(uint16_t* PacketLength, Bluetooth_Channel_t* Channel);
|
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: */
|
/* External Variables: */
|
||||||
extern Bluetooth_Device_t Bluetooth_DeviceConfiguration;
|
extern Bluetooth_Device_t Bluetooth_DeviceConfiguration;
|
||||||
|
|
Loading…
Reference in New Issue