Remove incorrect Language ID offset attribute from the SDP server - client assumes...
[pub/USBasp.git] / Demos / Host / Incomplete / BluetoothHost / Lib / SDPServices.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2010.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29 */
30
31 /** \file
32 *
33 * Header file for SDPServices.c.
34 */
35
36 #ifndef _SDPSERVICES_H_
37 #define _SDPSERVICES_H_
38
39 /* Includes: */
40 #include "ServiceDiscoveryProtocol.h"
41
42 /* Macros: */
43 /** Size of a full 128 bit UUID, in bytes. */
44 #define UUID_SIZE_BYTES 16
45
46 /** First 80 bits common to all standardized Bluetooth services. */
47 #define BASE_80BIT_UUID SWAPENDIAN_32(0xFB349B5F), SWAPENDIAN_16(0x8000), SWAPENDIAN_16(0x0080), SWAPENDIAN_16(0x0010)
48
49 #define SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE 0x0000
50 #define SDP_ATTRIBUTE_ID_SERVICECLASSIDS 0x0001
51 #define SDP_ATTRIBUTE_ID_VERSION 0x0200
52 #define SDP_ATTRIBUTE_ID_SERVICENAME 0x0100
53 #define SDP_ATTRIBUTE_ID_SERVICEDESCRIPTION 0x0101
54
55 #define SWAPENDIAN_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
56 #define SWAPENDIAN_32(x) ((((x) & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | \
57 (((x) & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24))
58
59 /** Terminator for a service attribute table of type \ref ServiceAttributeTable_t. */
60 #define SERVICE_ATTRIBUTE_TABLE_TERMINATOR {.Data = NULL}
61
62 /* Type Defines: */
63 typedef struct
64 {
65 uint32_t A;
66 uint16_t B;
67 uint16_t C;
68 uint16_t D;
69 uint8_t E[6];
70 } UUID_t;
71
72 /** Structure for the association of attribute ID values to an attribute value in FLASH. A table of these
73 * structures can then be built up for each supported UUID service within the device.
74 */
75 typedef struct
76 {
77 uint16_t AttributeID; /**< Attribute ID of the table element which the UUID service supports */
78 const void* Data; /**< Pointer to the attribute data, located in PROGMEM memory space */
79 } ServiceAttributeTable_t;
80
81 /** Structure for the association of service UUID values to attribute tables stored in FLASH. A table of these
82 * structures can then be built up for each supported UUID service within the device.
83 */
84 typedef struct
85 {
86 UUID_t UUID; /**< UUID of a service supported by the device */
87 const void* AttributeTable; /**< Pointer to the UUID's attribute table, located in PROGMEM memory space */
88 } ServiceTable_t;
89
90 /** Structure for a list of Data Elements containing UUIDs, for service attributes requiring UUID lists. */
91 typedef struct
92 {
93 uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit) */
94 UUID_t UUID; /**< UUID to store in the list Data Element */
95 } ItemUUID_t;
96
97 /** Structure for a list of Data Elements containing 8-bit integers, for service attributes requiring such lists. */
98 typedef struct
99 {
100 uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_8Bit) */
101 uint8_t Value; /**< Value to store in the list Data Element */
102 } Item8Bit_t;
103
104 /** Structure for a list of Data Elements containing 16-bit integers, for service attributes requiring such lists. */
105 typedef struct
106 {
107 uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit) */
108 uint16_t Value; /**< Value to store in the list Data Element */
109 } Item16Bit_t;
110
111 /** Structure for a list of Data Elements containing 32-bit integers, for service attributes requiring such lists. */
112 typedef struct
113 {
114 uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_32Bit) */
115 uint32_t Value; /**< Value to store in the list Data Element */
116 } Item32Bit_t;
117
118 /* External Variables: */
119 extern const ServiceAttributeTable_t SDP_Attribute_Table[];
120 extern const ServiceAttributeTable_t RFCOMM_Attribute_Table[];
121
122 #endif