Add new tag for the LUFA-120219-BETA release.
[pub/USBasp.git] / Demos / Host / Incomplete / BluetoothHost / Lib / SDPServices.h
index 1cfc2b2..adf4809 100644 (file)
-/*\r
-             LUFA Library\r
-     Copyright (C) Dean Camera, 2010.\r
-              \r
-  dean [at] fourwalledcubicle [dot] com\r
-      www.fourwalledcubicle.com\r
-*/\r
-\r
-/*\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
-  without fee, provided that the above copyright notice appear in \r
-  all copies and that both that the copyright notice and this\r
-  permission notice and warranty disclaimer appear in supporting \r
-  documentation, and that the name of the author not be used in \r
-  advertising or publicity pertaining to distribution of the \r
-  software without specific, written prior permission.\r
-\r
-  The author disclaim all warranties with regard to this\r
-  software, including all implied warranties of merchantability\r
-  and fitness.  In no event shall the author be liable for any\r
-  special, indirect or consequential damages or any damages\r
-  whatsoever resulting from loss of use, data or profits, whether\r
-  in an action of contract, negligence or other tortious action,\r
-  arising out of or in connection with the use or performance of\r
-  this software.\r
-*/\r
-\r
-/** \file\r
- *\r
- *  Header file for SDPServices.c.\r
- */\r
-\r
-#ifndef _SDPSERVICES_H_\r
-#define _SDPSERVICES_H_\r
-       \r
-       /* Includes: */\r
-               #include "ServiceDiscoveryProtocol.h"\r
-\r
-       /* Macros: */\r
-               /** Size of a full 128 bit UUID, in bytes. */\r
-               #define UUID_SIZE_BYTES                         16\r
-               \r
-               /** First 80 bits common to all standardized Bluetooth services. */\r
-               #define BASE_80BIT_UUID                         0x0000, 0x0010, 0x0080, {0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB}\r
-               \r
-               #define RFCOMM_UUID                             {SWAPENDIAN_32(0x00000003), BASE_80BIT_UUID}\r
-               #define L2CAP_UUID                              {SWAPENDIAN_32(0x00000100), BASE_80BIT_UUID}\r
-               #define SP_CLASS_UUID                           {SWAPENDIAN_32(0x00001101), BASE_80BIT_UUID}\r
-               #define PUBLICBROWSEGROUP_CLASS_UUID            {SWAPENDIAN_32(0x00001002), BASE_80BIT_UUID}\r
-               \r
-               #define SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE    0x0000\r
-               #define SDP_ATTRIBUTE_ID_SERVICECLASSIDS        0x0001\r
-               #define SDP_ATTRIBUTE_ID_PROTOCOLDESCRIPTORLIST 0x0004\r
-               #define SDP_ATTRIBUTE_ID_BROWSEGROUPLIST        0x0005\r
-               #define SDP_ATTRIBUTE_ID_LANGUAGEBASEATTROFFSET 0x0006\r
-               #define SDP_ATTRIBUTE_ID_SERVICENAME            0x0100\r
-               #define SDP_ATTRIBUTE_ID_SERVICEDESCRIPTION     0x0101\r
-               \r
-               /** Swaps the byte ordering of a 16-bit value at compile time. Do not use this macro for swapping byte orderings\r
-                *  of dynamic values computed at runtime -- use SwapEndian_16() instead.\r
-                *\r
-                *  \param[in]  x  16-bit value whose byte ordering is to be swapped\r
-                *\r
-                *  \return Input value with the byte ordering reversed\r
-                */\r
-               #define SWAPENDIAN_16(x)                        ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))\r
-\r
-               /** Swaps the byte ordering of a 32-bit value at compile time. Do not use this macro for swapping byte orderings\r
-                *  of dynamic values computed at runtime -- use SwapEndian_32() instead.\r
-                *\r
-                *  \param[in]  x  32-bit value whose byte ordering is to be swapped\r
-                *\r
-                *  \return Input value with the byte ordering reversed\r
-                */\r
-               #define SWAPENDIAN_32(x)                        ((((x) & 0xFF000000UL) >> 24UL) | (((x) & 0x00FF0000UL) >> 8UL) | \\r
-                                                                (((x) & 0x0000FF00UL) << 8UL) | (((x) & 0x000000FFUL) << 24UL))\r
-               \r
-               /** Terminator for a service attribute table of type \ref ServiceAttributeTable_t. */\r
-               #define SERVICE_ATTRIBUTE_TABLE_TERMINATOR      {.Data = NULL}\r
-               \r
-       /* Type Defines: */\r
-               /** Type define for a UUID value structure. This struct can be used to hold full 128-bit UUIDs. */\r
-               typedef struct\r
-               {\r
-                       uint32_t A; /**< Bits 0-31 of the UUID. */\r
-                       uint16_t B; /**< Bits 32-47 of the UUID. */\r
-                       uint16_t C; /**< Bits 48-63 of the UUID. */\r
-                       uint16_t D; /**< Bits 64-79 of the UUID. */\r
-                       uint8_t  E[6]; /**< Bits 80-128 of the UUID. */\r
-               } UUID_t;\r
-       \r
-               /** Structure for the association of attribute ID values to an attribute value in FLASH. A table of these\r
-                *  structures can then be built up for each supported UUID service within the device.\r
-                *\r
-                *  \note This table must be terminated with a \ref SERVICE_ATTRIBUTE_TABLE_TERMINATOR element.\r
-                */\r
-               typedef struct\r
-               {\r
-                       uint16_t    AttributeID; /**< Attribute ID of the table element which the UUID service supports */\r
-                       const void* Data; /**< Pointer to the attribute data, located in PROGMEM memory space */\r
-               } ServiceAttributeTable_t;\r
-\r
-               /** Structure for a list of Data Elements containing 8-bit integers, for service attributes requiring such lists. */\r
-               typedef struct\r
-               {\r
-                       uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_8Bit) */\r
-                       uint8_t Value; /**< Value to store in the list Data Element */\r
-               } Item8Bit_t;\r
-\r
-               /** Structure for a list of Data Elements containing 16-bit integers, for service attributes requiring such lists. */\r
-               typedef struct\r
-               {\r
-                       uint8_t  Header; /**< Data Element header, should be (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit) */\r
-                       uint16_t Value; /**< Value to store in the list Data Element */\r
-               } Item16Bit_t;\r
-\r
-               /** Structure for a list of Data Elements containing 32-bit integers, for service attributes requiring such lists. */\r
-               typedef struct\r
-               {\r
-                       uint8_t  Header; /**< Data Element header, should be (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_32Bit) */\r
-                       uint32_t Value; /**< Value to store in the list Data Element */\r
-               } Item32Bit_t;\r
-\r
-               /** Structure for a list of Data Elements containing UUIDs, for service attributes requiring UUID lists. */\r
-               typedef struct\r
-               {\r
-                       uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit) */\r
-                       UUID_t  UUID; /**< UUID to store in the list Data Element */\r
-               } ItemUUID_t;\r
-               \r
-               /** Structure for a list of Data Elements Sequences containing UUID Data Elements, for service attributes requiring\r
-                *  protocol lists.\r
-                */\r
-               typedef struct\r
-               {\r
-                       uint8_t        Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */\r
-                       uint8_t        Size; /**< Size of the inner Data Element sequence */\r
-                       \r
-                       struct\r
-                       {\r
-                               ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */\r
-                       } Protocol;\r
-               } ItemProtocol_t;\r
-\r
-               /** Structure for a list of Data Elements Sequences containing UUID Data Elements and 16-bit PSM values, for service\r
-                *  attributes requiring extended protocol lists.\r
-                */\r
-               typedef struct\r
-               {\r
-                       uint8_t         Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */\r
-                       uint8_t         Size; /**< Size of the inner Data Element sequence */\r
-                       \r
-                       struct\r
-                       {\r
-                               ItemUUID_t  UUID; /**< UUID to store in the protocol list Data Element sequence */\r
-                               Item16Bit_t PSM; /**< PSM that is to be used to access the service on created channels */\r
-                       } Protocol;\r
-               } ItemProtocolPSM_t;\r
-               \r
-               /** Structure for a list of Data Elements containing language encodings, including the language ID, Encoding ID and\r
-                *  Attribute base offset.\r
-                */\r
-               typedef struct\r
-               {\r
-                       Item16Bit_t LanguageID; /**< Language ID for the current language */\r
-                       Item16Bit_t EncodingID; /**< Encoding used for the current language */\r
-                       Item16Bit_t OffsetID; /**< Attribute offset added to all strings using this language within the service */\r
-               } ItemLangEncoding_t;\r
-               \r
-       /* External Variables: */\r
-               extern const ServiceAttributeTable_t SerialPort_Attribute_Table[];\r
-               \r
-#endif\r
+/*
+             LUFA Library
+     Copyright (C) Dean Camera, 2012.
+
+  dean [at] fourwalledcubicle [dot] com
+           www.lufa-lib.org
+*/
+
+/*
+  Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+  Permission to use, copy, modify, distribute, and sell this
+  software and its documentation for any purpose is hereby granted
+  without fee, provided that the above copyright notice appear in
+  all copies and that both that the copyright notice and this
+  permission notice and warranty disclaimer appear in supporting
+  documentation, and that the name of the author not be used in
+  advertising or publicity pertaining to distribution of the
+  software without specific, written prior permission.
+
+  The author disclaim all warranties with regard to this
+  software, including all implied warranties of merchantability
+  and fitness.  In no event shall the author be liable for any
+  special, indirect or consequential damages or any damages
+  whatsoever resulting from loss of use, data or profits, whether
+  in an action of contract, negligence or other tortious action,
+  arising out of or in connection with the use or performance of
+  this software.
+*/
+
+/** \file
+ *
+ *  Header file for SDPServices.c.
+ */
+
+#ifndef _SDPSERVICES_H_
+#define _SDPSERVICES_H_
+
+       /* Includes: */
+               #include "SDP.h"
+
+       /* Macros: */
+               /** Size of a full 128 bit UUID, in bytes. */
+               #define UUID_SIZE_BYTES                         16
+
+               /** First 80 bits common to all standardized Bluetooth services. */
+               #define BASE_80BIT_UUID                         0x0000, 0x0010, 0x0080, {0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB}
+
+               #define RFCOMM_UUID                             {SWAPENDIAN_32(0x00000003), BASE_80BIT_UUID}
+               #define L2CAP_UUID                              {SWAPENDIAN_32(0x00000100), BASE_80BIT_UUID}
+               #define SP_CLASS_UUID                           {SWAPENDIAN_32(0x00001101), BASE_80BIT_UUID}
+               #define PUBLICBROWSEGROUP_CLASS_UUID            {SWAPENDIAN_32(0x00001002), BASE_80BIT_UUID}
+
+               #define SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE    0x0000
+               #define SDP_ATTRIBUTE_ID_SERVICECLASSIDS        0x0001
+               #define SDP_ATTRIBUTE_ID_PROTOCOLDESCRIPTORLIST 0x0004
+               #define SDP_ATTRIBUTE_ID_BROWSEGROUPLIST        0x0005
+               #define SDP_ATTRIBUTE_ID_LANGUAGEBASEATTROFFSET 0x0006
+               #define SDP_ATTRIBUTE_ID_SERVICENAME            0x0100
+               #define SDP_ATTRIBUTE_ID_SERVICEDESCRIPTION     0x0101
+
+               /** Terminator for a service attribute table of type \ref ServiceAttributeTable_t. */
+               #define SERVICE_ATTRIBUTE_TABLE_TERMINATOR      {.Data = NULL}
+
+       /* Type Defines: */
+               /** Type define for a UUID value structure. This struct can be used to hold full 128-bit UUIDs. */
+               typedef struct
+               {
+                       uint32_t A; /**< Bits 0-31 of the UUID. */
+                       uint16_t B; /**< Bits 32-47 of the UUID. */
+                       uint16_t C; /**< Bits 48-63 of the UUID. */
+                       uint16_t D; /**< Bits 64-79 of the UUID. */
+                       uint8_t  E[6]; /**< Bits 80-127 of the UUID. */
+               } UUID_t;
+
+               /** Structure for the association of attribute ID values to an attribute value in FLASH. A table of these
+                *  structures can then be built up for each supported UUID service within the device.
+                *
+                *  \note This table must be terminated with a \ref SERVICE_ATTRIBUTE_TABLE_TERMINATOR element.
+                */
+               typedef struct
+               {
+                       uint16_t    AttributeID; /**< Attribute ID of the table element which the UUID service supports */
+                       const void* Data; /**< Pointer to the attribute data, located in PROGMEM memory space */
+               } ServiceAttributeTable_t;
+
+               /** Structure for a list of Data Elements containing 8-bit integers, for service attributes requiring such lists. */
+               typedef struct
+               {
+                       uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_8Bit) */
+                       uint8_t Value; /**< Value to store in the list Data Element */
+               } Item8Bit_t;
+
+               /** Structure for a list of Data Elements containing 16-bit integers, for service attributes requiring such lists. */
+               typedef struct
+               {
+                       uint8_t  Header; /**< Data Element header, should be (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit) */
+                       uint16_t Value; /**< Value to store in the list Data Element */
+               } Item16Bit_t;
+
+               /** Structure for a list of Data Elements containing 32-bit integers, for service attributes requiring such lists. */
+               typedef struct
+               {
+                       uint8_t  Header; /**< Data Element header, should be (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_32Bit) */
+                       uint32_t Value; /**< Value to store in the list Data Element */
+               } Item32Bit_t;
+
+               /** Structure for a list of Data Elements containing UUIDs, for service attributes requiring UUID lists. */
+               typedef struct
+               {
+                       uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit) */
+                       UUID_t  UUID; /**< UUID to store in the list Data Element */
+               } ItemUUID_t;
+
+               /** Structure for a list of Data Elements Sequences containing UUID Data Elements, for service attributes requiring
+                *  protocol lists.
+                */
+               typedef struct
+               {
+                       uint8_t        Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
+                       uint8_t        Size; /**< Size of the inner Data Element sequence */
+
+                       struct
+                       {
+                               ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */
+                       } Protocol;
+               } ItemProtocol_t;
+
+               /** Structure for a list of Data Elements Sequences containing UUID Data Elements and an 8-bit param value, for service
+                *  attributes requiring extended protocol lists containing an 8-bit value.
+                */
+               typedef struct
+               {
+                       uint8_t        Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
+                       uint8_t        Size; /**< Size of the inner Data Element sequence */
+
+                       struct
+                       {
+                               ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */
+                               Item8Bit_t Param; /**< 8-Bit Parameter associated with the service */
+                       } Protocol;
+               } ItemProtocol_8BitParam_t;
+
+               /** Structure for a list of Data Elements Sequences containing UUID Data Elements and an 16-bit param value, for service
+                *  attributes requiring extended protocol lists containing an 16-bit value.
+                */
+               typedef struct
+               {
+                       uint8_t        Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
+                       uint8_t        Size; /**< Size of the inner Data Element sequence */
+
+                       struct
+                       {
+                               ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */
+                               Item16Bit_t Channel; /**< 16-Bit Parameter associated with the service */
+                       } Protocol;
+               } ItemProtocol_16BitParam_t;
+
+               /** Structure for a list of Data Elements containing language encodings, including the language ID, Encoding ID and
+                *  Attribute base offset.
+                */
+               typedef struct
+               {
+                       Item16Bit_t LanguageID; /**< Language ID for the current language */
+                       Item16Bit_t EncodingID; /**< Encoding used for the current language */
+                       Item16Bit_t OffsetID; /**< Attribute offset added to all strings using this language within the service */
+               } ItemLangEncoding_t;
+
+       /* External Variables: */
+               extern const ServiceAttributeTable_t SerialPort_Attribute_Table[];
+               extern const ServiceAttributeTable_t PnP_Attribute_Table[];
+
+#endif
+