Add start of RFCOMM service layer to the incomplete BluetoothHost demo.
[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 SerialPort_Attribute_ServiceHandle =
38 {
39 (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_32Bit),
40 SWAPENDIAN_32(0x00010001),
41 };
42
43 const struct
44 {
45 uint8_t Header;
46 uint16_t Size;
47 ItemUUID_t UUIDList[];
48 } PROGMEM SerialPort_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), SP_CLASS_UUID}
54 }
55 };
56
57 const struct
58 {
59 uint8_t Header;
60 uint16_t Size;
61
62 ItemProtocol_t ProtocolList[];
63 } PROGMEM SerialPort_Attribute_ProtocolDescriptor =
64 {
65 (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable16Bit),
66 SWAPENDIAN_16(sizeof(ItemProtocol_t) * 2),
67 {
68 {
69 (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
70 sizeof(ItemUUID_t),
71 {
72 {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), L2CAP_UUID},
73 }
74 },
75 {
76 (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
77 sizeof(ItemUUID_t),
78 {
79 {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), RFCOMM_UUID},
80 }
81 },
82 }
83 };
84
85 const struct
86 {
87 uint8_t Header;
88 uint16_t Size;
89 ItemUUID_t UUIDList[];
90 } PROGMEM SerialPort_Attribute_BrowseGroupList =
91 {
92 (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable16Bit),
93 SWAPENDIAN_16(sizeof(ItemUUID_t) * 1),
94 {
95 {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), PUBLICBROWSEGROUP_CLASS_UUID}
96 }
97 };
98
99 const struct
100 {
101 uint8_t Header;
102 uint8_t Size;
103 ItemLangEncoding_t LanguageEncodings[];
104 } PROGMEM SerialPort_Attribute_LanguageBaseIDOffset =
105 {
106 .Header = (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
107 .Size = (sizeof(ItemLangEncoding_t) * 1),
108 .LanguageEncodings =
109 {
110 {
111 {(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(0x454E)},
112 {(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(0x006A)},
113 {(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(0x0100)},
114 }
115 }
116 };
117
118 const struct
119 {
120 uint8_t Header;
121 uint8_t Size;
122 char Text[];
123 } PROGMEM SerialPort_Attribute_ServiceName =
124 {
125 (SDP_DATATYPE_String | SDP_DATASIZE_Variable8Bit),
126 sizeof("Wireless Serial Port") - 1,
127 "Wireless Serial Port",
128 };
129
130 const struct
131 {
132 uint8_t Header;
133 uint8_t Size;
134 char Text[];
135 } PROGMEM SerialPort_Attribute_ServiceDescription =
136 {
137 (SDP_DATATYPE_String | SDP_DATASIZE_Variable8Bit),
138 sizeof("Wireless Serial Port Service") - 1,
139 "Wireless Serial Port Service",
140 };
141
142 const ServiceAttributeTable_t PROGMEM SerialPort_Attribute_Table[] =
143 {
144 {.AttributeID = SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE, .Data = &SerialPort_Attribute_ServiceHandle },
145 {.AttributeID = SDP_ATTRIBUTE_ID_SERVICECLASSIDS, .Data = &SerialPort_Attribute_ServiceClassIDs },
146 {.AttributeID = SDP_ATTRIBUTE_ID_PROTOCOLDESCRIPTORLIST, .Data = &SerialPort_Attribute_ProtocolDescriptor },
147 {.AttributeID = SDP_ATTRIBUTE_ID_BROWSEGROUPLIST, .Data = &SerialPort_Attribute_BrowseGroupList },
148 {.AttributeID = SDP_ATTRIBUTE_ID_LANGUAGEBASEATTROFFSET, .Data = &SerialPort_Attribute_LanguageBaseIDOffset},
149 {.AttributeID = SDP_ATTRIBUTE_ID_SERVICENAME, .Data = &SerialPort_Attribute_ServiceName },
150 {.AttributeID = SDP_ATTRIBUTE_ID_SERVICEDESCRIPTION, .Data = &SerialPort_Attribute_ServiceDescription },
151
152 SERVICE_ATTRIBUTE_TABLE_TERMINATOR
153 };