diff options
| author | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2010-07-08 08:48:52 +0000 |
|---|---|---|
| committer | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2010-07-08 08:48:52 +0000 |
| commit | e37bae42e92ef87c5b7fc024c7e25460d93eb67d (patch) | |
| tree | 879d6262225844dfa73c9c8b00bfa431e806c677 /Demos/Host/Incomplete/BluetoothHost/Lib | |
| parent | b835582df65fe78848f70a9cd72444a05eb605a1 (diff) | |
Add a new RFCOMM_ChannelOpened() callback event for when logical RFCOMM channels are opened in the BluetoothHost demo. Make the demo echo back sent characters to the remote device.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1363 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Demos/Host/Incomplete/BluetoothHost/Lib')
| -rw-r--r-- | Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c | 19 | ||||
| -rw-r--r-- | Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h | 6 |
2 files changed, 19 insertions, 6 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c index ae4e7832..c4aeb15e 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c @@ -94,6 +94,7 @@ void RFCOMM_ServiceChannels(Bluetooth_Channel_t* const BluetoothChannel) (RFCOMM_CONFIG_REMOTESIGNALS | RFCOMM_CONFIG_LOCALSIGNALS)) { RFCOMMChannel->State = RFCOMM_Channel_Open; + RFCOMM_ChannelOpened(RFCOMMChannel); } } } @@ -129,11 +130,6 @@ void RFCOMM_ProcessPacket(void* Data, Bluetooth_Channel_t* const Channel) } } -RFCOMM_Channel_t* RFCOMM_OpenChannel(Bluetooth_Channel_t* const BluetoothChannel) -{ - return NULL; -} - void RFCOMM_SendChannelSignals(const RFCOMM_Channel_t* const RFCOMMChannel, Bluetooth_Channel_t* const BluetoothChannel) { BT_RFCOMM_DEBUG(1, ">> MSC Command"); @@ -156,6 +152,19 @@ void RFCOMM_SendChannelSignals(const RFCOMM_Channel_t* const RFCOMMChannel, Blue RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, true, RFCOMM_Frame_UIH, sizeof(MSCommand), &MSCommand, BluetoothChannel); } +void RFCOMM_SendData(const uint16_t DataLen, const uint8_t* Data, const RFCOMM_Channel_t* const RFCOMMChannel, + Bluetooth_Channel_t* const BluetoothChannel) +{ + if (RFCOMMChannel->State != RFCOMM_Channel_Open) + return; + + BT_RFCOMM_DEBUG(1, ">> UIH Frame"); + BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", RFCOMMChannel->DLCI); + + /* Send the MSC command to the remote device */ + RFCOMM_SendFrame(RFCOMMChannel->DLCI, false, RFCOMM_Frame_UIH, DataLen, Data, BluetoothChannel); +} + RFCOMM_Channel_t* RFCOMM_GetFreeChannelEntry(const uint8_t DLCI) { /* Find a free entry in the RFCOMM channel multiplexer state array */ diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h index d23d6350..a30385fd 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h @@ -106,8 +106,12 @@ void RFCOMM_SendChannelSignals(const RFCOMM_Channel_t* const RFCOMMChannel, Bluetooth_Channel_t* const BluetoothChannel); + void RFCOMM_SendData(const uint16_t DataLen, const uint8_t* Data, + const RFCOMM_Channel_t* const RFCOMMChannel, + Bluetooth_Channel_t* const BluetoothChannel); - void RFCOMM_DataReceived(RFCOMM_Channel_t* const RFCOMMChannel, uint16_t DataLen, const uint8_t* Data); + void RFCOMM_ChannelOpened(RFCOMM_Channel_t* const Channel); + void RFCOMM_DataReceived(RFCOMM_Channel_t* const Channel, uint16_t DataLen, const uint8_t* Data); RFCOMM_Channel_t* RFCOMM_GetFreeChannelEntry(const uint8_t DLCI); RFCOMM_Channel_t* RFCOMM_GetChannelData(const uint8_t DLCI); |
