projects
/
pub
/
lufa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a new RFCOMM_ChannelOpened() callback event for when logical RFCOMM channels...
[pub/lufa.git]
/
Demos
/
Host
/
Incomplete
/
BluetoothHost
/
BluetoothEvents.c
diff --git
a/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
b/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
index
1b7997a
..
5996f30
100644
(file)
--- a/
Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
+++ b/
Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
@@
-37,11
+37,15
@@
\r
#include "BluetoothEvents.h"
\r
\r
\r
#include "BluetoothEvents.h"
\r
\r
-/**
Bluetooth RFCOMM channel structure - used to send and receive RFCOMM data between the local and remot
e
\r
- * device once a RFCOMM channel has been opened.
\r
+/**
Pointer to the opened Bluetooth ACL channel structure for RFCOMM, used to send and receive data between th
e
\r
+ *
local and remote
device once a RFCOMM channel has been opened.
\r
*/
\r
Bluetooth_Channel_t* RFCOMMChannel = NULL;
\r
\r
*/
\r
Bluetooth_Channel_t* RFCOMMChannel = 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
+RFCOMM_Channel_t* SerialPortChannel = 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
@@
-155,15
+159,24
@@
void Bluetooth_PacketReceived(void* Data, uint16_t DataLen, Bluetooth_Channel_t*
}
\r
}
\r
\r
}
\r
}
\r
\r
+void RFCOMM_ChannelOpened(RFCOMM_Channel_t* const Channel)
\r
+{
\r
+ /* Save the serial port RFCOMM logical channel for later use */
\r
+ SerialPortChannel = Channel;
\r
+}
\r
+
\r
/** RFCOMM layer callback for when a packet is received on an open RFCOMM channel.
\r
*
\r
/** RFCOMM layer callback for when a packet is received on an open RFCOMM channel.
\r
*
\r
- * \param[in]
RFCOMM
Channel RFCOMM channel that the data was directed to
\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
+ * \param[in] Channel RFCOMM channel that the data was directed to
\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
*/
\r
-void RFCOMM_DataReceived(RFCOMM_Channel_t* const
RFCOMM
Channel, uint16_t DataLen, const uint8_t* Data)
\r
+void RFCOMM_DataReceived(RFCOMM_Channel_t* const 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
/* 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
}
\r
}
\r