X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/071e02c6b6b4837fa9cf0b6d4c749994e02638d7..35b7946950e178c5ba51b87ef16e8a927239fda4:/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c?ds=sidebyside diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c index 542a783c9..07d867b4b 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c @@ -28,6 +28,12 @@ this software. */ +/** \file + * + * Main module for the Bluetooth stack. This module contains the overall Bluetooth + * stack state variables and the main Bluetooth stack management functions. + */ + #include "BluetoothStack.h" /** Bluetooth device connection information structure. Once connected to a remote device, this structure tracks the @@ -59,6 +65,9 @@ void Bluetooth_Stack_Init(void) */ void Bluetooth_Stack_USBTask(void) { + if (USB_HostState != HOST_STATE_Configured) + return; + Bluetooth_HCITask(); Bluetooth_ACLTask(); } @@ -75,9 +84,14 @@ Bluetooth_Channel_t* Bluetooth_GetChannelData(const uint16_t SearchValue, const for (uint8_t i = 0; i < BLUETOOTH_MAX_OPEN_CHANNELS; i++) { Bluetooth_Channel_t* ChannelData = &Bluetooth_Connection.Channels[i]; + + /* Closed channels should be ignored as they are not considered valid data */ + if (ChannelData->State == BT_Channel_Closed) + continue; bool FoundMatch = false; + /* Search the current channel for the search key to see if it matches */ switch (SearchKey) { case CHANNEL_SEARCH_LOCALNUMBER: