X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/fd96b288824caaa3ee4e5e03887f016de9df80cf..6cfa3b7db8b5585a8443f457dcb728b65a7f7ffd:/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h index 20bc95696..5ab7a6f9f 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h @@ -35,29 +35,46 @@ #include #include "BluetoothHost.h" - #include "BluetoothHCICommands.h" - #include "BluetoothACLPackets.h" /* Macros: */ - #define BLUETOOTH_DATA_IN_PIPE 1 - #define BLUETOOTH_DATA_OUT_PIPE 2 - #define BLUETOOTH_EVENTS_PIPE 3 + #define BLUETOOTH_DATA_IN_PIPE 1 + #define BLUETOOTH_DATA_OUT_PIPE 2 + #define BLUETOOTH_EVENTS_PIPE 3 #define BLUETOOTH_MAX_OPEN_CHANNELS 2 - #define BLUETOOTH_CHANNELNUMBER_BASEOFFSET 0x0040 - #define CHANNEL_LOOKUP_BY_SOURCE true - #define CHANNEL_LOOKUP_BY_DESTINATION false + #define CHANNEL_PSM_SERVICEDISCOVERY 0x0001 + #define CHANNEL_PSM_UDP 0x0002 + #define CHANNEL_PSM_RFCOMM 0x0003 + #define CHANNEL_PSM_TCP 0x0004 + #define CHANNEL_PSM_IP 0x0009 + #define CHANNEL_PSM_FTP 0x000A + #define CHANNEL_PSM_HTTP 0x000C + #define CHANNEL_PSM_UPNP 0x0010 + #define CHANNEL_PSM_HIDP 0x0011 + + #define MAXIMUM_CHANNEL_MTU 255 /* Enums: */ - enum Bluetooth_Channel_State_t + enum BT_ChannelStates_t + { + Channel_Closed = 0, + Channel_WaitConnect = 1, + Channel_WaitConnectRsp = 2, + Channel_Config_WaitConfig = 3, + Channel_Config_WaitSendConfig = 4, + Channel_Config_WaitReqResp = 5, + Channel_Config_WaitResp = 6, + Channel_Config_WaitReq = 7, + Channel_Open = 8, + Channel_WaitDisconnect = 9, + }; + + enum Endpoint_ControlStream_RW_ErrorCodes_t { - Channel_Closed = 0, - Channel_WaitConnect = 1, - Channel_WaitConnectRsp = 2, - Channel_Config = 3, - Channel_Open = 4, - Channel_WaitDisconnect = 5, + BT_SENDPACKET_NoError = 0, + BT_SENDPACKET_NotConnected = 1, + BT_SENDPACKET_ChannelNotOpen = 2, }; /* Type Defines: */ @@ -67,7 +84,8 @@ uint16_t LocalNumber; uint16_t RemoteNumber; uint16_t PSM; - uint16_t MTU; + uint16_t LocalMTU; + uint16_t RemoteMTU; } Bluetooth_Channel_t; typedef struct @@ -76,6 +94,7 @@ uint16_t ConnectionHandle; uint8_t RemoteAddress[6]; Bluetooth_Channel_t Channels[BLUETOOTH_MAX_OPEN_CHANNELS]; + uint8_t SignallingIdentifier; } Bluetooth_Connection_t; typedef struct @@ -84,13 +103,23 @@ char PINCode[16]; char Name[]; } Bluetooth_Device_t; + + /* Includes: */ + #include "BluetoothHCICommands.h" + #include "BluetoothACLPackets.h" - /* Function Prototypes: */ - Bluetooth_Channel_t* Bluetooth_GetChannelData(uint16_t ChannelNumber, bool SearchBySource); - Bluetooth_Channel_t* Bluetooth_InitChannelData(uint16_t RemoteChannelNumber, uint16_t PSM); - - void Bluetooth_State_Init(void); - void Bluetooth_Stack_Task(void); + /* Function Prototypes: */ + void Bluetooth_Stack_Init(void); + void Bluetooth_Stack_USBTask(void); + + bool Bluetooth_ConnectionRequest(uint8_t* RemoteAddress); + void Bluetooth_ConnectionComplete(void); + void Bluetooth_DisconnectionComplete(void); + void Bluetooth_PacketReceived(uint16_t* PacketLength, Bluetooth_Channel_t* Channel); + Bluetooth_Channel_t* Bluetooth_GetChannelData(uint16_t ChannelNumber, bool SearchByRemoteChannel); + Bluetooth_Channel_t* Bluetooth_OpenChannel(uint16_t PSM); + void Bluetooth_CloseChannel(Bluetooth_Channel_t* Channel); + uint8_t Bluetooth_SendPacket(void* Data, uint16_t DataLen, Bluetooth_Channel_t* Channel); /* External Variables: */ extern Bluetooth_Device_t Bluetooth_DeviceConfiguration;