Add user callback function to the Bluetooth host demo to filter out connections from...
[pub/USBasp.git] / Demos / Host / Incomplete / BluetoothHost / ConfigDescriptor.c
index e65155f..4c94eaa 100644 (file)
@@ -1,13 +1,13 @@
 /*\r
              LUFA Library\r
 /*\r
              LUFA Library\r
-     Copyright (C) Dean Camera, 2009.\r
+     Copyright (C) Dean Camera, 2010.\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
-  Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
 \r
   Permission to use, copy, modify, distribute, and sell this \r
   software and its documentation for any purpose is hereby granted\r
 \r
   Permission to use, copy, modify, distribute, and sell this \r
   software and its documentation for any purpose is hereby granted\r
   this software.\r
 */\r
 \r
   this software.\r
 */\r
 \r
+/** \file\r
+ *\r
+ *  USB Device Configuration Descriptor processing routines, to determine the correct pipe configurations\r
+ *  needed to communication with an attached USB device. Descriptors are special  computer-readable structures\r
+ *  which the host requests upon device enumeration, to determine the device's capabilities and functions.\r
+ */\r
+\r
 #include "ConfigDescriptor.h"\r
 \r
 #include "ConfigDescriptor.h"\r
 \r
+/** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This\r
+ *  routine will read in the entire configuration descriptor, and configure the hosts pipes to correctly communicate\r
+ *  with compatible devices.\r
+ *\r
+ *  This routine searches for a BT interface descriptor containing bulk IN and OUT data endpoints.\r
+ *\r
+ *  \return An error code from the \ref Bluetooth_GetConfigDescriptorDataCodes_t enum.\r
+ */\r
 uint8_t ProcessConfigurationDescriptor(void)\r
 {\r
        uint8_t  ConfigDescriptorData[512];\r
 uint8_t ProcessConfigurationDescriptor(void)\r
 {\r
        uint8_t  ConfigDescriptorData[512];\r
@@ -47,7 +62,7 @@ uint8_t ProcessConfigurationDescriptor(void)
                case HOST_GETCONFIG_BuffOverflow:\r
                        return DescriptorTooLarge;\r
                default:\r
                case HOST_GETCONFIG_BuffOverflow:\r
                        return DescriptorTooLarge;\r
                default:\r
-                       return ControlErrorDuringConfigRead;\r
+                       return ControlError;\r
        }\r
        \r
        /* The bluetooth USB transport addendum mandates that the data (not streaming voice) endpoints\r
        }\r
        \r
        /* The bluetooth USB transport addendum mandates that the data (not streaming voice) endpoints\r
@@ -56,7 +71,7 @@ uint8_t ProcessConfigurationDescriptor(void)
        \r
        /* Ensure that an interface was found, and the end of the descriptor was not reached */\r
        if (!(CurrConfigBytesRem))\r
        \r
        /* Ensure that an interface was found, and the end of the descriptor was not reached */\r
        if (!(CurrConfigBytesRem))\r
-         return NoInterfaceFound;\r
+         return NoBTInterfaceFound;\r
 \r
        /* Get the data IN, data OUT and event notification endpoints for the bluetooth interface */\r
        while (FoundEndpoints != ((1 << BLUETOOTH_DATA_IN_PIPE) | (1 << BLUETOOTH_DATA_OUT_PIPE) |\r
 \r
        /* Get the data IN, data OUT and event notification endpoints for the bluetooth interface */\r
        while (FoundEndpoints != ((1 << BLUETOOTH_DATA_IN_PIPE) | (1 << BLUETOOTH_DATA_OUT_PIPE) |\r
@@ -64,7 +79,7 @@ uint8_t ProcessConfigurationDescriptor(void)
        {\r
                /* Fetch the next endpoint from the current bluetooth interface */\r
                if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,\r
        {\r
                /* Fetch the next endpoint from the current bluetooth interface */\r
                if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,\r
-                                             NextInterfaceBluetoothDataEndpoint))\r
+                                             DComp_NextInterfaceBluetoothDataEndpoint))\r
                {\r
                        /* Descriptor not found, error out */\r
                        return NoEndpointFound;\r
                {\r
                        /* Descriptor not found, error out */\r
                        return NoEndpointFound;\r
@@ -118,7 +133,7 @@ uint8_t ProcessConfigurationDescriptor(void)
        return SuccessfulConfigRead;\r
 }\r
 \r
        return SuccessfulConfigRead;\r
 }\r
 \r
-uint8_t NextInterfaceBluetoothDataEndpoint(void* CurrentDescriptor)\r
+uint8_t DComp_NextInterfaceBluetoothDataEndpoint(void* CurrentDescriptor)\r
 {\r
        /* PURPOSE: Find next interface endpoint descriptor before next interface descriptor */\r
 \r
 {\r
        /* PURPOSE: Find next interface endpoint descriptor before next interface descriptor */\r
 \r