Clean up the Service tables, add incomplete ProtocolDescriptorList attribute to the...
[pub/USBasp.git] / Demos / Host / Incomplete / BluetoothHost / Lib / SDPServices.c
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 #include "SDPServices.h"
32
33 const struct
34 {
35 uint8_t Header;
36 uint32_t Data;
37 } PROGMEM SDP_Attribute_ServiceHandle =
38 {
39 (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_32Bit),
40 SWAPENDIAN_32(0x00010000),
41 };
42
43 const struct
44 {
45 uint8_t Header;
46 uint16_t Size;
47 ItemUUID_t UUIDList[];
48 } PROGMEM SDP_Attribute_ServiceClassIDs =
49 {
50 (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable16Bit),
51 SWAPENDIAN_16(sizeof(ItemUUID_t) * 1),
52 {
53 {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), {BASE_80BIT_UUID, {0x00, 0x00, 0x00, 0x00, 0x10, 0x00}}}
54 }
55 };
56
57 const struct
58 {
59 uint8_t Header;
60 uint16_t Size;
61 ItemProtocol_t ProtocolList[];
62 } PROGMEM SDP_Attribute_ProtocolDescriptor =
63 {
64 (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable16Bit),
65 SWAPENDIAN_16(sizeof(ItemProtocol_t) * 1),
66 {
67 {
68 (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
69 sizeof(UUID_t),
70 {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), {BASE_80BIT_UUID, {0x00, 0x00, 0x00, 0x00, 0x01, 0x00}}},
71 }
72 }
73 };
74
75 const struct
76 {
77 uint8_t Header;
78 uint8_t Size;
79 Item16Bit_t VersionList[];
80 } PROGMEM SDP_Attribute_Version =
81 {
82 (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
83 (sizeof(Item16Bit_t) * 1),
84 {
85 {(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(0x0100)}
86 }
87 };
88
89 const struct
90 {
91 uint8_t Header;
92 uint8_t Size;
93 char Text[];
94 } PROGMEM SDP_Attribute_ServiceName =
95 {
96 (SDP_DATATYPE_String | SDP_DATASIZE_Variable8Bit),
97 (sizeof("SDP") - 1),
98 "SDP",
99 };
100
101 const struct
102 {
103 uint8_t Header;
104 uint8_t Size;
105 char Text[];
106 } PROGMEM SDP_Attribute_ServiceDescription =
107 {
108 (SDP_DATATYPE_String | SDP_DATASIZE_Variable8Bit),
109 (sizeof("Service Discovery Protocol Server") - 1),
110 "Service Discovery Protocol Server",
111 };
112
113 /** Service Discovery Protocol attribute table, listing all supported attributes of the service. */
114 const ServiceAttributeTable_t SDP_Attribute_Table[] PROGMEM =
115 {
116 {.AttributeID = SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE, .Data = &SDP_Attribute_ServiceHandle },
117 {.AttributeID = SDP_ATTRIBUTE_ID_SERVICECLASSIDS, .Data = &SDP_Attribute_ServiceClassIDs },
118 // {.AttributeID = SDP_ATTRIBUTE_ID_PROTOCOLDESCRIPTORLIST, .Data = &SDP_Attribute_ProtocolDescriptor },
119 {.AttributeID = SDP_ATTRIBUTE_ID_VERSION, .Data = &SDP_Attribute_Version },
120 {.AttributeID = SDP_ATTRIBUTE_ID_SERVICENAME, .Data = &SDP_Attribute_ServiceName },
121 {.AttributeID = SDP_ATTRIBUTE_ID_SERVICEDESCRIPTION, .Data = &SDP_Attribute_ServiceDescription },
122
123 SERVICE_ATTRIBUTE_TABLE_TERMINATOR
124 };
125
126 const struct
127 {
128 uint8_t Header;
129 uint32_t Data;
130 } PROGMEM RFCOMM_Attribute_ServiceHandle =
131 {
132 (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_32Bit),
133 SWAPENDIAN_32(0x00010001),
134 };
135
136 const struct
137 {
138 uint8_t Header;
139 uint16_t Size;
140 ItemUUID_t UUIDList[];
141 } PROGMEM RFCOMM_Attribute_ServiceClassIDs =
142 {
143 (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable16Bit),
144 SWAPENDIAN_16(sizeof(ItemUUID_t) * 1),
145 {
146 {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), {BASE_80BIT_UUID, {0x00, 0x00, 0x00, 0x00, 0x11, 0x01}}}
147 }
148 };
149
150 const struct
151 {
152 uint8_t Header;
153 uint8_t Size;
154 Item16Bit_t OffsetList[];
155 } PROGMEM RFCOMM_Attribute_LangOffset =
156 {
157 (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
158 (sizeof(Item16Bit_t) * 1),
159 {
160 {(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(0x0100)}
161 }
162 };
163
164 const struct
165 {
166 uint8_t Header;
167 uint8_t Size;
168 char Text[];
169 } PROGMEM RFCOMM_Attribute_ServiceName =
170 {
171 (SDP_DATATYPE_String | SDP_DATASIZE_Variable8Bit),
172 sizeof("Serial Port") - 1,
173 "Serial Port",
174 };
175
176 const struct
177 {
178 uint8_t Header;
179 uint8_t Size;
180 char Text[];
181 } PROGMEM RFCOMM_Attribute_ServiceDescription =
182 {
183 (SDP_DATATYPE_String | SDP_DATASIZE_Variable8Bit),
184 sizeof("Wireless Serial Port Service") - 1,
185 "Wireless Serial Port Service",
186 };
187
188 const ServiceAttributeTable_t RFCOMM_Attribute_Table[] PROGMEM =
189 {
190 {.AttributeID = SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE, .Data = &RFCOMM_Attribute_ServiceHandle },
191 {.AttributeID = SDP_ATTRIBUTE_ID_SERVICECLASSIDS, .Data = &RFCOMM_Attribute_ServiceClassIDs },
192 {.AttributeID = SDP_ATTRIBUTE_ID_SERVICENAME, .Data = &RFCOMM_Attribute_ServiceName },
193 {.AttributeID = SDP_ATTRIBUTE_ID_SERVICEDESCRIPTION, .Data = &RFCOMM_Attribute_ServiceDescription },
194
195 SERVICE_ATTRIBUTE_TABLE_TERMINATOR
196 };