Add missing eol-style properties to new source files.
[pub/USBasp.git] / Demos / Host / Incomplete / BluetoothHost / Lib / RFCOMMControl.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 RFCOMMControl.c.
34 */
35
36 #ifndef _RFCOMM_CONTROL_H_
37 #define _RFCOMM_CONTROL_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <avr/pgmspace.h>
42 #include <string.h>
43 #include <stdbool.h>
44 #include <stdio.h>
45
46 #include <LUFA/Common/Common.h>
47 #include <LUFA/Drivers/Peripheral/SerialStream.h>
48
49 #include "BluetoothStack.h"
50 #include "RFCOMM.h"
51
52 /* Macros: */
53 #define RFCOMM_SIGNAL_FC (1 << 1)
54 #define RFCOMM_SIGNAL_RTC (1 << 2)
55 #define RFCOMM_SIGNAL_RTR (1 << 3)
56 #define RFCOMM_SIGNAL_IC (1 << 6)
57 #define RFCOMM_SIGNAL_DV (1 << 7)
58
59 #define RFCOMM_CONFIG_REMOTESIGNALS (1 << 0)
60 #define RFCOMM_CONFIG_LOCALSIGNALS (1 << 1)
61 #define RFCOMM_CONFIG_LOCALSIGNALSSENT (1 << 2)
62 #define RFCOMM_CONFIG_ABMMODESET (1 << 3)
63
64 /* Enums: */
65 enum RFCOMM_Control_Commands_t
66 {
67 RFCOMM_Control_Test = (0x20 >> 2),
68 RFCOMM_Control_FlowControlEnable = (0xA0 >> 2),
69 RFCOMM_Control_FlowControlDisable = (0x60 >> 2),
70 RFCOMM_Control_ModemStatus = (0xE0 >> 2),
71 RFCOMM_Control_RemotePortNegotiation = (0x90 >> 2),
72 RFCOMM_Control_RemoteLineStatus = (0x50 >> 2),
73 RFCOMM_Control_DLCParameterNegotiation = (0x80 >> 2),
74 RFCOMM_Control_NonSupportedCommand = (0x10 >> 2),
75 };
76
77 /* Type Defines: */
78 typedef struct
79 {
80 unsigned char EA : 1;
81 unsigned char CR : 1;
82 unsigned char DLCI : 6;
83 } RFCOMM_Address_t;
84
85 typedef struct
86 {
87 RFCOMM_Address_t Address;
88 uint8_t Control;
89 } RFCOMM_Header_t;
90
91 typedef struct
92 {
93 unsigned char EA : 1;
94 unsigned char CR : 1;
95 unsigned char Command : 6;
96 } RFCOMM_Command_t;
97
98 typedef struct
99 {
100 uint8_t DLCI;
101 unsigned char FrameType : 4;
102 unsigned char ConvergenceLayer : 4;
103 uint8_t Priority;
104 uint8_t ACKTimerTicks;
105 uint16_t MaximumFrameSize;
106 uint8_t MaxRetransmissions;
107 uint8_t RecoveryWindowSize;
108 } RFCOMM_DPN_Parameters_t;
109
110 typedef struct
111 {
112 RFCOMM_Address_t Channel;
113 uint8_t Signals;
114 uint8_t BreakSignal;
115 } RFCOMM_MSC_Parameters_t;
116
117 /* Function Prototypes: */
118 void RFCOMM_ProcessControlCommand(const uint8_t* Command, Bluetooth_Channel_t* const Channel);
119
120 #if defined(INCLUDE_FROM_RFCOMM_CONTROL_C)
121 static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t CommandDataLen,
122 const uint8_t* CommandData, Bluetooth_Channel_t* const ACLChannel);
123 static void RFCOMM_ProcessFCECommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
124 Bluetooth_Channel_t* const ACLChannel);
125 static void RFCOMM_ProcessFCDCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
126 Bluetooth_Channel_t* const ACLChannel);
127 static void RFCOMM_ProcessMSCCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t CommandDataLen,
128 const uint8_t* CommandData, Bluetooth_Channel_t* const ACLChannel);
129 static void RFCOMM_ProcessRPNCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
130 Bluetooth_Channel_t* const ACLChannel);
131 static void RFCOMM_ProcessRLSCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
132 Bluetooth_Channel_t* const ACLChannel);
133 static void RFCOMM_ProcessDPNCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
134 Bluetooth_Channel_t* const ACLChannel);
135 #endif
136
137 #endif