From 31a34154dbbc20adc523eb08678977d218ae8135 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Fri, 2 Jul 2010 03:06:16 +0000 Subject: Move out RFCOMM channel structure init code to a seperate routine, to save on compiled code space and to prevent copy-paste errors. --- .../Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c') diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c index 2495bb49e..e5bce54d2 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c @@ -195,23 +195,8 @@ static void RFCOMM_ProcessDPNCommand(const RFCOMM_Command_t* const CommandHeader /* Check if the channel has no corresponding entry - remote did not open it first */ if (RFCOMMChannel == NULL) { - /* Find a free entry in the RFCOMM channel multiplexer state array */ - for (uint8_t i = 0; i < RFCOMM_MAX_OPEN_CHANNELS; i++) - { - /* If the channel's state is closed, the channel state entry is free */ - if (RFCOMM_Channels[i].State == RFCOMM_Channel_Closed) - { - RFCOMMChannel = &RFCOMM_Channels[i]; - RFCOMMChannel->DLCI = Params->DLCI; - RFCOMMChannel->MTU = 0xFFFF; - RFCOMMChannel->Remote.Signals = 0 | (1 << 0); - RFCOMMChannel->Remote.BreakSignal = 0 | (1 << 0); - RFCOMMChannel->Local.Signals = RFCOMM_SIGNAL_RTC | RFCOMM_SIGNAL_RTR | RFCOMM_SIGNAL_DV | (1 << 0); - RFCOMMChannel->Local.BreakSignal = 0 | (1 << 0); - RFCOMMChannel->ConfigFlags = 0; - break; - } - } + /* Create a new entry in the channel table for the new channel */ + RFCOMMChannel = RFCOMM_GetFreeChannelEntry(Params->DLCI); /* No free entry was found, discard the request */ if (RFCOMMChannel == NULL) -- cgit v1.2.3