Branched trunk into MultiArch branch for future development of a multi-architecture...
[pub/USBasp.git] / Demos / BluetoothHost / 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, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 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
52 #define BLUETOOTH_CONNECTION_SUCCESSFUL 0x0000
53 #define BLUETOOTH_CONNECTION_REFUSED_RESOURCES 0x0004
54
55 #define BLUETOOTH_CONFIGURATION_SUCCESSFUL 0x0000
56 #define BLUETOOTH_CONFIGURATION_REJECTED 0x0002
57 #define BLUETOOTH_CONFIGURATION_UNKNOWNOPTIONS 0x0003
58
59
60 /* Type Defines: */
61 typedef struct
62 {
63 uint16_t ConnectionHandle;
64 uint16_t DataLength;
65 } Bluetooth_ACL_Header_t;
66
67 typedef struct
68 {
69 uint16_t PayloadLength;
70 uint16_t DestinationChannel;
71 } Bluetooth_DataPacket_Header_t;
72
73 typedef struct
74 {
75 uint8_t Code;
76 uint8_t Identifier;
77 uint16_t Length;
78 } Bluetooth_SignalCommand_Header_t;
79
80 typedef struct
81 {
82 uint16_t PSM;
83 uint16_t SourceChannel;
84 } Bluetooth_SignalCommand_ConnectionRequest_t;
85
86 typedef struct
87 {
88 uint16_t DestinationChannel;
89 uint16_t SourceChannel;
90 uint16_t Result;
91 uint16_t Status;
92 } Bluetooth_SignalCommand_ConnectionResponse_t;
93
94 typedef struct
95 {
96 uint16_t DestinationChannel;
97 uint16_t Flags;
98 uint8_t Options[];
99 } Bluetooth_SignalCommand_ConfigurationRequest_t;
100
101 typedef struct
102 {
103 uint16_t SourceChannel;
104 uint16_t Flags;
105 uint16_t Result;
106 uint8_t Config;
107 } Bluetooth_SignalCommand_ConfigurationResponse_t;
108
109 /* Function Prototypes: */
110 void Bluetooth_ProcessACLPackets(void);
111
112 #if defined(INCLUDE_FROM_BLUETOOTH_ACLPACKETS_C)
113 static inline void Bluetooth_ProcessSignalPacket_ConnectionRequest(Bluetooth_ACL_Header_t* ACLPacketHeader,
114 Bluetooth_DataPacket_Header_t* DataHeader,
115 Bluetooth_SignalCommand_Header_t* SignalCommandHeader);
116 static inline void Bluetooth_ProcessSignalPacket_ConfigurationRequest(Bluetooth_ACL_Header_t* ACLPacketHeader,
117 Bluetooth_DataPacket_Header_t* DataHeader,
118 Bluetooth_SignalCommand_Header_t* SignalCommandHeader);
119 #endif
120
121 #endif