Fix MIT license language to make its intent clearer.
[pub/USBasp.git] / Demos / Host / Incomplete / BluetoothHost / Lib / BluetoothACLPackets.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 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 #ifndef _BLUETOOTH_ACLPACKETS_
32 #define _BLUETOOTH_ACLPACKETS_
33
34 /* Includes: */
35 #include <avr/io.h>
36 #include <string.h>
37 #include <stdbool.h>
38
39 #include <LUFA/Drivers/USB/USB.h>
40
41 #include "BluetoothStack.h"
42
43 /* Macros: */
44 #define BLUETOOTH_CHANNEL_SIGNALING 0x0001
45 #define BLUETOOTH_CHANNEL_CONNECTIONLESS 0x0002
46
47 #define BLUETOOTH_SIGNAL_CONNECTION_REQUEST 0x02
48 #define BLUETOOTH_SIGNAL_CONNECTION_RESPONSE 0x03
49 #define BLUETOOTH_SIGNAL_CONFIGURATION_REQUEST 0x04
50 #define BLUETOOTH_SIGNAL_CONFIGURATION_RESPONSE 0x05
51 #define BLUETOOTH_SIGNAL_INFORMATION_REQUEST 0x0A
52
53 #define BLUETOOTH_CONNECTION_SUCCESSFUL 0x0000
54 #define BLUETOOTH_CONNECTION_REFUSED_RESOURCES 0x0004
55
56 #define BLUETOOTH_CONFIGURATION_SUCCESSFUL 0x0000
57 #define BLUETOOTH_CONFIGURATION_REJECTED 0x0002
58 #define BLUETOOTH_CONFIGURATION_UNKNOWNOPTIONS 0x0003
59
60
61 /* Type Defines: */
62 typedef struct
63 {
64 uint16_t ConnectionHandle;
65 uint16_t DataLength;
66 } Bluetooth_ACL_Header_t;
67
68 typedef struct
69 {
70 uint16_t PayloadLength;
71 uint16_t DestinationChannel;
72 } Bluetooth_DataPacket_Header_t;
73
74 typedef struct
75 {
76 uint8_t Code;
77 uint8_t Identifier;
78 uint16_t Length;
79 } Bluetooth_SignalCommand_Header_t;
80
81 typedef struct
82 {
83 uint16_t PSM;
84 uint16_t SourceChannel;
85 } Bluetooth_SignalCommand_ConnectionRequest_t;
86
87 typedef struct
88 {
89 uint16_t DestinationChannel;
90 uint16_t SourceChannel;
91 uint16_t Result;
92 uint16_t Status;
93 } Bluetooth_SignalCommand_ConnectionResponse_t;
94
95 typedef struct
96 {
97 uint16_t DestinationChannel;
98 uint16_t Flags;
99 uint8_t Options[];
100 } Bluetooth_SignalCommand_ConfigurationRequest_t;
101
102 typedef struct
103 {
104 uint16_t SourceChannel;
105 uint16_t Flags;
106 uint16_t Result;
107 uint8_t Config;
108 } Bluetooth_SignalCommand_ConfigurationResponse_t;
109
110 /* Function Prototypes: */
111 void Bluetooth_ProcessACLPackets(void);
112
113 #if defined(INCLUDE_FROM_BLUETOOTH_ACLPACKETS_C)
114 static inline void Bluetooth_ProcessSignalPacket_ConnectionRequest(Bluetooth_ACL_Header_t* ACLPacketHeader,
115 Bluetooth_DataPacket_Header_t* DataHeader,
116 Bluetooth_SignalCommand_Header_t* SignalCommandHeader);
117 static inline void Bluetooth_ProcessSignalPacket_ConfigurationRequest(Bluetooth_ACL_Header_t* ACLPacketHeader,
118 Bluetooth_DataPacket_Header_t* DataHeader,
119 Bluetooth_SignalCommand_Header_t* SignalCommandHeader);
120 #endif
121
122 #endif