diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-06-01 03:07:05 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-06-01 03:07:05 +0000 |
commit | e0ef5741d49dc5b36f3bb8165506b51006e68ee3 (patch) | |
tree | d257339e2716b868ac9b01bf731da384418c74f3 /Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h | |
parent | 587f3203333adb68fe3d4c89bc1a07698f180030 (diff) | |
download | lufa-e0ef5741d49dc5b36f3bb8165506b51006e68ee3.tar.gz lufa-e0ef5741d49dc5b36f3bb8165506b51006e68ee3.tar.bz2 lufa-e0ef5741d49dc5b36f3bb8165506b51006e68ee3.zip |
Move SDP service tables out into a new set of files, to make the SDP service code cleaner.
Diffstat (limited to 'Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h')
-rw-r--r-- | Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h new file mode 100644 index 000000000..ce920579b --- /dev/null +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h @@ -0,0 +1,114 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 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 "ServiceDiscoveryProtocol.h"
+
+ /* Macros: */
+ /** Size of a full 128 bit UUID, in bytes. */
+ #define UUID_SIZE_BYTES 16
+
+ /** First 96 bits common to all standardized Bluetooth services. */
+ #define BASE_96BIT_UUID 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00
+
+ #define SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE 0x0000
+ #define SDP_ATTRIBUTE_ID_SERVICECLASSIDS 0x0001
+ #define SDP_ATTRIBUTE_ID_LANGIDOFFSET 0x0006
+ #define SDP_ATTRIBUTE_ID_AVAILABILITY 0x0008
+ #define SDP_ATTRIBUTE_ID_VERSION 0x0200
+ #define SDP_ATTRIBUTE_ID_SERVICENAME 0x0100
+ #define SDP_ATTRIBUTE_ID_SERVICEDESCRIPTION 0x0101
+
+ #define SWAPENDIAN_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
+ #define SWAPENDIAN_32(x) (SWAPENDIAN_16(((x) & 0xFFFF0000) >> 16) | SWAPENDIAN_16(((x) & 0x0000FFFF) << 16))
+
+ /** Terminator for a service attribute table of type \ref ServiceAttributeTable_t. */
+ #define SERVICE_ATTRIBUTE_TABLE_TERMINATOR {.Data = NULL}
+
+ /* Type Defines: */
+ /** 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.
+ */
+ 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 the association of service UUID values to attribute tables stored in FLASH. A table of these
+ * structures can then be built up for each supported UUID service within the device.
+ */
+ typedef struct
+ {
+ uint8_t UUID[UUID_SIZE_BYTES]; /**< UUID of a service supported by the device */
+ const void* AttributeTable; /**< Pointer to the UUID's attribute table, located in PROGMEM memory space */
+ } ServiceTable_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) */
+ uint8_t UUID[UUID_SIZE_BYTES]; /**< UUID to store in the list Data Element */
+ } ClassUUID_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;
+
+ /* External Variables: */
+ extern const ServiceAttributeTable_t SDP_Attribute_Table[];
+ extern const ServiceAttributeTable_t RFCOMM_Attribute_Table[];
+
+#endif
|