projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename Bluetooth stack function parameters to clearly indicate what sort of Bluetooth...
[pub/USBasp.git]
/
Demos
/
Host
/
Incomplete
/
BluetoothHost
/
BluetoothEvents.c
diff --git
a/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
b/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
index
5996f30
..
82e347f
100644
(file)
--- a/
Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
+++ b/
Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
@@
-40,12
+40,12
@@
/** Pointer to the opened Bluetooth ACL channel structure for RFCOMM, used to send and receive data between the
\r
* local and remote device once a RFCOMM channel has been opened.
\r
*/
\r
/** Pointer to the opened Bluetooth ACL channel structure for RFCOMM, used to send and receive data between the
\r
* local and remote device once a RFCOMM channel has been opened.
\r
*/
\r
-Bluetooth_Channel_t*
RFCOMMChannel
= NULL;
\r
+Bluetooth_Channel_t*
SerialChannel_ACL
= NULL;
\r
\r
/** Pointer to the opened RFCOMM logical channel between local and remote device, once a RFCOMM ACL channel has been
\r
* negotiated and a logical RFCOMM channel requested.
\r
*/
\r
\r
/** Pointer to the opened RFCOMM logical channel between local and remote device, once a RFCOMM ACL channel has been
\r
* negotiated and a logical RFCOMM channel requested.
\r
*/
\r
-RFCOMM_Channel_t*
SerialPortChannel
= NULL;
\r
+RFCOMM_Channel_t*
SerialChannel_RFCOMM
= NULL;
\r
\r
/** Bluetooth stack callback event for when the Bluetooth stack has fully initialized using the attached
\r
* Bluetooth dongle.
\r
\r
/** Bluetooth stack callback event for when the Bluetooth stack has fully initialized using the attached
\r
* Bluetooth dongle.
\r
@@
-115,8
+115,8
@@
void Bluetooth_DisconnectionComplete(void)
*/
\r
bool Bluetooth_ChannelConnectionRequest(const uint16_t PSM)
\r
{
\r
*/
\r
bool Bluetooth_ChannelConnectionRequest(const uint16_t PSM)
\r
{
\r
- /*
Always accept channel connection requests regardless of PSM
*/
\r
- return
true
;
\r
+ /*
Only accept connections for channels that will be used for RFCOMM or SDP data
*/
\r
+ return
((PSM == CHANNEL_PSM_RFCOMM) || (PSM == CHANNEL_PSM_SDP))
;
\r
}
\r
\r
/** Bluetooth stack callback event for when a Bluetooth ACL channel has been fully created and configured,
\r
}
\r
\r
/** Bluetooth stack callback event for when a Bluetooth ACL channel has been fully created and configured,
\r
@@
-124,11
+124,11
@@
bool Bluetooth_ChannelConnectionRequest(const uint16_t PSM)
*
\r
* \param[in] Channel Bluetooth ACL data channel information structure for the channel that can now be used
\r
*/
\r
*
\r
* \param[in] Channel Bluetooth ACL data channel information structure for the channel that can now be used
\r
*/
\r
-void Bluetooth_ChannelOpened(Bluetooth_Channel_t* const Channel)
\r
+void Bluetooth_ChannelOpened(Bluetooth_Channel_t* const
ACL
Channel)
\r
{
\r
/* Save the RFCOMM channel for later use when we want to send RFCOMM data */
\r
{
\r
/* Save the RFCOMM channel for later use when we want to send RFCOMM data */
\r
- if (Channel->PSM == CHANNEL_PSM_RFCOMM)
\r
-
RFCOMMChannel =
Channel;
\r
+ if (
ACL
Channel->PSM == CHANNEL_PSM_RFCOMM)
\r
+
SerialChannel_ACL = ACL
Channel;
\r
}
\r
\r
/** Bluetooth stack callback event for a non-signal ACL packet reception. This callback fires once a connection
\r
}
\r
\r
/** Bluetooth stack callback event for a non-signal ACL packet reception. This callback fires once a connection
\r
@@
-138,31
+138,26
@@
void Bluetooth_ChannelOpened(Bluetooth_Channel_t* const Channel)
* \param[in] DataLen Length of the packet data, in bytes
\r
* \param[in] Channel Bluetooth ACL data channel information structure for the packet's destination channel
\r
*/
\r
* \param[in] DataLen Length of the packet data, in bytes
\r
* \param[in] Channel Bluetooth ACL data channel information structure for the packet's destination channel
\r
*/
\r
-void Bluetooth_PacketReceived(void* Data, uint16_t DataLen, Bluetooth_Channel_t* const Channel)
\r
+void Bluetooth_PacketReceived(void* Data, uint16_t DataLen, Bluetooth_Channel_t* const
ACL
Channel)
\r
{
\r
/* Run the correct packet handler based on the received packet's PSM, which indicates the service being carried */
\r
{
\r
/* Run the correct packet handler based on the received packet's PSM, which indicates the service being carried */
\r
- switch (Channel->PSM)
\r
+ switch (
ACL
Channel->PSM)
\r
{
\r
case CHANNEL_PSM_SDP:
\r
/* Service Discovery Protocol packet */
\r
{
\r
case CHANNEL_PSM_SDP:
\r
/* Service Discovery Protocol packet */
\r
- SDP_ProcessPacket(Data, Channel);
\r
+ SDP_ProcessPacket(Data,
ACL
Channel);
\r
break;
\r
case CHANNEL_PSM_RFCOMM:
\r
/* RFCOMM (Serial Port) Protocol packet */
\r
break;
\r
case CHANNEL_PSM_RFCOMM:
\r
/* RFCOMM (Serial Port) Protocol packet */
\r
- RFCOMM_ProcessPacket(Data, Channel);
\r
- break;
\r
- default:
\r
- /* Unknown Protocol packet */
\r
- printf_P(PSTR("Unknown Packet Received (Channel 0x%04X, PSM: 0x%02X, Len: 0x%04X):\r\n"),
\r
- Channel->LocalNumber, Channel->PSM, DataLen);
\r
+ RFCOMM_ProcessPacket(Data, ACLChannel);
\r
break;
\r
}
\r
}
\r
\r
break;
\r
}
\r
}
\r
\r
-void RFCOMM_ChannelOpened(RFCOMM_Channel_t* const Channel)
\r
+void RFCOMM_ChannelOpened(RFCOMM_Channel_t* const
RFCOMM
Channel)
\r
{
\r
/* Save the serial port RFCOMM logical channel for later use */
\r
{
\r
/* Save the serial port RFCOMM logical channel for later use */
\r
- Serial
PortChannel =
Channel;
\r
+ Serial
Channel_RFCOMM = RFCOMM
Channel;
\r
}
\r
\r
/** RFCOMM layer callback for when a packet is received on an open RFCOMM channel.
\r
}
\r
\r
/** RFCOMM layer callback for when a packet is received on an open RFCOMM channel.
\r
@@
-171,12
+166,17
@@
void RFCOMM_ChannelOpened(RFCOMM_Channel_t* const Channel)
* \param[in] DataLen Length of the received data, in bytes
\r
* \param[in] Data Pointer to a buffer where the received data is stored
\r
*/
\r
* \param[in] DataLen Length of the received data, in bytes
\r
* \param[in] Data Pointer to a buffer where the received data is stored
\r
*/
\r
-void RFCOMM_DataReceived(RFCOMM_Channel_t* const Channel, uint16_t DataLen, const uint8_t* Data)
\r
+void RFCOMM_DataReceived(RFCOMM_Channel_t* const
ACL
Channel, uint16_t DataLen, const uint8_t* Data)
\r
{
\r
/* Write the received bytes to the serial port */
\r
for (uint8_t i = 0; i < DataLen; i++)
\r
putchar(Data[i]);
\r
\r
/* Echo the data back to the sending device */
\r
{
\r
/* Write the received bytes to the serial port */
\r
for (uint8_t i = 0; i < DataLen; i++)
\r
putchar(Data[i]);
\r
\r
/* Echo the data back to the sending device */
\r
- RFCOMM_SendData(DataLen, Data, Channel, RFCOMMChannel);
\r
+ RFCOMM_SendData(DataLen, Data, SerialChannel_RFCOMM, SerialChannel_ACL);
\r
+}
\r
+
\r
+void RFCOMM_ChannelSignalsReceived(RFCOMM_Channel_t* const RFCOMMChannel)
\r
+{
\r
+ // Currently do nothing in response to the remote device sending new terminal control signals
\r
}
\r
}
\r