From a8373a417d87c495af2d9e657f6569f78e06021e Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Sun, 15 Nov 2015 21:34:05 +0100 Subject: [PATCH] collect Bluetooth defines from l2cap --- src/bluetooth.h | 33 +++++++++++++++++++++++++++++++++ src/l2cap.h | 34 +--------------------------------- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/src/bluetooth.h b/src/bluetooth.h index 37a7ec9ca..a22a40c0b 100644 --- a/src/bluetooth.h +++ b/src/bluetooth.h @@ -414,6 +414,39 @@ * L2CAP Layer */ +#define L2CAP_HEADER_SIZE 4 + +#define L2CAP_SIG_ID_INVALID 0 + +// size of HCI ACL + L2CAP Header for regular data packets (8) +#define COMPLETE_L2CAP_HEADER (HCI_ACL_HEADER_SIZE + L2CAP_HEADER_SIZE) + +// minimum signaling MTU +#define L2CAP_MINIMAL_MTU 48 +#define L2CAP_DEFAULT_MTU 672 + +// Minimum/default MTU +#define L2CAP_LE_DEFAULT_MTU 23 + +// L2CAP Fixed Channel IDs +#define L2CAP_CID_SIGNALING 0x0001 +#define L2CAP_CID_CONNECTIONLESS_CHANNEL 0x0002 +#define L2CAP_CID_ATTRIBUTE_PROTOCOL 0x0004 +#define L2CAP_CID_SIGNALING_LE 0x0005 +#define L2CAP_CID_SECURITY_MANAGER_PROTOCOL 0x0006 + +// L2CAP Configuration Result Codes +#define L2CAP_CONF_RESULT_UNKNOWN_OPTIONS 0x0003 + +// L2CAP Reject Result Codes +#define L2CAP_REJ_CMD_UNKNOWN 0x0000 + +// Response Timeout eXpired +#define L2CAP_RTX_TIMEOUT_MS 10000 + +// Extended Response Timeout eXpired +#define L2CAP_ERTX_TIMEOUT_MS 120000 + // Fixed PSM numbers #define PSM_SDP 0x01 #define PSM_RFCOMM 0x03 diff --git a/src/l2cap.h b/src/l2cap.h index 9f8554ed4..972cbe4a5 100644 --- a/src/l2cap.h +++ b/src/l2cap.h @@ -49,49 +49,17 @@ #include "hci.h" #include "l2cap_signaling.h" #include "utils.h" +#include "bluetooth.h" #if defined __cplusplus extern "C" { #endif -#define L2CAP_SIG_ID_INVALID 0 - -#define L2CAP_HEADER_SIZE 4 - -// size of HCI ACL + L2CAP Header for regular data packets (8) -#define COMPLETE_L2CAP_HEADER (HCI_ACL_HEADER_SIZE + L2CAP_HEADER_SIZE) - -// minimum signaling MTU -#define L2CAP_MINIMAL_MTU 48 -#define L2CAP_DEFAULT_MTU 672 - -// Minimum/default MTU -#define L2CAP_LE_DEFAULT_MTU 23 - // check L2CAP MTU #if (L2CAP_MINIMAL_MTU + L2CAP_HEADER_SIZE) > HCI_ACL_PAYLOAD_SIZE #error "HCI_ACL_PAYLOAD_SIZE too small for minimal L2CAP MTU of 48 bytes" #endif -// L2CAP Fixed Channel IDs -#define L2CAP_CID_SIGNALING 0x0001 -#define L2CAP_CID_CONNECTIONLESS_CHANNEL 0x0002 -#define L2CAP_CID_ATTRIBUTE_PROTOCOL 0x0004 -#define L2CAP_CID_SIGNALING_LE 0x0005 -#define L2CAP_CID_SECURITY_MANAGER_PROTOCOL 0x0006 - -// L2CAP Configuration Result Codes -#define L2CAP_CONF_RESULT_UNKNOWN_OPTIONS 0x0003 - -// L2CAP Reject Result Codes -#define L2CAP_REJ_CMD_UNKNOWN 0x0000 - -// Response Timeout eXpired -#define L2CAP_RTX_TIMEOUT_MS 10000 - -// Extended Response Timeout eXpired -#define L2CAP_ERTX_TIMEOUT_MS 120000 - // private structs typedef enum { L2CAP_STATE_CLOSED = 1, // no baseband